2005-03-30 18:25:04 +00:00
|
|
|
;
|
|
|
|
; Oliver Schmidt, 24.03.2005
|
|
|
|
;
|
|
|
|
; dhandle_t __fastcall__ dio_open (driveid_t drive_id);
|
|
|
|
;
|
|
|
|
; drive_id = (slot * 2) + (drive - 1)
|
|
|
|
|
|
|
|
.export _dio_open
|
2005-03-31 07:24:01 +00:00
|
|
|
.import return0
|
2005-03-30 18:25:04 +00:00
|
|
|
|
|
|
|
.include "zeropage.inc"
|
|
|
|
.include "errno.inc"
|
|
|
|
.include "mli.inc"
|
|
|
|
|
|
|
|
_dio_open:
|
|
|
|
; Convert drive id into unit number
|
|
|
|
lsr
|
|
|
|
bcc :+
|
|
|
|
ora #%00001000
|
|
|
|
: asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
2005-03-31 07:24:01 +00:00
|
|
|
tay ; Save handle
|
|
|
|
|
|
|
|
; Set handle
|
2005-03-30 18:25:04 +00:00
|
|
|
sta mliparam + MLI::ON_LINE::UNIT_NUM
|
|
|
|
|
|
|
|
; Alloc 16-byte buffer just below stack
|
|
|
|
lda sp
|
2005-03-31 07:24:01 +00:00
|
|
|
sec
|
|
|
|
sbc #16
|
2005-03-30 18:25:04 +00:00
|
|
|
sta mliparam + MLI::ON_LINE::DATA_BUFFER
|
2005-03-31 07:24:01 +00:00
|
|
|
lda sp+1
|
|
|
|
sbc #$00
|
|
|
|
sta mliparam + MLI::ON_LINE::DATA_BUFFER+1
|
2005-03-30 18:25:04 +00:00
|
|
|
|
|
|
|
; Get device state
|
|
|
|
lda #ON_LINE_CALL
|
|
|
|
ldx #ON_LINE_COUNT
|
|
|
|
jsr callmli
|
|
|
|
bcc :+
|
|
|
|
|
|
|
|
; DIO level access doesn't necessarily need a
|
|
|
|
; ProDOS 8 disk so ignore "high level" errors
|
|
|
|
cmp #$40
|
|
|
|
bcc oserr
|
|
|
|
|
|
|
|
; Return success
|
2005-03-31 07:24:01 +00:00
|
|
|
: tya ; Restore handle
|
2005-03-30 18:25:04 +00:00
|
|
|
ldx #$00
|
|
|
|
stx __oserror
|
|
|
|
rts
|
|
|
|
|
|
|
|
; Return oserror
|
|
|
|
oserr: sta __oserror
|
|
|
|
jmp return0
|