65c816: signal fixes
authorAlan Cox <alan@linux.intel.com>
Wed, 13 Dec 2017 20:36:30 +0000 (20:36 +0000)
committerAlan Cox <alan@linux.intel.com>
Wed, 13 Dec 2017 20:36:30 +0000 (20:36 +0000)
With this we seem to have working signals

Kernel/lowlevel-65c816.s
Kernel/platform-micropack/crt0.s
Kernel/platform-micropack/fuzix.lnk
Kernel/platform-micropack/rules.mk

index 286d4e5..117b3a1 100644 (file)
@@ -693,13 +693,13 @@ signal_exit:
        ;
        ; Right now it looks like this
        ;
-       ;               Bank
-       ;               PC high
-       ;               PC low
-       ;               P
-       ;               A16
-       ;               X16
-       ;               Y16
+       ;               Bank            10
+       ;               PC high         9
+       ;               PC low          8
+       ;               P               7
+       ;               A16             5,6
+       ;               X16             3,4
+       ;               Y16             1,2
        ;       SP
        ;
        ; We want it to look like
@@ -716,12 +716,25 @@ signal_exit:
        .i16
        .a16
 
+       ;
+       ;       We unwind this with an RTS but we created it with an RTI
+       ;       so we need to decrement the saved PC.
+       ;
+
+       lda 8,s
+       dec
+       sta 8,s
+
        tsc                     ; stack to accumulator
        clc
        adc     #10             ; top of block to change
        tax
        tay
        dex                     ; source one below dest
+
+       ;
+       ;       Y now points at bank, X points at PC high
+       ;
        lda     #8              ; copy 9 bytes
        mvp     0,0
        ;
index 71f12d4..b5356db 100644 (file)
@@ -17,6 +17,7 @@
         .area _GSINIT
         .area _GSFINAL
 
+       .area _BANK
        .area _DISCARD
        .area _UDATA
 
index 173af2d..8d87894 100644 (file)
@@ -1,9 +1,10 @@
 -mwxuy
 -i fuzix.ihx
--b _INITIALIZER=0x1000
+-b _INITIALIZER=0x2000
 -b _DISCARD=0x5000
--b _UDATA=0x6D00
--b _CODE=0x7000
+-b _BANK=0x1000
+-b _UDATA=0x7D00
+-b _CODE=0x8000
 -l z80
 platform-micropack/crt0.rel
 platform-micropack/commonmem.rel
index 990c36a..191b0ac 100644 (file)
@@ -4,6 +4,6 @@
 CROSS_CCOPTS += --peep-file $(ROOT_DIR)/cpu-z80/rst8.peep
 #export CROSS_CC_SYS1=--codeseg CODE3
 #export CROSS_CC_SYS2=--codeseg CODE4
-#export CROSS_CC_SYS3=--codeseg CODE5
-#export CROSS_CC_SYS4=--codeseg CODE6
-#export CROSS_CC_SYS5=--codeseg CODE7
+export CROSS_CC_SYS3=--codeseg BANK
+export CROSS_CC_SYS4=--codeseg BANK
+export CROSS_CC_SYS5=--codeseg BANK