blockdev: remove _blkCall

The ability to specify "0" routines in blkdev table is not used anymore
now that stdio is a separate subsystem.

Also, I'm preparing a blockdev refactoring and this complicates my work.
This commit is contained in:
Virgil Dupras 2019-06-04 09:23:10 -04:00
parent 50a26f6e39
commit c85ed474d7
2 changed files with 9 additions and 32 deletions

View File

@ -48,7 +48,6 @@
; *** CONSTS *** ; *** CONSTS ***
.equ BLOCKDEV_ERR_OUT_OF_BOUNDS 0x03 .equ BLOCKDEV_ERR_OUT_OF_BOUNDS 0x03
.equ BLOCKDEV_ERR_UNSUPPORTED 0x04
.equ BLOCKDEV_SEEK_ABSOLUTE 0 .equ BLOCKDEV_SEEK_ABSOLUTE 0
.equ BLOCKDEV_SEEK_FORWARD 1 .equ BLOCKDEV_SEEK_FORWARD 1
@ -117,34 +116,12 @@ blkSel:
pop af pop af
ret ret
; call IX unless it's zero
_blkCall:
; Before we call... is IX zero? We don't want to call a zero.
push af
xor a
push hl
push ix \ pop hl
cp h
jr nz, .ok ; not zero, ok
cp l
jr z, .error ; zero, error
.ok:
pop hl
pop af
call callIX
ret
.error:
pop hl
pop af
ld a, BLOCKDEV_ERR_UNSUPPORTED
ret
; Reads one character from selected device and returns its value in A. ; Reads one character from selected device and returns its value in A.
; Sets Z according to whether read was successful: Set if successful, unset ; Sets Z according to whether read was successful: Set if successful, unset
; if not. ; if not.
blkGetC: blkGetC:
ld ix, (BLOCKDEV_GETC) ld ix, (BLOCKDEV_GETC)
jr _blkCall jp (ix)
; Reads B chars from blkGetC and copy them in (HL). ; Reads B chars from blkGetC and copy them in (HL).
; Sets Z if successful, unset Z if there was an error. ; Sets Z if successful, unset Z if there was an error.
@ -154,7 +131,7 @@ _blkRead:
push hl push hl
push bc push bc
.loop: .loop:
call _blkCall call callIX
jr nz, .end ; Z already unset jr nz, .end ; Z already unset
ld (hl), a ld (hl), a
inc hl inc hl
@ -169,7 +146,7 @@ _blkRead:
; according to whether the operation was successful. ; according to whether the operation was successful.
blkPutC: blkPutC:
ld ix, (BLOCKDEV_PUTC) ld ix, (BLOCKDEV_PUTC)
jr _blkCall jp (ix)
; Writes B chars to blkPutC from (HL). ; Writes B chars to blkPutC from (HL).
; Sets Z if successful, unset Z if there was an error. ; Sets Z if successful, unset Z if there was an error.
@ -180,7 +157,7 @@ _blkWrite:
push bc push bc
.loop: .loop:
ld a, (hl) ld a, (hl)
call _blkCall call callIX
jr nz, .end ; Z already unset jr nz, .end ; Z already unset
inc hl inc hl
djnz .loop djnz .loop
@ -250,7 +227,7 @@ _blkSeek:
ld hl, 0xffff ld hl, 0xffff
ld de, 0xffff ld de, 0xffff
.seek: .seek:
call _blkCall call callIX
pop de pop de
ret ret
@ -258,7 +235,7 @@ _blkSeek:
blkTell: blkTell:
ld de, 0 ; in case device ignores DE. ld de, 0 ; in case device ignores DE.
ld ix, (BLOCKDEV_TELL) ld ix, (BLOCKDEV_TELL)
jp _blkCall jp (ix)
; This label is at the end of the file on purpose: the glue file should include ; This label is at the end of the file on purpose: the glue file should include
; a list of device routine table entries just after the include. Each line ; a list of device routine table entries just after the include. Each line

View File

@ -349,7 +349,7 @@ fsIsDeleted:
fsblkGetC: fsblkGetC:
push ix push ix
ld ix, (FS_GETC) ld ix, (FS_GETC)
call _blkCall call callIX
pop ix pop ix
ret ret
@ -363,7 +363,7 @@ fsblkRead:
fsblkPutC: fsblkPutC:
push ix push ix
ld ix, (FS_PUTC) ld ix, (FS_PUTC)
call _blkCall call callIX
pop ix pop ix
ret ret
@ -388,7 +388,7 @@ fsblkTell:
push ix push ix
ld de, 0 ld de, 0
ld ix, (FS_TELL) ld ix, (FS_TELL)
call _blkCall call callIX
pop ix pop ix
ret ret