Browse code

Progress toward migrating to proper peek/load

neauoire authored on 24/03/2021 17:50:55
Showing 3 changed files
... ...
@@ -28,7 +28,7 @@ else
28 28
 fi
29 29
 
30 30
 echo "Assembling.."
31
-./bin/assembler projects/software/noodle.usm bin/boot.rom
31
+./bin/assembler projects/software/left.usm bin/boot.rom
32 32
 
33 33
 echo "Running.."
34 34
 if [ "${2}" = '--cli' ]; 
... ...
@@ -296,14 +296,14 @@ parsetoken(char *w)
296 296
 		if(!findlabellen(w + 1) || findlabellen(w + 1) > 2)
297 297
 			return error("Invalid store helper", w);
298 298
 		pushshort(findlabeladdr(w + 1), 1);
299
-		pushbyte(findopcode(findlabellen(w + 1) == 2 ? "STR2" : "STR"), 0);
299
+		pushbyte(findopcode(findlabellen(w + 1) == 2 ? "STR2" : "POK2"), 0);
300 300
 		l->refs++;
301 301
 		return 1;
302 302
 	} else if(w[0] == '~' && (l = findlabel(w + 1))) {
303 303
 		if(!findlabellen(w + 1) || findlabellen(w + 1) > 2)
304 304
 			return error("Invalid load helper", w);
305 305
 		pushshort(findlabeladdr(w + 1), 1);
306
-		pushbyte(findopcode(findlabellen(w + 1) == 2 ? "LDR2" : "LDR"), 0);
306
+		pushbyte(findopcode(findlabellen(w + 1) == 2 ? "LDR2" : "PEK2"), 0);
307 307
 		l->refs++;
308 308
 		return 1;
309 309
 	} else if((op = findopcode(w)) || scmp(w, "BRK", 4)) {
... ...
@@ -50,8 +50,8 @@ void op_jsr(Uxn *u) { Uint8 a = pop8(u->src); push16(u->dst, u->ram.ptr); u->ram
50 50
 /* Memory */
51 51
 void op_pek(Uxn *u) { Uint16 a = pop8(u->src); push8(u->src, mempeek8(u, a)); }
52 52
 void op_pok(Uxn *u) { Uint16 a = pop8(u->src); Uint8 b = pop8(u->src); mempoke8(u, a, b); }
53
-void op_ldr(Uxn *u) { Uint16 a = pop16(u->src); push8(u->src, mempeek8(u, a)); }
54
-void op_str(Uxn *u) { Uint16 a = pop16(u->src); Uint8 b = pop8(u->src); mempoke8(u, a, b); }
53
+void op_ldr(Uxn *u) { Uint8 a = pop8(u->src); push16(u->src, mempeek16(u, a)); }
54
+void op_str(Uxn *u) { Uint8 a = pop8(u->src); Uint16 b = pop16(u->src); mempoke16(u, a, b); }
55 55
 void op_cln(Uxn *u) { push8(u->src, peek8(u->dst, 0)); }
56 56
 void op_sth(Uxn *u) { Uint8 a = pop8(u->src); push8(u->dst, a); }
57 57
 /* Arithmetic */
... ...
@@ -112,7 +112,7 @@ void (*ops[])(Uxn *u) = {
112 112
 Uint8 opr[][4] = { /* wstack-/+ rstack-/+ */
113 113
 	{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},
114 114
 	{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},
115
-	{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},
115
+	{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},
116 116
 	{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},
117 117
 	/* 16-bit */
118 118
 	{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},