Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DSKIO driver error check in DOS 1, page 1 transfers #134

Merged
merged 1 commit into from Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
73 changes: 46 additions & 27 deletions source/kernel/drv.mac
Expand Up @@ -259,8 +259,6 @@ CAPSOFF:
ret




ALIGN 781Fh
;-----------------------------------------------------------------------------
;
Expand All @@ -277,6 +275,18 @@ null_message:
db "2 - Double side",13,10
db 0


; Moved here due to space constraints

DO_DIRCALL:
pop ix
push bc
ld bc,DV_D0##-DIRCALL-3
add ix,bc
pop bc
jp DO_CALBNK


;-----------------------------------------------------------------------------
;
; Entries for direct calls.
Expand All @@ -292,13 +302,27 @@ DIRCALL:
call DO_DIRCALL
call DO_DIRCALL

DO_DIRCALL:
pop ix
push bc
ld bc,DV_D0##-DIRCALL-3
add ix,bc
pop bc
jp DO_CALBNK

; Process the output of DSKIO so that Cy is set
; if an error has been returned.

DIO_SET_ERR_FLAG::
push af
ld a,(KSLOT##)
or a
jr z,DIO_SET_ERR_FLAG_END

;Device-based: set Cy if error code is not 0
pop af
or a
ret z
scf
ret

;Drive-based driver: result will already have Cy set on error
DIO_SET_ERR_FLAG_END:
pop af
ret


;-----------------------------------------------------------------------------
Expand Down Expand Up @@ -478,14 +502,8 @@ DIO_RD_LOOP:
push de ;with a simple call to the driver
push hl

ld hl,($SECBUF##)
ld b,1
or a

ld ix,DV_DSKIO## ;Or DEV_RW (they are at the same address)
ex af,af'
ld a,DV_BANK##
call CALBNK##
call DIO_DO_CALDRV
jr nc,DIO_RD_OK

pop hl ;On disk error, just return
Expand Down Expand Up @@ -532,14 +550,8 @@ DIO_WR_LOOP:
push bc
push de

ld hl,($SECBUF##)
ld b,1
scf

ld ix,DV_DSKIO##
ex af,af'
ld a,DV_BANK##
call CALBNK##
call DIO_DO_CALDRV
jr nc,DIO_WR_OK

pop de ;On disk error, just return
Expand All @@ -562,6 +574,17 @@ DIO_WR_OK:
ret


DIO_DO_CALDRV:
ld hl,($SECBUF##)
ld b,1

ld ix,DV_DSKIO##
ex af,af'
ld a,DV_BANK##
call CALBNK##
jp DIO_SET_ERR_FLAG


; Jump here when the transfer can be done in a single step
; (no page 1 involved)

Expand Down Expand Up @@ -975,10 +998,6 @@ POP_CONV_ERR:
CONV_ERR:
or a
ret z
;jr c,CONVE2
;xor a
;ret
CONVE2:

push bc
ld b,0
Expand Down