Skip to content

Commit

Permalink
Ensure that the current drive is selected when exiting a system call.…
Browse files Browse the repository at this point in the history
… This

avoids issues where the current drive according to the BDOS doesn't match the
current drive according to the BIOS, which can make odd things happen.
  • Loading branch information
davidgiven committed Oct 30, 2024
1 parent e0ca707 commit b0e75e8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/bdos/filesystem.S
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,20 @@ zproc internal_ENDSYS
pha
tya
pha
txa
pha

lda old_fcb_drive
zif_pl
ldy #FCB_DR
sta (param), y ; restore user FCB
zendif

lda current_drive ; reselect the current drive
jsr bios_SELDSK

pla
tax
pla
tay
pla
Expand Down Expand Up @@ -1818,7 +1825,7 @@ NOINIT
filesystem_state_start:
find_first_count: .byte 0
active_drive: .byte 0 ; drive currently being worked on
old_drive: .byte 0 ; if the drive has been overridden by the FCB
old_active_drive: .byte 0 ; if the drive has been overridden by the FCB
old_fcb_drive: .byte 0 ; drive in user FCB on entry
write_protect_vector: .word 0
login_vector: .word 0
Expand Down

0 comments on commit b0e75e8

Please sign in to comment.