;================================================================ ; CDZSWP Overlay. ; Version : D-X Designs Pty Lts P112 SCSI Hard Disk Subsystem (NCR 5380) ; Revision: 0.1 ; Author : Harold F. Bower ; Date : 13 October 1997 ; Desc: This file uses a direct driver for the NCR 5380 (and compatibles ; such as National DP5380 and DP8490) for the SCSI subsystems on ; the D-X Designs' P112. While it uses minor features specific to ; the Z182 implementation, it should be easily adapted to other ; '5380 SCSI implementations. It requires tailoring of two ; options (chip base address, and unit Device Number) prior to use. ; Requirements: ; - NCR 5380-compatible SCSI Interface ; - SCSI CD-ROM drive such as: Sony CDU-55S/56S double-speed, ; NEC CDR-210 double-speed, or Chinon CDS-535 single-speed. ; ; NOTE: This module is basic, and does not include many possible ; enhancements. See CD-BPS.SRC for ideas on possiblities. ;---------------------------------------------------------------- ; Assemble this file with ZMAC (or SLR Assemblers) to a .HEX file ; and form into an overlay file as: ; ; ZMAC CD-SCSI.SRC /H ; MYLOAD CDZSWP.DVR=CD-SCSI.HEX <-- output renamed to default ; ; NOTE: the file must be self-contained with no external ; declarations to library routines. ;================================================================ REV EQU 01 ; Revision (Maj/Min) in Decimal ;*************************************************************************** ; SCSI routines for the National DP8490, DP5380 or NCR 5380 SCSI controller. ; These routines use the SCSI Controller registers to perform IO with the ; attached CD-ROM. This module must be edited to reflect the correct SCSI ; ID of the attached drive, and the base IO address of the chip, then ; assembled to a driver module. ;*************************************************************************** ;|| Configure following for your hardware. || ; || DEVICE EQU 00000010B ; Set ONLY ONE BIT to "1" for Device || ; |||||||+- Set for Device 0 || ; ||||||+-- Set for Device 1 || ; ... || ; |+------- Set for Device 6 || ; +-------- Device 7 normally reserved for Host || ; || ; Equates for the National DP8490/NCR 5380 SCSI controller || ; || NCR EQU 40H ; Base of Address of Controller chip || ; || ;*************************************************************************** BELL EQU 07H ; Ascii Char values LF EQU 0AH CR EQU 0DH envAdr EQU 0109H ; Address of ENV Address in Z3 Program Header ORG 180H ; <<<--- Overlay Starts Here! <--- ;!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*! ;*!*!*!*!*!*!* DO NOT ALTER SEQUENCES IN THIS TABLE !*!*!*!*!*!*!*!*!* ;!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*! Begin: DEFW LENGTH ; This word for checking available space DEFB REV ; Revision # (decimal) of this version ; Standard Entry Points. JP RetID ;+3 Return Pointer to Overlay Text ID String JP DrInit ;+6 Validate System Configuration, Init Params JP RdBlok ;+9 Read a 2048-byte block of Data from CD-ROM JP Eject ;+12 Spin down Disc and Eject Tray/Caddy JP Load ;+15 Load Tray/Caddy and Spin up Disc JP 0 ;+18 JP 0 ;+21 JP 0 ;+24 DEFB 'CDZSWP-OVL',0 ;+27 <<-- Mandatory Validation String -->> ;|*|*|*|*|*|*|*|*|*|*|*| End of Fixed Table |*|*|*|*|*|*|*|*|*|*|*|*|*| ;---------------------------------------------------------------- ; Return Pointer to a Null-Terminated Overlay Identification String ; Enter: None ; Exit : HL -> String ; Uses : HL ;---------------------------------------------------------------- RetID: LD HL,idStr RET idStr: DEFB 'Generic NCR 5380 SCSI Driver, Rev ' DEFB REV / 10 + '0','.',REV MOD 10 + '0',0 ;---------------------------------------------------------------- ; Initialize Drive Sub-System. Steps to be accomplished here are: ; 1) Store address of Buffer for later use by all routines ; 2) Validate System Configuration (H/W, S/W, OS and/or Configuration) ; 3) Perform any System-specific Initializations needed. ; ; Enter: HL -> 2048-byte buffer for CD-ROM "Block" ; Exit : Carry Set (C) if Errors occured (e.g. No Drive) or System incompatible ; Carry Clear (NC) if system compatible and initializations performed ; HL - Points to Null String if Ok ; - Points to Null-terminated (possibly Null) string if Errors ; Uses : All Registers ; NOTE: Access to pre-defined Static Z-System items is permitted, ; such as the z3eadr pointer at location 0103H ;---------------------------------------------------------------- DrInit: LD (bufAdr),HL ; Save the Buffer Address locally CALL Inquir ; Do SCSI Fcn 12H RET C ; return any Error (w/string in case..) CALL Load ; Give Command to Load just in case unloaded RET C ; return Error if Can't Load LD HL,idBufr ; Return w/ID String RET ; Error Flag Clear if Ok ;---------------------------------------------------------------- ; Read a Specified Block of 2048 bytes from the CD-ROM into the Buffer. ; Enter: BCDE = 32-bit Logical Block Address (2048-byte blocks) to Read ; (MSB in B..LSB in E) ; Exit : Carry Set (C) if Errors occured, Clear (NC) if Ok ; HL - Points to Null String if Ok ; - Points to a (possibly Null) Null-terminated String if Errors ; A contains Non-Zero Error Code as: ; (currently undefined except for:) ; 1FH = Excessively Large Block Number ; Uses : All Registers ;---------------------------------------------------------------- ; This routine only uses 21-bits of addressing for 2048-byte ; sectors in order to use 6-byte SCSI Read Command. Return ; Error if block size exceeds what can be handled. RdBlok: LD A,B ; Get Block MSB OR A ; Too large? JR NZ,RdBlk0 ; ..jump to Error if Yes LD A,C ; Else get next byte AND 0E0H ; Too Large JR Z,RdBlk1 ; ..jump to continue if No RdBlk0: LD A,1FH ; LBA Address too large. Return Error LD HL,bigLBA ; return String SCF RET bigLBA: DEFB CR,LF,BELL,'Address too Large!',0 RdBlk1: LD HL,cmdBlk ; Point to the Command Block LD (HL),08H ; Read Block Command (6-byte) INC HL LD (HL),C ; save LBA [2] (MSB) (LBA = 0) INC HL LD (HL),D ; LBA [1] INC HL LD (HL),E ; and LBA [0] (LSB) INC HL ; Advance to # of Blocks LD (HL),1 ; read only 1 INC HL LD (HL),0 ; with no control bits LD HL,(bufAdr) ; (load Data block here) CALL SCSIex ; execute CALL C,SnsErr ; Check for Real Errors RET C ; ..return with them if present ;..else fall thru for Good Operation.. ; This is Ok Exit from several points OkExit: LD HL,nulStr XOR A ; Clear Carry for Good status RET ; then back to Caller w/Ok Status ;---------------------------------------------------------------- ; Spin Down Disc (optionally Eject Tray/Caddy, unimplemented here) ; Enter: None ; Exit : Carry Set (C) if Errors occured, Clear (NC) if Ok ; HL - Points to a Null String if Ok, ; - Points to a Null-terminated string if Error and A ; contains Non-Zero Error Code ; Uses : All Registers ;---------------------------------------------------------------- Eject: LD HL,cmdBlk ; Point to the Command Block LD (HL),1BH ; Start/Stop Unit Command (6-byte) INC HL LD (HL),0 ; LUN = 0, Immediate Bit = 0 INC HL LD (HL),0 ; (reserved) INC HL LD (HL),0 ; (reserved) INC HL LD (HL),00000000B ; Spin Down Disc INC HL LD (HL),0 ; No Control Byte LD HL,snsDat ; (dummy data ptr here) CALL SCSIex ; execute JR NC,OkExit ; .Exit thru here if Ok JP SnsErr ; ..Else Determine Error and return it ;---------------------------------------------------------------- ; Spin Up Disc (optionally Load Tray/Caddy, unimplemented here) ; Enter: None ; Exit : Carry Set (C) if Errors occured, Clear (NC) if Ok ; HL - Points to a Null String if Ok, ; Points to a Null-terminated string if Error and A ; contains Non-Zero Error Code ; Uses : All Registers ;---------------------------------------------------------------- Load: LD HL,cmdBlk ; Point to the Command Block LD (HL),1BH ; Start/Stop Unit Command (6-byte) INC HL LD (HL),0 ; LUN = 0, Immediate Bit=0 INC HL LD (HL),0 ; (reserved) INC HL LD (HL),0 ; (reserved) INC HL LD (HL),00000001B ; Spin Up Disc INC HL LD (HL),0 ; No Control Byte LD HL,snsDat ; (dummy data ptr here) CALL SCSIex ; execute CALL C,SnsErr ; Check Sense if Not LD HL,200 ; Set timeout counter (desire ~15 sec, but..) LoadW: PUSH HL ; save counter LD HL,cmdBlk XOR A ; Get 0 LD (HL),A ; Test Unit Ready Command (0) INC HL LD (HL),A ; LUN = 0 INC HL LD (HL),A ; (reserved) INC HL LD (HL),A ; (reserved) INC HL LD (HL),A ; (reserved) INC HL LD (HL),A ; No Control Byte LD HL,snsDat ; (dummy data ptr here) CALL SCSIex ; execute POP HL ; (restore counter) JR NC,OkExit ; ..Exit thru here if Unit Ready PUSH HL CALL SnsErr ; Else Clear Sense Status (ignore results) POP HL DEC HL LD A,H OR L ; Counter timed out? JR NZ,LoadW ; ..loop if Not LD HL,timMsg ; Else send appropriate message SCF ; and return Error RET timMsg: DEFB CR,LF,BELL,'..Timeout waiting for Ready! ',0 ;===================== Support Routines ========================= ; Execute a SCSI Inquire (12H) command on the specified drive. First ; Select the drive with Hard Driver Function 1, then fill the Command ; Descriptor Block with Command 12H (Read Mode) parameters and execute. ; If a valid return, determine whether or not the drive is a CD-ROM. ; Return Either a Null Ptr (0000) or Pointer to the Vendor and Product ; ID Strings and Product Revision Level within the User Buffer. ; When the first CD-ROM is encountered, Set a flag and save the ; associated devLUN byte for use in later accesses. Inquir: LD HL,cmdBlk ; Address our local Command Block Image LD (HL),12H ; Stuff Command INC HL LD (HL),0 ; LUN = 0 INC HL LD (HL),0 INC HL LD (HL),0 INC HL LD (HL),0FFH ; Set Maximum space for return params INC HL LD (HL),0 ; No Codes LD HL,(bufAdr) ; Load Inquiry Data to Main Buffer CALL SCSIex ; Execute PUSH AF ; Save stat while we assume Good Opn LD HL,(bufAdr) ; Else pt to Data Area LD A,(HL) ; Get first byte of Data AND 1FH ; mask LD (cdflag),A ; save LD DE,8 ADD HL,DE ; (offset to text) LD DE,idBufr ; Copy potential ID String to Local Buffer LD BC,28 ; Store entire string LDIR XOR A LD (DE),A ; Null-terminate it POP AF ; Return Main Operation flag CALL C,SnsErr ; Real Error, or just info Sense? RET C ; ..return any real Error condition LD A,(cdflag) CP 00101B ; CD-ROM? JP Z,OkExit ; ..jump if Yes for Good Return LD HL,notCD ; Else return Error SCF RET ERROR: LD HL,nulStr SCF RET notCD: DEFB CR,LF,BELL,'++ Not a CD-ROM Drive!',0 ;..... ; Execute a Request Sense SCSI command to see if a Real error was detected. ; Return if only a warning, else delete the return address and return SnsErr: LD HL,cmdBlk ; Pt to Comnd Block LD (HL),03H ; Request Sense INC HL LD (HL),0 ; LUN = 0 INC HL LD (HL),0 ; (reserved) INC HL LD (HL),0 ; (reserved) INC HL LD (HL),32 ; allow up to 32 bytes INC HL LD (HL),0 ; no control codes LD HL,snsDat ; return sense data here CALL SCSIex ; execute JR NC,SnsEr0 ; ..jump if Ok LD HL,InvSns ; Else Pt to Message SCF ; Set Err Flag RET InvSns: DEFB CR,LF,BELL,'--Invalid Sense - ',0 SnsEr0: LD HL,snsDat ; Pt to data area LD A,(HL) ; Get Valid/Error Code byte OR A JP Z,OkExit ; ..exit (assuming Good) if No Code SnsEr1: INC HL INC HL ; Advance to Sense Key LD A,(HL) AND 0FH JP Z,OkExit ; ..exit (assuming Good) if No Specific Info ; Else we may have more specific data to return as a string. LD L,A ; Move resultant Key LD H,0 ; as 16-bits ADD HL,HL ; double for word index LD DE,keyPtr ADD HL,DE ; offset to entry in ptr table LD E,(HL) INC HL LD D,(HL) ; fetch EX DE,HL ; position SCF RET keyPtr: DEFW erStr1, erStr2, erStr3 DEFW erStr4, erStr5, erStr6 DEFW nulStr, erStr8, nulStr DEFW nulStr, erStrB, nulStr DEFW nulStr, nulStr, nulStr erStr1: DEFB '-- Recovered Error',BELL,0 erStr2: DEFB '-- Not Ready',BELL,0 erStr3: DEFB '-- Medium Error',BELL,0 erStr4: DEFB '-- Hardware Error',BELL,0 erStr5: DEFB '-- Illegal Request',BELL,0 erStr6: DEFB '-- Unit Attention',BELL,0 erStr8: DEFB '-- Blank Check',BELL,0 erStrB: DEFB '-- Aborted Command' nulStr: DEFB BELL,0 ; dual-use of ending bytes ;*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*| ;*|* 5380 SCSI Driver *|*| ;*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*| ; 5380 Chip Registers NCRDAT EQU NCR ; Current SCSI Data (Read) ; Output Data Register (Write) NCRCMD EQU NCR+1 ; Initiator Command Register (Read/Write) NCRMOD EQU NCR+2 ; Mode Register (Read/Write) NCRTGT EQU NCR+3 ; Target Command Register (Read/Write) NCRBUS EQU NCR+4 ; Current SCSI Bus Status (Read) NCRST EQU NCR+5 ; Bus & Status Register (Read) ; Start DMA Send (Write) NCRINT EQU NCR+7 ; Reset Parity/Interrupt (Read) ; Start DMA Initiator Receive (Write) DMAACK EQU NCR+8 ; SCSI Dack IO Port (Read/Write) ; Bit Assignments for NCR 5380 Ports as indicated B_ARST EQU 10000000B ; Assert *RST (NCRCMD) B_AACK EQU 00010000B ; Assert *ACK (NCRCMD) B_ASEL EQU 00000100B ; Assert *SEL (NCRCMD) B_ABUS EQU 00000001B ; Assert *Data Bus (NCRCMD) B_BSY EQU 01000000B ; *Busy (NCRBUS) B_REQ EQU 00100000B ; *Request (NCRBUS) B_MSG EQU 00010000B ; *Message (NCRBUS) B_CD EQU 00001000B ; *Command/Data (NCRBUS) B_IO EQU 00000100B ; *I/O (NCRBUS) B_SEL EQU 00000010B ; *Select (NCRBUS) B_PHAS EQU 00001000B ; Phase Match (NCRST) B_BBSY EQU 00000100B ; Bus Busy (NCRST) B_MBSY EQU 00000100B ; Monitor Busy Flag (NCRMOD) B_DMA EQU 00000010B ; DMA Mode of transfer (NCRMOD) ; Equates for the D-X Designs Pty Ltd P112 SCSI interface DRA EQU 0EEH ; Port A Data ; DMA Registers MAR1L EQU 28H ; DMA Memory Addr Reg Ch1-Low MAR1H EQU 29H ; DMA Memory Addr Reg Ch1-High MAR1B EQU 2AH ; DMA Memory Addr Reg Ch1-B IAR1L EQU 2BH ; DMA I/O Addr Reg Ch1-Low IAR1H EQU 2CH ; DMA I/O Addr Reg Ch1-High BCR1L EQU 2EH ; DMA Byte Count Reg Ch1-Low BCR1H EQU 2FH ; DMA Byte Count Reg Ch1-High DSTAT EQU 30H ; DMA Status Reg DCNTL EQU 32H ; DMA/WAIT Control Reg ; System Control Registers CBR EQU 38H ; MMU Common Base Reg BBR EQU 39H ; MMU Bank Base Reg CBAR EQU 3AH ; MMU Common/Bank Area Reg ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ; Try the Command specified. If errors returned (e.g. Attn assertion), ; read the SCSI Sense status and try the command again. ; Enter: HL -> Buffer to Send/Receive data SCSIex: LD (xfrAdr),HL ; Save the Address CALL Hdrw0 ; Try a Normal Data Access RET NC ; ..exitting if Ok LD HL,sense ; Set Ptr to Sense Command Block LD DE,snsDat ; and Sense Data Poiner CALL Hdrw1 ; Try a Sense Read, following thru to Dat Rd Hdrw0: LD DE,(xfrAdr) ; and Data Pointer for Normal Accesses LD HL,cmdBlk ; Set Command Block Address Hdrw1: LD (hdCmdV),HL ; Save Command Block Address LD (hdDatV),DE ; and Data Area Pointer ;..fall thru to change phases on the SCSI bus CALL SCSI ; Do the Work AND 00000010B ; Any errors? RET Z ; return if Ok LD HL,erMsg ; Else SCF ; return Error RET erMsg: DEFB CR,LF,BELL,'++ SCSI Command Error!',0 ;======================================================================== ; Raw SCSI Driver (for Z182 as used in P112) SCSI: XOR A OUT0 (NCRCMD),A ; Clear any previous Controller junk OUT0 (NCRMOD),A OUT0 (NCRTGT),A DEC A ; 0 --> FF LD (status),A ; Set Initial timeout status IN0 A,(NCRINT) ; Clear interrupts & Error Bits LD A,DEVICE ; Get the Target Device address bit OR 10000000B ; add Host initiator address bit OUT0 (NCRDAT),A IN0 A,(NCRCMD) ; Get Initiator Comnd Reg OR B_ABUS ; Get the Data Bus OUT0 (NCRCMD),A LD A,B_ASEL+B_ABUS ; Now Assert both Select and Data Bus bits OUT0 (NCRCMD),A ; Wait for Target to become Busy. The SCSI spec says 250 mS, but we don't ; have a timer, so use an arbitrary counter to set a limit. LD L,0FFH ; Preset Timeout Error Status LD BC,10000 ; (arbitrary limit counter) BsyWt: DEC BC ; Countdown LD A,B OR C ; Have we timed out? JR Z,TimOut ; ..exit to Error if So IN0 A,(NCRBUS) ; Get the Current Bus Status AND B_BSY ; Is it BSY? JR Z,BsyWt ; ..loop if Not ;..else fall thru.. LD A,B_ABUS OUT0 (NCRCMD),A ; Assert Bus w/o Select Command (or free) XOR A ; get a Zero OUT0 (NCRCMD),A ; then free the Data Bus LD (hdone),A ; Start by showing Not Done ; Wait for a Request on the SCSI bus RqWait: IN0 A,(NCRBUS) ; Get Bus status AND B_REQ ; Bus Request yet? JR Z,RqWait ; ..jump if Not and wait WtCall: CALL NZ,SCSInt ; Call the Interrupt to start transfer LD A,(hdone) ; Get Hard Drive Done flag OR A ; Finished? JR NZ,WtDonX ; ..exit if So IN0 A,(DRA) ; Else fetch Status (from Z182 Port A) BIT 4,A ; Interrupt? JR WtCall ; ..check & Read/Write SCSI if So WtDonX: LD HL,(status) ; Else get Status and Message bytes TimOut: LD A,L ; get Status Byte AND 0010B ; Set Flags RET Z ; and return if Ok SCF ; Else Set Error Flag RET ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ; SCSINT - "Interrupt" routine for the NCR 5380/DP 8490 chip. ; ; This routine handles Interrupts generated by the SCSI controller on phase ; changes or loss of BSY signal meaning that the operation is complete. ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: SCSInt: DI ; ..disable interrupts here for local calls XOR A OUT0 (NCRCMD),A ; Release the SCSI Bus IN0 A,(NCRST) ; Get status AND B_BBSY+B_PHAS ; Phase Match or Bus Busy? JR Z,SCSin0 ; ..jump if Not to continue ;..else fall thru to Exit.. ; Exit here when we are done to set the Completed flag DiSCSI: XOR A ; Turn off any SCSI operations OUT0 (NCRMOD),A OUT0 (NCRTGT),A DEC A ; 0 --> FF LD (hdone),A ; Indicate Hard Disk Operation Complete IN0 A,(NCRINT) ; Discard any pending 5380 Interrupts IN0 A,(DSTAT) AND 5FH ; Disable DMA1 Interrupts OUT (DSTAT),A RET ; Continue with Transaction SCSin0: XOR A OUT0 (NCRMOD),A ; Clear DMA mode IN0 A,(NCRINT) ; Clear SCSI Interrupts IN0 A,(DSTAT) AND 5FH ; and Stop Z-180 DMA Ch #1 OUT0 (DSTAT),A LD A,B_MBSY+B_DMA ; Monitor Busy and Set DMA Mode OUT0 (NCRMOD),A ;..fall thru to.. ; Come here when phases change Phase: IN0 A,(NCRBUS) ; Read the Bus Status AND B_MSG+B_CD+B_IO ; keep the three phases we are interested in RRCA ; Rotate Phase status bits RRCA ; into B0-2 position for testing OUT0 (NCRTGT),A ; Check for phase match LD HL,message ; (Ph 7 input goes here) CP 7 ; Are we in Phase 7 ? JR Z,HdIn ; ..jump if so to Message In Phase LD HL,(hdDatV) ; .(Ph 0/1 IO From/To here) OR A ; Are we in Phase 0 ? JR Z,HdOut ; ..jump to if so to Data Out Phase DEC A ; Are we in Phase 1 ? JR Z,HdIn ; ..jump to if so to Data In Phase LD HL,(hdCmdV) ; (Ph 2 output from here) DEC A ; Are we in Phase 2 ? JR Z,HdOut ; ..jump to if so to Command Out Phase LD HL,status ; (Ph 3 Input to here) DEC A ; Are we in Phase 3 ? JR Z,HdIn ; ..jump to if so to Status In Phase ;..else fall thru ; Phases 4, 5 and 6 wind up here in an Error CALL DiSCSI ; Disable any ongoing DMA/SCSI operation LD HL,nulStr OR 0FFH ; Set Flags LD (hdone),A ; signal Done LD (status),A ; w/Error SCF RET ;..... ; SCSI Input routine ; Enter: HL = Address of Receive Buffer start HdIn: LD C,1010B ; Set for Edge Triggering and Read mode CALL STDMA ; Set up Transfer and DMA Data OUT0 (NCRINT),A ; Start DMA Initiator Rcv (bits don't care) EI ; Interrupts Ok Now RET ;..... ; SCSI Output Routine ; Enter: HL = Address of Send Buffer start HdOut: LD C,1000B ; Set for Edge Triggering bit and Write mode CALL STDMA ; Set up Transfer and DMA Data LD A,B_ABUS ; Assert the Data Bus OUT0 (NCRCMD),A OUT0 (NCRST),A ; Start DMA Send (bits irrelevant) EI ; Interrupts Ok Now RET ;..... ; STDMA - Set up DMA Channel 1 for a SCSI Read or Write operation. ; Enter: HL = Start Address of Buffer to Read/Write from/to ; C = Write (1x00B) or Read (1x10B) DMA1 Control bits ; ||++- Mem->IO ||++- IO->Mem ; |+--- DMA0-Sns |+--- DMA0-Sns ; +---- DMA1-Edge +---- DMA1-Edge STDMA: IN0 A,(DCNTL) ; Get DMA1 Control bits AND 0F4H ; mask pertinent bits assuming a Write OR C ; Add Edge Triggering bit and R/W mode OUT0 (DCNTL),A ; and Command DMA Chan 1 IN0 E,(BBR) ; Read current Bank in context LD D,0 EX DE,HL ; position for mult x 16 ADD HL,HL ; shift bits ADD HL,HL ADD HL,HL ADD HL,HL LD A,E ; Position Low 8-bits of rel addr LD E,D ; move hi-8 to Low LD D,0 ; make into Word ADD HL,DE ; to form high 16-bits of Address OUT0 (MAR1B),H OUT0 (MAR1L),A OUT0 (MAR1H),L ; Set DMA for Memory Addr LD A,DMAACK OUT0 (IAR1L),A ; Set DMA IO Port # XOR A OUT0 (IAR1H),A ; (in 16-bit form) OUT0 (IAR1H+1),A ; (insurance) OUT0 (BCR1L),A ; Length (lo) LD A,10 OUT0 (BCR1H),A ; Length (hi) + slop for CD-ROM "Block" IN0 A,(DSTAT) ; Get DMA Chan 1 Status AND 57H ; set for No Terminating Interrupt OR 81H ; enable DMA operation OUT0 (DSTAT),A ; and Start the action! RET ;================= Data Area maintained in Code Segment ================ ; SCSI Read Sense Command Data Block sense: DEFB 03H ; SCSI Sense Command DEFB 00,00,00,32,00 ; remainder of Sense Command Block cdflag: DEFS 1 ; Flag derived from SCSI Inquire Command hdone: DEFS 1 ; Flag to indicate completion of SCSI Opn xfrAdr: DEFS 2 ; Pointer to use for local SCSI IO bufAdr: DEFS 2 ; Pointer to 2048-byte Buffer in Main Pgm hdCmdV: DEFS 2 ; Storage for current Command Data Block hdDatV: DEFS 2 ; Storage for current Data Transfer Area snsDat: DEFS 32 ; Storage for Sense Data Transferred ; SCSI Controller Command Block cmdBlk: DEFS 1 ; Command Byte DEFS 1 ; B7-5 = Unit #, remainder is Hi-Addr DEFS 1 ; Mid-Addr blkL: DEFS 1 ; Lo-Addr DEFS 1 ; Number of Blocks to Read/Write (1=512 bytes) DEFS 1 idBufr: DEFS 29 ; Buffer for CD-ROM "Inquire" Identity String ;<<--- WARNING! --- Do not re-order the following Two Bytes --->> status: DEFS 1 ; Ending Status Byte message: DEFS 1 ; Ending Message Byte LENGTH EQU $-Begin ; Compute Size of Overlay END