; ;***************************************************************************; ; ; ; ; ; cp/m 2.2 magnum bios ; ; for the fc-100 ; ; and magnum series controllers ; ; ; ; copyright 1984, Dion Vaughn ; ; ; ; ; ;***************************************************************************; ; ; ;version 2.5ns - for north star (only difference is bias and ccp values) ; ; msize: equ 56 ;top of ram msizh: equ 56h ;enter as hex number also for signon msg ; ; when using MOVCPM, use MSIZE-3 for nn ; command format will then be: MOVCPM nn * ; stack: equ 0100h ;stack base bias: equ (msize-21)*1024 ;set for north star, (msize-23 is standard) ccp: equ bias+03100h ;ccp base set for north *, (+3400h is standard) bdos: equ ccp+0806h ;bdos base biosb: equ ccp+01600h ;bios base ; iobyte: equ 03 ;i/o byte cdisk: equ 04 ;current logged in disk bdosev: equ 05 ;BDOS entry vector ; dmada: equ 0080h ;dma default address ; puns: equ 01h ;punch status port (serial) pundt: equ 00h ;punch data port (serial) cons: equ 03h ;console status port (serial) condt: equ 02h ;console data port (serial) lstst: equ 08h ;list device status port lstdt: equ 08h ;list device data port ; cntbs: equ 0d0h ;base port for disk controller cnts: equ cntbs ;controller status comr: equ cntbs ;command register trkr: equ cntbs+01 ;track register secr: equ cntbs+02 ;sector register datr: equ cntbs+03 ;data register brdst: equ cntbs+04 ;board setup latch drqs: equ cntbs+06 ;DRQ sync tmrt: equ cntbs+07 ;timer on test ; fill: equ 0e5h ;fill character rdsec: equ 084h ;read command wrsec: equ 0a0h ;write command fcint: equ 0d0h ;forced interrupt of controller chip ; cr: equ 0dh lf: equ 0ah ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; jump table ; ; org biosb ;origin of mbios ; start: jmp boot ;cold boot bios: jmp wboot ;warm boot jmp const ;console status jmp conin ;console character in routine jmp conout ;console character out routine jmp list ;list character out jmp punch ;punch character out jmp reader ;reader character in jmp home0 ;move head to home position jmp sldsk ;select disk jmp settrk ;set track number jmp setsec ;set sector number jmp setdma ;set dma address jmp read ;read from disk jmp write ;write to disk jmp listst ;list status jmp sectran ;sector translate tables ; ; ; the bios map (bmap) is set up to remain at this location relative to the ; bios origin (biosb). this allows external programs to access the routines ; listed in bmap. ; bmap: dw dspb ;address of first disk setup parameter block dw dpbas ;disk parameter block base ; dw crtst ;routine for crt input status dw 0 ;reserved ; dw last ;end of bios code (not including data area) dw 0 ;reserved dw start ;bios origin ; dw crtin ;console input routine dw crtout ;console output routine ; dw ttylst ;list device status routine dw ttylout ;list device output routine ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; cold boot ; boot: lxi sp,stack ;initialize stack ; mvi a,01 ;set io byte to crt sta iobyte ;initialize mvi a,00 ;zero the accumulator sta bufst lda cdisk ;current default disk (cdisk) set by rom sta bootdsk ;also make it the boot disk lxi b,0 ;set diskno value (0-3) mov h,b ;store in variable 'diskno' mov l,c shld diskno call clscr ;clear the screen ; lxi h,smsg ;load address of sign-on message call prnt ;print message mvi a,msizh ;print system size call ahex lxi h,smsg1 call prnt ; mvi a,00 ;reset boot flag sta bootfl jmp wboot ; cboot: mvi a,0ffh ;set boot flag sta bootfl jmp ccp ; sgnon: db '(C) Copyright 1984 Dion Vaughn$' ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; warm boot ; wboot: lxi sp,stack ;initialize stack lda bufst ;reset the buffer ani 0feh ;mark as clean buffer sta bufst mvi a,0ffh ;mark as impossible disk sta bdisk lhld bootdsk mvi b,00 mov c,l ;select boot disk mvi e,0 call sldsk ; lhld diskno ;get the board setup byte call seldspb ; shld cdpb ;store for later use inx h ;side mov a,m ori 010h ;set to side 0 ani 0dfh ;reset to double density out brdst ;out to board setup latch call dskrdy ;get it ready ; ;read in 1st half of ccp (track 0, sector 5) lxi h,5 ;starting sector lxi b,1024 ;read one sector lxi d,ccp ;address of ccp call msrd ;multiple sector read ; cpi 0 ;any errors? jz wboot1 ;then continue ; lxi h,wbmsg1 ;report ccp1 read error call prnt ; jmp wboot ; wbmsg1: db cr,lf,'CCP1 read error$' ; ;step in to track 1, or flip sides if double sided wboot1: lhld cdpb ;load current dspb inx h ;single/double sided and step rate inx h mov a,m ani 04h ;test single/double sided jz stpin ;if single sided step in ; dcx h ;side mov a,m ;else set controller for side 1 ani 0efh ;reset bit 4 out brdst jmp wboot2 ;back to boot routine ; stpin: mvi a,05bh ;step in (slow rate) di out comr call busy ; ;read in the rest of the ccp and the bdos (track 1, sectors 1-5) wboot2: lxi h,1 ;starting sector lxi b,0400h+0e00h ;number of bytes to read call msrd ;call multiple sector read routine ; cpi 0 ;any errors? jz gocpm ;if not continue ; lxi h,wbmsg2 ;report ccp2/bdos read error call prnt ; jmp wboot ; wbmsg2: db cr,lf,'CCP2/BDOS read error$' ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; gocpm: mvi a,0c3h ;load a with jump instruction sta 0000 ;store it at location 0 lxi h,bios ;load bios address into hl shld 0001h ;store it at bios entry vector sta bdosev ;setup bdos entry vector lxi h,bdos ;load bdos address into hl shld bdosev+1 ;store it at bdos entry vector lxi b,dmada ;load bc with default dma address call setdma ; lda cdisk ;load a with current disk number mov c,a ;save it in c ; lda bootfl ;check boot flag cpi 00h jz cboot ; jmp ccp+3 ;take it to the ccp ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; iobyte (location 0003) ; ; device ----- list punch reader console ; bit ----- 7, 6 5, 4 3, 2 1, 0 ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; console status ; ; entry: none ; exit: a = 00h: no character ready ; a = ffh: character ready ; changed: a ; const: lda iobyte ani 03 ;mask off bits 0 and 1 cpi 01 ;crt routine jz crtst ; ; cpi 02 ;batch routine ; jz batst ; ; cpi 03 ;user defined i/o ; jz usrst ; ;ttyst: mvi a,00 ; ret ;not yet implemented ; crtst: in cons ;input the status ani 02 ;mask bit 1 jnz crtst1 ;if so jump to crtst1 ; mvi a,0 ;if not load zero status ret ; crtst1: mvi a,0ffh ;if so load ready status ret ; ;batst: mvi a,00 ; ret ;not yet implemented ; ;usrst: mvi a,00 ; ret ;not yet implemented ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; character in routine ; ; entry: none ; exit: a = 7 bit character from console ; changed: a ; conin: lda iobyte ;load the iobyte ani 03 ;mask bits 0 and 1 cpi 01 ;crt routine jz crtin ; ; cpi 02 ;batch routine ; jz batin ; ; cpi 03 ;user defined i/o ; jz usrin ; ;ttyin: mvi a,00 ; ret ;not yet implemented ; crtin: in cons ;input the status ani 02 ;character ready? jz crtin ;loop until ready ; in condt ;if ready input the character ani 07fh ;strip off parity bit ret nop nop nop nop nop nop ; ;batin: mvi a,00 ; ret ;not yet implemented ; ;usrin: mvi a,00 ; ret ;not yet implemented ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; character out routine ; ; entry: c = 7 bit character to send to console ; exit: none ; changed: a ; conout: lda iobyte ;load the iobyte ani 03 ;mask bits 0 and 1 cpi 01 ;crt routine jz crtout ; ; cpi 02 ;batch routine ; jz batout ; ; cpi 03 ;user defined i/o ; jz usrout ; ;ttyout: mvi a,00 ; ret ;not yet implemented ; crtout: in cons ;input the status ani 01 ;character ready? jz crtout ;loop until ready ; mov a,c ;if ready output the character out condt ret nop nop nop nop nop nop nop ; ;batout: mvi a,00 ; ret ;not yet implemented ; ;usrout: mvi a,00 ; ret ;not yet implemented ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; list device status ; ; entry: none ; exit: a = 00h: not ready ; a = 01h: ready ; changed: a ; listst: ;lda iobyte ;load iobyte into a ; rlc ;shift bits 6, 7 to 0, 1 ; rlc ; ani 03 ;mask bits 0 and 1 ; cpi 01 ;crt routine ; jz crtlst ; ; cpi 02 ;batch routine ; jz batlst ; ; cpi 03 ;user defined i/o ; jz usrlst ; ttylst: in lstst ;input status ani 01 ;test bit 0 mvi a,0 rz mvi a,0ffh ret ; ;crtlst: mvi a,00 ; ret ;not yet implemented ; ;batlst: mvi a,00 ; ret ;not yet implemented ; ;usrlst: mvi a,00 ; ret ;not yet implemented ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; list device ; ; entry: c = 7 bit character to send to list device ; exit: none ; changed: a ; list: ;lda iobyte ;load iobyte into a ; rlc ;shift bits 6, 7 to 0, 1 ; rlc ; ani 03 ;mask bits 0 and 1 ; cpi 01 ;crt routine ; jz crtlout ; ; cpi 02 ;batch routine ; jz batlout ; ; cpi 03 ;user defined i/o ; jz usrlout ; ttylout:in lstst ;input status ani 01 ;test bit 0 jnz ttylout ;loop until ready ; mov a,c ;move character to a ori 80h ;add strobe out lstdt ;output xri 80h ;strobe out lstdt ;output xri 80h ;strobe out lstdt ;output ret nop ;extra space nop nop nop nop ; ;crtlout:mvi a,00 ; ret ;not yet implemented ; ;batlout:mvi a,00 ; ret ;not yet implemented ; ;usrlout:mvi a,00 ; ret ;not yet implemented ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; punch device ; ; entry: c = 7 bit character to send to punch device ; exit: none ; changed: a ; punch: ;lda iobyte ;load the iobyte ; rlc ; rlc ; rlc ; rlc ; ani 03 ;mask bits 0 and 1 ; cpi 01 ;crt routine ; jz crtpout ; ; cpi 02 ;batch routine ; jz batpout ; ; cpi 03 ;user defined i/o ; jz usrpout ; ttypout:in puns ;input the status ani 01 ;character ready? jz ttypout ;loop until ready ; mov a,c ;if ready output the character out pundt ret ; ;crtpout:mvi a,00 ; ret ;not yet implemented ; ;batpout:mvi a,00 ; ret ;not yet implemented ; ;usrpout:mvi a,00 ; ret ;not yet implemented ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; reader device ; ; entry: none ; exit: a = 7 bit character from reader device ; changed: a ; reader: ;lda iobyte ;load the iobyte ; rrc ; rrc ; ani 03 ;mask bits 0 and 1 ; cpi 01 ;crt routine ; jz crtrin ; ; cpi 02 ;batch routine ; jz batrin ; ; cpi 03 ;user defined i/o ; jz usrrin ; ttyrin: in puns ;input the status ani 01 ;character ready? jz ttyrin ;loop until ready ; in pundt ;if ready input the character ani 07fh ;strip off parity bit ret ; ;crtrin: mvi a,00 ; ret ;not yet implemented ; ;batrin: mvi a,00 ; ret ;not yet implemented ; ;usrrin: mvi a,00 ; ret ;not yet implemented ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; select disk ; ; entry: c = logical disk selected (0-15) ; e = if 0, first time selected ; exit: hl = disk parameter header address ; hl = 00 if error ; changed: ; sldsk: push psw ;save registers push b push d lxi h,0 ;load hl with zero for default error lda nmdrvs ;test for valid disk dcr a ;zero based drive numbers cmp c ;compare jc sldbp ;return on error (c > nmdrvs) ; lhld diskno ;get old disk's dspb call seldspb ; in trkr ;save head position of old disk mov m,a mvi h,0 mov l,c ;select new disk shld diskno ;store it in diskno call seldspb ;get the table address in hl ; mov a,m ;get the new track address out trkr ;output current track to track register inx h ;side mov a,m ;get the new setup byte out brdst ;output controller setup byte ;set step rate for seek and restore commands inx h mov a,m ;rate, single/double sided byte ani 03 ;mask bits 0 and 1 mov b,a ;save in b lda skcmd ;get the seek command ani 0fch ;strip off bits 0 and 1 (rate bits) ora b ;set the rate bits sta skcmd ;store at skcmd lda rstcd ;load the restore command ani 0fch ;strip off bits 0 and 1 ora b ;set the rate bits sta rstcd ;store at rstcd mov a,e ;move e to a ani 01 ;logged in yet? cz home ;set home and home disk ;compute proper disk parameter header address lhld diskno dad h ;*2 dad h ;*4 dad h ;*8 dad h ;*16 (size of each header) lxi d,dpbas ;de=table base address dad d ;hl=dpbase(diskno*16) sldbp: pop d ;restore registers pop b pop psw ret ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; home: call home0 ; homer: di ;disable interupts lda rstcd ;load restore command out comr call busy ;wait untill restore is done ; ret ; home0: lxi b,0 ;using set track routine ; ; establish logical track number for next r/w operation ; (actually converts track to side/cylinder pair) ; ; entry: bc = logical track number ( ex. 0-153 for double sided 8 in. ) ; exit: none ; cylinder 0 1 2 3 4 ... ; track conversion: side 0 - 000 002 004 006 008 ... n-1 ; side 1 - 001 003 005 007 009 ... n ; sector header: cylinder : side : sector : length code ; settrk: push d push h mov l,c ;move c to l mov h,b ;load h with 0 shld track ;store at 'track' ; lhld diskno ;test single/double sided call seldspb ; inx h ;rate, single/double sided inx h mov a,m ani 04h ;bit 2 jz sd0sel ;if 0 then the drive is single sided ; ;double sided - track divided by 2 = cylinder ;if even - side 0, if odd - side 1 ora a ;clear carry flag mov a,c rar ;divide by 2 mov c,a jnc sd0sel ;if even, select side 0 ; xra a sta side ;if odd, set side flag for side 1 jmp sdsel ; sd0sel: mvi a,10h ;set side flag for side 0 sta side ; sdsel mov e,m ;check for 48/96 tpi drive inx h mov a,m ;check for 48/96 tpi diskette xra e ani 080h ;bit 7 sta forty8 ;48/96 tpi flag (1 = 48 tpi in 96 tpi drive) ; mov h,b mov l,c shld cylind ;set cylinder pop h pop d ret ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; setsec ; ; convert logical record to physical sector/offset pair ; ; entry: bc = standard 128 byte record number ; note: depending on dspb, offset 3, bit 3 ... ; if first sector is 1 then bc ranges from 1-spt ; if first sector is 0 then bc ranges from 0-spt-1 ; exit: none ; setsec: push h mov h,b mov l,c shld sector ;save original value lxi h,0 ;initialize offset store shld offset lhld diskno ;initialize... call seldspb ; inx h ;sector size (0=128, 1=256, 2=512, 3=1024) inx h inx h mov a,m ani 07h lxi d,128 ;128 byte sector length ora a ;if secsz = 0 (128 bytes), bypass jz sec1 ; mvi h,0 mov l,a shld cdpb dcx b ;adjust to 0 base temporarily for math below ; ; perform an "n shift" of reg pair BC where "n" is secsz value (1-7) in a ; low n bits - value v such that 128*2^v is buffer offset ; high 16-n bits - when 1 based, is the physical sector sstop: ora a ;clear carry flag mov a,b ;divide by 2 rar mov b,a mov a,c rar mov c,a jnc sec0 ; lhld offset dad d ;add "adder" value into running total shld offset sec0: ora a ;clear carry flag mov a,e ral ;multiply by 2 mov e,a mov a,d ral mov d,a lhld cdpb dcr l ;count down shld cdpb jnz sstop ;if not done jump back ; inx b ;back to 1 base sector count ; sec1: mov h,b mov l,c shld dsect ;physical destination sector pop h ret ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; sector translation ; ; translate record according to disk skew factor ; ; entry: bc = 128 byte record number to translate (0-n) ; de = address of skew table ; exit: hl = translated 128 byte record number ; changed: none ; sectran:push psw ;save status word mov a,d ora e jnz sect1 ;if non-zero, table is needed ; mov h,b ;transfer bc to hl mov l,c ;for 128 byte record jmp sect2 ; sect1: xchg ;hl= translate table addr dad b mov l,m mvi h,0 ;hl= trans(sector) sect2: pop psw ret ;with value in hl ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; set dma (base of file buffer for r/w operations) ; ; entry: bc = address for system r/w operations ; exit: none ; changed: none ; setdma: push h mov l,c mov h,b shld dmaad pop h ret ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ;read ; ; record placed at last SETDMA as per SELDSK, SETTRK and SETSEC ; ; entry: none ; exit: a = 0 - no error nonzero - error ; read: call match ;ensure desired sector is in memory buffer ; cpi 0 ;test for error rnz ;on error return to bdos ; rls: lhld offset ;read logical sector (128 byte record) lxi d,buffer ;from offset in buffer to dma address dad d push h lhld dmaad xchg pop h lxi b,128 call blkmv ; ret ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; block read routine ; ; read 1024 byte physical buffer per diskno, cylind, side, dsect ; label the physical buffer as per bdisk, bcylind, bside, bsect ; ; note: error-on-read leaves buffer invalid, MATCH will force re-read ; entry: none ; exit: none ; changed: all ; blkrd: lda bufst ;mark buffer invalid ori 02 ;set bit 1 sta bufst ; lhld diskno ;board setup shld bdisk ;disk number lhld cylind shld bcylind ;cylinder lhld side shld bside ;side lhld dsect shld bsect ;sector ; lhld bcylind ;seek cylinder ; lda forty8 ;check if 48 tpi in 96 tpi drive cpi 080h ;bit 7 cz dbltrk ;if 48 tpi - go to track doubler ; mov a,l out datr lda skcmd di out comr call busy ;wait til command is thru ; lda bsect ;set sector out secr lda bside ;set side mov b,a lhld bdisk ;load board setup byte call seldspb shld cdpb ; inx h ;side mov a,m ani 0efh ;clear single/double sided bit ora b ;set side out brdst inx h ;sector size inx h mov a,m ;set track register (if not same as cylinder) ani 010h ;bit 4 jz br2 ; lda track out trkr ; br2: call dskrdy ;wait til drive is ready call secsiz ;get sector length (comes back in bc) ; lxi d,buffer ;physical buffer pointer mvi a,rdsec ;read sector call rd ;read data from disk call busy ;wait till command is done ; in cnts ;get the controller status ani 09ch ;save bits 2, 3, 4, 7 sta errst ;save status temporarily ; lhld cdpb ;reset track register inx h ;sector size inx h inx h mov a,m ani 010h ;bit 4 jz br4 ; lda bcylind out trkr ; br4: lda errst ;on error mark buffer invalid cpi 0 jnz br1 ; lda bufst ;if no error mark buffer as valid ani 0fdh ;reset bit 1 sta bufst jmp brnd ; ;read error report ; br1: lhld bdisk ;reselect disk mov b,h mov c,l mvi e,01 call sldsk call homer ;don't restore will mess up track ; lda errst ;status lxi b,br3 ;message call prterr ; brnd: lda errst ;restore error status ret ; br3: db ' read error $' ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; rd ; ; read data stream from controller ; ; entry: a = controller read command ; bc = number of bytes to read ; de = destination address ; exit: none ; changed: all ; rd: di out comr ; rd1: out drqs ;sync z80 and wd279x in datr ;get byte from disk stax d ;store in buffer inx d ;increment pointer dcx b ;decrement byte count mov a,c ;done? ora b jnz rd1 ;loop until done ; ret ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; msrd ; ; performs a multiple sector read ; ; entry: bc = number of bytes to read ; de = destination address ; l = starting sector ; exit: error code ; changed: psw,cdpb ; msrd: mov a,l ;sector number out secr ;out to sector register mvi a,094h ;load multiple sector read command call rd ;call read routine ; in cnts ;get the status ani 09ch ;mask bits 2, 3, 4, 7 call clear ;wait till operation is complete ; ret ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; write ; ; record specified by last SETDMA written per SELDSK, SETTRK, SETSEC ; ; entry: c = 0: normal write, preread, defer writing if possible ; 1: directory, preread, NO defer of writing ; 2: first write, no preread, defer writing if possible ; exit: a = 0: no error nonzero: error ; write: mov a,c cpi 01 ;directory write? jz dir ;if so jump to dir ; cpi 02 ;new block? jz newblk ;if so jump to newblk ; normal: call match ;match the desired sector to buffered sector ; cpi 0 ;test for error rnz ;error - return to bdos ; call wls ;write from dma to buffer ; ret ; dir: call normal ;directory write follows same path ; cpi 0 ;test for error rnz ;error - return to bdos ; call blkwr ;write buffered physical sector immediately ; ret ; newblk: call match ;does a preread to position disk head properly cpi 0 ;test for error rnz ;on error return to bdos ;initialize new 1k buffer mvi a,fill ;initialize buffer with fill character E5h sta buffer lxi h,buffer lxi d,buffer+1 lxi b,1024-1 call blkmv ; call wls ;write a logical sector into the buffer ; ret ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; move a logical sector (128 bytes) from dma to buffered physical sector ; ; entry: none ; exit: a = 0 ; changed: all ; wls: lhld offset lxi d,buffer dad d xchg lhld dmaad lxi b,128 call blkmv ; lda bufst ;mark buffered physical sector as updated ori 01 ;set bufst bit sta bufst ;store flag xra a ret ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; block write routine ; ; perform actual writing of buffered physical sector to disk ; ; note: always clears bufst bit - keeps error-on-write from hanging ; entry: none ; exit: a = 0: no error ; changed: all ; blkwr: lhld diskno ;save current logical disk push h lhld bdisk mov c,l mvi b,0 ;select physical buffer's disk mvi e,01 call sldsk ; ; assume head is already set to cylinder ; bw1: lda bside ;set side mov b,a lhld bdisk ;get board setup byte call seldspb ; shld cdpb inx h ;side mov a,m ani 0efh ;clear single/double sided bit ora b ;set side out brdst ; lda bsect ;set sector out secr ; inx h ;sector size inx h mov a,m ;set track register (if not same as cylinder) ani 010h ;bit 4 jz bw4 ; lda track ;set track out trkr ; bw4: call dskrdy ;is disk ready? call secsiz ;sector length lxi d,buffer ;physical buffer pointer mvi a,wrsec ;load write sector command call wrt call busy ;wait until command is executed in cnts ;get status to check for errors ani 0dch ;strip off bits 0 and 1 sta errst ;save status ; lhld cdpb ;reset track register to represent cylinder inx h ;sector size inx h inx h mov a,m ani 010h ;bit 4 jz bw5 ; lda bcylind out trkr ; bw5: lda errst ;exit if no error cpi 0 jz bwnd ; ;write error report ; bw2: lhld bdisk ;reselect disk, restore head mov c,l mvi b,0 mvi e,0 ;first time disk select call sldsk ; lhld bcylind ;reposition head ; lda forty8 ;check if 48 tpi in 96 tpi drive cpi 080h ;bit 7 cz dbltrk ;if 48 tpi - go to track doubler ; mov a,l out datr lda skcmd di out comr dblret: call busy ; lda errst ;status lxi b,bw3 ;message call prterr ; bwnd: lda bufst ;clear the update bit of the bufst word ani 0feh ;reset bit 0 sta bufst pop b ;restore originally selected disk mvi e,01 call sldsk ; lda errst ;restore status for error checking ret ; bw3: db ' write error ','$' ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; wrt ; ; write data stream to controller ; ; entry: a = controller write command ; bc = number of bytes to write ; de = source address ; exit: none ; changed: all ; wrt: di out comr ; wrt1: out drqs ;sync z80 and wd279x ldax d ;store into buffer out datr ;write byte to disk inx d ;increment pointer dcx b ;decrement byte count mov a,c ;done? ora b jnz wrt1 ;loop until done ; ret ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; track doubler ; ; set up for 48 tpi disk in 96 tpi drive - (double step) ; dbltrk: in trkr ;get current track register mov c,a ;store it temporarily mov a,l ;first seek out datr lda skcmd ;seek command di out comr call busy ; mov a,c ;restore old track register value out trkr ;make controller think seek not yet done ; ret ;go do second seek and continue ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; block move ; ; block move from hl pointer to de pointer ; ; entry: bc = number of bytes in block to move ; exit: none ; blkmv: mov a,m ;source pointer stax d ;destination pointer inx d inx h dcx b ;number of bytes counter mov a,c ora b ;empty? jnz blkmv ;if not loop til done ; ret ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; buffer update ; ; writes updated buffer to disk ; ; entry: none ; exit: a = error flag ; bufud: lda bufst ;buffer been updated? ani 01 jz bufw ; call blkwr ;if yes, write it to disk ; cpi 0 rnz ;report write error ; bufw: call blkrd ;get sector ; ret ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; match ; ; checks for new sector, track, side, disk ; ; entry: none ; exit: a = error code ; match: lda dsect ;new sector? mov b,a lda bsect cmp b jnz bufud ;if so go get it ; lda cylind ;track mov b,a lda bcylind cmp b jnz bufud ; lda side ;side mov b,a lda bside cmp b jnz bufud ; lda diskno ;disk mov b,a lda bdisk cmp b jnz bufud ; lda bufst ;buffer valid? ani 02 jnz bufud ; xra a ;set for no error ret ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; seldspb ; ; return dspb address of specified logical disk ; ; entry: hl = logical disk number ; exit: hl = dspb of specified disk ; changed: none ; seldspb:push d ;save registers dad h ; * 2 shift for offset dad h ; * 4 lxi d,dspb ;table base dad d ;offset pop d ;restore register ret ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; secsiz ; ; returns sector length for any given disk ; ; entry: none ; exit: bc = sector length in bytes ; changed: none ; secsiz: push psw ;save registers push h lhld cdpb ;load dspb inx h ;sector size inx h inx h mov a,m ;get code for sector size (0 - 3) ani 07h ;mask off bits 0-2 add a ;multiply by 2 mov c,a ;move it to bc mvi b,0 lxi h,lencode ;load base address dad b ;add offset mov c,m ;load into c inx h mov b,m pop h pop psw ret lencode:dw 128,256,512,1024 ;length code table ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; print message ; ; entry: hl = string address ; exit: hl = points to delimiter ; changed: none ; prnt: push psw ;save the status word push b ;save bc prntlp: mov a,m ;load char into a cpi 024h ;'$'= end of string delimiter jz prnt0 ;return if eos ; mov c,a ;save char in c call conout ;print the character ; inx h ;increment the counter jmp prntlp ; prnt0: pop b ;restore bc pop psw ;restore status word ret ; ; clscr: lxi h,clrsc ;clear screen call prnt ret ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; prterr ; ; prints message, buffer disk, side, sector, and status ; ; entry: a = status ; bc = message ; exit: none ; changed: none ; prterr: push psw ;save registers push b lxi h,crlf ;new line call prnt ; pop h ;(was pushed by bc) message line call prnt ; lda bdisk ;disk adi 041h ;calculate ascii disk name mov c,a call conout ; mvi c,03ah ;':' call conout ; lxi h,trmsg ;'trk' call prnt ; lda bcylind ;track number call ahex ; lda bside ;side cpi 0 jz errs1 ; lxi h,ems0 ;'side 0' jmp errcom ; errs1: lxi h,ems1 ;'side 1' errcom: call prnt ; lxi h,secmsg ;' sector ' call prnt ; lda bsect ;sector call ahex ; lxi h,stmsg ;'status: ' call prnt ; pop psw ;status call ahex ; ret ; ems0: db ' side 0$' ems1: db ' side 1$' trmsg: db ' trk$' secmsg: db ' sector $' crlf: db cr,lf,'$' stmsg: db ' status: $' ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; ahex ; ; prints reg a in 2 hex digits ; ; entry: a = value to be printed ; exit: none ; changed: none ; ahex: push b push psw ;save a rrc ;high order nibble rrc rrc rrc call nibhex ;convert to ascii call conout ;print it ; pop psw ;low order nibble call nibhex ;convert to ascii call conout ;print it ; pop b ret ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; nibhex ; ; converts a nibble to a hex digit ; ; entry: a = value whose low 4 bits get converted ; exit: c = hex code for low order nibble ; changed: none ; nibhex: ani 0fh ;mask off lower nibble adi 030h ;convert to ascii cpi 039h+1 ;is it a-f? jc nib1 ;if so bypass ; adi 07 ;convert to a-f nib1: mov c,a ret ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; clear ; ; waits until disk status indicates ready ; ; entry: none ; exit: none ; changed: none ; clear: ; on entry to this command interrupts are expected to be off push psw ;save a mvi a,fcint ;reset controller chip (forced interrupt) out comr call busy ;wait till done ; pop psw ;restore a ret ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; busy - waits (loops) until controller is finished with last command ; ; entry: none ; exit: none ; changed: none ; busy: push psw ;save registers push b mvi b,10 ;set up tight loop for wait (per W D) wtlp: dcr b jnz wtlp ; cstat: in cnts ;input status byte ani 1 ;mask bit 0 jnz cstat ;loop if still busy ; pop b ;restore registers pop psw ret ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; dskrdy ; ; waits until drive is ready ; ; entry: none ; exit: none ; changed: psw ; ;disk ready routine not using READY line, five revolutions for spin-up dskrdy: in tmrt ;get timer status ani 08h ;test bit 3 rz ;return if timer is still on ; push b ;save registers mvi b,05h ;count 5 index pulses dr1: in cnts ;start disk and look for index pulse (mark) ani 02h ;test bit 1 jz dr1 ; dr2: in cnts ;now look for space between holes ani 02 ;test bit 1 jnz dr2 dcr b jnz dr1 ;count 5 index pulses pop b ;restore registers ret ; ;^^^^^^^^^^^; ;***************************************************************************; ; ; ; ; ; cp/lf,lf,lf,lf,lf,lf,lf,lf,lf,lf,lf,lf,lf,lf,lf,lf db lf,lf,lf,cr,'$' ; smsg: db cr,lf,'magnum computer systems',cr,lf,' bios for cp/m 2.2 $' smsg1: db 'k',cr,lf,' bios version 2.5 ',cr,lf,lf,'$' ; nmdrvs: db 04 ;number of drives in system skcmd: db 18h ;seek command rstcd: db 08h ;restore command ; forty8: db 0 ;48/96 tpi flag ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; disk setup parameter block ; ; offset 1 - board setup byte prcmpe equ 00000000b ;write precomp enabled prcmpd equ 10000000b ;write precomp disabled inch8 equ 01000000b ;8 inch disk drive inch5 equ 00000000b ;5 1/4 inch disk drive sden equ 00100000b ;single density dden equ 00000000b ;double density ; drv0 equ 00001110b ;physical drive 0 drv1 equ 00001101b ;physical drive 1 drv2 equ 00001011b ;physical drive 2 drv3 equ 00000111b ;physical drive 3 ; ;offset 2 - drive head step rate ; tpi96 equ 00000000b ;96 tpi tpi48 equ 10000000b ;48 tpi ; rate0 equ 00000000b ;8" 3 ms 5" 6 ms rate1 equ 00000001b ;8" 6 ms 5" 12 ms rate2 equ 00000010b ;8" 15 ms 5" 30 ms rate3 equ 00000011b ;8" 30 ms 5" 60 ms ; sside equ 00000000b ;single sided dside equ 00000100b ;double sided ; ; ;offset 3 - physical sector size l128 equ 00 ;3 bits for expansion to large sectors l256 equ 01 l512 equ 02 l1024 equ 03 ; ; trkcyl equ 00010000b ;sectors labeled with track (Jade) ; ; ; drive a ------- magnum 5 dspb: db 00 ;old cylinder db inch5+dden+drv0 ;board setup byte db tpi48+sside+rate0 ;single/double sided and step rate db tpi48+l1024 ;diskette tpi, sector length ; ; drive b ------- magnum 5 db 00 ;old cylinder db inch5+dden+drv1 ;board setup byte db tpi48+sside+rate0 ;single/double sided and step rate db tpi48+l1024 ;diskette tpi, sector length ; ; drive c ------- magnum 8 db 00 ;old cylinder db inch8+dden+drv2 ;board setup byte db sside+rate0 ;single/double sided and step rate db l1024 ;sector length ; ; drive d ------- magnum 8 db 00 ;old cylinder db inch8+dden+drv3 ;board setup byte db sside+rate0 ;single/double sided and step rate db l1024 ;sector length ; ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; disk parameter header map ; ; ; disk a dpbas: dw stta ;addr of sector translate (skew factor) dw 0000h,0000h,0000h ;bdos work area dw dirbf ;dirbuf - addr of directory buffer dw dska ;addr of disk paramter block (dpb) dw chka ; csv ; addr of directory ckeck area dw alla ; alv ; addr of allocation vector area ; ; disk b dw sttb ;addr of sector translate (skew factor) dw 0000h,0000h,0000h ; bdos work area dw dirbf ; dirbuf ; addr of directory i/o buffer dw dskb ;addr of disk paramter block (dpb) dw chkb ; csv ; addr of directory ckeck area dw allb ; alv ; addr of allocation vector area ; ; disk c dw sttc ;addr of sector translate (skew factor) dw 0000h,0000h,0000h ; bdos work area dw dirbf ; dirbuf ; addr of directory i/o buffer dw dskc ;addr of disk paramter block (dpb) dw chkc ; csv ; addr of directory ckeck area dw allc ; alv ; addr of allocation vector area ; ; disk d dw sttd ;addr of sector translate (skew factor) dw 0000h,0000h,0000h ; bdos work area dw dirbf ; dirbuf ; addr of directory i/o buffer dw dskd ;addr of disk paramter block (dpb) dw chkd ; csv ; addr of directory ckeck area dw alld ; alv ; addr of allocation vector area ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; sector translate table (skew) ; ; ; translate table for MAGNUM standard 5 1/4 inch drives stta: db 01,02,03,04,05,06,07,08 ; 1 ; 1, 2, 3, 4, 5, 6, 7, 8 db 17,18,19,20,21,22,23,24 ; 3 ; 9,10,11,12,13,14,15,16 db 33,34,35,36,37,38,39,40 ; 5 ; 17,18,19,20,21,22,23,24 db 09,10,11,12,13,14,15,16 ; 2 ; 41,42,43,44,45,46,47,48 db 25,26,27,28,29,30,31,32 ; 4 ; 49,50,51,52,53,54,55,56 ds 32 ; ; ; translate table for MAGNUM standard 5 1/4 inch drives sttb: db 01,02,03,04,05,06,07,08 ; 1 ; 1, 2, 3, 4, 5, 6, 7, 8 db 17,18,19,20,21,22,23,24 ; 3 ; 9,10,11,12,13,14,15,16 db 33,34,35,36,37,38,39,40 ; 5 ; 17,18,19,20,21,22,23,24 db 09,10,11,12,13,14,15,16 ; 2 ; 41,42,43,44,45,46,47,48 db 25,26,27,28,29,30,31,32 ; 4 ; 49,50,51,52,53,54,55,56 ds 32 ; ; translate table for MAGNUM standard 8 inch diskettes sttc: db 01,02,03,04,05,06,07,08 ; 1 ; 1, 2, 3, 4, 5, 6, 7, 8 db 17,18,19,20,21,22,23,24 ; 3 ; 9,10,11,12,13,14,15,16 db 33,34,35,36,37,38,39,40 ; 5 ; 17,18,19,20,21,22,23,24 db 49,50,51,52,53,54,55,56 ; 7 ; 25,26,27,28,29,30,31,32 db 65,66,67,68,69,70,71,72 ; 9 ; 33,34,35,36,37,38,39,40 db 09,10,11,12,13,14,15,16 ; 2 ; 41,42,43,44,45,46,47,48 db 25,26,27,28,29,30,31,32 ; 4 ; 49,50,51,52,53,54,55,56 db 41,42,43,44,45,46,47,48 ; 6 ; 57,58,59,60,61,62,63,64 db 57,58,59,60,61,62,63,64 ; 8 ; 65,66,67,68,69,70,71,72 ; ; ; translate table for MAGNUM standard 8 inch diskettes sttd: db 01,02,03,04,05,06,07,08 ; 1 ; 1, 2, 3, 4, 5, 6, 7, 8 db 17,18,19,20,21,22,23,24 ; 3 ; 9,10,11,12,13,14,15,16 db 33,34,35,36,37,38,39,40 ; 5 ; 17,18,19,20,21,22,23,24 db 49,50,51,52,53,54,55,56 ; 7 ; 25,26,27,28,29,30,31,32 db 65,66,67,68,69,70,71,72 ; 9 ; 33,34,35,36,37,38,39,40 db 09,10,11,12,13,14,15,16 ; 2 ; 41,42,43,44,45,46,47,48 db 25,26,27,28,29,30,31,32 ; 4 ; 49,50,51,52,53,54,55,56 db 41,42,43,44,45,46,47,48 ; 6 ; 57,58,59,60,61,62,63,64 db 57,58,59,60,61,62,63,64 ; 8 ; 65,66,67,68,69,70,71,72 ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; disk paramter block tables ; ; ; magnum 5 - DSDD 5 1/4" - 48tpi 1024 bytes/sector 5 sectors/track ; ; 2K blocks, total disk data capacity: 390K = 195 blocks ; 64 directory entry/block ( 16k/dir ) == 25 min. entry for 1 large file ; 64 entry/bl * 2bl = 128 entry = 256K max ( assuming 1 block files ) dska: dw 40 ; spt - sectors per track db 4 ; bsh - block shift factor db 15 ; blm - block mask db 1 ; exm - extent mask dw 194 ; dsm - drive capacity: ((80-2)*5/2bls)-1 dw 127 ; drm - directory size: 64dir/bl.2bl db 0c0h,0 ; al0/al1 - initial allocation vector dw 32 ; cks - check area size (127+1)/4 dw 2 ; off - reserved tracks ; ; ; magnum 5 - DSDD 5 1/4" - 48tpi 1024 bytes/sector 5 sectors/track ; ; 2K blocks, total disk data capacity: 390K = 195 blocks ; 64 directory entry/block ( 16k/dir ) == 25 min. entry for 1 large file ; 64 entry/bl * 2bl = 128 entry = 256K max ( assuming 1 block files ) dskb: dw 40 ; spt - sectors per track db 4 ; bsh - block shift factor db 15 ; blm - block mask db 1 ; exm - extent mask dw 194 ; dsm - drive capacity: ((80-2)*5/2bls)-1 dw 127 ; drm - directory size: 64dir/bl.2bl db 0c0h,0 ; al0/al1 - initial allocation vector dw 32 ; cks - check area size (127+1)/4 dw 2 ; off - reserved tracks ; ; ; ; disk description for MAGNUM 8 dsdd disk drives ; note: 2k blocks, total disk data capacity = 152tr*9k/tr = 1368K = 684 blocks ; 64 directory entry/block ( 16k/dir ) == 86 min. entry for 1 large file ; 64 entry/bl * 5bl = 320 entry = 640K max ( assuming 1 block files ) dskc: dw 72 ; spt - sectors per track db 4 ; bsh - block shift factor db 15 ; blm - block mask db 0 ; exm - extent mask dw 683 ;dsm - drive capacity ((154-2)*9/2bls)-1 dw 319 ; drm - directory size db 0f8h,0 ; al0/al1 - initial allocation vector dw 80 ; cks - check area size (319+1)/4 dw 2 ; off - reserved tracks ; ; ; disk description for MAGNUM 8 dsdd disk drives ; note: 2k blocks, total disk data capacity = 152tr*9k/tr = 1368K = 684 blocks ; 64 directory entry/block ( 16k/dir ) == 86 min. entry for 1 large file ; 64 entry/bl * 5bl = 320 entry = 640K max ( assuming 1 block files ) dskd: dw 72 ; spt - sectors per track db 4 ; bsh - block shift factor db 15 ; blm - block mask db 0 ; exm - extent mask dw 683 ;dsm - drive capacity ((154-2)*9/2bls)-1 dw 319 ; drm - directory size db 0f8h,0 ; al0/al1 - initial allocation vector dw 80 ; cks - check area size (319+1)/4 dw 2 ; off - reserved tracks ; ; ; ; ; ; end of fixed tables ; last: equ $-start ; ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; ; ; uninitialized data area ; ; ; this is an uninitialized data area, and does not need to ; be a part of the system memory image stored on track 1 sectors 1-4. ; When planning CP/M size, allow enough room. ; begdat equ $ ; beginning of impure data area ; ; various and sundry variables ; bootdsk:db 0 ; the assigned boot disk cdpb: dw 0 ;current dspb bootfl: db 0 ;cold boot/warm boot flag temp: dw 0 ;status errst: db 0 ;status ; dmaad: dw 0 ;dma address set by SETDMA ; ;variables for drive, head placement, sector and deblocking diskno: dw 0 ;current disk per SETDSK ; track: dw 0 ;useful for sectors labeled with track not cylinder cylind: dw 0 ;actual physical cylinder per SETTRK side: dw 0 ;side per SETTRK ; dsect: dw 0 ;destination physical sector number sector: dw 0 ;logical record (128 byte sector) number per SETSEC offset: dw 0 ;offset into physical record buffer ; ;buffered sector variables bdisk: dw 0 ;disk of current buffered sector ; bcylind:dw 0 ;cylinder of current buffered sector bside: dw 0 ;side of current buffered sector ; bsect: dw 0 ;current physical sector in buffer ; ;1k sector buffer area bufst: db 0 ;buffer status buffer: ds 1024 ;buffer for largest possible physical sector ; dirbf: ds 128 ;scratch directory area ; ;allocation vector - size is dsm/8+1 alla: ds 100 ;allocation vector - large enough for 793 blocks allb: ds 100 ;allocation vector allc: ds 100 ;allocation vector alld: ds 100 ;allocation vector ; ;directory check information - size is cks (of dpbm) or (drm+1)/4 chka: ds 100 ;check vector - large enough for 400 directory entries chkb: ds 100 ;check vector chkc: ds 100 ;check vector chkd: ds 100 ;check vector ; ; end ;