+------------------------------------------------------------------------ | | DISK-DRIVE 1541: ROM-LISTING | +------------------------------------------------------------------------ | | ROM-Comments were done by Frank Kontros, used with permission. | | | File Manager Routines: | | $C100/49408 Turn LED on for current drive | $C118/49432 Turn LED on | $C123/49443 Clear error flags | $C12C/49452 Prepare for LED flash after error | $C146/49478 Interpret command from computer | $C194/49556 Prepare error msg after executing command | $C1BD/49597 Erase input buffer | $C1C8/49608 Output error msg (track and sector 0) | $C1D1/49617 Check input line | $C1E5/49637 Check ':' on input line | $C1EE/49646 Check input line | $C268/49768 Search character in input buffer | $C2B3/49843 Check line length | $C2DC/49884 Clear flags for command input | $C312/49938 Preserve drive number | $C33C/49980 Search for drive number | $C368/50024 Get drive number | $C38F/50063 Reverse drive number | $C398/50072 Check given file type | $C3BD/50109 Check given drive number | $C3CA/50122 Verify drive number | $C440/50240 Flags for drive check | $C44F/50255 Search for file in directory | $C48B/50315 ? | $C4D8/50392 ? | $C5AC/50604 ? | $C63D/50749 Test and initalise drive | $C66E/50798 Name of file in directory buffer | $C688/50824 Copy filename to work buffer | $C6A6/50854 Search for end of name in command | $C6CE/50894 ? | $C6DE/50910 ? | $C7AC/51116 Clear Directory Output Buffer | $C7B7/51127 Create header with disk name | $C806/51206 Print 'blocks free.' | $C817/51223 'Blocks free.' | $C823/51235 Perform [S] - Scratch command | $C87D/51325 Erase file | $C8B6/51382 Erase dir entry | $C8C1/51393 Perform [D] - Backup command (Unused) | $C8C6/51398 Format disk | $C8F0/51440 Perform [C] - Copy command | $C9A1/51617 ? | $C9A7/51623 ? | $C9D5/51669 ? | $C9FA/51706 ? | $CA35/51765 ? | $CA88/51848 Perform [R] - Rename command | $CACC/51916 Check if file present | $CAF8/51960 Perform [M] - Memory command | $CB20/52000 M-R memory read | $CB50/52048 M-W memory write | $CB5C/52060 Perform [U] - User command | $CB84/52100 Open direct access channel, number | $CC1B/52251 Perform [B] - Block/Buffer command | $CC5D/52317 Block commands "AFRWEP" | $CC63/52323 Block command vectors | $CC6F/52335 Get parameters form block commands | $CCF2/52466 Decimal values 1, 10, 100 | $CCF5/52469 B-F block free | $CCFE/52478 ? | $CD03/52483 B-A block allocate | $CD36/52534 Read block to buffer | $CD3C/52540 Get byte from buffer | $CD42/52546 Read block from disk | $CD56/52566 B-R block read | $CD5F/52575 U1, Block read without changing buffer pointer | $CD73/52595 B-W block write | $CD97/52631 U2, Block write without changing buffer pointer | $CDA3/52643 B-E block execute | $CDBD/52669 B-P block pointer | $CDD2/52690 Open channel | $CDF2/52722 Check buffer number and open channel | $CE0E/52750 Set pointer for REL file | $CE2C/52780 ? | $CE6E/52846 Divide by 254 | $CE71/52849 Divide by 120 | $CED9/52953 Erase work storage | $CEE2/52962 Left shift 3-byte register twice | $CEE5/52965 Left shift 3-byte register once | $CEED/52973 Add 3-byte registers | $CEFA/52986 ? | $CF09/53001 ? | $CF1E/53022 ? | $CF8C/53132 Change buffer | $CF9B/53147 Write data in buffer | $CFF1/53233 Write data byte in buffer | $D005/53253 Perform [I] - Initalise command | $D00E/53262 Read BAM from disk | $D042/53314 Load BAM | $D075/53365 Calculate blocks free | $D09B/53403 ? | $D0AF/53423 ? | $D0C3/53443 Read block | $D0C7/53447 Write block | $D0EB/53483 Open channel for reading | $D107/53511 Open channel for writing | $D125/53541 Check for file type REL | $D12F/53551 Get buffer and channel numbers | $D137/53559 Get a byte from buffer | $D156/53590 Get byte and read next block | $D19D/53661 Write byte in buffer and block | $D1C6/53702 Increment buffer pointer | $D1D3/53715 Get drive number | $D1DF/53727 Find write channel and buffer | $D1E2/53730 Find read channel and buffer | $D227/53799 Close channel | $D25A/53850 Free buffer | $D28E/53902 Find buffer | $D2BA/53946 ? | $D2DA/53978 ? | $D307/54023 Close all channels | $D313/54035 Close all channels of other drives | $D339/54073 ? | $D37F/54143 Find channel and allocate | $D39B/54171 Get byte for output | $D44D/54349 Read next block | $D460/54368 Read block | $D464/54372 Write block | $D475/54389 Allocate buffer and read block | $D486/54406 Allocate new block | $D48D/54413 Write dir block | $D4C8/54472 Set buffer pointer | $D4DA/54490 Close internal channel | $D4E8/54504 Set buffer pointer | $D4F6/54518 Get byte from buffer | $D506/54534 Check track and sector numbers | $D552/54610 Get track and sector numbers for current job | $D55F/54623 Check for vaild track and sector numbers | $D572/54642 DOS mismatch error | $D586/54662 Read block | $D58A/54666 Write block | $D599/54681 Verify execution | $D5C6/54726 Additional attempts for read errors | $D676/54902 Move head by half a track | $D693/54931 Move head one track in or out | $D6A6/54950 Attempt command execution multiple times | $D6D0/54992 Transmit param to disk controller | $D6E4/55012 Enter file in dir | $D7B4/55220 OPEN command, secondary addr 15 | $D7C7/55239 -Check '*' Last file | $D7F3/55283 -Check '$' Directory | $D815/55317 -Check '#' Channel | $D8F5/55541 Open a file with overwriting (@) | $D940/55616 ? | $D9A0/55712 Open file for reading | $D9E3/55779 Open file for writing | $DA09/55817 Check file type and control mode | $DA2A/55850 Preparation for append | $DA55/55893 Open directory | $DAC0/56000 Close routine | $DB02/56066 Close file | $DB62/56162 Write last block | $DBA5/56229 Directory entry | $DC46/56390 Read block, allocate buffer | $DCB6/56502 Reset pointer | $DCDA/56538 Construct a new block | $DD8D/56717 Write byte in side-sector block | $DD95/56725 Manipulate flags | $DDA6/56742 ? | $DDAB/56747 Verify command code for writing | $DDB7/56759 ? | $DDF1/56817 Write a block of a REL file | $DDFD/56829 Write bytes for following track | $DE0C/56844 Get following track and sector numbers | $DE19/56857 Following track for last block | $DE2B/56875 buffer pointer to zero | $DE3B/56891 Get track and sector | $DE50/56912 Write | $DE57/56919 Read | $DE5E/56926 Write | $DE65/56933 Read | $DE6C/56940 Write | $DE73/56947 Read | $DE95/56981 Get following track and sector from buffer | $DEA5/56997 Copy buffer contents | $DEC1/57025 Erase buffer Y | $DED2/57042 Get side-sector number | $DEDC/57052 Set buffer pointer to side-sector | $DEE9/57065 Buffer pointer for side-sector | $DEF8/57080 Get side sector and buffer pointer | $DF1B/57115 Read side-sector | $DF21/57121 Write side-sector | $DF45/57157 Set buffer pointer in side-sector | $DF4C/57164 Calculate number of blocks in a REL file | $DF66/57190 Verify side-sector in buffer | $DF93/57235 Get buffer number | $DF9E/57246 ? | $DFB7/57271 ? | $DFC2/57282 ? | $DFD0/57296 Get next record iin REL file | $E03C/57404 Write block and read next block | $E07C/57468 Write a byte in a record | $E0AB/57515 Write byte in REL file | $E0F3/57587 Fill record with 0s | $E105/57605 Write buffer number in table | $E120/57632 Get byte from REL file | $E1CB/57803 Get last side-sector | $E207/57863 Perform [P] - Position command | $E2E2/58082 Divide data blocks into records | $E304/58116 Set pointer to next record | $E31C/58140 Expand side-sector | $E44E/58446 Write side-sector and allocate new | $E4FC/58620 Table of Error Messages: 00, Ok | $E500/58624 Error Message: 20,21,22,23,24,27, Read error | $E50B/58635 Error Message: 52, File too large | $E517/58647 Error Message: 50, Record not present | $E522/58658 Error Message: 51, Overflow in record | $E52F/58671 Error Message: 25,28, Write error | $E533/58675 Error Message: 26, Write protect on | $E540/58688 Error Message: 29, Disk id mismatch | $E546/58694 Error Message: 30,31,32,33,34, Syntax error | $E552/58706 Error Message: 60, Write file open | $E556/58710 Error Message: 63, File exists | $E55F/58719 Error Message: 64, File type mismatch | $E567/58727 Error Message: 65, No block | $E570/58736 Error Message: 66,67, Illegal track or sector | $E589/58761 Error Message: 61, File not open | $E58D/58765 Error Message: 39,62, File not found | $E592/58770 Error Message: 01, Files scratched | $E59F/58783 Error Message: 70, No channel | $E5AA/58794 Error Message: 71, Dir error | $E5AF/58799 Error Message: 72, Disk full | $E5B6/58806 Error Message: 73, Cbm dos v2.6 1541 | $E5C8/58824 Error Message: 74, Drive not ready | $E5D5/58837 Indexed words: 09 Error | $E5DB/58843 Indexed words: 0A Write | $E5E1/58849 Indexed words: 03 File | $E5E6/58854 Indexed words: 04 Open | $E5EB/58859 Indexed words: 05 Mismatch | $E5F4/58868 Indexed words: 06 Not | $E5F8/58872 Indexed words: 07 Found | $E5FE/58878 Indexed words: 08 Disk | $E603/58883 Indexed words: 0B Record | $E60A/58890 Prepare error number and message | $E645/58949 Print error message into error buffer | $E680/59008 TALK | $E688/59016 LISTEN | $E69B/59035 Convert BIN to 2-Ascii (error message buffer) | $E6AB/59051 Convert BCD to 2-Ascii (error message buffer) | $E6BC/59068 Write OK in buffer | $E6C1/59073 Print error on track 00,00 to error buffer | $E6C7/59079 Print error on current track to error buffer | $E706/59142 Write error message string to buffer | $E754/59220 Get character and in buffer | $E767/59239 Get a char of the error message | $E775/59253 Increment pointer | $E77F/59263 Dummy subroutine | $E780/59264 Check for auto start - removed | $E7A3/59299 Perform [&] - USR file execute command | $E84B/59467 Generate checksum | $E853/59475 IRQ routine for serial bus | $E85B/59483 Service the serial bus | $E909/59657 Send data | $E99C/59804 DATA OUT lo | $E9A5/59813 DATA OUT hi | $E9AE/59822 CLOCK OUT hi | $E9B7/59831 CLOCK OUT lo | $E9C0/59840 Read IEEE port | $E9C9/59849 Get data byte from bus | $E9F2/59890 Accept byte with EOI | $EA2E/59950 Accept data from serial bus | $EA59/59993 Test for ATN | $EA6E/60014 Flash LED for hardware defects, self-test | $EAA0/60064 Power-up RESET routine | $EBFF/60415 Wait loop | $EC9E/60574 Load dir | $ED23/60707 ? | $ED59/60761 Transmit dir line | $ED67/60775 Get byte from buffer | $ED84/60804 Perform [V] - Validate command | $EDB3/60851 ? | $EDE5/60901 Allocate file blocks in BAM | $EE0D/60941 Perform [N] - New (Format) command | $EEB7/61111 Create BAM | $EEF4/61172 Write BAM if needed | $EF3A/61242 Set buffer pointer for BAM | $EF4D/61261 Get number of free blocks for dir | $EF5C/61276 Mark block as free | $EF88/61320 Set flag for BAM changed | $EF90/61328 Mark block as allocated | $EFCF/61391 Erase bit for sector in BAM entry | $EFE9/61417 Powers of 2 | $EFF1/61425 Write BAM after change | $F005/61445 Erase BAM buffer | $F011/61457 ? | $F05B/61531 ? | $F0D1/61649 ? | $F0DF/61663 ? | $F10F/61711 Get buffer number for BAM | $F119/61721 Buffer number for BAM | $F11E/61726 Find and allocate free block | $F1A9/61865 Find free sector and allocate | $F1FA/61946 Find free sectors in current track | $F220/61984 Verify number of free blocks in BAM | $F24B/62027 Establish number of sectors per track | $F258/62040 Dummy subroutine | | Disk Controller Routines: | | $F259/62041 Initialise disk controller | $F2B0/62128 IRQ routine for disk controller | $F2F9/62201 Head transport | $F36E/62318 Execute program in buffer | $F37C/62332 Bump, find track 1 (head at stop) | $F393/62355 Initialise pointer in buffer | $F3B1/62385 Read block header, verify ID | $F410/62480 Preserve block header | $F418/62488 Work Return value 01 (OK) into queue | $F41B/62491 Work Return value 0B (READ ERROR) into queue | $F41E/62494 Work Return value 09 (READ ERROR) into queue | $F423/62499 Job optimisation | $F4CA/62666 Test command code further | $F4D1/62673 Read sector | $F50A/62730 Find start of data block | $F510/62736 Read block header | $F556/62806 Wait for SYNC | $F56E/62830 Test command code further | $F575/62837 Write data block to disk | $F5E9/62953 Calculate parity for data buffer | $F5F2/62962 Convert buffer of GCR data into binary | $F691/63121 Test command code further | $F698/63128 Compare written data with data on disk | $F6CA/63178 Command code for find sector | $F6D0/63184 Convert 4 binary bytes to 5 GCR bytes | $F77F/63359 GCR (5-bit) nybble table | $F78F/63375 Convert 260 bytes to 325 bytes group code | $F7E6/63462 Convert 5 GCR bytes to 4 binary bytes | $F8A0/63648 Conversion table GCR to binary - high nybble | $F8C0/63680 Conversion table GCR to binary - low nybble | $F8E0/63712 Decode 69 GCR bytes | $F934/63796 Convert block header to GCR code | $F969/63849 Error entry disk controller | $F97E/63870 Turn drive motor on | $F98F/63887 Turn drive motor off | $F99C/63900 Job loop disk controller | $F9CB/63947 ? | $F9D9/63961 ? | $FA05/64005 Move head to next track | $FA1C/64028 Calculate number of head steps | $FA3B/64059 Move stepper motor short distance | $FA4E/64078 Load head | $FA63/64099 ? | $FA7B/64123 Prepare fast head movement | $FA97/64151 Fast head movement | $FAA5/64165 Prepare slow head movement | $FAC7/64199 Formatting | $FDA3/64931 Write SYNC 10240 times, erase track | $FDC3/64963 Read/write ($621/$622) times | $FDD3/64979 Attempt counter for formatting | $FDE5/64997 ? | $FDF5/65013 Copy data from overflow buffer | $FE00/65024 Switch to reading | $FE0E/65038 Write $55 10240 times | $FE30/65072 Convert header in buffer 0 to GCR code | $FE67/65127 Interrupt routine | $FE85/65157 Constant: Directory track | $FE86/65158 Constant: Start of BAM | $FE87/65159 Constant: Length of BAM per track | $FE88/65160 Constant: End of BAM | $FE89/65161 Table of command words | $FE95/65173 Low byte of command addresses | $FEA1/65185 High byte of command addresses | $FEAD/65197 Bytes for syntax check | $FEB2/65202 File control methods "RWAM" | $FEB6/65206 File types "DSPUL" | $FEBB/65211 Names of file types: 1st letter "DSPUR" | $FEC0/65216 Names of file types: 2nd letter "EERSE" | $FEC5/65221 Names of file types: 3rd letter "LQGRL" | $FECA/65226 Error LED bit value | $FECD/65229 Masks for bit command | $FED1/65233 Number of sectors per track | $FED5/65237 'A' marker for 1541 format | $FED6/65238 4 track ranges | $FED7/65239 Number of tracks | $FED8/65240 Tracks on which sector numbers change | $FEDB/65243 Control bytes for head postion | $FEE0/65248 Buffer address high bytes | $FEE6/65254 ROM checksum | $FEE7/65255 From UI command $EB22, to reset (Without RAM/ROM test) | $FEEA/65258 Patch for diagnostic routine from $EA7A | $FEF3/65267 Delay loop for serial bus in 1541 mode, from $E97D | $FEFB/65275 Patch for data output to serial bus, from $E980 | $FF01/65281 U9 vector, switch 1540/1541 | $FF10/65296 Patch for reset routine, from $EAA4 | $FF20/65312 Patch for listen to serial bus, from $E9DC | $FF2F/65327 Unused | $FFE6/65510 Format [C8C6] | $FFE8/65512 Turn motor off [F98F] | $FFEA/65514 USER vectors: UA, U1 [CD5F] | $FFEC/65516 USER vectors: UB, U2 [CD97] | $FFEE/65518 USER vectors: UC, U3 [0500] | $FFF0/65520 USER vectors: UD, U4 [0503] | $FFF2/65522 USER vectors: UE, U5 [0506] | $FFF4/65524 USER vectors: UF, U6 [0509] | $FFF6/65526 USER vectors: UG, U7 [050C] | $FFF8/65528 USER vectors: UH, U8 [050F] | $FFFA/65530 USER vectors: UI, U9 [FF01] | $FFFC/65532 Hardware vectors: RESET [EAA0] | $FFFE/65534 Hardware vectors: IRQ [FE67] | +------------------------------------------------------------------------ |