; generic (e.g. transfer size is fixed), it's used
; to save space with _dio_read and _dio_write functions.
;
-; unsigned char __fastcall__ _sio_call(_dhandle_t handle,
-; _sectnum_t sect_num,
+; unsigned char __fastcall__ _sio_call(dhandle_t handle,
+; sectnum_t sect_num,
; void *buffer,
; unsigned int sio_val);
-; _dhandle_t - 16bit (ptr)
-; _sectnum_t - 16bit
+; dhandle_t - 16bit (ptr)
+; sectnum_t - 16bit
; sio_val is (sio_command | sio_direction << 8)
;
adc #1
sta DUNIT ; unit number (d1,d2,d3,...)
- ldy #sst_sectsize
+ lda DAUX2 ; high byte sector #
+ bne _realsz
+ lda DAUX1
+ cmp #4 ; sectors 1 to 3 are special (always 128 bytes)
+ bcs _realsz
+
+ lda #$80
+ sta DBYTLO
+ asl a
+ sta DBYTHI
+ beq _cont
+
+_realsz:ldy #sst_sectsize
lda (ptr1),y
sta DBYTLO
iny
lda (ptr1),y
sta DBYTHI
- lda #$31 ; D1 (drive_id == 0) has id $31
+_cont: lda #DISKID ; SIO bus ID of diskette drive
sta DDEVIC
lda #15
sta DTIMLO ; value got from DOS source