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-11-16 21:27:42 +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
|
|
|
;
|
|
|
|
|
2000-11-16 21:27:42 +00:00
|
|
|
.export _dio_open,_dio_close
|
2000-10-16 23:24:24 +00:00
|
|
|
.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
|
|
|
|
|
|
|
|
|
2000-11-16 21:27:42 +00:00
|
|
|
.proc _dio_open
|
2000-10-16 23:24:24 +00:00
|
|
|
|
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
|
|
|
|
|
2000-11-16 21:27:42 +00:00
|
|
|
.proc _dio_close
|
2000-10-16 23:24:24 +00:00
|
|
|
|
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
|
|
|
|
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
|
|
|
|
|