c128 evalstack corrections

This commit is contained in:
Irmen de Jong 2021-12-22 00:07:05 +01:00
parent 431401d90e
commit 836d40072f
2 changed files with 101 additions and 99 deletions

View File

@ -21,8 +21,8 @@ class C128MachineDefinition: IMachineDefinition {
override val RAW_LOAD_ADDRESS = 0x1300u override val RAW_LOAD_ADDRESS = 0x1300u
// the 2*256 byte evaluation stack (on which bytes, words, and even floats are stored during calculations) // the 2*256 byte evaluation stack (on which bytes, words, and even floats are stored during calculations)
override val ESTACK_LO = 0xce00u // $ce00-$ceff inclusive // TODO c128 address override val ESTACK_LO = 0x1a00u // $1a00-$1aff inclusive
override val ESTACK_HI = 0xcf00u // $ce00-$ceff inclusive // TODO c128 address override val ESTACK_HI = 0x1b00u // $1b00-$1bff inclusive
override lateinit var zeropage: Zeropage override lateinit var zeropage: Zeropage

View File

@ -658,106 +658,108 @@ cx16 {
; the sixteen virtual 16-bit registers that the CX16 has defined in the zeropage ; the sixteen virtual 16-bit registers that the CX16 has defined in the zeropage
; they are simulated on the C128 as well but their location in memory is different ; they are simulated on the C128 as well but their location in memory is different
; (because there's no room for them in the zeropage) ; (because there's no room for them in the zeropage)
; $1300-$1bff is unused RAM on C128, we put the registers at the last 32 bytes of that chunk. ; $1300-$1bff is unused RAM on C128. We'll use $1a00-$1bff as the lo/hi evalstack.
&uword r0 = $1be0 ; the virtual registers are allocated at the bottom of the eval-stack (should be ample space unless
&uword r1 = $1be2 ; you're doing insane nesting of expressions...)
&uword r2 = $1be4 &uword r0 = $1b00
&uword r3 = $1be6 &uword r1 = $1b02
&uword r4 = $1be8 &uword r2 = $1b04
&uword r5 = $1bea &uword r3 = $1b06
&uword r6 = $1bec &uword r4 = $1b08
&uword r7 = $1bee &uword r5 = $1b0a
&uword r8 = $1bf0 &uword r6 = $1b0c
&uword r9 = $1bf2 &uword r7 = $1b0e
&uword r10 = $1bf4 &uword r8 = $1b10
&uword r11 = $1bf6 &uword r9 = $1b12
&uword r12 = $1bf8 &uword r10 = $1b14
&uword r13 = $1bfa &uword r11 = $1b16
&uword r14 = $1bfc &uword r12 = $1b18
&uword r15 = $1bfe &uword r13 = $1b1a
&uword r14 = $1b1c
&uword r15 = $1b1e
&word r0s = $1be0 &word r0s = $1b00
&word r1s = $1be2 &word r1s = $1b02
&word r2s = $1be4 &word r2s = $1b04
&word r3s = $1be6 &word r3s = $1b06
&word r4s = $1be8 &word r4s = $1b08
&word r5s = $1bea &word r5s = $1b0a
&word r6s = $1bec &word r6s = $1b0c
&word r7s = $1bee &word r7s = $1b0e
&word r8s = $1bf0 &word r8s = $1b10
&word r9s = $1bf2 &word r9s = $1b12
&word r10s = $1bf4 &word r10s = $1b14
&word r11s = $1bf6 &word r11s = $1b16
&word r12s = $1bf8 &word r12s = $1b18
&word r13s = $1bfa &word r13s = $1b1a
&word r14s = $1bfc &word r14s = $1b1c
&word r15s = $1bfe &word r15s = $1b1e
&ubyte r0L = $1be0 &ubyte r0L = $1b00
&ubyte r1L = $1be2 &ubyte r1L = $1b02
&ubyte r2L = $1be4 &ubyte r2L = $1b04
&ubyte r3L = $1be6 &ubyte r3L = $1b06
&ubyte r4L = $1be8 &ubyte r4L = $1b08
&ubyte r5L = $1bea &ubyte r5L = $1b0a
&ubyte r6L = $1bec &ubyte r6L = $1b0c
&ubyte r7L = $1bee &ubyte r7L = $1b0e
&ubyte r8L = $1bf0 &ubyte r8L = $1b10
&ubyte r9L = $1bf2 &ubyte r9L = $1b12
&ubyte r10L = $1bf4 &ubyte r10L = $1b14
&ubyte r11L = $1bf6 &ubyte r11L = $1b16
&ubyte r12L = $1bf8 &ubyte r12L = $1b18
&ubyte r13L = $1bfa &ubyte r13L = $1b1a
&ubyte r14L = $1bfc &ubyte r14L = $1b1c
&ubyte r15L = $1bfe &ubyte r15L = $1b1e
&ubyte r0H = $1be1 &ubyte r0H = $1b01
&ubyte r1H = $1be3 &ubyte r1H = $1b03
&ubyte r2H = $1be5 &ubyte r2H = $1b05
&ubyte r3H = $1be7 &ubyte r3H = $1b07
&ubyte r4H = $1be9 &ubyte r4H = $1b09
&ubyte r5H = $1beb &ubyte r5H = $1b0b
&ubyte r6H = $1bed &ubyte r6H = $1b0d
&ubyte r7H = $1bef &ubyte r7H = $1b0f
&ubyte r8H = $1bf1 &ubyte r8H = $1b11
&ubyte r9H = $1bf3 &ubyte r9H = $1b13
&ubyte r10H = $1bf5 &ubyte r10H = $1b15
&ubyte r11H = $1bf7 &ubyte r11H = $1b17
&ubyte r12H = $1bf9 &ubyte r12H = $1b19
&ubyte r13H = $1bfb &ubyte r13H = $1b1b
&ubyte r14H = $1bfd &ubyte r14H = $1b1d
&ubyte r15H = $1bff &ubyte r15H = $1b1f
&byte r0sL = $1be0 &byte r0sL = $1b00
&byte r1sL = $1be2 &byte r1sL = $1b02
&byte r2sL = $1be4 &byte r2sL = $1b04
&byte r3sL = $1be6 &byte r3sL = $1b06
&byte r4sL = $1be8 &byte r4sL = $1b08
&byte r5sL = $1bea &byte r5sL = $1b0a
&byte r6sL = $1bec &byte r6sL = $1b0c
&byte r7sL = $1bee &byte r7sL = $1b0e
&byte r8sL = $1bf0 &byte r8sL = $1b10
&byte r9sL = $1bf2 &byte r9sL = $1b12
&byte r10sL = $1bf4 &byte r10sL = $1b14
&byte r11sL = $1bf6 &byte r11sL = $1b16
&byte r12sL = $1bf8 &byte r12sL = $1b18
&byte r13sL = $1bfa &byte r13sL = $1b1a
&byte r14sL = $1bfc &byte r14sL = $1b1c
&byte r15sL = $1bfe &byte r15sL = $1b1e
&byte r0sH = $1be1 &byte r0sH = $1b01
&byte r1sH = $1be3 &byte r1sH = $1b03
&byte r2sH = $1be5 &byte r2sH = $1b05
&byte r3sH = $1be7 &byte r3sH = $1b07
&byte r4sH = $1be9 &byte r4sH = $1b09
&byte r5sH = $1beb &byte r5sH = $1b0b
&byte r6sH = $1bed &byte r6sH = $1b0d
&byte r7sH = $1bef &byte r7sH = $1b0f
&byte r8sH = $1bf1 &byte r8sH = $1b11
&byte r9sH = $1bf3 &byte r9sH = $1b13
&byte r10sH = $1bf5 &byte r10sH = $1b15
&byte r11sH = $1bf7 &byte r11sH = $1b17
&byte r12sH = $1bf9 &byte r12sH = $1b19
&byte r13sH = $1bfb &byte r13sH = $1b1b
&byte r14sH = $1bfd &byte r14sH = $1b1d
&byte r15sH = $1bff &byte r15sH = $1b1f
} }