uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 16f9b92d4af1f79a4ad3d7e2527733fb562bf57b
parent 1f9155400dd13add78e8d8d6bdc32a2e49884242
Author: neauoire <aliceffekt@gmail.com>
Date:   Wed, 24 Mar 2021 10:50:55 -0700

Progress toward migrating to proper peek/load

Diffstat:
Mbuild.sh | 2+-
Msrc/assembler.c | 4++--
Msrc/uxn.c | 6+++---
3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/build.sh b/build.sh @@ -28,7 +28,7 @@ else fi echo "Assembling.." -./bin/assembler projects/software/noodle.usm bin/boot.rom +./bin/assembler projects/software/left.usm bin/boot.rom echo "Running.." if [ "${2}" = '--cli' ]; diff --git a/src/assembler.c b/src/assembler.c @@ -296,14 +296,14 @@ parsetoken(char *w) if(!findlabellen(w + 1) || findlabellen(w + 1) > 2) return error("Invalid store helper", w); pushshort(findlabeladdr(w + 1), 1); - pushbyte(findopcode(findlabellen(w + 1) == 2 ? "STR2" : "STR"), 0); + pushbyte(findopcode(findlabellen(w + 1) == 2 ? "STR2" : "POK2"), 0); l->refs++; return 1; } else if(w[0] == '~' && (l = findlabel(w + 1))) { if(!findlabellen(w + 1) || findlabellen(w + 1) > 2) return error("Invalid load helper", w); pushshort(findlabeladdr(w + 1), 1); - pushbyte(findopcode(findlabellen(w + 1) == 2 ? "LDR2" : "LDR"), 0); + pushbyte(findopcode(findlabellen(w + 1) == 2 ? "LDR2" : "PEK2"), 0); l->refs++; return 1; } else if((op = findopcode(w)) || scmp(w, "BRK", 4)) { diff --git a/src/uxn.c b/src/uxn.c @@ -50,8 +50,8 @@ void op_jsr(Uxn *u) { Uint8 a = pop8(u->src); push16(u->dst, u->ram.ptr); u->ram /* Memory */ void op_pek(Uxn *u) { Uint16 a = pop8(u->src); push8(u->src, mempeek8(u, a)); } void op_pok(Uxn *u) { Uint16 a = pop8(u->src); Uint8 b = pop8(u->src); mempoke8(u, a, b); } -void op_ldr(Uxn *u) { Uint16 a = pop16(u->src); push8(u->src, mempeek8(u, a)); } -void op_str(Uxn *u) { Uint16 a = pop16(u->src); Uint8 b = pop8(u->src); mempoke8(u, a, b); } +void op_ldr(Uxn *u) { Uint8 a = pop8(u->src); push16(u->src, mempeek16(u, a)); } +void op_str(Uxn *u) { Uint8 a = pop8(u->src); Uint16 b = pop16(u->src); mempoke16(u, a, b); } void op_cln(Uxn *u) { push8(u->src, peek8(u->dst, 0)); } void op_sth(Uxn *u) { Uint8 a = pop8(u->src); push8(u->dst, a); } /* Arithmetic */ @@ -112,7 +112,7 @@ void (*ops[])(Uxn *u) = { Uint8 opr[][4] = { /* wstack-/+ rstack-/+ */ {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {1,0,0,0}, {1,2,0,0}, {2,2,0,0}, {2,3,0,0}, {3,3,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {1,0,0,0}, {1,0,0,2}, - {1,1,0,0}, {2,0,0,0}, {2,1,0,0}, {3,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,1,1,1}, {1,0,0,1}, + {1,1,0,0}, {2,0,0,0}, {1,2,0,0}, {3,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,1,1,1}, {1,0,0,1}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, /* 16-bit */ {0,0,0,0}, {2,0,0,0}, {0,0,0,0}, {2,0,0,0}, {2,4,0,0}, {4,4,0,0}, {4,6,0,0}, {6,6,0,0},