home *** CD-ROM | disk | FTP | other *** search
- cr equ 13
- lf equ 10
-
- wboot equ 0
- dfcb equ 5Ch ; Default File Control block
-
- public $memry
- extrn cout,print,pa2hc
- extrn f$make,f$open,f$write,f$close
- extrn setdma
-
- ld a,(dfcb+1)
- cp a,'/'
- jp z,help
-
- ld de,fcb ; Get file control block
- ld a,(dfcb) ; Get disk number
- ld (de),a ; And set in FCB
- or a,a ; See if we have one
- jp z,nodisk ; No, complain
-
- call f$make ; And make file
- call f$open ; And open
- cp a,0FFh ; See if we have file
- jp z,openerr ; Show error
-
- ld b,8 ; Write 8 sectors
- file_loop:
- push bc ; Save counter
- call fillbuf
- ld hl,($memry) ; Get buffer pointer
- call setdma ; And set the DMA
- ld de,fcb ; Get file control block
- call f$write ; And write the file
- or a,a ; Set flags on status
- jp nz,write_err
- pop bc ; Get counter
- djnz file_loop
-
- ld de,fcb
- call f$close
- jp wboot ; All done
-
- fillbuf:
- ld b,128 ; Number of bytes to fill
- ld hl,($memry) ; Point to buffer
- ld a,(fill_seed) ; Get our pattern
- fillbuf_loop:
- ld (hl),a ; Save away
- inc hl ; Bump pointer
- $1:
- rlca ; Move pattern
- cp a,10000111b ; See if it is eigth pattern
- jr z,$1 ; Yes, skip over it
- djnz fillbuf_loop ; get next one
- ld (fill_seed),a ; Save for next time
- ret
-
- help:
- call print
- db cr,lf,'USAGE: CRTST <disk>:'
- db cr,lf,'Will create a file "!!!TESTF.TST" on indicated drive with'
- db cr,lf,' unique data pattern. Can be read by "TSTDSK" to determine validity.',0
- jp wboot
-
- nodisk:
- call print
- db cr,lf,'CRTST: Disk must be specified.',0
- jp wboot
-
- write_err:
- openerr:
- call print
- db cr,lf,'CRTST: Error in opening file on disk ',0
- ld a,(fcb) ; Get disk
- add a,'A'-1 ; Make into disk
- call cout ; And print it
- call print
- db '.',0
- jp wboot
-
- fill_seed
- db 00001111b ; First of test pattern
- $memry ds 2 ; Bottom of free memory
- fcb:
- db 0
- db '!!!TESTF'
- db 'TST'
- ds 24
-
- end