2000-10-16 23:24:24 +00:00
|
|
|
;
|
|
|
|
; Christian Groessler, October 2000
|
|
|
|
;
|
|
|
|
; This file provides the __dio_open and __dio_close functions
|
|
|
|
; Since on the Atari no real open and close is necessary, they
|
2000-10-18 23:51:29 +00:00
|
|
|
; do not much. The __dio_open sets the sector size of the
|
2000-10-16 23:24:24 +00:00
|
|
|
; drive which is later used by the _dio_read and _dio_write
|
|
|
|
; functions.
|
|
|
|
;
|
2000-10-18 23:51:29 +00:00
|
|
|
; _dhandle_t __fastcall__ _dio_open (_driveid_t drive_id);
|
|
|
|
; unsigned char __fastcall__ _dio_close (_dhandle_t handle);
|
2000-10-16 23:24:24 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
.export __dio_open,__dio_close
|
|
|
|
.export sectsizetab
|
2000-10-18 23:51:29 +00:00
|
|
|
.import __oserror
|
|
|
|
.importzp ptr1,tmp1
|
2000-10-16 23:24:24 +00:00
|
|
|
.include "atari.inc"
|
|
|
|
|
2000-10-18 23:51:29 +00:00
|
|
|
|
2000-10-16 23:24:24 +00:00
|
|
|
.bss
|
|
|
|
|
|
|
|
sectsizetab:
|
2000-10-18 23:51:29 +00:00
|
|
|
.res NUMDRVS * sst_size
|
2000-10-16 23:24:24 +00:00
|
|
|
|
|
|
|
.code
|
|
|
|
|
|
|
|
|
|
|
|
.proc __dio_open
|
|
|
|
|
2000-10-18 23:51:29 +00:00
|
|
|
cmp #NUMDRVS ; valid drive id?
|
|
|
|
bcs _inv_drive
|
|
|
|
tay ; drive #
|
|
|
|
asl a ; make index from drive id
|
|
|
|
asl a
|
2000-10-16 23:24:24 +00:00
|
|
|
tax
|
2000-10-18 23:51:29 +00:00
|
|
|
lda #128 ; currently hardcoded (until I get an 815 :-)
|
|
|
|
sta sectsizetab+sst_sectsize,x
|
|
|
|
sta sectsizetab+sst_flag,x ; set flag that drive is "open"
|
2000-10-16 23:24:24 +00:00
|
|
|
lda #0
|
2000-10-18 23:51:29 +00:00
|
|
|
sta sectsizetab+sst_sectsize+1,x
|
|
|
|
sta __oserror ; success
|
|
|
|
tya
|
|
|
|
sta sectsizetab+sst_driveno,x
|
|
|
|
; lda #SSTIDVAL
|
|
|
|
; sta sectsizetab+sst_id+1,x
|
|
|
|
stx tmp1
|
|
|
|
lda #<sectsizetab
|
|
|
|
clc
|
|
|
|
adc tmp1
|
|
|
|
sta tmp1
|
|
|
|
lda #>sectsizetab
|
|
|
|
adc #0
|
|
|
|
tax
|
|
|
|
lda tmp1
|
|
|
|
rts
|
2000-10-16 23:24:24 +00:00
|
|
|
|
2000-10-18 23:51:29 +00:00
|
|
|
_inv_drive:
|
|
|
|
lda #NONDEV ; non-existent device
|
|
|
|
sta __oserror
|
|
|
|
lda #0
|
|
|
|
tax
|
|
|
|
rts ; return NULL
|
2000-10-16 23:24:24 +00:00
|
|
|
|
|
|
|
.endproc
|
|
|
|
|
|
|
|
.proc __dio_close
|
|
|
|
|
2000-10-18 23:51:29 +00:00
|
|
|
sta ptr1
|
|
|
|
stx ptr1+1
|
2000-10-16 23:24:24 +00:00
|
|
|
lda #0
|
2000-10-18 23:51:29 +00:00
|
|
|
ldy #sst_flag
|
|
|
|
sta (ptr1),y
|
|
|
|
; ldy #sst_id
|
|
|
|
; sta (ptr1),y
|
|
|
|
sta __oserror ; success
|
2000-10-16 23:24:24 +00:00
|
|
|
tax
|
2000-10-18 23:51:29 +00:00
|
|
|
rts ; return no error
|
2000-10-16 23:24:24 +00:00
|
|
|
|
|
|
|
.endproc
|
|
|
|
|