mirror of
https://github.com/cc65/cc65.git
synced 2024-07-16 17:29:43 +00:00
now sets up SIO command and transfer direction; __sio_call now does the
real work git-svn-id: svn://svn.cc65.org/cc65/trunk@361 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
bf32739271
commit
3f71fcb293
@ -8,48 +8,16 @@
|
|||||||
; _sectnum_t - 16bit
|
; _sectnum_t - 16bit
|
||||||
;
|
;
|
||||||
|
|
||||||
|
.import __sio_call,pushax
|
||||||
.export __dio_read
|
.export __dio_read
|
||||||
.import popa,popax
|
|
||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
|
|
||||||
.proc __dio_read
|
.proc __dio_read
|
||||||
|
|
||||||
sta DBUFLO ; set buffer address into DCB
|
jsr pushax ; push buffer address
|
||||||
stx DBUFHI
|
ldx #%01000000 ; direction value
|
||||||
jsr popax
|
lda #SIO_READ ; read sector command
|
||||||
sta DAUX1 ; set sector #
|
jmp __sio_call ; do the call and return to the user
|
||||||
stx DAUX2
|
|
||||||
jsr popa
|
|
||||||
cmp #16
|
|
||||||
bcs _inv_dev ; invalid device #
|
|
||||||
adc #1
|
|
||||||
sta DUNIT ; unit number (d1,d2,d3,...)
|
|
||||||
lda #$31 ; D1 (drive_id == 0) has id $31
|
|
||||||
sta DDEVIC
|
|
||||||
lda #0
|
|
||||||
sta DBYTHI ; high byte of bytes to transfer
|
|
||||||
lda #%01000000 ; indicate i/o direction (read)
|
|
||||||
sta DSTATS
|
|
||||||
lda #15
|
|
||||||
sta DTIMLO ; value got from DOS source
|
|
||||||
lda #128
|
|
||||||
sta DBYTLO ; low byte of bytes to transfer
|
|
||||||
lda #SIO_READ ; read sector
|
|
||||||
sta DCOMND
|
|
||||||
|
|
||||||
jsr SIOV ; execute
|
|
||||||
|
|
||||||
ldx #0
|
|
||||||
lda DSTATS
|
|
||||||
bmi _req_err ; error occurred
|
|
||||||
txa ; no error occurred
|
|
||||||
_req_err:
|
|
||||||
rts
|
|
||||||
|
|
||||||
_inv_dev:
|
|
||||||
ldx #0
|
|
||||||
lda #NONDEV ; non-existent device error
|
|
||||||
rts
|
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
@ -8,48 +8,16 @@
|
|||||||
; _sectnum_t - 16bit
|
; _sectnum_t - 16bit
|
||||||
;
|
;
|
||||||
|
|
||||||
|
.import __sio_call,pushax
|
||||||
.export __dio_write
|
.export __dio_write
|
||||||
.import popa,popax
|
|
||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
|
|
||||||
.proc __dio_write
|
.proc __dio_write
|
||||||
|
|
||||||
sta DBUFLO ; set buffer address into DCB
|
jsr pushax ; push buffer address
|
||||||
stx DBUFHI
|
ldx #%10000000 ; indicate i/o direction (write)
|
||||||
jsr popax
|
lda #SIO_WRITE ; write sector command
|
||||||
sta DAUX1 ; set sector #
|
jmp __sio_call ; do the call and return to the user
|
||||||
stx DAUX2
|
|
||||||
jsr popa
|
|
||||||
cmp #16
|
|
||||||
bcs _inv_dev ; invalid device #
|
|
||||||
adc #1
|
|
||||||
sta DUNIT ; unit number (d1,d2,d3,...)
|
|
||||||
lda #$31 ; D1 (drive_id == 0) has id $31
|
|
||||||
sta DDEVIC
|
|
||||||
lda #0
|
|
||||||
sta DBYTHI ; high byte of bytes to transfer
|
|
||||||
lda #%10000000 ; indicate i/o direction (write)
|
|
||||||
sta DSTATS
|
|
||||||
lda #15
|
|
||||||
sta DTIMLO ; value got from DOS source
|
|
||||||
lda #128
|
|
||||||
sta DBYTLO ; low byte of bytes to transfer
|
|
||||||
lda #SIO_WRITE ; write sector
|
|
||||||
sta DCOMND
|
|
||||||
|
|
||||||
jsr SIOV ; execute
|
|
||||||
|
|
||||||
ldx #0
|
|
||||||
lda DSTATS
|
|
||||||
bmi _req_err ; error occurred
|
|
||||||
txa ; no error occurred
|
|
||||||
_req_err:
|
|
||||||
rts
|
|
||||||
|
|
||||||
_inv_dev:
|
|
||||||
ldx #0
|
|
||||||
lda #NONDEV ; non-existent device error
|
|
||||||
rts
|
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user