...
|
...
|
@@ -15,9 +15,9 @@ WITH REGARD TO THIS SOFTWARE.
|
15
|
15
|
#pragma mark - Operations
|
16
|
16
|
|
17
|
17
|
/* clang-format off */
|
18
|
|
-void push8(Stack *s, Uint8 a) { if (s->ptr == 0xff) { s->error = 2; return; } s->dat[s->ptr++] = a; }
|
19
|
|
-Uint8 pop8_keep(Stack *s) { if (s->kptr == 0) { s->error = 1; return 0; } return s->dat[--s->kptr]; }
|
20
|
|
-Uint8 pop8_nokeep(Stack *s) { if (s->ptr == 0) { s->error = 1; return 0; } return s->dat[--s->ptr]; }
|
|
18
|
+void push8(Stack *s, Uint8 a) { if(s->ptr == 0xff) { s->error = 2; return; } s->dat[s->ptr++] = a; }
|
|
19
|
+Uint8 pop8_keep(Stack *s) { if(s->kptr == 0) { s->error = 1; return 0; } return s->dat[--s->kptr]; }
|
|
20
|
+Uint8 pop8_nokeep(Stack *s) { if(s->ptr == 0) { s->error = 1; return 0; } return s->dat[--s->ptr]; }
|
21
|
21
|
static Uint8 (*pop8)(Stack *s);
|
22
|
22
|
void mempoke8(Uint8 *m, Uint16 a, Uint8 b) { m[a] = b; }
|
23
|
23
|
Uint8 mempeek8(Uint8 *m, Uint16 a) { return m[a]; }
|
...
|
...
|
@@ -44,7 +44,7 @@ void op_neq(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b
|
44
|
44
|
void op_gth(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b > a); }
|
45
|
45
|
void op_lth(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b < a); }
|
46
|
46
|
void op_jmp(Uxn *u) { Uint8 a = pop8(u->src); u->ram.ptr += (Sint8)a; }
|
47
|
|
-void op_jnz(Uxn *u) { Uint8 a = pop8(u->src); if (pop8(u->src)) u->ram.ptr += (Sint8)a; }
|
|
47
|
+void op_jnz(Uxn *u) { Uint8 a = pop8(u->src); if(pop8(u->src)) u->ram.ptr += (Sint8)a; }
|
48
|
48
|
void op_jsr(Uxn *u) { Uint8 a = pop8(u->src); push16(u->dst, u->ram.ptr); u->ram.ptr += (Sint8)a; }
|
49
|
49
|
void op_sth(Uxn *u) { Uint8 a = pop8(u->src); push8(u->dst, a); }
|
50
|
50
|
/* Memory */
|
...
|
...
|
@@ -78,7 +78,7 @@ void op_neq16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push8(u->sr
|
78
|
78
|
void op_gth16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push8(u->src, b > a); }
|
79
|
79
|
void op_lth16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push8(u->src, b < a); }
|
80
|
80
|
void op_jmp16(Uxn *u) { u->ram.ptr = pop16(u->src); }
|
81
|
|
-void op_jnz16(Uxn *u) { Uint16 a = pop16(u->src); if (pop8(u->src)) u->ram.ptr = a; }
|
|
81
|
+void op_jnz16(Uxn *u) { Uint16 a = pop16(u->src); if(pop8(u->src)) u->ram.ptr = a; }
|
82
|
82
|
void op_jsr16(Uxn *u) { push16(u->dst, u->ram.ptr); u->ram.ptr = pop16(u->src); }
|
83
|
83
|
void op_sth16(Uxn *u) { Uint16 a = pop16(u->src); push16(u->dst, a); }
|
84
|
84
|
/* Memory(16-bits) */
|