coco3: make sdc driver handle rawmode=1.
authorBrett Gordon <beretta42@gmail.com>
Tue, 17 May 2016 20:17:16 +0000 (16:17 -0400)
committerBrett Gordon <beretta42@gmail.com>
Thu, 26 May 2016 19:22:22 +0000 (15:22 -0400)
Kernel/platform-coco3/sdc.s

index 0193e00..e7bb7ef 100644 (file)
@@ -37,6 +37,9 @@ _devsdc_write
        pshs    y,u
        ldy     #PREG2          ; set Y to point at data reg a
        ldd     #64*256+4       ; A = chunk count (64), B = bytes per chunk (4)
+       tst     _blk_op+2       ; test user/kernel xfer
+       beq     wrChnk          ; if zero then stay in kernel space
+       jsr     map_process_always ; else flip in user space
 wrChnk  ldu            ,x              ; get 2 data bytes from source
        stu     ,y              ; send data to controller
        ldu     2,x             ; two more bytes..
@@ -44,6 +47,7 @@ wrChnk  ldu           ,x              ; get 2 data bytes from source
        abx                     ; increment X by chunk size (4)
        deca                    ; decrement loop counter
        bne     wrChnk          ; loop until all chunks written
+       jsr     map_kernel      ; reset to kernel space
        puls    y,u,pc          ; return
 
 ;;; Reads 256 bytes from SDC
@@ -51,6 +55,9 @@ _devsdc_read
        pshs    y,u
        ldy     #PREG2          ; set Y to point to data reg a
        ldd     #32*256+8       ; A = chunk count (32), B = bytes per chunk (8)
+       tst     _blk_op+2       ; test usr/kernel xfer
+       beq     rdChnk          ; if zero then stay in kernel space
+       jsr     map_process_always ; else flip to user space
 rdChnk         ldu     ,y              ; read 1st pair of bytes for the chunk
        stu     ,x              ; store to buffer
        ldu     ,y              ; bytes 3 and 4 of..
@@ -62,11 +69,5 @@ rdChnk       ldu     ,y              ; read 1st pair of bytes for the chunk
        abx                     ; increment X by chunk size (8)
        deca                    ; decrement loop counter
        bne     rdChnk          ; loop if more chunks to read
+       jsr     map_kernel      ; reset to kernel space
        puls    y,u,pc          ; return
-       
-
-
-
-
-
-