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,
12 ; unsigned int sio_val);
13 ; dhandle_t - 16bit (ptr)
15 ; sio_val is (sio_command | sio_direction << 8)
21 .import sectsizetab,__oserror
26 sta DCOMND ; set command into DCB
27 stx DSTATS ; set data flow directon
28 jsr popax ; get buffer address
29 sta DBUFLO ; set buffer address into DCB
32 sta DAUX1 ; set sector #
42 beq _inv_hand ; handle not open or invalid
49 sta DUNIT ; unit number (d1,d2,d3,...)
51 lda DAUX2 ; high byte sector #
54 cmp #4 ; sectors 1 to 3 are special (always 128 bytes)
63 _realsz:ldy #sst_sectsize
70 _cont: lda #DISKID ; SIO bus ID of diskette drive
73 sta DTIMLO ; value got from DOS source
79 bmi _req_err ; error occurred
80 txa ; no error occurred