]> git.sur5r.net Git - cc65/blobdiff - libsrc/atari/dioread.s
The spans do now contain the size of a span, no longer the end offset.
[cc65] / libsrc / atari / dioread.s
index 06ea0d484817e9aebd2b5cc4e57514daea3d963c..9cdd18143cbe71a831d179d541ef26bca1da8603 100644 (file)
@@ -3,53 +3,21 @@
 ;
 ; this file provides the _dio_read function
 ;
-; unsigned char __fastcall__ _dio_read(_driveid_t drive_id, _sectnum_t sect_num, void *buffer);
-; _driveid_t - 8bit
-; _sectnum_t - 16bit
+; unsigned char __fastcall__ dio_read(dhandle_t handle,sectnum_t sect_num,void *buffer);
+; dhandle_t - 16bit (ptr)
+; sectnum_t - 16bit
 ;
 
-
-       .export         __dio_read
-       .import         popa,popax
+       .import         __sio_call,pushax
+       .export         _dio_read
        .include        "atari.inc"
 
-.proc  __dio_read
-
-       sta     DBUFLO          ; set buffer address into DCB
-       stx     DBUFHI
-       jsr     popax
-       sta     DAUX1           ; set sector #
-       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
+.proc  _dio_read
 
-       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
+       jsr     pushax          ; push buffer address
+       ldx     #%01000000      ; direction value
+       lda     #SIO_READ       ; read sector command
+       jmp     __sio_call      ; do the call and return to the user
 
 .endproc
+