RAM Disk Auto-Format Improvements

- Detect the situation where the RAM disk area is all zeroes and handle it properly as uninitialized.
This commit is contained in:
Wayne Warthen
2021-10-27 15:06:24 -07:00
parent 535dc1314e
commit 2e6122025d
4 changed files with 35 additions and 2 deletions

View File

@@ -328,6 +328,17 @@ clrram:
;call hb_bnksel ; select bank
call 0FFF3h ; select bank
; Check the first sector (512 bytes) for all zeroes. If so,
; it implies the RAM is uninitialized.
ld hl,0 ; start at begining of ram disk
ld bc,512 ; compare 512 bytes
xor a ; compare to zero
clrram000:
cpi ; a - (hl), hl++, bc--
jr nz,clrram00 ; if not zero, go to next test
jp pe,clrram000 ; loop thru all bytes
jr clrram2 ; all zeroes, jump to init
clrram00:
; Check first 32 directory entries. If any start with an invalid
; value, init the ram disk. Valid entries are e5 (empty entry) or
; 0-15 (user number).