2 ; Christian Groessler, October 2000
4 ; This file provides the __sio_call function
5 ; The function does a SIO call, it's not completely
6 ; generic (e.g. transfer size is fixed), it's used
7 ; to save space with _dio_read and _dio_write functions.
9 ; unsigned char __fastcall__ _sio_call(dhandle_t handle,
13 ; dhandle_t - 16bit (ptr)
14 ; sio_val is (sio_command | sio_direction << 8)
19 .import popa,popax,popptr1
20 .import sectsizetab,__oserror
25 sta DCOMND ; set command into DCB
26 stx DSTATS ; set data flow directon
27 jsr popax ; get buffer address
28 sta DBUFLO ; set buffer address into DCB
31 sta DAUX1 ; set sector #
39 beq _inv_hand ; handle not open or invalid
46 sta DUNIT ; unit number (d1,d2,d3,...)
48 lda DAUX2 ; high byte sector #
51 cmp #4 ; sectors 1 to 3 are special (always 128 bytes)
60 _realsz:ldy #sst_sectsize
67 _cont: lda #DISKID ; SIO bus ID of diskette drive
70 sta DTIMLO ; value got from DOS source
76 bmi _req_err ; error occurred
77 txa ; no error occurred