Fix to cc65 dio_open() function to support ProDOS 2.5+ drive number >2

This commit is contained in:
Bobbi Webber-Manners 2020-06-02 21:18:11 -04:00
parent bd4c8230d5
commit 98b52f0a58
2 changed files with 70 additions and 0 deletions

52
cc65-dio-fix/dioopen.s Normal file
View File

@ -0,0 +1,52 @@
;
; Oliver Schmidt, 24.03.2005
;
; dhandle_t __fastcall__ dio_open (unsigned char device);
;
.export _dio_open
.import return0, __dos_type, isdevice
.include "errno.inc"
.include "mli.inc"
.include "zeropage.inc"
_dio_open:
; Check for ProDOS 8
ldx __dos_type
bne :+
lda #$01 ; "Bad system call number"
bne oserr ; Branch always
; Convert from 00DDDSSS format to DSSS00DD format
: tax
clc
asl
asl
asl
asl
sta tmp1
txa
lsr
lsr
lsr
lsr
ora tmp1
; Check for valid device
tax
jsr isdevice
beq :+
lda #$28 ; "No device connected"
; Return oserror
oserr: sta __oserror
jmp return0
; Return success
: txa
ldx #$00
stx __oserror
rts

18
cc65-dio-fix/isdevice.s Normal file
View File

@ -0,0 +1,18 @@
;
; Oliver Schmidt, 2012-10-15
;
.export isdevice
.include "zeropage.inc"
.include "mli.inc"
isdevice:
ldy DEVCNT
: lda DEVLST,y
sta tmp1
cpx tmp1
beq :+
dey
bpl :-
: rts