1
0
mirror of https://github.com/cc65/cc65.git synced 2025-08-08 06:25:17 +00:00

adapted to new calling parameters (_dhandle_t)

git-svn-id: svn://svn.cc65.org/cc65/trunk@384 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cpg
2000-10-18 23:54:27 +00:00
parent 2690dfc172
commit 979700f2fe

View File

@@ -6,11 +6,11 @@
; generic (e.g. transfer size is fixed), it's used ; generic (e.g. transfer size is fixed), it's used
; to save space with _dio_read and _dio_write functions. ; to save space with _dio_read and _dio_write functions.
; ;
; unsigned char __fastcall__ _sio_call(_driveid_t drive_id, ; unsigned char __fastcall__ _sio_call(_dhandle_t handle,
; _sectnum_t sect_num, ; _sectnum_t sect_num,
; void *buffer, ; void *buffer,
; unsigned int sio_val); ; unsigned int sio_val);
; _driveid_t - 8bit ; _dhandle_t - 16bit (ptr)
; _sectnum_t - 16bit ; _sectnum_t - 16bit
; sio_val is (sio_command | sio_direction << 8) ; sio_val is (sio_command | sio_direction << 8)
; ;
@@ -18,7 +18,8 @@
.export __sio_call .export __sio_call
.include "atari.inc" .include "atari.inc"
.import popa,popax .import popa,popax
.import sectsizetab .import sectsizetab,__oserror
.importzp ptr1
.proc __sio_call .proc __sio_call
@@ -30,18 +31,30 @@
jsr popax jsr popax
sta DAUX1 ; set sector # sta DAUX1 ; set sector #
stx DAUX2 stx DAUX2
jsr popa
cmp #NUMDRVS jsr popax
bcs _inv_dev ; invalid device # 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
adc #1 adc #1
sta DUNIT ; unit number (d1,d2,d3,...) sta DUNIT ; unit number (d1,d2,d3,...)
sbc #0
asl a ldy #sst_sectsize
tax lda (ptr1),y
lda sectsizetab,x sta DBYTLO
sta DBYTLO ; low byte of bytes to transfer iny
lda sectsizetab+1,x lda (ptr1),y
sta DBYTHI ; high byte of bytes to transfer sta DBYTHI
lda #$31 ; D1 (drive_id == 0) has id $31 lda #$31 ; D1 (drive_id == 0) has id $31
sta DDEVIC sta DDEVIC
lda #15 lda #15
@@ -54,11 +67,12 @@
bmi _req_err ; error occurred bmi _req_err ; error occurred
txa ; no error occurred txa ; no error occurred
_req_err: _req_err:
sta __oserror
rts rts
_inv_dev: _inv_hand:
ldx #0 ldx #0
lda #NONDEV ; non-existent device error lda #BADIOC
rts bne _req_err
.endproc .endproc