2005-03-30 18:25:04 +00:00
|
|
|
;
|
|
|
|
; Oliver Schmidt, 24.03.2005
|
|
|
|
;
|
2012-10-11 18:22:49 +00:00
|
|
|
; dhandle_t __fastcall__ dio_open (unsigned char device);
|
2005-03-30 18:25:04 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
.export _dio_open
|
2012-10-15 21:59:51 +00:00
|
|
|
.import return0, __dos_type, isdevice
|
2005-03-30 18:25:04 +00:00
|
|
|
|
|
|
|
.include "errno.inc"
|
|
|
|
.include "mli.inc"
|
|
|
|
|
|
|
|
_dio_open:
|
2010-06-16 21:19:47 +00:00
|
|
|
; Check for ProDOS 8
|
|
|
|
ldx __dos_type
|
|
|
|
bne :+
|
|
|
|
lda #$01 ; "Bad system call number"
|
|
|
|
bne oserr ; Branch always
|
|
|
|
|
2012-10-15 21:59:51 +00:00
|
|
|
; Check for valid device
|
|
|
|
: tax
|
|
|
|
jsr isdevice
|
|
|
|
beq :+
|
2010-07-17 19:11:51 +00:00
|
|
|
lda #$28 ; "No device connected"
|
2012-10-15 21:59:51 +00:00
|
|
|
|
2010-06-16 21:19:47 +00:00
|
|
|
; Return oserror
|
|
|
|
oserr: sta __oserror
|
|
|
|
jmp return0
|
2005-03-30 18:25:04 +00:00
|
|
|
|
|
|
|
; Return success
|
2012-10-15 21:59:51 +00:00
|
|
|
: txa
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
ldx #$00
|
2005-03-30 18:25:04 +00:00
|
|
|
stx __oserror
|
|
|
|
rts
|