AS V1.42 Beta [Bld 222] - Source File 9895.asm - Page 1 - 06/27/2022 08:12:57 PM 1/ 0 : ; HP 9895A floppy disk firmware 2/ 0 : ; Partially reverse-engineered by Eric Smith 3/ 0 : ; and Craig Ruff 4/ 0 : 5/ 0 : ; Cross-assembles with Macro Assembler AS: 6/ 0 : ; http://john.ccac.rwth-aachen.de:8000/as/ 7/ 0 : 8/ 0 : page 0 9/ 0 : cpu z80undoc 10/ 0 : 11/ 0 : include macros.inc (1) 1/ 0 : ; HP 9895A floppy disk firmware (1) 2/ 0 : ; Partially reverse-engineered by Eric Smith (1) 3/ 0 : ; and Craig Ruff (1) 4/ 0 : (1) 5/ 0 : ; Cross-assembles with Macro Assembler AS: (1) 6/ 0 : ; http://john.ccac.rwth-aachen.de:8000/as/ (1) 7/ 0 : (1) 8/ 0 : fillto macro endaddr, value (1) 9/ 0 : db (endaddr-$) dup (value) (1) 10/ 0 : endm (1) 11/ 0 : (1) 12/ 0 : bmask function msb, lsb, ((1<<(msb-lsb+1))-1)< (1) 3/ 0 : ; and Craig Ruff (1) 4/ 0 : (1) 5/ 0 : ; Cross-assembles with Macro Assembler AS: (1) 6/ 0 : ; http://john.ccac.rwth-aachen.de:8000/as/ (1) 7/ 0 : (1) 8/ 0 : ; PHI chip (Processor to Hpib Interface) I/O ports (1) 9/ 0 : (1) 10/ 0 : ; Marketing blurb about PHI chip: (1) 11/ 0 : ; Hewlett-Packard Computer Advances, Volume 2 Number 4, November 1977 (1) 12/ 0 : ; included in Computerworld, Volume XI Number 46, November 14, 1977 (1) 13/ 0 : ; (1) 14/ 0 : ; General description of the PHI chip: (1) 15/ 0 : ; "PHI, the HP-IB Interface Chip", John W. Figueroa, (1) 16/ 0 : ; Hewlett Packard Journal, Volume 29 Number 11, July 1978, pp. 16-16 (1) 17/ 0 : ; (1) 18/ 0 : ; Detailed information about PHI chip: (1) 19/ 0 : ; "HP 12009A HP-IB Interface Reference Manual", (1) 20/ 0 : ; manual part number 12009-90001, September 1982 (1) 21/ 0 : (1) 22/ 0 : ; Note that HP 12009A inverts address A1 (A14 in HP numbering), so (1) 23/ 0 : ; register numbering doesn't match that documentation. (1) 24/ 0 : (1) 25/ 0 : ; The 9895A uses the PHI in the 8-bit mode, so the D0 (bit 9) and D1 (bit 8) bits (1) 26/ 0 : ; in these registers must be indirectly accessed via the phi_status register (1) 27/ 0 : ; "high order bit access" bits 7 and 6. (1) 28/ 0 : (1) 29/ 0 : =10H phi_int_cond port 10h ; PHI register 2 (HP 12009A numbering) (1) 30/ 0 : (MACRO) bdef 7, INT_PEND ; bit D0: interrupt pending (in phi_status) (1) 30/ 0 : =7H equ INT_PEND, 7 (1) 30/ 0 : =80H equ INT_PEND_m, 1 << 7 (1) 31/ 0 : (MACRO) bdef 6, PRTY_ERR ; bit D1: parity error (in phi_status) (1) 31/ 0 : =6H equ PRTY_ERR, 6 (1) 31/ 0 : =40H equ PRTY_ERR_m, 1 << 6 (1) 32/ 0 : (MACRO) bdef 7, STAT_CHNG ; bit 7: status change (1) 32/ 0 : =7H equ STAT_CHNG, 7 (1) 32/ 0 : =80H equ STAT_CHNG_m, 1 << 7 (1) 33/ 0 : (MACRO) bdef 6, PROC_ABRT ; bit 6: processor handshake abort (1) 33/ 0 : =6H equ PROC_ABRT, 6 (1) 33/ 0 : =40H equ PROC_ABRT_m, 1 << 6 (1) 34/ 0 : (MACRO) bdef 5, PP_RESP ; bit 5: parallel poll response (1) 34/ 0 : =5H equ PP_RESP, 5 (1) 34/ 0 : =20H equ PP_RESP_m, 1 << 5 (1) 35/ 0 : (MACRO) bdef 4, SERV_RQST ; bit 4: service request (1) 35/ 0 : =4H equ SERV_RQST, 4 (1) 35/ 0 : =10H equ SERV_RQST_m, 1 << 4 (1) 36/ 0 : (MACRO) bdef 3, FIFO_ROOM ; bit 3: fifo room available (1) 36/ 0 : =3H equ FIFO_ROOM, 3 (1) 36/ 0 : =8H equ FIFO_ROOM_m, 1 << 3 (1) 37/ 0 : (MACRO) bdef 2, FIFO_BYTE ; bit 2: fifo bytes available (1) 37/ 0 : =2H equ FIFO_BYTE, 2 (1) 37/ 0 : =4H equ FIFO_BYTE_m, 1 << 2 (1) 38/ 0 : (MACRO) bdef 1, FIFO_IDLE ; bit 1: fifo idle (1) 38/ 0 : =1H equ FIFO_IDLE, 1 (1) 38/ 0 : =2H equ FIFO_IDLE_m, 1 << 1 (1) 39/ 0 : (MACRO) bdef 0, DEV_CLR ; bit 0: device clear (1) 39/ 0 : =0H equ DEV_CLR, 0 (1) 39/ 0 : =1H equ DEV_CLR_m, 1 << 0 (1) 40/ 0 : (1) 41/ 0 : =11H phi_int_mask port 11h ; PHI register 3 (HP 12009A numbering) (1) 42/ 0 : (MACRO) bdef 7, INT_ENAB ; bit D0: INT ENAB (1) 42/ 0 : =7H equ INT_ENAB, 7 (1) 42/ 0 : =80H equ INT_ENAB_m, 1 << 7 (1) 43/ 0 : ; bits D1,7..0: interrupt mask corresponding to phi_int_cond bits (1) 44/ 0 : (1) 45/ 0 : =12H phi_fifo port 12h ; PHI register 0 (HP 12009A numbering) (1) 46/ 0 : ; bit 15..14: 00 - RX/TX normal data (1) 47/ 0 : ; 01 - RX secondary address (1) 48/ 0 : ; 01 - TX interface command (1) 49/ 0 : ; 10 - TX byte count (controller) (1) 50/ 0 : ; 11 - RX end (1) 51/ 0 : ; 11 - TX uncounted transfer enable (1) 52/ 0 : ; bits 7..0: data (1) 53/ 0 : ; inbound fifo has 8 entries (1) 54/ 0 : ; outbound fifo has 8 entries (1) 55/ 0 : (1) 56/ 0 : (MACRO) bdef 7, OUT_END ; out (D0) assert END with this byte (EOI) (1) 56/ 0 : =7H equ OUT_END, 7 (1) 56/ 0 : =80H equ OUT_END_m, 1 << 7 (1) 57/ 0 : (1) 58/ 0 : =0C0H equ IN_EOI, 0c0h ; last byte of record (EOI) (1) 59/ 0 : (MACRO) bdef 6, SAD_D1 ; in (D1) SAD received (1) 59/ 0 : =6H equ SAD_D1, 6 (1) 59/ 0 : =40H equ SAD_D1_m, 1 << 6 (1) 60/ 0 : (MACRO) bdef 5, TLK ; in Received SAD is a talk address (1) 60/ 0 : =5H equ TLK, 5 (1) 60/ 0 : =20H equ TLK_m, 1 << 5 (1) 61/ 0 : (MACRO) bfield 4, 0, SAD ; in The SAD (1) 61/ 0 : =1FH equ SAD_m, bmask(4, 0) (1) 61/ 0 : =0H equ SAD_shift, 0 (1) 62/ 0 : (1) 63/ 0 : =13H phi_status port 13h ; PHI register 1 (HP 12009A numbering) (1) 64/ 0 : (MACRO) bfield 7, 6, D0D1 ; bits 7..6: high order bit access (1) 64/ 0 : =0C0H equ D0D1_m, bmask(7, 6) (1) 64/ 0 : =6H equ D0D1_shift, 6 (1) 65/ 0 : (MACRO) bdef 1, D0 (1) 65/ 0 : =1H equ D0, 1 (1) 65/ 0 : =2H equ D0_m, 1 << 1 (1) 66/ 0 : (MACRO) bdef 6, D1 (1) 66/ 0 : =6H equ D1, 6 (1) 66/ 0 : =40H equ D1_m, 1 << 6 (1) 67/ 0 : (MACRO) bdef 5, REM ; bit 5: Remote state (1) 67/ 0 : =5H equ REM, 5 (1) 67/ 0 : =20H equ REM_m, 1 << 5 (1) 68/ 0 : (MACRO) bdef 4, HPIB_CTRL ; bit 4: HP-IB Controller (1) 68/ 0 : =4H equ HPIB_CTRL, 4 (1) 68/ 0 : =10H equ HPIB_CTRL_m, 1 << 4 (1) 69/ 0 : (MACRO) bdef 3, SYST_CTRL ; bit 3: HP-IB System Controller (1) 69/ 0 : =3H equ SYST_CTRL, 3 (1) 69/ 0 : =8H equ SYST_CTRL_m, 1 << 3 (1) 70/ 0 : (MACRO) bdef 2, TLK_IDF ; bit 2: Addressed to talk or identify (1) 70/ 0 : =2H equ TLK_IDF, 2 (1) 70/ 0 : =4H equ TLK_IDF_m, 1 << 2 (1) 71/ 0 : (MACRO) bdef 1, LTN ; bit 1: Addressed to listen (1) 71/ 0 : =1H equ LTN, 1 (1) 71/ 0 : =2H equ LTN_m, 1 << 1 (1) 72/ 0 : (MACRO) bdef 0, DATA_FRZ ; bit 0: Outbound data freeze (1) 72/ 0 : =0H equ DATA_FRZ, 0 (1) 72/ 0 : =1H equ DATA_FRZ_m, 1 << 0 (1) 73/ 0 : (1) 74/ 0 : =16H phi_id1 port 16h ; PHI register 4 (HP 12009A numbering) (1) 75/ 0 : ; device mode: IDENTIFY byte 1 (1) 76/ 0 : (1) 77/ 0 : =17H phi_id2 port 17h ; PHI register 5 (HP 12009A numbering) (1) 78/ 0 : ; device mode: IDENTIFY byte 2 (1) 79/ 0 : (1) 80/ 0 : =14H phi_control port 14h ; PHI register 6 (HP 12009A numbering) (1) 81/ 0 : (MACRO) bdef 7, POLL_HLDF ; bit D0: Don't respond to parallel poll if data freeze active (1) 81/ 0 : =7H equ POLL_HLDF, 7 (1) 81/ 0 : =80H equ POLL_HLDF_m, 1 << 7 (1) 82/ 0 : (MACRO) bdef 6, DHSK_DLY ; bit D1: require NDAC and NRFD remain false for a period before sensing them (1) 82/ 0 : =6H equ DHSK_DLY, 6 (1) 82/ 0 : =40H equ DHSK_DLY_m, 1 << 6 (1) 83/ 0 : (MACRO) bdef 7, EIGHT_BIT ; bit 7: 8-bit processor (1) 83/ 0 : =7H equ EIGHT_BIT, 7 (1) 83/ 0 : =80H equ EIGHT_BIT_m, 1 << 7 (1) 84/ 0 : (MACRO) bdef 6, PRTY_FRZ ; bit 6: parity freeze (1) 84/ 0 : =6H equ PRTY_FRZ, 6 (1) 84/ 0 : =40H equ PRTY_FRZ_m, 1 << 6 (1) 85/ 0 : (MACRO) bdef 5, REN ; bit 5: REN value (1) 85/ 0 : =5H equ REN, 5 (1) 85/ 0 : =20H equ REN_m, 1 << 5 (1) 86/ 0 : (MACRO) bdef 4, IFC ; bit 4: IFC value (1) 86/ 0 : =4H equ IFC, 4 (1) 86/ 0 : =10H equ IFC_m, 1 << 4 (1) 87/ 0 : (MACRO) bdef 3, RSPD_PP ; bit 3: respond to parallel poll (1) 87/ 0 : =3H equ RSPD_PP, 3 (1) 87/ 0 : =8H equ RSPD_PP_m, 1 << 3 (1) 88/ 0 : (MACRO) bdef 2, RQST_SRVC ; bit 2: request service (1) 88/ 0 : =2H equ RQST_SRVC, 2 (1) 88/ 0 : =4H equ RQST_SRVC_m, 1 << 2 (1) 89/ 0 : (MACRO) bdef 1, FIFO_SEL ; bit 1: DMA fifo select (1) 89/ 0 : =1H equ FIFO_SEL, 1 (1) 89/ 0 : =2H equ FIFO_SEL_m, 1 << 1 (1) 90/ 0 : (MACRO) bdef 0, INIT_FIFO ; bit 0: initialize outbound FIFO (write only) (1) 90/ 0 : =0H equ INIT_FIFO, 0 (1) 90/ 0 : =1H equ INIT_FIFO_m, 1 << 0 (1) 91/ 0 : (1) 92/ 0 : =15H phi_address port 15h ; PHI register 7 (HP 12009A numbering) (1) 93/ 0 : (MACRO) bdef 7, CRCE ; bit D0: enable CRC SAD processing (see page 3-25a) (1) 93/ 0 : =7H equ CRCE, 7 (1) 93/ 0 : =80H equ CRCE_m, 1 << 7 (1) 94/ 0 : (MACRO) bdef 6, EPAR ; bit D1: generate even parity on the HP-IB bus (1) 94/ 0 : =6H equ EPAR, 6 (1) 94/ 0 : =40H equ EPAR_m, 1 << 6 (1) 95/ 0 : (MACRO) bdef 7, ONL ; bit 7: PHI online to HP-IB bus (1) 95/ 0 : =7H equ ONL, 7 (1) 95/ 0 : =80H equ ONL_m, 1 << 7 (1) 96/ 0 : (MACRO) bdef 6, TA ; bit 6: talk always (1) 96/ 0 : =6H equ TA, 6 (1) 96/ 0 : =40H equ TA_m, 1 << 6 (1) 97/ 0 : (MACRO) bdef 5, LA ; bit 5: listen always (1) 97/ 0 : =5H equ LA, 5 (1) 97/ 0 : =20H equ LA_m, 1 << 5 (1) 98/ 0 : (MACRO) bfield 4, 0, ADDRESS_PHI ; bits 4..0: HP-IB address (1) 98/ 0 : =1FH equ ADDRESS_PHI_m, bmask(4, 0) (1) 98/ 0 : =0H equ ADDRESS_PHI_shift, 0 (1) 99/ 0 : 13/ 0 : include io.inc (1) 1/ 0 : ; HP 9895A floppy disk firmware (1) 2/ 0 : ; Partially reverse-engineered by Eric Smith (1) 3/ 0 : ; and Craig Ruff (1) 4/ 0 : (1) 5/ 0 : ; Cross-assembles with Macro Assembler AS: (1) 6/ 0 : ; http://john.ccac.rwth-aachen.de:8000/as/ (1) 7/ 0 : (1) 8/ 0 : ; FDD Jumper configuration (From 09895-90030 service manual): (1) 9/ 0 : ; Jumpered: A, DD, HO, I, IU, NS, R, RI, RR, SS, S2, TS, WP, X (1) 10/ 0 : ; A: Gate DRIVE-SELECT with HEAD-LOAD (1) 11/ 0 : ; D & DL: door lock latches (1) 12/ 0 : ; DC: enable -DISK-CHANGE latched when not selected, resets if drive READY on deselection? (1) 13/ 0 : ; A: Gate HEAD-LOAD with DRIVE-SELECT to latch head load signal (1) 14/ 0 : ; 2S: enable two sided signal (1) 15/ 0 : ; Open: B, C, DR, E, FS, HS, NP, OS, S, S1, S3, Y, Z (1) 16/ 0 : (1) 17/ 0 : ; Other I/O port defintions (1) 18/ 0 : (1) 19/ 0 : (1) 20/ 0 : =60H data port 60h ; in/out (1) 21/ 0 : ; drive data shift register (1) 22/ 0 : (1) 23/ 0 : =61H clock port 61h ; in/out (1) 24/ 0 : ; drive clock shift register (1) 25/ 0 : (1) 26/ 0 : =62H drv_status port 62h ; in only (1) 27/ 0 : ; drive status signals (1) 28/ 0 : (MACRO) bdef 7, TWOSIDE ; 1 = disc is two sided (drive TWO SIDED signal) (1) 28/ 0 : =7H equ TWOSIDE, 7 (1) 28/ 0 : =80H equ TWOSIDE_m, 1 << 7 (1) 29/ 0 : (MACRO) bdef 6, OVERUN ; 1 = data overrun error (1) 29/ 0 : =6H equ OVERUN, 6 (1) 29/ 0 : =40H equ OVERUN_m, 1 << 6 (1) 30/ 0 : (MACRO) bdef 5, CRCERR ; 1 = CRC error, valid after last check bit clocked into 74F401 (1) 30/ 0 : =5H equ CRCERR, 5 (1) 30/ 0 : =20H equ CRCERR_m, 1 << 5 (1) 31/ 0 : (MACRO) bdef 4, READY ; 1 = disc has rotated at least 2 revs (index hole detected) (1) 31/ 0 : =4H equ READY, 4 (1) 31/ 0 : =10H equ READY_m, 1 << 4 (1) 32/ 0 : (MACRO) bdef 3, WRPROT ; 1 = write protected (drive WRITE PROTECT signal) (1) 32/ 0 : =3H equ WRPROT, 3 (1) 32/ 0 : =8H equ WRPROT_m, 1 << 3 (1) 33/ 0 : (MACRO) bdef 2, TRACK0 ; 1 = at track 0 (1) 33/ 0 : =2H equ TRACK0, 2 (1) 33/ 0 : =4H equ TRACK0_m, 1 << 2 (1) 34/ 0 : (MACRO) bdef 1, DISCHNG ; 1 = door was opened (drive DISK CHANGE signal) (1) 34/ 0 : =1H equ DISCHNG, 1 (1) 34/ 0 : =2H equ DISCHNG_m, 1 << 1 (1) 35/ 0 : ; (loss of READY - when drive is not selected) (1) 36/ 0 : (MACRO) bdef 0, INDEX ; 1 = index hole deteted (pulsed) (1) 36/ 0 : =0H equ INDEX, 0 (1) 36/ 0 : =1H equ INDEX_m, 1 << 0 (1) 37/ 0 : (1) 38/ 0 : =62H reset port 62h ; out only (1) 39/ 0 : ; latched signal resets (1) 40/ 0 : (MACRO) bdef 3, PROGRES ; 1 = Program reset (resets other devices except the CPU) (1) 40/ 0 : =3H equ PROGRES, 3 (1) 40/ 0 : =8H equ PROGRES_m, 1 << 3 (1) 41/ 0 : (MACRO) bdef 1, r_OVERUN ; 1 = reset OVERUN (1) 41/ 0 : =1H equ R_OVERUN, 1 (1) 41/ 0 : =2H equ R_OVERUN_m, 1 << 1 (1) 42/ 0 : (MACRO) bdef 0, r_TIMEOUT ; 1 = reset TIMEOUT (1) 42/ 0 : =0H equ R_TIMEOUT, 0 (1) 42/ 0 : =1H equ R_TIMEOUT_m, 1 << 0 (1) 43/ 0 : (1) 44/ 0 : =63H switches port 63h ; in only (1) 45/ 0 : ; various switches and misc status signals (1) 46/ 0 : =4H equ NOSW, 4 (1) 47/ 0 : ; When read as port 67h, the switches state is not sampled (1) 48/ 0 : ; and reads as zero bits. (1) 49/ 0 : (MACRO) bdef 7, AMDT ; bit 7: 1 = Address Mark Detected (1) 49/ 0 : =7H equ AMDT, 7 (1) 49/ 0 : =80H equ AMDT_m, 1 << 7 (1) 50/ 0 : (MACRO) bdef 6, TIMEOUT (1) 50/ 0 : =6H equ TIMEOUT, 6 (1) 50/ 0 : =40H equ TIMEOUT_m, 1 << 6 (1) 51/ 0 : (MACRO) bdef 5, LOOP ; Test LOOP jumper 1 = installed (1) 51/ 0 : =5H equ LOOP, 5 (1) 51/ 0 : =20H equ LOOP_m, 1 << 5 (1) 52/ 0 : (MACRO) bdef 4, SELFTEST ; 1 = self test sw pressed (1) 52/ 0 : =4H equ SELFTEST, 4 (1) 52/ 0 : =10H equ SELFTEST_m, 1 << 4 (1) 53/ 0 : (MACRO) bdef 3, WRTEST ; 1 = write test enable sw (1) 53/ 0 : =3H equ WRTEST, 3 (1) 53/ 0 : =8H equ WRTEST_m, 1 << 3 (1) 54/ 0 : (MACRO) bfield 2, 0, ADDRESS_SW ; HP-IB Address Switches (1) 54/ 0 : =7H equ ADDRESS_SW_m, bmask(2, 0) (1) 54/ 0 : =0H equ ADDRESS_SW_shift, 0 (1) 55/ 0 : (1) 56/ 0 : =63H leds port 63h ; out only (1) 57/ 0 : ; LEDs (and 09895-66506 Flexible Disc Controller Self Test Monitor) (1) 58/ 0 : (MACRO) bfield 7, 5, SUBTEST ; subtest number LEDs bits 2..0 (Monitor only) (1) 58/ 0 : =0E0H equ SUBTEST_m, bmask(7, 5) (1) 58/ 0 : =5H equ SUBTEST_shift, 5 (1) 59/ 0 : (MACRO) bfield 4, 1, TESTNUM ; LEDs bits 3..0 (marked ABCD) (1) 59/ 0 : =1EH equ TESTNUM_m, bmask(4, 1) (1) 59/ 0 : =1H equ TESTNUM_shift, 1 (1) 60/ 0 : (MACRO) bdef 0, DONE ; LED (marked *, 1 = self test code, 0 = in use codes) (1) 60/ 0 : =0H equ DONE, 0 (1) 60/ 0 : =1H equ DONE_m, 1 << 0 (1) 61/ 0 : (1) 62/ 0 : =64H cntl port 64h ; out only (1) 63/ 0 : ; drive and other control signals (1) 64/ 0 : ; bit 7: NC (1) 65/ 0 : ; bit 6: NC (1) 66/ 0 : (MACRO) bdef 5, READON (1) 66/ 0 : =5H equ READON, 5 (1) 66/ 0 : =20H equ READON_m, 1 << 5 (1) 67/ 0 : (MACRO) bdef 4, CRCOUT ; => 74175 CWE 0 = data bits in, 1 = CRC bits out (1) 67/ 0 : =4H equ CRCOUT, 4 (1) 67/ 0 : =10H equ CRCOUT_m, 1 << 4 (1) 68/ 0 : (MACRO) bdef 3, WRITDRV ; 1 = drive write mode enabled (drive WRITE GATE signal) (1) 68/ 0 : =3H equ WRITDRV, 3 (1) 68/ 0 : =8H equ WRITDRV_m, 1 << 3 (1) 69/ 0 : (MACRO) bdef 2, WRITON (1) 69/ 0 : =2H equ WRITON, 2 (1) 69/ 0 : =4H equ WRITON_m, 1 << 2 (1) 70/ 0 : (MACRO) bdef 1, CRCON ; => 74175 PRESET 0 = preset, 1 = calculate (1) 70/ 0 : =1H equ CRCON, 1 (1) 70/ 0 : =2H equ CRCON_m, 1 << 1 (1) 71/ 0 : ; bit 0: NC (1) 72/ 0 : (1) 73/ 0 : =65H drv port 65h ; out only (1) 74/ 0 : ; drive and other control signals (1) 75/ 0 : (MACRO) bdef 7, HEAD1 ; bit 7: 1 = Head 1, 0 = Head 0 (drive HEAD SELECT signal) (1) 75/ 0 : =7H equ HEAD1, 7 (1) 75/ 0 : =80H equ HEAD1_m, 1 << 7 (1) 76/ 0 : ; bit 6: NC (1) 77/ 0 : ; bit 5: NC (1) 78/ 0 : (MACRO) bdef 4, LOWCURR ; bit 4: reduce write current for inner tracks (>= 43) (1) 78/ 0 : =4H equ LOWCURR, 4 (1) 78/ 0 : =10H equ LOWCURR_m, 1 << 4 (1) 79/ 0 : (MACRO) bdef 3, HEADLOAD ; bit 3: 1 = assert IN-USE (drive IN-USE signal) (1) 79/ 0 : =3H equ HEADLOAD, 3 (1) 79/ 0 : =8H equ HEADLOAD_m, 1 << 3 (1) 80/ 0 : ; IN-USE has multiple uses on the FDD: (1) 81/ 0 : ; 1. turn on the LED (1) 82/ 0 : ; 2. lock the door (1) 83/ 0 : ; 3. load the heads (1) 84/ 0 : (MACRO) bdef 2, MGNENA ; bit 2: 1 = enable reduced margins for good data (1) 84/ 0 : =2H equ MGNENA, 2 (1) 84/ 0 : =4H equ MGNENA_m, 1 << 2 (1) 85/ 0 : ; (Also may affect the Z80 WAIT signal?) (1) 86/ 0 : ; margin enable?? check use in read-verify (1) 87/ 0 : (MACRO) bdef 1, MOVEIN ; bit 1: 1 = towards center, 0 = towards edge (drive DIRECTION SELECT signal) (1) 87/ 0 : =1H equ MOVEIN, 1 (1) 87/ 0 : =2H equ MOVEIN_m, 1 << 1 (1) 88/ 0 : (MACRO) bdef 0, STEP ; bit 0: perform step (pulsed) (1) 88/ 0 : =0H equ STEP, 0 (1) 88/ 0 : =1H equ STEP_m, 1 << 0 (1) 89/ 0 : (1) 90/ 0 : =66H xv port 66h ; out only (1) 91/ 0 : ; extra signals and drive select lines (1) 92/ 0 : ; bit 7: NC (1) 93/ 0 : ; bit 6: NC (1) 94/ 0 : (MACRO) bdef 5, PRECMP ; bit 5: enable precompensation (1) 94/ 0 : =5H equ PRECMP, 5 (1) 94/ 0 : =20H equ PRECMP_m, 1 << 5 (1) 95/ 0 : (MACRO) bdef 4, HIDEN ; bit 4: enable high density (1) 95/ 0 : =4H equ HIDEN, 4 (1) 95/ 0 : =10H equ HIDEN_m, 1 << 4 (1) 96/ 0 : (MACRO) bfield 3, 0, DRV_SEL ; bits 3..0: Drive select lines (1) 96/ 0 : =0FH equ DRV_SEL_m, bmask(3, 0) (1) 96/ 0 : =0H equ DRV_SEL_shift, 0 (1) 97/ 0 : (MACRO) bdef 3, DRV0 ; (drive DRIVE SELECT 1 signal) (1) 97/ 0 : =3H equ DRV0, 3 (1) 97/ 0 : =8H equ DRV0_m, 1 << 3 (1) 98/ 0 : (MACRO) bdef 2, DRV1 ; (drive DRIVE SELECT 2 signal) (1) 98/ 0 : =2H equ DRV1, 2 (1) 98/ 0 : =4H equ DRV1_m, 1 << 2 (1) 99/ 0 : (MACRO) bdef 1, DRV2 ; (drive DRIVE SELECT 3 signal) (1) 99/ 0 : =1H equ DRV2, 1 (1) 99/ 0 : =2H equ DRV2_m, 1 << 1 (1) 100/ 0 : (MACRO) bdef 0, DRV3 ; (drive DRIVE SELECT 4 signal) (1) 100/ 0 : =0H equ DRV3, 0 (1) 100/ 0 : =1H equ DRV3_m, 1 << 0 (1) 101/ 0 : (1) 102/ 0 : =67H monitor_U6 port 67h ; out: 09895-66506 Flexible Disc Controller Self Test Monitor (1) 103/ 0 : ; in: read switches without the switch bits (1) 104/ 0 : (MACRO) bdef 7, ERROR ; LED (1) 104/ 0 : =7H equ ERROR, 7 (1) 104/ 0 : =80H equ ERROR_m, 1 << 7 (1) 105/ 0 : (MACRO) bdef 6, HEAD ; LED (1) 105/ 0 : =6H equ HEAD, 6 (1) 105/ 0 : =40H equ HEAD_m, 1 << 6 (1) 106/ 0 : (MACRO) bfield 5, 4, UNIT ; LEDS (1) 106/ 0 : =30H equ UNIT_m, bmask(5, 4) (1) 106/ 0 : =4H equ UNIT_shift, 4 (1) 107/ 0 : (MACRO) bdef 3, HPFMT ; LED (1) 107/ 0 : =3H equ HPFMT, 3 (1) 107/ 0 : =8H equ HPFMT_m, 1 << 3 (1) 108/ 0 : ;bdef ,2 ; Feeds U8 NAND to U7 /CLK (1) 109/ 0 : (MACRO) bfield 1, 0, SUBTEST_MSB ; subtest number bits 4..3 (1) 109/ 0 : =3H equ SUBTEST_MSB_m, bmask(1, 0) (1) 109/ 0 : =0H equ SUBTEST_MSB_shift, 0 (1) 110/ 0 : 14/ 0 : include ram.inc (1) 1/ 0 : ; HP 9895A floppy disk firmware (1) 2/ 0 : ; Partially reverse-engineered by Eric Smith (1) 3/ 0 : ; and Craig Ruff (1) 4/ 0 : (1) 5/ 0 : ; Cross-assembles with Macro Assembler AS: (1) 6/ 0 : ; http://john.ccac.rwth-aachen.de:8000/as/ (1) 7/ 0 : (1) 8/ 0 : ; Amigo ICD (1) 9/ 0 : =30H equ DSJ_SAD, TLK_m | 10h (1) 10/ 0 : (1) 11/ 0 : ; HP-300 Clear (1) 12/ 0 : =10H equ HP300_CLEAR_SAD, 10h (1) 13/ 0 : (MACRO) bdef 0, ENABLE_PARITY_CHECK ; fist byte after secondary device clear (1) 13/ 0 : =0H equ ENABLE_PARITY_CHECK, 0 (1) 13/ 0 : =1H equ ENABLE_PARITY_CHECK_m, 1 << 0 (1) 14/ 0 : (1) 15/ 0 : (1) 16/ 0 : (MACRO) bdef 7, STEP_OUT ; C bit 7: 1 = step towards cylinder 0 (1) 16/ 0 : =7H equ STEP_OUT, 7 (1) 16/ 0 : =80H equ STEP_OUT_m, 1 << 7 (1) 17/ 0 : (1) 18/ 0 : =4H equ NUNITS, 4 (1) 19/ 0 : (1) 20/ 0 : ; do_talk_transfer B register bits (1) 21/ 0 : (MACRO) bdef 1, FLUSH_FIFO (1) 21/ 0 : =1H equ FLUSH_FIFO, 1 (1) 21/ 0 : =2H equ FLUSH_FIFO_m, 1 << 1 (1) 22/ 0 : (MACRO) bdef 0, SEND_EOI (1) 22/ 0 : =0H equ SEND_EOI, 0 (1) 22/ 0 : =1H equ SEND_EOI_m, 1 << 0 (1) 23/ 0 : (1) 24/ 0 : ; In-Use LED Patterns (1) 25/ 0 : =2H equ IU_WAIT, 02h ; waiting for a command and monitoring drive status (END cmd) (1) 26/ 0 : =4H equ IU_SEND, 04h ; sending data to host system (1) 27/ 0 : =6H equ IU_RECV, 06h ; receiving data from host system (1) 28/ 0 : =8H equ IU_STAT, 08h ; determining status and format from selected unit (1) 29/ 0 : =0AH equ IU_LOAD, 0ah ; loading heads on a drive (1) 30/ 0 : =0CH equ IU_SAD, 0ch ; waiting for a secondary HP-IB command (1) 31/ 0 : =0EH equ IU_FMT, 0eh ; formatting a track (1) 32/ 0 : =10H equ IU_WAIT_DSJ, 10h ; waiting for command show DSJ value (1) 33/ 0 : =18H equ IU_VFY, 18h ; executing VERIFY command (1) 34/ 0 : =1AH equ IU_STEP, 1ah ; moving the heads one track (1) 35/ 0 : =1CH equ IU_WRT, 1ch ; writing a sector (1) 36/ 0 : =1EH equ IU_READ, 1eh ; reading a sector (1) 37/ 0 : (1) 38/ 0 : ; Disc format defines (1) 39/ 0 : =4DH equ PHYSICAL_TRACKS, 77 (1) 40/ 0 : (1) 41/ 0 : =2BH equ HP_LOWCURR_START_TRACK, 43 (1) 42/ 0 : =37H equ HP_PRECMP_START_TRACK, 55 (1) 43/ 0 : =100H equ HP_BYTES_PER_SECTOR, 256 (1) 44/ 0 : =0H equ HP_FIRST_SECTOR, 0 (1) 45/ 0 : =1EH equ HP_SECTORS_PER_TRACK, 30 (1) 46/ 0 : =0EH equ HP_AM_CLK, 0eh (1) 47/ 0 : =70H equ HP_ID_AM_DPAT, 70h (1) 48/ 0 : =0F0H equ HP_DEFECTIVE_TRACK_AM_DPAT, 0f0h (1) 49/ 0 : =50H equ HP_DATA_AM_DPAT, 50h (1) 50/ 0 : =0D0H equ HP_ECC_DATA_AM_DPAT, 0d0h ; NOTE: Unused (1) 51/ 0 : =0FFH equ HP_DEFECTIVE_TRACK_MARKER, 0ffh (1) 52/ 0 : (1) 53/ 0 : =80H equ IBM_BYTES_PER_SECTOR, 128 (1) 54/ 0 : =1H equ IBM_FIRST_SECTOR, 1 (1) 55/ 0 : =1AH equ IBM_SECTORS_PER_TRACK, 26 (1) 56/ 0 : =0D7H equ IBM_INDEX_AM_CLK, 0d7h (1) 57/ 0 : =0FCH equ IBM_INDEX_AM_DPAT, 0fch (1) 58/ 0 : (1) 59/ 0 : =0C7H equ IBM_AM_CLK, 0c7h (1) 60/ 0 : =0FEH equ IBM_ID_AM_DPAT, 0feh (1) 61/ 0 : =0FBH equ IBM_DATA_AM_DPAT, 0fbh (1) 62/ 0 : =0F8H equ IBM_DELETED_DATA_AM_DPAT, 0f8h (1) 63/ 0 : =0FFH equ IBM_GAP_DPAT, 0ffh (1) 64/ 0 : (1) 65/ 0 : ; IC notes (1) 66/ 0 : ; U21 is 3-to-8 demux (1) 67/ 0 : ; U30, U31, U86, U87 are 74LS174 or equiv (1) 68/ 0 : ; U32, U33, U47, U48 are 74LS253 or equiv (1) 69/ 0 : ; U35, U36 are 1KiBx4 RAM (1) 70/ 0 : ; U66 is 74175 or equiv quad FF (1) 71/ 0 : ; U71 appears to be a ROM used for precompensation and write bit stream generation (1) 72/ 0 : ; U77 is 74F401 or equiv CRC chip (1) 73/ 0 : (1) 74/ 0 : ; wait_for_sector defines (1) 75/ 0 : ; sector I/O status bits (1) 76/ 0 : (MACRO) bdef 7, SIO_D_WRONG_SECTOR (1) 76/ 0 : =7H equ SIO_D_WRONG_SECTOR, 7 (1) 76/ 0 : =80H equ SIO_D_WRONG_SECTOR_m, 1 << 7 (1) 77/ 0 : (MACRO) bdef 6, SIO_D_WRONG_TRACK (1) 77/ 0 : =6H equ SIO_D_WRONG_TRACK, 6 (1) 77/ 0 : =40H equ SIO_D_WRONG_TRACK_m, 1 << 6 (1) 78/ 0 : (MACRO) bdef 5, SIO_D_WRONG_HEAD (1) 78/ 0 : =5H equ SIO_D_WRONG_HEAD, 5 (1) 78/ 0 : =20H equ SIO_D_WRONG_HEAD_m, 1 << 5 (1) 79/ 0 : (MACRO) bdef 5, SIO_D_BIT5 ; IBM format (1) 79/ 0 : =5H equ SIO_D_BIT5, 5 (1) 79/ 0 : =20H equ SIO_D_BIT5_m, 1 << 5 (1) 80/ 0 : (MACRO) bdef 4, SIO_D_BIT4 ; IBM format (1) 80/ 0 : =4H equ SIO_D_BIT4, 4 (1) 80/ 0 : =10H equ SIO_D_BIT4_m, 1 << 4 (1) 81/ 0 : (MACRO) bdef 1, SIO_D_WFS_FAILED (1) 81/ 0 : =1H equ SIO_D_WFS_FAILED, 1 (1) 81/ 0 : =2H equ SIO_D_WFS_FAILED_m, 1 << 1 (1) 82/ 0 : (MACRO) bdef 0, SIO_D_SECTOR_FOUND (1) 82/ 0 : =0H equ SIO_D_SECTOR_FOUND, 0 (1) 82/ 0 : =1H equ SIO_D_SECTOR_FOUND_m, 1 << 0 (1) 83/ 0 : (1) 84/ 0 : ; 6, OVERUN (1) 85/ 0 : ; 5, CRCERR (1) 86/ 0 : (MACRO) bdef 4, SIO_E_NOT_READY (1) 86/ 0 : =4H equ SIO_E_NOT_READY, 4 (1) 86/ 0 : =10H equ SIO_E_NOT_READY_m, 1 << 4 (1) 87/ 0 : (MACRO) bdef 3, SIO_E_3 (1) 87/ 0 : =3H equ SIO_E_3, 3 (1) 87/ 0 : =8H equ SIO_E_3_m, 1 << 3 (1) 88/ 0 : (MACRO) bdef 2, SIO_E_DEFECTIVE_SECTOR (1) 88/ 0 : =2H equ SIO_E_DEFECTIVE_SECTOR, 2 (1) 88/ 0 : =4H equ SIO_E_DEFECTIVE_SECTOR_m, 1 << 2 (1) 89/ 0 : (MACRO) bdef 1, SIO_E_1 ; retries exhausted? (1) 89/ 0 : =1H equ SIO_E_1, 1 (1) 89/ 0 : =2H equ SIO_E_1_m, 1 << 1 (1) 90/ 0 : (MACRO) bdef 0, SIO_E_SCE (1) 90/ 0 : =0H equ SIO_E_SCE, 0 (1) 90/ 0 : =1H equ SIO_E_SCE_m, 1 << 0 (1) 91/ 0 : (1) 92/ 0 : ; *************************************************************** (1) 93/ 0 : ; * 9895A RAM ADDRESS SPACE * (1) 94/ 0 : ; *************************************************************** (1) 95/ 0 : (1) 96/ 0 : ; DriveData - a per-drive data structure (pointed to by IX) (1) 97/ 0 : DriveData struct dots (1) 98/ 0 : ; +0 (1) 99/ 0 : physical_cylinder ds 1 (1) 100/ 1 : (1) 101/ 1 : ; +1 (1) 102/ 1 : current_cyl_hd ds 1 ; bit 7: HEAD1 (1) 103/ 2 : ; bits 6..0: cylinder number (1) 104/ 2 : (1) 105/ 2 : ; +2 (1) 106/ 2 : target_cyl_hd ds 1 ; bit 7: HEAD1 (1) 107/ 3 : ; bits 6..0: cylinder number (1) 108/ 3 : (1) 109/ 3 : ; +3 (1) 110/ 3 : sector ds 1 ; current sector (1) 111/ 4 : (1) 112/ 4 : ; +4 (1) 113/ 4 : drv ds 1 ; drv register shadow (1) 114/ 5 : ; bit 7: HEAD1 (init 0) (1) 115/ 5 : ; bit 6: ? (init 0 NC in drv reg) (1) 116/ 5 : (MACRO) bdef 5, DOOR_LOCK ; bit 5: door lock (init 0 NC in drv reg) (1) 116/ 5 : =5H equ DOOR_LOCK, 5 (1) 116/ 5 : =20H equ DOOR_LOCK_m, 1 << 5 (1) 117/ 5 : ; bit 4: LOWCURR (init 0) (1) 118/ 5 : ; bit 3: HEADLOAD (init 0) (1) 119/ 5 : ; bit 2: MGNENA (init 0) (1) 120/ 5 : ; bit 1: MOVEIN? (init 0) (1) 121/ 5 : ; bit 0: STEP? (init 0) (1) 122/ 5 : (1) 123/ 5 : ; +5 (1) 124/ 5 : stat2 ds 1 ; saved stat2 (usually loaded into E) (1) 125/ 6 : (MACRO) bdef 7, STAT2_ERROR ; bit 7: Stat 2 error (E, C or SS bits are set) (1) 125/ 6 : =7H equ STAT2_ERROR, 7 (1) 125/ 6 : =80H equ STAT2_ERROR_m, 1 << 7 (1) 126/ 6 : ; bit 6: copy of OVERUN? (see turn_off_get_status) (1) 127/ 6 : ; bit 5: copy of CRCERR? (see turn_off_get_status) (1) 128/ 6 : (MACRO) bfield 4, 1, DISC_TYPE ; bits 4..1: (disc type) (1) 128/ 6 : =1EH equ DISC_TYPE_m, bmask(4, 1) (1) 128/ 6 : =1H equ DISC_TYPE_shift, 1 (1) 129/ 6 : (MACRO) bdef 4, DT_IBM ; TTTT IBM format bit (1) 129/ 6 : =4H equ DT_IBM, 4 (1) 129/ 6 : =10H equ DT_IBM_m, 1 << 4 (1) 130/ 6 : (MACRO) bdef 3, DT_DS ; TTTT double sided bit (1) 130/ 6 : =3H equ DT_DS, 3 (1) 130/ 6 : =8H equ DT_DS_m, 1 << 3 (1) 131/ 6 : (MACRO) bdef 2, DT_HP ; TTTT HP format bit (1) 131/ 6 : =2H equ DT_HP, 2 (1) 131/ 6 : =4H equ DT_HP_m, 1 << 2 (1) 132/ 6 : (MACRO) bdef 1, DT_BLANK ; TTTT blank or unknown format (1) 132/ 6 : =1H equ DT_BLANK, 1 (1) 132/ 6 : =2H equ DT_BLANK_m, 1 << 1 (1) 133/ 6 : =0H equ DT_EMPTY, 0 ; TTTT empty drive (1) 134/ 6 : (MACRO) bdef 0, STAT2_RSVD ; bit 0: reserved (1) 134/ 6 : =0H equ STAT2_RSVD, 0 (1) 134/ 6 : =1H equ STAT2_RSVD_m, 1 << 0 (1) 135/ 6 : (1) 136/ 6 : ; +6 (1) 137/ 6 : stat2_ds ds 1 ; saved stat2_ds (usually loaded into D) (1) 138/ 7 : (MACRO) bdef 7, STAT2_A ; bit 7: A (attention) (1) 138/ 7 : =7H equ STAT2_A, 7 (1) 138/ 7 : =80H equ STAT2_A_m, 1 << 7 (1) 139/ 7 : (MACRO) bdef 6, STAT2_W ; bit 6: W (write protect) (1) 139/ 7 : =6H equ STAT2_W, 6 (1) 139/ 7 : =40H equ STAT2_W_m, 1 << 6 (1) 140/ 7 : (MACRO) bdef 5, STAT2_UNDOC ; bit 5: ? (1) 140/ 7 : =5H equ STAT2_UNDOC, 5 (1) 140/ 7 : =20H equ STAT2_UNDOC_m, 1 << 5 (1) 141/ 7 : (MACRO) bdef 4, STAT2_E ; bit 4: E (drive fault) (1) 141/ 7 : =4H equ STAT2_E, 4 (1) 141/ 7 : =10H equ STAT2_E_m, 1 << 4 (1) 142/ 7 : (MACRO) bdef 3, STAT2_F ; bit 3: F (first status/no disc?) (1) 142/ 7 : =3H equ STAT2_F, 3 (1) 142/ 7 : =8H equ STAT2_F_m, 1 << 3 (1) 143/ 7 : (MACRO) bdef 2, STAT2_C ; bit 2: C (seek check) (1) 143/ 7 : =2H equ STAT2_C, 2 (1) 143/ 7 : =4H equ STAT2_C_m, 1 << 2 (1) 144/ 7 : (1) 145/ 7 : (MACRO) bfield 1, 0, SS ; bits 1..0: SS (drive ready status) (1) 145/ 7 : =3H equ SS_m, bmask(1, 0) (1) 145/ 7 : =0H equ SS_shift, 0 (1) 146/ 7 : =0H equ SS_READY, 0 (1) 147/ 7 : =1H equ SS_UNDEF, 1 (1) 148/ 7 : =2H equ SS_NO_DRV, 2 (1) 149/ 7 : =3H equ SS_NO_DISC, 3 (1) 150/ 7 : (MACRO) bdef 1, SS_NOT_READY ; Either not ready status (1) 150/ 7 : =1H equ SS_NOT_READY, 1 (1) 150/ 7 : =2H equ SS_NOT_READY_m, 1 << 1 (1) 151/ 7 : (1) 152/ 7 : ; +7 (1) 153/ 7 : unload_timer ds 1 ; unload timer (approx seconds?) (1) 154/ 8 : (1) 155/ 8 : ; +8 (1) 156/ 8 : unload_ticks ds 1 ; unload timer ticks (1/256th second units?) (1) 157/ 9 : (1) 158/ 9 : ; +9 (1) 159/ 9 : xv ds 1 ; xv register shadow (1) 160/ A : (MACRO) bdef 7, XV_SHDW_DISCHNG ; bit 7: remembered DISCHNG (1) 160/ A : =7H equ XV_SHDW_DISCHNG, 7 (1) 160/ A : =80H equ XV_SHDW_DISCHNG_m, 1 << 7 (1) 161/ A : ; bits 5..0: drive specific xv reg value bits (1) 162/ 0 : =0AH DriveData endstruct (1) 163/ 0 : (1) 164/ 0 : ; using a section causes extra work for symbol visibility, for now I'll skip it. (1) 165/ 0 : ; section ram (1) 166/ 0 : (1) 167/ 0 : =6000H ramstart equ 6000h (1) 168/ 0 : =400H ramsize equ 0400h (1) 169/ 0 : =63FFH ramend equ ramstart + ramsize - 1 (1) 170/ 0 : (1) 171/ 6000 : org ramstart (1) 172/ 6000 : (1) 173/ 6000 : DSJ: ds 1 ; the current DSJ byte (1) 174/ 6001 : =0H equ DSJ_normal, 0 (1) 175/ 6001 : =1H equ DSJ_aborted, 1 (1) 176/ 6001 : =2H equ DSJ_holdoff, 2 (1) 177/ 6001 : =3H equ DSJ_parity_error, 3 (1) 178/ 6001 : (1) 179/ 6001 : S1: ds 1 ; the stat2 S1 value (1) 180/ 6002 : ; DEFINE S1 codes here (1) 181/ 6002 : =0H equ S1_NORMAL, 00h ; normal completion (1) 182/ 6002 : =1H equ S1_ILL_OP, 01h ; illegal opcode (1) 183/ 6002 : =7H equ S1_CCE, 07h ; cylinder compare error (1) 184/ 6002 : =8H equ S1_UDE, 08h ; uncorrectable data error (1) 185/ 6002 : =9H equ S1_SCE, 09h ; sector compare error (1) 186/ 6002 : =0AH equ S1_IPE, 0ah ; I/O program error (1) 187/ 6002 : =11H equ S1_DTE, 11h ; defective track or sector (1) 188/ 6002 : =12H equ S1_RHE, 12h ; retryable hardware error (1) 189/ 6002 : =13H equ S1_S2E, 13h ; Stat 2 error (1) 190/ 6002 : =17H equ S1_UA, 17h ; unit unavailable (1) 191/ 6002 : =1FH equ S1_DA, 1fh ; drive attention (1) 192/ 6002 : (MACRO) bdef 5, S1_DBIT (1) 192/ 6002 : =5H equ S1_DBIT, 5 (1) 192/ 6002 : =20H equ S1_DBIT_m, 1 << 5 (1) 193/ 6002 : (1) 194/ 6002 : S1_unit: ds 1 ; unit associated with S1 value? (1) 195/ 6003 : (1) 196/ 6003 : current_unit: ds 1 ; Which unit was selected by get_drive_data_ptr? (1) 197/ 6004 : (1) 198/ 6004 : commanded_unit: ds 1 ; Which unit is being manipulated by a command? 4 = none (1) 199/ 6005 : (1) 200/ 6005 : state_flags: ds 1 (1) 201/ 6006 : (MACRO) bdef 5, LISTEN_ACT ; HP-IB listen transfer active (1) 201/ 6006 : =5H equ LISTEN_ACT, 5 (1) 201/ 6006 : =20H equ LISTEN_ACT_m, 1 << 5 (1) 202/ 6006 : (MACRO) bdef 4, TALK_ACT ; HP-IB talk transfer active (1) 202/ 6006 : =4H equ TALK_ACT, 4 (1) 202/ 6006 : =10H equ TALK_ACT_m, 1 << 4 (1) 203/ 6006 : (MACRO) bdef 2, DBIT_ON ; bit 2: DBIT was set in the Initialize command (1) 203/ 6006 : =2H equ DBIT_ON, 2 (1) 203/ 6006 : =4H equ DBIT_ON_m, 1 << 2 (1) 204/ 6006 : (MACRO) bdef 1, SECTOR_IO_RETRY ; also use during formatting? (1) 204/ 6006 : =1H equ SECTOR_IO_RETRY, 1 (1) 204/ 6006 : =2H equ SECTOR_IO_RETRY_m, 1 << 1 (1) 205/ 6006 : (MACRO) bdef 0, SELF_TEST_ACTIVE (1) 205/ 6006 : =0H equ SELF_TEST_ACTIVE, 0 (1) 205/ 6006 : =1H equ SELF_TEST_ACTIVE_m, 1 << 0 (1) 206/ 6006 : (1) 207/ 6006 : head_unload_set: ds 1 ; drives that have loaded heads and are not door locked (1) 208/ 6007 : ; (drive select bit mask) (1) 209/ 6007 : (1) 210/ 6007 : leds_shdw: ds 1 (1) 211/ 6008 : (1) 212/ 6008 : monitor_U6_shdw: (1) 213/ 6008 : ds 1 (1) 214/ 6009 : (1) 215/ 6009 : disc_format: ds 1 (1) 216/ 600A : =0H equ FORMAT_HP, 0 (1) 217/ 600A : (MACRO) bdef 0, FORMAT_IBM (1) 217/ 600A : =0H equ FORMAT_IBM, 0 (1) 217/ 600A : =1H equ FORMAT_IBM_m, 1 << 0 (1) 218/ 600A : (MACRO) bdef 1, FORMAT_UNKNOWN (1) 218/ 600A : =1H equ FORMAT_UNKNOWN, 1 (1) 218/ 600A : =2H equ FORMAT_UNKNOWN_m, 1 << 1 (1) 219/ 600A : (1) 220/ 600A : listen_transfer_final_d0d1: (1) 221/ 600A : ds 1 (1) 222/ 600B : (1) 223/ 600B : target_cyl_hd: ds 1 (1) 224/ 600C : (1) 225/ 600C : parity_check_state: (1) 226/ 600C : ds 1 (1) 227/ 600D : (1) 228/ 600D : previous_format: (1) 229/ 600D : tmp_unit: ds 1 (1) 230/ 600E : fmt_data_2: ds 1 ; format_track stores 2nd byte of format_data_tbl entry here (1) 231/ 600F : fmt_data_1: ds 1 ; format_track stores 1st byte of format_data_tbl entry here (1) 232/ 6010 : format_phys_sector: (1) 233/ 6010 : ds 1 (1) 234/ 6011 : fmt_sector_count: ; how many sectors remain to format in the track (1) 235/ 6011 : ds 1 (1) 236/ 6012 : format_flags: ds 1 (1) 237/ 6013 : (MACRO) bdef 7, FF_DATA_INIT ; the sector interleave table and sector format buffer have been initialized (1) 237/ 6013 : =7H equ FF_DATA_INIT, 7 (1) 237/ 6013 : =80H equ FF_DATA_INIT_m, 1 << 7 (1) 238/ 6013 : (1) 239/ 6013 : test_flags: ds 1 (1) 240/ 6014 : (MACRO) bdef 3, WR_TEST_ACTIVE ; bit 3: WR TEST SW state (1) 240/ 6014 : =3H equ WR_TEST_ACTIVE, 3 (1) 240/ 6014 : =8H equ WR_TEST_ACTIVE_m, 1 << 3 (1) 241/ 6014 : ; bit 4: set at cold start (1) 242/ 6014 : ; bits 1..0: a counter? (1) 243/ 6014 : (1) 244/ 6014 : current_head: ds 1 (1) 245/ 6015 : (1) 246/ 6015 : test_jmptbl_ptr: dw ? (1) 247/ 6017 : (1) 248/ 6017 : in_use_leds_stack_ptr: dw ? ; ptr into in_use_leds_stack (1) 249/ 6019 : in_use_leds_stack: ds 5 (1) 250/ 601E : (1) 251/ 601E : (STRUCT) drive_data_table: DriveData [4] ; the per-drive DriveData array (1) 252/ 6046 : (1) 253/ 6046 : ; NOTE: potentially everything from cmd_buffer to cmd_buffer + 255 (1) 254/ 6046 : ; could be overwritten if a controller sends bytes to us after a listen (1) 255/ 6046 : ; SAD handled by do_listen_cmds. (1) 256/ 6046 : (1) 257/ 6046 : cmd_count: ds 1 ; transfer byte count (1) 258/ 6047 : cmd_buffer: (1) 259/ 6047 : cmd_opcode: ds 1 ; first byte of Amigo command (1) 260/ 6048 : cmd_unit: ds 1 ; second byte of Amigo command (1) 261/ 6049 : cmd_3: ds 1 ; third byte of Amigo command (1) 262/ 604A : cmd_4: ds 3 ; fourth through sixth bytes of Amigo command (1) 263/ 604D : (1) 264/ 604D : =6049H equ format_type, cmd_buffer + 2 (1) 265/ 604D : (MACRO) bdef 7, FORMAT_OVERRIDE (1) 265/ 604D : =7H equ FORMAT_OVERRIDE, 7 (1) 265/ 604D : =80H equ FORMAT_OVERRIDE_m, 1 << 7 (1) 266/ 604D : (MACRO) bfield 6, 0, FORMAT_WANTED_TYPE (1) 266/ 604D : =7FH equ FORMAT_WANTED_TYPE_m, bmask(6, 0) (1) 266/ 604D : =0H equ FORMAT_WANTED_TYPE_shift, 0 (1) 267/ 604D : =2H equ FORMAT_TYPE_HP, 2 (1) 268/ 604D : =8H equ FORMAT_TYPE_IBM, 8 (1) 269/ 604D : (1) 270/ 604D : (MACRO) bdef 5, INIT_DBIT ; for Initialize (1) 270/ 604D : =5H equ INIT_DBIT, 5 (1) 270/ 604D : =20H equ INIT_DBIT_m, 1 << 5 (1) 271/ 604D : (1) 272/ 604D : =604AH equ format_interleave, cmd_buffer + 3 (1) 273/ 604D : =604BH equ format_data_byte, cmd_buffer + 4 (1) 274/ 604D : (1) 275/ 604D : =6049H equ seek_cylinder_msb, cmd_buffer + 2 (1) 276/ 604D : =604AH equ seek_cylinder_lsb, cmd_buffer + 3 (1) 277/ 604D : =604BH equ seek_head, cmd_buffer + 4 (1) 278/ 604D : =604CH equ seek_sector, cmd_buffer + 5 (1) 279/ 604D : (1) 280/ 604D : =6047H equ stat1, cmd_buffer (1) 281/ 604D : =6048H equ stat1_unit, cmd_buffer + 1 (1) 282/ 604D : =6049H equ stat2, cmd_buffer + 2 (1) 283/ 604D : =604AH equ stat2_ds, cmd_buffer + 3 (1) 284/ 604D : (1) 285/ 604D : =6049H equ verify_count_msb, cmd_buffer + 2 (1) 286/ 604D : =604AH equ verify_count_lsb, cmd_buffer + 3 (1) 287/ 604D : (1) 288/ 604D : =6048H equ clr_hd_sect, cmd_buffer + 1 (1) 289/ 604D : (1) 290/ 604D : data_buffer_count: ds 1 (1) 291/ 604E : data_buffer: ds 256 ; 256 bytes x604e to x614d (1) 292/ 614E : =6050H equ download_code_entry, data_buffer + 2 (1) 293/ 614E : (1) 294/ 614E : =604DH equ sector_table, data_buffer_count ; for formatting tracks (1) 295/ 614E : (1) 296/ 614E : (1) 297/ 614E : =606BH x606b equ 606bh (1) 298/ 614E : =606BH format_sector_buffer equ 606bh (1) 299/ 614E : =60B4H x60b4 equ 60b4h (1) 300/ 614E : (1) 301/ 63FC : org ramend - 3 (1) 302/ 63FC : penultimate_stack_word: ds 1 (1) 303/ 63FD : tsterr_sp: ds 1 (1) 304/ 63FE : highest_stack_word: ds 1 (1) 305/ 63FF : (1) 306/ 63FF : ; endsection ram (1) 307/ 63FF : 15/ 63FF : 16/ 63FF : =0H equ ID_BYTE_1, 00h 17/ 63FF : =81H equ ID_BYTE_2, 81h 18/ 63FF : 19/ 63FF : ; *************************************************************** 20/ 63FF : ; * ROM ADDRESS SPACE * 21/ 63FF : ; * * 22/ 63FF : ; * Note: unused parts of ROM filled with 76h (halt) bytes * 23/ 63FF : ; *************************************************************** 24/ 63FF : section rom 25/ 63FF : 26/ 63FF : =0H start equ 0000h 27/ 63FF : =2000H size equ 2000h 28/ 63FF : 29/ 0 : org start 30/ 0 : C3 20 17 jp do_reset ; rst 00h location 31/ 3 : 32/ 3 : wait_for_cmd_jv: 33/ 3 : C3 2B 01 jp do_wait_for_cmd 34/ 6 : 35/ 6 : ;x0006: 36/ 6 : 12 80 db 12h, 80h 37/ 8 : ;ld (de), a 38/ 8 : ;add a, b 39/ 8 : 40/ 8 : reset_drive macro 41/ 8 : rst 08h 42/ 8 : endm 43/ 8 : reset_drive_jv: ; rst 08h location 44/ 8 : C3 C6 06 jp do_reset_drive 45/ B : 46/ B : check_for_command_byte_jv: 47/ B : C3 60 03 jp do_check_for_command_byte 48/ E : 49/ E : ;x000e: 50/ E : 06 26 db 06h, 26h 51/ 10 : ;ld b, 26h 52/ 10 : 53/ 10 : seek macro 54/ 10 : rst 10h 55/ 10 : endm 56/ 10 : C3 67 05 jp do_seek ; rst 10h location 57/ 13 : 58/ 13 : HP_300_Clear_jv: 59/ 13 : C3 12 03 jp do_HP_300_Clear 60/ 16 : 61/ 16 : ;x0016: 62/ 16 : 16 54 db 16h, 54h 63/ 18 : ;ld d, 54h 64/ 18 : 65/ 18 : wait_for_sector macro 66/ 18 : rst 18h 67/ 18 : endm 68/ 18 : C3 94 09 jp do_wait_for_sector ; rst 18h location 69/ 1B : 70/ 1B : step_drive_jv: 71/ 1B : C3 A8 06 jp do_step_drive 72/ 1E : 73/ 1E : ;x001e: 74/ 1E : 4D 60 db 4dh, 60h 75/ 20 : ;ld c, l 76/ 20 : ;ld h, b 77/ 20 : 78/ 20 : load_head macro 79/ 20 : rst 20h 80/ 20 : endm 81/ 20 : C3 9F 15 jp do_load_head ; rst 20h location 82/ 23 : 83/ 23 : determine_unit_status_jv: 84/ 23 : C3 63 04 jp do_determine_unit_status 85/ 26 : 86/ 26 : (MACRO) fillto 0028h, 076h 86/ 26 : 76 76 db (0028H-$) dup (076H) 87/ 28 : 88/ 28 : set_in_use_leds macro 89/ 28 : rst 28h 90/ 28 : endm 91/ 28 : show_in_use_leds_jv: ; rst 28h location 92/ 28 : C3 D8 14 jp do_show_in_use_leds 93/ 2B : 94/ 2B : read_sector_jv: 95/ 2B : C3 CF 0A jp do_read_sector 96/ 2E : 97/ 2E : (MACRO) fillto 0030h, 076h 97/ 2E : 76 76 db (0030H-$) dup (076H) 98/ 30 : 99/ 30 : ; turns off the in use LED 100/ 30 : ; unloads heads 101/ 30 : deassert_in_use macro 102/ 30 : rst 30h 103/ 30 : endm 104/ 30 : C3 0A 16 jp do_deassert_in_use ; rst 30h location 105/ 33 : 106/ 33 : write_sector_jv: 107/ 33 : C3 C8 0B jp write_sector 108/ 36 : 109/ 36 : (MACRO) fillto 0038h, 076h 109/ 36 : 76 76 db (0038H-$) dup (076H) 110/ 38 : 111/ 38 : ;****************************************************************** 112/ 38 : ; 38h: IM1 vector is entered when a PHI I/O is terminated 113/ 38 : 08 im1_jv: ex af, af' ; Save current flags 114/ 39 : F3 di 115/ 3A : DB 13 in a, (phi_status) ; Get the D0D1 bits 116/ 3C : D9 exx 117/ 3D : 21 5C 13 ld hl, terminate_listen_tranfer 118/ 40 : E3 ex (sp), hl 119/ 41 : D9 exx 120/ 42 : F5 push af 121/ 43 : 08 ex af, af' ; Restore saved flags 122/ 44 : F1 pop af ; Return with phi_status value in A 123/ 45 : ED 4D reti ; Jumps to terminate_listen_tranfer 124/ 47 : 125/ 47 : (MACRO) fillto 0057h, 076h 125/ 47 : 76 76 76 76 76 76 db (0057H-$) dup (076H) 4D : 76 76 76 76 76 76 53 : 76 76 76 76 126/ 57 : 127/ 57 : C3 4C 15 x0057: jp deselect_drives ; not reached?? 128/ 5A : C3 1A 15 jp prep_drive_regs ; not reached?? 129/ 5D : 130/ 5D : fmt_hp_track: 131/ 5D : C3 71 0E jp do_hp_fmt_track 132/ 60 : 133/ 60 : fmt_ibm_track_jv: 134/ 60 : C3 41 10 jp fmt_ibm_track 135/ 63 : 136/ 63 : verify_cylinder_jv: 137/ 63 : C3 33 07 jp verify_cylinder 138/ 66 : 139/ 66 : ;****************************************************************** 140/ 66 : ; 66h: NMI vector is entered for other PHI interrupts 141/ 66 : nmi_jv: 142/ 66 : C3 B9 13 jp do_phi_int 143/ 69 : 144/ 69 : (MACRO) fillto 006ah, 076h 144/ 69 : 76 db (006AH-$) dup (076H) 145/ 6A : 146/ 6A : seek_to_cylinder_jv: 147/ 6A : C3 84 05 jp do_seek_to_cylinder 148/ 6D : 149/ 6D : send_status_or_address_jv: 150/ 6D : C3 40 04 jp do_send_status_or_address 151/ 70 : 152/ 70 : done_holdoff: 153/ 70 : 3E 02 ld a, DSJ_holdoff 154/ 72 : 18 01 jr set_DSJ 155/ 74 : 156/ 74 : ; done_normal - normal command completion and cleanup 157/ 74 : done_normal: 158/ 74 : AF xor a ; A = DSJ_normal 159/ 75 : 160/ 75 : ;****************************************************************** 161/ 75 : ; set_DSJ - non-normal command completion and cleanup 162/ 75 : ; 163/ 75 : ; on entry: 164/ 75 : ; A: the DSJ value to set 165/ 75 : 166/ 75 : set_DSJ: 167/ 75 : 32 00 60 ld (DSJ), a 168/ 78 : 31 FF 63 ld sp, ramend ; Reset SP for next command 169/ 7B : AF xor a ; Clear PHI D0, D1 bits 170/ 7C : D3 13 out (phi_status), a 171/ 7E : 32 0C 60 ld (parity_check_state), a ; disable HP-IB parity checking 172/ 81 : 3E 0D ld a, FIFO_ROOM_m | FIFO_BYTE_m | DEV_CLR_m 173/ 83 : D3 11 out (phi_int_mask), a 174/ 85 : DB 14 in a, (phi_control) ; clear parity freeze 175/ 87 : CB B7 res PRTY_FRZ, a 176/ 89 : D3 14 out (phi_control), a 177/ 8B : 178/ 8B : do_device_clear: 179/ 8B : AF xor a 180/ 8C : 32 01 60 ld (S1), a ; S1_NORMAL 181/ 8F : 32 02 60 ld (S1_unit), a ; Unit 0 182/ 92 : 32 06 60 ld (head_unload_set), a ; clear head_unload_set 183/ 95 : CD 4D 12 call prep_for_next_cmd 184/ 98 : CD 66 12 call set_parity_check_state 185/ 9B : AF xor a 186/ 9C : D3 64 out (cntl), a ; turn off write mode, etc 187/ 9E : D3 13 out (phi_status), a ; D0D1=00 188/ A0 : D3 16 out (phi_id1), a ; set Identify bytes (ID_BYTE_1 = 00h) 189/ A2 : 3E 81 ld a, ID_BYTE_2 190/ A4 : D3 17 out (phi_id2), a 191/ A6 : 3E 41 ld a, PRTY_ERR_m | DATA_FRZ_m ; D0D1=01, clear output data freeze 192/ A8 : D3 13 out (phi_status), a 193/ AA : 3E FF ld a, 0ffh ; enable all interrupt conditions 194/ AC : D3 10 out (phi_int_cond), a 195/ AE : FD 36 0D 03 ld (iy + YB(tmp_unit)), NUNITS - 1 ; initialize the DriveData structures 196/ B2 : 197/ B2 : .drive_init_loop: 198/ B2 : 3A 0D 60 ld a, (tmp_unit) 199/ B5 : FE FF cp -1 200/ B7 : 28 51 jr z, exit_drive_init_loop 201/ B9 : FD 35 0D dec (iy + YB(tmp_unit)) 202/ BC : 47 ld b, a 203/ BD : CD 07 15 call get_drive_data_ptr_in_ix 204/ C0 : AF xor a 205/ C1 : D3 65 out (drv), a ; reset drv register (head 0, not in use) 206/ C3 : DD 77 04 ld (ix + DriveData.drv), a ; Keep a copy 207/ C6 : 208/ C6 : 04 inc b ; calculate the drive's select bit #(3 - unit) 209/ C7 : 3E 10 ld a, DRV0_m << 1 210/ C9 : 0F .loop: rrca 211/ CA : 10 FD djnz .loop 212/ CC : 213/ CC : DD 77 09 ld (ix + DriveData.xv), a ; save it for later use (clearing the other bits) 214/ CF : D3 66 out (xv), a ; select the drive too 215/ D1 : CD 12 16 call get_drive_SS ; get the drive's current status 216/ D4 : 28 17 jr z, .no_disc_or_fs 217/ D6 : 3A 00 60 ld a, (DSJ) 218/ D9 : FE 02 cp DSJ_holdoff 219/ DB : 28 12 jr z, .first_status ; in holdoff 220/ DD : DD 7E 05 ld a, (ix + DriveData.stat2) 221/ E0 : E6 1E and DISC_TYPE_m 222/ E2 : 57 ld d, a ; stat2 (not its usual register assignment) 223/ E3 : DD 7E 06 ld a, (ix + DriveData.stat2_ds) 224/ E6 : E6 4B and STAT2_W_m | STAT2_F_m | SS_m 225/ E8 : 5F ld e, a ; stat2_ds (not its usual register assignment) 226/ E9 : E6 03 and SS_m ; isolate stat2 SS, clear the other bits - seems unused 227/ EB : 18 0B jr .set_status 228/ ED : 229/ ED : .no_disc_or_fs: 230/ ED : 30 06 jr nc, .no_disc 231/ EF : .first_status: 232/ EF : 16 00 ld d, 0 ; clear stat2 233/ F1 : 1E 08 ld e, STAT2_F_m 234/ F3 : 18 03 jr .set_status 235/ F5 : 236/ F5 : .no_disc: 237/ F5 : 5F ld e, a 238/ F6 : 16 00 ld d, 0 ; clear stat2 239/ F8 : .set_status: 240/ F8 : DD 72 05 ld (ix + DriveData.stat2), d 241/ FB : DD 73 06 ld (ix + DriveData.stat2_ds), e 242/ FE : (MACRO) reset_drive 242/ FE : CF rst 08h 243/ FF : 28 04 jr z, .skip_c 244/ 101 : DD 36 06 04 ld (ix + DriveData.stat2_ds), STAT2_C_m ; seek check 245/ 105 : .skip_c: 246/ 105 : CD 4C 15 call deselect_drives 247/ 108 : 18 A8 jr .drive_init_loop 248/ 10A : 249/ 10A : exit_drive_init_loop: 250/ 10A : DB 14 in a, (phi_control) 251/ 10C : E6 40 and PRTY_FRZ_m ; save the parity freeze state 252/ 10E : F6 89 or EIGHT_BIT_m | RSPD_PP_m | INIT_FIFO_m 253/ 110 : 47 ld b, a ; set initial PHI control state 254/ 111 : 3E 07 ld a, POLL_HLDF 255/ 113 : D3 13 out (phi_status), a 256/ 115 : 78 ld a, b 257/ 116 : D3 14 out (phi_control), a 258/ 118 : 259/ 118 : DB 63 in a, (switches) 260/ 11A : E6 1F and ADDRESS_PHI_m ; read the HP-IB address from the switches 261/ 11C : F6 80 or ONL_m ; set the HP-IB online state 262/ 11E : 263/ 11E : ; Possible bug here? D0=1 from previous write to phi_status above, 264/ 11E : ; but that will cause the CRCE bit to be enabled for this write to 265/ 11E : ; phi_address. Will that enable the PHI CRC SAD 11h support even 266/ 11E : ; though the service manual says they are supposed to be ignored? 267/ 11E : D3 15 out (phi_address), a 268/ 120 : ED 56 im 1 ; Interrupt mode 1 vectors INT to 038h 269/ 122 : 3A 00 60 ld a, (DSJ) 270/ 125 : FE 02 cp DSJ_holdoff 271/ 127 : 20 02 jr nz, do_wait_for_cmd ; not holdoff 272/ 129 : 18 1F jr show_idle_state 273/ 12B : 274/ 12B : ;****************************************************************** 275/ 12B : ; do_wait_for_cmd - the main idle loop 276/ 12B : 277/ 12B : do_wait_for_cmd: 278/ 12B : CD 4D 12 call prep_for_next_cmd 279/ 12E : 3A 00 60 ld a, (DSJ) ; form the waiting + DSJ state pattern 280/ 131 : 07 rlca ; put DSJ value into proper position 281/ 132 : F6 10 or IU_WAIT_DSJ 282/ 134 : (MACRO) set_in_use_leds 282/ 134 : EF rst 28h 283/ 135 : 284/ 135 : cmd_wait_loop: 285/ 135 : 06 00 ld b, 0 286/ 137 : ;x0137: 287/ 137 : CD 85 12 .inner: call poll_input_or_DCL 288/ 13A : 20 09 jr nz, .exitloop 289/ 13C : 10 F9 djnz .inner ; not 256 interations yet 290/ 13E : 16 10 ld d, 16 ; approx 1/16 s elapsed? 291/ 140 : CD 5F 15 call head_unload_timer_check 292/ 143 : 18 F0 jr cmd_wait_loop 293/ 145 : 294/ 145 : .exitloop: 295/ 145 : CD 54 01 call read_Amigo_cmd 296/ 148 : 18 E1 jr do_wait_for_cmd 297/ 14A : 298/ 14A : ;****************************************************************** 299/ 14A : ; show_idle_state - entered after a device clear has executed 300/ 14A : ; 301/ 14A : ; Lighting the DONE LED shows either self test has stopped or that 302/ 14A : ; the 9895A is not under active control of an HP-IB controller. 303/ 14A : 304/ 14A : show_idle_state: 305/ 14A : 3A 07 60 ld a, (leds_shdw) 306/ 14D : CB C7 set DONE, a 307/ 14F : 2F cpl ; (Complement for LED OC drivers) 308/ 150 : D3 63 out (leds), a ; Show it 309/ 152 : 18 E1 jr cmd_wait_loop 310/ 154 : 311/ 154 : ;****************************************************************** 312/ 154 : ; read_Amigo_cmd - read an Amigo command and process it 313/ 154 : 314/ 154 : read_Amigo_cmd: 315/ 154 : CD 72 12 call do_PPD 316/ 157 : 3E F9 ld a, ~IU_RECV ; OC LED drivers need complemented data 317/ 159 : D3 63 out (leds), a 318/ 15B : 319/ 15B : .wait_for_sad: 320/ 15B : DB 12 in a, (phi_fifo) ; Read the HP-IB data byte 321/ 15D : 4F ld c, a 322/ 15E : DB 13 in a, (phi_status) 323/ 160 : CB 77 bit SAD_D1, a ; Was D1 set (maybe rcvd a secondary address)? 324/ 162 : 20 05 jr nz, .handle_sad 325/ 164 : CD AE 01 call wait_for_input_or_DCL 326/ 167 : 18 F2 jr .wait_for_sad 327/ 169 : 328/ 169 : .handle_sad: 329/ 169 : E6 C0 and D0D1_m ; isolate D0D1 bits 330/ 16B : FE 40 cp SAD_D1_m ; secondary address? 331/ 16D : C2 73 14 jp nz, abort_IO_program_error ; no, EOI 332/ 170 : 79 ld a, c ; handle secondary address 333/ 171 : FE 30 cp DSJ_SAD 334/ 173 : CA E0 03 jp z, cmd_DSJ ; yes, handle DSJ command 335/ 176 : CD 90 12 call check_for_parity_error 336/ 179 : 79 ld a, c ; A = secondary address 337/ 17A : FE 10 cp HP300_CLEAR_SAD 338/ 17C : CA 12 03 jp z, do_HP_300_Clear ; yes, HP-300 clear (listener) 339/ 17F : 340/ 17F : E6 1F and SAD_m 341/ 181 : 21 C9 01 ld hl, SAD_dispatch_table 342/ 184 : 11 03 00 ld de, 3 ; ? sets D = 0, E gets overwritten later 343/ 187 : 06 09 ld b, 9 ; SAD_dispatch_table length 344/ 189 : BE .loop: cp (hl) 345/ 18A : 28 06 jr z, .matched 346/ 18C : 19 add hl, de 347/ 18D : 10 FA djnz .loop 348/ 18F : C3 73 14 jp abort_IO_program_error ; no match found 349/ 192 : 350/ 192 : .matched: 351/ 192 : 23 inc hl ; HL points to listen SAD entry 352/ 193 : CB 69 bit TLK, c ; addressed to talk? 353/ 195 : 28 01 jr z, .skip 354/ 197 : 23 inc hl ; HL points to talk SAD entry 355/ 198 : 5E .skip: ld e, (hl) ; find the jump table entry's address 356/ 199 : 21 E4 01 ld hl, SAD_jmptbl 357/ 19C : 19 add hl, de 358/ 19D : 359/ 19D : ;****************************************************************** 360/ 19D : ; dispatch_cmd - execute a command handler 361/ 19D : ; 362/ 19D : ; on entry: 363/ 19D : ; HL: pointer to the handler's address 364/ 19D : 365/ 19D : dispatch_cmd: 366/ 19D : 5E ld e, (hl) 367/ 19E : 23 inc hl 368/ 19F : 66 ld h, (hl) 369/ 1A0 : 6B ld l, e 370/ 1A1 : 371/ 1A1 : 11 A6 01 ld de, ignore_cmd ; in case (HL) returns? 372/ 1A4 : D5 push de 373/ 1A5 : E9 jp (hl) ; call subroutine pointed to by HL 374/ 1A6 : 375/ 1A6 : ignore_cmd: 376/ 1A6 : CD 85 12 call poll_input_or_DCL 377/ 1A9 : C0 ret nz 378/ 1AA : CD 78 12 call do_PPE 379/ 1AD : C9 ret 380/ 1AE : 381/ 1AE : ;****************************************************************** 382/ 1AE : ; wait_for_input_or_DCL - wait until there are input bytes or a DCL 383/ 1AE : ; If we've been addressed to talk or listen in this state do nothing until 384/ 1AE : ; we time out as we are supposed to be reading command data. 385/ 1AE : wait_for_input_or_DCL: 386/ 1AE : 01 00 00 ld bc, 0 387/ 1B1 : 16 1F ld d, 31 388/ 1B3 : .loop: 389/ 1B3 : CD 85 12 call poll_input_or_DCL 390/ 1B6 : C0 ret nz 391/ 1B7 : DB 13 in a, (phi_status) 392/ 1B9 : E6 06 and TLK_IDF_m | LTN_m ; addressed to talk or listen? 393/ 1BB : CA 73 14 jp z, abort_IO_program_error ; no 394/ 1BE : 10 F3 djnz .loop 395/ 1C0 : 0D dec c 396/ 1C1 : 20 F0 jr nz, .loop 397/ 1C3 : 15 dec d 398/ 1C4 : 20 ED jr nz, .loop 399/ 1C6 : C3 73 14 jp abort_IO_program_error ; timed out 400/ 1C9 : 401/ 1C9 : ;****************************************************************** 402/ 1C9 : ; secondary address (SAD) dispatch data tables 403/ 1C9 : ; first byte is secondary address 404/ 1C9 : ; second and third bytes are byte indexes into jump table at SAD_jmptbl 405/ 1C9 : ; second byte = listen, third byte = talk 406/ 1C9 : SAD_dispatch_table: 407/ 1C9 : 08 04 00 db 08h, 04h, 00h 408/ 1CC : 09 04 00 db 09h, 04h, 00h 409/ 1CF : 0A 04 00 db 0ah, 04h, 00h 410/ 1D2 : 0B 04 00 db 0bh, 04h, 00h 411/ 1D5 : 0C 04 00 db 0ch, 04h, 00h 412/ 1D8 : 0F 10 00 db 0fh, 10h, 00h 413/ 1DB : 11 06 02 db 11h, 06h, 02h 414/ 1DE : 1E 08 0A db 1eh, 08h, 0ah 415/ 1E1 : 1F 0C 0E db 1fh, 0ch, 0eh 416/ 1E4 : 417/ 1E4 : SAD_jmptbl: 418/ 1E4 : 73 14 dw abort_IO_program_error ; invalid or send status or address?? 419/ 1E6 : EC 12 dw terminate_talk ; talker 11: HP-IB CRC 420/ 1E8 : F6 01 dw do_unit_cmds ; listener 08, 09, 0a, 0b, 0c: commands 421/ 1EA : A6 01 dw ignore_cmd ; listener 11: HP-IB CRC 422/ 1EC : EA 11 dw write_loopback ; listener 1e 423/ 1EE : DB 11 dw read_loopback ; talker 1e 424/ 1F0 : 06 12 dw initiate_self_test ; listener 1f 425/ 1F2 : 25 12 dw read_self_test ; talker 1f 426/ 1F4 : F2 11 dw download ; listener 0f 427/ 1F6 : 428/ 1F6 : 429/ 1F6 : ;****************************************************************** 430/ 1F6 : ; do_unit_cmds - handle reading command data bytes for drive related commands. 431/ 1F6 : ; listen with secondary address 08, 09, 0a, 0b, 0c (via tables) 432/ 1F6 : ; and 10 (HP-300 Clear) explicitly 433/ 1F6 : ; on entry: 434/ 1F6 : ; C: the SAD byte that sent us here 435/ 1F6 : do_unit_cmds: 436/ 1F6 : 21 46 60 ld hl, cmd_count 437/ 1F9 : C5 push bc 438/ 1FA : E5 push hl 439/ 1FB : 1E 00 ld e, 0 ; E: count of bytes read 440/ 1FD : 23 inc hl ; buffer follows cmd_count in memory 441/ 1FE : CD AE 01 .loop: call wait_for_input_or_DCL 442/ 201 : 0E 12 ld c, phi_fifo 443/ 203 : ED A2 ini ; read a byte from the controller 444/ 205 : DB 13 in a, (phi_status) 445/ 207 : 1C inc e 446/ 208 : CB 77 bit SAD_D1, a 447/ 20A : 20 04 jr nz, .handle_EOI ; Possible EOI or SAD 448/ 20C : AF xor a 449/ 20D : BB cp e ; read 256 bytes? 450/ 20E : 20 EE jr nz, .loop 451/ 210 : 452/ 210 : .handle_EOI: 453/ 210 : E6 C0 and D0D1_m 454/ 212 : FE 40 cp SAD_D1_m ; SAD received? 455/ 214 : 20 0A jr nz, .cmddone ; no EOI, command input complete 456/ 216 : CD 90 12 call check_for_parity_error 457/ 219 : 2B dec hl 458/ 21A : 7E ld a, (hl) ; get the SAD byte we just read (not the original one) 459/ 21B : FE 10 cp HP300_CLEAR_SAD 460/ 21D : CA 13 00 jp z, HP_300_Clear_jv 461/ 220 : ; missing error handling for multiple SAD bytes received not done here? 462/ 220 : ; (Fall through ignores any non HP-300 Clear SAD) 463/ 220 : 464/ 220 : .cmddone: 465/ 220 : E1 pop hl 466/ 221 : 73 ld (hl), e ; save the transfer byte count 467/ 222 : C1 pop bc 468/ 223 : 469/ 223 : 21 64 02 ld hl, cmdtbl 470/ 226 : 16 00 ld d, 0 471/ 228 : ;x0228: 472/ 228 : ; Note: guaranteed to find a match due to the table lookup in read_Amigo_cmd. 473/ 228 : .loopdispatch: 474/ 228 : 79 ld a, c ; does secondary address match table header? 475/ 229 : BE cp (hl) 476/ 22A : 28 0C jr z, .found ; yes 477/ 22C : 23 inc hl ; no, get length of table 478/ 22D : 46 ld b, (hl) 479/ 22E : 23 inc hl 480/ 22F : 481/ 22F : AF xor a ; HL := HL + b * 4 (find next table) 482/ 230 : C6 04 .mullp: add a, 4 483/ 232 : 10 FC djnz .mullp 484/ 234 : 5F ld e, a 485/ 235 : 19 add hl, de ; HL now points to the next table 486/ 236 : 18 F0 jr .loopdispatch 487/ 238 : 488/ 238 : 23 .found: inc hl 489/ 239 : 3A 47 60 ld a, (cmd_opcode) 490/ 23C : E6 1F and 1fh ; mask parity? 491/ 23E : 28 0A jr z, .nounit ; opcode == 00h only for Cold Load Read 492/ 240 : 47 ld b, a 493/ 241 : 3A 48 60 ld a, (cmd_unit) 494/ 244 : E6 0F and 0fh ; mask parity? 495/ 246 : 32 48 60 ld (cmd_unit), a 496/ 249 : 78 ld a, b ; A has opcode again 497/ 24A : 498/ 24A : .nounit: 499/ 24A : 46 ld b, (hl) ; get length of table 500/ 24B : 1E 04 ld e, 4 ; DE = 4 (table entry length) 501/ 24D : 23 inc hl 502/ 24E : BE .cmdlp: cp (hl) ; does command match? 503/ 24F : 28 06 jr z, .cmdfound 504/ 251 : 19 add hl, de ; no, advance to next entry 505/ 252 : 10 FA djnz .cmdlp 506/ 254 : C3 7C 14 jp abort_illegal_opcode ; command not found 507/ 257 : 508/ 257 : .cmdfound: 509/ 257 : 23 inc hl ; advance pointer to length byte 510/ 258 : 3A 46 60 ld a, (cmd_count) 511/ 25B : BE cp (hl) ; does command length match? 512/ 25C : C2 73 14 jp nz, abort_IO_program_error 513/ 25F : 23 inc hl ; advance pointer to dispatch vector 514/ 260 : D1 pop de 515/ 261 : C3 9D 01 jp dispatch_cmd 516/ 264 : 517/ 264 : 518/ 264 : ; command dispatch tables 519/ 264 : ; a series of tables for each listen secondary address (08 through 0c) 520/ 264 : 521/ 264 : ; each table has a two byte header 522/ 264 : ; first byte - secondary address 523/ 264 : ; second byte - table length in 4 byte entries 524/ 264 : 525/ 264 : ; each table entry is four bytes 526/ 264 : ; first byte - opcode 527/ 264 : ; second byte - data byte count (including SAD byte) 528/ 264 : ; third and fourth bytes - execution address 529/ 264 : 530/ 264 : cmdtbl: 531/ 264 : ; secondary address 08 532/ 264 : 08 09 db 08h, 09h 533/ 266 : 534/ 266 : 03 02 db 03h, 02h 535/ 268 : 34 04 dw cmd_request_status 536/ 26A : 537/ 26A : 02 06 db 02h, 06h 538/ 26C : F0 04 dw cmd_seek 539/ 26E : 540/ 26E : 05 02 db 05h, 02h 541/ 270 : 43 07 dw cmd_unbuffered_read 542/ 272 : 543/ 272 : 08 02 db 08h, 02h 544/ 274 : 86 0B dw cmd_unbuffered_write 545/ 276 : 546/ 276 : 15 02 db 15h, 02h 547/ 278 : 6D 03 dw cmd_end 548/ 27A : 549/ 27A : 14 02 db 14h, 02h 550/ 27C : AD 11 dw cmd_request_logical_address 551/ 27E : 552/ 27E : 07 04 db 07h, 04h 553/ 280 : 8A 07 dw cmd_verify 554/ 282 : 555/ 282 : 0B 02 db 0bh, 02h 556/ 284 : A0 0C dw cmd_initialize 557/ 286 : 558/ 286 : 00 02 db 00h, 02h 559/ 288 : F3 07 dw cmd_cold_load_read 560/ 28A : 561/ 28A : ; secondary address 09 562/ 28A : 09 01 db 09h, 01h 563/ 28C : 564/ 28C : 08 02 db 08h, 02h 565/ 28E : AC 0B dw cmd_buffered_write 566/ 290 : 567/ 290 : ; secondary address 0a 568/ 290 : 0A 03 db 0ah, 03h 569/ 292 : 570/ 292 : 03 02 db 03h, 02h 571/ 294 : 34 04 dw cmd_request_status 572/ 296 : 573/ 296 : 05 02 db 05h, 02h 574/ 298 : 09 07 dw cmd_buffered_read 575/ 29A : 576/ 29A : 14 02 db 14h, 02h 577/ 29C : AD 11 dw cmd_request_logical_address 578/ 29E : 579/ 29E : ; secondary address 0b 580/ 29E : 0B 02 db 0bh, 02h 581/ 2A0 : 582/ 2A0 : 05 02 db 05h, 02h 583/ 2A2 : 00 07 dw cmd_buffered_read_verify 584/ 2A4 : 585/ 2A4 : 06 02 db 06h, 02h 586/ 2A6 : 2C 08 dw cmd_id_triggered_read 587/ 2A8 : 588/ 2A8 : ; secondary address 0c 589/ 2A8 : 0C 05 db 0ch, 05h 590/ 2AA : 591/ 2AA : 19 02 db 19h, 02h 592/ 2AC : 80 11 dw cmd_door_lock 593/ 2AE : 594/ 2AE : 1A 02 db 1ah, 02h 595/ 2B0 : 99 11 dw cmd_door_unlock 596/ 2B2 : 597/ 2B2 : 05 02 db 05h, 02h 598/ 2B4 : 3A 07 dw cmd_unbuffered_read_verify 599/ 2B6 : 600/ 2B6 : 18 05 db 018h, 005h 601/ 2B8 : FB 0C dw cmd_format 602/ 2BA : 603/ 2BA : 14 02 db 14h, 02h 604/ 2BC : BF 11 dw cmd_request_physical_address 605/ 2BE : 606/ 2BE : check_for_holdoff: 607/ 2BE : 3A 00 60 ld a, (DSJ) 608/ 2C1 : FE 02 cp DSJ_holdoff 609/ 2C3 : C0 ret nz ; not holdoff 610/ 2C4 : C3 64 14 jp cmd_terminate 611/ 2C7 : 612/ 2C7 : ;****************************************************************** 613/ 2C7 : ; verify_known_format - verify the disc has a known format 614/ 2C7 : ; 615/ 2C7 : ; exits via abort_stat2_error if unknown 616/ 2C7 : ;x02c7: 617/ 2C7 : verify_known_format: 618/ 2C7 : 3A 09 60 ld a, (disc_format) 619/ 2CA : FE 02 cp FORMAT_UNKNOWN_m 620/ 2CC : CA 9C 14 jp z, abort_stat2_error 621/ 2CF : C9 ret 622/ 2D0 : 623/ 2D0 : verify_write_enabled: 624/ 2D0 : DB 62 in a, (drv_status) 625/ 2D2 : CB 5F bit WRPROT, a 626/ 2D4 : C2 9C 14 jp nz, abort_stat2_error 627/ 2D7 : C9 ret 628/ 2D8 : 629/ 2D8 : ; not quite check_unit_ready?? better term? 630/ 2D8 : check_unit_ready: 631/ 2D8 : CD EB 02 call verify_unit_ready 632/ 2DB : CD C1 14 call check_DSJ_S1 633/ 2DE : C8 ret z ; OK, DSJ normal 634/ 2DF : 3A 01 60 ld a, (S1) 635/ 2E2 : FE 01 cp S1_ILL_OP 636/ 2E4 : C8 ret z 637/ 2E5 : FE 0A cp S1_IPE 638/ 2E7 : C8 ret z 639/ 2E8 : C3 64 14 jp cmd_terminate 640/ 2EB : 641/ 2EB : ;****************************************************************** 642/ 2EB : ; verify_unit_ready - validate the unit number and check for ready status 643/ 2EB : ; 644/ 2EB : ; on entry: 645/ 2EB : ; IY - RAM pointer 646/ 2EB : ; 647/ 2EB : ; exits via cmd_terminate or abort_stat2_error if not valid/ready 648/ 2EB : ; on exit: 649/ 2EB : ; IX: DriveData pointer 650/ 2EB : ; 651/ 2EB : 652/ 2EB : verify_unit_ready: 653/ 2EB : FD 7E 48 ld a, (iy + YB(cmd_unit)) 654/ 2EE : FE 04 cp NUNITS 655/ 2F0 : FA FB 02 jp m, .ok 656/ 2F3 : 3E 17 ld a, S1_UA ; unit unavailable 657/ 2F5 : CD A3 14 call set_abort_S1 658/ 2F8 : C3 64 14 jp cmd_terminate 659/ 2FB : 660/ 2FB : CD 1A 15 .ok: call prep_drive_regs 661/ 2FE : CD 12 16 call get_drive_SS 662/ 301 : D2 9C 14 jp nc, abort_stat2_error 663/ 304 : 20 04 jr nz, .skip 664/ 306 : DD CB 06 DE set STAT2_F, (ix + DriveData.stat2_ds) 665/ 30A : DD CB 06 5E .skip: bit STAT2_F, (ix + DriveData.stat2_ds) 666/ 30E : C2 9C 14 jp nz, abort_stat2_error 667/ 311 : C9 ret 668/ 312 : 669/ 312 : 670/ 312 : ;****************************************************************** 671/ 312 : ; do_HP_300_Clear - handle the HP-300 Device Clear command 672/ 312 : ; 673/ 312 : ; This is the expected HP-IB sequence for an HP-300 Device Clear: 674/ 312 : ; MLA SDC SDC UNL 675/ 312 : ;x0312: 676/ 312 : do_HP_300_Clear: 677/ 312 : 01 00 00 ld bc, 0 678/ 315 : 16 5A ld d, 90 ; wait ? ms for DEVICE CLEAR? 679/ 317 : DB 10 .loop: in a, (phi_int_cond) 680/ 319 : CB 47 bit DEV_CLR, a 681/ 31B : 20 0F jr nz, .gotdcl 682/ 31D : 10 F8 djnz .loop 683/ 31F : 0D dec c 684/ 320 : 20 F5 jr nz, .loop 685/ 322 : 15 dec d 686/ 323 : 20 F2 jr nz, .loop 687/ 325 : 688/ 325 : .clrerr: 689/ 325 : 3E 01 ld a, DEV_CLR_m ; clear DEVICE CLEAR status not received 690/ 327 : D3 10 out (phi_int_cond), a 691/ 329 : C3 73 14 jp abort_IO_program_error 692/ 32C : 693/ 32C : .gotdcl: 694/ 32C : CB 57 bit FIFO_BYTE, a 695/ 32E : 28 F5 jr z, .clrerr ; control byte is missing 696/ 330 : 697/ 330 : DB 12 in a, (phi_fifo) 698/ 332 : 47 ld b, a 699/ 333 : DB 13 in a, (phi_status) ; get D0D1 for this byte 700/ 335 : E6 C0 and D0D1_m 701/ 337 : FE C0 cp IN_EOI 702/ 339 : 20 EA jr nz, .clrerr ; not EOI 703/ 33B : 704/ 33B : AF xor a ; A = DSJ_normal 705/ 33C : 32 00 60 ld (DSJ), a 706/ 33F : CB 40 bit ENABLE_PARITY_CHECK, b 707/ 341 : 28 02 jr z, .skip ; disable parity check (A == 0 here) 708/ 343 : 709/ 343 : 3E 40 ld a, PRTY_FRZ_m ; enable parity check 710/ 345 : 47 .skip: ld b, a 711/ 346 : DB 14 in a, (phi_control) 712/ 348 : B0 or b 713/ 349 : D3 14 out (phi_control), a ; set the desired parity freeze state 714/ 34B : 715/ 34B : 78 ld a, b 716/ 34C : 32 0C 60 ld (parity_check_state), a ; save the parity check state 717/ 34F : D3 13 out (phi_status), a 718/ 351 : 3E 03 ld a, FIFO_ROOM | FIFO_BYTE | DEV_CLR 719/ 353 : D3 11 out (phi_int_mask), a 720/ 355 : CB 70 bit PRTY_FRZ, b ; parity check enabled? 721/ 357 : C2 8B 00 jp nz, do_device_clear 722/ 35A : CD 90 12 call check_for_parity_error 723/ 35D : C3 8B 00 jp do_device_clear 724/ 360 : 725/ 360 : ;****************************************************************** 726/ 360 : ; saves AF or jumps to normal if no command_byte is waiting 727/ 360 : ;x0360: 728/ 360 : do_check_for_command_byte: 729/ 360 : F5 push af 730/ 361 : CD 72 12 call do_PPD 731/ 364 : DB 10 in a, (phi_int_cond) 732/ 366 : CB 57 bit FIFO_BYTE, a 733/ 368 : CA 74 00 jp z, done_normal ; no fifo bytes available, done_normal doesn't return to the caller 734/ 36B : F1 pop af 735/ 36C : C9 ret 736/ 36D : 737/ 36D : ;****************************************************************** 738/ 36D : ; cmd_end - wait for a change in drive status or a command is received 739/ 36D : cmd_end: 740/ 36D : CD BE 02 call check_for_holdoff 741/ 370 : 3E 02 ld a, IU_WAIT 742/ 372 : (MACRO) set_in_use_leds 742/ 372 : EF rst 28h 743/ 373 : 3A 03 60 ld a, (current_unit) 744/ 376 : 32 0D 60 ld (tmp_unit), a 745/ 379 : CD B1 14 call normal_and_deselect_drives 746/ 37C : 747/ 37C : .scanloop: 748/ 37C : FD 36 03 03 ld (iy + YB(current_unit)), 3 ; Scan the drives for a change 749/ 380 : .nextdrive: 750/ 380 : 3A 03 60 ld a, (current_unit) 751/ 383 : CD 1A 15 call prep_drive_regs 752/ 386 : DD 5E 06 ld e, (ix + DriveData.stat2_ds) 753/ 389 : CD 12 16 call get_drive_SS 754/ 38C : 20 0D jr nz, .skip ; A not valid (no SS value) 755/ 38E : 38 2D jr c, .gofs ; drive ready 756/ 390 : 47 ld b, a ; B = current SS value 757/ 391 : 7B ld a, e ; A = previous SS value 758/ 392 : E6 03 and SS_m 759/ 394 : FE 02 cp SS_NO_DRV 760/ 396 : 28 03 jr z, .skip 761/ 398 : B8 cp b 762/ 399 : 20 24 jr nz, .goda ; SS value has changed 763/ 39B : CB 5B .skip: bit STAT2_F, e 764/ 39D : 20 1E jr nz, .gofs 765/ 39F : CD 85 12 call poll_input_or_DCL 766/ 3A2 : 20 25 jr nz, .exitend 767/ 3A4 : CD 4C 15 call deselect_drives 768/ 3A7 : FD 35 03 dec (iy + YB(current_unit)) 769/ 3AA : F2 80 03 jp p, .nextdrive 770/ 3AD : 771/ 3AD : 06 00 ld b, 0 ; delay a bit looking for new input 772/ 3AF : CD 85 12 .loop: call poll_input_or_DCL 773/ 3B2 : 20 15 jr nz, .exitend 774/ 3B4 : 10 F9 djnz .loop 775/ 3B6 : 776/ 3B6 : 16 12 ld d, 18 ; approx 18/256s elapsed? 777/ 3B8 : CD 5F 15 call head_unload_timer_check 778/ 3BB : 18 BF jr .scanloop 779/ 3BD : 780/ 3BD : CB DB .gofs: set STAT2_F, e 781/ 3BF : CB FB .goda: set STAT2_A, e 782/ 3C1 : DD 73 06 ld (ix + DriveData.stat2_ds), e 783/ 3C4 : 3E 1F ld a, S1_DA 784/ 3C6 : CD A3 14 call set_abort_S1 785/ 3C9 : 786/ 3C9 : .exitend: 787/ 3C9 : CD 4C 15 call deselect_drives 788/ 3CC : 3A 0D 60 ld a, (tmp_unit) 789/ 3CF : 32 03 60 ld (current_unit), a 790/ 3D2 : C9 ret 791/ 3D3 : 792/ 3D3 : 793/ 3D3 : (MACRO) fillto 03e0h, 076h 793/ 3D3 : 76 76 76 76 76 76 db (03E0H-$) dup (076H) 3D9 : 76 76 76 76 76 76 3DF : 76 794/ 3E0 : 795/ 3E0 : 796/ 3E0 : ; return the DSJ byte 797/ 3E0 : cmd_DSJ: 798/ 3E0 : DB 10 in a, (phi_int_cond) 799/ 3E2 : DB 13 in a, (phi_status) 800/ 3E4 : E6 40 and PRTY_ERR_m 801/ 3E6 : 20 3F jr nz, .prtyerr 802/ 3E8 : 803/ 3E8 : .continue: 804/ 3E8 : DB 14 in a, (phi_control) 805/ 3EA : F6 01 or INIT_FIFO_m 806/ 3EC : D3 14 out (phi_control), a 807/ 3EE : 808/ 3EE : 3E 81 ld a, OUT_END_m | DATA_FRZ_m ; EOI, initialize outbound FIFO 809/ 3F0 : D3 13 out (phi_status), a 810/ 3F2 : 3A 00 60 ld a, (DSJ) ; send the current DSJ byte 811/ 3F5 : D3 12 out (phi_fifo), a 812/ 3F7 : DB 10 in a, (phi_int_cond) 813/ 3F9 : CB 57 bit FIFO_BYTE, a 814/ 3FB : C2 67 14 jp nz, listen_terminate ; unexpected byte in the inbound FIFO 815/ 3FE : 3A 00 60 ld a, (DSJ) 816/ 401 : D6 02 sub DSJ_holdoff ; detect transition from holdoff or parity error? 817/ 403 : D8 ret c ; return if DSJ was normal or abort 818/ 404 : 819/ 404 : ; Map the last command's S1 code into the previous DSJ value 820/ 404 : 3A 01 60 ld a, (S1) 821/ 407 : B7 or a 822/ 408 : 28 19 jr z, .saveit ; DSJ_normal 823/ 40A : FE 1F cp S1_DA ; drive attention? 824/ 40C : 20 13 jr nz, .aborted 825/ 40E : FD 46 03 ld b, (iy + YB(current_unit)) 826/ 411 : CD 07 15 call get_drive_data_ptr_in_ix 827/ 414 : CD 00 15 call get_drive_stat2_bytes 828/ 417 : CB 62 bit STAT2_E, d 829/ 419 : 20 06 jr nz, .aborted 830/ 41B : CB 52 bit STAT2_C, d 831/ 41D : 3E 00 ld a, DSJ_normal 832/ 41F : 28 02 jr z, .saveit 833/ 421 : .aborted: 834/ 421 : 3E 01 ld a, DSJ_aborted 835/ 423 : .saveit: 836/ 423 : 32 00 60 ld (DSJ), a 837/ 426 : C9 ret 838/ 427 : 839/ 427 : .prtyerr: 840/ 427 : 06 06 ld b, PRTY_ERR ; reset the parity error 841/ 429 : D3 13 out (phi_status), a 842/ 42B : AF xor a 843/ 42C : D3 10 out (phi_int_cond), a 844/ 42E : FD 36 00 03 ld (iy + YB(DSJ)), DSJ_parity_error 845/ 432 : 18 B4 jr .continue 846/ 434 : 847/ 434 : 848/ 434 : cmd_request_status: 849/ 434 : CD BE 02 call check_for_holdoff 850/ 437 : 3E 08 ld a, IU_STAT 851/ 439 : (MACRO) set_in_use_leds 851/ 439 : EF rst 28h 852/ 43A : 3A 48 60 ld a, (cmd_unit) 853/ 43D : CD 23 00 call determine_unit_status_jv 854/ 440 : 855/ 440 : ;****************************************************************** 856/ 440 : ; do_send_status_or_address - send the request status or address response bytes 857/ 440 : ; waits for the talk 08h SAD then send the data bytes 858/ 440 : ; 859/ 440 : ; on entry: 860/ 440 : ; C = first byte, B = second byte 861/ 440 : ; E = third byte, D = fourth byte 862/ 440 : ; 863/ 440 : ; For status: 864/ 440 : ; C: stat1, B: stat1_unit 865/ 440 : ; E: stat2, D: stat2_ds 866/ 440 : ; 867/ 440 : ; For addresses: 868/ 440 : ; C: cylinder high, B: cylinder low 869/ 440 : ; E: head, D: sector or zeros 870/ 440 : 871/ 440 : do_send_status_or_address: 872/ 440 : C5 push bc ; save the status bytes 873/ 441 : D5 push de 874/ 442 : 06 28 ld b, TLK_M | 08h 875/ 444 : CD A3 12 call wait_for_HPIB_SAD ; (doesn't return if an error) 876/ 447 : D1 pop de ; restore status buffer bytes 877/ 448 : C1 pop bc 878/ 449 : 21 46 60 ld hl, cmd_count 879/ 44C : ED 43 47 60 ld (stat1), bc ; C: stat1, B: stat1_unit 880/ 450 : ED 53 49 60 ld (stat2), de ; E: stat2, D: stat2_ds 881/ 454 : FD 36 4B 01 ld (iy + YB(stat2_ds+1)), 1 ; dummy byte for the EOI? 882/ 458 : 06 03 ld b, FLUSH_FIFO_m | SEND_EOI_m 883/ 45A : 3E 04 ld a, 4 ; transfer 4 bytes 884/ 45C : CD F8 12 call do_talk_transfer 885/ 45F : CD B1 14 call normal_and_deselect_drives 886/ 462 : C9 ret 887/ 463 : 888/ 463 : do_determine_unit_status: 889/ 463 : 47 ld b, a ; save unit in B 890/ 464 : FE 04 cp NUNITS 891/ 466 : 38 06 jr c, .unitvalid 892/ 468 : 0E 17 ld c, S1_UA 893/ 46A : 11 00 00 ld de, 0 ; no stat 2 bits for unit unavailable 894/ 46D : C9 ret 895/ 46E : 896/ 46E : ; build status data values 897/ 46E : ; on return: 898/ 46E : ; C = stat1: 00DSSSSS 899/ 46E : ; B = stat1_unit: 000000UU 900/ 46E : ; E = stat2: *??TTTTR 901/ 46E : ; D = stat2_ds: AW?EFCSS 902/ 46E : .unitvalid: 903/ 46E : CD 1A 15 call prep_drive_regs 904/ 471 : CD 00 15 call get_drive_stat2_bytes ; D = stat2_ds, E = stat2 905/ 474 : CD 12 16 call get_drive_SS 906/ 477 : 28 0E jr z, .save_ss ; Z -> A is valid, A = SS bits 907/ 479 : 3E 00 ld a, SS_READY 908/ 47B : CB 5A bit STAT2_F, d 909/ 47D : 20 08 jr nz, .save_ss 910/ 47F : 7A ld a, d ; A = previous stat2_ds 911/ 480 : E6 03 and SS_m ; isolate the SS field 912/ 482 : FE 02 cp SS_NO_DRV ; is a drive connected? 913/ 484 : 37 scf 914/ 485 : 20 1F jr nz, .jrsr ; yes 915/ 487 : 916/ 487 : .save_ss: 917/ 487 : F5 push af ; save flags from get_drive_SS 918/ 488 : FE 03 cp SS_NO_DISC ; no disc in drive? 919/ 48A : 20 09 jr nz, .skipnd 920/ 48C : 7A ld a, d 921/ 48D : E6 03 and SS_m 922/ 48F : FE 02 cp SS_NO_DRV ; is a drive connected? 923/ 491 : 28 02 jr z, .skipnd 924/ 493 : 3E 03 ld a, SS_NO_DISC 925/ 495 : .skipnd: 926/ 495 : 47 ld b, a 927/ 496 : F1 pop af ; restore flags from get_drive_SS 928/ 497 : 78 ld a, b ; A = SS (drive status bits) 929/ 498 : CB 8A res SS_NOT_READY, d ; SS = 00 (drive ready) 930/ 49A : CB 82 res 0, d ; (clear SS_UNDEF just in case?) 931/ 49C : 1E 00 ld e, 0 ; clear stat2 fields 932/ 49E : CB AA res STAT2_UNDOC, d ; ? 933/ 4A0 : CB B2 res STAT2_W, d 934/ 4A2 : 38 04 jr c, .first ; (C saved from get_drive_SS) first status 935/ 4A4 : B2 or d ; include the SS bits 936/ 4A5 : 57 ld d, a 937/ 4A6 : 18 21 .jrsr: jr .setregs 938/ 4A8 : 939/ 4A8 : CB DA .first: set STAT2_F, d ; (first status) 940/ 4AA : DB 62 in a, (drv_status) 941/ 4AC : CB 5F bit WRPROT, a 942/ 4AE : 28 02 jr z, .skipw ; no 943/ 4B0 : CB F2 set STAT2_W, d ; (write protect) 944/ 4B2 : CD B7 15 .skipw: call load_head_ix ; try to determine the disc type? 945/ 4B5 : DD CB 04 BE res HEAD1, (ix + DriveData.drv) ; Select head 0 946/ 4B9 : (MACRO) deassert_in_use 946/ 4B9 : F7 rst 30h 947/ 4BA : CD 83 16 call get_double_sided_bit 948/ 4BD : CD 8D 16 call media_type_check 949/ 4C0 : 28 07 jr z, .setregs 950/ 4C2 : 3E 13 ld a, S1_S2E ; Stat 2 error 951/ 4C4 : CD A3 14 call set_abort_S1 952/ 4C7 : CB CB set DT_BLANK, e 953/ 4C9 : .setregs: 954/ 4C9 : FD 4E 01 ld c, (iy + YB(S1)) ; S1 955/ 4CC : FD 46 02 ld b, (iy + YB(S1_unit)) ; S1_unit 956/ 4CF : 7A ld a, d 957/ 4D0 : E6 17 and STAT2_E_m | STAT2_C_m | SS_m 958/ 4D2 : 28 02 jr z, .skipe 959/ 4D4 : CB FB set STAT2_ERROR, e 960/ 4D6 : 7A .skipe: ld a, d 961/ 4D7 : E6 63 and STAT2_W_m | STAT2_UNDOC_m | SS_m ; clear error bits 962/ 4D9 : DD 77 06 ld (ix + DriveData.stat2_ds), a 963/ 4DC : 7B ld a, e 964/ 4DD : E6 F8 and ~STAT2_ERROR 965/ 4DF : DD 77 05 ld (ix + DriveData.stat2), a 966/ 4E2 : C3 4C 15 jp deselect_drives ; returns from deselect_drives 967/ 4E5 : 968/ 4E5 : 969/ 4E5 : (MACRO) fillto 04f0h, 076h 969/ 4E5 : 76 76 76 76 76 76 db (04F0H-$) dup (076H) 4EB : 76 76 76 76 76 970/ 4F0 : 971/ 4F0 : 972/ 4F0 : ;****************************************************************** 973/ 4F0 : ; cmd_seek - perform the seek command 974/ 4F0 : ; 975/ 4F0 : ; on entry: 976/ 4F0 : ; IX - DriveData pointer 977/ 4F0 : ; IY - RAM pointer 978/ 4F0 : 979/ 4F0 : cmd_seek: 980/ 4F0 : CD BE 02 call check_for_holdoff 981/ 4F3 : CD EB 02 call verify_unit_ready 982/ 4F6 : CD C7 02 call verify_known_format 983/ 4F9 : FD 56 4B ld d, (iy + YB(seek_head)) 984/ 4FC : FD 46 4C ld b, (iy + YB(seek_sector)) 985/ 4FF : FD 7E 49 ld a, (iy + YB(seek_cylinder_msb)) 986/ 502 : B7 or a 987/ 503 : C2 90 14 jp nz, abort_seek_check 988/ 506 : FD 7E 4A ld a, (iy + YB(seek_cylinder_lsb)) 989/ 509 : 4F ld c, a 990/ 50A : FE 00 cp 0 991/ 50C : FA 90 14 jp m, abort_seek_check 992/ 50F : FE 4D cp PHYSICAL_TRACKS 993/ 511 : D2 90 14 jp nc, abort_seek_check 994/ 514 : CD 3E 16 call validate_sector_number 995/ 517 : C2 90 14 jp nz, abort_seek_check 996/ 51A : AF xor a 997/ 51B : BA cp d ; D: head 998/ 51C : 28 0C jr z, .hdok 999/ 51E : 3C inc a 1000/ 51F : BA cp d 1001/ 520 : C2 90 14 jp nz, abort_seek_check 1002/ 523 : DD CB 05 5E bit DT_DS, (ix + DriveData.stat2) 1003/ 527 : CA 90 14 jp z, abort_seek_check 1004/ 52A : 1005/ 52A : 7A .hdok: ld a, d 1006/ 52B : 0F rrca ; move head number into bit 7 1007/ 52C : B1 or c ; combine cylinder and head 1008/ 52D : 4F ld c, a 1009/ 52E : C5 push bc 1010/ 52F : (MACRO) load_head 1010/ 52F : E7 rst 20h 1011/ 530 : C1 pop bc 1012/ 531 : DD 71 02 ld (ix + DriveData.target_cyl_hd), c 1013/ 534 : DD 70 03 ld (ix + DriveData.sector), b 1014/ 537 : DD 7E 01 ld a, (ix + DriveData.current_cyl_hd) 1015/ 53A : B9 cp c 1016/ 53B : 28 19 jr z, .success 1017/ 53D : (MACRO) wait_for_sector ; see where we're at now 1017/ 53D : DF rst 18h 1018/ 53E : DD BE 01 cp (ix + DriveData.current_cyl_hd) 1019/ 541 : 28 12 jr z, .call_seek ; the head is where we expect 1020/ 543 : DD 46 02 ld b, (ix + DriveData.target_cyl_hd) ; not at the expected cylinder, rezero it 1021/ 546 : DD 4E 03 ld c, (ix + DriveData.sector) 1022/ 549 : C5 push bc 1023/ 54A : (MACRO) reset_drive 1023/ 54A : CF rst 08h 1024/ 54B : C1 pop bc 1025/ 54C : DD 70 02 ld (ix + DriveData.target_cyl_hd), b 1026/ 54F : DD 71 03 ld (ix + DriveData.sector), c 1027/ 552 : C2 80 14 jp nz, abort_drive_fault_seek 1028/ 555 : 1029/ 555 : ;x0555: 1030/ 555 : .call_seek 1031/ 555 : (MACRO) seek ; calls do_seek below via the rst jv 1031/ 555 : D7 rst 10h 1032/ 556 : .success: 1033/ 556 : DD CB 06 FE set STAT2_A, (ix + DriveData.stat2_ds) 1034/ 55A : 3E 1F ld a, S1_DA ; drive attention 1035/ 55C : CD A3 14 call set_abort_S1 ; a "successful abort" 1036/ 55F : FD 36 00 00 ld (iy + YB(DSJ)), DSJ_normal ; indicate success 1037/ 563 : CD 4C 15 call deselect_drives 1038/ 566 : C9 ret 1039/ 567 : 1040/ 567 : do_seek: 1041/ 567 : CD 84 05 call do_seek_to_cylinder 1042/ 56A : C8 ret z 1043/ 56B : DA 80 14 jp c, abort_drive_fault_seek 1044/ 56E : DD 46 03 ld b, (ix + DriveData.sector) 1045/ 571 : DD 4E 02 ld c, (ix + DriveData.target_cyl_hd) 1046/ 574 : C5 push bc 1047/ 575 : FE 01 cp 1 ; did do_seek_to_cylinder return A == 1? 1048/ 577 : CC 08 00 call z, reset_drive_jv 1049/ 57A : C1 pop bc 1050/ 57B : DD 70 03 ld (ix + DriveData.sector), b 1051/ 57E : DD 71 02 ld (ix + DriveData.target_cyl_hd), c 1052/ 581 : C3 90 14 jp abort_seek_check 1053/ 584 : 1054/ 584 : 1055/ 584 : ;****************************************************************** 1056/ 584 : ; do_seek_to_cylinder - seek to the desired cylinder and head 1057/ 584 : ; 1058/ 584 : ; on entry: 1059/ 584 : ; IX - DriveData pointer 1060/ 584 : ; IY - RAM pointer 1061/ 584 : ; DriveData.target_cyl_hd - the desired cylinder and head 1062/ 584 : ; 1063/ 584 : ; on exit: 1064/ 584 : ; C - error 1065/ 584 : ; Z - success? 1066/ 584 : 1067/ 584 : do_seek_to_cylinder: 1068/ 584 : 3E 1A ld a, IU_STEP 1069/ 586 : (MACRO) set_in_use_leds 1069/ 586 : EF rst 28h 1070/ 587 : FD 36 0D 0A ld (iy + YB(tmp_unit)), 10 ; max 10 seek retry attempts 1071/ 58B : DD 7E 02 ld a, (ix + DriveData.target_cyl_hd) 1072/ 58E : B7 or a 1073/ 58F : 20 15 jr nz, perform_seek 1074/ 591 : DD 46 03 ld b, (ix + DriveData.sector) ; save sector across call to reset_drive 1075/ 594 : C5 push bc 1076/ 595 : (MACRO) reset_drive ; use reset_drive to seek to cylinder 0 1076/ 595 : CF rst 08h 1077/ 596 : C1 pop bc 1078/ 597 : DD 70 03 ld (ix + DriveData.sector), b 1079/ 59A : 28 02 jr z, .at_track0 1080/ 59C : 37 scf 1081/ 59D : C9 ret ; C, NZ - indicate error 1082/ 59E : 1083/ 59E : .at_track0: 1084/ 59E : 0E 00 ld c, 0 1085/ 5A0 : 41 ld b, c 1086/ 5A1 : DD 56 04 ld d, (ix + DriveData.drv) 1087/ 5A4 : 18 53 jr stepit 1088/ 5A6 : 1089/ 5A6 : perform_seek: 1090/ 5A6 : DD 7E 01 ld a, (ix + DriveData.current_cyl_hd) 1091/ 5A9 : DD AE 04 xor (ix + DriveData.drv) 1092/ 5AC : CB 7F bit HEAD1, a 1093/ 5AE : F5 push af ; remember if a head change is needed 1094/ 5AF : DD 7E 01 ld a, (ix + DriveData.current_cyl_hd) 1095/ 5B2 : E6 7F and BYTENOT(HEAD1_m) 1096/ 5B4 : 47 ld b, a 1097/ 5B5 : DD 7E 02 ld a, (ix + DriveData.target_cyl_hd) 1098/ 5B8 : E6 7F and BYTENOT(HEAD1_m) 1099/ 5BA : 90 sub b 1100/ 5BB : 47 ld b, a ; B: number of tracks and direction to step 1101/ 5BC : F1 pop af 1102/ 5BD : 28 14 jr z, .sethd ; no head change needed 1103/ 5BF : DD 7E 01 ld a, (ix + DriveData.current_cyl_hd) ; adjust B appropriately for the 1104/ 5C2 : DD AE 02 xor (ix + DriveData.target_cyl_hd) ; current cylinder and the target combos 1105/ 5C5 : CB 7F bit HEAD1, a 1106/ 5C7 : 28 0A jr z, .sethd 1107/ 5C9 : DD 7E 02 ld a, (ix + DriveData.target_cyl_hd) 1108/ 5CC : 04 inc b 1109/ 5CD : CB 7F bit HEAD1, a 1110/ 5CF : 20 02 jr nz, .sethd 1111/ 5D1 : 05 dec b 1112/ 5D2 : 05 dec b 1113/ 5D3 : DD 56 04 .sethd: ld d, (ix + DriveData.drv) ; swap heads if needed 1114/ 5D6 : DD 7E 01 ld a, (ix + DriveData.current_cyl_hd) 1115/ 5D9 : DD AE 02 xor (ix + DriveData.target_cyl_hd) 1116/ 5DC : CB 7F bit HEAD1, a 1117/ 5DE : 28 08 jr z, .notoggle 1118/ 5E0 : CB 7A bit HEAD1, d ; toggle HEAD1 in D 1119/ 5E2 : CB BA res HEAD1, d 1120/ 5E4 : 20 02 jr nz, .notoggle 1121/ 5E6 : CB FA set HEAD1, d 1122/ 5E8 : .notoggle: 1123/ 5E8 : AF xor a 1124/ 5E9 : B8 cp b 1125/ 5EA : 48 ld c, b 1126/ 5EB : 20 0C jr nz, stepit 1127/ 5ED : CB 7A bit HEAD1, d 1128/ 5EF : 20 08 jr nz, stepit 1129/ 5F1 : DD CB 05 5E bit DT_DS, (ix + DriveData.stat2) 1130/ 5F5 : 28 02 jr z, stepit ; single sided 1131/ 5F7 : 0E FF ld c, -1 ; stepping out towards 0 1132/ 5F9 : CD 65 06 stepit: call do_steps 1133/ 5FC : 20 63 jr nz, .x0661 1134/ 5FE : DD CB 04 BE res HEAD1, (ix + DriveData.drv) 1135/ 602 : CB 7A bit HEAD1, d 1136/ 604 : 28 04 jr z, .skip 1137/ 606 : DD CB 04 FE set HEAD1, (ix + DriveData.drv) 1138/ 60A : (MACRO) .skip: deassert_in_use 1138/ 60A : F7 rst 30h 1139/ 60B : 06 0C ld b, 12 1140/ 60D : .retry_wfs: 1141/ 60D : C5 push bc 1142/ 60E : (MACRO) wait_for_sector 1142/ 60E : DF rst 18h 1143/ 60F : C1 pop bc 1144/ 610 : FE FF cp 0ffh ; A: 0ffh -> failed 1145/ 612 : C2 4C 06 jp nz, .verify_seek 1146/ 615 : 05 dec b 1147/ 616 : 28 4B jr z, .x0663 1148/ 618 : DD CB 05 5E bit DT_DS, (ix + DriveData.stat2) 1149/ 61C : 28 1D jr z, .x063b ; single sided 1150/ 61E : DD CB 04 7E bit HEAD1, (ix + DriveData.drv) 1151/ 622 : DD CB 04 FE set HEAD1, (ix + DriveData.drv) 1152/ 626 : 28 04 jr z, .x062c 1153/ 628 : DD CB 04 BE res HEAD1, (ix + DriveData.drv) ; select head 0 1154/ 62C : (MACRO) .x062c: deassert_in_use 1154/ 62C : F7 rst 30h 1155/ 62D : AF xor a ; maybe select head 0 1156/ 62E : CB 79 bit 7, c ; seeking towards 0 (sign bit set)? 1157/ 630 : 28 02 jr z, .x0634 1158/ 632 : 3E 80 ld a, HEAD1_m ; select head 1 1159/ 634 : DD AE 04 .x0634: xor (ix + DriveData.drv) ; reset drv_shdw 1160/ 637 : CB 7F bit HEAD1, a 1161/ 639 : 20 D2 jr nz, .retry_wfs 1162/ 63B : C5 .x063b: push bc 1163/ 63C : 06 01 ld b, 1 1164/ 63E : CB 79 bit 7, c ; seeking towards 0 (sign bit set)? 1165/ 640 : 28 02 jr z, .x0644 1166/ 642 : 06 FF ld b, -1 1167/ 644 : CD 65 06 .x0644: call do_steps 1168/ 647 : C1 pop bc 1169/ 648 : 20 17 jr nz, .x0661 1170/ 64A : 18 C1 jr .retry_wfs 1171/ 64C : 1172/ 64C : .verify_seek: 1173/ 64C : DD 77 01 ld (ix + DriveData.current_cyl_hd), a ; current cylinder in A from wait_for_sector 1174/ 64F : DD BE 02 cp (ix + DriveData.target_cyl_hd) 1175/ 652 : CC EB 14 call z, show_previous_in_use_leds ; we are at the target cylinder 1176/ 655 : C8 ret z 1177/ 656 : FD 35 0D dec (iy + YB(tmp_unit)) ; oops, didn't get there 1178/ 659 : C2 A6 05 jp nz, perform_seek ; retry 1179/ 65C : F6 01 or 1 ; set NZ 1180/ 65E : 3E 00 ld a, 0 1181/ 660 : C9 ret 1182/ 661 : 1183/ 661 : 3E 01 .x0661: ld a, 1 1184/ 663 : B7 .x0663: or a ; set NZ 1185/ 664 : C9 ret 1186/ 665 : 1187/ 665 : 1188/ 665 : ;x0665: 1189/ 665 : do_steps: 1190/ 665 : 78 ld a, b 1191/ 666 : B7 or a 1192/ 667 : C8 ret z ; no cylinder change 1193/ 668 : F2 7A 06 jp p, .seek_in 1194/ 66B : DD 86 00 add a, (ix + DriveData.physical_cylinder) ; seeking out 1195/ 66E : FE 00 cp 0 1196/ 670 : FA 77 06 jp m, .skip ; would go beyond cylinder 0 1197/ 673 : DB 62 in a, (drv_status) 1198/ 675 : CB 57 bit TRACK0, a ; at cylinder 0? 1199/ 677 : C0 .skip: ret nz 1200/ 678 : 18 0A jr .dosteps 1201/ 67A : 1202/ 67A : .seek_in: 1203/ 67A : DD 86 00 add a, (ix + DriveData.physical_cylinder) 1204/ 67D : FE 4D cp PHYSICAL_TRACKS 1205/ 67F : FA 84 06 jp m, .dosteps 1206/ 682 : 3C inc a ; at the highest cylinder 1207/ 683 : C9 ret 1208/ 684 : 1209/ 684 : .dosteps: 1210/ 684 : C5 push bc 1211/ 685 : AF xor a 1212/ 686 : 48 ld c, b ; C: skip direction 1213/ 687 : B8 cp b 1214/ 688 : FA 8F 06 jp m, .steploop 1215/ 68B : 78 ld a, b ; form abs(B) for loop count 1216/ 68C : ED 44 neg 1217/ 68E : 47 ld b, a 1218/ 68F : .steploop: 1219/ 68F : CD 1B 00 call step_drive_jv 1220/ 692 : CB 79 bit 7, c ; seeking in or out? 1221/ 694 : 28 05 jr z, .skipdec 1222/ 696 : DD 35 00 dec (ix + DriveData.physical_cylinder) 1223/ 699 : 18 03 jr .continue 1224/ 69B : 1225/ 69B : .skipdec: 1226/ 69B : DD 34 00 inc (ix + DriveData.physical_cylinder) 1227/ 69E : .continue: 1228/ 69E : 10 EF djnz .steploop 1229/ 6A0 : 06 14 ld b, 20 1230/ 6A2 : CD 40 12 call delay ; delay 20 ms 1231/ 6A5 : C1 pop bc 1232/ 6A6 : AF xor a 1233/ 6A7 : C9 ret 1234/ 6A8 : 1235/ 6A8 : ; do_step_drive - step drive one track 1236/ 6A8 : ; 1237/ 6A8 : ; on entry: 1238/ 6A8 : ; C: negative => step out 1239/ 6A8 : ; 1240/ 6A8 : ; NOTE: The drive document says 3 ms (min) required between step pulses 1241/ 6A8 : ; and 18 ms between step pulses if a direction change has taken place 1242/ 6A8 : ; with no intervening read/write operation performed. The step pulse 1243/ 6A8 : ; should be 1 us min width. 1244/ 6A8 : 1245/ 6A8 : do_step_drive: 1246/ 6A8 : C5 push bc 1247/ 6A9 : DD 7E 04 ld a, (ix + DriveData.drv) 1248/ 6AC : E6 FC and ~HEADLOAD ; unload_head now? 1249/ 6AE : CB 79 bit STEP_OUT, c 1250/ 6B0 : 20 02 jr nz, .skip 1251/ 6B2 : CB CF set MOVEIN, a ; It appears DriveData.drv keeps MOVEIN deasserted 1252/ 6B4 : D3 65 .skip: out (drv), a ; set MOVEIN as required 1253/ 6B6 : CB C7 set STEP, a ; Pulse STEP 1254/ 6B8 : D3 65 out (drv), a 1255/ 6BA : CB 87 res STEP, a 1256/ 6BC : D3 65 out (drv), a 1257/ 6BE : (MACRO) deassert_in_use 1257/ 6BE : F7 rst 30h 1258/ 6BF : 06 03 ld b, 3 ; Delay 3 ms 1259/ 6C1 : CD 40 12 call delay 1260/ 6C4 : C1 pop bc 1261/ 6C5 : C9 ret 1262/ 6C6 : 1263/ 6C6 : ;****************************************************************** 1264/ 6C6 : ; do_reset_drive - "recalibrate drive" 1265/ 6C6 : ; reset current addresses and seek to track 0 1266/ 6C6 : ; 1267/ 6C6 : ; on exit: 1268/ 6C6 : ; Z: at track 0, A = 0 1269/ 6C6 : ; NZ: error 1270/ 6C6 : 1271/ 6C6 : do_reset_drive: 1272/ 6C6 : AF xor a 1273/ 6C7 : DD 77 00 ld (ix + DriveData.physical_cylinder), a 1274/ 6CA : DD 77 02 ld (ix + DriveData.target_cyl_hd), a 1275/ 6CD : DD 77 01 ld (ix + DriveData.current_cyl_hd), a 1276/ 6D0 : 3A 09 60 ld a, (disc_format) 1277/ 6D3 : E6 01 and FORMAT_IBM_m 1278/ 6D5 : DD 77 03 ld (ix + DriveData.sector), a 1279/ 6D8 : DD CB 04 BE res HEAD1, (ix + DriveData.drv) ; select head 0 1280/ 6DC : (MACRO) deassert_in_use 1280/ 6DC : F7 rst 30h 1281/ 6DD : 1282/ 6DD : 06 50 ld b, 80 ; step to track 0 1283/ 6DF : .step_loop: 1284/ 6DF : DB 62 in a, (drv_status) 1285/ 6E1 : CB 57 bit TRACK0, a 1286/ 6E3 : 20 09 jr nz, .at_track0 1287/ 6E5 : 0E FF ld c, 0ffh ; step towards track 0 1288/ 6E7 : CD 1B 00 call step_drive_jv 1289/ 6EA : 10 F3 djnz .step_loop 1290/ 6EC : 04 inc b ; NZ (not at track 0 after 80 step attempts) 1291/ 6ED : C9 ret 1292/ 6EE : 1293/ 6EE : .at_track0: 1294/ 6EE : 3E 50 ld a, 80 1295/ 6F0 : B8 cp b 1296/ 6F1 : 06 14 ld b, 20 1297/ 6F3 : C4 40 12 call nz, delay ; delay 20 ms if we weren't at track 0 already 1298/ 6F6 : AF xor a 1299/ 6F7 : C9 ret ; Z 1300/ 6F8 : 1301/ 6F8 : (MACRO) fillto 0700h, 076h 1301/ 6F8 : 76 76 76 76 76 76 db (0700H-$) dup (076H) 6FE : 76 76 1302/ 700 : 1303/ 700 : cmd_buffered_read_verify: 1304/ 700 : CD 2A 07 call sio_common_prep 1305/ 703 : DD CB 04 D6 set MGNENA, (ix + DriveData.drv) ; turn on reduced margins 1306/ 707 : 18 03 jr buffered_read_common 1307/ 709 : 1308/ 709 : cmd_buffered_read: 1309/ 709 : CD 2A 07 call sio_common_prep 1310/ 70C : buffered_read_common: 1311/ 70C : (MACRO) load_head 1311/ 70C : E7 rst 20h 1312/ 70D : CD 87 0C call head_unload_timer_1s_check 1313/ 710 : 21 73 F0 ld hl, 0f073h 1314/ 713 : ; (SIO_D_WRONG_SECTOR_m | SIO_D_WRONG_TRACK_m | SIO_WRONG_HEAD_m | SIO_BIT5_m) << 8 1315/ 713 : ; | (OVERUN_m | CRCERR_m | SIO_E_NOT_READY_m | SIO_E_1_m | SIO_E_SCE_m) 1316/ 713 : 3E 01 ld a, 1 1317/ 715 : CD 65 08 call read_the_sector 1318/ 718 : ;x0718 1319/ 718 : do_send_data: 1320/ 718 : F5 push af 1321/ 719 : 06 20 ld b, TLK_m | 00h 1322/ 71B : CD A3 12 call wait_for_HPIB_SAD ; wait until we're told to talk 1323/ 71E : 06 03 ld b, 3 1324/ 720 : F1 pop af 1325/ 721 : CD 52 09 call do_read_send_data ; do_read_send_data doesn't alter flags! 1326/ 724 : CA E4 07 jp z, read_success ; success from read_the_sector 1327/ 727 : C3 ED 07 jp read_failed ; failure 1328/ 72A : 1329/ 72A : sio_common_prep: 1330/ 72A : CD BE 02 call check_for_holdoff 1331/ 72D : CD D8 02 call check_unit_ready 1332/ 730 : CD C7 02 call verify_known_format 1333/ 733 : verify_cylinder: 1334/ 733 : CD A4 08 call check_cylinder_in_range 1335/ 736 : D2 90 14 jp nc, abort_seek_check 1336/ 739 : C9 ret 1337/ 73A : 1338/ 73A : cmd_unbuffered_read_verify: 1339/ 73A : CD 2A 07 call sio_common_prep 1340/ 73D : DD CB 04 D6 set MGNENA, (ix + DriveData.drv) 1341/ 741 : 18 03 jr unbuffered_read_common 1342/ 743 : 1343/ 743 : cmd_unbuffered_read: 1344/ 743 : CD 2A 07 call sio_common_prep 1345/ 746 : 1346/ 746 : ;x0746 1347/ 746 : unbuffered_read_common: 1348/ 746 : 21 73 F0 ld hl, 0f073h 1349/ 749 : ; (SIO_D_WRONG_SECTOR_m | SIO_D_WRONG_TRACK_m | SIO_WRONG_HEAD_m | SIO_BIT5_m) << 8 1350/ 749 : ; | (OVERUN_m | CRCERR_m | SIO_E_NOT_READY_m | SIO_E_1_m | SIO_E_SCE_m) 1351/ 749 : E5 push hl 1352/ 74A : (MACRO) load_head 1352/ 74A : E7 rst 20h 1353/ 74B : 3E 01 ld a, 1 1354/ 74D : CD 65 08 call read_the_sector 1355/ 750 : F5 push af 1356/ 751 : 06 20 ld b, TLK_m | 00h 1357/ 753 : CD A3 12 call wait_for_HPIB_SAD 1358/ 756 : 06 02 ld b, 2 1359/ 758 : F1 pop af 1360/ 759 : 28 02 jr z, .success 1361/ 75B : 06 03 ld b, 3 ; B bit 1 = 1: flush out fifo 1362/ 75D : .success: 1363/ 75D : CD 52 09 call do_read_send_data 1364/ 760 : C2 ED 07 jp nz, read_failed 1365/ 763 : CD 85 12 .again: call poll_input_or_DCL 1366/ 766 : E1 pop hl 1367/ 767 : C2 E4 07 jp nz, read_success 1368/ 76A : DB 13 in a, (phi_status) 1369/ 76C : CB 57 bit TLK_IDF, a ; Still addressed to talk? 1370/ 76E : CA E4 07 jp z, read_success ; no, done 1371/ 771 : CD 87 0C call head_unload_timer_1s_check 1372/ 774 : (MACRO) deassert_in_use 1372/ 774 : F7 rst 30h 1373/ 775 : AF xor a 1374/ 776 : CD 65 08 call read_the_sector 1375/ 779 : E5 push hl 1376/ 77A : 06 00 ld b, 0 1377/ 77C : 28 02 jr z, .skip 1378/ 77E : 06 01 ld b, 1 1379/ 780 : F5 .skip: push af 1380/ 781 : CD 52 09 call do_read_send_data 1381/ 784 : F1 pop af 1382/ 785 : C2 ED 07 jp nz, read_failed 1383/ 788 : 18 D9 jr .again 1384/ 78A : 1385/ 78A : cmd_verify: 1386/ 78A : 3E 18 ld a, IU_VFY 1387/ 78C : (MACRO) set_in_use_leds 1387/ 78C : EF rst 28h 1388/ 78D : CD BE 02 call check_for_holdoff 1389/ 790 : CD EB 02 call verify_unit_ready 1390/ 793 : CD C7 02 call verify_known_format 1391/ 796 : CD 63 00 call verify_cylinder_jv 1392/ 799 : 3A 49 60 ld a, (verify_count_msb) 1393/ 79C : FE 00 cp 0 1394/ 79E : FA 73 14 jp m, abort_IO_program_error 1395/ 7A1 : FD 46 49 ld b, (iy + YB(verify_count_msb)) 1396/ 7A4 : FD 4E 4A ld c, (iy + YB(verify_count_lsb)) 1397/ 7A7 : C5 push bc 1398/ 7A8 : 78 ld a, b 1399/ 7A9 : B7 or a 1400/ 7AA : 28 06 jr z, .x07b2 1401/ 7AC : FE 01 cp 1 1402/ 7AE : 38 18 jr c, .x07c8 1403/ 7B0 : 18 03 jr .x07b5 1404/ 7B2 : 1405/ 7B2 : 81 .x07b2: add a, c 1406/ 7B3 : 20 13 jr nz, .x07c8 1407/ 7B5 : 06 04 .x07b5: ld b, 4 1408/ 7B7 : DD E5 push ix 1409/ 7B9 : 05 .x07b9: dec b 1410/ 7BA : 78 ld a, b 1411/ 7BB : FA C6 07 jp m, .x07c6 1412/ 7BE : FD BE 03 cp (iy + YB(current_unit)) 1413/ 7C1 : C4 D8 15 call nz, maybe_unload_head 1414/ 7C4 : 18 F3 jr .x07b9 1415/ 7C6 : 1416/ 7C6 : DD E1 .x07c6: pop ix 1417/ 7C8 : (MACRO) .x07c8: load_head 1417/ 7C8 : E7 rst 20h 1418/ 7C9 : C1 pop bc 1419/ 7CA : DD CB 04 D6 set MGNENA, (ix + DriveData.drv) 1420/ 7CE : 16 01 ld d, 1 1421/ 7D0 : 21 73 F0 .again: ld hl, 0f073h 1422/ 7D3 : ; (SIO_D_WRONG_SECTOR_m | SIO_D_WRONG_TRACK_m | SIO_WRONG_HEAD_m | SIO_BIT5_m) << 8 1423/ 7D3 : ; | (OVERUN_m | CRCERR_m | SIO_E_NOT_READY_m | SIO_E_1_m | SIO_E_SCE_m) 1424/ 7D3 : (MACRO) deassert_in_use 1424/ 7D3 : F7 rst 30h 1425/ 7D4 : C5 push bc 1426/ 7D5 : 7A ld a, d 1427/ 7D6 : CD 65 08 call read_the_sector 1428/ 7D9 : C2 ED 07 jp nz, read_failed 1429/ 7DC : C1 pop bc 1430/ 7DD : 16 00 ld d, 0 1431/ 7DF : ED A1 cpi 1432/ 7E1 : EA D0 07 jp pe, .again 1433/ 7E4 : 1434/ 7E4 : read_success: 1435/ 7E4 : CD B1 14 call normal_and_deselect_drives 1436/ 7E7 : read_cleanup: 1437/ 7E7 : DD CB 04 96 res MGNENA, (ix + DriveData.drv) 1438/ 7EB : (MACRO) deassert_in_use 1438/ 7EB : F7 rst 30h 1439/ 7EC : C9 ret 1440/ 7ED : 1441/ 7ED : read_failed: 1442/ 7ED : CD E7 07 call read_cleanup 1443/ 7F0 : C3 67 14 jp listen_terminate 1444/ 7F3 : 1445/ 7F3 : 1446/ 7F3 : ; cmd_cold_load_read - Read from unit 0 cylinder 0 at specified head and sector 1447/ 7F3 : ; until the controller terminates the I/O. 1448/ 7F3 : cmd_cold_load_read: 1449/ 7F3 : AF xor a ; DSJ_normal, unit 0 1450/ 7F4 : 32 00 60 ld (DSJ), a 1451/ 7F7 : CD 23 00 call determine_unit_status_jv 1452/ 7FA : AF xor a 1453/ 7FB : CD 1A 15 call prep_drive_regs 1454/ 7FE : CD C7 02 call verify_known_format 1455/ 801 : FD 7E 48 ld a, (iy + YB(clr_hd_sect)) 1456/ 804 : E6 3F and 3fh ; isolate the sector field 1457/ 806 : 47 ld b, a 1458/ 807 : CD 3E 16 call validate_sector_number 1459/ 80A : C2 90 14 jp nz, abort_seek_check 1460/ 80D : FD 7E 48 ld a, (iy + YB(clr_hd_sect)) 1461/ 810 : 07 rlca ; isolate head field 1462/ 811 : 07 rlca 1463/ 812 : E6 03 and 3 1464/ 814 : 28 0D jr z, .ok 1465/ 816 : FE 02 cp 2 1466/ 818 : D2 90 14 jp nc, abort_seek_check ; only 2 heads on 9895A 1467/ 81B : DD CB 05 5E bit 3, (ix + DriveData.stat2) 1468/ 81F : CA 90 14 jp z, abort_seek_check 1469/ 822 : 0F rrca 1470/ 823 : DD 77 02 .ok: ld (ix + DriveData.target_cyl_hd), a 1471/ 826 : DD 70 03 ld (ix + DriveData.sector), b 1472/ 829 : C3 46 07 jp unbuffered_read_common 1473/ 82C : 1474/ 82C : 1475/ 82C : cmd_id_triggered_read: 1476/ 82C : CD 2A 07 call sio_common_prep 1477/ 82F : FD CB 09 46 bit FORMAT_IBM, (iy + YB(disc_format)) 1478/ 833 : C2 9C 14 jp nz, abort_stat2_error ; not supported for IBM format discs? 1479/ 836 : (MACRO) load_head 1479/ 836 : E7 rst 20h 1480/ 837 : CD AC 08 call seek_to_target_cyl_hd 1481/ 83A : 28 06 jr z, .doread 1482/ 83C : DA 8A 14 jp c, abort_drive_fault 1483/ 83F : D2 90 14 jp nc, abort_seek_check 1484/ 842 : .doread: 1485/ 842 : 21 73 F0 ld hl, 0f073h 1486/ 845 : ; (SIO_D_WRONG_SECTOR_m | SIO_D_WRONG_TRACK_m | SIO_WRONG_HEAD_m | SIO_BIT5_m) << 8 1487/ 845 : ; | (OVERUN_m | CRCERR_m | SIO_E_NOT_READY_m | SIO_E_1_m | SIO_E_SCE_m) 1488/ 845 : CD B5 09 call wait_for_sector_id_field 1489/ 848 : CD CA 08 call do_sector_io_check 1490/ 84B : 30 F5 jr nc, .doread 1491/ 84D : C2 64 14 jp nz, cmd_terminate 1492/ 850 : 06 02 ld b, 2 1493/ 852 : CD 40 12 call delay ; delay 2 ms 1494/ 855 : 3E 06 ld a, 6 ; # retry attampts? 1495/ 857 : CD D9 0A call do_read_sector_common 1496/ 85A : CD CA 08 call do_sector_io_check 1497/ 85D : 30 E3 jr nc, .doread 1498/ 85F : CC 76 08 call z, next_logical_sector_save_flags 1499/ 862 : C3 18 07 jp do_send_data 1500/ 865 : 1501/ 865 : ; on exit: 1502/ 865 : ; Z: success 1503/ 865 : ; NZ: failure 1504/ 865 : read_the_sector: 1505/ 865 : F5 push af 1506/ 866 : CD AC 08 .again: call seek_to_target_cyl_hd 1507/ 869 : 20 11 jr nz, rts_err 1508/ 86B : CD CF 0A call do_read_sector 1509/ 86E : CD CA 08 call do_sector_io_check 1510/ 871 : 30 F3 jr nc, .again 1511/ 873 : 33 inc sp ; pop one return address, saving regs 1512/ 874 : 33 inc sp 1513/ 875 : C0 ret nz 1514/ 876 : 1515/ 876 : next_logical_sector_save_flags: 1516/ 876 : F5 push af 1517/ 877 : CD 6D 09 call next_logical_sector 1518/ 87A : F1 pop af 1519/ 87B : C9 ret 1520/ 87C : 1521/ 87C : rts_err: 1522/ 87C : 38 14 jr c, .sete 1523/ 87E : FE 01 cp 1 1524/ 880 : 20 0A jr nz, .setc 1525/ 882 : F1 pop af 1526/ 883 : F5 push af 1527/ 884 : B7 or a 1528/ 885 : 20 05 jr nz, .setc 1529/ 887 : CD B1 14 call normal_and_deselect_drives 1530/ 88A : 18 13 jr .doexit 1531/ 88C : 1532/ 88C : DD CB 06 D6 .setc: set STAT2_C, (ix + DriveData.stat2_ds) 1533/ 890 : 18 04 jr .seta 1534/ 892 : 1535/ 892 : DD CB 06 E6 .sete: set STAT2_E, (ix + DriveData.stat2_ds) 1536/ 896 : DD CB 06 FE .seta: set STAT2_A, (ix + DriveData.stat2_ds) 1537/ 89A : 3E 1F ld a, S1_DA ; drive attention 1538/ 89C : CD A3 14 call set_abort_S1 1539/ 89F : .doexit: 1540/ 89F : F1 pop af 1541/ 8A0 : 3E 01 ld a, 1 1542/ 8A2 : B7 or a ; set NZ 1543/ 8A3 : C9 ret 1544/ 8A4 : 1545/ 8A4 : check_cylinder_in_range: 1546/ 8A4 : DD 7E 02 ld a, (ix + DriveData.target_cyl_hd) 1547/ 8A7 : E6 F8 and BYTENOT(HEAD1) 1548/ 8A9 : FE 4D cp PHYSICAL_TRACKS 1549/ 8AB : C9 ret 1550/ 8AC : 1551/ 8AC : seek_to_target_cyl_hd: 1552/ 8AC : DD 7E 01 ld a, (ix + DriveData.current_cyl_hd) 1553/ 8AF : DD BE 02 cp (ix + DriveData.target_cyl_hd) 1554/ 8B2 : C8 ret z 1555/ 8B3 : E5 push hl 1556/ 8B4 : DD 46 04 ld b, (ix + DriveData.drv) 1557/ 8B7 : C5 push bc ; Save DriveData.drv value 1558/ 8B8 : CD 6A 00 call seek_to_cylinder_jv ; This may affect MGNENA? 1559/ 8BB : C1 pop bc 1560/ 8BC : F5 push af ; save A value? 1561/ 8BD : 78 ld a, b 1562/ 8BE : E6 04 and MGNENA_m ; Isolate MGNENA from DriveData.drv copy 1563/ 8C0 : DD B6 04 or (ix + DriveData.drv) ; or in current drv_shdw (changed by do_seek_to_cylinder?) 1564/ 8C3 : DD 77 04 ld (ix + DriveData.drv), a ; update it 1565/ 8C6 : (MACRO) deassert_in_use 1565/ 8C6 : F7 rst 30h 1566/ 8C7 : F1 pop af 1567/ 8C8 : E1 pop hl 1568/ 8C9 : C9 ret 1569/ 8CA : 1570/ 8CA : ; do_sector_io_check - test for errors during sector I/O and set statuses 1571/ 8CA : ; 1572/ 8CA : ; on entry: 1573/ 8CA : ; E: result of sio_done_get_status 1574/ 8CA : ; 1575/ 8CA : ; on exit: 1576/ 8CA : ; A: unchanged - not sure why 1577/ 8CA : 1578/ 8CA : do_sector_io_check: 1579/ 8CA : F5 push af ; save A 1580/ 8CB : 06 13 ld b, S1_S2E ; check stat2 for cause 1581/ 8CD : CB 63 bit SIO_E_NOT_READY, e 1582/ 8CF : 20 44 jr nz, dsic_abort 1583/ 8D1 : 06 09 ld b, S1_SCE ; sector compare error 1584/ 8D3 : CB 43 bit SIO_E_SCE, e 1585/ 8D5 : 20 75 jr nz, dsio_retry_if_sector_was_found 1586/ 8D7 : 06 07 ld b, S1_CCE ; cylinder compare error 1587/ 8D9 : CB 72 bit SIO_D_WRONG_TRACK, d 1588/ 8DB : 20 40 jr nz, dsio_retry_seek 1589/ 8DD : 06 09 ld b, S1_SCE ; sector compare error 1590/ 8DF : CB 6A bit SIO_D_WRONG_HEAD, d 1591/ 8E1 : 20 3A jr nz, dsio_retry_seek 1592/ 8E3 : 06 31 ld b, S1_DBIT_m | S1_DTE 1593/ 8E5 : CB 53 bit SIO_E_DEFECTIVE_SECTOR, e 1594/ 8E7 : 20 2C jr nz, dsic_abort 1595/ 8E9 : 06 09 ld b, S1_SCE ; sector compare error 1596/ 8EB : CB 4B bit SIO_E_1, e 1597/ 8ED : 20 26 jr nz, dsic_abort 1598/ 8EF : 7B ld a, e 1599/ 8F0 : A5 and l ; oh noes, what is L here? 1600/ 8F1 : 06 12 ld b, S1_RHE 1601/ 8F3 : CB 77 bit OVERUN, a ; couldn't keep up, retryable hardware error 1602/ 8F5 : 20 26 jr nz, dsio_retry_seek 1603/ 8F7 : 06 08 ld b, S1_UDE ; uncorrectable data error 1604/ 8F9 : CB 6F bit CRCERR, a 1605/ 8FB : 28 0E jr z, dsic_success 1606/ 8FD : DD CB 04 56 bit MGNENA, (ix + DriveData.drv) 1607/ 901 : 28 12 jr z, dsic_abort ; not using reduced read margins 1608/ 903 : CB 4A bit SIO_D_WFS_FAILED, d 1609/ 905 : 28 0E jr z, dsic_abort 1610/ 907 : 06 09 ld b, S1_SCE ; sector compare error 1611/ 909 : 18 0A jr dsic_abort 1612/ 90B : 1613/ 90B : dsic_success: 1614/ 90B : AF xor a 1615/ 90C : dsic_exit: 1616/ 90C : FD CB 05 8E res SECTOR_IO_RETRY, (iy + YB(state_flags)) 1617/ 910 : 37 scf 1618/ 911 : dsic_cleanup: 1619/ 911 : E3 ex (sp), hl ; AF pushed at entry 1620/ 912 : 7C ld a, h ; recover A 1621/ 913 : E1 pop hl ; get back HL 1622/ 914 : C9 ret 1623/ 915 : 1624/ 915 : dsic_abort: 1625/ 915 : 78 ld a, b 1626/ 916 : CD A3 14 call set_abort_S1 1627/ 919 : F6 01 or 1 ; exit with A = 1/NZ 1628/ 91B : 18 EF jr dsic_exit 1629/ 91D : 1630/ 91D : dsio_retry_seek: 1631/ 91D : FD CB 05 4E bit SECTOR_IO_RETRY, (iy + YB(state_flags)) 1632/ 921 : 20 F2 jr nz, dsic_abort ; only retry once 1633/ 923 : DD 7E 04 ld a, (ix + DriveData.drv) ; drv_shdw? 1634/ 926 : F5 push af ; Remember DriveData.drv state for later 1635/ 927 : E5 push hl 1636/ 928 : DD 7E 02 ld a, (ix + DriveData.target_cyl_hd) 1637/ 92B : F5 push af 1638/ 92C : DD 36 02 00 ld (ix + DriveData.target_cyl_hd), 0 1639/ 930 : (MACRO) seek ; rezero drive 1639/ 930 : D7 rst 10h 1640/ 931 : F1 pop af ; Get back saved (ix + DriveData.target_cyl_hd) 1641/ 932 : B7 or a ; Any bits set in the cylinder number? 1642/ 933 : 28 04 jr z, .skipseek ; no, already at cylinder 0 1643/ 935 : DD 77 02 ld (ix + DriveData.target_cyl_hd), a 1644/ 938 : (MACRO) seek 1644/ 938 : D7 rst 10h 1645/ 939 : .skipseek: 1646/ 939 : E1 pop hl 1647/ 93A : F1 pop af ; Get back saved DriveData.drv 1648/ 93B : E6 04 and MGNENA_m ; Isolate MGNENA 1649/ 93D : DD B6 04 or (ix + DriveData.drv) ; Combine previous MGNENA with drv reg copy 1650/ 940 : DD 77 04 ld (ix + DriveData.drv), a ; udpate it 1651/ 943 : (MACRO) deassert_in_use 1651/ 943 : F7 rst 30h 1652/ 944 : FD CB 05 CE set SECTOR_IO_RETRY, (iy + YB(state_flags)) 1653/ 948 : F6 01 or 1 ; exit with A = 1/NZ 1654/ 94A : 18 C5 jr dsic_cleanup 1655/ 94C : 1656/ 94C : dsio_retry_if_sector_was_found: 1657/ 94C : CB 42 bit SIO_D_SECTOR_FOUND, d 1658/ 94E : 28 CD jr z, dsio_retry_seek 1659/ 950 : 18 C3 jr dsic_abort 1660/ 952 : 1661/ 952 : ; 1662/ 952 : ; on entry: 1663/ 952 : ; A = 0: send data buffer 1664/ 952 : ; A = 1: send end of transfer byte with EOI? 1665/ 952 : ; B bit 1 = 1: flush the out fifo first 1666/ 952 : do_read_send_data: 1667/ 952 : F5 push af 1668/ 953 : 21 4D 60 ld hl, data_buffer_count 1669/ 956 : FE 01 cp 1 1670/ 958 : 28 05 jr z, .sendEOIbyte 1671/ 95A : CD F8 12 call do_talk_transfer 1672/ 95D : F1 pop af 1673/ 95E : C9 ret 1674/ 95F : 1675/ 95F : .sendEOIbyte: 1676/ 95F : CB 48 bit 1, b 1677/ 961 : C4 7E 12 call nz, flush_out_fifo 1678/ 964 : 3E 01 ld a, 1 ; placeholder byte? 1679/ 966 : 06 80 ld b, OUT_END_m ; D0D1 = 10 (EOI) 1680/ 968 : CD DA 12 call send_out_byte 1681/ 96B : F1 pop af 1682/ 96C : C9 ret 1683/ 96D : 1684/ 96D : ; next_logical_sector - move to the next logical sector 1685/ 96D : ; 1686/ 96D : ; on entry: 1687/ 96D : ; DriveData contains the current state 1688/ 96D : ; 1689/ 96D : ; on exit: 1690/ 96D : ; DriveData contains the updated state 1691/ 96D : 1692/ 96D : next_logical_sector: 1693/ 96D : DD 46 03 ld b, (ix + DriveData.sector) 1694/ 970 : 04 inc b 1695/ 971 : CD 3E 16 call validate_sector_number 1696/ 974 : 28 1A jr z, .sector_valid 1697/ 976 : DD CB 05 5E bit DT_DS, (ix + DriveData.stat2) ; done with this track 1698/ 97A : 28 0E jr z, .skipds 1699/ 97C : DD CB 02 7E bit HEAD1, (ix + DriveData.target_cyl_hd) ; toggle the head 1700/ 980 : DD CB 02 FE set HEAD1, (ix + DriveData.target_cyl_hd) 1701/ 984 : 28 07 jr z, .skiph1 ; same cylinder, now HEAD1 1702/ 986 : DD CB 02 BE res HEAD1, (ix + DriveData.target_cyl_hd) 1703/ 98A : .skipds: 1704/ 98A : DD 34 02 inc (ix + DriveData.target_cyl_hd) ; was HEAD1, next cylinder 1705/ 98D : .skiph1: 1706/ 98D : FD 46 09 ld b, (iy + YB(disc_format)) ; get the starting sector number 1707/ 990 : .sector_valid: 1708/ 990 : DD 70 03 ld (ix + DriveData.sector), b 1709/ 993 : C9 ret 1710/ 994 : 1711/ 994 : 1712/ 994 : ; do_wait_for_sector - wait for a sector to be found on the track 1713/ 994 : ; 1714/ 994 : ; on exit: 1715/ 994 : ; NZ: failed, A: -1, B: ? 1716/ 994 : ; Z: success, A: current cylinder, B: current sector 1717/ 994 : do_wait_for_sector: 1718/ 994 : DB 62 in a, (drv_status) 1719/ 996 : CB 67 bit READY, a 1720/ 998 : CA 80 14 jp z, abort_drive_fault_seek 1721/ 99B : DD CB 04 96 res MGNENA, (ix + DriveData.drv) ; give us the best chance to see where we are 1722/ 99F : (MACRO) deassert_in_use 1722/ 99F : F7 rst 30h 1723/ 9A0 : 21 60 04 ld hl, (SIO_D_BIT4 << 8) | (OVERUN_m | CRCERR_m) 1724/ 9A3 : 06 02 ld b, 2 ; try two times 1725/ 9A5 : C5 .loop: push bc 1726/ 9A6 : CD B5 09 call wait_for_sector_id_field 1727/ 9A9 : 28 06 jr z, .ret 1728/ 9AB : C1 pop bc 1729/ 9AC : 10 F7 djnz .loop ; something failed, try again 1730/ 9AE : F6 FF or 0ffh ; A = 0ffh, NZ: failed 1731/ 9B0 : C9 ret 1732/ 9B1 : 1733/ 9B1 : E1 .ret: pop hl ; success, drop BC off the stack 1734/ 9B2 : 78 ld a, b ; A: current_cyl_hd? 1735/ 9B3 : 41 ld b, c ; b: ? 1736/ 9B4 : C9 ret 1737/ 9B5 : 1738/ 9B5 : ; wait_for_sector_id_field 1739/ 9B5 : ; 1740/ 9B5 : ; NOTE: HP format sector number has the head number in bit 7 1741/ 9B5 : ; 1742/ 9B5 : ; on entry: 1743/ 9B5 : ; H: error mask for SIO_D_* flags 1744/ 9B5 : ; L: error mask for SIO_E_* flags 1745/ 9B5 : ; IX: DriveData pointer 1746/ 9B5 : ; 1747/ 9B5 : ; on exit: 1748/ 9B5 : ; B: current cylinder as read from the disc 1749/ 9B5 : ; C: sector number as read from the disc 1750/ 9B5 : ; D: SIO_D_* flags 1751/ 9B5 : ; E: SIO_E_* flags 1752/ 9B5 : ; NZ: failed 1753/ 9B5 : ; Z: success 1754/ 9B5 : 1755/ 9B5 : ;x09b5: 1756/ 9B5 : wait_for_sector_id_field: 1757/ 9B5 : 3E 03 ld a, r_OVERUN_m | r_TIMEOUT_m 1758/ 9B7 : D3 62 out (reset), a ; reset error flags 1759/ 9B9 : DD 7E 02 ld a, (ix + DriveData.target_cyl_hd) 1760/ 9BC : E6 7F and BYTENOT(HEAD1_m) ; just the cylinder 1761/ 9BE : 32 0B 60 ld (target_cyl_hd), a 1762/ 9C1 : 11 00 00 ld de, 0 ; status flags word 1763/ 9C4 : E5 again: push hl ; save error mask flags 1764/ 9C5 : 7A ld a, d 1765/ 9C6 : E6 01 and SIO_D_SECTOR_FOUND_m ; indicate second attempt? AM found? 1766/ 9C8 : 57 ld d, a 1767/ 9C9 : 1E 00 ld e, 0 ; reset the E part of the flags 1768/ 9CB : D5 push de 1769/ 9CC : wfs_id_am: 1770/ 9CC : D1 pop de ; DE: some type of operation flags 1771/ 9CD : AF xor a 1772/ 9CE : D3 64 out (cntl), a ; preparation to find an AM 1773/ 9D0 : 3E 02 ld a, r_OVERUN_m 1774/ 9D2 : D3 62 out (reset), a 1775/ 9D4 : D5 push de 1776/ 9D5 : 3E 02 ld a, CRCON_m ; enable CRC checking 1777/ 9D7 : 06 22 ld b, READON_m | CRCON_m ; send data to CRC chip 1778/ 9D9 : 0E 67 ld c, switches + NOSW ; (will read just the AMDT and TIMEOUT bits) 1779/ 9DB : 16 70 ld d, HP_ID_AM_DPAT 1780/ 9DD : 1E 0E ld e, HP_AM_CLK 1781/ 9DF : FD CB 09 46 bit FORMAT_IBM, (iy + YB(disc_format)) 1782/ 9E3 : C2 5F 0A jp nz, wfs_ibm 1783/ 9E6 : D3 64 out (cntl), a 1784/ 9E8 : 1785/ 9E8 : ; test for HP format? 1786/ 9E8 : wfs_hp: 1787/ 9E8 : ED 70 in (c) ; undocumented Z80: in flags, (c) 1788/ 9EA : 28 FC jr z, wfs_hp ; wait until either AMDT or TIMEOUT are set 1789/ 9EC : F2 56 0A jp p, wfs_timedout 1790/ 9EF : DB 60 in a, (data) ; AMDT signal is asserted here 1791/ 9F1 : 67 ld h, a ; save the AM byte 1792/ 9F2 : DB 61 in a, (clock) 1793/ 9F4 : BB cp e ; does the clock pattern match? 1794/ 9F5 : 20 D5 jr nz, wfs_id_am ; nope 1795/ 9F7 : 78 ld a, b 1796/ 9F8 : ; NOTE: HP AMs not included in CRC calcs 1797/ 9F8 : D3 64 out (cntl), a ; READON_m | CRCON_m from above 1798/ 9FA : DB 60 in a, (data) 1799/ 9FC : 47 ld b, a ; B: track number 1800/ 9FD : 7C ld a, h ; get back the AM byte 1801/ 9FE : 92 sub d ; D: HP_ID_AM_DPAT 1802/ 9FF : CB 17 rl a ; 50-70=e0 -> C, c1 (HP_DATA_AM_DPAT) 1803/ A01 : ; 70-70=00 -> NC, 00 (HP_ID_AM_DPAT) 1804/ A01 : ; d0-70=60 -> NC, c0 (HP_ECC_DATA_AM_DPAT) 1805/ A01 : ; f0-70=80 -> C, 00 (HP_DEFECTIVE_TRACK_AM_DPAT) 1806/ A01 : 20 C9 jr nz, wfs_id_am ; HP_DATA_AM_DPAT or HP_ECC_DATA_AM_DPAT? 1807/ A03 : DB 60 in a, (data) ; A: sector number 1808/ A05 : D1 pop de ; DE is zeros first time around? 1809/ A06 : F5 push af ; save flags and sector number 1810/ A07 : DB 60 in a, (data) ; A: first crc byte 1811/ A09 : CB C2 set SIO_D_SECTOR_FOUND, d 1812/ A0B : CD AA 0A call verify_crc ; E has OVERUN_m | CRCERR_m | ~READY_m 1813/ A0E : F1 pop af ; restore flags 1814/ A0F : 30 02 jr nc, .skipdt ; NC => HP_ID_AM_DPAT 1815/ A11 : CB D3 set SIO_E_DEFECTIVE_SECTOR, e ; found a HP_DEFECTIVE_TRACK_AM_DPAT 1816/ A13 : ;x0a13: 1817/ A13 : .skipdt: 1818/ A13 : CB 7F bit HEAD1, a ; A: sector number, is this HEAD1? 1819/ A15 : CB BF res HEAD1, a ; clear the HEAD1 bit from A 1820/ A17 : 4F ld c, a ; C: sector number field 1821/ A18 : 28 02 jr z, .skiphead 1822/ A1A : CB F8 set HEAD1, b ; set HEAD1 bit, B: cyl_hd 1823/ A1C : .skiphead: 1824/ A1C : DD BE 03 cp (ix + DriveData.sector) ; at the target sector? 1825/ A1F : 28 02 jr z, .skipws ; yes 1826/ A21 : CB FA set SIO_D_WRONG_SECTOR, d 1827/ A23 : .skipws: 1828/ A23 : 78 ld a, b 1829/ A24 : E6 7F and BYTENOT(HEAD1_m) 1830/ A26 : FD BE 0B cp (iy + YB(target_cyl_hd)) ; reached the target_cyl_hd? 1831/ A29 : 28 02 jr z, .skipwt ; yes 1832/ A2B : CB F2 set SIO_D_WRONG_TRACK, d 1833/ A2D : .skipwt: 1834/ A2D : 78 ld a, b 1835/ A2E : DD AE 02 xor (ix + DriveData.target_cyl_hd) 1836/ A31 : CB 7F bit HEAD1, a 1837/ A33 : 28 02 jr z, wfs_coda 1838/ A35 : CB EA set SIO_D_WRONG_HEAD, d 1839/ A37 : ;x0a37 1840/ A37 : wfs_coda: 1841/ A37 : 7B ld a, e ; E: verify_crc drv_status bits and accumulated bits 1842/ A38 : E1 pop hl ; get back ERROR masks 1843/ A39 : A5 and l ; mask from do_wait_for_sector L=60h 1844/ A3A : 20 05 jr nz, .wfs_error 1845/ A3C : 7A ld a, d 1846/ A3D : A4 and h ; mask from do_wait_for_sector H=10h 1847/ A3E : 20 01 jr nz, .wfs_error 1848/ A40 : C9 ret 1849/ A41 : 1850/ A41 : .wfs_error: 1851/ A41 : 7B ld a, e 1852/ A42 : E6 60 and OVERUN_m | CRCERR_m 1853/ A44 : C2 C4 09 jp nz, again ; try again in case is recoverable transient 1854/ A47 : 7A ld a, d 1855/ A48 : E6 60 and SIO_D_WRONG_TRACK_m | SIO_D_WRONG_HEAD_m 1856/ A4A : C0 ret nz 1857/ A4B : 7A ld a, d 1858/ A4C : E6 84 and SIO_D_WRONG_SECTOR_m | SIO_D_BIT4 1859/ A4E : C2 C4 09 jp nz, again 1860/ A51 : wfs_done: 1861/ A51 : F6 01 or 1 ; set NZ 1862/ A53 : CB CA set SIO_D_WFS_FAILED, d 1863/ A55 : C9 ret 1864/ A56 : 1865/ A56 : wfs_timedout: 1866/ A56 : AF xor a 1867/ A57 : D3 64 out (cntl), a 1868/ A59 : D1 pop de 1869/ A5A : E1 pop hl 1870/ A5B : CB C3 set SIO_E_SCE, e 1871/ A5D : 18 F2 jr wfs_done 1872/ A5F : 1873/ A5F : ; wfs_ibm - wait for an IBM format sector ID AM 1874/ A5F : ;x0a5f: 1875/ A5F : wfs_ibm: 1876/ A5F : D3 64 out (cntl), a ; CRCON_m from above 1877/ A61 : .waitamibm: 1878/ A61 : ED 70 in (c) ; undocumented Z80: in flags, (c) 1879/ A63 : 28 FC jr z, .waitamibm ; wait until either AMDT or TIMEOUT are set 1880/ A65 : F2 56 0A jp p, wfs_timedout 1881/ A68 : 78 ld a, b 1882/ A69 : ; NOTE: IBM AM is included in CRC calcs 1883/ A69 : D3 64 out (cntl), a ; READON_m | CRCON_m 1884/ A6B : DB 60 in a, (data) ; read the AM 1885/ A6D : 47 ld b, a 1886/ A6E : DB 61 in a, (clock) 1887/ A70 : FE C7 cp IBM_AM_CLK ; and the correct clock byte? 1888/ A72 : C2 CC 09 jp nz, wfs_id_am 1889/ A75 : 78 ld a, b 1890/ A76 : FE FE cp IBM_ID_AM_DPAT 1891/ A78 : C2 CC 09 jp nz, wfs_id_am ; not the AM, try again 1892/ A7B : DB 60 in a, (data) ; read the track number 1893/ A7D : D1 pop de ; get the flags word 1894/ A7E : 47 ld b, a 1895/ A7F : FD BE 0B cp (iy + YB(target_cyl_hd)) ; reached target_cyl_hd? 1896/ A82 : 28 02 jr z, .skipwt 1897/ A84 : CB F2 set SIO_D_WRONG_TRACK, d 1898/ A86 : .skipwt: 1899/ A86 : DB 60 in a, (data) 1900/ A88 : FE 00 cp 0 ; should have a 00h byte here 1901/ A8A : 28 02 jr z, .skipb5 1902/ A8C : CB EA set SIO_D_BIT5, d ; bad id field 9th byte not 00h 1903/ A8E : .skipb5: 1904/ A8E : DB 60 in a, (data) ; sector number 1905/ A90 : 4F ld c, a 1906/ A91 : DD BE 03 cp (ix + DriveData.sector) 1907/ A94 : 28 02 jr z, .skipws 1908/ A96 : CB FA set SIO_D_WRONG_SECTOR, d 1909/ A98 : .skipws: 1910/ A98 : DB 60 in a, (data) 1911/ A9A : FE 00 cp 0 ; another 00h byte here 1912/ A9C : 28 02 jr z, .skipd4 1913/ A9E : CB E2 set SIO_D_BIT4, d ; bad id field 11th byte not 00h 1914/ AA0 : .skipd4: 1915/ AA0 : DB 60 in a, (data) ; first CRC byte 1916/ AA2 : CB C2 set SIO_D_SECTOR_FOUND, d 1917/ AA4 : CD AA 0A call verify_crc 1918/ AA7 : C3 37 0A jp wfs_coda 1919/ AAA : 1920/ AAA : 1921/ AAA : ; verify CRC 1922/ AAA : ; on entry: 1923/ AAA : ; The first CRC byte has been read? 1924/ AAA : ; IX: DriveData pointer 1925/ AAA : ; E: stat2? 1926/ AAA : ; 1927/ AAA : ; on exit: 1928/ AAA : ; E: drv_status | E with READY complemented 1929/ AAA : 1930/ AAA : verify_crc: 1931/ AAA : DB 60 in a, (data) ; process the second CRC byte 1932/ AAC : DD 7E 04 ld a, (ix + DriveData.drv) 1933/ AAF : 67 ld h, a 1934/ AB0 : E6 F3 and ~(HEADLOAD_m | MGNENA_m) ; turn off the IN-USE and error signals enable? 1935/ AB2 : D3 65 out (drv), a 1936/ AB4 : DB 60 in a, (data) ; one more to finalize the CRC check? 1937/ AB6 : 7C ld a, h 1938/ AB7 : E6 F7 and ~HEADLOAD_m ; turn on the error signals? 1939/ AB9 : D3 65 out (drv), a 1940/ ABB : ;x0abb: 1941/ ABB : sio_done_get_status: 1942/ ABB : DB 62 in a, (drv_status) 1943/ ABD : 6F ld l, a 1944/ ABE : AF xor a 1945/ ABF : D3 64 out (cntl), a ; turn off cntl signals 1946/ AC1 : 7D ld a, l ; A: drv_status value 1947/ AC2 : E6 70 and OVERUN_m | CRCERR_m | READY_m 1948/ AC4 : B3 or e ; Or in the other bits captured during the I/O 1949/ AC5 : CB 67 bit READY, a ; Toggle READY bit - not sure why this 1950/ AC7 : CB E7 set READY, a ; is done this way, do_sector_io_check could 1951/ AC9 : 28 02 jr z, .skip ; just reverse the sense of the bit test later. 1952/ ACB : CB A7 res READY, a 1953/ ACD : 5F .skip: ld e, a ; SIO_E_NOT_READY == ~READY 1954/ ACE : C9 ret 1955/ ACF : 1956/ ACF : do_read_sector: 1957/ ACF : 3E 1E ld a, IU_READ 1958/ AD1 : (MACRO) set_in_use_leds 1958/ AD1 : EF rst 28h 1959/ AD2 : CD B5 09 call wait_for_sector_id_field ; DE: SIO_* flags 1960/ AD5 : 3E 01 ld a, 1 ; # retry attempts? 1961/ AD7 : 20 55 jr nz, do_read_sector_exit ; failed 1962/ AD9 : 1963/ AD9 : do_read_sector_common: 1964/ AD9 : E5 push hl 1965/ ADA : 67 ld h, a ; H: # retry attempts? 1966/ ADB : C5 push bc 1967/ ADC : 3E 02 ld a, CRCON_m 1968/ ADE : D3 64 out (cntl), a 1969/ AE0 : CB DB set SIO_E_3, e ; ? 1970/ AE2 : D5 push de ; save SIO_* flags from wait_for_sector_id_field 1971/ AE3 : 06 BE ld b, 0beh 1972/ AE5 : 16 0E ld d, HP_AM_CLK 1973/ AE7 : 0E 67 ld c, switches + NOSW ; switch port without switch bits 1974/ AE9 : 1E 7F ld e, 7fh ; mask for HP_ID_AM_DPAT and HP_DEFECTIVE_TRACK_AM_DPAT 1975/ AEB : 2E 22 ld l, READON_m | CRCON_m 1976/ AED : FD CB 09 46 bit FORMAT_IBM, (iy + YB(disc_format)) 1977/ AF1 : C2 53 0B jp nz, do_read_sector_ibm 1978/ AF4 : 1979/ AF4 : do_read_sector_hp: 1980/ AF4 : ED 70 in (c) ; undocumented Z80: in flags, (c) 1981/ AF6 : F2 32 0B jp p, do_read_sector_hp_retry ; timedout 1982/ AF9 : DB 60 in a, (data) ; track number 1983/ AFB : A3 and e ; mask AM for valid and defective AMs? 1984/ AFC : 5F ld e, a 1985/ AFD : DB 61 in a, (clock) 1986/ AFF : BA cp d ; have the correct AM clock pattern? 1987/ B00 : 20 40 jr nz, do_read_sector_retry 1988/ B02 : 7D ld a, l 1989/ B03 : D3 64 out (cntl), a ; READON_m | CRCON_m - start CRC calcs 1990/ B05 : DB 60 in a, (data) 1991/ B07 : 57 ld d, a ; first byte of sector data 1992/ B08 : 7B ld a, e ; test masked AM 1993/ B09 : FE 50 cp HP_DATA_AM_DPAT 1994/ B0B : 20 33 jr nz, do_read_sector_retry_hp_clk 1995/ B0D : 21 4F 60 ld hl, data_buffer+1 ; what are these shennanigans? 1996/ B10 : 72 ld (hl), d ; sector data is byte swapped?? 1997/ B11 : 2B dec hl ; compatability with other systems? 1998/ B12 : DB 60 in a, (data) 1999/ B14 : 77 ld (hl), a ; second byte of sector data 2000/ B15 : 23 inc hl 2001/ B16 : 23 inc hl 2002/ B17 : 0E 60 ld c, data 2003/ B19 : 06 FE ld b, 254 2004/ B1B : .readloop: ; continue reading until 256 bytes saved 2005/ B1B : 23 inc hl 2006/ B1C : ED AA ind 2007/ B1E : ED A2 ini 2008/ B20 : 23 inc hl 2009/ B21 : 20 F8 jr nz, .readloop 2010/ B23 : 2011/ B23 : do_read_sector_verify_crc: 2012/ B23 : DB 60 in a, (data) 2013/ B25 : D1 pop de 2014/ B26 : 36 01 ld (hl), 1 ; ? 2015/ B28 : CD AA 0A call verify_crc ; DE: SIO_* flags 2016/ B2B : 78 ld a, b 2017/ B2C : 2018/ B2C : do_read_sector_cleanup_exit: 2019/ B2C : C1 pop bc 2020/ B2D : E1 pop hl 2021/ B2E : 2022/ B2E : do_read_sector_exit: 2023/ B2E : CD EB 14 call show_previous_in_use_leds 2024/ B31 : C9 ret 2025/ B32 : 2026/ B32 : do_read_sector_hp_retry: 2027/ B32 : 10 C0 djnz do_read_sector_hp 2028/ B34 : 25 dec h 2029/ B35 : 20 BD jr nz, do_read_sector_hp 2030/ B37 : 2031/ B37 : do_read_sector_retries_exhausted: 2032/ B37 : AF xor a 2033/ B38 : D3 64 out (cntl), a ; stop the read attempts 2034/ B3A : D1 pop de 2035/ B3B : CB CB set SIO_E_1, e ; retries exhausted? 2036/ B3D : 3C inc a ; set NZ? 2037/ B3E : 18 EC jr do_read_sector_cleanup_exit 2038/ B40 : 2039/ B40 : do_read_sector_retry_hp_clk: 2040/ B40 : 16 0E ld d, HP_AM_CLK 2041/ B42 : do_read_sector_retry: 2042/ B42 : 1E 7F ld e, 7fh ; AM mask? 2043/ B44 : AF xor a 2044/ B45 : D3 64 out (cntl), a ; reset CRC chip 2045/ B47 : 3E 02 ld a, CRCON_m 2046/ B49 : D3 64 out (cntl), a 2047/ B4B : FD CB 09 46 bit FORMAT_IBM, (iy + YB(disc_format)) 2048/ B4F : 28 E1 jr z, do_read_sector_hp_retry 2049/ B51 : 18 2F jr do_read_sector_ibm_retry 2050/ B53 : 2051/ B53 : do_read_sector_ibm: 2052/ B53 : ED 70 in (c) ; undocumented Z80: in flags, (c) 2053/ B55 : F2 82 0B jp p, do_read_sector_ibm_retry ; AMDT not asserted must be a TIMEOUT 2054/ B58 : 7D ld a, l 2055/ B59 : D3 64 out (cntl), a ; READON_m | CRCON_m 2056/ B5B : DB 60 in a, (data) 2057/ B5D : D6 F8 sub IBM_DELETED_DATA_AM_DPAT 2058/ B5F : 28 04 jr z, .doread 2059/ B61 : FE 03 cp 3 ; IBM_DATA_AM_DPAT - IBM_DELETED_DATA_AM_DPAT = 3 2060/ B63 : 20 DD jr nz, do_read_sector_retry 2061/ B65 : .doread: 2062/ B65 : 57 ld d, a ; save the subtraction result 2063/ B66 : DB 61 in a, (clock) 2064/ B68 : FE C7 cp IBM_AM_CLK 2065/ B6A : 20 D6 jr nz, do_read_sector_retry 2066/ B6C : 0E 60 ld c, data ; data port number 2067/ B6E : 21 4E 60 ld hl, data_buffer 2068/ B71 : 06 80 ld b, IBM_BYTES_PER_SECTOR 2069/ B73 : ED B2 inir ; save the sector data 2070/ B75 : 7A ld a, d ; A: the AM subtraction result 2071/ B76 : D1 pop de ; SIO_* flags from wait_for_sector_id_field 2072/ B77 : FE 03 cp 3 2073/ B79 : 28 02 jr z, .valid 2074/ B7B : CB D3 set SIO_E_DEFECTIVE_SECTOR, e 2075/ B7D : D5 .valid: push de 2076/ B7E : 06 80 ld b, IBM_BYTES_PER_SECTOR 2077/ B80 : 18 A1 jr do_read_sector_verify_crc 2078/ B82 : 2079/ B82 : do_read_sector_ibm_retry: 2080/ B82 : 10 CF djnz do_read_sector_ibm 2081/ B84 : 18 B1 jr do_read_sector_retries_exhausted 2082/ B86 : 2083/ B86 : 2084/ B86 : cmd_unbuffered_write: 2085/ B86 : CD 2A 07 call sio_common_prep 2086/ B89 : CD D0 02 call verify_write_enabled 2087/ B8C : 06 00 ld b, 0 2088/ B8E : CD A3 12 call wait_for_HPIB_SAD 2089/ B91 : (MACRO) load_head 2089/ B91 : E7 rst 20h 2090/ B92 : CD 55 14 .again: call receive_sector_data 2091/ B95 : CD 87 0C call head_unload_timer_1s_check 2092/ B98 : 21 57 F0 ld hl, 0f057h 2093/ B9B : ; (SIO_D_WRONG_SECTOR_m | SIO_D_WRONG_TRACK_m | SIO_WRONG_HEAD_m | SIO_BIT5_m) << 8 2094/ B9B : ; | (OVERUN_m | SIO_E_NOT_READY_m | SIO_E_DEFECTIVE_SECTOR_m | SIO_E_1_m | SIO_E_SCE_m) 2095/ B9B : CD C8 0B call write_sector 2096/ B9E : C2 67 14 jp nz, listen_terminate 2097/ BA1 : 3A 0A 60 ld a, (listen_transfer_final_d0d1) 2098/ BA4 : FE C0 cp IN_EOI 2099/ BA6 : 20 EA jr nz, .again 2100/ BA8 : CD B1 14 call normal_and_deselect_drives 2101/ BAB : C9 ret 2102/ BAC : 2103/ BAC : 2104/ BAC : cmd_buffered_write: 2105/ BAC : CD 2A 07 call sio_common_prep 2106/ BAF : CD D0 02 call verify_write_enabled 2107/ BB2 : 06 00 ld b, 0 2108/ BB4 : CD A3 12 call wait_for_HPIB_SAD 2109/ BB7 : (MACRO) load_head 2109/ BB7 : E7 rst 20h 2110/ BB8 : CD 55 14 call receive_sector_data 2111/ BBB : CD 87 0C call head_unload_timer_1s_check 2112/ BBE : 21 57 F0 ld hl, 0f057h 2113/ BC1 : ; (SIO_D_WRONG_SECTOR_m | SIO_D_WRONG_TRACK_m | SIO_WRONG_HEAD_m | SIO_BIT5_m) << 8 2114/ BC1 : ; | (OVERUN_m | SIO_E_NOT_READY_m | SIO_E_DEFECTIVE_SECTOR_m | SIO_E_1_m | SIO_E_SCE_m) 2115/ BC1 : CD C8 0B call write_sector 2116/ BC4 : CC B1 14 call z, normal_and_deselect_drives 2117/ BC7 : C9 ret 2118/ BC8 : 2119/ BC8 : write_sector: 2120/ BC8 : CD AC 08 call seek_to_target_cyl_hd 2121/ BCB : 28 06 jr z, .ok 2122/ BCD : D2 90 14 jp nc, abort_seek_check 2123/ BD0 : DA 80 14 jp c, abort_drive_fault_seek 2124/ BD3 : CD E1 0B .ok: call do_write_sector 2125/ BD6 : CD CA 08 call do_sector_io_check 2126/ BD9 : 30 ED jr nc, write_sector 2127/ BDB : C0 ret nz 2128/ BDC : CD 6D 09 call next_logical_sector 2129/ BDF : AF xor a 2130/ BE0 : C9 ret 2131/ BE1 : 2132/ BE1 : do_write_sector: 2133/ BE1 : 3E 1C ld a, IU_WRT 2134/ BE3 : (MACRO) set_in_use_leds 2134/ BE3 : EF rst 28h 2135/ BE4 : CD 5B 16 call set_lowcurr_and_precmp 2136/ BE7 : E5 push hl ; save error masks 2137/ BE8 : CD B5 09 call wait_for_sector_id_field 2138/ BEB : 20 57 jr nz, write_sector_cleanup_ret 2139/ BED : 21 4E 60 ld hl, data_buffer 2140/ BF0 : FD CB 09 46 bit FORMAT_IBM, (iy + YB(disc_format)) 2141/ BF4 : 20 56 jr nz, write_ibm_sector 2142/ BF6 : 06 2B ld b, HP_LOWCURR_START_TRACK 2143/ BF8 : 10 FE .wait: djnz .wait 2144/ BFA : 3E 04 ld a, WRITON_m 2145/ BFC : D3 64 out (cntl), a 2146/ BFE : AF xor a 2147/ BFF : D3 61 out (clock), a 2148/ C01 : D3 60 out (data), a ; first 00h byte clock sync data field 2149/ C03 : 3E 0C ld a, WRITDRV_m | WRITON_m 2150/ C05 : D3 64 out (cntl), a 2151/ C07 : AF xor a 2152/ C08 : D3 60 out (data), a ; second 00h byte clock sync 2153/ C0A : 0E 60 ld c, data 2154/ C0C : D3 60 out (data), a ; third 00h byte clock sync 2155/ C0E : D3 60 out (data), a ; fourth 00h byte clock sync 2156/ C10 : 06 04 ld b, 4 2157/ C12 : 3D dec a 2158/ C13 : D3 60 .loop: out (data), a ; write 4 ffh byte clock sync 2159/ C15 : 10 FC djnz .loop 2160/ C17 : 3E 38 ld a, 38h 2161/ C19 : D3 61 out (clock), a 2162/ C1B : 3E 50 ld a, HP_DATA_AM_DPAT 2163/ C1D : D3 60 out (data), a 2164/ C1F : AF xor a 2165/ C20 : D3 61 out (clock), a 2166/ C22 : 47 ld b, a 2167/ C23 : 3E 2C ld a, READON_m | WRITDRV_m | WRITON_m 2168/ C25 : D3 64 out (cntl), a 2169/ C27 : .wrtloop: 2170/ C27 : 23 inc hl ; sector data is byte swapped 2171/ C28 : ED AB outd 2172/ C2A : ED A3 outi 2173/ C2C : 23 inc hl 2174/ C2D : 20 F8 jr nz, .wrtloop 2175/ C2F : write_sector_coda: 2176/ C2F : 3E 3C ld a, READON_m | CRCOUT_m | WRITDRV_m | WRITON_m 2177/ C31 : D3 64 out (cntl), a 2178/ C33 : AF xor a 2179/ C34 : D3 60 out (data), a ; CRC bytes get written here 2180/ C36 : D3 60 out (data), a 2181/ C38 : 3E 0C ld a, WRITDRV_m | WRITON_m 2182/ C3A : D3 64 out (cntl), a 2183/ C3C : 78 ld a, b 2184/ C3D : D3 60 out (data), a ; ? 2185/ C3F : D3 60 out (data), a 2186/ C41 : CD BB 0A call sio_done_get_status 2187/ C44 : 2188/ C44 : write_sector_cleanup_ret: 2189/ C44 : AF xor a 2190/ C45 : D3 64 out (cntl), a 2191/ C47 : CD EB 14 call show_previous_in_use_leds 2192/ C4A : E1 pop hl 2193/ C4B : C9 ret 2194/ C4C : 2195/ C4C : ;x0c4c: 2196/ C4C : write_ibm_sector: 2197/ C4C : 06 47 ld b, 71 ; delay a bit 2198/ C4E : 10 FE .delay: djnz .delay 2199/ C50 : 3E 04 ld a, 4 2200/ C52 : D3 64 out (cntl), a 2201/ C54 : 06 05 ld b, 5 2202/ C56 : 3E FF ld a, 0ffh 2203/ C58 : D3 61 out (clock), a 2204/ C5A : AF xor a 2205/ C5B : D3 60 out (data), a 2206/ C5D : 3E 0C ld a, WRITDRV_m | WRITON_m 2207/ C5F : D3 64 out (cntl), a 2208/ C61 : AF xor a 2209/ C62 : D3 60 .loop: out (data), a 2210/ C64 : 10 FC djnz .loop 2211/ C66 : 3E 2C ld a, READON_m | WRITDRV_m | WRITON_m 2212/ C68 : D3 64 out (cntl), a 2213/ C6A : 3E C7 ld a, IBM_AM_CLK 2214/ C6C : D3 61 out (clock), a 2215/ C6E : 3E FB ld a, IBM_DATA_AM_DPAT 2216/ C70 : FD CB 05 56 bit DBIT_ON, (iy + YB(state_flags)) 2217/ C74 : 28 02 jr z, .notdel 2218/ C76 : 3E F8 ld a, IBM_DELETED_DATA_AM_DPAT 2219/ C78 : .notdel: 2220/ C78 : D3 60 out (data), a 2221/ C7A : 3E FF ld a, 0ffh 2222/ C7C : D3 61 out (clock), a 2223/ C7E : 06 80 ld b, IBM_BYTES_PER_SECTOR 2224/ C80 : 0E 60 ld c, data 2225/ C82 : ED B3 otir 2226/ C84 : 05 dec b 2227/ C85 : 18 A8 jr write_sector_coda 2228/ C87 : 2229/ C87 : head_unload_timer_1s_check: 2230/ C87 : 16 FF ld d, 0ffh ; approx 1 s elapsed? 2231/ C89 : CD 5F 15 call head_unload_timer_check 2232/ C8C : C9 ret 2233/ C8D : 2234/ C8D : 2235/ C8D : (MACRO) fillto 0ca0h, 076h 2235/ C8D : 76 76 76 76 76 76 db (0CA0H-$) dup (076H) C93 : 76 76 76 76 76 76 C99 : 76 76 76 76 76 76 C9F : 76 2236/ CA0 : 2237/ CA0 : 2238/ CA0 : cmd_initialize: 2239/ CA0 : CD BE 02 call check_for_holdoff 2240/ CA3 : CD EB 02 call verify_unit_ready 2241/ CA6 : CD C7 02 call verify_known_format 2242/ CA9 : CD 63 00 call verify_cylinder_jv 2243/ CAC : CD D0 02 call verify_write_enabled 2244/ CAF : (MACRO) load_head 2244/ CAF : E7 rst 20h 2245/ CB0 : (MACRO) seek 2245/ CB0 : D7 rst 10h 2246/ CB1 : FD CB 09 46 bit FORMAT_IBM, (iy + YB(disc_format)) 2247/ CB5 : 20 1C jr nz, .initibm 2248/ CB7 : 16 00 ld d, 0 2249/ CB9 : FD 72 12 ld (iy + YB(format_flags)), d ; reset the format_flags 2250/ CBC : 1E 70 ld e, HP_ID_AM_DPAT 2251/ CBE : FD CB 47 6E bit INIT_DBIT, (iy + YB(cmd_buffer)) 2252/ CC2 : 28 02 jr z, .skip 2253/ CC4 : 1E F0 ld e, HP_DEFECTIVE_TRACK_AM_DPAT ; D bit was set in the command 2254/ CC6 : DD 4E 02 .skip: ld c, (ix + DriveData.target_cyl_hd) 2255/ CC9 : 06 02 ld b, 2 ; Initialize interleave value 2256/ CCB : CD 5D 00 call fmt_hp_track 2257/ CCE : C2 8A 14 jp nz, abort_drive_fault 2258/ CD1 : 18 0A jr .init_common 2259/ CD3 : 2260/ CD3 : .initibm: 2261/ CD3 : FD CB 47 6E bit INIT_DBIT, (iy + YB(cmd_buffer)) 2262/ CD7 : 28 04 jr z, .init_common 2263/ CD9 : FD CB 05 D6 set DBIT_ON, (iy + YB(state_flags)) 2264/ CDD : 2265/ CDD : .init_common: 2266/ CDD : 06 00 ld b, 0 2267/ CDF : CD A3 12 call wait_for_HPIB_SAD 2268/ CE2 : CD 55 14 call receive_sector_data 2269/ CE5 : 21 53 F0 ld hl, 0f053h 2270/ CE8 : ; (SIO_D_WRONG_SECTOR_m | SIO_D_WRONG_TRACK_m | SIO_WRONG_HEAD_m | SIO_BIT5_m) << 8 2271/ CE8 : ; | (OVERUN_m | SIO_E_NOT_READY_m | SIO_E_1_m | SIO_E_SCE_m) 2272/ CE8 : CD 33 00 call write_sector_jv 2273/ CEB : FD CB 05 96 res DBIT_ON, (iy + YB(state_flags)) 2274/ CEF : CC B1 14 call z, normal_and_deselect_drives 2275/ CF2 : 3A 01 60 ld a, (S1) 2276/ CF5 : FE 31 cp S1_DBIT_m | S1_DTE 2277/ CF7 : CC B1 14 call z, normal_and_deselect_drives 2278/ CFA : C9 ret 2279/ CFB : 2280/ CFB : 2281/ CFB : ; cmd_format - format a disc 2282/ CFB : cmd_format: 2283/ CFB : CD BE 02 call check_for_holdoff 2284/ CFE : CD EB 02 call verify_unit_ready 2285/ D01 : CD D0 02 call verify_write_enabled 2286/ D04 : 3A 49 60 ld a, (format_type) 2287/ D07 : E6 7F and FORMAT_WANTED_TYPE_M 2288/ D09 : FE 02 cp FORMAT_TYPE_HP 2289/ D0B : 28 05 jr z, .typegood 2290/ D0D : FE 08 cp FORMAT_TYPE_IBM 2291/ D0F : C2 73 14 jp nz, abort_IO_program_error 2292/ D12 : .typegood: 2293/ D12 : 07 rlca ; convert into the desired DISC_TYPE value 2294/ D13 : 47 ld b, a 2295/ D14 : 3A 4A 60 ld a, (format_interleave) ; validate the interleave value 2296/ D17 : FE 01 cp 1 2297/ D19 : FA 73 14 jp m, abort_IO_program_error 2298/ D1C : 0E 1E ld c, HP_SECTORS_PER_TRACK 2299/ D1E : CB 60 bit DT_IBM, b 2300/ D20 : 28 02 jr z, .valid 2301/ D22 : 0E 1A ld c, IBM_SECTORS_PER_TRACK 2302/ D24 : B9 .valid: cp c 2303/ D25 : D2 73 14 jp nc, abort_IO_program_error 2304/ D28 : DD 7E 05 ld a, (ix + DriveData.stat2) 2305/ D2B : 32 0D 60 ld (previous_format), a 2306/ D2E : E6 08 and DT_DS_m 2307/ D30 : B0 or b ; add in the double sided flag 2308/ D31 : CB 67 bit DT_IBM, a 2309/ D33 : 28 05 jr z, .savestat2 2310/ D35 : CB 5F bit DT_DS, a 2311/ D37 : C2 9C 14 jp nz, abort_stat2_error ; IBM format is single sided only 2312/ D3A : .savestat2: 2313/ D3A : DD 77 05 ld (ix + DriveData.stat2), a 2314/ D3D : 2315/ D3D : 06 04 ld b, NUNITS ; unload the other drive's heads 2316/ D3F : .uloop: 2317/ D3F : 05 dec b ; as this will take a while 2318/ D40 : FA 4C 0D jp m, format_disc 2319/ D43 : 78 ld a, b 2320/ D44 : FD BE 03 cp (iy + YB(current_unit)) 2321/ D47 : C4 D8 15 call nz, maybe_unload_head 2322/ D4A : 18 F3 jr .uloop 2323/ D4C : 2324/ D4C : format_disc: 2325/ D4C : CD 4C 15 call deselect_drives 2326/ D4F : 3A 03 60 ld a, (current_unit) 2327/ D52 : CD 1A 15 call prep_drive_regs 2328/ D55 : 3E 0E ld a, IU_FMT 2329/ D57 : (MACRO) set_in_use_leds 2329/ D57 : EF rst 28h 2330/ D58 : (MACRO) load_head 2330/ D58 : E7 rst 20h 2331/ D59 : (MACRO) reset_drive 2331/ D59 : CF rst 08h 2332/ D5A : C2 80 14 jp nz, abort_drive_fault_seek 2333/ D5D : 01 00 00 ld bc, 0 2334/ D60 : FD 70 12 ld (iy + YB(format_flags)), b ; reset the format_flags 2335/ D63 : FD CB 09 46 bit FORMAT_IBM, (iy + YB(disc_format)) 2336/ D67 : C2 F7 0D jp nz, do_ibm_format 2337/ D6A : .hpfmtloop: 2338/ D6A : 78 ld a, b 2339/ D6B : FE 4D cp PHYSICAL_TRACKS 2340/ D6D : 28 77 jr z, format_done 2341/ D6F : C5 push bc 2342/ D70 : FD CB 49 7E bit FORMAT_OVERRIDE, (iy + YB(format_type)) 2343/ D74 : 20 1D jr nz, .hpdofmt 2344/ D76 : FD CB 0D 56 bit DT_HP, (iy + YB(previous_format)) 2345/ D7A : 28 17 jr z, .hpdofmt ; blank media or different format 2346/ D7C : (MACRO) wait_for_sector ; no, check current format? 2346/ D7C : DF rst 18h 2347/ D7D : FE FF cp 0ffh 2348/ D7F : 28 04 jr z, .x0d85 2349/ D81 : CB 53 bit 2, e ; DT_HP? 2350/ D83 : 28 0E jr z, .hpdofmt 2351/ D85 : 0E FF .x0d85: ld c, HP_DEFECTIVE_TRACK_MARKER 2352/ D87 : CD EE 0D call get_interleave_and_data_byte 2353/ D8A : CD 5D 00 call fmt_hp_track 2354/ D8D : C2 8A 14 jp nz, abort_drive_fault 2355/ D90 : C1 pop bc 2356/ D91 : 18 1B jr .x0dae 2357/ D93 : 2358/ D93 : .hpdofmt: 2359/ D93 : C1 pop bc 2360/ D94 : C5 push bc ; b = current physical track or logical track? 2361/ D95 : CD EE 0D call get_interleave_and_data_byte 2362/ D98 : CD 5D 00 call fmt_hp_track 2363/ D9B : C2 8A 14 jp nz, abort_drive_fault 2364/ D9E : C1 pop bc 2365/ D9F : DD CB 05 5E bit DT_DS, (ix + DriveData.stat2) 2366/ DA3 : 28 08 jr z, .skipss1 2367/ DA5 : CB 79 bit 7, c ; what is C here? 2368/ DA7 : CB F9 set 7, c 2369/ DA9 : 28 03 jr z, .x0dae 2370/ DAB : CB B9 res 7, c 2371/ DAD : .skipss1: 2372/ DAD : 0C inc c 2373/ DAE : DD CB 05 5E .x0dae: bit DT_DS, (ix + DriveData.stat2) 2374/ DB2 : 28 0E jr z, .skipss2 2375/ DB4 : DD CB 04 7E bit HEAD1, (ix + DriveData.drv) ; remember which head was selected 2376/ DB8 : DD CB 04 FE set HEAD1, (ix + DriveData.drv) ; select head 1 2377/ DBC : 28 05 jr z, .skipinc ; head 0 was selected previously 2378/ DBE : DD CB 04 BE res HEAD1, (ix + DriveData.drv) ; select head 0 2379/ DC2 : .skipss2: 2380/ DC2 : 04 inc b 2381/ DC3 : .skipinc: 2382/ DC3 : (MACRO) deassert_in_use 2382/ DC3 : F7 rst 30h 2383/ DC4 : DD CB 04 7E bit HEAD1, (ix + DriveData.drv) 2384/ DC8 : CC 61 0E call z, step_in_one_track ; head 0 was selected 2385/ DCB : AF xor a 2386/ DCC : DD CB 04 7E bit HEAD1, (ix + DriveData.drv) 2387/ DD0 : 3A 0F 60 ld a, (fmt_data_1) 2388/ DD3 : 20 03 jr nz, .x0dd8 2389/ DD5 : 3A 0E 60 ld a, (fmt_data_2) 2390/ DD8 : FD 86 10 .x0dd8: add a, (iy + YB(format_phys_sector)) 2391/ DDB : FE 1E cp HP_SECTORS_PER_TRACK 2392/ DDD : 38 02 jr c, .x0de1 2393/ DDF : D6 1E sub HP_SECTORS_PER_TRACK 2394/ DE1 : 32 10 60 .x0de1: ld (format_phys_sector), a 2395/ DE4 : 18 84 jr .hpfmtloop 2396/ DE6 : 2397/ DE6 : format_done: 2398/ DE6 : (MACRO) reset_drive 2398/ DE6 : CF rst 08h 2399/ DE7 : C2 80 14 jp nz, abort_drive_fault_seek 2400/ DEA : CD B1 14 call normal_and_deselect_drives 2401/ DED : C9 ret 2402/ DEE : 2403/ DEE : ; on exit: 2404/ DEE : ; B: interleave 2405/ DEE : ; D: data byte 2406/ DEE : get_interleave_and_data_byte: 2407/ DEE : FD 46 4A ld b, (iy + YB(format_interleave)) 2408/ DF1 : FD 56 4B ld d, (iy + YB(format_data_byte)) 2409/ DF4 : 1E 70 ld e, 70h ; HP_ID_AM_DPAT? 2410/ DF6 : C9 ret 2411/ DF7 : 2412/ DF7 : ;x0df7: 2413/ DF7 : do_ibm_format: 2414/ DF7 : C5 push bc 2415/ DF8 : FD CB 49 7E bit FORMAT_OVERRIDE, (iy + YB(format_type)) 2416/ DFC : 20 06 jr nz, .skip 2417/ DFE : FD CB 0D 66 bit DT_IBM, (iy + YB(previous_format)) 2418/ E02 : 20 18 jr nz, .previous_type_is_ibm 2419/ E04 : C1 .skip: pop bc 2420/ E05 : C5 push bc 2421/ E06 : CD EE 0D call get_interleave_and_data_byte 2422/ E09 : CD 60 00 call fmt_ibm_track_jv 2423/ E0C : C2 8A 14 jp nz, abort_drive_fault 2424/ E0F : C1 pop bc 2425/ E10 : 0C inc c 2426/ E11 : .ibmfmtloop: 2427/ E11 : 04 inc b 2428/ E12 : 78 ld a, b 2429/ E13 : FE 4D cp PHYSICAL_TRACKS 2430/ E15 : 28 CF jr z, format_done 2431/ E17 : CD 61 0E call step_in_one_track 2432/ E1A : 18 DB jr do_ibm_format 2433/ E1C : 2434/ E1C : .previous_type_is_ibm: 2435/ E1C : 21 64 00 ld hl, 0064h ; HL = error masks for wfs_coda? 2436/ E1F : DD CB 04 96 res MGNENA, (ix + DriveData.drv) 2437/ E23 : CD 2B 00 .x0e23: call read_sector_jv 2438/ E26 : FD CB 12 BE res FF_DATA_INIT, (iy + YB(format_flags)) 2439/ E2A : CB 73 bit OVERUN, e 2440/ E2C : 20 17 jr nz, .x0e45 2441/ E2E : CB 42 bit SIO_D_SECTOR_FOUND, d 2442/ E30 : 28 21 jr z, .ibmcoda 2443/ E32 : 78 ld a, b 2444/ E33 : FE FF cp 0ffh 2445/ E35 : 28 1C jr z, .ibmcoda 2446/ E37 : CB 4B bit SIO_E_1, e 2447/ E39 : 20 0A jr nz, .x0e45 2448/ E3B : CB 6B bit CRCERR, e 2449/ E3D : 20 06 jr nz, .x0e45 2450/ E3F : CB 53 bit SIO_E_DEFECTIVE_SECTOR, e 2451/ E41 : 20 10 jr nz, .ibmcoda 2452/ E43 : 18 CC jr .ibmfmtloop 2453/ E45 : 2454/ E45 : FD CB 05 4E .x0e45: bit SECTOR_IO_RETRY, (iy + YB(state_flags)) 2455/ E49 : FD CB 05 CE set SECTOR_IO_RETRY, (iy + YB(state_flags)) 2456/ E4D : 28 04 jr z, .ibmcoda 2457/ E4F : FD CB 05 8E res SECTOR_IO_RETRY, (iy + YB(state_flags)) 2458/ E53 : .ibmcoda: 2459/ E53 : 0E FF ld c, 0ffh 2460/ E55 : CD EE 0D call get_interleave_and_data_byte 2461/ E58 : CD 60 00 call fmt_ibm_track_jv 2462/ E5B : C2 8A 14 jp nz, abort_drive_fault 2463/ E5E : C1 pop bc 2464/ E5F : 18 B0 jr .ibmfmtloop 2465/ E61 : 2466/ E61 : C5 step_in_one_track: push bc 2467/ E62 : 0E 00 ld c, 0 ; step in towards center 2468/ E64 : CD 1B 00 call step_drive_jv 2469/ E67 : 06 14 ld b, 20 2470/ E69 : CD 40 12 call delay ; delay 20 ms 2471/ E6C : C1 pop bc 2472/ E6D : DD 34 00 inc (ix + DriveData.physical_cylinder) 2473/ E70 : C9 ret 2474/ E71 : 2475/ E71 : ; do_hp_fmt_track - format an HP type track 2476/ E71 : ; 2477/ E71 : ; on entry 2478/ E71 : ; B: interleave 2479/ E71 : ; C: target_cyl_hd 2480/ E71 : ; D: data byte 2481/ E71 : ; E: ID AM 2482/ E71 : ; 2483/ E71 : ; on exit: 2484/ E71 : ; A = 0 (success) 2485/ E71 : ; A = 1 (failure) 2486/ E71 : 2487/ E71 : do_hp_fmt_track: 2488/ E71 : FD CB 12 7E bit FF_DATA_INIT, (iy + YB(format_flags)) 2489/ E75 : 20 21 jr nz, .skipinit 2490/ E77 : D5 push de 2491/ E78 : C5 push bc 2492/ E79 : CD FA 0F call init_sector_table 2493/ E7C : C1 pop bc 2494/ E7D : 21 90 0F ld hl, format_data_tbl 2495/ E80 : 78 ld a, b 2496/ E81 : 3D dec a 2497/ E82 : 07 rlca 2498/ E83 : 5F ld e, a 2499/ E84 : 19 add hl, de ; HL = &fmt_data_tbl[2 * (interleave - 1)] 2500/ E85 : 56 ld d, (hl) 2501/ E86 : 23 inc hl 2502/ E87 : 5E ld e, (hl) 2503/ E88 : ED 53 0E 60 ld (fmt_data_2), de 2504/ E8C : AF xor a 2505/ E8D : 32 10 60 ld (format_phys_sector), a 2506/ E90 : D1 pop de 2507/ E91 : CD CA 0F call init_hp_format_sector_buffer 2508/ E94 : FD CB 12 FE set FF_DATA_INIT, (iy + YB(format_flags)) 2509/ E98 : 2510/ E98 : ;x0e98: 2511/ E98 : .skipinit: 2512/ E98 : 06 00 ld b, 0 2513/ E9A : 79 ld a, c ; C: target_cyl_hd 2514/ E9B : FE FF cp HP_DEFECTIVE_TRACK_MARKER 2515/ E9D : 28 03 jr z, .skip 2516/ E9F : 47 ld b, a 2517/ EA0 : E6 7F and BYTENOT(HEAD1_m) ; just the cylinder 2518/ EA2 : 2519/ EA2 : F5 .skip: push af 2520/ EA3 : FD 70 0B ld (iy + YB(target_cyl_hd)), b 2521/ EA6 : CD 5B 16 call set_lowcurr_and_precmp 2522/ EA9 : FD 36 11 1E ld (iy + YB(fmt_sector_count)), HP_SECTORS_PER_TRACK 2523/ EAD : 0E 60 ld c, data ; data port address 2524/ EAF : CD 87 0F call get_log_sector_ptr ; DE = logical sector number pointer 2525/ EB2 : F1 pop af ; A = cylinder 2526/ EB3 : DD E5 push ix ; save DriveData pointer 2527/ EB5 : DD 21 74 60 ld ix, format_sector_buffer + 9 2528/ EB9 : DD 77 00 ld (ix + 0), a ; stuff the cylinder number into the buffer 2529/ EBC : 06 00 ld b, 0 2530/ EBE : AF xor a 2531/ EBF : D3 61 out (clock), a 2532/ EC1 : ;x0ec1: 2533/ EC1 : .widx1: 2534/ EC1 : DB 62 in a, (drv_status) ; wait for the index hole signal signal 2535/ EC3 : CB 67 bit READY, a 2536/ EC5 : CA 7F 0F jp z, fmt_track_error 2537/ EC8 : CB 47 bit INDEX, a 2538/ ECA : 28 F5 jr z, .widx1 2539/ ECC : 2540/ ECC : 3E 02 ld a, r_OVERUN_m ; prepare to format the track 2541/ ECE : D3 62 out (reset), a 2542/ ED0 : 3E 0C ld a, WRITDRV_m | WRITON_m 2543/ ED2 : D3 64 out (cntl), a 2544/ ED4 : 2545/ ED4 : .widxd1: ; while waiting for the index signal 2546/ ED4 : ED 41 out (c), b ; to be deasserted, write zeros 2547/ ED6 : DB 62 in a, (drv_status) ; erase end of gap 3? 2548/ ED8 : CB 67 bit READY, a 2549/ EDA : CA 7F 0F jp z, fmt_track_error 2550/ EDD : CB 47 bit INDEX, a 2551/ EDF : 20 F3 jr nz, .widxd1 2552/ EE1 : 2553/ EE1 : ED 41 .widx2: out (c), b ; wait for the index signal again (erase track) 2554/ EE3 : DB 62 in a, (drv_status) 2555/ EE5 : CB 67 bit READY, a 2556/ EE7 : CA 7F 0F jp z, fmt_track_error 2557/ EEA : CB 47 bit INDEX, a 2558/ EEC : 28 F3 jr z, .widx2 2559/ EEE : 2560/ EEE : ;x0eee 2561/ EEE : .widxd2: 2562/ EEE : ED 41 out (c), b ; finish erase track waiting for start of track 2563/ EF0 : DB 62 in a, (drv_status) 2564/ EF2 : CB 47 bit INDEX, a 2565/ EF4 : 20 F8 jr nz, .widxd2 2566/ EF6 : 2567/ EF6 : ; NOTE: Various bits of processing are done in between writes of floppy write data bytes 2568/ EF6 : ; to maintain timing. 2569/ EF6 : ;x0ef6 2570/ EF6 : .fmt_sector: 2571/ EF6 : 21 6B 60 ld hl, format_sector_buffer 2572/ EF9 : ED A3 outi ; first zero byte of ID field clock sync 2573/ EFB : 1A ld a, (de) ; A = logical sector number 2574/ EFC : FD CB 0B 7E bit HEAD1, (iy + YB(target_cyl_hd)) ; add in the head bit 2575/ F00 : 28 02 jr z, .current_cyl_hd0 2576/ F02 : CB FF set HEAD1, a 2577/ F04 : .current_cyl_hd0: 2578/ F04 : ED A3 outi ; second zero byte of ID field clock sync 2579/ F06 : 06 06 ld b, 6 2580/ F08 : DD 77 01 ld (ix + 1), a ; stuff the sector number into the buffer 2581/ F0B : ED B3 otir ; write 6 bytes (completes clock sync) 2582/ F0D : 3E 38 ld a, 38h 2583/ F0F : D3 61 out (clock), a 2584/ F11 : ED A3 outi ; write the AM with the required clock pattern 2585/ F13 : AF xor a 2586/ F14 : D3 61 out (clock), a 2587/ F16 : 3E 2C ld a, READON_m | WRITDRV_m | WRITON_M 2588/ F18 : D3 64 out (cntl), a 2589/ F1A : ED A3 outi ; write track number 2590/ F1C : ED A3 outi ; write sector number 2591/ F1E : 3E 3C ld a, READON_m | CRCOUT_m | WRITDRV_m | WRITON_m 2592/ F20 : D3 64 out (cntl), a 2593/ F22 : ED A3 outi ; write ID field CRC byte 1 2594/ F24 : ED A3 outi ; write ID field CRC byte 2 2595/ F26 : 3E 0C ld a, WRITDRV_m | WRITON_m 2596/ F28 : D3 64 out (cntl), a 2597/ F2A : 06 19 ld b, 25 2598/ F2C : ED B3 otir ; write 25 bytes gap 1 + data field sync 2599/ F2E : 3E 38 ld a, 38h 2600/ F30 : D3 61 out (clock), a 2601/ F32 : ED A3 outi ; write the data field AM with the required clock 2602/ F34 : AF xor a 2603/ F35 : D3 61 out (clock), a 2604/ F37 : 47 ld b, a 2605/ F38 : 3E 2C ld a, READON_m | WRITDRV_m | WRITON_M 2606/ F3A : D3 64 out (cntl), a 2607/ F3C : ED B3 otir ; write sector data fill 256 bytes 2608/ F3E : 3E 3C ld a, READON_m | CRCOUT_m | WRITDRV_m | WRITON_m 2609/ F40 : D3 64 out (cntl), a 2610/ F42 : ED A3 outi ; write data field CRC byte 1 2611/ F44 : ED A3 outi ; write data field CRC byte 2 2612/ F46 : 3E 0C ld a, WRITDRV_m | WRITON_m 2613/ F48 : D3 64 out (cntl), a 2614/ F4A : 06 23 ld b, 35 2615/ F4C : ED A3 outi ; write 35 bytes (1 zero byte + gap 2) 2616/ F4E : 3A 10 60 ld a, (format_phys_sector) 2617/ F51 : 3C inc a 2618/ F52 : ; is gap2 actually larger than documented? gap 3 smaller? 2619/ F52 : ED A3 outi ; write one byte - what is this?? B = 255 2620/ F54 : FE 1E cp HP_SECTORS_PER_TRACK 2621/ F56 : 38 01 jr c, .skipwrap ; format_phys_sector < HP_SECTORS_PER_TRACK 2622/ F58 : AF xor a ; sector numbers wrapped around 2623/ F59 : .skipwrap: 2624/ F59 : 32 10 60 ld (format_phys_sector), a 2625/ F5C : ED A3 outi ; write one byte - what is this?? B = 254 2626/ F5E : 11 4D 60 ld de, sector_table ; get address of the next logical sector number 2627/ F61 : 83 add a, e 2628/ F62 : 5F ld e, a 2629/ F63 : ED A3 outi ; write one byte - what is this?? B = 253 2630/ F65 : FD 35 11 dec (iy + YB(fmt_sector_count)) 2631/ F68 : 28 04 jr z, fmt_track_done 2632/ F6A : ED B3 otir ; write 253 bytes gap 3? 2633/ F6C : 18 88 jr .fmt_sector 2634/ F6E : 2635/ F6E : ;x0f6e: 2636/ F6E : AF fmt_track_done: xor a 2637/ F6F : D3 64 out (cntl), a ; turn off signals 2638/ F71 : DB 62 in a, (drv_status) 2639/ F73 : CB 77 bit OVERUN, a 2640/ F75 : 20 08 jr nz, fmt_track_error 2641/ F77 : 06 98 ld b, 152 ; wait a bit (for what?) 2642/ F79 : 10 FE .loop: djnz .loop 2643/ F7B : AF xor a ; indicate success 2644/ F7C : DD E1 pop ix ; restore the DriveData pointer 2645/ F7E : C9 ret 2646/ F7F : 2647/ F7F : ;x0f7f: 2648/ F7F : fmt_track_error: 2649/ F7F : AF xor a 2650/ F80 : D3 64 out (cntl), a ; turn off enable signals 2651/ F82 : DD E1 pop ix ; restore the DriveData pointer 2652/ F84 : F6 01 or 1 ; indicate failure 2653/ F86 : C9 ret 2654/ F87 : 2655/ F87 : ; get_log_sector_ptr - lookup the logical sector number for this physical sector number 2656/ F87 : ; 2657/ F87 : ; on exit: 2658/ F87 : ; DE = address of the logical sector number 2659/ F87 : 2660/ F87 : ;x0f87: 2661/ F87 : get_log_sector_ptr: 2662/ F87 : 11 4D 60 ld de, sector_table 2663/ F8A : 3A 10 60 ld a, (format_phys_sector) 2664/ F8D : 83 add a, e 2665/ F8E : 5F ld e, a 2666/ F8F : C9 ret 2667/ F90 : 2668/ F90 : ; 29 two byte entries correspond to the sector interleave in format_track 2669/ F90 : ; 2nd byte of entry loaded into fmt_data_2, 1st byte into fmt_data_1 2670/ F90 : 2671/ F90 : format_data_tbl: 2672/ F90 : 1C 18 db 28, 24 ; 1 2673/ F92 : 1C 18 db 28, 24 ; 2 2674/ F94 : 1C 18 db 28, 24 ; 3 2675/ F96 : 1D 1A db 29, 26 ; 4 2676/ F98 : 1A 18 db 26, 24 ; 5 2677/ F9A : 19 1A db 25, 26 ; 6 2678/ F9C : 00 00 db 0, 0 ; 7 2679/ F9E : 1D 1D db 29, 29 ; 8 2680/ FA0 : 1C 1C db 28, 28 ; 9 2681/ FA2 : 15 15 db 21, 21 ; 10 2682/ FA4 : 00 00 db 0, 0 ; 11 2683/ FA6 : 19 19 db 25, 25 ; 12 2684/ FA8 : 00 00 db 0, 0 ; 13 2685/ FAA : 1D 1D db 29, 29 ; 14 2686/ FAC : 10 10 db 16, 16 ; 15 2687/ FAE : 1D 1D db 29, 29 ; 16 2688/ FB0 : 00 00 db 0, 0 ; 17 2689/ FB2 : 19 19 db 25, 25 ; 18 2690/ FB4 : 00 00 db 0, 0 ; 19 2691/ FB6 : 15 15 db 21, 21 ; 20 2692/ FB8 : 1C 1C db 28, 28 ; 21 2693/ FBA : 1D 1D db 29, 29 ; 22 2694/ FBC : 00 00 db 0, 0 ; 23 2695/ FBE : 19 19 db 25, 25 ; 24 2696/ FC0 : 1A 1A db 26, 26 ; 25 2697/ FC2 : 1D 1D db 29, 29 ; 26 2698/ FC4 : 1C 1C db 28, 28 ; 27 2699/ FC6 : 1D 1D db 29, 29 ; 28 2700/ FC8 : 00 00 db 0, 0 ; 29 2701/ FCA : 2702/ FCA : ; init_hp_format_sector_buffer - setup the sector buffer with the HP format bytes 2703/ FCA : 2704/ FCA : init_hp_format_sector_buffer: 2705/ FCA : 21 6B 60 ld hl, format_sector_buffer 2706/ FCD : AF xor a 2707/ FCE : 06 04 ld b, 4 2708/ FD0 : CD F5 0F call fill_buffer_with_a ; 4 bytes of 00h (ID field clock sync) 2709/ FD3 : 3D dec a 2710/ FD4 : 06 04 ld b, 4 2711/ FD6 : CD F5 0F call fill_buffer_with_a ; 4 bytes of ffh (ID field clock sync) 2712/ FD9 : 73 ld (hl), e ; ID AM 2713/ FDA : 23 inc hl 2714/ FDB : AF xor a 2715/ FDC : 06 19 ld b, 25 2716/ FDE : CD F5 0F call fill_buffer_with_a ; 25 bytes of 00h (..., Gap 1, data field clock sync) 2717/ FE1 : 3D dec a 2718/ FE2 : 06 04 ld b, 4 2719/ FE4 : CD F5 0F call fill_buffer_with_a ; 4 bytes of ffh (data field clock sync) 2720/ FE7 : 36 50 ld (hl), HP_DATA_AM_DPAT 2721/ FE9 : 23 inc hl 2722/ FEA : 7A ld a, d 2723/ FEB : CD F5 0F call fill_buffer_with_a ; 256 bytes of fill byte (B was zero) 2724/ FEE : AF xor a 2725/ FEF : 06 25 ld b, 37 2726/ FF1 : CD F5 0F call fill_buffer_with_a ; 37 bytes of 00h (CRC, 00, Gap 2) 2727/ FF4 : C9 ret 2728/ FF5 : 2729/ FF5 : ; fill_buffer_with_a - fills a buffer with the byte in A 2730/ FF5 : ; 2731/ FF5 : ; on entry: 2732/ FF5 : ; A: the fill byte 2733/ FF5 : ; B: the number of fill bytes 2734/ FF5 : ; HL: the buffer pointer 2735/ FF5 : 2736/ FF5 : fill_buffer_with_a: 2737/ FF5 : 77 ld (hl), a 2738/ FF6 : 23 inc hl 2739/ FF7 : 10 FC djnz fill_buffer_with_a 2740/ FF9 : C9 ret 2741/ FFA : 2742/ FFA : ; init_sector_table - fill the table of the logical sector numbers at the 2743/ FFA : ; specified interleave 2744/ FFA : ; 2745/ FFA : ; on entry 2746/ FFA : ; B: interleave 2747/ FFA : 2748/ FFA : init_sector_table: 2749/ FFA : 21 4D 60 ld hl, sector_table 2750/ FFD : E5 push hl 2751/ FFE : FD 70 12 ld (iy + YB(format_flags)), b ; format_flags temporarily is interleave 2752/ 1001 : 06 1E ld b, HP_SECTORS_PER_TRACK 2753/ 1003 : 3E FF ld a, 0ffh ; sector number not yet set 2754/ 1005 : CD F5 0F call fill_buffer_with_a ; 30 bytes of 0ffh, B = 0 after 2755/ 1008 : E1 pop hl 2756/ 1009 : 0E 1E ld c, HP_SECTORS_PER_TRACK ; C: sectors per track 2757/ 100B : FD CB 09 46 bit FORMAT_IBM, (iy + YB(disc_format)) 2758/ 100F : 28 03 jr z, .skiphp 2759/ 1011 : 04 inc b ; B: first sector number 2760/ 1012 : 0E 1A ld c, IBM_SECTORS_PER_TRACK 2761/ 1014 : .skiphp: 2762/ 1014 : 11 00 00 ld de, 0 ; E: current physical sector 2763/ 1017 : 70 ld (hl), b ; first sector of the track 2764/ 1018 : 04 inc b 2765/ 1019 : E5 .loop: push hl 2766/ 101A : 7B ld a, e 2767/ 101B : FD 86 12 add a, (iy + YB(format_flags)) ; E += interleave 2768/ 101E : .chkwrap: 2769/ 101E : B9 cp c 2770/ 101F : 38 01 jr c, .nowrap 2771/ 1021 : 91 sub c ; E -= sectors_per_track 2772/ 1022 : .nowrap: 2773/ 1022 : 5F ld e, a 2774/ 1023 : 19 add hl, de ; address of this sector in the table 2775/ 1024 : 7E ld a, (hl) 2776/ 1025 : FE FF cp 0ffh 2777/ 1027 : 28 06 jr z, .claim ; not yet assigned a sector number 2778/ 1029 : 1C inc e ; bump to an unclaimed phys sector 2779/ 102A : E1 pop hl 2780/ 102B : E5 push hl 2781/ 102C : 7B ld a, e 2782/ 102D : 18 EF jr .chkwrap 2783/ 102F : 2784/ 102F : 70 .claim: ld (hl), b ; set this logical sector number in table 2785/ 1030 : 04 inc b 2786/ 1031 : 78 ld a, b 2787/ 1032 : B9 cp c ; finished? 2788/ 1033 : E1 pop hl 2789/ 1034 : 20 E3 jr nz, .loop ; no 2790/ 1036 : FD CB 09 46 bit FORMAT_IBM, (iy + YB(disc_format)) 2791/ 103A : C8 ret z ; HP format 2792/ 103B : FE 1B cp IBM_SECTORS_PER_TRACK + 1 2793/ 103D : C8 ret z 2794/ 103E : 0C inc c ; one more time! Index AM?? 2795/ 103F : 18 D8 jr .loop 2796/ 1041 : 2797/ 1041 : ; format IBM track 2798/ 1041 : ; B: interleave 2799/ 1041 : ; C: ? 2800/ 1041 : ; D: format data byte 2801/ 1041 : ; E: ? 2802/ 1041 : fmt_ibm_track: 2803/ 1041 : AF xor a 2804/ 1042 : 32 10 60 ld (format_phys_sector), a 2805/ 1045 : FD CB 12 7E bit FF_DATA_INIT, (iy + YB(format_flags)) 2806/ 1049 : 20 0E jr nz, .skipsetup 2807/ 104B : C5 push bc 2808/ 104C : D5 push de 2809/ 104D : CD FA 0F call init_sector_table 2810/ 1050 : D1 pop de 2811/ 1051 : CD 35 11 call fill_ibm_sector_buffer 2812/ 1054 : FD CB 12 FE set FF_DATA_INIT, (iy + YB(format_flags)) 2813/ 1058 : C1 pop bc 2814/ 1059 : .skipsetup: 2815/ 1059 : 3E 1A ld a, IBM_SECTORS_PER_TRACK 2816/ 105B : 32 11 60 ld (fmt_sector_count), a 2817/ 105E : 41 ld b, c 2818/ 105F : C5 push bc 2819/ 1060 : 06 2E x1060: ld b, 2eh ; 46 2820/ 1062 : 0E 60 ld c, data 2821/ 1064 : CD 87 0F call get_log_sector_ptr ; DE = logical sector number pointer 2822/ 1067 : 21 6B 60 ld hl, format_sector_buffer 2823/ 106A : F1 pop af ; AF = BC? 2824/ 106B : DD E5 push ix 2825/ 106D : DD 21 6B 60 ld ix, format_sector_buffer 2826/ 1071 : DD 77 00 ld (ix + 0), a 2827/ 1074 : FE FF cp 0ffh 2828/ 1076 : 20 06 jr nz, .x107e 2829/ 1078 : DD 77 01 ld (ix + 1), a 2830/ 107B : DD 77 03 ld (ix + 3), a 2831/ 107E : 3E FF .x107e: ld a, 0ffh 2832/ 1080 : D3 61 out (clock), a 2833/ 1082 : .waitidx: 2834/ 1082 : DB 62 in a, (drv_status) ; wait for the index hole asserted 2835/ 1084 : CB 67 bit READY, a 2836/ 1086 : CA 7F 0F jp z, fmt_track_error 2837/ 1089 : CB 47 bit INDEX, a 2838/ 108B : 20 F5 jr nz, .waitidx 2839/ 108D : 2840/ 108D : DB 62 .waitd: in a, (drv_status) ; wait for index hole deasserted 2841/ 108F : CB 67 bit READY, a 2842/ 1091 : CA 7F 0F jp z, fmt_track_error 2843/ 1094 : CB 47 bit INDEX, a 2844/ 1096 : 28 F5 jr z, .waitd 2845/ 1098 : 2846/ 1098 : 3E 02 ld a, r_OVERUN_m 2847/ 109A : D3 62 out (reset), a 2848/ 109C : 3E 0C ld a, WRITDRV_m | WRITON_m 2849/ 109E : D3 64 out (cntl), a 2850/ 10A0 : ED B3 otir 2851/ 10A2 : 3E D7 ld a, IBM_INDEX_AM_CLK 2852/ 10A4 : D3 61 out (clock), a 2853/ 10A6 : ED A3 outi 2854/ 10A8 : 3E FF ld a, 0ffh 2855/ 10AA : D3 61 out (clock), a 2856/ 10AC : 06 1A ld b, 26 ; gap 0 2857/ 10AE : ED B3 otir 2858/ 10B0 : 06 06 x10b0: ld b, 6 ; 6 zero bytes clock sync 2859/ 10B2 : ED A3 outi 2860/ 10B4 : DD 7E 00 ld a, (ix + 0) 2861/ 10B7 : FE FF cp 0ffh 2862/ 10B9 : 28 01 jr z, x10bc ; deleted track? 2863/ 10BB : 1A ld a, (de) 2864/ 10BC : DD 77 02 x10bc: ld (ix + 2), a 2865/ 10BF : ED B3 otir 2866/ 10C1 : 3E 2C ld a, READON_m | WRITDRV_m | WRITON_m 2867/ 10C3 : D3 64 out (cntl), a 2868/ 10C5 : 3E C7 ld a, IBM_AM_CLK 2869/ 10C7 : D3 61 out (clock), a 2870/ 10C9 : ED A3 outi 2871/ 10CB : 3E FF ld a, 0ffh 2872/ 10CD : D3 61 out (clock), a 2873/ 10CF : 06 04 ld b, 4 2874/ 10D1 : ED B3 otir 2875/ 10D3 : 3E 3C ld a, READON_m | CRCOUT_m | WRITDRV_m | WRITON_m 2876/ 10D5 : D3 64 out (cntl), a 2877/ 10D7 : ED A3 outi ; write id field CRC byte 1 2878/ 10D9 : ED A3 outi ; write id field CRC byte 2 2879/ 10DB : 3E 0C ld a, WRITDRV_m | WRITON_m 2880/ 10DD : D3 64 out (cntl), a 2881/ 10DF : 06 11 ld b, 17 ; gap 1 + 6 zero bytes clock sync 2882/ 10E1 : ED B3 otir 2883/ 10E3 : 3E 2C ld a, READON_m | WRITDRV_m | WRITON_m 2884/ 10E5 : D3 64 out (cntl), a 2885/ 10E7 : 3E C7 ld a, IBM_AM_CLK 2886/ 10E9 : D3 61 out (clock), a 2887/ 10EB : ED A3 outi 2888/ 10ED : 3E FF ld a, 0ffh 2889/ 10EF : D3 61 out (clock), a 2890/ 10F1 : 06 80 ld b, 128 ; sector fill bytes 2891/ 10F3 : ED B3 otir 2892/ 10F5 : 3E 2E ld a, READON_M | CRCON_m | WRITDRV_m | WRITON_m 2893/ 10F7 : D3 64 out (cntl), a 2894/ 10F9 : ED A3 outi ; write data field CRC byte 1 2895/ 10FB : ED A3 outi ; write data field CRC byte 2 2896/ 10FD : 3E 0C ld a, WRITDRV_m | WRITON_m 2897/ 10FF : D3 64 out (cntl), a 2898/ 1101 : 06 1A ld b, 26 ; gap 2 2899/ 1103 : ED A3 outi 2900/ 1105 : 3A 10 60 ld a, (format_phys_sector) 2901/ 1108 : 3C inc a 2902/ 1109 : 11 4D 60 ld de, data_buffer_count 2903/ 110C : ED A3 outi 2904/ 110E : FE 1A cp 1ah 2905/ 1110 : 38 01 jr c, x1113 2906/ 1112 : AF xor a 2907/ 1113 : 32 10 60 x1113: ld (format_phys_sector), a 2908/ 1116 : 83 add a, e 2909/ 1117 : 5F ld e, a 2910/ 1118 : ED B3 otir 2911/ 111A : 21 B4 60 ld hl, x60b4 2912/ 111D : FD 35 11 dec (iy + YB(fmt_sector_count)) 2913/ 1120 : 20 8E jr nz, x10b0 ; format next sector 2914/ 1122 : 05 dec b 2915/ 1123 : ED 41 x1123: out (c), b 2916/ 1125 : DB 62 in a, (drv_status) 2917/ 1127 : CB 67 bit 4, a 2918/ 1129 : CA 7F 0F jp z, fmt_track_error 2919/ 112C : CB 47 bit 0, a 2920/ 112E : 28 F3 jr z, x1123 2921/ 1130 : ED 41 out (c), b 2922/ 1132 : C3 6E 0F jp fmt_track_done 2923/ 1135 : 2924/ 1135 : fill_ibm_sector_buffer: 2925/ 1135 : 21 6B 60 ld hl, format_sector_buffer 2926/ 1138 : 3E FF ld a, IBM_GAP_DPAT 2927/ 113A : 06 28 ld b, 40 2928/ 113C : CD F5 0F call fill_buffer_with_a ; last 40 bytes of gap 3 bytes 2929/ 113F : AF xor a 2930/ 1140 : 06 06 ld b, 6 2931/ 1142 : CD F5 0F call fill_buffer_with_a ; 6 bytes of 00h sync bytes 2932/ 1145 : 36 FC ld (hl), IBM_INDEX_AM_DPAT 2933/ 1147 : 23 inc hl 2934/ 1148 : 3D dec a 2935/ 1149 : 06 1A ld b, 26 2936/ 114B : CD F5 0F call fill_buffer_with_a ; 26 bytes of 0ffh gap 0 2937/ 114E : AF xor a 2938/ 114F : 06 06 ld b, 6 2939/ 1151 : CD F5 0F call fill_buffer_with_a ; 6 bytes of 00h sync bytes 2940/ 1154 : 36 FE ld (hl), IBM_ID_AM_DPAT ; id field ID AM 2941/ 1156 : 23 inc hl 2942/ 1157 : 06 06 ld b, 6 2943/ 1159 : CD F5 0F call fill_buffer_with_a ; 6 bytes to be filled in later 2944/ 115C : 3D dec a 2945/ 115D : 06 0B ld b, 11 2946/ 115F : CD F5 0F call fill_buffer_with_a ; 11 bytes of 0ffh gap 1 2947/ 1162 : AF xor a 2948/ 1163 : 06 06 ld b, 6 2949/ 1165 : CD F5 0F call fill_buffer_with_a ; 6 bytes of 00h sync bytes 2950/ 1168 : 36 FB ld (hl), IBM_DATA_AM_DPAT ; data field AM 2951/ 116A : 23 inc hl 2952/ 116B : 7A ld a, d 2953/ 116C : 06 80 ld b, 128 2954/ 116E : CD F5 0F call fill_buffer_with_a ; 128 bytes of sector data 2955/ 1171 : AF xor a 2956/ 1172 : 06 02 ld b, 2 2957/ 1174 : CD F5 0F call fill_buffer_with_a ; space for CRC bytes 2958/ 1177 : 3D dec a 2959/ 1178 : 06 1A ld b, 26 2960/ 117A : CD F5 0F call fill_buffer_with_a ; 26 bytes of 0ffh gap 2 2961/ 117D : C9 ret 2962/ 117E : 2963/ 117E : 76 halt 2964/ 117F : 76 halt 2965/ 1180 : 2966/ 1180 : 2967/ 1180 : ; Drive has D and DL jumpers closed: 2968/ 1180 : ; In Use = active + Drive Select activated latches door lock on 2969/ 1180 : ; In Use = inactive + Drive Select activated unlatches door lock 2970/ 1180 : 2971/ 1180 : cmd_door_lock: 2972/ 1180 : CD BE 02 call check_for_holdoff 2973/ 1183 : CD D8 02 call check_unit_ready 2974/ 1186 : CD B7 15 call load_head_ix 2975/ 1189 : DD 7E 09 ld a, (ix + DriveData.xv) ; remove this drive from the head_unload_set 2976/ 118C : 2F cpl ; form mask 2977/ 118D : FD A6 06 and (iy + YB(head_unload_set)) 2978/ 1190 : 32 06 60 ld (head_unload_set), a 2979/ 1193 : DD CB 04 EE set DOOR_LOCK, (ix + DriveData.drv) 2980/ 1197 : 18 10 jr door_lock_coda 2981/ 1199 : 2982/ 1199 : cmd_door_unlock: 2983/ 1199 : CD BE 02 call check_for_holdoff 2984/ 119C : CD D8 02 call check_unit_ready 2985/ 119F : DD CB 04 AE res DOOR_LOCK, (ix + DriveData.drv) 2986/ 11A3 : FD 46 03 ld b, (iy + YB(current_unit)) 2987/ 11A6 : CD D8 15 call maybe_unload_head 2988/ 11A9 : door_lock_coda: 2989/ 11A9 : CD B1 14 call normal_and_deselect_drives 2990/ 11AC : C9 ret 2991/ 11AD : 2992/ 11AD : 2993/ 11AD : ; return 2 bytes cylinder, 1 byte head, 1 byte sector 2994/ 11AD : cmd_request_logical_address: 2995/ 11AD : 3A 03 60 ld a, (current_unit) 2996/ 11B0 : CD 1A 15 call prep_drive_regs 2997/ 11B3 : DD 46 02 ld b, (ix + DriveData.target_cyl_hd) ; B = second byte 2998/ 11B6 : CB 78 bit HEAD1, b ; sets Z (head) appropriately for later 2999/ 11B8 : CB B8 res HEAD1, b ; clear the head from the rest of the cylinder 3000/ 11BA : DD 56 03 ld d, (ix + DriveData.sector) ; D = fourth byte 3001/ 11BD : 18 0F jr cmd_request_address_common 3002/ 11BF : 3003/ 11BF : ; return 2 bytes cylinder, 1 byte head, 1 byte zeros 3004/ 11BF : cmd_request_physical_address: 3005/ 11BF : 3A 03 60 ld a, (current_unit) 3006/ 11C2 : CD 1A 15 call prep_drive_regs 3007/ 11C5 : DD 46 00 ld b, (ix + DriveData.physical_cylinder) 3008/ 11C8 : 16 00 ld d, 0 ; D = fourth byte 3009/ 11CA : DD CB 04 7E bit HEAD1, (ix + DriveData.drv) 3010/ 11CE : 3011/ 11CE : cmd_request_address_common: 3012/ 11CE : 1E 00 ld e, 0 ; E = third byte 3013/ 11D0 : 28 01 jr z, .skip ; head 0 3014/ 11D2 : 1C inc e ; head 1 3015/ 11D3 : 0E 00 .skip: ld c, 0 ; C = first byte (cylinder msb - always zero) 3016/ 11D5 : CD BE 02 call check_for_holdoff 3017/ 11D8 : C3 6D 00 jp send_status_or_address_jv 3018/ 11DB : 3019/ 11DB : 3020/ 11DB : ; send the contents of the data buffer (256 bytes max) 3021/ 11DB : ; Note: the controller can terminate this early by UNT or a SAD is sent 3022/ 11DB : read_loopback: 3023/ 11DB : 3E FF ld a, 0ffh ; 255 bytes + 1 final byte with EOI 3024/ 11DD : read_loopback_talk: 3025/ 11DD : 21 4D 60 ld hl, data_buffer_count 3026/ 11E0 : 06 03 ld b, FLUSH_FIFO_m | SEND_EOI_m 3027/ 11E2 : CD F8 12 call do_talk_transfer 3028/ 11E5 : AF xor a 3029/ 11E6 : 32 01 60 ld (S1), a ; S1_NORMAL 3030/ 11E9 : C9 ret 3031/ 11EA : 3032/ 11EA : ; place up to 256 bytes into the data buffer 3033/ 11EA : ; Must mark last byte with EOI set if less than 256 bytes is sent. 3034/ 11EA : write_loopback: 3035/ 11EA : 21 4D 60 ld hl, data_buffer_count 3036/ 11ED : AF xor a ; A = 0 -> up to 256 bytes 3037/ 11EE : CD 44 13 call do_listen_transfer 3038/ 11F1 : C9 ret 3039/ 11F2 : 3040/ 11F2 : ; download up to 256 bytes at data_buffer 3041/ 11F2 : ; jumps to download_code_entry but only if the download was terminated with EOI 3042/ 11F2 : download: 3043/ 11F2 : CD EA 11 call write_loopback 3044/ 11F5 : 3A 0A 60 ld a, (listen_transfer_final_d0d1) 3045/ 11F8 : FE C0 cp IN_EOI ; terminated with EOI marker? 3046/ 11FA : C2 73 14 jp nz, abort_IO_program_error ; No 3047/ 11FD : 21 50 60 ld hl, download_code_entry 3048/ 1200 : EB ex de, hl 3049/ 1201 : CD 4D 12 call prep_for_next_cmd ; reset SP to ramend 3050/ 1204 : EB ex de, hl 3051/ 1205 : E9 jp (hl) ; execute the downloaded code 3052/ 1206 : ; what happens if it returns to the caller? 3053/ 1206 : 3054/ 1206 : initiate_self_test: 3055/ 1206 : 21 4D 60 ld hl, data_buffer_count 3056/ 1209 : AF xor a 3057/ 120A : CD 44 13 call do_listen_transfer 3058/ 120D : 3A 4D 60 ld a, (data_buffer_count) 3059/ 1210 : FE 01 cp 1 3060/ 1212 : FD 56 4E ld d, (iy + YB(data_buffer)) ; data_buffer (cylinder) 3061/ 1215 : 1E 00 ld e, 0 ; default W to 0 3062/ 1217 : 28 03 jr z, .skip ; only received one byte 3063/ 1219 : FD 5E 4F ld e, (iy + YB(data_buffer+1)) ; data_buffer+1 (W - seems to be bit 3 of second byte) 3064/ 121C : 7A .skip: ld a, d 3065/ 121D : FE 4D cp PHYSICAL_TRACKS 3066/ 121F : D2 90 14 jp nc, abort_seek_check ; cylinder in range? 3067/ 1222 : C3 22 17 jp do_initiate_self_test ; yes 3068/ 1225 : 3069/ 1225 : 3070/ 1225 : read_self_test: 3071/ 1225 : 2A 07 60 ld hl, (leds_shdw) 3072/ 1228 : 7C ld a, h 3073/ 1229 : 65 ld h, l 3074/ 122A : 6F ld l, a 3075/ 122B : 22 4E 60 ld (data_buffer), hl 3076/ 122E : 3E 01 ld a, 1 3077/ 1230 : 18 AB jr read_loopback_talk 3078/ 1232 : 3079/ 1232 : 3080/ 1232 : (MACRO) fillto 01240h, 076h 3080/ 1232 : 76 76 76 76 76 76 db (01240H-$) dup (076H) 1238 : 76 76 76 76 76 76 123E : 76 76 3081/ 1240 : 3082/ 1240 : 3083/ 1240 : ;****************************************************************** 3084/ 1240 : ; delay - delays for (B) ms 3085/ 1240 : ; 3086/ 1240 : ; on entry: 3087/ 1240 : ; B: the number of milliseconds to delay 3088/ 1240 : 3089/ 1240 : C5 delay: push bc 3090/ 1241 : 06 00 ld b, 0 3091/ 1243 : 10 FE .loop1: djnz .loop1 3092/ 1245 : 06 28 ld b, 28h 3093/ 1247 : 10 FE .loop2: djnz .loop2 3094/ 1249 : C1 pop bc 3095/ 124A : 10 F4 djnz delay 3096/ 124C : C9 ret 3097/ 124D : 3098/ 124D : 3099/ 124D : ;****************************************************************** 3100/ 124D : ; prep_for_next_cmd - reset the execution state 3101/ 124D : ; 3102/ 124D : ; On exit: 3103/ 124D : ; SP = ramend 3104/ 124D : ; IY = ramstart 3105/ 124D : ; IX = &drive_data_table[0] 3106/ 124D : ; state_flags reset 3107/ 124D : 3108/ 124D : prep_for_next_cmd: 3109/ 124D : E1 pop hl ; save the return address 3110/ 124E : AF xor a 3111/ 124F : 32 05 60 ld (state_flags), a ; clear the state_flags 3112/ 1252 : 31 FF 63 ld sp, ramend 3113/ 1255 : FD 21 19 60 ld iy, in_use_leds_stack 3114/ 1259 : FD 22 17 60 ld (in_use_leds_stack_ptr), iy 3115/ 125D : FD 21 00 60 ld iy, ramstart 3116/ 1261 : DD 21 1E 60 ld ix, drive_data_table 3117/ 1265 : E9 jp (hl) ; jump to the return address 3118/ 1266 : 3119/ 1266 : 3120/ 1266 : set_parity_check_state: 3121/ 1266 : DB 11 in a, (phi_int_mask) 3122/ 1268 : 47 ld b, a 3123/ 1269 : 3A 0C 60 ld a, (parity_check_state) 3124/ 126C : D3 13 out (phi_status), a 3125/ 126E : 78 ld a, b 3126/ 126F : D3 11 out (phi_int_mask), a 3127/ 1271 : C9 ret 3128/ 1272 : 3129/ 1272 : 3130/ 1272 : DB 14 do_PPD: in a, (phi_control) 3131/ 1274 : E6 FC and ~RSPD_PP 3132/ 1276 : 18 0A jr write_phi_control 3133/ 1278 : 3134/ 1278 : DB 14 do_PPE: in a, (phi_control) 3135/ 127A : F6 03 or RSPD_PP 3136/ 127C : 18 04 jr write_phi_control 3137/ 127E : 3138/ 127E : flush_out_fifo: 3139/ 127E : DB 14 in a, (phi_control) 3140/ 1280 : F6 00 or INIT_FIFO 3141/ 1282 : 3142/ 1282 : write_phi_control: 3143/ 1282 : D3 14 out (phi_control), a 3144/ 1284 : C9 ret 3145/ 1285 : 3146/ 1285 : 3147/ 1285 : ; poll_input_or_DCL - check if a byte has been received or a device clear happened 3148/ 1285 : ; 3149/ 1285 : ; on exit: 3150/ 1285 : ; NZ: a byte is available to read 3151/ 1285 : 3152/ 1285 : ; does the PHI clear the inbound fifo bytes if DCL received? No 3153/ 1285 : poll_input_or_DCL: 3154/ 1285 : DB 10 in a, (phi_int_cond) 3155/ 1287 : CB 57 bit FIFO_BYTE, a 3156/ 1289 : C0 ret nz ; return if inbound fifo bytes are available 3157/ 128A : CB 47 bit DEV_CLR, a 3158/ 128C : C4 0B 00 call nz, check_for_command_byte_jv 3159/ 128F : C9 ret 3160/ 1290 : 3161/ 1290 : check_for_parity_error: 3162/ 1290 : DB 10 in a, (phi_int_cond) ; get D0D1 bits associated with phi_int_cond 3163/ 1292 : DB 13 in a, (phi_status) 3164/ 1294 : CB 77 bit PRTY_ERR, a 3165/ 1296 : C8 ret z ; no 3166/ 1297 : 06 40 ld b, 40h ; ? never used by callers 3167/ 1299 : D3 13 out (phi_status), a ; D0D1=01 (clear parity error) 3168/ 129B : AF xor a 3169/ 129C : D3 10 out (phi_int_cond), a 3170/ 129E : FD 36 00 03 ld (iy + YB(DSJ)), DSJ_Parity_error 3171/ 12A2 : C9 ret 3172/ 12A3 : 3173/ 12A3 : ; B = the expected SAD (bit 5: TALK) 3174/ 12A3 : wait_for_HPIB_SAD: 3175/ 12A3 : C5 push bc 3176/ 12A4 : 3E 06 ld a, IU_RECV 3177/ 12A6 : CD 28 00 call show_in_use_leds_jv 3178/ 12A9 : CD 78 12 call do_PPE 3179/ 12AC : 01 00 00 ld bc, 0 ; waits for 41 * 65536 iterations 3180/ 12AF : 16 29 ld d, 41 3181/ 12B1 : CD 85 12 .again: call poll_input_or_DCL 3182/ 12B4 : 20 0B jr nz, .gotone ; got a byte in the inbound FIFO 3183/ 12B6 : 10 F9 djnz .again 3184/ 12B8 : 0D dec c 3185/ 12B9 : 20 F6 jr nz, .again 3186/ 12BB : 15 dec d 3187/ 12BC : 20 F3 jr nz, .again 3188/ 12BE : C3 73 14 jp abort_IO_program_error ; timedout without having received the SAD 3189/ 12C1 : 3190/ 12C1 : .gotone: 3191/ 12C1 : CD 72 12 call do_PPD 3192/ 12C4 : DB 12 in a, (phi_fifo) 3193/ 12C6 : 4F ld c, a 3194/ 12C7 : DB 13 in a, (phi_status) ; check D0D1 bits 3195/ 12C9 : CB 77 bit 6, a ; secondary address received? 3196/ 12CB : CA 73 14 jp z, abort_IO_program_error ; no 3197/ 12CE : CD 90 12 call check_for_parity_error 3198/ 12D1 : 79 ld a, c 3199/ 12D2 : C1 pop bc 3200/ 12D3 : B8 cp b ; does it match the expected secondary? 3201/ 12D4 : C2 73 14 jp nz, abort_IO_program_error 3202/ 12D7 : C3 EB 14 jp show_previous_in_use_leds ; returns to caller? 3203/ 12DA : 3204/ 12DA : ; A = byte, B = D0D1 bits 3205/ 12DA : send_out_byte: 3206/ 12DA : F5 push af 3207/ 12DB : 3E 01 ld a, DATA_FRZ_m 3208/ 12DD : D3 13 out (phi_status), a 3209/ 12DF : CD 85 12 call poll_input_or_DCL 3210/ 12E2 : C2 67 14 jp nz, listen_terminate 3211/ 12E5 : 78 ld a, b 3212/ 12E6 : D3 13 out (phi_status), a ; set D0D1 bits from caller 3213/ 12E8 : F1 pop af 3214/ 12E9 : D3 12 out (phi_fifo), a ; send the byte 3215/ 12EB : C9 ret 3216/ 12EC : 3217/ 12EC : terminate_talk: 3218/ 12EC : 3E 01 ld a, 1 ; dummy byte 3219/ 12EE : 06 07 ld b, OUT_END 3220/ 12F0 : F5 push af 3221/ 12F1 : CD 7E 12 call flush_out_fifo 3222/ 12F4 : F1 pop af 3223/ 12F5 : C3 DA 12 jp send_out_byte 3224/ 12F8 : 3225/ 12F8 : ;================= START HERE ======================== 3226/ 12F8 : ; A = number of bytes, B = bit 1: flush out fifo, bit 0: EOI 3227/ 12F8 : ; HL = address of cmd_count (can this potentially be anywhere??) 3228/ 12F8 : ; HL+1 = address of the transfer buffer 3229/ 12F8 : do_talk_transfer: 3230/ 12F8 : 77 ld (hl), a 3231/ 12F9 : 3E 04 ld a, IU_SEND 3232/ 12FB : CD 28 00 call show_in_use_leds_jv 3233/ 12FE : C5 push bc ; save the flags for later 3234/ 12FF : CB 48 bit FLUSH_FIFO, b 3235/ 1301 : C4 7E 12 call nz, flush_out_fifo 3236/ 1304 : 3E 00 ld a, DATA_FRZ 3237/ 1306 : D3 13 out (phi_status), a ; unfreeze the outbound fifo 3238/ 1308 : DB 10 in a, (phi_int_cond) 3239/ 130A : CB 57 bit FIFO_BYTE, a 3240/ 130C : 20 21 jr nz, talkdone2 ; the inbound fifo has bytes 3241/ 130E : FD CB 05 E6 set TALK_ACT, (iy + YB(state_flags)) 3242/ 1312 : CD AC 13 call enable_proc_abrt_int 3243/ 1315 : AF xor a ; D0D1 = 00 (normal bytes) 3244/ 1316 : D3 13 out (phi_status), a 3245/ 1318 : 46 ld b, (hl) ; B = transfer count 3246/ 1319 : 23 inc hl ; the buffer follows the transfer count 3247/ 131A : .dotalk: 3248/ 131A : 0E 12 ld c, phi_fifo ; phi_fifo port number 3249/ 131C : ED B3 otir ; send the data 3250/ 131E : C1 pop bc ; get the flags back 3251/ 131F : CB 40 bit SEND_EOI, b 3252/ 1321 : 28 0B jr z, .talkdone ; don't send final EOI marked byte 3253/ 1323 : 06 00 ld b, 0 ; clear the flags so we don't infinite loop! 3254/ 1325 : C5 push bc 3255/ 1326 : 06 01 ld b, 1 ; transfer the final (dummy?) byte 3256/ 1328 : 3E 80 ld a, OUT_END_m ; D0D1 = 10 (set EOI) 3257/ 132A : D3 13 out (phi_status), a 3258/ 132C : 18 EC jr .dotalk 3259/ 132E : 3260/ 132E : ;x132e: 3261/ 132E : .talkdone: 3262/ 132E : C5 push bc 3263/ 132F : talkdone2: 3264/ 132F : FD CB 05 A6 res TALK_ACT, (iy + YB(state_flags)) 3265/ 1333 : C1 pop bc 3266/ 1334 : CD A2 13 call set_phi_int_mask 3267/ 1337 : CD EB 14 call show_previous_in_use_leds 3268/ 133A : C9 ret 3269/ 133B : 3270/ 133B : talkdone3: 3271/ 133B : C1 pop bc 3272/ 133C : CD A2 13 call set_phi_int_mask 3273/ 133F : CD 0B 00 call check_for_command_byte_jv 3274/ 1342 : 18 EB jr talkdone2 3275/ 1344 : 3276/ 1344 : ; Preserves BC, DE, HL? 3277/ 1344 : do_listen_transfer: 3278/ 1344 : C5 push bc 3279/ 1345 : D5 push de 3280/ 1346 : E5 push hl 3281/ 1347 : F5 push af ; A = max byte count (0 -> 256 bytes) 3282/ 1348 : 3E 06 ld a, IU_RECV 3283/ 134A : CD 28 00 call show_in_use_leds_jv 3284/ 134D : 23 inc hl ; skip past read count? 3285/ 134E : C1 pop bc ; pops A (byte count) into B for inir 3286/ 134F : FD CB 05 EE set LISTEN_ACT, (iy + YB(state_flags)) 3287/ 1353 : restart_listen_transfer: 3288/ 1353 : CD AC 13 call enable_proc_abrt_int 3289/ 1356 : 0E 12 ld c, phi_fifo 3290/ 1358 : AF xor a ; not sure what this is for 3291/ 1359 : FB ei ; enable interrupts (PHI interrupts if transfer stops early?) 3292/ 135A : ED B2 inir ; read data from talker 3293/ 135C : 3294/ 135C : ; PHI IO Interrupt Handler 3295/ 135C : ; On entry A = phi_status register value 3296/ 135C : ; is there always an interrupt or just if it stops early? 3297/ 135C : terminate_listen_tranfer: 3298/ 135C : F3 di 3299/ 135D : FD CB 05 AE res LISTEN_ACT, (iy + YB(state_flags)) 3300/ 1361 : 4F ld c, a ; Save phi_status value 3301/ 1362 : CD 66 12 call set_parity_check_state 3302/ 1365 : D1 pop de ; pops saved HL value from do_listen_transfer 3303/ 1366 : E5 push hl 3304/ 1367 : D5 push de 3305/ 1368 : AF xor a ; clear A (clear carry flag) 3306/ 1369 : ED 52 sbc hl, de ; HL = # bytes read 3307/ 136B : 45 ld b, l 3308/ 136C : 05 dec b ; B = adjusted bytes read 3309/ 136D : E1 pop hl ; swaps pushed DE & HL, HL now data_buffer_count ptr 3310/ 136E : D1 pop de ; DE now ptr to 1 past end of read bytes? 3311/ 136F : 70 ld (hl), b ; store # bytes read 3312/ 1370 : 79 ld a, c ; Fetch saved phi_status value 3313/ 1371 : E6 C0 and IN_EOI ; Isolate saved PHI D0 and D1 bits 3314/ 1373 : 32 0A 60 ld (listen_transfer_final_d0d1), a ; Save them 3315/ 1376 : FE 40 cp SAD_D1_m 3316/ 1378 : CD A2 13 call set_phi_int_mask ; restore idle phi_int_mask? 3317/ 137B : 20 07 jr nz, .done ; no 3318/ 137D : 1B dec de ; adjust to the last byte received (a SAD byte) 3319/ 137E : 1A ld a, (de) 3320/ 137F : FE 10 cp HP300_CLEAR_SAD 3321/ 1381 : CA 13 00 jp z, HP_300_Clear_jv ; listen was terminated by receipt of HP300 clear SAD 3322/ 1384 : CD EB 14 .done: call show_previous_in_use_leds 3323/ 1387 : D1 pop de 3324/ 1388 : C1 pop bc 3325/ 1389 : C9 ret 3326/ 138A : 3327/ 138A : ; hmm - restarts the trasnfer but with the state_flag cleared?? 3328/ 138A : FD CB 05 AE x138a: res LISTEN_ACT, (iy + YB(state_flags)) 3329/ 138E : CD A2 13 call set_phi_int_mask ; restore idle phi_int_mask? 3330/ 1391 : CD 0B 00 call check_for_command_byte_jv 3331/ 1394 : 2B dec hl 3332/ 1395 : 04 inc b 3333/ 1396 : 18 BB jr restart_listen_transfer 3334/ 1398 : 3335/ 1398 : abort_listen: 3336/ 1398 : FD CB 05 AE res LISTEN_ACT, (iy + YB(state_flags)) 3337/ 139C : CD A2 13 call set_phi_int_mask 3338/ 139F : C3 73 14 jp abort_IO_program_error 3339/ 13A2 : 3340/ 13A2 : ; set_idle_phi_int_mask? 3341/ 13A2 : set_phi_int_mask: 3342/ 13A2 : 3A 0C 60 ld a, (parity_check_state) ; set PHI D0D1 for following phi_int_mask write 3343/ 13A5 : D3 13 out (phi_status), a 3344/ 13A7 : 3E 0D ld a, FIFO_ROOM_m | FIFO_BYTE_m | DEV_CLR_m 3345/ 13A9 : D3 11 out (phi_int_mask), a 3346/ 13AB : C9 ret 3347/ 13AC : 3348/ 13AC : enable_proc_abrt_int: 3349/ 13AC : 3E 40 ld a, PROC_ABRT_m 3350/ 13AE : D3 11 out (phi_int_mask), a 3351/ 13B0 : 3E 80 ld a, INT_ENAB_m 3352/ 13B2 : D3 13 out (phi_status), a 3353/ 13B4 : 3E 40 ld a, PROC_ABRT_m 3354/ 13B6 : D3 11 out (phi_int_mask), a 3355/ 13B8 : C9 ret 3356/ 13B9 : 3357/ 13B9 : ; ******************** NMI PHI INT handler 3358/ 13B9 : do_phi_int: 3359/ 13B9 : 08 ex af, af' 3360/ 13BA : D9 exx 3361/ 13BB : DB 13 in a, (phi_status) 3362/ 13BD : F5 push af ; save the D0D1 bits? 3363/ 13BE : FD CB 05 6E bit LISTEN_ACT, (iy + YB(state_flags)) 3364/ 13C2 : C2 22 14 jp nz, phi_int_listen_active 3365/ 13C5 : DB 10 in a, (phi_int_cond) 3366/ 13C7 : F5 push af ; save the interrupting condition 3367/ 13C8 : AF xor a 3368/ 13C9 : D3 13 out (phi_status), a 3369/ 13CB : 3E 0D ld a, FIFO_ROOM_m | FIFO_BYTE_m | DEV_CLR_m 3370/ 13CD : D3 11 out (phi_int_mask), a 3371/ 13CF : 01 00 00 ld bc, 0 3372/ 13D2 : 16 26 ld d, 38 3373/ 13D4 : DB 10 .loop: in a, (phi_int_cond) 3374/ 13D6 : CB 5F bit FIFO_ROOM, a 3375/ 13D8 : 20 1B jr nz, out_fifo_room_available 3376/ 13DA : CB 47 bit DEV_CLR, a 3377/ 13DC : 20 30 jr nz, listen_dev_clr 3378/ 13DE : CB 57 bit FIFO_BYTE, a 3379/ 13E0 : 20 31 jr nz, in_fifo_bytes_available 3380/ 13E2 : DB 13 in a, (phi_status) 3381/ 13E4 : CB 57 bit TLK_IDF, a 3382/ 13E6 : 28 2E jr z, phi_int_listen_terminate 3383/ 13E8 : 10 EA djnz .loop 3384/ 13EA : 0D dec c 3385/ 13EB : 20 E7 jr nz, .loop 3386/ 13ED : 15 dec d 3387/ 13EE : 20 E4 jr nz, .loop 3388/ 13F0 : 3389/ 13F0 : phi_int_abort_listen: 3390/ 13F0 : 21 98 13 ld hl, abort_listen ; timed out waiting... 3391/ 13F3 : 18 24 jr x1419 3392/ 13F5 : 3393/ 13F5 : ; not just FIFO_ROOM path? 3394/ 13F5 : out_fifo_room_available: 3395/ 13F5 : F1 pop af ; restore the interrupt condition reg? 3396/ 13F6 : D3 10 out (phi_int_cond), a 3397/ 13F8 : CD AC 13 call enable_proc_abrt_int 3398/ 13FB : F1 pop af 3399/ 13FC : 08 ex af, af' 3400/ 13FD : E3 ex (sp), hl 3401/ 13FE : 20 02 jr nz, x1402 ; pre-interrupt flags?? 3402/ 1400 : 2B dec hl ; dec interrupt return location by two 3403/ 1401 : 2B dec hl 3404/ 1402 : D9 x1402: exx 3405/ 1403 : 2B dec hl ; retry the previous byte for the transfer 3406/ 1404 : 04 inc b 3407/ 1405 : D9 exx 3408/ 1406 : 08 ex af, af' 3409/ 1407 : do_phi_int_coda: 3410/ 1407 : E3 ex (sp), hl ; set up return to (HL) 3411/ 1408 : D3 13 out (phi_status), a ; restore the interrupt status 3412/ 140A : 08 ex af, af' 3413/ 140B : D9 exx 3414/ 140C : ED 45 retn 3415/ 140E : 3416/ 140E : listen_dev_clr: 3417/ 140E : 21 3B 13 ld hl, talkdone3 3418/ 1411 : 18 06 jr x1419 3419/ 1413 : 3420/ 1413 : in_fifo_bytes_available: 3421/ 1413 : CD 72 12 call do_PPD 3422/ 1416 : phi_int_listen_terminate: 3423/ 1416 : 21 2F 13 ld hl, talkdone2 3424/ 1419 : CD 66 12 x1419: call set_parity_check_state 3425/ 141C : F1 pop af 3426/ 141D : D3 10 out (phi_int_cond), a 3427/ 141F : F1 pop af 3428/ 1420 : 18 E5 jr do_phi_int_coda 3429/ 1422 : 3430/ 1422 : phi_int_listen_active: 3431/ 1422 : F3 di 3432/ 1423 : DB 10 in a, (phi_int_cond) 3433/ 1425 : F5 push af 3434/ 1426 : AF xor a 3435/ 1427 : D3 13 out (phi_status), a 3436/ 1429 : 3E 05 ld a, FIFO_BYTE_m | DEV_CLR_m 3437/ 142B : D3 11 out (phi_int_mask), a 3438/ 142D : 01 00 00 ld bc, 0 3439/ 1430 : 16 26 ld d, 38 3440/ 1432 : DB 10 .loop: in a, (phi_int_cond) 3441/ 1434 : CB 57 bit FIFO_BYTE, a 3442/ 1436 : 20 14 jr nz, .in_fifo_bytes 3443/ 1438 : CB 47 bit DEV_CLR, a 3444/ 143A : 20 13 jr nz, .dev_clr 3445/ 143C : DB 13 in a, (phi_status) 3446/ 143E : CB 4F bit FIFO_IDLE, a 3447/ 1440 : 28 AE jr z, phi_int_abort_listen 3448/ 1442 : 10 EE djnz .loop 3449/ 1444 : 0D dec c 3450/ 1445 : 20 EB jr nz, .loop 3451/ 1447 : 15 dec d 3452/ 1448 : 20 E8 jr nz, .loop 3453/ 144A : 18 A4 jr phi_int_abort_listen 3454/ 144C : 3455/ 144C : .in_fifo_bytes: 3456/ 144C : FB ei 3457/ 144D : 18 A6 jr out_fifo_room_available 3458/ 144F : 3459/ 144F : .dev_clr: 3460/ 144F : 21 8A 13 ld hl, x138a 3461/ 1452 : C3 19 14 jp x1419 3462/ 1455 : 3463/ 1455 : ;**************** END NMI PHI INT handler 3464/ 1455 : 3465/ 1455 : receive_sector_data: 3466/ 1455 : AF xor a ; A = 0 (HP_BYTES_PER_SECTOR, max do_listen_transfer) 3467/ 1456 : FD CB 09 46 bit FORMAT_IBM, (iy + YB(disc_format)) 3468/ 145A : 28 02 jr z, .skip ; HP format 3469/ 145C : 3E 80 ld a, IBM_BYTES_PER_SECTOR 3470/ 145E : 21 4D 60 .skip: ld hl, data_buffer_count ; large I/O buffer? 3471/ 1461 : C3 44 13 jp do_listen_transfer 3472/ 1464 : 3473/ 1464 : cmd_terminate: 3474/ 1464 : CD EC 12 call terminate_talk 3475/ 1467 : listen_terminate: 3476/ 1467 : CD 4D 12 call prep_for_next_cmd 3477/ 146A : CD 4C 15 call deselect_drives 3478/ 146D : CD 78 12 call do_PPE 3479/ 1470 : C3 03 00 jp wait_for_cmd_jv 3480/ 1473 : 3481/ 1473 : abort_IO_program_error: 3482/ 1473 : CD C1 14 call check_DSJ_S1 3483/ 1476 : 20 EC jr nz, cmd_terminate 3484/ 1478 : 3E 0A ld a, 0ah ; S1 = I/O program error 3485/ 147A : 18 22 jr abort_common 3486/ 147C : 3487/ 147C : abort_illegal_opcode: 3488/ 147C : 3E 01 ld a, 1 ; S1 = illegal opcode 3489/ 147E : 18 1E jr abort_common 3490/ 1480 : 3491/ 1480 : abort_drive_fault_seek: 3492/ 1480 : DD CB 06 E6 set 4, (ix + DriveData.stat2_ds) ; E (drive fault) 3493/ 1484 : DD CB 06 FE set 7, (ix + DriveData.stat2_ds) ; A (attention seek completed) 3494/ 1488 : 18 0E jr abort_drive_attention 3495/ 148A : 3496/ 148A : abort_drive_fault: 3497/ 148A : DD CB 06 E6 set 4, (ix + DriveData.stat2_ds) ; E (drive fault) 3498/ 148E : 18 0C jr abort_stat2_error 3499/ 1490 : 3500/ 1490 : abort_seek_check: 3501/ 1490 : DD CB 06 D6 set 2, (ix + DriveData.stat2_ds) ; C (seek check) 3502/ 1494 : DD CB 06 FE set 7, (ix + DriveData.stat2_ds) ; A (attention seek completed) 3503/ 1498 : ;x1498: 3504/ 1498 : abort_drive_attention: 3505/ 1498 : 3E 1F ld a, S1_DA ; drive attention 3506/ 149A : 18 02 jr abort_common 3507/ 149C : 3508/ 149C : abort_stat2_error: 3509/ 149C : 3E 13 ld a, S1_S2E ; Stat 2 error 3510/ 149E : abort_common: 3511/ 149E : CD A3 14 call set_abort_S1 3512/ 14A1 : 18 C1 jr cmd_terminate 3513/ 14A3 : 3514/ 14A3 : 3515/ 14A3 : ; set DSJ abort if not already DSJ_holdoff or DSJ_parity_error 3516/ 14A3 : ; on entry A = S1 value 3517/ 14A3 : set_abort_S1: 3518/ 14A3 : CD B7 14 call set_S1_and_unit 3519/ 14A6 : 3A 00 60 ld a, (DSJ) 3520/ 14A9 : FE 02 cp DSJ_holdoff 3521/ 14AB : F0 ret p ; return if DSJ_holdoff or DSJ_parity_error 3522/ 14AC : FD 36 00 01 ld (iy + YB(DSJ)), DSJ_aborted 3523/ 14B0 : C9 ret 3524/ 14B1 : 3525/ 14B1 : normal_and_deselect_drives: 3526/ 14B1 : CD 4C 15 call deselect_drives ; A == 0 at return from deselect_drives 3527/ 14B4 : 32 00 60 ld (DSJ), a ; DSJ_normal 3528/ 14B7 : 3529/ 14B7 : ; on entry A = S1 value 3530/ 14B7 : set_S1_and_unit: 3531/ 14B7 : 32 01 60 ld (S1), a 3532/ 14BA : 3A 03 60 ld a, (current_unit) 3533/ 14BD : 32 02 60 ld (S1_unit), a 3534/ 14C0 : C9 ret 3535/ 14C1 : 3536/ 14C1 : check_DSJ_S1: 3537/ 14C1 : 3A 00 60 ld a, (DSJ) 3538/ 14C4 : B7 or a ; DSJ_normal? 3539/ 14C5 : C8 ret z ; yes normal completion 3540/ 14C6 : FE 03 cp DSJ_parity_error 3541/ 14C8 : C0 ret nz ; DSJ_aborted or DSJ_holdoff 3542/ 14C9 : 3A 01 60 ld a, (S1) 3543/ 14CC : B7 or a 3544/ 14CD : C8 ret z ; normal 3545/ 14CE : FE 1F cp S1_DA 3546/ 14D0 : C0 ret nz ; no, other 3547/ 14D1 : DD 7E 06 ld a, (ix + DriveData.stat2_ds) 3548/ 14D4 : E6 18 and STAT2_E_m | STAT2_F_m 3549/ 14D6 : C8 ret z ; why not just ret?? 3550/ 14D7 : C9 ret 3551/ 14D8 : 3552/ 14D8 : do_show_in_use_leds: 3553/ 14D8 : F5 push af 3554/ 14D9 : CD F7 14 call return_if_in_self_test 3555/ 14DC : E5 push hl 3556/ 14DD : 2A 17 60 ld hl, (in_use_leds_stack_ptr) ; push on the in_use_leds_stack 3557/ 14E0 : 23 inc hl ; seems like this wastes one byte 3558/ 14E1 : 77 ld (hl), a 3559/ 14E2 : set_leds: 3560/ 14E2 : 22 17 60 ld (in_use_leds_stack_ptr), hl 3561/ 14E5 : 2F cpl ; adjust for OC LED drivers 3562/ 14E6 : D3 63 out (leds), a 3563/ 14E8 : E1 pop hl 3564/ 14E9 : F1 pop af 3565/ 14EA : C9 ret 3566/ 14EB : 3567/ 14EB : show_previous_in_use_leds: 3568/ 14EB : F5 push af 3569/ 14EC : CD F7 14 call return_if_in_self_test 3570/ 14EF : E5 push hl 3571/ 14F0 : 2A 17 60 ld hl, (in_use_leds_stack_ptr) 3572/ 14F3 : 2B dec hl 3573/ 14F4 : 7E ld a, (hl) 3574/ 14F5 : 18 EB jr set_leds 3575/ 14F7 : 3576/ 14F7 : return_if_in_self_test: 3577/ 14F7 : FD CB 05 46 bit SELF_TEST_ACTIVE, (iy + YB(state_flags)) 3578/ 14FB : C8 ret z ; no 3579/ 14FC : 33 inc sp ; pop our return address 3580/ 14FD : 33 inc sp 3581/ 14FE : F1 pop af ; pop the saved af value 3582/ 14FF : C9 ret ; return to the caller's return address instead 3583/ 1500 : 3584/ 1500 : 3585/ 1500 : ;************* 3586/ 1500 : ; get_drive_stat2_bytes - fetch stat2 and stat2_ds 3587/ 1500 : ; 3588/ 1500 : ; on entry: 3589/ 1500 : ; IX: DriveData pointer 3590/ 1500 : ; 3591/ 1500 : ; on exit: 3592/ 1500 : ; D = stat2_ds 3593/ 1500 : ; E = stat2 3594/ 1500 : get_drive_stat2_bytes: 3595/ 1500 : DD 56 06 ld d, (ix + DriveData.stat2_ds) 3596/ 1503 : DD 5E 05 ld e, (ix + DriveData.stat2) 3597/ 1506 : C9 ret 3598/ 1507 : 3599/ 1507 : ; get pointer to per-drive data: 10 bytes each 3600/ 1507 : ; B = drive # 3601/ 1507 : ; IX = ptr (on return) 3602/ 1507 : ;x1507: 3603/ 1507 : get_drive_data_ptr_in_ix: 3604/ 1507 : C5 push bc 3605/ 1508 : DD 21 1E 60 ld ix, drive_data_table 3606/ 150C : 0E 0A ld c, 10 ; form index 10 * B 3607/ 150E : AF xor a 3608/ 150F : B8 cp b 3609/ 1510 : 28 06 jr z, .done 3610/ 1512 : 81 .loop: add a, c 3611/ 1513 : 10 FD djnz .loop 3612/ 1515 : 4F ld c, a 3613/ 1516 : DD 09 add ix, bc ; ix = &drive_data[10*B] 3614/ 1518 : C1 .done: pop bc 3615/ 1519 : C9 ret 3616/ 151A : 3617/ 151A : ; prep_drive_regs - setup for working with a drive/disc 3618/ 151A : ; 3619/ 151A : ; on exit: 3620/ 151A : ; IX: DriveData pointer 3621/ 151A : ; DE: unchanged 3622/ 151A : ; (disc_format): the current disc format information 3623/ 151A : ; DriveData.xv, xv: set appropriately 3624/ 151A : 3625/ 151A : prep_drive_regs: 3626/ 151A : D5 push de 3627/ 151B : 32 03 60 ld (current_unit), a ; save unit # 3628/ 151E : 32 04 60 ld (commanded_unit), a ; save unit # again?? 3629/ 1521 : 47 ld b, a 3630/ 1522 : CD 07 15 call get_drive_data_ptr_in_ix 3631/ 1525 : CD 00 15 call get_drive_stat2_bytes 3632/ 1528 : 06 00 ld b, FORMAT_HP 3633/ 152A : CB 53 bit DT_HP, e 3634/ 152C : 20 08 jr nz, .saveb 3635/ 152E : 06 00 ld b, FORMAT_IBM 3636/ 1530 : CB 63 bit DT_IBM, e 3637/ 1532 : 20 02 jr nz, .saveb 3638/ 1534 : 06 01 ld b, FORMAT_UNKNOWN 3639/ 1536 : FD 70 09 .saveb: ld (iy + YB(disc_format)), b 3640/ 1539 : DD 7E 09 ld a, (ix + DriveData.xv) 3641/ 153C : E6 0F and DRV_SEL_m ; mask off PRECMP and HIDEN 3642/ 153E : CB 40 bit FORMAT_IBM, b 3643/ 1540 : 20 02 jr nz, .skiphd ; IBM format only low density 3644/ 1542 : CB E7 set HIDEN, a 3645/ 1544 : .skiphd: 3646/ 1544 : DD 77 09 ld (ix + DriveData.xv), a 3647/ 1547 : CD FD 15 call set_drv_xv 3648/ 154A : D1 pop de 3649/ 154B : C9 ret 3650/ 154C : 3651/ 154C : ; returns with A==0 3652/ 154C : deselect_drives: 3653/ 154C : DB 62 in a, (drv_status) 3654/ 154E : CB 4F bit DISCHNG, a 3655/ 1550 : 28 04 jr z, deselect_drives_no_chng_check 3656/ 1552 : DD CB 09 FE set XV_SHDW_DISCHNG, (ix + DriveData.xv) 3657/ 1556 : deselect_drives_no_chng_check: 3658/ 1556 : 3E 04 ld a, NUNITS ; indicate no drive is selected 3659/ 1558 : 32 04 60 ld (commanded_unit), a 3660/ 155B : AF xor a 3661/ 155C : D3 66 out (xv), a ; deselect all drives 3662/ 155E : C9 ret 3663/ 155F : 3664/ 155F : ; head_unload_timer_check - see if it is time to unload heads on drives 3665/ 155F : ; 3666/ 155F : ; Keeps a head loaded for approximately 2 seconds if no further operations 3667/ 155F : ; have been received. The time a head remains loaded may go as long as 10 3668/ 155F : ; seconds on inactive drives if another drive has activity. 3669/ 155F : ; 3670/ 155F : ; on entry: 3671/ 155F : ; D = passed in parameter, approximate elapsed ticks 3672/ 155F : 3673/ 155F : head_unload_timer_check: 3674/ 155F : 3A 06 60 ld a, (head_unload_set) 3675/ 1562 : E6 0F and DRV_SEL_m ; any active timers? 3676/ 1564 : C8 ret z ; no, nothing to do 3677/ 1565 : 4F ld c, a 3678/ 1566 : 06 04 ld b, NUNITS ; init unit number counter 3679/ 1568 : DD E5 push ix ; save the current drive_data_ptr 3680/ 156A : CB 39 .loop: srl c 3681/ 156C : 05 dec b 3682/ 156D : FA 9C 15 jp m, .done ; done with the loop 3683/ 1570 : 30 F8 jr nc, .loop ; this drive's timer is not active, continue loop 3684/ 1572 : 3A 04 60 ld a, (commanded_unit) 3685/ 1575 : B8 cp b 3686/ 1576 : 28 F2 jr z, .loop ; skip the commanded drive 3687/ 1578 : CD 07 15 call get_drive_data_ptr_in_ix 3688/ 157B : DD 7E 08 ld a, (ix + DriveData.unload_ticks) 3689/ 157E : 92 sub d 3690/ 157F : DD 77 08 ld (ix + DriveData.unload_ticks), a 3691/ 1582 : 30 E6 jr nc, .loop ; continue loop if ticks didn't underflow 3692/ 1584 : DD 35 07 dec (ix + DriveData.unload_timer) ; approximately 1 sec has elapsed 3693/ 1587 : F2 6A 15 jp p, .loop ; timer not exipred, continue loop 3694/ 158A : CD D8 15 call maybe_unload_head 3695/ 158D : 3A 04 60 ld a, (commanded_unit) 3696/ 1590 : FE 04 cp NUNITS 3697/ 1592 : 28 05 jr z, .skip ; no drive is commanded, we're done 3698/ 1594 : DD E1 pop ix ; restore commanded drive's register values 3699/ 1596 : C3 F3 15 jp set_drv_xv_disc_chng 3700/ 1599 : CD 4C 15 .skip: call deselect_drives 3701/ 159C : DD E1 .done: pop ix 3702/ 159E : C9 ret 3703/ 159F : 3704/ 159F : 3705/ 159F : ;************* 3706/ 159F : ; load_head_ix - Load the nead in the selected drive 3707/ 159F : ; 3708/ 159F : ; on entry: 3709/ 159F : ; IX: DriveData pointer 3710/ 159F : ; 3711/ 159F : ; on exit: 3712/ 159F : ; A, B: clobbered 3713/ 159F : 3714/ 159F : do_load_head: 3715/ 159F : 3E 0A ld a, IU_LOAD 3716/ 15A1 : (MACRO) set_in_use_leds 3716/ 15A1 : EF rst 28h 3717/ 15A2 : CD B7 15 call load_head_ix 3718/ 15A5 : 06 3C ld b, 60 3719/ 15A7 : CC 40 12 call z, delay ; delay 60 ms if previously unloaded 3720/ 15AA : DB 62 in a, (drv_status) 3721/ 15AC : CB 67 bit READY, a 3722/ 15AE : C2 EB 14 jp nz, show_previous_in_use_leds ; the drive is ready (disc loaded) 3723/ 15B1 : CD E1 15 call force_unload_head ; drive not ready within 60 ms 3724/ 15B4 : C3 8A 14 jp abort_drive_fault 3725/ 15B7 : 3726/ 15B7 : ;************* 3727/ 15B7 : ; load_head_ix - Load the head on the selected drive 3728/ 15B7 : ; 3729/ 15B7 : ; on entry: 3730/ 15B7 : ; IX: DriveData pointer 3731/ 15B7 : ; 3732/ 15B7 : ; on exit: 3733/ 15B7 : ; Z = drive was not in use (head unloaded) 3734/ 15B7 : 3735/ 15B7 : load_head_ix: 3736/ 15B7 : DD CB 04 5E bit HEADLOAD, (ix + DriveData.drv) ; remember the previous state 3737/ 15BB : F5 push af 3738/ 15BC : DD CB 04 DE set HEADLOAD, (ix + DriveData.drv) ; turn on IN-USE 3739/ 15C0 : CD F3 15 call set_drv_xv_disc_chng 3740/ 15C3 : DD CB 04 6E bit DOOR_LOCK, (ix + DriveData.drv) ; drive's door lock set? 3741/ 15C7 : 20 0D jr nz, .skip 3742/ 15C9 : 3A 06 60 ld a, (head_unload_set) ; add this drive to head_unload_set 3743/ 15CC : DD B6 09 or (ix + DriveData.xv) 3744/ 15CF : 32 06 60 ld (head_unload_set), a 3745/ 15D2 : DD 36 07 18 ld (ix + DriveData.unload_timer), 24 ; initialize the unload timer (~24 sec?) 3746/ 15D6 : F1 .skip: pop af ; return the previous IN-USE state 3747/ 15D7 : C9 ret 3748/ 15D8 : 3749/ 15D8 : 3750/ 15D8 : ;************* 3751/ 15D8 : ; maybe_unload_head - See if we are allowed to unload the head and if so, do it. 3752/ 15D8 : ; on entry: 3753/ 15D8 : ; B = drive unit number 3754/ 15D8 : ; 3755/ 15D8 : ; on exit: 3756/ 15D8 : ; IX: DriveData pointer 3757/ 15D8 : 3758/ 15D8 : maybe_unload_head: 3759/ 15D8 : CD 07 15 call get_drive_data_ptr_in_ix 3760/ 15DB : DD CB 04 6E bit DOOR_LOCK, (ix + DriveData.drv) 3761/ 15DF : 20 07 jr nz, remove_from_head_unload_set 3762/ 15E1 : 3763/ 15E1 : ;************* 3764/ 15E1 : ; force_unload_head - Unload the head. 3765/ 15E1 : ; on entry: 3766/ 15E1 : ; IX: DriveData pointer 3767/ 15E1 : ; 3768/ 15E1 : ; on exit: 3769/ 15E1 : ; IX: DriveData pointer 3770/ 15E1 : 3771/ 15E1 : force_unload_head: 3772/ 15E1 : DD CB 04 9E res HEADLOAD, (ix + DriveData.drv) 3773/ 15E5 : CD F3 15 call set_drv_xv_disc_chng ; unload the head 3774/ 15E8 : 3775/ 15E8 : remove_from_head_unload_set: 3776/ 15E8 : DD 7E 09 ld a, (ix + DriveData.xv) 3777/ 15EB : 2F cpl ; form mask 3778/ 15EC : FD A6 06 and (iy + YB(head_unload_set)) ; remove this drive from head_unload_set 3779/ 15EF : 32 06 60 ld (head_unload_set), a 3780/ 15F2 : C9 ret 3781/ 15F3 : 3782/ 15F3 : 3783/ 15F3 : ;************* 3784/ 15F3 : ; Notes: 3785/ 15F3 : ; If HEADLOAD is active when this is called it will lock the door. 3786/ 15F3 : ; If HEADLOAD is inactive when this is called it will unlock the door. 3787/ 15F3 : x15f3: 3788/ 15F3 : set_drv_xv_disc_chng: 3789/ 15F3 : DB 62 in a, (drv_status) 3790/ 15F5 : CB 4F bit DISCHNG, a 3791/ 15F7 : 28 04 jr z, set_drv_xv ; no change has been detected 3792/ 15F9 : DD CB 09 FE set XV_SHDW_DISCHNG, (ix + DriveData.xv) ; remember disc change was detected 3793/ 15FD : set_drv_xv: 3794/ 15FD : AF xor a 3795/ 15FE : D3 66 out (xv), a ; deselect all drives 3796/ 1600 : DD 7E 04 ld a, (ix + DriveData.drv) ; set this drive's drv value 3797/ 1603 : D3 65 out (drv), a ; HEADLOAD (aka IN-USE) state is latched here 3798/ 1605 : DD 7E 09 ld a, (ix + DriveData.xv) ; select the drive 3799/ 1608 : D3 66 out (xv), a 3800/ 160A : 3801/ 160A : do_deassert_in_use: 3802/ 160A : DD 7E 04 ld a, (ix + DriveData.drv) 3803/ 160D : E6 FC and ~HEADLOAD ; Turn off the drive's In Use signal 3804/ 160F : D3 65 out (drv), a 3805/ 1611 : C9 ret 3806/ 1612 : 3807/ 1612 : ;************* 3808/ 1612 : ; get_drive_SS - Determine the stat2_ds SS value from the currently selected 3809/ 1612 : ; drive's status register or a remembered DISCHNG status. 3810/ 1612 : ; 3811/ 1612 : ; on entry: 3812/ 1612 : ; IX: DriveData pointer 3813/ 1612 : ; 3814/ 1612 : ; on exit: 3815/ 1612 : ; IX: unchanged 3816/ 1612 : ; Z: A is valid (SS value) 3817/ 1612 : ; C: drive ready + first status 3818/ 1612 : 3819/ 1612 : ;x1612: 3820/ 1612 : get_drive_SS: 3821/ 1612 : DB 62 in a, (drv_status) 3822/ 1614 : CB 4F bit DISCHNG, a 3823/ 1616 : 20 12 jr nz, .dchng 3824/ 1618 : DD CB 09 7E bit XV_SHDW_DISCHNG, (ix + DriveData.xv) 3825/ 161C : 20 0C jr nz, .dchng 3826/ 161E : CB 67 bit READY, a 3827/ 1620 : 20 13 jr nz, .check_ready 3828/ 1622 : 3829/ 1622 : .no_disc: 3830/ 1622 : 3E 03 ld a, SS_NO_DISC 3831/ 1624 : DD CB 04 AE res DOOR_LOCK, (ix + DriveData.drv) 3832/ 1628 : BF cp a 3833/ 1629 : C9 ret ; NC, Z, A = SS_NO_DISC 3834/ 162A : 3835/ 162A : DD CB 09 BE .dchng: res XV_SHDW_DISCHNG, (ix + DriveData.xv) 3836/ 162E : CB 67 bit READY, a 3837/ 1630 : 28 F0 jr z, .no_disc 3838/ 1632 : 3839/ 1632 : AF .ready: xor a ; A = 0 3840/ 1633 : 37 scf 3841/ 1634 : C9 ret ; C, Z, A = SS_READY 3842/ 1635 : 3843/ 1635 : .check_ready: 3844/ 1635 : DD CB 06 56 bit SS_NOT_READY_m, (ix + DriveData.stat2_ds) 3845/ 1639 : 20 F7 jr nz, .ready 3846/ 163B : B7 or a ; A is non-zero here 3847/ 163C : 37 scf 3848/ 163D : C9 ret ; C, NZ, A = drv_status 3849/ 163E : 3850/ 163E : ;************* 3851/ 163E : ; validate_sector_number - check if the sector number is in range 3852/ 163E : ; 3853/ 163E : ; on entry: 3854/ 163E : ; B: sector number 3855/ 163E : ; 3856/ 163E : ; on exit: 3857/ 163E : ; A: clobbered 3858/ 163E : ; Z: valid 3859/ 163E : ; NZ: invalid 3860/ 163E : 3861/ 163E : validate_sector_number: 3862/ 163E : E5 push hl 3863/ 163F : 21 57 16 ld hl, sector_range_tbl 3864/ 1642 : FD CB 09 46 bit FORMAT_IBM, (iy + YB(disc_format)) 3865/ 1646 : 28 01 jr z, .skip 3866/ 1648 : 23 inc hl ; choose the IBM values 3867/ 1649 : 78 .skip: ld a, b 3868/ 164A : BE cp (hl) 3869/ 164B : 38 08 jr c, .invalid ; borrow, was < min number 3870/ 164D : 23 inc hl ; now check the max number 3871/ 164E : 23 inc hl 3872/ 164F : BE cp (hl) 3873/ 1650 : 28 03 jr z, .invalid 3874/ 1652 : 30 01 jr nc, .invalid ; no borrow, was > max number 3875/ 1654 : AF xor a ; set Z 3876/ 1655 : .invalid: 3877/ 1655 : E1 pop hl 3878/ 1656 : C9 ret 3879/ 1657 : 3880/ 1657 : sector_range_tbl: 3881/ 1657 : 00 01 db HP_FIRST_SECTOR, IBM_FIRST_SECTOR 3882/ 1659 : 1E 1A db HP_SECTORS_PER_TRACK, IBM_SECTORS_PER_TRACK 3883/ 165B : 3884/ 165B : set_lowcurr_and_precmp: 3885/ 165B : DD 7E 00 ld a, (ix + DriveData.physical_cylinder) 3886/ 165E : FD CB 09 46 bit FORMAT_IBM, (iy + YB(disc_format)) 3887/ 1662 : 20 0C jr nz, .skipp 3888/ 1664 : DD CB 09 AE res PRECMP, (ix + DriveData.xv) 3889/ 1668 : FE 37 cp HP_PRECMP_START_TRACK 3890/ 166A : 38 04 jr c, .skipp 3891/ 166C : DD CB 09 EE set PRECMP, (ix + DriveData.xv) 3892/ 1670 : .skipp: 3893/ 1670 : DD CB 04 A6 res LOWCURR, (ix + DriveData.drv) 3894/ 1674 : FE 2B cp HP_LOWCURR_START_TRACK 3895/ 1676 : 38 04 jr c, .skipl 3896/ 1678 : DD CB 04 E6 set LOWCURR, (ix + DriveData.drv) 3897/ 167C : (MACRO) .skipl: deassert_in_use 3897/ 167C : F7 rst 30h 3898/ 167D : DD 7E 09 ld a, (ix + DriveData.xv) 3899/ 1680 : D3 66 out (xv), a 3900/ 1682 : C9 ret 3901/ 1683 : 3902/ 1683 : ;************* 3903/ 1683 : ; get_doubled_sided_bit - get the drive's TWO-SIDED signal 3904/ 1683 : ; 3905/ 1683 : ; on entry: 3906/ 1683 : ; E = copy of DriveData.stat2 3907/ 1683 : ; 3908/ 1683 : ; on exit: 3909/ 1683 : ; E = copy of DriveData.stat2 with DT_DS set appropriately 3910/ 1683 : 3911/ 1683 : get_double_sided_bit: 3912/ 1683 : CB 9B res DT_DS, e ; assume single sided 3913/ 1685 : DB 62 in a, (drv_status) 3914/ 1687 : CB 7F bit TWOSIDE, a 3915/ 1689 : C8 ret z 3916/ 168A : CB DB set DT_DS, e 3917/ 168C : C9 ret 3918/ 168D : 3919/ 168D : ;x168d: 3920/ 168D : ; media_type_check - determine the disc media type 3921/ 168D : ; 3922/ 168D : ; on entry: 3923/ 168D : ; DE: (zeroed?) 3924/ 168D : ; 3925/ 168D : ; on exit: 3926/ 168D : ; D: DriveData.stat2_ds 3927/ 168D : ; E: DriveData.stat2 3928/ 168D : media_type_check: 3929/ 168D : D5 push de 3930/ 168E : 3E 04 ld a, DT_HP_m ; assume HP format 3931/ 1690 : CD FA 16 call set_stat2_check_ready 3932/ 1693 : 28 60 jr z, .notready 3933/ 1695 : (MACRO) reset_drive 3933/ 1695 : CF rst 08h 3934/ 1696 : 28 05 jr z, .ready 3935/ 1698 : D1 pop de 3936/ 1699 : CB D2 set STAT2_C, d ; set stat2 C bit (seek check)? 3937/ 169B : 18 5B jr .inc_a_ret 3938/ 169D : 3939/ 169D : FD 36 0E 05 .ready: ld (iy + YB(600eh)), 5 ; retries? 3940/ 16A1 : 3E 04 .retry: ld a, DT_HP_m 3941/ 16A3 : CD FA 16 call set_stat2_check_ready 3942/ 16A6 : 28 4D jr z, .notready 3943/ 16A8 : (MACRO) wait_for_sector 3943/ 16A8 : DF rst 18h 3944/ 16A9 : 3E 04 ld a, DT_HP_m 3945/ 16AB : 28 42 jr z, .exit 3946/ 16AD : D1 pop de ; get stat2 and stat2_ds back 3947/ 16AE : D5 push de 3948/ 16AF : CB 5B bit DT_DS, e 3949/ 16B1 : 20 12 jr nz, .twoside 3950/ 16B3 : 3E 10 ld a, DT_IBM_m 3951/ 16B5 : CD FA 16 call set_stat2_check_ready 3952/ 16B8 : 28 3B jr z, .notready 3953/ 16BA : (MACRO) wait_for_sector 3953/ 16BA : DF rst 18h 3954/ 16BB : 20 08 jr nz, .twoside 3955/ 16BD : DD 36 03 01 ld (ix + DriveData.sector), 1 ; IBM format first sector is 1 3956/ 16C1 : 3E 10 ld a, DT_IBM_m 3957/ 16C3 : 18 2A jr .exit 3958/ 16C5 : 3959/ 16C5 : .twoside: 3960/ 16C5 : FD 35 0E dec (iy + YB(600eh)) 3961/ 16C8 : 3E 02 ld a, DT_BLANK_m 3962/ 16CA : 28 23 jr z, .exit ; retries expired? 3963/ 16CC : CB 5B bit DT_DS, e 3964/ 16CE : 28 15 jr z, .oneside 3965/ 16D0 : DD CB 04 7E bit HEAD1, (ix + DriveData.drv) ; switch to the other head 3966/ 16D4 : DD CB 04 FE set HEAD1, (ix + DriveData.drv) 3967/ 16D8 : 28 04 jr z, .skip ; HEAD1 was not previously set 3968/ 16DA : DD CB 04 BE res HEAD1, (ix + DriveData.drv) 3969/ 16DE : (MACRO) .skip: deassert_in_use 3969/ 16DE : F7 rst 30h 3970/ 16DF : DD CB 04 7E bit HEAD1, (ix + DriveData.drv) 3971/ 16E3 : 20 BC jr nz, .retry ; now try again with HEAD1 3972/ 16E5 : 3973/ 16E5 : .oneside: 3974/ 16E5 : 0E 00 ld c, 0 ; step in towards center 3975/ 16E7 : CD 1B 00 call step_drive_jv 3976/ 16EA : DD 34 00 inc (ix + DriveData.physical_cylinder) 3977/ 16ED : 18 B2 jr .retry 3978/ 16EF : 3979/ 16EF : D1 .exit: pop de 3980/ 16F0 : F5 push af 3981/ 16F1 : B3 or e ; set the disc type in stat2 (in E) 3982/ 16F2 : 5F ld e, a 3983/ 16F3 : F1 pop af ; return with the disc type in A 3984/ 16F4 : C9 ret 3985/ 16F5 : 3986/ 16F5 : .notready: 3987/ 16F5 : D1 pop de 3988/ 16F6 : CB E2 set STAT2_E, d 3989/ 16F8 : .inc_a_ret: 3990/ 16F8 : 3C inc a ; set STAT2_RSVD ?? 3991/ 16F9 : C9 ret 3992/ 16FA : 3993/ 16FA : ;****************************************************************** 3994/ 16FA : ; set_stat2_check_ready - set the stat2 value and check if the 3995/ 16FA : ; drive is ready 3996/ 16FA : ; on entry: 3997/ 16FA : ; A: the stat2 value to set 3998/ 16FA : ; 3999/ 16FA : ; on exit: 4000/ 16FA : ; NZ: the drive is ready 4001/ 16FA : ; Z: not ready 4002/ 16FA : 4003/ 16FA : set_stat2_check_ready: 4004/ 16FA : DD 77 05 ld (ix + DriveData.stat2), a 4005/ 16FD : CD 4C 15 call deselect_drives 4006/ 1700 : 3A 03 60 ld a, (current_unit) 4007/ 1703 : CD 1A 15 call prep_drive_regs 4008/ 1706 : CD B7 15 call load_head_ix 4009/ 1709 : DB 62 in a, (drv_status) 4010/ 170B : CB 67 bit READY, a 4011/ 170D : C0 ret nz ; why not just ret? 4012/ 170E : C8 ret z 4013/ 170F : 4014/ 170F : 4015/ 170F : (MACRO) fillto 1720h, 076h 4015/ 170F : 76 76 76 76 76 76 db (1720H-$) dup (076H) 1715 : 76 76 76 76 76 76 171B : 76 76 76 76 76 4016/ 1720 : 4017/ 1720 : do_reset: 4018/ 1720 : 18 02 jr cold_start 4019/ 1722 : 4020/ 1722 : do_initiate_self_test: 4021/ 1722 : 18 0F jr reset_peripherals 4022/ 1724 : 4023/ 1724 : cold_start: 4024/ 1724 : AF xor a 4025/ 1725 : 57 ld d, a 4026/ 1726 : D3 63 out (leds), a ; turn on all LEDs 4027/ 1728 : CB FF set ERROR, a 4028/ 172A : D3 67 out (monitor_U6), a ; turn on monitor ERROR LED 4029/ 172C : DB 63 in a, (switches) 4030/ 172E : E6 08 and WRTEST_m 4031/ 1730 : 5F ld e, a 4032/ 1731 : CB E3 set SELFTEST, e ; DE = bit 4: SELF TEST (internal, not commanded), bit 3: WR TEST 4033/ 1733 : 4034/ 1733 : reset_peripherals: 4035/ 1733 : F3 di 4036/ 1734 : 3E 03 ld a, PROGRES 4037/ 1736 : D3 62 out (reset), a 4038/ 1738 : 4039/ 1738 : ; run off the end of test_jmptbl?? or initiate self test 4040/ 1738 : test_1738: 4041/ 1738 : AF xor a 4042/ 1739 : D3 64 out (cntl), a ; clear cntl 4043/ 173B : 31 FF 63 ld sp, ramend 4044/ 173E : C3 E3 17 jp cpu_test 4045/ 1741 : 4046/ 1741 : ; warm start?? 4047/ 1741 : FD 21 00 60 x1741: ld iy, ramstart ; IY convenient pointer to start of RAM 4048/ 1745 : FD CB 15 76 bit 6, (iy + YB(test_jmptbl_ptr)) ; (x6015) bit 6 set? (after ram test this should be zero) 4049/ 1749 : 20 39 jr nz, do_self_test_loop ; Yes, run self tests 4050/ 174B : 06 00 ld b, 0 4051/ 174D : CD 07 15 x174d: call get_drive_data_ptr_in_ix 4052/ 1750 : C5 push bc 4053/ 1751 : 04 inc b 4054/ 1752 : 3E 10 ld a, 10h 4055/ 1754 : 0F x1754: rrca 4056/ 1755 : 10 FD djnz x1754 4057/ 1757 : DD 77 09 ld (ix + DriveData.xv), a 4058/ 175A : F5 push af 4059/ 175B : D3 66 out (xv), a 4060/ 175D : (MACRO) reset_drive 4060/ 175D : CF rst 08h 4061/ 175E : 28 09 jr z, x1769 4062/ 1760 : F1 pop af 4063/ 1761 : FD B6 46 or (iy + YB(cmd_count)) 4064/ 1764 : 32 46 60 ld (cmd_count), a 4065/ 1767 : 18 0E jr x1777 4066/ 1769 : 4067/ 1769 : 0E 00 x1769: ld c, 0 ; step in towards center 4068/ 176B : CD 1B 00 call step_drive_jv 4069/ 176E : CD AD 17 call delay_20ms 4070/ 1771 : 06 04 ld b, 4 4071/ 1773 : CD 15 1C call x1c15 4072/ 1776 : F1 pop af 4073/ 1777 : C1 x1777: pop bc 4074/ 1778 : 04 inc b 4075/ 1779 : CB 50 bit 2, b 4076/ 177B : 28 D0 jr z, x174d 4077/ 177D : AF xor a 4078/ 177E : D3 66 out (xv), a 4079/ 1780 : FD CB 13 F6 set 6, (iy + YB(test_flags)) 4080/ 1784 : 4081/ 1784 : do_self_test_loop: 4082/ 1784 : 01 B2 17 ld bc, test_jmptbl ; Initialize the self test table pointer 4083/ 1787 : ED 43 15 60 ld (test_jmptbl_ptr), bc 4084/ 178B : 21 05 60 ld hl, state_flags 4085/ 178E : CB C6 set SELF_TEST_ACTIVE, (hl) 4086/ 1790 : self_test_loop: 4087/ 1790 : FD 2A 15 60 ld iy, (test_jmptbl_ptr) ; Get the address of the next test 4088/ 1794 : FD 6E 00 ld l, (iy + YB(ramstart)) 4089/ 1797 : FD 23 inc iy 4090/ 1799 : FD 66 00 ld h, (iy + YB(ramstart)) 4091/ 179C : FD 23 inc iy 4092/ 179E : FD 22 15 60 ld (test_jmptbl_ptr), iy ; save new pointer value 4093/ 17A2 : FD 21 00 60 ld iy, ramstart ; restore IY to usual value 4094/ 17A6 : 01 AB 17 ld bc, x17ab ; Set test return address 4095/ 17A9 : C5 push bc 4096/ 17AA : E9 jp (hl) ; Run the next self test 4097/ 17AB : 4098/ 17AB : 18 E3 x17ab: jr self_test_loop 4099/ 17AD : 4100/ 17AD : delay_20ms: 4101/ 17AD : 06 14 ld b, 14h 4102/ 17AF : C3 40 12 jp delay 4103/ 17B2 : 4104/ 17B2 : test_jmptbl: 4105/ 17B2 : 2B 1A dw timeout_bit_test 4106/ 17B4 : 6C 1A dw overrun_bit_test 4107/ 17B6 : 96 1A dw ibm_data_loop_test 4108/ 17B8 : BF 1A dw hp_data_loop_test 4109/ 17BA : 4D 1B dw crc_test 4110/ 17BC : seek_recalibrate_test_ptr: 4111/ 17BC : A5 1B dw seek_recalibrate_test 4112/ 17BE : 20 1C dw rotational_timing_test 4113/ 17C0 : 74 1C dw write_test 4114/ 17C2 : AB 1C dw write_test_part2 4115/ 17C4 : D9 1C dw write_test_part3 4116/ 17C6 : read_test_ptr: 4117/ 17C6 : E3 1D dw read_test 4118/ 17C8 : test_1e9c_ptr: 4119/ 17C8 : 9C 1E dw test_1e9c 4120/ 17CA : test_1ef3_ptr: 4121/ 17CA : F3 1E dw test_1ef3 4122/ 17CC : test_1ed9_ptr: 4123/ 17CC : D9 1E dw test_1ed9 4124/ 17CE : 38 17 dw test_1738 4125/ 17D0 : 4126/ 17D0 : ; update_monitor_leds data 1 = on 4127/ 17D0 : ; A = monitor_U6 value 4128/ 17D0 : ; C = leds value (mirrored by the montor board) 4129/ 17D0 : update_monitor_leds: 4130/ 17D0 : 47 ld b, a 4131/ 17D1 : ED 43 07 60 ld (leds_shdw), bc ; Save them in the shadows 4132/ 17D5 : 2F cpl ; Complement for OC drivers 4133/ 17D6 : D3 67 out (monitor_U6), a 4134/ 17D8 : 79 ld a, c 4135/ 17D9 : 2F cpl ; Complement for OC drivers 4136/ 17DA : D3 63 out (leds), a 4137/ 17DC : C9 x17dc: ret 4138/ 17DD : 4139/ 17DD : 4140/ 17DD : led_data_to_a_c: 4141/ 17DD : ED 4B 07 60 ld bc, (leds_shdw) 4142/ 17E1 : 78 ld a, b 4143/ 17E2 : C9 ret 4144/ 17E3 : 4145/ 17E3 : ;on entry from cold_start: DE = bit 4: SELF TEST (artificially set), bit 3: WR TEST 4146/ 17E3 : cpu_test: 4147/ 17E3 : 3E C0 ld a, 0c0h ; Processor test 15 ST 1 4148/ 17E5 : D3 63 out (leds), a 4149/ 17E7 : 3E FF ld a, 0ffh 4150/ 17E9 : D3 67 out (monitor_U6), a 4151/ 17EB : 3E 00 ld a, 0 4152/ 17ED : 87 add a, a 4153/ 17EE : 28 02 jr z, test_nz ; 0 better be zero! 4154/ 17F0 : hang_z_not_set: 4155/ 17F0 : 18 FE jr hang_z_not_set 4156/ 17F2 : 4157/ 17F2 : test_nz: 4158/ 17F2 : hang_nz_set: 4159/ 17F2 : 20 FE jr nz, hang_nz_set 4160/ 17F4 : 4161/ 17F4 : C6 0F add a, 0fh ; A = 15 4162/ 17F6 : F2 FB 17 jp p, test_m ; 15 better be positive! 4163/ 17F9 : hang_p_not_set: 4164/ 17F9 : 18 FE jr hang_p_not_set 4165/ 17FB : 4166/ 17FB : test_m: 4167/ 17FB : hang_m_set: 4168/ 17FB : FA FB 17 jp m, hang_m_set 4169/ 17FE : FE 0E cp 0eh 4170/ 1800 : hang_cp_pos: 4171/ 1800 : FA 00 18 jp m, hang_cp_pos ; 15 - 14 better be positive! 4172/ 1803 : 4173/ 1803 : FE 0F cp 0fh 4174/ 1805 : hang_cp_ne: 4175/ 1805 : 20 FE jr nz, hang_cp_ne ; 15 better equal 15! 4176/ 1807 : 4177/ 1807 : FE 10 x1807: cp 10h 4178/ 1809 : hang_cp_neg: 4179/ 1809 : F2 09 18 jp p, hang_cp_neg ; 15 - 16 better be negative! 4180/ 180C : 4181/ 180C : D6 10 sub 10h ; A = -1 4182/ 180E : FA 13 18 jp m, hang_sub_pos ; subtract better work the same way 4183/ 1811 : hang_sub_neg: 4184/ 1811 : 18 FE jr hang_sub_neg 4185/ 1813 : 4186/ 1813 : hang_sub_pos: 4187/ 1813 : F2 13 18 jp p, hang_sub_pos ; 15 - 16 should not also be positive! 4188/ 1816 : 4189/ 1816 : ; Do some ALU and register transfer tests 4190/ 1816 : 47 ld b, a ; B = -1 4191/ 1817 : 48 ld c, b ; C = -1 4192/ 1818 : 61 ld h, c ; H = -1 4193/ 1819 : 6C ld l, h ; L = -1 4194/ 181A : 2C inc l ; L = 0 4195/ 181B : 65 ld h, l ; H = 0 4196/ 181C : 4C ld c, h ; C = 0 4197/ 181D : 41 ld b, c ; B = 0 4198/ 181E : 78 ld a, b ; A = 0 4199/ 181F : 3D dec a ; A = 0ffh 4200/ 1820 : E6 5A and 5ah ; A = 5ah 4201/ 1822 : 47 ld b, a ; B = 5ah 4202/ 1823 : F6 99 or 99h ; A = 0dbh 4203/ 1825 : 4F ld c, a ; C = 0dbh 4204/ 1826 : EE DB xor 0dbh ; A = 0 4205/ 1828 : 2F cpl ; A = 0ffh 4206/ 1829 : CB 9F res 3, a ; A = 0f7h 4207/ 182B : 67 ld h, a ; H = 0f7h 4208/ 182C : 37 scf ; CF=1 4209/ 182D : 88 adc a, b ; A = 52h, CF=1 4210/ 182E : 6F ld l, a ; L = 52h 4211/ 182F : 3F ccf ; CF=0 4212/ 1830 : 99 sbc a, c ; A = 77h, CF=1 4213/ 1831 : CB FF set 7, a ; A = 0f7h 4214/ 1833 : ED 44 neg ; A = 09h, CF=1 4215/ 1835 : 0F rrca ; A = 04h, CF=1 4216/ 1836 : CB 10 rl b ; B = 0b5h, CF=0 4217/ 1838 : CB 01 rlc c ; C = 0b7h, CF=1 4218/ 183A : CB 1C rr h ; H = 7bh, CF=1 4219/ 183C : CB 25 sla l ; L = 0a4h, CF=0 4220/ 183E : CB 2F sra a ; A = 02h, CF=0 4221/ 1840 : CB 3C srl h ; H = 3dh, CF=1 4222/ 1842 : 38 02 jr c, hang_alu_nc ; all that mess should end up with the C flag set 4223/ 1844 : hang_alu_c: 4224/ 1844 : 18 FE jr hang_alu_c 4225/ 1846 : 4226/ 1846 : hang_alu_nc: 4227/ 1846 : 30 FE jr nc, hang_alu_nc 4228/ 1848 : 80 add a, b 4229/ 1849 : 81 add a, c 4230/ 184A : 84 add a, h 4231/ 184B : 85 add a, l 4232/ 184C : 42 ld b, d ; save DE contents into BC 4233/ 184D : 4B ld c, e 4234/ 184E : 16 54 ld d, 54h 4235/ 1850 : 82 add a, d 4236/ 1851 : 1E A2 ld e, 0a2h 4237/ 1853 : CB C3 set 0, e 4238/ 1855 : BB cp e 4239/ 1856 : hang_cpu_nz: 4240/ 1856 : 20 FE jr nz, hang_cpu_nz 4241/ 1858 : 4242/ 1858 : CB 74 bit 6, h ; H = 3dh from above 4243/ 185A : hang_bit_test: 4244/ 185A : 28 FE jr z, hang_bit_test 4245/ 185C : 50 ld d, b ; restore DE 4246/ 185D : 59 ld e, c 4247/ 185E : 21 64 18 ld hl, processor_st2 ; test indirect jump 4248/ 1861 : E9 jp (hl) 4249/ 1862 : 4250/ 1862 : hang_ind_jp: 4251/ 1862 : 18 FE jr hang_ind_jp 4252/ 1864 : 4253/ 1864 : 4254/ 1864 : ; DE = bit 4: SELF TEST (artificially set), bit 3: WR TEST 4255/ 1864 : processor_st2: 4256/ 1864 : 3E A0 ld a, 0a0h ; Processor test ST 2 4257/ 1866 : D3 63 out (leds), a 4258/ 1868 : 3E FF ld a, 0ffh 4259/ 186A : D3 67 out (monitor_U6), a 4260/ 186C : 06 A5 ld b, 0a5h 4261/ 186E : C5 push bc 4262/ 186F : F1 pop af 4263/ 1870 : B8 cp b 4264/ 1871 : hang_push_pop: 4265/ 1871 : 20 FE jr nz, hang_push_pop ; A == B? 4266/ 1873 : 4267/ 1873 : AF xor a 4268/ 1874 : 21 FE 63 ld hl, highest_stack_word ; Reg B containing a5h pushed on stack previously 4269/ 1877 : 7E ld a, (hl) 4270/ 1878 : B8 cp b 4271/ 1879 : hang_stack_rw: 4272/ 1879 : 20 FE jr nz, hang_stack_rw ; A == B? 4273/ 187B : 4274/ 187B : DD 21 FE 63 ld ix, highest_stack_word ; Test index register accesses 4275/ 187F : FD 21 FC 63 ld iy, penultimate_stack_word 4276/ 1883 : DD BE 00 cp (ix + DriveData.physical_cylinder) 4277/ 1886 : hang_ix: 4278/ 1886 : 20 FE jr nz, hang_ix 4279/ 1888 : 4280/ 1888 : FD BE 02 cp (iy + YB(S1_unit)) 4281/ 188B : hang_iy: 4282/ 188B : 20 FE jr nz, hang_iy 4283/ 188D : 4284/ 188D : CD 95 18 call call_ret_test 4285/ 1890 : hang_call_ret: 4286/ 1890 : 18 FE jr hang_call_ret 4287/ 1892 : 4288/ 1892 : C3 A4 18 jp romcsum ; CPU test complete 4289/ 1895 : 4290/ 1895 : call_ret_test: 4291/ 1895 : 01 90 18 ld bc, hang_call_ret 4292/ 1898 : 7E ld a, (hl) 4293/ 1899 : B8 cp b 4294/ 189A : hang_ret_addr_H: 4295/ 189A : 20 FE jr nz, hang_ret_addr_H 4296/ 189C : 2B dec hl 4297/ 189D : 7E ld a, (hl) 4298/ 189E : B9 cp c 4299/ 189F : hang_ret_addr_L: 4300/ 189F : 20 FE jr nz, hang_ret_addr_L 4301/ 18A1 : 34 inc (hl) ; adjust ret addr to return to jp romcsum 4302/ 18A2 : 34 inc (hl) 4303/ 18A3 : C9 ret 4304/ 18A4 : 4305/ 18A4 : ; DE = bit 4: SELF TEST (artificially set), bit 3: WR TEST 4306/ 18A4 : romcsum: 4307/ 18A4 : 3E FC ld a, 0fch ; ROM test ST 0 4308/ 18A6 : D3 63 out (leds), a 4309/ 18A8 : 3E FF ld a, 0ffh 4310/ 18AA : D3 67 out (monitor_U6), a 4311/ 18AC : 4312/ 18AC : DD 21 FD 1F ld ix, rom_csum_L-1 ; highest ROM address to check 4313/ 18B0 : 01 FE 1F ld bc, rom_csum_L ; # ROM bytes to check (excl ROM csum bytes) 4314/ 18B3 : D5 push de ; save DE (written to test_flags later) 4315/ 18B4 : AF xor a 4316/ 18B5 : 57 ld d, a 4317/ 18B6 : 67 ld h, a 4318/ 18B7 : 6F ld l, a 4319/ 18B8 : 4320/ 18B8 : romcsum_loop: 4321/ 18B8 : 0B dec bc 4322/ 18B9 : DD 5E 00 ld e, (ix + DriveData.physical_cylinder) 4323/ 18BC : 19 add hl, de 4324/ 18BD : DD 2B dec ix 4325/ 18BF : B8 cp b 4326/ 18C0 : 20 F6 jr nz, romcsum_loop 4327/ 18C2 : B9 cp c 4328/ 18C3 : 20 F3 jr nz, romcsum_loop 4329/ 18C5 : 3A FE 1F ld a, (rom_csum_L) 4330/ 18C8 : BD cp l 4331/ 18C9 : romcsum_fail_l: 4332/ 18C9 : 20 FE jr nz, romcsum_fail_l 4333/ 18CB : 4334/ 18CB : 3A FF 1F ld a, (rom_csum_H) 4335/ 18CE : BC cp h 4336/ 18CF : romcsum_fail_h: 4337/ 18CF : 20 FE jr nz, romcsum_fail_h 4338/ 18D1 : 4339/ 18D1 : D1 pop de ; restore DE (written to test_flags later) 4340/ 18D2 : 4341/ 18D2 : ramtest: 4342/ 18D2 : 21 00 60 ld hl, ramstart ; Fill RAM with an address dependent pattern 4343/ 18D5 : 01 00 04 ld bc, ramsize 4344/ 18D8 : fill_loop: 4345/ 18D8 : 7D ld a, l 4346/ 18D9 : 84 add a, h 4347/ 18DA : 77 ld (hl), a 4348/ 18DB : 23 inc hl 4349/ 18DC : 0D dec c 4350/ 18DD : 20 F9 jr nz, fill_loop 4351/ 18DF : 10 F7 djnz fill_loop 4352/ 18E1 : 4353/ 18E1 : 21 00 60 ld hl, ramstart ; Check RAM for the address dependent pattern 4354/ 18E4 : 01 00 04 ld bc, ramsize 4355/ 18E7 : chk_loop: 4356/ 18E7 : 7D ld a, l 4357/ 18E8 : 84 add a, h 4358/ 18E9 : BE cp (hl) 4359/ 18EA : 20 56 jr nz, RAM_addr_fail 4360/ 18EC : 23 inc hl 4361/ 18ED : 0D dec c 4362/ 18EE : 20 F7 jr nz, chk_loop 4363/ 18F0 : 10 F5 djnz chk_loop 4364/ 18F2 : FD 21 4C 19 ld iy, ram_test_patterns ; Test with the static patterns 4365/ 18F6 : 4366/ 18F6 : do_pat_tests: 4367/ 18F6 : FD 7E 00 ld a, (iy + YB(ramstart)) 4368/ 18F9 : CD 07 19 call do_pat_test 4369/ 18FC : FD 23 inc iy 4370/ 18FE : B7 or a 4371/ 18FF : 20 F5 jr nz, do_pat_tests 4372/ 1901 : ED 53 13 60 ld (test_flags), de ; DE = bit 4: SELF TEST (artificially set cold start), bit 3: WR TEST 4373/ 1905 : 18 49 jr do_phi_test ; ram test done 4374/ 1907 : 4375/ 1907 : 4376/ 1907 : ; Test pattern in A also at (iy + YB(ramstart)) 4377/ 1907 : do_pat_test: 4378/ 1907 : DD E1 pop ix ; Save return addr since we will test that loc 4379/ 1909 : 01 00 04 ld bc, ramsize 4380/ 190C : 21 00 60 ld hl, ramstart 4381/ 190F : pfill_loop: 4382/ 190F : 77 ld (hl), a 4383/ 1910 : 23 inc hl 4384/ 1911 : 0D dec c 4385/ 1912 : 20 FB jr nz, pfill_loop 4386/ 1914 : 10 F9 djnz pfill_loop 4387/ 1916 : 4388/ 1916 : 01 00 04 ld bc, ramsize 4389/ 1919 : 21 00 60 ld hl, ramstart 4390/ 191C : pchk_loop: 4391/ 191C : 7E ld a, (hl) 4392/ 191D : FD BE 00 cp (iy + YB(ramstart)) 4393/ 1920 : 20 09 jr nz, pattern_test_fail 4394/ 1922 : 23 inc hl 4395/ 1923 : 0D dec c 4396/ 1924 : 20 F6 jr nz, pchk_loop 4397/ 1926 : 10 F4 djnz pchk_loop 4398/ 1928 : DD E5 push ix ; Restore the return addr 4399/ 192A : C9 ret 4400/ 192B : 4401/ 192B : ; A = failed RAM read data 4402/ 192B : pattern_test_fail: 4403/ 192B : E6 F0 and 0f0h 4404/ 192D : 4F ld c, a 4405/ 192E : FD 7E 00 ld a, (iy + YB(ramstart)) ; Get the correct data 4406/ 1931 : E6 F0 and 0f0h 4407/ 1933 : B9 cp c 4408/ 1934 : 3E F4 ld a, 0f4h ; Upper nibble failed U36 test 5 + DONE 4409/ 1936 : 20 02 jr nz, x193a 4410/ 1938 : 3E F2 ld a, 0f2h ; Lower nibble failed U35 test 6 + DONE 4411/ 193A : D3 63 x193a: out (leds), a ; NOTE: LED pattern 0 = on here 4412/ 193C : 3E FF ld a, 0ffh 4413/ 193E : D3 67 out (monitor_U6), a 4414/ 1940 : hang_RAM_failure: 4415/ 1940 : 18 FE jr hang_RAM_failure 4416/ 1942 : 4417/ 1942 : RAM_addr_fail: 4418/ 1942 : 3E F6 ld a, 0f6h ; RAM address fail test 4 + DONE 4419/ 1944 : D3 63 out (leds), a ; NOTE: LED pattern 0 = on here 4420/ 1946 : 3E FF ld a, 0ffh 4421/ 1948 : D3 67 out (monitor_U6), a 4422/ 194A : hang_RAM_addr_fail: 4423/ 194A : 18 FE jr hang_RAM_addr_fail 4424/ 194C : 4425/ 194C : ram_test_patterns: 4426/ 194C : FF db 0ffh 4427/ 194D : A5 db 0a5h 4428/ 194E : 5A db 05ah 4429/ 194F : 00 db 000h ; Last RAM test, leave it cleared 4430/ 1950 : 4431/ 1950 : do_phi_test: 4432/ 1950 : 3E 00 ld a, 0 ; PHI Test subtest 0 4433/ 1952 : 0E 0F ld c, 0fh 4434/ 1954 : CD D0 17 call update_monitor_leds 4435/ 1957 : AF xor a 4436/ 1958 : D3 13 out (phi_status), a ; D0D1 = 00 4437/ 195A : 3E 80 ld a, EIGHT_BIT_m 4438/ 195C : D3 14 out (phi_control), a 4439/ 195E : D3 14 out (phi_control), a ; why twice? 4440/ 1960 : ; I'm guessing so that D0D1 get pulled from phi_status, 4441/ 1960 : ; the first time they may be floating or random? 4442/ 1960 : ; Since D0D1 do not have documented meanings in phi_control, 4443/ 1960 : ; perhaps they found an issue with testing that requires it. 4444/ 1960 : 4445/ 1960 : ; set up Amigo identify response bytes 00h 81h (9895A) 4446/ 1960 : 3E 00 ld a, 0 4447/ 1962 : D3 16 out (phi_id1), a 4448/ 1964 : 3E 81 ld a, 81h 4449/ 1966 : D3 17 out (phi_id2), a 4450/ 1968 : 4451/ 1968 : AF xor a 4452/ 1969 : D3 13 out (phi_status), a ; D0D1 = 00 4453/ 196B : 3E 7F ld a, 7fh 4454/ 196D : D3 11 out (phi_int_mask), a ; disable interrupts, enable most interrupt conditions 4455/ 196F : AF xor a 4456/ 1970 : D3 13 out (phi_status), a ; D0D1 = 00 4457/ 1972 : 3E 20 ld a, 20h 4458/ 1974 : D3 15 out (phi_address), a ; listen always, offline (diag mode) 4459/ 1976 : 3E 41 ld a, 41h 4460/ 1978 : D3 10 out (phi_int_cond), a ; reset device clear and processor handshake abort bits 4461/ 197A : DB 10 .loop: in a, (phi_int_cond) ; clear out the inbound FIFO 4462/ 197C : CB 57 bit FIFO_BYTE, a 4463/ 197E : 28 04 jr z, .empty 4464/ 1980 : DB 12 in a, (phi_fifo) 4465/ 1982 : 18 F6 jr .loop 4466/ 1984 : 4467/ 1984 : ; Note: in the offline diag mode the PHI chip behaves as it is a self-contained 4468/ 1984 : ; HP-IB bus with a system controller and a device connected internal to the chip. 4469/ 1984 : ; When in this diag mode the chip assumes system controller status regardless 4470/ 1984 : ; of the state of the SCTRL pin. In diag mode the chip responds to address 30 (1eh). 4471/ 1984 : 4472/ 1984 : 3E 01 .empty: ld a, DATA_FRZ_m ; D0D1=00, reset outbound fifo freeze bit 4473/ 1986 : D3 13 out (phi_status), a 4474/ 1988 : 3E 10 ld a, 10h 4475/ 198A : D3 14 out (phi_control), a ; assert IFC (disable 8-bit processor mode??) 4476/ 198C : 3E 89 ld a, 89h 4477/ 198E : D3 14 out (phi_control), a ; 8-bit processor, respond to PPOL, init fifo 4478/ 1990 : 16 0A ld d, 0ah 4479/ 1992 : 0E 00 ld c, 0 4480/ 1994 : CD 1A 1A call rd_phi_int_cond_cp_cd ; FIFO room available and idle? 4481/ 1997 : 3E 40 ld a, 40h ; D0D1=01 (send interface commands) 4482/ 1999 : D3 13 out (phi_status), a 4483/ 199B : 3E 5F ld a, 5fh ; send UNT 4484/ 199D : D3 12 out (phi_fifo), a 4485/ 199F : 3E 7E ld a, 7eh ; send SAD MLA 4486/ 19A1 : D3 12 out (phi_fifo), a 4487/ 19A3 : 3E C0 ld a, 0c0h ; D0D1=11 4488/ 19A5 : D3 13 out (phi_status), a 4489/ 19A7 : 3E 02 ld a, 2 ; set "uncounted transfer" 2 bytes - read our own id bytes 4490/ 19A9 : D3 12 out (phi_fifo), a 4491/ 19AB : 06 01 ld b, 1 4492/ 19AD : CD 40 12 call delay ; delay 1 ms 4493/ 19B0 : 16 0E ld d, 0eh 4494/ 19B2 : CD 1A 1A call rd_phi_int_cond_cp_cd ; FIFO room available, bytes available and idle? 4495/ 19B5 : 0E 00 ld c, 0 4496/ 19B7 : 16 00 ld d, 0 4497/ 19B9 : CD 1E 1A call rd_phi_fifo_cp_cd ; first id byte matches? 4498/ 19BC : 0E C0 ld c, 0c0h 4499/ 19BE : 16 81 ld d, 81h 4500/ 19C0 : CD 1E 1A call rd_phi_fifo_cp_cd ; second id byte matches? 4501/ 19C3 : 0E 00 ld c, 0 4502/ 19C5 : 16 0A ld d, 0ah 4503/ 19C7 : CD 1A 1A call rd_phi_int_cond_cp_cd ; now FIFO room avilable and idle? (we read the fifo) 4504/ 19CA : AF xor a ; D0D1=00 4505/ 19CB : D3 13 out (phi_status), a 4506/ 19CD : D3 15 out (phi_address), a ; reset listen always, offline 4507/ 19CF : 3E 40 ld a, 40h 4508/ 19D1 : D3 13 out (phi_status), a ; D0D1=01 (send interface commands) 4509/ 19D3 : 3E 3F ld a, 3fh ; send UNL 4510/ 19D5 : D3 12 out (phi_fifo), a 4511/ 19D7 : 3E 49 ld a, 49h ; send TALK 9? 4512/ 19D9 : D3 12 out (phi_fifo), a 4513/ 19DB : 3E 09 ld a, 9 ; send TCT (take control) 4514/ 19DD : D3 12 out (phi_fifo), a 4515/ 19DF : CD 1A 1A call rd_phi_int_cond_cp_cd ; FIFO room available, device clear? 4516/ 19E2 : AF xor a ; D0D1=00 4517/ 19E3 : D3 13 out (phi_status), a 4518/ 19E5 : 3E 40 ld a, 40h ; Talk always 4519/ 19E7 : D3 15 out (phi_address), a 4520/ 19E9 : 3E 60 ld a, 60h ; Talks always, listen always 4521/ 19EB : D3 15 out (phi_address), a 4522/ 19ED : 3E FF ld a, 0ffh ; send 16 bytes to the outbound FIFO (fill both FIFOs) 4523/ 19EF : 06 10 ld b, 10h ; verifies handshaking 4524/ 19F1 : D3 12 x19f1: out (phi_fifo), a 4525/ 19F3 : 3D dec a 4526/ 19F4 : 10 FB djnz x19f1 4527/ 19F6 : 0E 00 ld c, 0 4528/ 19F8 : 16 04 ld d, 4 4529/ 19FA : CD 1A 1A call rd_phi_int_cond_cp_cd ; FIFO bytes available? 4530/ 19FD : 4531/ 19FD : 0E 00 ld c, 0 ; Read the 16 bytes from the inbound FIFO 4532/ 19FF : 16 FF ld d, 0ffh 4533/ 1A01 : 06 10 ld b, 10h 4534/ 1A03 : CD 1E 1A x1a03: call rd_phi_fifo_cp_cd ; Does each byte match? 4535/ 1A06 : 15 dec d 4536/ 1A07 : 10 FA djnz x1a03 4537/ 1A09 : 4538/ 1A09 : 0E 00 ld c, 0 4539/ 1A0B : 16 0A ld d, 0ah 4540/ 1A0D : CD 1A 1A call rd_phi_int_cond_cp_cd ; FIFO room available, idle? 4541/ 1A10 : 4542/ 1A10 : AF xor a ; D0D1=00 4543/ 1A11 : D3 13 out (phi_status), a 4544/ 1A13 : 3E 81 ld a, 81h ; set 8-bit processor and initialize outbound FIFO 4545/ 1A15 : D3 14 out (phi_control), a 4546/ 1A17 : 4547/ 1A17 : C3 41 17 jp x1741 4548/ 1A1A : 4549/ 1A1A : 4550/ 1A1A : rd_phi_int_cond_cp_cd: 4551/ 1A1A : DB 10 in a, (phi_int_cond) 4552/ 1A1C : 18 02 jr x1a20 4553/ 1A1E : 4554/ 1A1E : rd_phi_fifo_cp_cd: 4555/ 1A1E : DB 12 in a, (phi_fifo) 4556/ 1A20 : BA x1a20: cp d 4557/ 1A21 : hang_phi_reg_miscompare: 4558/ 1A21 : 20 FE jr nz, hang_phi_reg_miscompare 4559/ 1A23 : 4560/ 1A23 : DB 13 in a, (phi_status) ; check high order bits 4561/ 1A25 : E6 C0 and 0c0h 4562/ 1A27 : B9 cp c 4563/ 1A28 : 20 FE x1a28: jr nz, x1a28 4564/ 1A2A : C9 ret 4565/ 1A2B : 4566/ 1A2B : timeout_bit_test: 4567/ 1A2B : 3E 00 ld a, 0 ; reset subtest 4568/ 1A2D : 0E 11 ld c, 11h ; Time-out bit test 4569/ 1A2F : CD D0 17 call update_monitor_leds 4570/ 1A32 : 3A 13 60 ld a, (test_flags) 4571/ 1A35 : E6 03 and 3 ; Low two bits indicate what? 4572/ 1A37 : 20 04 jr nz, x1a3d 4573/ 1A39 : FD CB 13 CE set 1, (iy + YB(test_flags)) 4574/ 1A3D : 06 FA x1a3d: ld b, 250 4575/ 1A3F : 3E 01 ld a, r_TIMEOUT_m 4576/ 1A41 : D3 62 out (reset), a ; reset TIMEOUT 4577/ 1A43 : CD 40 12 call delay ; delay 250 ms 4578/ 1A46 : D3 62 out (reset), a ; reset TIMEOUT 4579/ 1A48 : CD 40 12 call delay ; delay 256 ms 4580/ 1A4B : D3 62 out (reset), a ; reset TIMEOUT 4581/ 1A4D : CD 40 12 call delay ; delay 256 ms 4582/ 1A50 : 06 64 ld b, 100 4583/ 1A52 : CD 40 12 call delay ; delay 100 ms 4584/ 1A55 : DB 63 in a, (switches) 4585/ 1A57 : CB 77 bit TIMEOUT, a 4586/ 1A59 : C2 3D 1F jp nz, tsterr_st0 ; timeout high when it should be low ST 0 4587/ 1A5C : CD 40 12 call delay ; delay 256 ms (B=0 here) 4588/ 1A5F : 06 FA ld b, 250 4589/ 1A61 : CD 40 12 call delay ; delay 250 ms 4590/ 1A64 : DB 63 in a, (switches) 4591/ 1A66 : CB 77 bit TIMEOUT, a 4592/ 1A68 : CA 3E 1F jp z, tsterr_st1 ; timeout low when it should be high ST 1 4593/ 1A6B : C9 ret 4594/ 1A6C : 4595/ 1A6C : overrun_bit_test: 4596/ 1A6C : 3E 00 ld a, 0 ; reset subtest 4597/ 1A6E : 0E 11 ld c, 11h ; Overrun bit test 4598/ 1A70 : CD D0 17 call update_monitor_leds 4599/ 1A73 : AF xor a 4600/ 1A74 : D3 66 out (xv), a ; deselect all drives 4601/ 1A76 : 3E 04 ld a, WRITON_m 4602/ 1A78 : D3 64 out (cntl), a ; WRITON but not WRITDRV 4603/ 1A7A : D3 60 out (data), a ; set a data byte (value unimportant) 4604/ 1A7C : 3E 02 ld a, r_OVERUN_m 4605/ 1A7E : D3 62 out (reset), a ; reset OVERUN 4606/ 1A80 : DB 62 in a, (drv_status) 4607/ 1A82 : CB 77 bit OVERUN, a 4608/ 1A84 : C2 3F 1F jp nz, tsterr_st2 ; overrun high when it should be low ST 2 4609/ 1A87 : 06 0A ld b, 0ah 4610/ 1A89 : 10 FE .loop: djnz .loop 4611/ 1A8B : DB 62 in a, (drv_status) 4612/ 1A8D : CB 77 bit OVERUN, a 4613/ 1A8F : CA 40 1F jp z, tsterr_st3 ; overrun low when it should be high ST 3 4614/ 1A92 : AF xor a 4615/ 1A93 : D3 64 out (cntl), a 4616/ 1A95 : C9 ret 4617/ 1A96 : 4618/ 1A96 : ibm_data_loop_test: 4619/ 1A96 : 3E 40 ld a, TIMEOUT_m 4620/ 1A98 : D3 62 out (reset), a 4621/ 1A9A : 3E 00 ld a, 0 ; IBM Data Loop Test ST 1 4622/ 1A9C : 0E 13 ld c, 13h 4623/ 1A9E : CD D0 17 call update_monitor_leds 4624/ 1AA1 : 3E 06 ld a, WRITON_m | CRCON_m 4625/ 1AA3 : D3 64 out (cntl), a 4626/ 1AA5 : 3E E7 ld a, 0e7h 4627/ 1AA7 : D3 61 out (clock), a 4628/ 1AA9 : 3E CA ld a, 0cah 4629/ 1AAB : D3 60 out (data), a 4630/ 1AAD : DB 60 in a, (data) 4631/ 1AAF : FE CA cp 0cah 4632/ 1AB1 : C2 3D 1F jp nz, tsterr_st0 ; data byte read error 4633/ 1AB4 : DB 61 in a, (clock) 4634/ 1AB6 : FE E7 cp 0e7h 4635/ 1AB8 : C2 3E 1F jp nz, tsterr_st1 ; clock byte read error 4636/ 1ABB : AF xor a 4637/ 1ABC : D3 64 out (cntl), a 4638/ 1ABE : C9 ret 4639/ 1ABF : 4640/ 1ABF : hp_data_loop_test: 4641/ 1ABF : 3E 40 ld a, TIMEOUT_m 4642/ 1AC1 : D3 62 out (reset), a 4643/ 1AC3 : 3E 00 ld a, 0 ; HP Data Loop Test 4644/ 1AC5 : 0E 13 ld c, 13h 4645/ 1AC7 : CD D0 17 call update_monitor_leds 4646/ 1ACA : 3E 10 ld a, HIDEN_m 4647/ 1ACC : D3 66 out (xv), a 4648/ 1ACE : 2E 00 ld l, 0 ; normal clock for the AM byte? 4649/ 1AD0 : CD F3 1A call .dotest 4650/ 1AD3 : 20 11 jr nz, .failed 4651/ 1AD5 : 7D ld a, l 4652/ 1AD6 : FE 28 cp 28h ; did the clock register have the right value? 4653/ 1AD8 : C2 40 1F jp nz, tsterr_st3 ; no, HP Data Loop Test ST 3 failed clock byte read 4654/ 1ADB : 2E 38 ld l, 38h ; poison the clock for the AM byte? 4655/ 1ADD : CD F3 1A call .dotest 4656/ 1AE0 : 20 04 jr nz, .failed 4657/ 1AE2 : AF xor a 4658/ 1AE3 : D3 64 out (cntl), a ; turn off stuff 4659/ 1AE5 : C9 ret 4660/ 1AE6 : 4661/ 1AE6 : .failed: 4662/ 1AE6 : CB 5F bit 3, a 4663/ 1AE8 : C2 41 1F jp nz, tsterr_st4 ; Address Mark Test ST 4 failed AM on when it should be off 4664/ 1AEB : CB 57 bit 2, a 4665/ 1AED : C2 42 1F jp nz, tsterr_st5 ; Address Mark Test ST 5 failed AM off when it should be on 4666/ 1AF0 : C3 3F 1F jp tsterr_st2 ; HP Data Loop Test ST 2 failed data byte read? 4667/ 1AF3 : 4668/ 1AF3 : ; on entry: 4669/ 1AF3 : ; L: clock register value to use with the AM byte 4670/ 1AF3 : ; 4671/ 1AF3 : ; on exit: 4672/ 1AF3 : ; Z: success 4673/ 1AF3 : ; L: clock register value when the AM was read 4674/ 1AF3 : .dotest: 4675/ 1AF3 : AF xor a ; A = 0 4676/ 1AF4 : D3 64 out (cntl), a 4677/ 1AF6 : D3 61 out (clock), a 4678/ 1AF8 : 3E 06 ld a, WRITON_m | CRCON_m 4679/ 1AFA : D3 64 out (cntl), a 4680/ 1AFC : 3E CC ld a, 0cch 4681/ 1AFE : D3 60 out (data), a 4682/ 1B00 : 06 02 ld b, 2 4683/ 1B02 : 0E 60 ld c, data 4684/ 1B04 : 16 FF ld d, 0ffh ; clock sync preamble? 4685/ 1B06 : 1E 50 ld e, HP_DATA_AM_DPAT 4686/ 1B08 : ED 51 .loop: out (c), d 4687/ 1B0A : 10 FC djnz .loop 4688/ 1B0C : 3E 26 ld a, READON_m | WRITON_m | CRCON_m 4689/ 1B0E : D3 64 out (cntl), a 4690/ 1B10 : ED 51 out (c), d 4691/ 1B12 : ED 51 out (c), d 4692/ 1B14 : DB 63 in a, (switches) 4693/ 1B16 : E6 80 and AMDT_m 4694/ 1B18 : 20 27 jr nz, .set_a_bit_3 ; st 4 failed 4695/ 1B1A : 7D ld a, l 4696/ 1B1B : D3 61 out (clock), a ; write the callers clock value 4697/ 1B1D : ED 59 out (c), e ; write address mark byte 4698/ 1B1F : DB 63 in a, (switches) 4699/ 1B21 : ED 40 in b, (c) ; read data register 4700/ 1B23 : 67 ld h, a 4701/ 1B24 : DB 61 in a, (clock) 4702/ 1B26 : 6F ld l, a 4703/ 1B27 : AF xor a 4704/ 1B28 : D3 61 out (clock), a 4705/ 1B2A : ED 59 out (c), e 4706/ 1B2C : CB 7C bit AMDT, h 4707/ 1B2E : 28 15 jr z, .set_a_bit_2 ; st 5 failed 4708/ 1B30 : 78 ld a, b 4709/ 1B31 : FE 43 cp 43h 4710/ 1B33 : 20 14 jr nz, .set_a_bit_0 ; st 2 failed 4711/ 1B35 : ED 59 out (c), e 4712/ 1B37 : 3E 06 ld a, WRITON_m | CRCON_m 4713/ 1B39 : D3 64 out (cntl), a 4714/ 1B3B : AF xor a ; A = 0 4715/ 1B3C : E6 FF .ret: and 0ffh 4716/ 1B3E : ED 59 out (c), e 4717/ 1B40 : C9 ret 4718/ 1B41 : 4719/ 1B41 : .set_a_bit_3: 4720/ 1B41 : 3E 08 ld a, 8 4721/ 1B43 : 18 F7 jr .ret 4722/ 1B45 : 4723/ 1B45 : .set_a_bit_2: 4724/ 1B45 : 3E 04 ld a, 4 4725/ 1B47 : 18 F3 jr .ret 4726/ 1B49 : 4727/ 1B49 : .set_a_bit_0 4728/ 1B49 : 3E 01 ld a, 1 4729/ 1B4B : 18 EF jr .ret 4730/ 1B4D : 4731/ 1B4D : crc_test: 4732/ 1B4D : 3E 01 ld a, 1 ; reset TIMEOUT 4733/ 1B4F : D3 62 out (reset), a 4734/ 1B51 : 3E 00 ld a, 0 ; CRC Test ST 0 4735/ 1B53 : 0E 15 ld c, 15h 4736/ 1B55 : CD D0 17 call update_monitor_leds 4737/ 1B58 : AF xor a 4738/ 1B59 : D3 66 out (xv), a 4739/ 1B5B : 3E 04 ld a, 4 4740/ 1B5D : D3 64 out (cntl), a 4741/ 1B5F : D3 60 out (data), a 4742/ 1B61 : 3E 24 ld a, 24h 4743/ 1B63 : D3 64 out (cntl), a 4744/ 1B65 : 3E 5C ld a, 5ch 4745/ 1B67 : D3 60 out (data), a 4746/ 1B69 : DB 62 in a, (drv_status) 4747/ 1B6B : CB 6F bit 5, a 4748/ 1B6D : CA 3D 1F jp z, tsterr_st0 4749/ 1B70 : 3E 56 ld a, 56h 4750/ 1B72 : D3 60 out (data), a 4751/ 1B74 : 3E 36 ld a, 36h 4752/ 1B76 : D3 64 out (cntl), a 4753/ 1B78 : DB 60 in a, (data) 4754/ 1B7A : DB 60 in a, (data) 4755/ 1B7C : FE 6C cp 6ch 4756/ 1B7E : C2 3E 1F jp nz, tsterr_st1 4757/ 1B81 : DB 60 in a, (data) 4758/ 1B83 : FE EE cp 0eeh 4759/ 1B85 : C2 3E 1F jp nz, tsterr_st1 4760/ 1B88 : DB 62 in a, (drv_status) 4761/ 1B8A : CB 6F bit 5, a 4762/ 1B8C : C2 3F 1F jp nz, tsterr_st2 4763/ 1B8F : AF xor a 4764/ 1B90 : D3 64 out (cntl), a 4765/ 1B92 : 3A 13 60 ld a, (test_flags) 4766/ 1B95 : 3D dec a 4767/ 1B96 : 32 13 60 ld (test_flags), a 4768/ 1B99 : E6 03 and 3 4769/ 1B9B : 20 01 jr nz, reset_test_jump_table_ptr 4770/ 1B9D : C9 ret 4771/ 1B9E : 4772/ 1B9E : reset_test_jump_table_ptr: 4773/ 1B9E : 21 B2 17 ld hl, test_jmptbl 4774/ 1BA1 : 22 15 60 ld (test_jmptbl_ptr), hl 4775/ 1BA4 : C9 ret 4776/ 1BA5 : 4777/ 1BA5 : seek_recalibrate_test: 4778/ 1BA5 : 3A 03 60 ld a, (current_unit) 4779/ 1BA8 : CD 1A 15 call prep_drive_regs 4780/ 1BAB : 3A 03 60 ld a, (current_unit) 4781/ 1BAE : 07 rlca 4782/ 1BAF : 07 rlca 4783/ 1BB0 : 07 rlca 4784/ 1BB1 : 07 rlca 4785/ 1BB2 : 0E 17 ld c, 17h 4786/ 1BB4 : CD D0 17 call update_monitor_leds 4787/ 1BB7 : 3A 46 60 ld a, (cmd_count) 4788/ 1BBA : DD A6 09 and (ix + DriveData.xv) 4789/ 1BBD : 28 07 jr z, x1bc6 4790/ 1BBF : 21 C8 17 ld hl, test_1e9c_ptr 4791/ 1BC2 : 22 15 60 ld (test_jmptbl_ptr), hl 4792/ 1BC5 : C9 ret 4793/ 1BC6 : 4794/ 1BC6 : FD CB 13 EE x1bc6: set 5, (iy + YB(test_flags)) 4795/ 1BCA : FD CB 13 66 bit 4, (iy + YB(test_flags)) 4796/ 1BCE : 28 05 jr z, x1bd5 4797/ 1BD0 : 3A 14 60 ld a, (current_head) 4798/ 1BD3 : B7 or a 4799/ 1BD4 : C0 ret nz 4800/ 1BD5 : (MACRO) x1bd5: reset_drive 4800/ 1BD5 : CF rst 08h 4801/ 1BD6 : C2 40 1F jp nz, tsterr_st3 4802/ 1BD9 : CD B7 15 call load_head_ix 4803/ 1BDC : 0E 00 ld c, 0 4804/ 1BDE : 06 4C ld b, 4ch 4805/ 1BE0 : CD 15 1C call x1c15 4806/ 1BE3 : C2 41 1F jp nz, tsterr_st4 4807/ 1BE6 : CD AD 17 call delay_20ms 4808/ 1BE9 : 0D dec c 4809/ 1BEA : 06 4B ld b, 4bh 4810/ 1BEC : CD 15 1C call x1c15 4811/ 1BEF : C2 42 1F jp nz, tsterr_st5 4812/ 1BF2 : 06 01 ld b, 1 4813/ 1BF4 : CD 15 1C call x1c15 4814/ 1BF7 : CA 43 1F jp z, tsterr_st6 4815/ 1BFA : FD CB 13 66 bit 4, (iy + YB(test_flags)) 4816/ 1BFE : C0 ret nz 4817/ 1BFF : AF xor a 4818/ 1C00 : 4F ld c, a 4819/ 1C01 : FD 46 14 ld b, (iy +14h) 4820/ 1C04 : DD 70 00 ld (ix + DriveData.physical_cylinder), b 4821/ 1C07 : B8 cp b 4822/ 1C08 : C8 ret z 4823/ 1C09 : C5 push bc 4824/ 1C0A : CD AD 17 call delay_20ms 4825/ 1C0D : C1 pop bc 4826/ 1C0E : CD 15 1C call x1c15 4827/ 1C11 : C2 41 1F jp nz, tsterr_st4 4828/ 1C14 : C8 ret z 4829/ 1C15 : 4830/ 1C15 : CD 1B 00 x1c15: call step_drive_jv 4831/ 1C18 : DB 62 in a, (drv_status) 4832/ 1C1A : CB 57 bit 2, a ; reached track 0? 4833/ 1C1C : C0 ret nz ; yes 4834/ 1C1D : 10 F6 djnz x1c15 4835/ 1C1F : C9 ret 4836/ 1C20 : 4837/ 1C20 : rotational_timing_test: 4838/ 1C20 : 3A 08 60 ld a, (monitor_U6_shdw) 4839/ 1C23 : 0E 19 ld c, 19h 4840/ 1C25 : CD D0 17 call update_monitor_leds 4841/ 1C28 : DB 62 in a, (drv_status) 4842/ 1C2A : CB 67 bit 4, a 4843/ 1C2C : C8 ret z 4844/ 1C2D : AF xor a 4845/ 1C2E : 0E 62 ld c, 62h 4846/ 1C30 : CD 49 1C call x1c49 4847/ 1C33 : CA 3D 1F jp z, tsterr_st0 4848/ 1C36 : CD 49 1C call x1c49 4849/ 1C39 : 01 E8 31 ld bc, 031e8h 4850/ 1C3C : 11 87 2E ld de, 02e87h 4851/ 1C3F : CD 64 1C call x1c64 4852/ 1C42 : C8 ret z 4853/ 1C43 : FA 3E 1F jp m, tsterr_st1 4854/ 1C46 : F2 3F 1F jp p, tsterr_st2 4855/ 1C49 : 6F x1c49: ld l, a 4856/ 1C4A : 67 ld h, a 4857/ 1C4B : 23 x1c4b: inc hl 4858/ 1C4C : BD cp l 4859/ 1C4D : 20 02 jr nz, x1c51 4860/ 1C4F : BC cp h 4861/ 1C50 : C8 ret z 4862/ 1C51 : ED 40 x1c51: in b, (c) 4863/ 1C53 : CB 40 bit 0, b 4864/ 1C55 : 20 F4 jr nz, x1c4b 4865/ 1C57 : 23 x1c57: inc hl 4866/ 1C58 : BD cp l 4867/ 1C59 : 20 02 jr nz, x1c5d 4868/ 1C5B : BC cp h 4869/ 1C5C : C8 ret z 4870/ 1C5D : ED 40 x1c5d: in b, (c) 4871/ 1C5F : CB 40 bit 0, b 4872/ 1C61 : 28 F4 jr z, x1c57 4873/ 1C63 : C9 ret 4874/ 1C64 : 4875/ 1C64 : E5 x1c64: push hl 4876/ 1C65 : 37 scf 4877/ 1C66 : 3F ccf 4878/ 1C67 : ED 42 sbc hl, bc 4879/ 1C69 : E1 pop hl 4880/ 1C6A : F0 ret p 4881/ 1C6B : E5 push hl 4882/ 1C6C : 37 scf 4883/ 1C6D : 3F ccf 4884/ 1C6E : ED 52 sbc hl, de 4885/ 1C70 : E1 pop hl 4886/ 1C71 : F8 ret m 4887/ 1C72 : AF xor a 4888/ 1C73 : C9 ret 4889/ 1C74 : 4890/ 1C74 : write_test: 4891/ 1C74 : 3A 08 60 ld a, (monitor_U6_shdw) 4892/ 1C77 : 0E 1B ld c, 1bh 4893/ 1C79 : CD D0 17 call update_monitor_leds 4894/ 1C7C : FD CB 13 5E bit 3, (iy + YB(test_flags)) 4895/ 1C80 : 20 07 jr nz, x1c89 4896/ 1C82 : 21 C6 17 ld hl, read_test_ptr 4897/ 1C85 : 22 15 60 ld (test_jmptbl_ptr), hl 4898/ 1C88 : C9 ret 4899/ 1C89 : 4900/ 1C89 : DB 62 x1c89: in a, (drv_status) 4901/ 1C8B : CB 67 bit 4, a 4902/ 1C8D : CA 3E 1F jp z, tsterr_st1 4903/ 1C90 : CB 5F bit 3, a 4904/ 1C92 : C2 3F 1F jp nz, tsterr_st2 4905/ 1C95 : FD CB 13 66 bit 4, (iy + YB(test_flags)) 4906/ 1C99 : C8 ret z 4907/ 1C9A : 3A 14 60 ld a, (current_head) 4908/ 1C9D : E6 7F and BYTENOT(HEAD1_m) 4909/ 1C9F : DD 77 00 ld (ix + DriveData.physical_cylinder), a 4910/ 1CA2 : C8 ret z 4911/ 1CA3 : 0E 01 ld c, 1 4912/ 1CA5 : CD 1B 00 call step_drive_jv 4913/ 1CA8 : C3 AD 17 jp delay_20ms 4914/ 1CAB : 4915/ 1CAB : write_test_part2: 4916/ 1CAB : 3A 08 60 ld a, (monitor_U6_shdw) 4917/ 1CAE : 0E 1B ld c, 1bh 4918/ 1CB0 : CD D0 17 call update_monitor_leds 4919/ 1CB3 : CD 64 1D call sel_head_0 4920/ 1CB6 : CD 47 1D call x1d47 4921/ 1CB9 : CD 60 00 call fmt_ibm_track_jv 4922/ 1CBC : C2 3D 1F jp nz, tsterr_st0 4923/ 1CBF : 3A 08 60 ld a, (monitor_U6_shdw) 4924/ 1CC2 : 0E 1D ld c, 1dh 4925/ 1CC4 : CD D0 17 call update_monitor_leds 4926/ 1CC7 : 0E 40 ld c, 40h 4927/ 1CC9 : 06 01 ld b, 1 4928/ 1CCB : CD 98 1D x1ccb: call x1d98 4929/ 1CCE : CD D4 1C call x1cd4 4930/ 1CD1 : 20 F8 jr nz, x1ccb 4931/ 1CD3 : C9 ret 4932/ 1CD4 : 4933/ 1CD4 : 04 x1cd4: inc b 4934/ 1CD5 : 78 ld a, b 4935/ 1CD6 : FE 1B cp 1bh 4936/ 1CD8 : C9 ret 4937/ 1CD9 : 4938/ 1CD9 : write_test_part3: 4939/ 1CD9 : 3A 08 60 ld a, (monitor_U6_shdw) 4940/ 1CDC : CB DF set 3, a 4941/ 1CDE : 0E 1B ld c, 1bh 4942/ 1CE0 : CD D0 17 call update_monitor_leds 4943/ 1CE3 : CD 64 1D call sel_head_0 4944/ 1CE6 : CD 37 1D call x1d37 4945/ 1CE9 : CD 5D 00 call fmt_hp_track 4946/ 1CEC : C2 3D 1F jp nz, tsterr_st0 4947/ 1CEF : DD 5E 05 ld e, (ix + DriveData.stat2) 4948/ 1CF2 : DD 56 06 ld d, (ix + DriveData.stat2_ds) 4949/ 1CF5 : CD 83 16 call get_double_sided_bit 4950/ 1CF8 : 28 18 jr z, x1d12 4951/ 1CFA : CD 6E 1D call sel_head_1 4952/ 1CFD : DD CB 05 DE set DT_DS, (ix + DriveData.stat2) 4953/ 1D01 : CD DD 17 call led_data_to_a_c ; A = monitor_U6_shdw 4954/ 1D04 : CB F7 set HEAD, a ; turn on head LED on monitor board 4955/ 1D06 : CD D0 17 call update_monitor_leds 4956/ 1D09 : CD 37 1D call x1d37 4957/ 1D0C : CD 5D 00 call fmt_hp_track 4958/ 1D0F : C2 3D 1F jp nz, tsterr_st0 4959/ 1D12 : 26 00 x1d12: ld h, 0 4960/ 1D14 : CD 78 1D call x1d78 4961/ 1D17 : CD 98 1D x1d17: call x1d98 4962/ 1D1A : CD 32 1D call x1d32 4963/ 1D1D : 20 F8 jr nz, x1d17 4964/ 1D1F : 26 40 ld h, 40h 4965/ 1D21 : CD 78 1D call x1d78 4966/ 1D24 : C8 ret z 4967/ 1D25 : CD 98 1D x1d25: call x1d98 4968/ 1D28 : CD 32 1D call x1d32 4969/ 1D2B : 20 F8 jr nz, x1d25 4970/ 1D2D : FD CB 14 BE res 7, (iy + 14h) 4971/ 1D31 : C9 ret 4972/ 1D32 : 4973/ 1D32 : 04 x1d32: inc b 4974/ 1D33 : 78 ld a, b 4975/ 1D34 : FE 1E cp 1eh 4976/ 1D36 : C9 ret 4977/ 1D37 : 4978/ 1D37 : DD 7E 05 x1d37: ld a, (ix + DriveData.stat2) 4979/ 1D3A : E6 ED and 0edh 4980/ 1D3C : CB D7 set 2, a 4981/ 1D3E : DD 77 05 ld (ix + DriveData.stat2), a 4982/ 1D41 : 1E 70 ld e, HP_ID_AM_DPAT 4983/ 1D43 : 16 C6 ld d, 0c6h 4984/ 1D45 : 18 0C jr x1d53 4985/ 1D47 : 4986/ 1D47 : DD 7E 05 x1d47: ld a, (ix + DriveData.stat2) 4987/ 1D4A : E6 F9 and ~(DT_HP_m | DT_BLANK_m) ; why not DT_DS_m also? 4988/ 1D4C : CB E7 set DT_IBM, a 4989/ 1D4E : DD 77 05 ld (ix + DriveData.stat2), a 4990/ 1D51 : 16 40 ld d, 40h 4991/ 1D53 : 3A 03 60 x1d53: ld a, (current_unit) 4992/ 1D56 : CD 1A 15 call prep_drive_regs 4993/ 1D59 : 06 01 ld b, 1 4994/ 1D5B : 3A 14 60 ld a, (current_head) 4995/ 1D5E : 4F ld c, a 4996/ 1D5F : AF xor a 4997/ 1D60 : 32 12 60 ld (format_flags), a 4998/ 1D63 : C9 ret 4999/ 1D64 : 5000/ 1D64 : ;x1d64: 5001/ 1D64 : sel_head_0: 5002/ 1D64 : DD CB 04 BE res HEAD1, (ix + DriveData.drv) 5003/ 1D68 : FD CB 14 BE res HEAD1, (iy + YB(current_head)) 5004/ 1D6C : 18 08 jr sel_head_common 5005/ 1D6E : 5006/ 1D6E : sel_head_1: 5007/ 1D6E : DD CB 04 FE set HEAD1, (ix + DriveData.drv) 5008/ 1D72 : FD CB 14 FE set HEAD1, (iy + YB(current_head)) 5009/ 1D76 : 5010/ 1D76 : sel_head_common: 5011/ 1D76 : (MACRO) deassert_in_use 5011/ 1D76 : F7 rst 30h 5012/ 1D77 : C9 ret 5013/ 1D78 : 5014/ 1D78 : 3A 08 60 x1d78: ld a, (monitor_U6_shdw) 5015/ 1D7B : CB B7 res 6, a 5016/ 1D7D : B4 or h 5017/ 1D7E : 0E 1D ld c, 1dh 5018/ 1D80 : CD D0 17 call update_monitor_leds 5019/ 1D83 : 06 00 ld b, 0 5020/ 1D85 : 0E C6 ld c, 0c6h 5021/ 1D87 : CB 74 bit 6, h 5022/ 1D89 : 20 03 jr nz, x1d8e 5023/ 1D8B : C3 64 1D jp sel_head_0 5024/ 1D8E : 5025/ 1D8E : DD CB 05 5E x1d8e: bit 3, (ix + DriveData.stat2) 5026/ 1D92 : C8 ret z 5027/ 1D93 : CD 6E 1D call sel_head_1 5028/ 1D96 : B7 or a 5029/ 1D97 : C9 ret 5030/ 1D98 : 5031/ 1D98 : DD 70 03 x1d98: ld (ix + DriveData.sector), b 5032/ 1D9B : 3A 14 60 ld a, (current_head) 5033/ 1D9E : DD 77 02 ld (ix + DriveData.target_cyl_hd), a 5034/ 1DA1 : 21 7F F0 ld hl, 0f07fh 5035/ 1DA4 : DB 63 in a, (switches) 5036/ 1DA6 : CB 5F bit 3, a 5037/ 1DA8 : 28 04 jr z, x1dae 5038/ 1DAA : DD CB 04 D6 set 2, (ix + DriveData.drv) 5039/ 1DAE : C5 x1dae: push bc 5040/ 1DAF : CD 2B 00 call read_sector_jv 5041/ 1DB2 : C1 pop bc 5042/ 1DB3 : 7B ld a, e 5043/ 1DB4 : A5 and l 5044/ 1DB5 : 5F ld e, a 5045/ 1DB6 : E1 pop hl 5046/ 1DB7 : CB 63 bit 4, e 5047/ 1DB9 : C2 3D 1F jp nz, tsterr_st0 5048/ 1DBC : CB 5B bit 3, e 5049/ 1DBE : 20 0D jr nz, x1dcd 5050/ 1DC0 : CB 43 bit 0, e 5051/ 1DC2 : CA 3E 1F jp z, tsterr_st1 5052/ 1DC5 : CB 42 bit 0, d 5053/ 1DC7 : CA 3F 1F jp z, tsterr_st2 5054/ 1DCA : C3 40 1F jp tsterr_st3 5055/ 1DCD : 5056/ 1DCD : CB 4B x1dcd: bit 1, e 5057/ 1DCF : C2 41 1F jp nz, tsterr_st4 5058/ 1DD2 : CB 6B bit 5, e 5059/ 1DD4 : 28 0A jr z, x1de0 5060/ 1DD6 : DD CB 04 56 bit 2, (ix + DriveData.drv) 5061/ 1DDA : C2 45 1F jp nz, tsterr 5062/ 1DDD : C3 42 1F jp tsterr_st5 5063/ 1DE0 : 5064/ 1DE0 : C3 CB 1F x1de0: jp x1fcb 5065/ 1DE3 : 5066/ 1DE3 : read_test: 5067/ 1DE3 : FD CB 13 5E bit WR_TEST_ACTIVE, (iy + YB(test_flags)) 5068/ 1DE7 : C0 ret nz 5069/ 1DE8 : DB 63 in a, (switches) 5070/ 1DEA : CB 67 bit SELFTEST, a 5071/ 1DEC : C8 ret z ; self test SW not on, return 5072/ 1DED : 3A 08 60 ld a, (monitor_U6_shdw) 5073/ 1DF0 : CB B7 res HEAD, a 5074/ 1DF2 : CB CF set 1, a ; indicate running read-only subtests 5075/ 1DF4 : 0E 1D ld c, 1dh ; read test 5076/ 1DF6 : CD D0 17 call update_monitor_leds 5077/ 1DF9 : DB 62 in a, (drv_status) 5078/ 1DFB : CB 67 bit READY, a 5079/ 1DFD : CA 40 1F jp z, tsterr_st3 5080/ 1E00 : AF xor a 5081/ 1E01 : DD BE 05 cp (ix + DriveData.stat2) 5082/ 1E04 : 20 11 jr nz, .skipmtc 5083/ 1E06 : 57 ld d, a ; init DE for media type check 5084/ 1E07 : 5F ld e, a 5085/ 1E08 : CD 83 16 call get_double_sided_bit ; e: DriveData.stat2 5086/ 1E0B : CD 8D 16 call media_type_check 5087/ 1E0E : C2 3D 1F jp nz, tsterr_st0 5088/ 1E11 : DD 73 05 ld (ix + DriveData.stat2), e ; remember what we learned 5089/ 1E14 : DD 72 06 ld (ix + DriveData.stat2_ds), d 5090/ 1E17 : .skipmtc: 5091/ 1E17 : DD CB 05 4E bit 1, (ix + DriveData.stat2) 5092/ 1E1B : C2 3E 1F jp nz, tsterr_st1 5093/ 1E1E : 3A 03 60 ld a, (current_unit) 5094/ 1E21 : CD 1A 15 call prep_drive_regs 5095/ 1E24 : FD CB 14 BE res 7, (iy +14h) 5096/ 1E28 : CD 95 1E call x1e95 5097/ 1E2B : CD 6A 00 call seek_to_cylinder_jv 5098/ 1E2E : 28 06 jr z, x1e36 5099/ 1E30 : D2 3F 1F x1e30: jp nc, tsterr_st2 5100/ 1E33 : DA 3D 1F jp c, tsterr_st0 5101/ 1E36 : FD CB 09 46 x1e36: bit 0, (iy + YB(disc_format)) 5102/ 1E3A : 20 44 jr nz, x1e80 5103/ 1E3C : CD DD 17 call led_data_to_a_c 5104/ 1E3F : CB DF set 3, a 5105/ 1E41 : E6 BD and 0bdh 5106/ 1E43 : CD D0 17 call update_monitor_leds 5107/ 1E46 : 06 00 ld b, 0 5108/ 1E48 : CD 98 1D x1e48: call x1d98 5109/ 1E4B : CD 32 1D call x1d32 5110/ 1E4E : 20 F8 jr nz, x1e48 5111/ 1E50 : DD CB 05 5E bit 3, (ix + DriveData.stat2) 5112/ 1E54 : C8 ret z 5113/ 1E55 : CD DD 17 call led_data_to_a_c 5114/ 1E58 : F6 42 or 42h 5115/ 1E5A : CD D0 17 call update_monitor_leds 5116/ 1E5D : FD CB 14 FE set 7, (iy +14h) 5117/ 1E61 : CD 95 1E call x1e95 5118/ 1E64 : CD 6A 00 call seek_to_cylinder_jv 5119/ 1E67 : 20 C7 jr nz, x1e30 5120/ 1E69 : CD DD 17 call led_data_to_a_c 5121/ 1E6C : CB 8F res 1, a 5122/ 1E6E : CD D0 17 call update_monitor_leds 5123/ 1E71 : 06 00 ld b, 0 5124/ 1E73 : CD 98 1D x1e73: call x1d98 5125/ 1E76 : CD 32 1D call x1d32 5126/ 1E79 : 20 F8 jr nz, x1e73 5127/ 1E7B : FD CB 14 BE res 7, (iy +14h) 5128/ 1E7F : C9 ret 5129/ 1E80 : 5130/ 1E80 : CD DD 17 x1e80: call led_data_to_a_c 5131/ 1E83 : CB 9F res 3, a 5132/ 1E85 : E6 BD and 0bdh 5133/ 1E87 : CD D0 17 call update_monitor_leds 5134/ 1E8A : 06 01 ld b, 1 5135/ 1E8C : CD 98 1D x1e8c: call x1d98 5136/ 1E8F : CD D4 1C call x1cd4 5137/ 1E92 : 20 F8 jr nz, x1e8c 5138/ 1E94 : C9 ret 5139/ 1E95 : 5140/ 1E95 : 3A 14 60 x1e95: ld a, (current_head) 5141/ 1E98 : DD 77 02 ld (ix + DriveData.target_cyl_hd), a 5142/ 1E9B : C9 ret 5143/ 1E9C : 5144/ 1E9C : test_1e9c: 5145/ 1E9C : CD 56 15 call deselect_drives_no_chng_check 5146/ 1E9F : AF xor a 5147/ 1EA0 : D3 64 out (cntl), a 5148/ 1EA2 : 21 03 60 ld hl, current_unit 5149/ 1EA5 : 34 inc (hl) 5150/ 1EA6 : 3E 04 ld a, 4 5151/ 1EA8 : 96 sub (hl) 5152/ 1EA9 : 20 0A jr nz, x1eb5 5153/ 1EAB : 77 ld (hl), a 5154/ 1EAC : 32 08 60 ld (monitor_U6_shdw), a 5155/ 1EAF : FD CB 13 6E bit 5, (iy + YB(test_flags)) 5156/ 1EB3 : 20 0E jr nz, x1ec3 5157/ 1EB5 : 21 BC 17 x1eb5: ld hl, seek_recalibrate_test_ptr 5158/ 1EB8 : 20 02 jr nz, x1ebc 5159/ 1EBA : 23 inc hl 5160/ 1EBB : 23 inc hl 5161/ 1EBC : 22 15 60 x1ebc: ld (test_jmptbl_ptr), hl 5162/ 1EBF : C0 ret nz 5163/ 1EC0 : C3 44 1F jp tsterr_st7 5164/ 1EC3 : 5165/ 1EC3 : 21 14 60 x1ec3: ld hl, current_head 5166/ 1EC6 : CB BE res 7, (hl) 5167/ 1EC8 : 34 inc (hl) 5168/ 1EC9 : 3E 4D ld a, 4dh 5169/ 1ECB : 96 sub (hl) 5170/ 1ECC : 28 09 jr z, x1ed7 5171/ 1ECE : FD CB 13 AE res 5, (iy + YB(test_flags)) 5172/ 1ED2 : FD CB 13 FE set 7, (iy + YB(test_flags)) 5173/ 1ED6 : C9 ret 5174/ 1ED7 : 5175/ 1ED7 : 77 x1ed7: ld (hl), a 5176/ 1ED8 : C9 ret 5177/ 1ED9 : 5178/ 1ED9 : ; Clear memory, save contents of leds_shdw 5179/ 1ED9 : C1 test_1ed9: pop bc 5180/ 1EDA : ED 5B 07 60 ld de, (leds_shdw) 5181/ 1EDE : AF xor a ; Clear RAM 5182/ 1EDF : 01 00 04 ld bc, ramsize 5183/ 1EE2 : 21 00 60 ld hl, ramstart 5184/ 1EE5 : 77 x1ee5: ld (hl), a 5185/ 1EE6 : 23 inc hl 5186/ 1EE7 : 0D dec c 5187/ 1EE8 : 20 FB jr nz, x1ee5 5188/ 1EEA : 10 F9 djnz x1ee5 5189/ 1EEC : ED 53 07 60 ld (leds_shdw), de 5190/ 1EF0 : C3 70 00 jp done_holdoff 5191/ 1EF3 : 5192/ 1EF3 : test_1ef3: 5193/ 1EF3 : AF xor a 5194/ 1EF4 : D3 64 out (cntl), a 5195/ 1EF6 : 32 07 60 ld (leds_shdw), a 5196/ 1EF9 : 32 08 60 ld (monitor_U6_shdw), a 5197/ 1EFC : 2F cpl 5198/ 1EFD : D3 67 out (monitor_U6), a 5199/ 1EFF : CB 87 res 0, a 5200/ 1F01 : D3 63 out (leds), a 5201/ 1F03 : FD CB 13 66 bit 4, (iy + YB(test_flags)) 5202/ 1F07 : C8 ret z 5203/ 1F08 : DB 63 in a, (switches) 5204/ 1F0A : CB 6F bit 5, a 5205/ 1F0C : 20 0B jr nz, x1f19 5206/ 1F0E : CB 67 bit 4, a 5207/ 1F10 : C8 ret z 5208/ 1F11 : 06 FA ld b, 0fah 5209/ 1F13 : CD 40 12 call delay 5210/ 1F16 : CD 40 12 call delay 5211/ 1F19 : 47 x1f19: ld b, a 5212/ 1F1A : 3A 14 60 ld a, (current_head) 5213/ 1F1D : B7 or a 5214/ 1F1E : 28 0A jr z, x1f2a 5215/ 1F20 : FD CB 13 5E bit 3, (iy + YB(test_flags)) 5216/ 1F24 : 20 10 jr nz, x1f36 5217/ 1F26 : CB 60 bit 4, b 5218/ 1F28 : 20 0C jr nz, x1f36 5219/ 1F2A : 16 00 x1f2a: ld d, 0 5220/ 1F2C : FD 5E 13 ld e, (iy + YB(test_flags)) 5221/ 1F2F : FD 34 15 inc (iy + YB(test_jmptbl_ptr)) 5222/ 1F32 : FD 34 15 inc (iy + YB(test_jmptbl_ptr)) 5223/ 1F35 : C9 ret 5224/ 1F36 : 5225/ 1F36 : 21 BC 17 x1f36: ld hl, seek_recalibrate_test_ptr 5226/ 1F39 : 22 15 60 ld (test_jmptbl_ptr), hl 5227/ 1F3C : C9 ret 5228/ 1F3D : 5229/ 1F3D : ; This bit of code seems to be an odd way to set the sub test number 5230/ 1F3D : ; Check what SP will be at the branches to these entry points. 5231/ 1F3D : 33 tsterr_st0: inc sp 5232/ 1F3E : 33 tsterr_st1: inc sp 5233/ 1F3F : 33 tsterr_st2: inc sp 5234/ 1F40 : 33 tsterr_st3: inc sp 5235/ 1F41 : 33 tsterr_st4: inc sp 5236/ 1F42 : 33 tsterr_st5: inc sp 5237/ 1F43 : 33 tsterr_st6: inc sp 5238/ 1F44 : 33 tsterr_st7: inc sp 5239/ 1F45 : 21 05 64 tsterr: ld hl, ramend+6 5240/ 1F48 : 37 scf ; clear carry flag for next SBC 5241/ 1F49 : 3F ccf 5242/ 1F4A : ED 72 sbc hl, sp ; HL = subtest number 5243/ 1F4C : 31 FD 63 ld sp, tsterr_sp ; reset SP so it is usable 5244/ 1F4F : 06 05 ld b, 5 5245/ 1F51 : CB 25 x1f51: sla l ; align subtest number for display (5 bits left) 5246/ 1F53 : 10 FC djnz x1f51 5247/ 1F55 : 3A 08 60 ld a, (monitor_U6_shdw) 5248/ 1F58 : 88 adc a, b ; B will be zero, so this just adds carry flag 5249/ 1F59 : ; which will contain the 4th? bit of subtest# 5250/ 1F59 : CB FF set 7, a ; Light the ERROR LED 5251/ 1F5B : F5 push af 5252/ 1F5C : 3A 07 60 ld a, (leds_shdw) 5253/ 1F5F : B5 or l ; include subtest portion 5254/ 1F60 : 4F ld c, a 5255/ 1F61 : F1 pop af 5256/ 1F62 : CD D0 17 call update_monitor_leds 5257/ 1F65 : AF xor a ; disable data transfers? 5258/ 1F66 : D3 64 out (cntl), a 5259/ 1F68 : FD CB 13 66 bit 4, (iy + YB(test_flags)) 5260/ 1F6C : 28 56 jr z, x1fc4 5261/ 1F6E : DB 63 in a, (switches) 5262/ 1F70 : CB 67 bit 4, a 5263/ 1F72 : 28 2C jr z, x1fa0 ; self test SW is off 5264/ 1F74 : CB 6F bit 5, a 5265/ 1F76 : 28 18 jr z, test_done ; the test loop jumper is not installed 5266/ 1F78 : 06 C8 ld b, 0c8h 5267/ 1F7A : CD 40 12 call delay ; delay 200 ms 5268/ 1F7D : 3A 08 60 ld a, (monitor_U6_shdw) 5269/ 1F80 : E6 30 and 30h ; turn off ERROR, HEAD and HPFMT LEDs 5270/ 1F82 : 32 08 60 ld (monitor_U6_shdw), a 5271/ 1F85 : FD CB 14 BE res 7, (iy +14h) 5272/ 1F89 : FD 35 15 dec (iy + YB(test_jmptbl_ptr)) 5273/ 1F8C : FD 35 15 dec (iy + YB(test_jmptbl_ptr)) 5274/ 1F8F : C9 ret 5275/ 1F90 : 5276/ 1F90 : test_done: 5277/ 1F90 : CD 56 15 call deselect_drives_no_chng_check 5278/ 1F93 : 16 20 x1f93: ld d, 20h ; approx 1/8 s elapsed? 5279/ 1F95 : CD 5F 15 call head_unload_timer_check 5280/ 1F98 : DB 63 in a, (switches) 5281/ 1F9A : CB 67 bit 4, a 5282/ 1F9C : 20 F5 jr nz, x1f93 ; SELF TEST SW pressed 5283/ 1F9E : 18 24 jr x1fc4 5284/ 1FA0 : 5285/ 1FA0 : ;run_self_test?: 5286/ 1FA0 : ;stop_self_test?: 5287/ 1FA0 : CD 56 15 x1fa0: call deselect_drives_no_chng_check 5288/ 1FA3 : 3E CE ld a, 0ceh 5289/ 1FA5 : F5 x1fa5: push af 5290/ 1FA6 : 16 80 ld d, 80h ; approx 1/2 s elapsed 5291/ 1FA8 : CD 5F 15 call head_unload_timer_check 5292/ 1FAB : 06 64 ld b, 64h 5293/ 1FAD : CD 40 12 call delay ; Delay 64 ms 5294/ 1FB0 : F1 pop af 5295/ 1FB1 : 3D dec a 5296/ 1FB2 : 20 F1 jr nz, x1fa5 5297/ 1FB4 : DB 63 in a, (switches) 5298/ 1FB6 : CB 6F bit 5, a 5299/ 1FB8 : 28 0A jr z, x1fc4 ; Test LOOP jumper not installed? 5300/ 1FBA : AF xor a 5301/ 1FBB : 57 ld d, a 5302/ 1FBC : FD 5E 13 ld e, (iy + YB(test_flags)) 5303/ 1FBF : 21 CC 17 ld hl, test_1ed9_ptr ; (last test in test_jump_table) 5304/ 1FC2 : 18 03 jr x1fc7 5305/ 1FC4 : 5306/ 1FC4 : 21 CA 17 x1fc4: ld hl, test_1ef3_ptr ; (second to last test in test_jump_table) 5307/ 1FC7 : 22 15 60 x1fc7: ld (test_jmptbl_ptr), hl 5308/ 1FCA : C9 ret 5309/ 1FCB : 5310/ 1FCB : CB 73 x1fcb: bit 6, e 5311/ 1FCD : C2 43 1F jp nz, tsterr_st6 5312/ 1FD0 : 3A 13 60 ld a, (test_flags) 5313/ 1FD3 : CB 5F bit 3, a 5314/ 1FD5 : 28 07 jr z, x1fde ; WR TEST SW not set 5315/ 1FD7 : 3A 4E 60 ld a, (data_buffer) 5316/ 1FDA : B9 cp c ; C = ?? 5317/ 1FDB : C2 44 1F jp nz, tsterr_st7 5318/ 1FDE : DD CB 04 96 x1fde: res 2, (ix + DriveData.drv) 5319/ 1FE2 : E9 jp (hl) 5320/ 1FE3 : 5321/ 1FE3 : (MACRO) fillto 01ffeh, 076h 5321/ 1FE3 : 76 76 76 76 76 76 db (01FFEH-$) dup (076H) 1FE9 : 76 76 76 76 76 76 1FEF : 76 76 76 76 76 76 1FF5 : 76 76 76 76 76 76 1FFB : 76 76 76 5322/ 1FFE : 5323/ 1FFE : B0 rom_csum_L: db 0b0h 5324/ 1FFF : FF rom_csum_H: db 0ffh 5325/ 2000 : 5326/ 2000 : endsection rom 5327/ 2000 : 5328/ 2000 : AS V1.42 Beta [Bld 222] - Source File 9895.asm - Page 2 - 06/27/2022 08:12:57 PM Symbol Table (* = unused): -------------------------- ABORT_COMMON : [ROM] 149E C | ABORT_DRIVE_ATTENTION : [ROM]1498 C | ABORT_DRIVE_FAULT : [ROM] 148A C | ABORT_DRIVE_FAULT_SEEK : [ROM] 1480 C | ABORT_ILLEGAL_OPCODE : [ROM] 147C C | ABORT_IO_PROGRAM_ERROR : [ROM] 1473 C | ABORT_LISTEN : [ROM] 1398 C | ABORT_SEEK_CHECK : [ROM] 1490 C | ABORT_STAT2_ERROR : [ROM] 149C C | ADDRESS_PHI_M : 1F - | *ADDRESS_PHI_SHIFT : 0 - | *ADDRESS_SW_M : 7 - | *ADDRESS_SW_SHIFT : 0 - | AGAIN : [ROM] 9C4 C | AMDT : 7 - | AMDT_M : 80 - | *ARCHITECTURE : "x86_64-unknown-linux" - | BUFFERED_READ_COMMON : [ROM] 70C C | CALL_RET_TEST : [ROM] 1895 C | *CASESENSITIVE : 0 - | CHECK_CYLINDER_IN_RANGE : [ROM] 8A4 C | CHECK_DSJ_S1 : [ROM] 14C1 C | CHECK_FOR_COMMAND_BYTE_JV : [ROM] 0B C | CHECK_FOR_HOLDOFF : [ROM] 2BE C | CHECK_FOR_PARITY_ERROR : [ROM] 1290 C | CHECK_UNIT_READY : [ROM] 2D8 C | CHK_LOOP : [ROM] 18E7 C | CLOCK : 61 P | CLR_HD_SECT : 6048 - | CMDTBL : [ROM] 264 C | *CMD_3 : 6049 C | *CMD_4 : 604A C | CMD_BUFFER : 6047 C | CMD_BUFFERED_READ : [ROM] 709 C | CMD_BUFFERED_READ_VERIFY : [ROM] 700 C | CMD_BUFFERED_WRITE : [ROM] 0BAC C | CMD_COLD_LOAD_READ : [ROM] 7F3 C | CMD_COLD_LOAD_READ.OK : [ROM] 823 C | CMD_COUNT : 6046 C | CMD_DOOR_LOCK : [ROM] 1180 C | CMD_DOOR_UNLOCK : [ROM] 1199 C | CMD_DSJ : [ROM] 3E0 C | CMD_DSJ.ABORTED : [ROM] 421 C | CMD_DSJ.CONTINUE : [ROM] 3E8 C | CMD_DSJ.PRTYERR : [ROM] 427 C | CMD_DSJ.SAVEIT : [ROM] 423 C | CMD_END : [ROM] 36D C | CMD_END.EXITEND : [ROM] 3C9 C | CMD_END.GODA : [ROM] 3BF C | CMD_END.GOFS : [ROM] 3BD C | CMD_END.LOOP : [ROM] 3AF C | CMD_END.NEXTDRIVE : [ROM] 380 C | CMD_END.SCANLOOP : [ROM] 37C C | CMD_END.SKIP : [ROM] 39B C | CMD_FORMAT : [ROM] 0CFB C | CMD_FORMAT.SAVESTAT2 : [ROM] 0D3A C | CMD_FORMAT.TYPEGOOD : [ROM] 0D12 C | CMD_FORMAT.ULOOP : [ROM] 0D3F C | CMD_FORMAT.VALID : [ROM] 0D24 C | CMD_ID_TRIGGERED_READ : [ROM] 82C C | CMD_ID_TRIGGERED_READ.DOREAD : [ROM] 842 C | CMD_INITIALIZE : [ROM] 0CA0 C | CMD_INITIALIZE.INITIBM : [ROM] 0CD3 C | CMD_INITIALIZE.INIT_COMMON : [ROM] 0CDD C | CMD_INITIALIZE.SKIP : [ROM] 0CC6 C | CMD_OPCODE : 6047 C | CMD_REQUEST_ADDRESS_COMMON : [ROM] 11CE C | CMD_REQUEST_ADDRESS_COMMON.SKIP : [ROM] 11D3 C | CMD_REQUEST_LOGICAL_ADDRESS : [ROM] 11AD C | CMD_REQUEST_PHYSICAL_ADDRESS : [ROM] 11BF C | CMD_REQUEST_STATUS : [ROM] 434 C | CMD_SEEK : [ROM] 4F0 C | CMD_SEEK.CALL_SEEK : [ROM] 555 C | CMD_SEEK.HDOK : [ROM] 52A C | CMD_SEEK.SUCCESS : [ROM] 556 C | CMD_TERMINATE : [ROM] 1464 C | CMD_UNBUFFERED_READ : [ROM] 743 C | CMD_UNBUFFERED_READ_VERIFY : [ROM] 73A C | CMD_UNBUFFERED_WRITE : [ROM] 0B86 C | CMD_UNBUFFERED_WRITE.AGAIN : [ROM] 0B92 C | CMD_UNIT : 6048 C | CMD_VERIFY : [ROM] 78A C | CMD_VERIFY.AGAIN : [ROM] 7D0 C | CMD_VERIFY.X07B2 : [ROM] 7B2 C | CMD_VERIFY.X07B5 : [ROM] 7B5 C | CMD_VERIFY.X07B9 : [ROM] 7B9 C | CMD_VERIFY.X07C6 : [ROM] 7C6 C | CMD_VERIFY.X07C8 : [ROM] 7C8 C | CMD_WAIT_LOOP : [ROM] 135 C | CMD_WAIT_LOOP.EXITLOOP : [ROM]145 C | CMD_WAIT_LOOP.INNER : [ROM] 137 C | CNTL : 64 P | COLD_START : [ROM] 1724 C | COMMANDED_UNIT : 6004 C | *COMPMODE : 0 - | *CONSTPI : 3.141592653589793 - | CPU_TEST : [ROM] 17E3 C | *CRCE : 7 - | CRCERR : 5 - | CRCERR_M : 20 - | *CRCE_M : 80 - | *CRCON : 1 - | CRCON_M : 2 - | *CRCOUT : 4 - | CRCOUT_M : 10 - | CRC_TEST : [ROM] 1B4D C | CURRENT_HEAD : 6014 C | CURRENT_UNIT : 6003 C | *D0 : 1 - | D0D1_M : 0C0 - | *D0D1_SHIFT : 6 - | *D0_M : 2 - | *D1 : 6 - | *D1_M : 40 - | DATA : 60 P | DATA_BUFFER : 604E C | DATA_BUFFER_COUNT : 604D C | DATA_FRZ : 0 - | DATA_FRZ_M : 1 - | *DATE : "06/27/2022" - | DBIT_ON : 2 - | *DBIT_ON_M : 4 - | DELAY : [ROM] 1240 C | DELAY.LOOP1 : [ROM] 1243 C | DELAY.LOOP2 : [ROM] 1247 C | DELAY_20MS : [ROM] 17AD C | DESELECT_DRIVES : [ROM] 154C C | DESELECT_DRIVES_NO_CHNG_CHECK : [ROM] 1556 C | DETERMINE_UNIT_STATUS_JV : [ROM] 23 C | DEV_CLR : 0 - | DEV_CLR_M : 1 - | *DHSK_DLY : 6 - | *DHSK_DLY_M : 40 - | DISCHNG : 1 - | *DISCHNG_M : 2 - | DISC_FORMAT : 6009 C | DISC_TYPE_M : 1E - | *DISC_TYPE_SHIFT : 1 - | DISPATCH_CMD : [ROM] 19D C | DONE : 0 - | DONE_HOLDOFF : [ROM] 70 C | *DONE_M : 1 - | DONE_NORMAL : [ROM] 74 C | DOOR_LOCK : 5 - | DOOR_LOCK_CODA : [ROM] 11A9 C | *DOOR_LOCK_M : 20 - | DOWNLOAD : [ROM] 11F2 C | DOWNLOAD_CODE_ENTRY : 6050 - | DO_CHECK_FOR_COMMAND_BYTE : [ROM] 360 C | DO_DEASSERT_IN_USE : [ROM] 160A C | DO_DETERMINE_UNIT_STATUS : [ROM] 463 C | DO_DETERMINE_UNIT_STATUS.FIRST : [ROM] 4A8 C | DO_DETERMINE_UNIT_STATUS.JRSR : [ROM] 4A6 C | DO_DETERMINE_UNIT_STATUS.SAVE_SS : [ROM] 487 C | DO_DETERMINE_UNIT_STATUS.SETREGS : [ROM] 4C9 C | DO_DETERMINE_UNIT_STATUS.SKIPE : [ROM] 4D6 C | DO_DETERMINE_UNIT_STATUS.SKIPND : [ROM] 495 C | DO_DETERMINE_UNIT_STATUS.SKIPW : [ROM] 4B2 C | DO_DETERMINE_UNIT_STATUS.UNITVALID : [ROM] 46E C | DO_DEVICE_CLEAR : [ROM] 8B C | DO_DEVICE_CLEAR.DRIVE_INIT_LOOP : [ROM] 0B2 C | DO_DEVICE_CLEAR.FIRST_STATUS : [ROM] 0EF C | DO_DEVICE_CLEAR.LOOP : [ROM] 0C9 C | DO_DEVICE_CLEAR.NO_DISC : [ROM] 0F5 C | DO_DEVICE_CLEAR.NO_DISC_OR_FS : [ROM] 0ED C | DO_DEVICE_CLEAR.SET_STATUS : [ROM] 0F8 C | DO_DEVICE_CLEAR.SKIP_C : [ROM]105 C | DO_HP_300_CLEAR : [ROM] 312 C | DO_HP_300_CLEAR.CLRERR : [ROM]325 C | DO_HP_300_CLEAR.GOTDCL : [ROM]32C C | DO_HP_300_CLEAR.LOOP : [ROM] 317 C | DO_HP_300_CLEAR.SKIP : [ROM] 345 C | DO_HP_FMT_TRACK : [ROM] 0E71 C | DO_HP_FMT_TRACK.CURRENT_CYL_HD0 : [ROM] 0F04 C | DO_HP_FMT_TRACK.FMT_SECTOR : [ROM] 0EF6 C | DO_HP_FMT_TRACK.SKIP : [ROM] 0EA2 C | DO_HP_FMT_TRACK.SKIPINIT : [ROM] 0E98 C | DO_HP_FMT_TRACK.SKIPWRAP : [ROM] 0F59 C | DO_HP_FMT_TRACK.WIDX1 : [ROM]0EC1 C | DO_HP_FMT_TRACK.WIDX2 : [ROM]0EE1 C | DO_HP_FMT_TRACK.WIDXD1 : [ROM] 0ED4 C | DO_HP_FMT_TRACK.WIDXD2 : [ROM] 0EEE C | DO_IBM_FORMAT : [ROM] 0DF7 C | DO_IBM_FORMAT.IBMCODA : [ROM]0E53 C | DO_IBM_FORMAT.IBMFMTLOOP : [ROM] 0E11 C | DO_IBM_FORMAT.PREVIOUS_TYPE_IS_IBM : [ROM] 0E1C C | DO_IBM_FORMAT.SKIP : [ROM] 0E04 C | *DO_IBM_FORMAT.X0E23 : [ROM] 0E23 C | DO_IBM_FORMAT.X0E45 : [ROM] 0E45 C | DO_INITIATE_SELF_TEST : [ROM]1722 C | DO_LISTEN_TRANSFER : [ROM] 1344 C | DO_LOAD_HEAD : [ROM] 159F C | DO_PAT_TEST : [ROM] 1907 C | DO_PAT_TESTS : [ROM] 18F6 C | DO_PHI_INT : [ROM] 13B9 C | DO_PHI_INT.LOOP : [ROM] 13D4 C | DO_PHI_INT_CODA : [ROM] 1407 C | DO_PHI_TEST : [ROM] 1950 C | DO_PHI_TEST.EMPTY : [ROM] 1984 C | DO_PHI_TEST.LOOP : [ROM] 197A C | DO_PPD : [ROM] 1272 C | DO_PPE : [ROM] 1278 C | DO_READ_SECTOR : [ROM] 0ACF C | DO_READ_SECTOR_CLEANUP_EXIT : [ROM] 0B2C C | DO_READ_SECTOR_COMMON : [ROM]0AD9 C | DO_READ_SECTOR_EXIT : [ROM] 0B2E C | DO_READ_SECTOR_HP : [ROM] 0AF4 C | DO_READ_SECTOR_HP.READLOOP : [ROM] 0B1B C | DO_READ_SECTOR_HP_RETRY : [ROM] 0B32 C | DO_READ_SECTOR_IBM : [ROM] 0B53 C | DO_READ_SECTOR_IBM.DOREAD : [ROM] 0B65 C | DO_READ_SECTOR_IBM.VALID : [ROM] 0B7D C | DO_READ_SECTOR_IBM_RETRY : [ROM] 0B82 C | DO_READ_SECTOR_RETRIES_EXHAUSTED : [ROM] 0B37 C | DO_READ_SECTOR_RETRY : [ROM] 0B42 C | DO_READ_SECTOR_RETRY_HP_CLK : [ROM] 0B40 C | DO_READ_SECTOR_VERIFY_CRC : [ROM] 0B23 C | DO_READ_SEND_DATA : [ROM] 952 C | DO_READ_SEND_DATA.SENDEOIBYTE : [ROM] 95F C | DO_RESET : [ROM] 1720 C | DO_RESET_DRIVE : [ROM] 6C6 C | DO_RESET_DRIVE.AT_TRACK0 : [ROM] 6EE C | DO_RESET_DRIVE.STEP_LOOP : [ROM] 6DF C | DO_SECTOR_IO_CHECK : [ROM] 8CA C | DO_SEEK : [ROM] 567 C | DO_SEEK_TO_CYLINDER : [ROM] 584 C | DO_SEEK_TO_CYLINDER.AT_TRACK0 : [ROM] 59E C | DO_SELF_TEST_LOOP : [ROM] 1784 C | DO_SEND_DATA : [ROM] 718 C | DO_SEND_STATUS_OR_ADDRESS : [ROM] 440 C | DO_SHOW_IN_USE_LEDS : [ROM] 14D8 C | DO_STEPS : [ROM] 665 C | DO_STEPS.CONTINUE : [ROM] 69E C | DO_STEPS.DOSTEPS : [ROM] 684 C | DO_STEPS.SEEK_IN : [ROM] 67A C | DO_STEPS.SKIP : [ROM] 677 C | DO_STEPS.SKIPDEC : [ROM] 69B C | DO_STEPS.STEPLOOP : [ROM] 68F C | DO_STEP_DRIVE : [ROM] 6A8 C | DO_STEP_DRIVE.SKIP : [ROM] 6B4 C | DO_TALK_TRANSFER : [ROM] 12F8 C | DO_TALK_TRANSFER.DOTALK : [ROM] 131A C | DO_TALK_TRANSFER.TALKDONE : [ROM] 132E C | DO_UNIT_CMDS : [ROM] 1F6 C | DO_UNIT_CMDS.CMDDONE : [ROM] 220 C | DO_UNIT_CMDS.CMDFOUND : [ROM] 257 C | DO_UNIT_CMDS.CMDLP : [ROM] 24E C | DO_UNIT_CMDS.FOUND : [ROM] 238 C | DO_UNIT_CMDS.HANDLE_EOI : [ROM] 210 C | DO_UNIT_CMDS.LOOP : [ROM] 1FE C | DO_UNIT_CMDS.LOOPDISPATCH : [ROM] 228 C | DO_UNIT_CMDS.MULLP : [ROM] 230 C | DO_UNIT_CMDS.NOUNIT : [ROM] 24A C | DO_WAIT_FOR_CMD : [ROM] 12B C | DO_WAIT_FOR_SECTOR : [ROM] 994 C | DO_WAIT_FOR_SECTOR.LOOP : [ROM] 9A5 C | DO_WAIT_FOR_SECTOR.RET : [ROM]9B1 C | DO_WRITE_SECTOR : [ROM] 0BE1 C | DO_WRITE_SECTOR.LOOP : [ROM] 0C13 C | DO_WRITE_SECTOR.WAIT : [ROM] 0BF8 C | DO_WRITE_SECTOR.WRTLOOP : [ROM] 0C27 C | DRIVEDATA.CURRENT_CYL_HD : 1 - | DRIVEDATA.DRV : 4 - | *DRIVEDATA.LEN : 0A - | DRIVEDATA.PHYSICAL_CYLINDER : 0 - | DRIVEDATA.SECTOR : 3 - | DRIVEDATA.STAT2 : 5 - | DRIVEDATA.STAT2_DS : 6 - | DRIVEDATA.TARGET_CYL_HD : 2 - | DRIVEDATA.UNLOAD_TICKS : 8 - | DRIVEDATA.UNLOAD_TIMER : 7 - | DRIVEDATA.XV : 9 - | DRIVE_DATA_TABLE : 601E C | *DRIVE_DATA_TABLE_0 : 601E C | *DRIVE_DATA_TABLE_0.CURRENT_CYL_HD : 601F C | *DRIVE_DATA_TABLE_0.DRV : 6022 C | *DRIVE_DATA_TABLE_0.PHYSICAL_CYLINDER : 601E C | *DRIVE_DATA_TABLE_0.SECTOR : 6021 C | *DRIVE_DATA_TABLE_0.STAT2 : 6023 C | *DRIVE_DATA_TABLE_0.STAT2_DS : 6024 C | *DRIVE_DATA_TABLE_0.TARGET_CYL_HD : 6020 C | *DRIVE_DATA_TABLE_0.UNLOAD_TICKS : 6026 C | *DRIVE_DATA_TABLE_0.UNLOAD_TIMER : 6025 C | *DRIVE_DATA_TABLE_0.XV : 6027 C | *DRIVE_DATA_TABLE_1 : 6028 C | *DRIVE_DATA_TABLE_1.CURRENT_CYL_HD : 6029 C | *DRIVE_DATA_TABLE_1.DRV : 602C C | *DRIVE_DATA_TABLE_1.PHYSICAL_CYLINDER : 6028 C | *DRIVE_DATA_TABLE_1.SECTOR : 602B C | *DRIVE_DATA_TABLE_1.STAT2 : 602D C | *DRIVE_DATA_TABLE_1.STAT2_DS : 602E C | *DRIVE_DATA_TABLE_1.TARGET_CYL_HD : 602A C | *DRIVE_DATA_TABLE_1.UNLOAD_TICKS : 6030 C | *DRIVE_DATA_TABLE_1.UNLOAD_TIMER : 602F C | *DRIVE_DATA_TABLE_1.XV : 6031 C | *DRIVE_DATA_TABLE_2 : 6032 C | *DRIVE_DATA_TABLE_2.CURRENT_CYL_HD : 6033 C | *DRIVE_DATA_TABLE_2.DRV : 6036 C | *DRIVE_DATA_TABLE_2.PHYSICAL_CYLINDER : 6032 C | *DRIVE_DATA_TABLE_2.SECTOR : 6035 C | *DRIVE_DATA_TABLE_2.STAT2 : 6037 C | *DRIVE_DATA_TABLE_2.STAT2_DS : 6038 C | *DRIVE_DATA_TABLE_2.TARGET_CYL_HD : 6034 C | *DRIVE_DATA_TABLE_2.UNLOAD_TICKS : 603A C | *DRIVE_DATA_TABLE_2.UNLOAD_TIMER : 6039 C | *DRIVE_DATA_TABLE_2.XV : 603B C | *DRIVE_DATA_TABLE_3 : 603C C | *DRIVE_DATA_TABLE_3.CURRENT_CYL_HD : 603D C | *DRIVE_DATA_TABLE_3.DRV : 6040 C | *DRIVE_DATA_TABLE_3.PHYSICAL_CYLINDER : 603C C | *DRIVE_DATA_TABLE_3.SECTOR : 603F C | *DRIVE_DATA_TABLE_3.STAT2 : 6041 C | *DRIVE_DATA_TABLE_3.STAT2_DS : 6042 C | *DRIVE_DATA_TABLE_3.TARGET_CYL_HD : 603E C | *DRIVE_DATA_TABLE_3.UNLOAD_TICKS : 6044 C | *DRIVE_DATA_TABLE_3.UNLOAD_TIMER : 6043 C | *DRIVE_DATA_TABLE_3.XV : 6045 C | DRV : 65 P | *DRV0 : 3 - | DRV0_M : 8 - | *DRV1 : 2 - | *DRV1_M : 4 - | *DRV2 : 1 - | *DRV2_M : 2 - | *DRV3 : 0 - | *DRV3_M : 1 - | DRV_SEL_M : 0F - | *DRV_SEL_SHIFT : 0 - | DRV_STATUS : 62 P | DSIC_ABORT : [ROM] 915 C | DSIC_CLEANUP : [ROM] 911 C | DSIC_EXIT : [ROM] 90C C | DSIC_SUCCESS : [ROM] 90B C | DSIO_RETRY_IF_SECTOR_WAS_FOUND : [ROM] 94C C | DSIO_RETRY_SEEK : [ROM] 91D C | DSIO_RETRY_SEEK.SKIPSEEK : [ROM] 939 C | DSJ : 6000 C | DSJ_ABORTED : 1 - | DSJ_HOLDOFF : 2 - | DSJ_NORMAL : 0 - | DSJ_PARITY_ERROR : 3 - | DSJ_SAD : 30 - | DT_BLANK : 1 - | DT_BLANK_M : 2 - | DT_DS : 3 - | DT_DS_M : 8 - | *DT_EMPTY : 0 - | DT_HP : 2 - | DT_HP_M : 4 - | DT_IBM : 4 - | DT_IBM_M : 10 - | *EIGHT_BIT : 7 - | EIGHT_BIT_M : 80 - | ENABLE_PARITY_CHECK : 0 - | *ENABLE_PARITY_CHECK_M : 1 - | ENABLE_PROC_ABRT_INT : [ROM] 13AC C | *EPAR : 6 - | *EPAR_M : 40 - | ERROR : 7 - | *ERROR_M : 80 - | EXIT_DRIVE_INIT_LOOP : [ROM] 10A C | *FALSE : 0 - | FF_DATA_INIT : 7 - | *FF_DATA_INIT_M : 80 - | FIFO_BYTE : 2 - | FIFO_BYTE_M : 4 - | FIFO_IDLE : 1 - | *FIFO_IDLE_M : 2 - | FIFO_ROOM : 3 - | FIFO_ROOM_M : 8 - | *FIFO_SEL : 1 - | *FIFO_SEL_M : 2 - | FILL_BUFFER_WITH_A : [ROM] 0FF5 C | FILL_IBM_SECTOR_BUFFER : [ROM] 1135 C | FILL_LOOP : [ROM] 18D8 C | FLUSH_FIFO : 1 - | FLUSH_FIFO_M : 2 - | FLUSH_OUT_FIFO : [ROM] 127E C | FMT_DATA_1 : 600F C | FMT_DATA_2 : 600E C | FMT_HP_TRACK : [ROM] 5D C | FMT_IBM_TRACK : [ROM] 1041 C | FMT_IBM_TRACK.SKIPSETUP : [ROM] 1059 C | FMT_IBM_TRACK_JV : [ROM] 60 C | FMT_SECTOR_COUNT : 6011 C | FMT_TRACK_DONE : [ROM] 0F6E C | FMT_TRACK_DONE.LOOP : [ROM] 0F79 C | FMT_TRACK_ERROR : [ROM] 0F7F C | FORCE_UNLOAD_HEAD : [ROM] 15E1 C | FORMAT_DATA_BYTE : 604B - | FORMAT_DATA_TBL : [ROM] 0F90 C | FORMAT_DISC : [ROM] 0D4C C | FORMAT_DISC.HPDOFMT : [ROM] 0D93 C | FORMAT_DISC.HPFMTLOOP : [ROM]0D6A C | FORMAT_DISC.SKIPINC : [ROM] 0DC3 C | FORMAT_DISC.SKIPSS1 : [ROM] 0DAD C | FORMAT_DISC.SKIPSS2 : [ROM] 0DC2 C | FORMAT_DISC.X0D85 : [ROM] 0D85 C | FORMAT_DISC.X0DAE : [ROM] 0DAE C | FORMAT_DISC.X0DD8 : [ROM] 0DD8 C | FORMAT_DISC.X0DE1 : [ROM] 0DE1 C | FORMAT_DONE : [ROM] 0DE6 C | FORMAT_FLAGS : 6012 C | FORMAT_HP : 0 - | FORMAT_IBM : 0 - | FORMAT_IBM_M : 1 - | FORMAT_INTERLEAVE : 604A - | FORMAT_OVERRIDE : 7 - | *FORMAT_OVERRIDE_M : 80 - | FORMAT_PHYS_SECTOR : 6010 C | FORMAT_SECTOR_BUFFER : 606B - | FORMAT_TYPE : 6049 - | FORMAT_TYPE_HP : 2 - | FORMAT_TYPE_IBM : 8 - | FORMAT_UNKNOWN : 1 - | FORMAT_UNKNOWN_M : 2 - | FORMAT_WANTED_TYPE_M : 7F - | *FORMAT_WANTED_TYPE_SHIFT : 0 - | *FULLPMMU : 1 - | GET_DOUBLE_SIDED_BIT : [ROM] 1683 C | GET_DRIVE_DATA_PTR_IN_IX : [ROM] 1507 C | GET_DRIVE_DATA_PTR_IN_IX.DONE : [ROM] 1518 C | GET_DRIVE_DATA_PTR_IN_IX.LOOP : [ROM] 1512 C | GET_DRIVE_SS : [ROM] 1612 C | GET_DRIVE_SS.CHECK_READY : [ROM] 1635 C | GET_DRIVE_SS.DCHNG : [ROM] 162A C | GET_DRIVE_SS.NO_DISC : [ROM] 1622 C | GET_DRIVE_SS.READY : [ROM] 1632 C | GET_DRIVE_STAT2_BYTES : [ROM]1500 C | GET_INTERLEAVE_AND_DATA_BYTE : [ROM] 0DEE C | GET_LOG_SECTOR_PTR : [ROM] 0F87 C | HANG_ALU_C : [ROM] 1844 C | HANG_ALU_NC : [ROM] 1846 C | HANG_BIT_TEST : [ROM] 185A C | HANG_CALL_RET : [ROM] 1890 C | HANG_CPU_NZ : [ROM] 1856 C | HANG_CP_NE : [ROM] 1805 C | HANG_CP_NEG : [ROM] 1809 C | HANG_CP_POS : [ROM] 1800 C | HANG_IND_JP : [ROM] 1862 C | HANG_IX : [ROM] 1886 C | HANG_IY : [ROM] 188B C | HANG_M_SET : [ROM] 17FB C | HANG_NZ_SET : [ROM] 17F2 C | HANG_PHI_REG_MISCOMPARE : [ROM] 1A21 C | HANG_PUSH_POP : [ROM] 1871 C | HANG_P_NOT_SET : [ROM] 17F9 C | HANG_RAM_ADDR_FAIL : [ROM] 194A C | HANG_RAM_FAILURE : [ROM] 1940 C | HANG_RET_ADDR_H : [ROM] 189A C | HANG_RET_ADDR_L : [ROM] 189F C | HANG_STACK_RW : [ROM] 1879 C | HANG_SUB_NEG : [ROM] 1811 C | HANG_SUB_POS : [ROM] 1813 C | HANG_Z_NOT_SET : [ROM] 17F0 C | *HAS64 : 1 - | *HASFPU : 0 - | *HASPMMU : 0 - | HEAD : 6 - | HEAD1 : 7 - | HEAD1_M : 80 - | HEADLOAD : 3 - | HEADLOAD_M : 8 - | *HEAD_M : 40 - | HEAD_UNLOAD_SET : 6006 C | HEAD_UNLOAD_TIMER_1S_CHECK : [ROM] 0C87 C | HEAD_UNLOAD_TIMER_CHECK : [ROM] 155F C | HEAD_UNLOAD_TIMER_CHECK.DONE : [ROM] 159C C | HEAD_UNLOAD_TIMER_CHECK.LOOP : [ROM] 156A C | HEAD_UNLOAD_TIMER_CHECK.SKIP : [ROM] 1599 C | HIDEN : 4 - | HIDEN_M : 10 - | HIGHEST_STACK_WORD : 63FE C | HP300_CLEAR_SAD : 10 - | *HPFMT : 3 - | *HPFMT_M : 8 - | *HPIB_CTRL : 4 - | *HPIB_CTRL_M : 10 - | HP_300_CLEAR_JV : [ROM] 13 C | HP_AM_CLK : 0E - | *HP_BYTES_PER_SECTOR : 100 - | HP_DATA_AM_DPAT : 50 - | HP_DATA_LOOP_TEST : [ROM] 1ABF C | HP_DATA_LOOP_TEST.DOTEST : [ROM] 1AF3 C | HP_DATA_LOOP_TEST.FAILED : [ROM] 1AE6 C | HP_DATA_LOOP_TEST.LOOP : [ROM] 1B08 C | HP_DATA_LOOP_TEST.RET : [ROM]1B3C C | HP_DATA_LOOP_TEST.SET_A_BIT_0 : [ROM] 1B49 C | HP_DATA_LOOP_TEST.SET_A_BIT_2 : [ROM] 1B45 C | HP_DATA_LOOP_TEST.SET_A_BIT_3 : [ROM] 1B41 C | HP_DEFECTIVE_TRACK_AM_DPAT : 0F0 - | HP_DEFECTIVE_TRACK_MARKER : 0FF - | *HP_ECC_DATA_AM_DPAT : 0D0 - | HP_FIRST_SECTOR : 0 - | HP_ID_AM_DPAT : 70 - | HP_LOWCURR_START_TRACK : 2B - | HP_PRECMP_START_TRACK : 37 - | HP_SECTORS_PER_TRACK : 1E - | IBM_AM_CLK : 0C7 - | IBM_BYTES_PER_SECTOR : 80 - | IBM_DATA_AM_DPAT : 0FB - | IBM_DATA_LOOP_TEST : [ROM] 1A96 C | IBM_DELETED_DATA_AM_DPAT : 0F8 - | IBM_FIRST_SECTOR : 1 - | IBM_GAP_DPAT : 0FF - | IBM_ID_AM_DPAT : 0FE - | IBM_INDEX_AM_CLK : 0D7 - | IBM_INDEX_AM_DPAT : 0FC - | IBM_SECTORS_PER_TRACK : 1A - | *ID_BYTE_1 : 0 - | ID_BYTE_2 : 81 - | *IFC : 4 - | *IFC_M : 10 - | IGNORE_CMD : [ROM] 1A6 C | *IM1_JV : [ROM] 38 C | INDEX : 0 - | *INDEX_M : 1 - | INITIATE_SELF_TEST : [ROM] 1206 C | INITIATE_SELF_TEST.SKIP : [ROM] 121C C | INIT_DBIT : 5 - | *INIT_DBIT_M : 20 - | INIT_FIFO : 0 - | INIT_FIFO_M : 1 - | INIT_HP_FORMAT_SECTOR_BUFFER : [ROM] 0FCA C | INIT_SECTOR_TABLE : [ROM] 0FFA C | INIT_SECTOR_TABLE.CHKWRAP : [ROM] 101E C | INIT_SECTOR_TABLE.CLAIM : [ROM] 102F C | INIT_SECTOR_TABLE.LOOP : [ROM] 1019 C | INIT_SECTOR_TABLE.NOWRAP : [ROM] 1022 C | INIT_SECTOR_TABLE.SKIPHP : [ROM] 1014 C | *INSUPMODE : 0 - | *INT_ENAB : 7 - | INT_ENAB_M : 80 - | *INT_PEND : 7 - | *INT_PEND_M : 80 - | IN_EOI : 0C0 - | IN_FIFO_BYTES_AVAILABLE : [ROM] 1413 C | IN_USE_LEDS_STACK : 6019 C | IN_USE_LEDS_STACK_PTR : 6017 C | IU_FMT : 0E - | IU_LOAD : 0A - | IU_READ : 1E - | IU_RECV : 6 - | *IU_SAD : 0C - | IU_SEND : 4 - | IU_STAT : 8 - | IU_STEP : 1A - | IU_VFY : 18 - | IU_WAIT : 2 - | IU_WAIT_DSJ : 10 - | IU_WRT : 1C - | *LA : 5 - | *LA_M : 20 - | LEDS : 63 P | LEDS_SHDW : 6007 C | LED_DATA_TO_A_C : [ROM] 17DD C | LISTEN_ACT : 5 - | *LISTEN_ACT_M : 20 - | LISTEN_DEV_CLR : [ROM] 140E C | LISTEN_TERMINATE : [ROM] 1467 C | LISTEN_TRANSFER_FINAL_D0D1 : 600A C | *LISTON : 1 - | LOAD_HEAD_IX : [ROM] 15B7 C | LOAD_HEAD_IX.SKIP : [ROM] 15D6 C | *LOOP : 5 - | *LOOP_M : 20 - | LOWCURR : 4 - | *LOWCURR_M : 10 - | *LTN : 1 - | LTN_M : 2 - | *MACEXP : 7 - | MAYBE_UNLOAD_HEAD : [ROM] 15D8 C | MEDIA_TYPE_CHECK : [ROM] 168D C | MEDIA_TYPE_CHECK.EXIT : [ROM]16EF C | MEDIA_TYPE_CHECK.INC_A_RET : [ROM] 16F8 C | MEDIA_TYPE_CHECK.NOTREADY : [ROM] 16F5 C | MEDIA_TYPE_CHECK.ONESIDE : [ROM] 16E5 C | MEDIA_TYPE_CHECK.READY : [ROM] 169D C | MEDIA_TYPE_CHECK.RETRY : [ROM] 16A1 C | MEDIA_TYPE_CHECK.SKIP : [ROM]16DE C | MEDIA_TYPE_CHECK.TWOSIDE : [ROM] 16C5 C | MGNENA : 2 - | MGNENA_M : 4 - | *MOMCPU : 80DC - | *MOMCPUNAME : "Z80UNDOC" - | MONITOR_U6 : 67 P | MONITOR_U6_SHDW : 6008 C | MOVEIN : 1 - | *MOVEIN_M : 2 - | *NESTMAX : 100 - | NEXT_LOGICAL_SECTOR : [ROM] 96D C | NEXT_LOGICAL_SECTOR.SECTOR_VALID : [ROM] 990 C | NEXT_LOGICAL_SECTOR.SKIPDS : [ROM] 98A C | NEXT_LOGICAL_SECTOR.SKIPH1 : [ROM] 98D C | NEXT_LOGICAL_SECTOR_SAVE_FLAGS : [ROM] 876 C | *NMI_JV : [ROM] 66 C | NORMAL_AND_DESELECT_DRIVES : [ROM] 14B1 C | NOSW : 4 - | NUNITS : 4 - | *ONL : 7 - | ONL_M : 80 - | OUT_END : 7 - | OUT_END_M : 80 - | OUT_FIFO_ROOM_AVAILABLE : [ROM] 13F5 C | OVERRUN_BIT_TEST : [ROM] 1A6C C | OVERRUN_BIT_TEST.LOOP : [ROM]1A89 C | OVERUN : 6 - | OVERUN_M : 40 - | *PADDING : 1 - | PARITY_CHECK_STATE : 600C C | PATTERN_TEST_FAIL : [ROM] 192B C | PCHK_LOOP : [ROM] 191C C | PENULTIMATE_STACK_WORD : 63FC C | PERFORM_SEEK : [ROM] 5A6 C | PERFORM_SEEK.NOTOGGLE : [ROM] 5E8 C | PERFORM_SEEK.SETHD : [ROM] 5D3 C | PFILL_LOOP : [ROM] 190F C | PHI_ADDRESS : 15 P | PHI_CONTROL : 14 P | PHI_FIFO : 12 P | PHI_ID1 : 16 P | PHI_ID2 : 17 P | PHI_INT_ABORT_LISTEN : [ROM] 13F0 C | PHI_INT_COND : 10 P | PHI_INT_LISTEN_ACTIVE : [ROM]1422 C | PHI_INT_LISTEN_ACTIVE.DEV_CLR : [ROM] 144F C | PHI_INT_LISTEN_ACTIVE.IN_FIFO_BYTES : [ROM] 144C C | PHI_INT_LISTEN_ACTIVE.LOOP : [ROM] 1432 C | PHI_INT_LISTEN_TERMINATE : [ROM] 1416 C | PHI_INT_MASK : 11 P | PHI_STATUS : 13 P | PHYSICAL_TRACKS : 4D - | POLL_HLDF : 7 - | *POLL_HLDF_M : 80 - | POLL_INPUT_OR_DCL : [ROM] 1285 C | *PP_RESP : 5 - | *PP_RESP_M : 20 - | PRECMP : 5 - | *PRECMP_M : 20 - | PREP_DRIVE_REGS : [ROM] 151A C | PREP_DRIVE_REGS.SAVEB : [ROM]1536 C | PREP_DRIVE_REGS.SKIPHD : [ROM] 1544 C | PREP_FOR_NEXT_CMD : [ROM] 124D C | PREVIOUS_FORMAT : 600D C | PROCESSOR_ST2 : [ROM] 1864 C | *PROC_ABRT : 6 - | PROC_ABRT_M : 40 - | PROGRES : 3 - | *PROGRES_M : 8 - | PRTY_ERR : 6 - | PRTY_ERR_M : 40 - | PRTY_FRZ : 6 - | PRTY_FRZ_M : 40 - | RAMEND : 63FF - | RAMSIZE : 400 - | RAMSTART : 6000 - | *RAMTEST : [ROM] 18D2 C | RAM_ADDR_FAIL : [ROM] 1942 C | RAM_TEST_PATTERNS : [ROM] 194C C | RD_PHI_FIFO_CP_CD : [ROM] 1A1E C | RD_PHI_INT_COND_CP_CD : [ROM]1A1A C | *READON : 5 - | READON_M : 20 - | READY : 4 - | READY_M : 10 - | READ_AMIGO_CMD : [ROM] 154 C | READ_AMIGO_CMD.HANDLE_SAD : [ROM] 169 C | READ_AMIGO_CMD.LOOP : [ROM] 189 C | READ_AMIGO_CMD.MATCHED : [ROM]192 C | READ_AMIGO_CMD.SKIP : [ROM] 198 C | READ_AMIGO_CMD.WAIT_FOR_SAD : [ROM] 15B C | READ_CLEANUP : [ROM] 7E7 C | READ_FAILED : [ROM] 7ED C | READ_LOOPBACK : [ROM] 11DB C | READ_LOOPBACK_TALK : [ROM] 11DD C | READ_SECTOR_JV : [ROM] 2B C | READ_SELF_TEST : [ROM] 1225 C | READ_SUCCESS : [ROM] 7E4 C | READ_TEST : [ROM] 1DE3 C | READ_TEST.SKIPMTC : [ROM] 1E17 C | READ_TEST_PTR : [ROM] 17C6 C | READ_THE_SECTOR : [ROM] 865 C | READ_THE_SECTOR.AGAIN : [ROM] 866 C | RECEIVE_SECTOR_DATA : [ROM] 1455 C | RECEIVE_SECTOR_DATA.SKIP : [ROM] 145E C | *RELAXED : 0 - | *REM : 5 - | REMOVE_FROM_HEAD_UNLOAD_SET : [ROM] 15E8 C | *REM_M : 20 - | *REN : 5 - | *REN_M : 20 - | RESET : 62 P | RESET_DRIVE_JV : [ROM] 8 C | RESET_PERIPHERALS : [ROM] 1733 C | RESET_TEST_JUMP_TABLE_PTR : [ROM] 1B9E C | RESTART_LISTEN_TRANSFER : [ROM] 1353 C | RETURN_IF_IN_SELF_TEST : [ROM] 14F7 C | ROMCSUM : [ROM] 18A4 C | ROMCSUM_FAIL_H : [ROM] 18CF C | ROMCSUM_FAIL_L : [ROM] 18C9 C | ROMCSUM_LOOP : [ROM] 18B8 C | ROM_CSUM_H : [ROM] 1FFF C | ROM_CSUM_L : [ROM] 1FFE C | ROTATIONAL_TIMING_TEST : [ROM] 1C20 C | *RQST_SRVC : 2 - | *RQST_SRVC_M : 4 - | RSPD_PP : 3 - | RSPD_PP_M : 8 - | RTS_ERR : [ROM] 87C C | RTS_ERR.DOEXIT : [ROM] 89F C | RTS_ERR.SETA : [ROM] 896 C | RTS_ERR.SETC : [ROM] 88C C | RTS_ERR.SETE : [ROM] 892 C | *R_OVERUN : 1 - | R_OVERUN_M : 2 - | *R_TIMEOUT : 0 - | R_TIMEOUT_M : 1 - | S1 : 6001 C | S1_CCE : 7 - | S1_DA : 1F - | *S1_DBIT : 5 - | S1_DBIT_M : 20 - | S1_DTE : 11 - | S1_ILL_OP : 1 - | S1_IPE : 0A - | *S1_NORMAL : 0 - | S1_RHE : 12 - | S1_S2E : 13 - | S1_SCE : 9 - | S1_UA : 17 - | S1_UDE : 8 - | S1_UNIT : 6002 C | SAD_D1 : 6 - | SAD_D1_M : 40 - | SAD_DISPATCH_TABLE : [ROM] 1C9 C | SAD_JMPTBL : [ROM] 1E4 C | SAD_M : 1F - | *SAD_SHIFT : 0 - | SECTOR_IO_RETRY : 1 - | *SECTOR_IO_RETRY_M : 2 - | SECTOR_RANGE_TBL : [ROM] 1657 C | SECTOR_TABLE : 604D - | SEEK_CYLINDER_LSB : 604A - | SEEK_CYLINDER_MSB : 6049 - | SEEK_HEAD : 604B - | SEEK_RECALIBRATE_TEST : [ROM]1BA5 C | SEEK_RECALIBRATE_TEST_PTR : [ROM] 17BC C | SEEK_SECTOR : 604C - | SEEK_TO_CYLINDER_JV : [ROM] 6A C | SEEK_TO_TARGET_CYL_HD : [ROM] 8AC C | SELFTEST : 4 - | *SELFTEST_M : 10 - | SELF_TEST_ACTIVE : 0 - | *SELF_TEST_ACTIVE_M : 1 - | SELF_TEST_LOOP : [ROM] 1790 C | SEL_HEAD_0 : [ROM] 1D64 C | SEL_HEAD_1 : [ROM] 1D6E C | SEL_HEAD_COMMON : [ROM] 1D76 C | SEND_EOI : 0 - | SEND_EOI_M : 1 - | SEND_OUT_BYTE : [ROM] 12DA C | SEND_STATUS_OR_ADDRESS_JV : [ROM] 6D C | *SERV_RQST : 4 - | *SERV_RQST_M : 10 - | SET_ABORT_S1 : [ROM] 14A3 C | SET_DRV_XV : [ROM] 15FD C | SET_DRV_XV_DISC_CHNG : [ROM] 15F3 C | SET_DSJ : [ROM] 75 C | SET_LEDS : [ROM] 14E2 C | SET_LOWCURR_AND_PRECMP : [ROM] 165B C | SET_LOWCURR_AND_PRECMP.SKIPL : [ROM] 167C C | SET_LOWCURR_AND_PRECMP.SKIPP : [ROM] 1670 C | SET_PARITY_CHECK_STATE : [ROM] 1266 C | SET_PHI_INT_MASK : [ROM] 13A2 C | SET_S1_AND_UNIT : [ROM] 14B7 C | SET_STAT2_CHECK_READY : [ROM]16FA C | SHOW_IDLE_STATE : [ROM] 14A C | SHOW_IN_USE_LEDS_JV : [ROM] 28 C | SHOW_PREVIOUS_IN_USE_LEDS : [ROM] 14EB C | SIO_COMMON_PREP : [ROM] 72A C | SIO_DONE_GET_STATUS : [ROM] 0ABB C | SIO_DONE_GET_STATUS.SKIP : [ROM] 0ACD C | SIO_D_BIT4 : 4 - | *SIO_D_BIT4_M : 10 - | SIO_D_BIT5 : 5 - | *SIO_D_BIT5_M : 20 - | SIO_D_SECTOR_FOUND : 0 - | SIO_D_SECTOR_FOUND_M : 1 - | SIO_D_WFS_FAILED : 1 - | *SIO_D_WFS_FAILED_M : 2 - | SIO_D_WRONG_HEAD : 5 - | SIO_D_WRONG_HEAD_M : 20 - | SIO_D_WRONG_SECTOR : 7 - | SIO_D_WRONG_SECTOR_M : 80 - | SIO_D_WRONG_TRACK : 6 - | SIO_D_WRONG_TRACK_M : 40 - | SIO_E_1 : 1 - | *SIO_E_1_M : 2 - | SIO_E_3 : 3 - | *SIO_E_3_M : 8 - | SIO_E_DEFECTIVE_SECTOR : 2 - | *SIO_E_DEFECTIVE_SECTOR_M : 4 - | SIO_E_NOT_READY : 4 - | *SIO_E_NOT_READY_M : 10 - | SIO_E_SCE : 0 - | *SIO_E_SCE_M : 1 - | *SIZE : [ROM] 2000 - | SS_M : 3 - | SS_NOT_READY : 1 - | SS_NOT_READY_M : 2 - | SS_NO_DISC : 3 - | SS_NO_DRV : 2 - | SS_READY : 0 - | *SS_SHIFT : 0 - | *SS_UNDEF : 1 - | START : [ROM] 0 - | STAT1 : 6047 - | *STAT1_UNIT : 6048 - | STAT2 : 6049 - | STAT2_A : 7 - | *STAT2_A_M : 80 - | STAT2_C : 2 - | STAT2_C_M : 4 - | STAT2_DS : 604A - | STAT2_E : 4 - | STAT2_ERROR : 7 - | *STAT2_ERROR_M : 80 - | STAT2_E_M : 10 - | STAT2_F : 3 - | STAT2_F_M : 8 - | *STAT2_RSVD : 0 - | *STAT2_RSVD_M : 1 - | STAT2_UNDOC : 5 - | STAT2_UNDOC_M : 20 - | STAT2_W : 6 - | STAT2_W_M : 40 - | STATE_FLAGS : 6005 C | *STAT_CHNG : 7 - | *STAT_CHNG_M : 80 - | STEP : 0 - | STEPIT : [ROM] 5F9 C | STEPIT.RETRY_WFS : [ROM] 60D C | STEPIT.SKIP : [ROM] 60A C | STEPIT.VERIFY_SEEK : [ROM] 64C C | STEPIT.X062C : [ROM] 62C C | STEPIT.X0634 : [ROM] 634 C | STEPIT.X063B : [ROM] 63B C | STEPIT.X0644 : [ROM] 644 C | STEPIT.X0661 : [ROM] 661 C | STEPIT.X0663 : [ROM] 663 C | STEP_DRIVE_JV : [ROM] 1B C | STEP_IN_ONE_TRACK : [ROM] 0E61 C | *STEP_M : 1 - | STEP_OUT : 7 - | *STEP_OUT_M : 80 - | *SUBTEST_M : 0E0 - | *SUBTEST_MSB_M : 3 - | *SUBTEST_MSB_SHIFT : 0 - | *SUBTEST_SHIFT : 5 - | SWITCHES : 63 P | *SYST_CTRL : 3 - | *SYST_CTRL_M : 8 - | *TA : 6 - | TALKDONE2 : [ROM] 132F C | TALKDONE3 : [ROM] 133B C | TALK_ACT : 4 - | *TALK_ACT_M : 10 - | TARGET_CYL_HD : 600B C | *TA_M : 40 - | TERMINATE_LISTEN_TRANFER : [ROM] 135C C | TERMINATE_LISTEN_TRANFER.DONE : [ROM] 1384 C | TERMINATE_TALK : [ROM] 12EC C | *TESTNUM_M : 1E - | *TESTNUM_SHIFT : 1 - | TEST_1738 : [ROM] 1738 C | TEST_1E9C : [ROM] 1E9C C | TEST_1E9C_PTR : [ROM] 17C8 C | TEST_1ED9 : [ROM] 1ED9 C | TEST_1ED9_PTR : [ROM] 17CC C | TEST_1EF3 : [ROM] 1EF3 C | TEST_1EF3_PTR : [ROM] 17CA C | TEST_DONE : [ROM] 1F90 C | TEST_FLAGS : 6013 C | TEST_JMPTBL : [ROM] 17B2 C | TEST_JMPTBL_PTR : 6015 C | TEST_M : [ROM] 17FB C | TEST_NZ : [ROM] 17F2 C | *TIME : "08:12:57 PM" - | TIMEOUT : 6 - | TIMEOUT_BIT_TEST : [ROM] 1A2B C | TIMEOUT_M : 40 - | TLK : 5 - | TLK_IDF : 2 - | TLK_IDF_M : 4 - | TLK_M : 20 - | TMP_UNIT : 600D C | TRACK0 : 2 - | *TRACK0_M : 4 - | *TRUE : 1 - | TSTERR : [ROM] 1F45 C | TSTERR_SP : 63FD C | TSTERR_ST0 : [ROM] 1F3D C | TSTERR_ST1 : [ROM] 1F3E C | TSTERR_ST2 : [ROM] 1F3F C | TSTERR_ST3 : [ROM] 1F40 C | TSTERR_ST4 : [ROM] 1F41 C | TSTERR_ST5 : [ROM] 1F42 C | TSTERR_ST6 : [ROM] 1F43 C | TSTERR_ST7 : [ROM] 1F44 C | TWOSIDE : 7 - | *TWOSIDE_M : 80 - | UNBUFFERED_READ_COMMON : [ROM]746 C | UNBUFFERED_READ_COMMON.AGAIN : [ROM] 763 C | UNBUFFERED_READ_COMMON.SKIP : [ROM] 780 C | UNBUFFERED_READ_COMMON.SUCCESS : [ROM] 75D C | *UNIT_M : 30 - | *UNIT_SHIFT : 4 - | UPDATE_MONITOR_LEDS : [ROM] 17D0 C | VALIDATE_SECTOR_NUMBER : [ROM] 163E C | VALIDATE_SECTOR_NUMBER.INVALID : [ROM] 1655 C | VALIDATE_SECTOR_NUMBER.SKIP : [ROM] 1649 C | VERIFY_COUNT_LSB : 604A - | VERIFY_COUNT_MSB : 6049 - | VERIFY_CRC : [ROM] 0AAA C | VERIFY_CYLINDER : [ROM] 733 C | VERIFY_CYLINDER_JV : [ROM] 63 C | VERIFY_KNOWN_FORMAT : [ROM] 2C7 C | VERIFY_UNIT_READY : [ROM] 2EB C | VERIFY_UNIT_READY.OK : [ROM] 2FB C | VERIFY_UNIT_READY.SKIP : [ROM]30A C | VERIFY_WRITE_ENABLED : [ROM] 2D0 C | *VERSION : 142F - | WAIT_FOR_CMD_JV : [ROM] 3 C | WAIT_FOR_HPIB_SAD : [ROM] 12A3 C | WAIT_FOR_HPIB_SAD.AGAIN : [ROM] 12B1 C | WAIT_FOR_HPIB_SAD.GOTONE : [ROM] 12C1 C | WAIT_FOR_INPUT_OR_DCL : [ROM] 1AE C | WAIT_FOR_INPUT_OR_DCL.LOOP : [ROM] 1B3 C | WAIT_FOR_SECTOR_ID_FIELD : [ROM] 9B5 C | WFS_CODA : [ROM] 0A37 C | WFS_CODA.WFS_ERROR : [ROM] 0A41 C | WFS_DONE : [ROM] 0A51 C | WFS_HP : [ROM] 9E8 C | WFS_HP.SKIPDT : [ROM] 0A13 C | WFS_HP.SKIPHEAD : [ROM] 0A1C C | WFS_HP.SKIPWS : [ROM] 0A23 C | WFS_HP.SKIPWT : [ROM] 0A2D C | WFS_IBM : [ROM] 0A5F C | WFS_IBM.SKIPB5 : [ROM] 0A8E C | WFS_IBM.SKIPD4 : [ROM] 0AA0 C | WFS_IBM.SKIPWS : [ROM] 0A98 C | WFS_IBM.SKIPWT : [ROM] 0A86 C | WFS_IBM.WAITAMIBM : [ROM] 0A61 C | WFS_ID_AM : [ROM] 9CC C | WFS_TIMEDOUT : [ROM] 0A56 C | *WRITDRV : 3 - | WRITDRV_M : 8 - | WRITE_IBM_SECTOR : [ROM] 0C4C C | WRITE_IBM_SECTOR.DELAY : [ROM] 0C4E C | WRITE_IBM_SECTOR.LOOP : [ROM]0C62 C | WRITE_IBM_SECTOR.NOTDEL : [ROM] 0C78 C | WRITE_LOOPBACK : [ROM] 11EA C | WRITE_PHI_CONTROL : [ROM] 1282 C | WRITE_SECTOR : [ROM] 0BC8 C | WRITE_SECTOR.OK : [ROM] 0BD3 C | WRITE_SECTOR_CLEANUP_RET : [ROM] 0C44 C | WRITE_SECTOR_CODA : [ROM] 0C2F C | WRITE_SECTOR_JV : [ROM] 33 C | WRITE_TEST : [ROM] 1C74 C | WRITE_TEST_PART2 : [ROM] 1CAB C | WRITE_TEST_PART3 : [ROM] 1CD9 C | *WRITON : 2 - | WRITON_M : 4 - | WRPROT : 3 - | *WRPROT_M : 8 - | *WRTEST : 3 - | WRTEST_M : 8 - | WR_TEST_ACTIVE : 3 - | *WR_TEST_ACTIVE_M : 8 - | *X0057 : [ROM] 57 C | *X1060 : [ROM] 1060 C | X1060.WAITD : [ROM] 108D C | X1060.WAITIDX : [ROM] 1082 C | X1060.X107E : [ROM] 107E C | X10B0 : [ROM] 10B0 C | X10BC : [ROM] 10BC C | X1113 : [ROM] 1113 C | X1123 : [ROM] 1123 C | X138A : [ROM] 138A C | X1402 : [ROM] 1402 C | X1419 : [ROM] 1419 C | *X15F3 : [ROM] 15F3 C | X1741 : [ROM] 1741 C | X174D : [ROM] 174D C | X1754 : [ROM] 1754 C | X1769 : [ROM] 1769 C | X1777 : [ROM] 1777 C | X17AB : [ROM] 17AB C | *X17DC : [ROM] 17DC C | *X1807 : [ROM] 1807 C | X193A : [ROM] 193A C | X19F1 : [ROM] 19F1 C | X1A03 : [ROM] 1A03 C | X1A20 : [ROM] 1A20 C | X1A28 : [ROM] 1A28 C | X1A3D : [ROM] 1A3D C | X1BC6 : [ROM] 1BC6 C | X1BD5 : [ROM] 1BD5 C | X1C15 : [ROM] 1C15 C | X1C49 : [ROM] 1C49 C | X1C4B : [ROM] 1C4B C | X1C51 : [ROM] 1C51 C | X1C57 : [ROM] 1C57 C | X1C5D : [ROM] 1C5D C | X1C64 : [ROM] 1C64 C | X1C89 : [ROM] 1C89 C | X1CCB : [ROM] 1CCB C | X1CD4 : [ROM] 1CD4 C | X1D12 : [ROM] 1D12 C | X1D17 : [ROM] 1D17 C | X1D25 : [ROM] 1D25 C | X1D32 : [ROM] 1D32 C | X1D37 : [ROM] 1D37 C | X1D47 : [ROM] 1D47 C | X1D53 : [ROM] 1D53 C | X1D78 : [ROM] 1D78 C | X1D8E : [ROM] 1D8E C | X1D98 : [ROM] 1D98 C | X1DAE : [ROM] 1DAE C | X1DCD : [ROM] 1DCD C | X1DE0 : [ROM] 1DE0 C | X1E30 : [ROM] 1E30 C | X1E36 : [ROM] 1E36 C | X1E48 : [ROM] 1E48 C | X1E73 : [ROM] 1E73 C | X1E80 : [ROM] 1E80 C | X1E8C : [ROM] 1E8C C | X1E95 : [ROM] 1E95 C | X1EB5 : [ROM] 1EB5 C | X1EBC : [ROM] 1EBC C | X1EC3 : [ROM] 1EC3 C | X1ED7 : [ROM] 1ED7 C | X1EE5 : [ROM] 1EE5 C | X1F19 : [ROM] 1F19 C | X1F2A : [ROM] 1F2A C | X1F36 : [ROM] 1F36 C | X1F51 : [ROM] 1F51 C | X1F93 : [ROM] 1F93 C | X1FA0 : [ROM] 1FA0 C | X1FA5 : [ROM] 1FA5 C | X1FC4 : [ROM] 1FC4 C | X1FC7 : [ROM] 1FC7 C | X1FCB : [ROM] 1FCB C | X1FDE : [ROM] 1FDE C | *X606B : 606B - | X60B4 : 60B4 - | XV : 66 P | XV_SHDW_DISCHNG : 7 - | *XV_SHDW_DISCHNG_M : 80 - | 1059 symbols 206 unused symbols AS V1.42 Beta [Bld 222] - Source File 9895.asm - Page 3 - 06/27/2022 08:12:57 PM Defined Macros: --------------- BDEF | BFIELD DEASSERT_IN_USE[ROM] | FILLTO LOAD_HEAD[ROM] | RESET_DRIVE[ROM] SEEK[ROM] | SET_IN_USE_LEDS[ROM] WAIT_FOR_SECTOR[ROM] | 9 macros AS V1.42 Beta [Bld 222] - Source File 9895.asm - Page 4 - 06/27/2022 08:12:57 PM Defined Structures/Unions: -------------------------- DRIVEDATA 0 PHYSICAL_CYLINDER 1 CURRENT_CYL_HD 2 TARGET_CYL_HD 3 SECTOR 4 DRV 5 STAT2 6 STAT2_DS 7 UNLOAD_TIMER 8 UNLOAD_TICKS 9 XV 1 structure AS V1.42 Beta [Bld 222] - Source File 9895.asm - Page 5 - 06/27/2022 08:12:57 PM Defined Functions: ------------------ BYTENOT | YB BMASK | AS V1.42 Beta [Bld 222] - Source File 9895.asm - Page 6 - 06/27/2022 08:12:57 PM Code Pages: ---------- STANDARD (0 changed characters) 1 code page 0.08 seconds assembly time 5874 lines source file 6194 lines incl. macro expansions 2 passes 0 errors 0 warnings