commit 1afe39fba4a0fdba16b6e561b3fb4b38578ccbb1
parent 0e69b012709d79d2752800eedf7b1a24383bc6d7
Author: neauoire <aliceffekt@gmail.com>
Date: Sun, 15 Aug 2021 12:01:22 -0700
Removed OVR opcode and replaced with NIP
Diffstat:
3 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/projects/examples/demos/piano.tal b/projects/examples/demos/piano.tal
@@ -6,7 +6,8 @@
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%RTN { JMP2r }
-%TOS { #00 SWP } %TOB { SWP POP }
+%OVR { NIPk } %OVR2 { NIP2k }
+%TOS { #00 SWP }
%MOD { DUP2 / * - }
%LTS2 { #8000 ++ SWP2 #8000 ++ >> }
%GTS2 { #8000 ++ SWP2 #8000 ++ << }
@@ -183,8 +184,8 @@ BRK
@on-touch-octave-view ( -> )
- .Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// TOB #09 ! ,&no-mod JCN
- .Mouse/y DEI2 .octave-view/y1 LDZ2 -- 8// TOB
+ .Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// NIP #09 ! ,&no-mod JCN
+ .Mouse/y DEI2 .octave-view/y1 LDZ2 -- 8// NIP
DUP #00 ! ,&no-incr JCN
.octave LDZ #03 = ,&no-incr JCN
.octave LDZ #01 + .octave STZ &no-incr
@@ -197,7 +198,7 @@ BRK
BRK
&no-mod
- .Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// TOB #06 > ,&no-key JCN
+ .Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// NIP #06 > ,&no-key JCN
.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// ;notes ++ LDA .octave LDZ #0c * + ;play JSR2
( release ) #00 .Mouse/state DEO
;draw-octave JSR2
@@ -207,7 +208,7 @@ BRK
@on-touch-adsr-view ( -> )
- .Mouse/x DEI2 .adsr-view/x1 LDZ2 -- 8// TOB #03 /
+ .Mouse/x DEI2 .adsr-view/x1 LDZ2 -- 8// NIP #03 /
DUP #00 ! ,&no-a JCN
.Audio0/adsr DEI
#10 .Mouse/state DEI #10 = #e0 * + +
@@ -357,7 +358,7 @@ RTN
TOS 4// .wave-view/y1 LDZ2 ++ .Screen/y DEO2
.Screen/x DEI2 #0001 ++ .Screen/x DEO2
( draw ) DUP
- .Audio0/length DEI2 TOB >
+ .Audio0/length DEI2 NIP >
.Audio0/length DEI2 #0100 !! #0101 == #02 * #01 + .Screen/pixel DEO
#01 + GTHk ,&loop JCN
POP2
diff --git a/src/uxn.c b/src/uxn.c
@@ -39,7 +39,7 @@ static void op_lit(Uxn *u) { push8(u->src, mempeek8(u->ram.dat, u->ram.ptr++));
static void op_pop(Uxn *u) { pop8(u->src); }
static void op_dup(Uxn *u) { Uint8 a = pop8(u->src); push8(u->src, a); push8(u->src, a); }
static void op_swp(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, a); push8(u->src, b); }
-static void op_ovr(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b); push8(u->src, a); push8(u->src, b); }
+static void op_nip(Uxn *u) { Uint8 a; pop8(u->src); a = pop8(u->src); push8(u->src, a); }
static void op_rot(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src); push8(u->src, b); push8(u->src, a); push8(u->src, c); }
/* Logic */
static void op_equ(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b == a); }
@@ -73,7 +73,7 @@ static void op_lit16(Uxn *u) { push16(u->src, mempeek16(u->ram.dat, u->ram.ptr++
static void op_pop16(Uxn *u) { pop16(u->src); }
static void op_dup16(Uxn *u) { Uint16 a = pop16(u->src); push16(u->src, a); push16(u->src, a); }
static void op_swp16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->src, a); push16(u->src, b); }
-static void op_ovr16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->src, b); push16(u->src, a); push16(u->src, b); }
+static void op_nip16(Uxn *u) { Uint16 a; pop16(u->src); a = pop16(u->src); push16(u->src, a); }
static void op_rot16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src), c = pop16(u->src); push16(u->src, b); push16(u->src, a); push16(u->src, c); }
/* Logic(16-bits) */
static void op_equ16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push8(u->src, b == a); }
@@ -104,12 +104,12 @@ static void op_eor16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push
static void op_sft16(Uxn *u) { Uint8 a = pop8(u->src); Uint16 b = pop16(u->src); push16(u->src, b >> (a & 0x0f) << ((a & 0xf0) >> 4)); }
static void (*ops[])(Uxn *u) = {
- op_brk, op_lit, op_nop, op_pop, op_dup, op_swp, op_ovr, op_rot,
+ op_brk, op_lit, op_nop, op_pop, op_dup, op_swp, op_nip, op_rot,
op_equ, op_neq, op_gth, op_lth, op_jmp, op_jnz, op_jsr, op_sth,
op_pek, op_pok, op_ldr, op_str, op_lda, op_sta, op_dei, op_deo,
op_add, op_sub, op_mul, op_div, op_and, op_ora, op_eor, op_sft,
/* 16-bit */
- op_brk, op_lit16, op_nop, op_pop16, op_dup16, op_swp16, op_ovr16, op_rot16,
+ op_brk, op_lit16, op_nop, op_pop16, op_dup16, op_swp16, op_nip16, op_rot16,
op_equ16, op_neq16, op_gth16, op_lth16, op_jmp16, op_jnz16, op_jsr16, op_sth16,
op_pek16, op_pok16, op_ldr16, op_str16, op_lda16, op_sta16, op_dei16, op_deo16,
op_add16, op_sub16, op_mul16, op_div16, op_and16, op_ora16, op_eor16, op_sft16
diff --git a/src/uxnasm.c b/src/uxnasm.c
@@ -40,7 +40,7 @@ Program p;
/* clang-format off */
static char ops[][4] = {
- "BRK", "LIT", "NOP", "POP", "DUP", "SWP", "OVR", "ROT",
+ "BRK", "LIT", "NOP", "POP", "DUP", "SWP", "NIP", "ROT",
"EQU", "NEQ", "GTH", "LTH", "JMP", "JCN", "JSR", "STH",
"LDZ", "STZ", "LDR", "STR", "LDA", "STA", "DEI", "DEO",
"ADD", "SUB", "MUL", "DIV", "AND", "ORA", "EOR", "SFT"