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
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export _dio_open
|
|
|
|
.import return0, __dos_type, isdevice
|
2005-03-30 18:25:04 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "errno.inc"
|
|
|
|
.include "mli.inc"
|
2005-03-30 18:25:04 +00:00
|
|
|
|
|
|
|
_dio_open:
|
2010-06-16 21:19:47 +00:00
|
|
|
; Check for ProDOS 8
|
2013-05-09 11:56:54 +00:00
|
|
|
ldx __dos_type
|
|
|
|
bne :+
|
|
|
|
lda #$01 ; "Bad system call number"
|
|
|
|
bne oserr ; Branch always
|
2010-06-16 21:19:47 +00:00
|
|
|
|
2012-10-15 21:59:51 +00:00
|
|
|
; Check for valid device
|
|
|
|
: tax
|
2013-05-09 11:56:54 +00:00
|
|
|
jsr isdevice
|
|
|
|
beq :+
|
|
|
|
lda #$28 ; "No device connected"
|
2012-10-15 21:59:51 +00:00
|
|
|
|
2010-06-16 21:19:47 +00:00
|
|
|
; Return oserror
|
2013-05-09 11:56:54 +00:00
|
|
|
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
|
2013-05-09 11:56:54 +00:00
|
|
|
ldx #$00
|
|
|
|
stx __oserror
|
2005-03-30 18:25:04 +00:00
|
|
|
rts
|