home *** CD-ROM | disk | FTP | other *** search
-
- ; FORMATS ONLY - NO SYSGEN
-
-
-
- firstrack equ 0 ; First track to format
- firsect equ 0 ; First sector to format
- ntrks equ 2 ; Number of tracks to format
-
- ddata equ 2ah ;
- dcntl equ 2bh ;
-
- ld bc,51
- ld hl,(01)
- ld de,jmptable
- ldir
- ld c,19h
- call 5 ; Get currently logged in disk
- ld (curdsk),a
-
-
- ; Check to see if Ram disk has been initiated.
-
- checki:
- ld a,(setram)
- cp 0c3h ; Do we have a jump command?
- jr z,chek0
- call say
- defz ' BIOS does not support RAM disk'
- ret
-
- chek0:
- ld c,2
- call setram
- inc a
- jr nz,iok
- call say
- defz ' RAM disk not initialized'
- ret
-
-
-
- ; Set ramdisk to input (just for safety's sake)
-
- iok: dec a
- ld (rdnum),a ; Save away current logical ramdisk
- ld a,0cfh
- out (dcntl),a
- ld a,0ffh
- out (dcntl),a
-
- ; Test high off track for format pattern. Format if not already done
- ;
- test: ld bc,80h
- call setdma
- ld a,(rdnum)
- ld c,a
- call seldsk
- ld c,186
- call settrk
- ld c,39
- call setsec
- call read
- ld a,(80h)
- ld b,a
- ld a,(dfim)
- cp b
- jr nz,set_trks
- call say
- defz ' Ram disk already formatted'
- ld a,(curdsk)
- ld c,a ; Return BIOS to current disk
- call seldsk
- ret
-
- set_trks:
- call say
- defz ' Formatting RAM disk'
- ld a,firstrack
- ld (trck),a
- set_secs:
- ld a,firsect
- ld (sector),a
- do_1_trk:
- ld bc,dfim
- call setdma
- ld a,(rdnum)
- ld c,a
- call seldsk
- ld a,(trck)
- ld c,a
- call settrk
- ld a,(sector)
- ld c,a
- call setsec
- call write
- ld a,(sector)
- inc a
- ld (sector),a
- cp 40 ;40 sectors to a track
- jr nz,do_1_trk
- ld c,'.'
- call conout
- ld a,(trck)
- inc a
- ld (trck),a
- cp ntrks ;ntrks tracks to a ramdisk
- jp nz,set_secs ;all done w/this track - do next
-
- ; Format an off track at end of disk for check for format already done
-
- ld bc,dfim
- call setdma
- ld a,(rdnum)
- ld c,a
- call seldsk
- ld c,186
- call settrk
- ld c,39
- call setsec
- call write
- ld a,(curdsk)
- ld c,a ; Return BIOS to a disk
- call seldsk
- ret
-
- print: ld a,(hl)
- or a
- ret z
- ld e,a
- ld c,06h
- push hl
- call 05
- pop hl
- ck1: inc hl
- jp print
-
- say: pop hl
- call print
- push hl
- ret
-
- curdsk: defb 0 ; Currently logged disk
- rdnum defb 0 ; Ramdisk number
- trck: defb 0 ; Current track
- sector: defb 0 ; Current sector
-
- jmptable:
- wboot: db 0,0,0
- const: db 0,0,0
- conin: db 0,0,0
- conout: db 0,0,0
- list: db 0,0,0
- punch: db 0,0,0
- reader: db 0,0,0
- home: db 0,0,0
- seldsk: db 0,0,0
- settrk: db 0,0,0
- setsec: db 0,0,0
- setdma: db 0,0,0
- read: db 0,0,0
- write: db 0,0,0
- listst: db 0,0,0
- sectran: db 0,0,0
- setram: db 0,0,0
-
-
-
- fw equ 0e5e5h
- dfim:
- defw fw,fw,fw,fw,fw,fw,fw,fw
- defw fw,fw,fw,fw,fw,fw,fw,fw
- defw fw,fw,fw,fw,fw,fw,fw,fw
- defw fw,fw,fw,fw,fw,fw,fw,fw
- defw fw,fw,fw,fw,fw,fw,fw,fw
- defw fw,fw,fw,fw,fw,fw,fw,fw
- defw fw,fw,fw,fw,fw,fw,fw,fw
- defw fw,fw,fw,fw,fw,fw,fw,fw
-
- nop
-
- end