home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
SB180
/
RAMFIX.LBR
/
TSTDSK.1Z0
/
TSTDSK.180
Wrap
Text File
|
2000-06-30
|
3KB
|
142 lines
cr equ 13
lf equ 10
wboot equ 0
dfcb equ 5Ch ; Default File Control block
public $memry
extrn cout,print,pa2hc,phl4hc
extrn cin
extrn f$open,f$read,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$open ; And open
or a,a ; See if we have file
jp nz,openerr ; Show error
ld b,8 ; Read 8 sectors
file_loop:
push bc ; Save counter
ld hl,($memry) ; Get buffer pointer
call setdma ; And set the DMA
ld de,fcb ; Get file control block
call f$read ; And read the file
or a,a ; Check status
jp nz,read_err
pop de ; Get count
push de ; And put back on stack
ld a,8
sub a,d
ld d,a ; Get count of sectors read
ld e,128 ; And length of sector
mlt de ; Set offset to beginning of sector
call tstbuf
pop bc ; Get counter
djnz file_loop
ld de,fcb
call f$close
jp wboot ; All done
tstbuf:
ld c,10 ; Maximum errors reported
ld b,128 ; Number of bytes to test
ld hl,($memry) ; Point to buffer
ex de,hl
or a,a ; Clear carry
sbc hl,de
ex de,hl ; Should prime de for offset
ld a,(fill_seed) ; Get our pattern
tstbuf_loop:
cp a,(hl) ; Test pattern
jp z,$1
push hl ; Save our place
add hl,de ; Get offset
call print
db cr,lf,'TSTDSK: Byte error disk ',0
push af
ld a,(fcb)
add a,'A'-1
call cout
pop af
call print
db ' at ',0
call phl4hc
pop hl
call print
db ' Should be ',0
call pa2hc
call print
db 'h Is: ',0
push af ; Save pattern
ld a,(hl)
call pa2hc
pop af
call print
db 'h.',0
dec c ; Bump error count
; jr nz,$1
call print
db ' Continue (Y or N)?',0
push af ; Save pattern
call cin
and a,5Fh
cp a,'Y'
jp nz,wboot
pop af
$1:
inc hl ; Bump pointer
$2:
rlca ; Move pattern
cp a,10000111b ; See if it is eigth pattern
jr z,$2 ; Yes, skip over it
; djnz tstbuf_loop ; get next one
dec b
jp nz,tstbuf_loop ; Get next one
ld (fill_seed),a ; Save for next time
ret
help:
call print
db cr,lf,'USAGE: TSTDSK <disk>:'
db cr,lf,'Will read a file "!!!TESTF.TST" on indicated drive with'
db cr,lf,' unique data pattern previously set by "CRTST".',0
jp wboot
nodisk:
call print
db cr,lf,'TSTDSK: Disk must be specified.',0
jp wboot
read_err:
openerr:
call print
db cr,lf,'TSTDSK: Error in opening file "!!!TESTF.TST" on disk ',0
ld a,(fcb)
add a,'A'-1 ; Make into disk name
call cout
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