diff options
author | Bad Diode <bd@badd10de.dev> | 2023-08-29 20:41:30 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2023-08-29 20:41:30 +0200 |
commit | b4e6d175934513d4b0bd611d321a5d031dafc1a9 (patch) | |
tree | 8485fe1519b7b4bc14415f1023d6ac81b25deb57 /src | |
parent | e2a7888c638d6f1587100713be6414007890e458 (diff) | |
download | uxngba-b4e6d175934513d4b0bd611d321a5d031dafc1a9.tar.gz uxngba-b4e6d175934513d4b0bd611d321a5d031dafc1a9.zip |
Fix signed issue with immediate jump ops
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 20 | ||||
-rw-r--r-- | src/uxn-core.s | 7 |
2 files changed, 16 insertions, 11 deletions
@@ -273,16 +273,16 @@ main(void) { | |||
273 | 273 | ||
274 | uxn_eval_asm(PAGE_PROGRAM); | 274 | uxn_eval_asm(PAGE_PROGRAM); |
275 | 275 | ||
276 | // txt_printf("\nROM"); | 276 | // txt_printf("\nROM"); |
277 | // for (size_t i = 0; i < 64; i++) { | 277 | // for (size_t i = 0; i < 32; i++) { |
278 | // if (i % 8 == 0) { | 278 | // if (i % 8 == 0) { |
279 | // txt_printf("\n"); | 279 | // txt_printf("\n"); |
280 | // } | 280 | // } |
281 | // txt_printf("%02x ", uxn_ram[i + PAGE_PROGRAM]); | 281 | // txt_printf("%02x ", uxn_ram[i + PAGE_PROGRAM]); |
282 | // } | 282 | // } |
283 | // txt_printf("\n"); | 283 | // txt_printf("\n"); |
284 | 284 | ||
285 | txt_printf("WST ("); | 285 | txt_printf("\nWST ("); |
286 | txt_printf("SIZE: %d)", wst_ptr - (uintptr_t)wst); | 286 | txt_printf("SIZE: %d)", wst_ptr - (uintptr_t)wst); |
287 | for (size_t i = 0; i < 32; i++) { | 287 | for (size_t i = 0; i < 32; i++) { |
288 | if (i % 8 == 0) { | 288 | if (i % 8 == 0) { |
diff --git a/src/uxn-core.s b/src/uxn-core.s index ba05cc9..f110b61 100644 --- a/src/uxn-core.s +++ b/src/uxn-core.s | |||
@@ -854,16 +854,19 @@ jci: | |||
854 | ldrb r5, [r0], #1 | 854 | ldrb r5, [r0], #1 |
855 | ldrb r3, [r0], #1 | 855 | ldrb r3, [r0], #1 |
856 | orr r3, r3, r5, lsl #8 | 856 | orr r3, r3, r5, lsl #8 |
857 | lsl r3, r3, #16 | ||
858 | asr r3, r3, #16 | ||
857 | wpop8 r4 | 859 | wpop8 r4 |
858 | cmp r4, #0 | 860 | cmp r4, #0 |
859 | addne r0, r3 | 861 | addne r0, r3 |
860 | addeq r0, #2 | ||
861 | b uxn_decode | 862 | b uxn_decode |
862 | 863 | ||
863 | jmi: | 864 | jmi: |
864 | ldrb r5, [r0], #1 | 865 | ldrb r5, [r0], #1 |
865 | ldrb r3, [r0], #1 | 866 | ldrb r3, [r0], #1 |
866 | orr r3, r3, r5, lsl #8 | 867 | orr r3, r3, r5, lsl #8 |
868 | lsl r3, r3, #16 | ||
869 | asr r3, r3, #16 | ||
867 | add r0, r3 | 870 | add r0, r3 |
868 | b uxn_decode | 871 | b uxn_decode |
869 | 872 | ||
@@ -871,6 +874,8 @@ jsi: | |||
871 | ldrb r5, [r0], #1 | 874 | ldrb r5, [r0], #1 |
872 | ldrb r3, [r0], #1 | 875 | ldrb r3, [r0], #1 |
873 | orr r3, r3, r5, lsl #8 | 876 | orr r3, r3, r5, lsl #8 |
877 | lsl r3, r3, #16 | ||
878 | asr r3, r3, #16 | ||
874 | mov r4, r0 | 879 | mov r4, r0 |
875 | rpush16 r4 | 880 | rpush16 r4 |
876 | add r0, r3 | 881 | add r0, r3 |