; CBMXfer Disassembler, Platform File
; For Commodore 1541 Disk Drive
;-------------------------------------------------------------
; This was created by importing from ReGenerator, then adding
; a few extra locations
;-------------------------------------------------------------
0000,,Command code for buffer 0
0001,,Command code for buffer 1
0002,,Command code for buffer 2
0003,,Command code for buffer 3
0004,,Command code for buffer 4
0005,,Command code for buffer 5 (unused)
0006,,Track and sector for buffer 0
0008,,Track and sector for buffer 1
000a,,Track and sector for buffer 2
000c,,Track and sector for buffer 3
000e,,Track and sector for buffer 4
0010,,Track and sector for buffer 5 (unused)
0012,,Disk ID, drive 0
0014,,Disk ID, drive 1
0016,,Header block: ID
0018,,Header block: Track
0019,,Header block: Sector
001a,,Header block: Parity
001b,,Not used (Disk Controller work)
001c,,Flag for disk change, drive 0 [01]
001d,,Flag for disk change, drive 1 [01]
001e,,Flag for write protect sense, drive 0 [01]
001f,,Flag for write protect sense, drive 1
0020,,Drive 0 status (disk and step motor)
0021,,Drive 1 status (disk and step motor)
0022,,Current track for drive 0
0023,,Flag for 1541 (0), 1540 (not 0)
0024,,Scratch pad of GCR conversion
002e,,Pointer for temporary storage
0030,,Buffer pointer for disk controller
0032,,Pointer: *** active track
0033,,Pointer: *** active sector
0034,,Pointer to last converted byte
0035,,Not used (decode error, GCR)
0036,,Byte counter for GCR/BIN conversion
0037,,Not used (bit counter)
0038,,Constant 7, ID mark for start of  block
0039,,Constant 8, ID mark for start of block header
003a,,Parity for  buffer
003b,,Not directly used
003c,,Not directly used
003d,,Motor flag
003e,,Active drive (FF, if not active)
003f,,Buffer number for disk controller
0040,,Byte counter for GCR conversion
0041,,Number of next work in queue (0 - 5)
0042,,Destination track (to move R/W head to)
0043,,Number of sectors per track for formatting
0044,,Temp. work area; Scratch pad
0045,,Work code temp. storage
0046,,Not used
0047,,block ID char, default 07.
0048,,Counter for head movement
0049,,Stack pointer temp. storage [39]
004a,,Step counter for head transport
004c,,Last read sector
004d,,Next sector
004e,,Pointer to buffer for GCR->BIN conversion
0050,,Flag for GCR format (0=BIN, 1=GCR)
0051,,Current track number for formatting [FF]
0052,,Storage for 4 BIN bytes for GCR coding
0056,,Storage for 5 GCR bytes
005e,,Number of steps for head motor accelerating/decl. [04]
005f,,accelerating/decl. factor [04]
0062,,Pointer to routine for head movement [FA05]
0064,,Minimum number of steps [C8]
0065,,UI vector [$EB22]
0067,,Flag: NMI
0068,,Flag for disk initialisation
0069,,Step size for sector division [0A]
006a,,Number of read attempts [5]
006b,,Pointer: Start of Jump table for U commands [FFEA]
006d,,Pointer: Start of bitmap [0400]
006f,,Pointer to address for M & B commands
0071,,Temp. work area
0072,,Temp. work area [FF]
0073,,Temp. work area
0074,,Temp. work area
0075,,Indirect pointer [0100]
0077,,Listener address (Device number + $20) [28]
0078,,Talker address (Device number + $40) [48]
0079,,Flag: Active listener
007a,,Flag: Active talker
007c,,Flag for ATN from serial bus receiving
007d,,Flag for ATN on serial bus active
007e,,Last handled program
007f,,Drive number (on 1541 always 00)
0080,,Current Track number
0081,,Current Sector number
0082,,Channel number (Logical index)
0083,,Secondary address
0084,,Original Secondary address [6F]
0085,,Current  byte [3F]
0086,,Temp Results
008b,,Work storage for division
0094,,Current buffer pointer
0099,,Pointer: Next byte in buffer 0 [0300]
009b,,Pointer: Next byte in buffer 1 [0400]
009d,,Pointer: Next byte in buffer 2 [0500]
009f,,Pointer: Next byte in buffer 3 [0600]
00a1,,Pointer: Next byte in buffer 4 [0700]
00a3,,Pointer: Next byte in command buffer [0200]
00a5,,Pointer: Next byte in error message buffer [02D6]
00a7,,Table: Non-active channel numbers for each buffer
00ae,,Table:
00b5,,Table: Record # low , block # low
00bb,,Table: Record # high, block # high
00c1,,Write pointer for REL file
00c7,,Table: Record length for REL file
00cd,,Table: Side sectors
00d4,,Pointer in record for REL file
00d5,,Side sector number
00d6,,Pointer to  block in side sector
00d7,,Pointer to record in REL file
00d8,,Directory sectors
00dd,,Index: Directory
00e2,,Default disk drive [00]
00e7,,File type (wild cards, @, closed)
00ec,,File type (channel)
00f2,,Channel status
00f8,,Flag for EOI
00f9,,Current work (Buffer number)
00fa,,Last used table
00ff,,Flag: FF = drive 0 not ready (No disk), 00 = ready
0100,,Flag: FF = drive 1 not ready (No disk), 00 = ready
0101,,Format marker, drive 0
0102,,Format marker, drive 1
0103,,Not used
0104,,Stack area
01ba,,Buffer for GCR code
0200,,Buffer for command string
022a,,Command code
022b,,Logical index, channel 0
022c,,Logical index, channel 1
022d,,Logical index, channel 2
022e,,Last read/written byte for each channel
0244,,Pointer: Last char on channel.
024a,,Type of active file
024b,,String length
024c,,Temp. channel number (secondary address)
024d,,Current work with drive number
024e,,Work area to find the best sector
024f,,Buffer allocated
0251,,Flag: BAM changed, drive 0
0252,,Flag: BAM changed, drive 1
0253,,Flag for directory entry found (FF = Not found, 00 = Found)
0254,,Flag for directory output
0255,,Flag: Waiting for command
0257,,Last used buffer
0258,,Record length
0259,,Track of side sector
025a,,Sector of side sector
025b,,Last work (buffers)
0260,,Directory sector (buffers)
0266,,File's index in directory (buffers)
026c,,Counter for LED flash
026d,,Error LED
026e,,Drive for last program
026f,,sector for last program
0270,,Write LINDX
0271,,Read LINDX
0272,,Number of blocks (temp)
0274,,Length of input line
0275,,Char to interpret
0276,,Index: End of filename in command buffer
0278,,Number of file names
027a,,Pointer table: Filenames
0280,,Track of a file
0285,,Sector of a file
028a,,Flag: wild cards
028c,,Number of drive(s ?) to look for
028d,,Flag: Looking for drive
028e,,drive with last write/open error, used as default drive
028f,,Flag: Found in directory
0290,,Directory sector
0291,,Sector for first available file
0292,,Index (in directory) for first available file
0293,,For the last directory entry 0
0294,,Current buffer-index
0295,,Counter: Files
0296,,Flag: Name matching wild cards
0297,,Active operating mode (R or W)
0298,,Flag: Work return
0299,,Pointer: Re-read error
029a,,Total tracks
029b,,Pointer: BAM last update
029d,,BAM: image sector (drives 0 and 1)
02a1,,BAM image
02b1,,Buffer for directory output
02d5,,Buffer for error message
02f9,,Flag: Don't write BAM
02fa,,Number of free blocks, low byte for drives 0 ja 1
02fc,,Number of free blocks, hi byte for drives 0 ja 1
02fe,,Stepper motor sequence
0300,,Buffer 0
0400,,Buffer 1
0500,,Buffer 2
0600,,Buffer 3
0621,,Formatting counter
0700,,Buffer 4
07ff,,End of RAM
1800,,PB, port B
1801,,PA, port A
1802,,CB,  direction port B
1803,,CA,  direction port A
1805,,Timer
1C00,,PB, control port B
1C01,,PA, port A ( to and from read/write head)
1C02,,CB,  direction port B
1C03,,CA,  direction port A
;---- ROM
c100,,$C100 Turn LED on for current drive
c118,,$C118 Turn LED on
c123,,$C123 Clear error flags
c12c,,$C12C Prepare for LED flash after error
c146,,$C146 Interpret command from computer
c194,,$C194 Prepare error msg after executing command
c1bd,,$C1BD Erase input buffer
c1c8,,$C1C8 Output error msg (track and sector 0)
c1d1,,$C1D1 Check input line
c1e5,,$C1E5 Check ':' on input line
c1ee,,$C1EE Check input line
c268,,$C268 Search character in input buffer
c2b3,,$C2B3 Check line length
c2dc,,$C2DC Clear flags for command input
c312,,$C312 Preserve drive number
c33c,,$C33C Search for drive number
c368,,$C368 Get drive number
c38f,,$C38F Reverse drive number
c398,,$C398 Check given file type
c3bd,,$C3BD Check given drive number
c3ca,,$C3CA Verify drive number
c440,,Flags for drive check
c44f,,$C44F Search for file in directory
c63d,,$C63D Test and initalise drive
c66e,,$C66E Name of file in directory buffer
c688,,$C688 Copy filename to work buffer
c6a6,,$C6A6 Search for end of name in command
c7ac,,$C7AC Clear Directory Output Buffer
c7b7,,$C7B7 Create header with disk name
c806,,$C806 Print 'blocks free.'
c817,,'Blocks free.'
c823,,$C823 Perform [S] - Scratch command
c87d,,$C87D Erase file
c8b6,,$C8B6 Erase dir entry
c8c1,,$C8C1 Perform [D] - Backup command (Unused)
c8c6,,$C8C6 Format disk
c8f0,,$C8F0 Perform [C] - Copy command
ca88,,$CA88 Perform [R] - Rename command
cacc,,$CACC Check if file present
caf8,,$CAF8 Perform [M] - Memory command
cb20,,$CB20 M-R memory read
cb50,,$CB50 M-W memory write
cb5c,,$CB5C Perform [U] - User command
cb84,,$CB84 Open direct access channel, number
cc1b,,$CC1B Perform [B] - Block/Buffer command
cc5d,,Block commands "AFRWEP"
cc63,,Block command vectors
cc6f,,$CC6F Get parameters form block commands
ccf2,,Decimal values  1, 10, 100
ccf5,,$CCF5 B-F block free
cd03,,$CD03 B-A block allocate
cd36,,$CD36 Read block to buffer
cd3c,,$CD3C Get byte from buffer
cd42,,$CD42 Read block from disk
cd56,,$CD56 B-R block read
cd5f,,$CD5F U1, Block read without changing buffer pointer
cd73,,$CD73 B-W block write
cd97,,$CD97 U2, Block write without changing buffer pointer
cda3,,$CDA3 B-E block execute
cdbd,,$CDBD B-P block pointer
cdd2,,$CDD2 Open channel
cdf2,,$CDF2 Check buffer number and open channel
ce0e,,$CE0E Set pointer for REL file
ce6e,,$CE6E Divide by 254
ce71,,$CE71 Divide by 120
ced9,,$CED9 Erase work storage
cee2,,$CEE2 Left shift 3-byte register twice
cee5,,$CEE5 Left shift 3-byte register once
ceed,,$CEED Add 3-byte registers
cf8c,,$CF8C Change buffer
cf9b,,$CF9B Write data in buffer
cff1,,$CFF1 Write data byte in buffer
d005,,$D005 Perform [I] - Initalise command
d00e,,$D00E Read BAM from disk
d042,,$D042 Load BAM
d075,,$D075 Calculate blocks free
d0c3,,$D0C3 Read block
d0c7,,$D0C7 Write block
d0eb,,$D0EB Open channel for reading
d107,,$D107 Open channel for writing
d125,,$D125 Check for file type REL
d12f,,$D12F Get buffer and channel numbers
d137,,$D137 Get a byte from buffer
d156,,$D156 Get byte and read next block
d19d,,$D19D Write byte in buffer and block
d1c6,,$D1C6 Increment buffer pointer
d1d3,,$D1D3 Get drive number
d1df,,$D1DF Find write channel and buffer
d1e2,,$D1E2 Find read channel and buffer
d227,,$D227 Close channel
d25a,,$D25A Free buffer
d28e,,$D28E Find buffer
d307,,$D307 Close all channels
d313,,$D313 Close all channels of other drives
d37f,,$D37F Find channel and allocate
d39b,,$D39B Get byte for output
d44d,,$D44D Read next block
d460,,$D460 Read block
d464,,$D464 Write block
d475,,$D475 Allocate buffer and read block
d486,,$D486 Allocate new block
d48d,,$D48D Write dir block
d4c8,,$D4C8 Set buffer pointer
d4da,,$D4DA Close internal channel
d4e8,,$D4E8 Set buffer pointer
d4f6,,$D4F6 Get byte from buffer
d506,,$D506 Check track and sector numbers
d552,,$D552 Get track and sector numbers for current job
d55f,,$D55F Check for vaild track and sector numbers
d572,,$D572 DOS mismatch error
d586,,$D586 Read block
d58a,,$D58A Write block
d599,,$D599 Verify execution
d5c6,,$D5C6 Additional attempts for read errors
d676,,$D676 Move head by half a track
d693,,$D693 Move head one track in or out
d6a6,,$D6A6 Attempt command execution multiple times
d6d0,,$D6D0 Transmit param to disk controller
d6e4,,$D6E4 Enter file in dir
d7b4,,$D7B4 OPEN command, secondary addr 15
d7c7,,$D7C7 -Check '*' Last file
d7f3,,$D7F3 -Check '$' Directory
d815,,$D815 -Check '#' Channel
d8f5,,$D8F5 Open a file with overwriting (@)
d9a0,,$D9A0 Open file for reading
d9e3,,$D9E3 Open file for writing
da09,,$DA09 Check file type and control mode
da2a,,$DA2A Preparation for append
da55,,$DA55 Open directory
dac0,,$DAC0 Close routine
db02,,$DB02 Close file
db62,,$DB62 Write last block
dba5,,$DBA5 Directory entry
dc46,,$DC46 Read block, allocate buffer
dcb6,,$DCB6 Reset pointer
dcda,,$DCDA Construct a new block
dd8d,,$DD8D Write byte in side-sector block
dd95,,$DD95 Manipulate flags
ddab,,$DDAB Verify command code for writing
ddf1,,$DDF1 Write a block of a REL file
ddfd,,$DDFD Write bytes for following track
de0c,,$DE0C Get following track and sector numbers
de19,,$DE19 Following track for last block
de2b,,$DE2B buffer pointer to zero
de3b,,$DE3B Get track and sector
de50,,$DE50 Write (?)
de57,,$DE57 R
de5e,,$DE5E W
de65,,$DE65 R
de6c,,$DE6C W
de73,,$DE73 R
de95,,$DE95 Get following track and sector from buffer
dea5,,$DEA5 Copy buffer contents
dec1,,$DEC1 Erase buffer Y
ded2,,$DED2 Get side-sector number
dedc,,$DEDC Set buffer pointer to side-sector
dee9,,$DEE9 Buffer pointer for side-sector
def8,,$DEF8 Get side sector and buffer pointer
df1b,,$DF1B Read side-sector
df21,,$DF21 Write side-sector
df45,,$DF45 Set buffer pointer in side-sector
df4c,,$DF4C Calculate number of blocks in a REL file
df66,,$DF66 Verify side-sector in buffer
df93,,$DF93 Get buffer number
dfd0,,$DFD0 Get next record iin REL file
e03c,,$E03C Write block and read next block
e07c,,$E07C Write a byte in a record
e0ab,,$E0AB Write byte in REL file
e0f3,,$E0F3 Fill record with 0s
e105,,$E105 Write buffer number in table
e120,,$E120 Get byte from REL file
e1cb,,$E1CB Get last side-sector
e207,,$E207 Perform [P] - Position command
e2e2,,$E2E2 Divide data blocks into records
e304,,$E304 Set pointer to next record
e31c,,$E31C Expand side-sector
e44e,,$E44E Write side-sector and allocate new
e4fc,,Table of error messages
e5d5,,Indexed s
e60a,,$E60A Prepare error number and message
e645,,$E645 Print error message into error buffer
e680,,$E680 TALK
e688,,$E688 LISTEN
e69b,,$E69B Convert BIN to 2-Ascii (error message buffer)
e6ab,,$E6AB Convert BCD to 2-Ascii (error message buffer)
e6bc,,$E6BC Write OK in buffer
e6c1,,$E6C1 Print error on track 00,00 to error buffer
e6c7,,$E6C7 Print error on current track to error buffer
e706,,$E706 Write error message string to buffer
e754,,$E754 Get character and in buffer
e767,,$E767 Get a char of the error message
e775,,$E775 Increment pointer
e77f,,$E77F Dummy subroutine
e780,,$E780 Check for auto start - removed
e7a3,,$E7A3 Perform [&] - USR file execute command
e84b,,$E84B Generate checksum
e853,,$E853 IRQ routine for serial bus
e85b,,$E85B Service the serial bus
e909,,$E909 Send data
e99c,,$E99C DATA OUT lo
e9a5,,$E9A5 DATA OUT hi
e9ae,,$E9AE CLOCK OUT hi
e9b7,,$E9B7 CLOCK OUT lo
e9c0,,$E9C0 Read IEEE port
e9c9,,$E9C9 Get data byte from bus
e9f2,,$E9F2 Accept byte with EOI
ea2e,,$EA2E Accept data from serial bus
ea59,,$EA59 Test for ATN
ea6e,,$EA6E Flash LED for hardware defects, self-test
eaa0,,$EAA0 Power-up RESET routine
ebff,,$EBFF Wait loop
ec9e,,$EC9E Load dir
ed59,,$ED59 Transmit dir line
ed67,,$ED67 Get byte from buffer
ed84,,$ED84 Perform [V] - Validate command
ede5,,$EDE5 Allocate file blocks in BAM
ee0d,,$EE0D Perform [N] - New (Format) command
eeb7,,$EEB7 Create BAM
eef4,,$EEF4 Write BAM if needed
ef3a,,$EF3A Set buffer pointer for BAM
ef4d,,$EF4D Get number of free blocks for dir
ef5c,,$EF5C Mark block as free
ef88,,$EF88 Set flag for BAM changed
ef90,,$EF90 Mark block as allocated
efcf,,$EFCF Erase bit for sector in BAM entry
efe9,,Powers of 2
eff1,,$EFF1 Write BAM after change
f005,,$F005 Erase BAM buffer
f0d1,,$F0D1 Clear BAM               ?
f10f,,$F10F Get buffer number for BAM
f119,,$F119 Buffer number for BAM
f11e,,$F11E Find and allocate free block
f1a9,,$F1A9 Find free sector and allocate
f1fa,,$F1FA Find free sectors in current track
f220,,$F220 Verify number of free blocks in BAM
f24b,,$F24B Establish number of sectors per track
f258,,$F258 Dummy subroutine
f259,,$F259 Initialise disk controller
f2b0,,$F2B0 IRQ routine for disk controller
f2f9,,$F2F9 Head transport
f36e,,$F36E Execute program in buffer
f37c,,$F37C Bump, find track 1 (head at stop)
f393,,$F393 Initialise pointer in buffer
f3b1,,$F3B1 Read block header, verify ID
f410,,$F410 Preserve block header
f418,,$F418 Work Return value 01 (OK) into queue
f41b,,$F41B Work Return value 0B (READ ERROR) into queue
f41e,,$F41E Work Return value 09 (READ ERROR) into queue
f423,,$F423 Job optimisation
f4ca,,$F4CA Test command code further
f4d1,,$F4D1 Read sector
f50a,,$F50A Find start of data block
f510,,$F510 Read block header
f556,,$F556 Wait for SYNC
f56e,,$F56E Test command code further
f575,,$F575 Write data block to disk
f5e9,,$F5E9 Calculate parity for data buffer
f5f2,,$F5F2 Convert buffer of GCR data into binary
f691,,$F691 Test command code further
f698,,$F698 Compare written data with data on disk
f6ca,,$F6CA Command code for find sector
f6d0,,$F6D0 Convert 4 binary bytes to 5 GCR bytes
f77f,,GCR (5-bit) nybble table
f78f,,$F78F Convert 260 bytes to 325 bytes group code
f7e6,,$F7E6 Convert 5 GCR bytes to 4 binary bytes
f8a0,,$F8A0 Conversion table GCR to binary - high nybble
f8c0,,$F8C0 Conversion table GCR to binary - low nybble
f8e0,,$F8E0 Decode 69 GCR bytes
f934,,$F934 Convert block header to GCR code
f969,,$F969 Error entry disk controller
f97e,,$F97E Turn drive motor on
f98f,,$F98F Turn drive motor off
f99c,,$F99C Job loop disk controller
fa05,,$FA05 Move head to next track
fa1c,,$FA1C Calculate number of head steps
fa3b,,$FA3B Move stepper motor short distance
fa4e,,$FA4E Load head
fa7b,,$FA7B Prepare fast head movement
fa97,,$FA97 Fast head movement
faa5,,$FAA5 Prepare slow head movement
fac7,,$FAC7 Formatting
fda3,,$FDA3 Write SYNC 10240 times, erase track
fdc3,,$FDC3 Read/write ($621/$622) times
fdd3,,$FDD3 Attempt counter for formatting
fdf5,,$FDF5 Copy data from overflow buffer
fe00,,$FE00 Switch to reading
fe0e,,$FE0E Write $55 10240 times
fe30,,$FE30 Convert header in buffer 0 to GCR code
fe67,,$FE67 Interrupt routine
fe85,,Directory track
fe86,,Start of bam
fe87,,Length of bam per track
fe88,,End of bam
fe89,,Table of command s
fe95,,Low  byte of command addresses
fea1,,High byte of command addresses
fead,,Bytes for syntax check
feb2,,File control methods "RWAM"
feb6,,File types "DSPUL"
febb,,Names of file types
fec0,,2nd letter "EERSE"
fec5,,3rd letter "LQGRL"
feca,,Error LED bit value
fecd,,Masks for bit command
fed1,,Number of sectors per track
fed5,,Constands for disk format
fed6,,4 track ranges
fed7,,Number of tracks
fed8,,Tracks on which sector numbers change
fedb,,Control bytes for head postion
fee0,,Buffer address high bytes
fee6,,ROM checksum
fee7,,$FEE7 From UI command $EB22, to reset
feea,,$FEEA Patch for diagnostic routine from $EA7A
fef3,,$FEF3 Delay loop for serial bus in 1541 mode, from $E97D
fefb,,$FEFB Patch for data output to serial bus, from $E980
ff01,,$FF01 U9 vector, switch 1540/1541
ff10,,$FF10 Patch for reset routine, from $EAA4
ff20,,$FF20 Patch for listen to serial bus, from $E9DC
ffe6,,Format  [C8C6]
ffe8,,Turn motor off [F98F]
ffea,,USER vectors
ffec,,UB, U2  [CD97]
ffee,,UC, U3  [0500]
fff0,,UD, U4  [0503]
fff2,,UE, U5  [0506]
fff4,,UF, U6  [0509]
fff6,,UG, U7  [050C]
fff8,,UH, U8  [050F]
fffa,,UI, U9  [FF01]
FFFC,RESET,Processor RESET Vector
FFFE,IRQ,Processor IRQ/BRK Vector