From: Brett Gordon Date: Thu, 22 Oct 2015 17:37:28 +0000 (-0400) Subject: coco3: bugfix uget/uput: don't assume regular kernel mapping X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=ac7fe3da79328bc3b24291ee22b51b89f4ed5253;p=FUZIX.git coco3: bugfix uget/uput: don't assume regular kernel mapping the kernel mmu could be another state - namely a video state. --- diff --git a/Kernel/platform-coco3/usermem_gime.s b/Kernel/platform-coco3/usermem_gime.s index bc981e48..cfc52289 100644 --- a/Kernel/platform-coco3/usermem_gime.s +++ b/Kernel/platform-coco3/usermem_gime.s @@ -207,6 +207,10 @@ a@ std ,u ;;; remapping the mmu, copies those bytes, *then* re-computes the ;;; mmu banking and repeats until all bytes are transfered. uxfer: + ;; save kernel mmu mapping + ldd $ffa8 + ldx $ffaa + pshs d,x ;; make a data stack leau -8,s ; allow 4 levels in S ;; calc max src @@ -265,24 +269,25 @@ a@ lda ,u+ ; get a byte leay -1,y ; bump counter bne a@ ; loop if not done ;; end inner loop + puls u ; restore data stack ;; clean up kernel mmu's for next mapping or returning - ldd #$0001 ; restore kernel mapping (manually) - std $ffa8 - ldd #$0203 - std $ffaa + puls d,x + pshs d,x + std 0xffa8 + stx 0xffaa ;; increment out loop variables - puls u ; restore data stack ldd krn ; add this iteration's byte count addd icount ; from source address - std krn ; + std krn ; ldd usr ; add this iteration's byte count addd icount ; from destination address - std usr ; + std usr ; ldd count ; subtract this iteration's byte count subd icount ; from total byte to copy std count lbne b@ ; if bytes left to copy then repeat ;; return + leas 4,s ; drop saved kernel map ldx #0 ; return #0 - success puls u,y,cc,pc ; return