aboutsummaryrefslogtreecommitdiffstats
path: root/src/uxn-core.s
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-08-29 13:28:47 +0200
committerBad Diode <bd@badd10de.dev>2023-08-29 13:28:47 +0200
commitb1b6d258cd8b2dae16815ff239bc9db353e170aa (patch)
tree24ba54f363ce699e40beeba2da1b36ac71f12905 /src/uxn-core.s
parent3473765c5bcf2dde8b22998d6dac7a3873c6f7d3 (diff)
downloaduxngba-b1b6d258cd8b2dae16815ff239bc9db353e170aa.tar.gz
uxngba-b1b6d258cd8b2dae16815ff239bc9db353e170aa.zip
Add immediate jump operations jci/jmi/jsi
Diffstat (limited to 'src/uxn-core.s')
-rw-r--r--src/uxn-core.s40
1 files changed, 34 insertions, 6 deletions
diff --git a/src/uxn-core.s b/src/uxn-core.s
index ec7537f..d32f303 100644
--- a/src/uxn-core.s
+++ b/src/uxn-core.s
@@ -94,6 +94,16 @@ uxn_ret:
94 strb \a, [r2], #1 94 strb \a, [r2], #1
95.endm 95.endm
96 96
97.macro rpop8s a
98 ldrsb \a, [r2, #-1]!
99.endm
100
101.macro rpop16 a, b
102 ldrb \a, [r2, #-1]!
103 ldrb \b, [r2, #-1]!
104 orr \a, \a, \b, lsl #8
105.endm
106
97.macro rpush16 a 107.macro rpush16 a
98 strb \a, [r2, #1] 108 strb \a, [r2, #1]
99 lsr \a, #8 109 lsr \a, #8
@@ -255,7 +265,7 @@ op_table:
255 .word brk @ 0x69 265 .word brk @ 0x69
256 .word brk @ 0x6a 266 .word brk @ 0x6a
257 .word brk @ 0x6b 267 .word brk @ 0x6b
258 .word brk @ 0x6c 268 .word jmp2r @ 0x6c
259 .word brk @ 0x6d 269 .word brk @ 0x6d
260 .word brk @ 0x6e 270 .word brk @ 0x6e
261 .word brk @ 0x6f 271 .word brk @ 0x6f
@@ -412,17 +422,29 @@ brk:
412 b uxn_ret 422 b uxn_ret
413 423
414jci: 424jci:
415 wpop8 r3 425 ldrb r5, [r0], #1
416 cmp r3, #0 426 ldrsb r3, [r0], #1
417 @ TODO: What to do here? Reference not fully clear. 427 orr r3, r3, r5, lsl #8
428 wpop8 r4
429 cmp r4, #0
430 addne r0, r3
431 addeq r0, #2
418 b uxn_decode 432 b uxn_decode
419 433
420jmi: 434jmi:
421 @ TODO: What to do here? Reference not fully clear. 435 ldrb r5, [r0], #1
436 ldrsb r3, [r0], #1
437 orr r3, r3, r5, lsl #8
438 add r0, r3
422 b uxn_decode 439 b uxn_decode
423 440
424jsi: 441jsi:
425 @ TODO: What to do here? Reference not fully clear. 442 ldrb r5, [r0], #1
443 ldrsb r3, [r0], #1
444 orr r3, r3, r5, lsl #8
445 mov r4, r0
446 rpush16 r4
447 add r0, r3
426 b uxn_decode 448 b uxn_decode
427 449
428lit: 450lit:
@@ -618,6 +640,12 @@ jmp2:
618 add r0, r0, r3 640 add r0, r0, r3
619 b uxn_decode 641 b uxn_decode
620 642
643jmp2r:
644 rpop16 r3, r5
645 mov r0, r7
646 add r0, r0, r3
647 b uxn_decode
648
621jcn: 649jcn:
622 wpop8s r3 650 wpop8s r3
623 wpop8 r4 651 wpop8 r4