aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-08-28 20:46:36 +0200
committerBad Diode <bd@badd10de.dev>2023-08-28 20:46:36 +0200
commit864f6b60f5f8d70c14d177256a0815fc9cabacef (patch)
tree24dc5b6a67151063bc40d2e7a3d0924c7a289f1f
parent6c2da62e1a5cc88dae68f0dfe3305974fb5d4467 (diff)
downloaduxngba-864f6b60f5f8d70c14d177256a0815fc9cabacef.tar.gz
uxngba-864f6b60f5f8d70c14d177256a0815fc9cabacef.zip
Add absolute store instructions sta/sta2
-rw-r--r--src/main.c7
-rw-r--r--src/uxn-core.s29
2 files changed, 27 insertions, 9 deletions
diff --git a/src/main.c b/src/main.c
index 33f53c3..8dbaf45 100644
--- a/src/main.c
+++ b/src/main.c
@@ -134,8 +134,10 @@ init_uxn() {
134 // 0x80, 0xff, 0x80, 1, 0x13, 0xa0, 0xaa, 0xbb, 134 // 0x80, 0xff, 0x80, 1, 0x13, 0xa0, 0xaa, 0xbb,
135 // 0xa0, 0xff, 0xee, 0x80, 1, 0x33, 0xa0, 0xaa, 0xbb, 135 // 0xa0, 0xff, 0xee, 0x80, 1, 0x33, 0xa0, 0xaa, 0xbb,
136 // LDA /STA 136 // LDA /STA
137 0xa0, 0x01, 0x05, 0x14, 0xa0, 0xaa, 0xbb, 137 // 0xa0, 0x01, 0x05, 0x14, 0xa0, 0xaa, 0xbb,
138 0xa0, 0x01, 0x05, 0x34, 0xa0, 0xcc, 0xdd, 138 // 0xa0, 0x01, 0x05, 0x34, 0xa0, 0xcc, 0xdd,
139 0xa0, 0xab, 0xcd, 0xa0, 0x01, 0x08, 0x15,
140 // 0xa0, 0xab, 0xcd, 0xa0, 0x01, 0x08, 0x35,
139 }; 141 };
140 memcpy(uxn_ram + PAGE_PROGRAM, uxn_rom, sizeof(uxn_rom)); 142 memcpy(uxn_ram + PAGE_PROGRAM, uxn_rom, sizeof(uxn_rom));
141} 143}
@@ -143,7 +145,6 @@ init_uxn() {
143// TODO: 145// TODO:
144// - Division 146// - Division
145// - DEI/DEO 147// - DEI/DEO
146// - Absolute load/store
147// - Jump instructions (JMP/JCN/JCI/JMI/JSI/JSR) 148// - Jump instructions (JMP/JCN/JCI/JMI/JSI/JSR)
148// - OPr modes 149// - OPr modes
149// - OPk modes 150// - OPk modes
diff --git a/src/uxn-core.s b/src/uxn-core.s
index 7307dce..c290d17 100644
--- a/src/uxn-core.s
+++ b/src/uxn-core.s
@@ -111,16 +111,27 @@ uxn_ret:
111 strb \a, [\off] 111 strb \a, [\off]
112.endm 112.endm
113 113
114.macro zload8 dst, off 114.macro zload8 a, off
115 ldrb \dst, [r7, \off] 115 ldrb \a, [r7, \off]
116.endm 116.endm
117 117
118.macro rload8 dst, off 118.macro rload8 a, off
119 ldrb \dst, [r0, \off] 119 ldrb \a, [r0, \off]
120.endm 120.endm
121 121
122.macro aload8 dst, off 122.macro aload8 a, off
123 ldrb \dst, [r7, \off] 123 ldrb \a, [r7, \off]
124.endm
125
126.macro asave8 a, off
127 strb \a, [r7, \off]
128.endm
129
130.macro asave16 a, off
131 add \off, r7
132 strb \a, [\off, #1]
133 lsr \a, #8
134 strb \a, [\off]
124.endm 135.endm
125 136
126.macro rsave8 a, off 137.macro rsave8 a, off
@@ -684,9 +695,15 @@ lda2:
684 b uxn_decode 695 b uxn_decode
685 696
686sta: 697sta:
698 wpop16 r4, r5
699 wpop8 r3
700 asave8 r3, r4
687 b uxn_decode 701 b uxn_decode
688 702
689sta2: 703sta2:
704 wpop16 r4, r5
705 wpop16 r3, r5
706 asave16 r3, r4
690 b uxn_decode 707 b uxn_decode
691 708
692dei: 709dei: