From: Alan Cox Date: Sun, 19 Apr 2015 22:08:38 +0000 (+0100) Subject: zx128: swap in logic X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=03bfc291cf5bc7b1705a4de11e4b1896b4757e36;p=FUZIX.git zx128: swap in logic With this in place we swap data out, we read it back in and then we crash. Further debugging needed yet. --- diff --git a/Kernel/platform-zx128/tricks.s b/Kernel/platform-zx128/tricks.s index 9e09f033..e0986699 100644 --- a/Kernel/platform-zx128/tricks.s +++ b/Kernel/platform-zx128/tricks.s @@ -21,6 +21,7 @@ .globl interrupt_handler .globl current_map .globl _ptab + .globl _swapper ; imported debug symbols .globl outstring, outde, outhl, outbc, outnewline, outchar, outcharhex @@ -114,17 +115,31 @@ _switchin: push bc ; restore stack push hl ; far padding - ld hl, #P_TAB__P_PAGE_OFFSET add hl, de ; process ptr ; We are in DI so we can poke these directly but must not invoke ; any code outside of common + ld sp, #_swapstack + ld a, (hl) + or a + jr nz, not_swapped + + ; Swap the process in (this may swap something else out first) + + push hl + push de + push af + call _swapper + pop af + pop de + pop hl + ld a, (hl) +not_swapped: or #0x18 - ; Need to deal with swap here ; Pages please ! ld bc, #0x7ffd