mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-24 03:38:05 +11:00
blockdev: protect IX in routines
Sure, it's a bit slower, but it prevents a lot of hard to debug problems. I don't have to want to remember "don't use IX if you have any blk* calls". Let's optimize I/O later.
This commit is contained in:
parent
3b0029335a
commit
797cbdcc95
@ -125,7 +125,11 @@ _blkInc:
|
|||||||
; 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:
|
||||||
|
push ix
|
||||||
ld ix, BLOCKDEV_SEL
|
ld ix, BLOCKDEV_SEL
|
||||||
|
call _blkGetC
|
||||||
|
pop ix
|
||||||
|
ret
|
||||||
_blkGetC:
|
_blkGetC:
|
||||||
push hl
|
push hl
|
||||||
push de
|
push de
|
||||||
@ -138,7 +142,11 @@ _blkGetC:
|
|||||||
; Writes character in A in current position in the selected device. Sets Z
|
; Writes character in A in current position in the selected device. Sets Z
|
||||||
; according to whether the operation was successful.
|
; according to whether the operation was successful.
|
||||||
blkPutC:
|
blkPutC:
|
||||||
|
push ix
|
||||||
ld ix, BLOCKDEV_SEL
|
ld ix, BLOCKDEV_SEL
|
||||||
|
call _blkPutC
|
||||||
|
pop ix
|
||||||
|
ret
|
||||||
_blkPutC:
|
_blkPutC:
|
||||||
push ix
|
push ix
|
||||||
push hl
|
push hl
|
||||||
@ -155,7 +163,11 @@ _blkPutC:
|
|||||||
; 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.
|
||||||
blkRead:
|
blkRead:
|
||||||
|
push ix
|
||||||
ld ix, BLOCKDEV_SEL
|
ld ix, BLOCKDEV_SEL
|
||||||
|
call _blkRead
|
||||||
|
pop ix
|
||||||
|
ret
|
||||||
_blkRead:
|
_blkRead:
|
||||||
push hl
|
push hl
|
||||||
push bc
|
push bc
|
||||||
@ -174,7 +186,11 @@ _blkRead:
|
|||||||
; 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.
|
||||||
blkWrite:
|
blkWrite:
|
||||||
|
push ix
|
||||||
ld ix, BLOCKDEV_SEL
|
ld ix, BLOCKDEV_SEL
|
||||||
|
call _blkWrite
|
||||||
|
pop ix
|
||||||
|
ret
|
||||||
_blkWrite:
|
_blkWrite:
|
||||||
push hl
|
push hl
|
||||||
push bc
|
push bc
|
||||||
@ -207,7 +223,11 @@ _blkWrite:
|
|||||||
; If the device is "growable", it's possible that seeking to end when calling
|
; If the device is "growable", it's possible that seeking to end when calling
|
||||||
; PutC doesn't necessarily result in a failure.
|
; PutC doesn't necessarily result in a failure.
|
||||||
blkSeek:
|
blkSeek:
|
||||||
|
push ix
|
||||||
ld ix, BLOCKDEV_SEL
|
ld ix, BLOCKDEV_SEL
|
||||||
|
call _blkSeek
|
||||||
|
pop ix
|
||||||
|
ret
|
||||||
_blkSeek:
|
_blkSeek:
|
||||||
cp BLOCKDEV_SEEK_FORWARD
|
cp BLOCKDEV_SEEK_FORWARD
|
||||||
jr z, .forward
|
jr z, .forward
|
||||||
@ -275,7 +295,11 @@ _blkSeek:
|
|||||||
|
|
||||||
; Returns the current position of the selected device in HL (low) and DE (high).
|
; Returns the current position of the selected device in HL (low) and DE (high).
|
||||||
blkTell:
|
blkTell:
|
||||||
|
push ix
|
||||||
ld ix, BLOCKDEV_SEL
|
ld ix, BLOCKDEV_SEL
|
||||||
|
call _blkTell
|
||||||
|
pop ix
|
||||||
|
ret
|
||||||
_blkTell:
|
_blkTell:
|
||||||
ld e, (ix+4)
|
ld e, (ix+4)
|
||||||
ld d, (ix+5)
|
ld d, (ix+5)
|
||||||
|
Loading…
Reference in New Issue
Block a user