Skip to content

Commit 5a11635

Browse files
committed
finally fix the uxn backend
1 parent 05b8fc8 commit 5a11635

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ scripting languages like Lua, while still maintaining a relatively low-level app
99
- **x86 Real Mode, MS-DOS:** Fully supported
1010
- **x86_64 Linux, macOS:** Fully supported
1111
- **ARM64 Linux, macOS:** Fully supported
12-
- **Uxn:** Fully supported (note: `implement` is broken, see [issue #6](#6))
12+
- **Uxn:** Fully supported
1313
- **Lua:** Fully supported (subset: CallistoScript)
1414

1515
## Build Instructions

source/backends/uxn.d

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ class BackendUXN : CompilerBackend {
124124
}
125125

126126
override void Init() {
127-
WarnNoInfo("This backend is slightly broken. Don't use implement");
128127
output ~= "|0 @vsp $2 @arraySrc $2 @arrayDest $2\n";
129128
output ~= "|100\n";
130129
output ~= "@on-reset\n";
@@ -609,14 +608,12 @@ class BackendUXN : CompilerBackend {
609608
output ~= format(".vsp LDZ2 #%.4x SUB2 .vsp STZ2\n", array.Size());
610609

611610
// copy array contents
612-
output ~= format(";array_%d .arraySrc STZ2\n", arrays.length - 1);
613-
output ~= ".vsp LDZ2 .arrayDest STZ2\n";
614-
output ~= format("#%.4x\n", array.Size());
615-
output ~= format("@copy_loop_%d\n", arrays.length - 1);
616-
output ~= ".arraySrc LDZ2 LDA .arrayDest LDZ2 STA\n";
617-
output ~= ".arraySrc LDZ2 INC2 .arraySrc STZ2\n";
618-
output ~= ".arrayDest LDZ2 INC2 .arrayDest STZ2\n";
619-
output ~= format("#0001 SUB2 DUP2 #0000 NEQ2 ,copy_loop_%d JCN\n", arrays.length - 1);
611+
output ~= format("#%.4x ;memcpy/length STA2\n", array.Size());
612+
output ~= "#0000 ;memcpy/srcBank STA2\n";
613+
output ~= format(";array_%d ;memcpy/srcAddr STA2\n", arrays.length - 1);
614+
output ~= "#0000 ;memcpy/dstBank STA2\n";
615+
output ~= ".vsp LDZ2 ;memcpy/dstAddr STA2\n";
616+
output ~= ";memcpy .System/expansion DEO2\n";
620617

621618
Variable var;
622619
var.type = array.type;

0 commit comments

Comments
 (0)