2000-10-12 21:03:53 +00:00
|
|
|
;
|
|
|
|
; Christian Groessler, October 2000
|
|
|
|
;
|
2000-10-16 23:23:22 +00:00
|
|
|
; This file provides the __sio_call function
|
|
|
|
; The function does a SIO call, it's not completely
|
2000-10-12 21:03:53 +00:00
|
|
|
; generic (e.g. transfer size is fixed), it's used
|
2000-10-16 23:23:22 +00:00
|
|
|
; to save space with _dio_read and _dio_write functions.
|
2000-10-12 21:03:53 +00:00
|
|
|
;
|
2000-10-18 23:54:27 +00:00
|
|
|
; unsigned char __fastcall__ _sio_call(_dhandle_t handle,
|
2000-10-12 21:03:53 +00:00
|
|
|
; _sectnum_t sect_num,
|
|
|
|
; void *buffer,
|
|
|
|
; unsigned int sio_val);
|
2000-10-18 23:54:27 +00:00
|
|
|
; _dhandle_t - 16bit (ptr)
|
2000-10-12 21:03:53 +00:00
|
|
|
; _sectnum_t - 16bit
|
2000-10-16 23:23:22 +00:00
|
|
|
; sio_val is (sio_command | sio_direction << 8)
|
2000-10-12 21:03:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
.export __sio_call
|
|
|
|
.include "atari.inc"
|
|
|
|
.import popa,popax
|
2000-10-18 23:54:27 +00:00
|
|
|
.import sectsizetab,__oserror
|
|
|
|
.importzp ptr1
|
2000-10-12 21:03:53 +00:00
|
|
|
|
|
|
|
.proc __sio_call
|
|
|
|
|
|
|
|
sta DCOMND ; set command into DCB
|
|
|
|
stx DSTATS ; set data flow directon
|
|
|
|
jsr popax ; get buffer address
|
|
|
|
sta DBUFLO ; set buffer address into DCB
|
|
|
|
stx DBUFHI
|
|
|
|
jsr popax
|
|
|
|
sta DAUX1 ; set sector #
|
|
|
|
stx DAUX2
|
2000-10-18 23:54:27 +00:00
|
|
|
|
|
|
|
jsr popax
|
|
|
|
sta ptr1
|
|
|
|
stx ptr1+1
|
|
|
|
|
|
|
|
ldy #sst_flag
|
|
|
|
lda (ptr1),y
|
|
|
|
and #128
|
|
|
|
beq _inv_hand ; handle not open or invalid
|
|
|
|
|
|
|
|
ldy #sst_driveno
|
|
|
|
lda (ptr1),y
|
|
|
|
|
|
|
|
clc
|
2000-10-12 21:03:53 +00:00
|
|
|
adc #1
|
|
|
|
sta DUNIT ; unit number (d1,d2,d3,...)
|
2000-10-18 23:54:27 +00:00
|
|
|
|
|
|
|
ldy #sst_sectsize
|
|
|
|
lda (ptr1),y
|
|
|
|
sta DBYTLO
|
|
|
|
iny
|
|
|
|
lda (ptr1),y
|
|
|
|
sta DBYTHI
|
|
|
|
|
2000-10-23 21:39:45 +00:00
|
|
|
lda #DISKID ; SIO bus ID of diskette drive
|
2000-10-12 21:03:53 +00:00
|
|
|
sta DDEVIC
|
|
|
|
lda #15
|
|
|
|
sta DTIMLO ; value got from DOS source
|
|
|
|
|
|
|
|
jsr SIOV ; execute
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
lda DSTATS
|
|
|
|
bmi _req_err ; error occurred
|
|
|
|
txa ; no error occurred
|
|
|
|
_req_err:
|
2000-10-18 23:54:27 +00:00
|
|
|
sta __oserror
|
2000-10-12 21:03:53 +00:00
|
|
|
rts
|
|
|
|
|
2000-10-18 23:54:27 +00:00
|
|
|
_inv_hand:
|
2000-10-12 21:03:53 +00:00
|
|
|
ldx #0
|
2000-10-18 23:54:27 +00:00
|
|
|
lda #BADIOC
|
|
|
|
bne _req_err
|
2000-10-12 21:03:53 +00:00
|
|
|
|
|
|
|
.endproc
|