Browse code

Removed OVR opcode and replaced with NIP

neauoire authored on 15/08/2021 19:01:22
Showing 3 changed files
... ...
@@ -6,7 +6,8 @@
6 6
 %<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
7 7
 
8 8
 %RTN  { JMP2r }
9
-%TOS  { #00 SWP } %TOB { SWP POP }
9
+%OVR  { NIPk } %OVR2  { NIP2k }
10
+%TOS  { #00 SWP } 
10 11
 %MOD  { DUP2 / * - }
11 12
 %LTS2 { #8000 ++ SWP2 #8000 ++ >> }
12 13
 %GTS2 { #8000 ++ SWP2 #8000 ++ << }
... ...
@@ -183,8 +184,8 @@ BRK
183 184
 
184 185
 @on-touch-octave-view ( -> )
185 186
 
186
-	.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// TOB #09 ! ,&no-mod JCN
187
-		.Mouse/y DEI2 .octave-view/y1 LDZ2 -- 8// TOB 
187
+	.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// NIP #09 ! ,&no-mod JCN
188
+		.Mouse/y DEI2 .octave-view/y1 LDZ2 -- 8// NIP 
188 189
 		DUP #00 ! ,&no-incr JCN
189 190
 			.octave LDZ #03 = ,&no-incr JCN
190 191
 			.octave LDZ #01 + .octave STZ &no-incr
... ...
@@ -197,7 +198,7 @@ BRK
197 198
 		BRK
198 199
 	&no-mod
199 200
 
200
-	.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// TOB #06 > ,&no-key JCN
201
+	.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// NIP #06 > ,&no-key JCN
201 202
 		.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// ;notes ++ LDA .octave LDZ #0c * + ;play JSR2
202 203
 		( release ) #00 .Mouse/state DEO
203 204
 		;draw-octave JSR2
... ...
@@ -207,7 +208,7 @@ BRK
207 208
 
208 209
 @on-touch-adsr-view ( -> )
209 210
 
210
-	.Mouse/x DEI2 .adsr-view/x1 LDZ2 -- 8// TOB #03 /
211
+	.Mouse/x DEI2 .adsr-view/x1 LDZ2 -- 8// NIP #03 /
211 212
 	DUP #00 ! ,&no-a JCN
212 213
 		.Audio0/adsr DEI
213 214
 		#10 .Mouse/state DEI #10 = #e0 * + +
... ...
@@ -357,7 +358,7 @@ RTN
357 358
 		TOS 4// .wave-view/y1 LDZ2 ++ .Screen/y DEO2
358 359
 		.Screen/x DEI2 #0001 ++ .Screen/x DEO2
359 360
 		( draw ) DUP 
360
-			.Audio0/length DEI2 TOB > 
361
+			.Audio0/length DEI2 NIP > 
361 362
 			.Audio0/length DEI2 #0100 !! #0101 == #02 * #01 + .Screen/pixel DEO
362 363
 		#01 + GTHk ,&loop JCN
363 364
 	POP2
... ...
@@ -39,7 +39,7 @@ static void op_lit(Uxn *u) { push8(u->src, mempeek8(u->ram.dat, u->ram.ptr++));
39 39
 static void op_pop(Uxn *u) { pop8(u->src); }
40 40
 static void op_dup(Uxn *u) { Uint8 a = pop8(u->src); push8(u->src, a); push8(u->src, a); }
41 41
 static void op_swp(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, a); push8(u->src, b); }
42
-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); }
42
+static void op_nip(Uxn *u) { Uint8 a; pop8(u->src); a = pop8(u->src); push8(u->src, a); }
43 43
 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); }
44 44
 /* Logic */
45 45
 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++
73 73
 static void op_pop16(Uxn *u) { pop16(u->src); }
74 74
 static void op_dup16(Uxn *u) { Uint16 a = pop16(u->src); push16(u->src, a); push16(u->src, a); }
75 75
 static void op_swp16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->src, a); push16(u->src, b); }
76
-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); }
76
+static void op_nip16(Uxn *u) { Uint16 a; pop16(u->src); a = pop16(u->src); push16(u->src, a); }
77 77
 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); }
78 78
 /* Logic(16-bits) */
79 79
 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
104 104
 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)); }
105 105
 
106 106
 static void (*ops[])(Uxn *u) = {
107
-	op_brk, op_lit, op_nop, op_pop, op_dup, op_swp, op_ovr, op_rot,
107
+	op_brk, op_lit, op_nop, op_pop, op_dup, op_swp, op_nip, op_rot,
108 108
 	op_equ, op_neq, op_gth, op_lth, op_jmp, op_jnz, op_jsr, op_sth, 
109 109
 	op_pek, op_pok, op_ldr, op_str, op_lda, op_sta, op_dei, op_deo,
110 110
 	op_add, op_sub, op_mul, op_div, op_and, op_ora, op_eor, op_sft,
111 111
 	/* 16-bit */
112
-	op_brk,   op_lit16, op_nop,   op_pop16, op_dup16, op_swp16, op_ovr16, op_rot16,
112
+	op_brk,   op_lit16, op_nop,   op_pop16, op_dup16, op_swp16, op_nip16, op_rot16,
113 113
 	op_equ16, op_neq16, op_gth16, op_lth16, op_jmp16, op_jnz16, op_jsr16, op_sth16, 
114 114
 	op_pek16, op_pok16, op_ldr16, op_str16, op_lda16, op_sta16, op_dei16, op_deo16, 
115 115
 	op_add16, op_sub16, op_mul16, op_div16, op_and16, op_ora16, op_eor16, op_sft16
... ...
@@ -40,7 +40,7 @@ Program p;
40 40
 /* clang-format off */
41 41
 
42 42
 static char ops[][4] = {
43
-	"BRK", "LIT", "NOP", "POP", "DUP", "SWP", "OVR", "ROT",
43
+	"BRK", "LIT", "NOP", "POP", "DUP", "SWP", "NIP", "ROT",
44 44
 	"EQU", "NEQ", "GTH", "LTH", "JMP", "JCN", "JSR", "STH",
45 45
 	"LDZ", "STZ", "LDR", "STR", "LDA", "STA", "DEI", "DEO",
46 46
 	"ADD", "SUB", "MUL", "DIV", "AND", "ORA", "EOR", "SFT"