mirror of
https://github.com/bobbimanners/ProDOS-Utils.git
synced 2025-03-28 04:36:48 +00:00
Fix to cc65 dio_open() function to support ProDOS 2.5+ drive number >2
This commit is contained in:
parent
bd4c8230d5
commit
98b52f0a58
52
cc65-dio-fix/dioopen.s
Normal file
52
cc65-dio-fix/dioopen.s
Normal 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
18
cc65-dio-fix/isdevice.s
Normal 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
|
Loading…
x
Reference in New Issue
Block a user