Removed OVR opcode and replaced with NIP

This commit is contained in:
neauoire 2021-08-15 12:01:22 -07:00
parent 0e69b01270
commit 1afe39fba4
3 changed files with 12 additions and 11 deletions

View File

@ -6,7 +6,8 @@
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 } %<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%RTN { JMP2r } %RTN { JMP2r }
%TOS { #00 SWP } %TOB { SWP POP } %OVR { NIPk } %OVR2 { NIP2k }
%TOS { #00 SWP }
%MOD { DUP2 / * - } %MOD { DUP2 / * - }
%LTS2 { #8000 ++ SWP2 #8000 ++ >> } %LTS2 { #8000 ++ SWP2 #8000 ++ >> }
%GTS2 { #8000 ++ SWP2 #8000 ++ << } %GTS2 { #8000 ++ SWP2 #8000 ++ << }
@ -183,8 +184,8 @@ BRK
@on-touch-octave-view ( -> ) @on-touch-octave-view ( -> )
.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// TOB #09 ! ,&no-mod JCN .Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// NIP #09 ! ,&no-mod JCN
.Mouse/y DEI2 .octave-view/y1 LDZ2 -- 8// TOB .Mouse/y DEI2 .octave-view/y1 LDZ2 -- 8// NIP
DUP #00 ! ,&no-incr JCN DUP #00 ! ,&no-incr JCN
.octave LDZ #03 = ,&no-incr JCN .octave LDZ #03 = ,&no-incr JCN
.octave LDZ #01 + .octave STZ &no-incr .octave LDZ #01 + .octave STZ &no-incr
@ -197,7 +198,7 @@ BRK
BRK BRK
&no-mod &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 .Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// ;notes ++ LDA .octave LDZ #0c * + ;play JSR2
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
;draw-octave JSR2 ;draw-octave JSR2
@ -207,7 +208,7 @@ BRK
@on-touch-adsr-view ( -> ) @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 DUP #00 ! ,&no-a JCN
.Audio0/adsr DEI .Audio0/adsr DEI
#10 .Mouse/state DEI #10 = #e0 * + + #10 .Mouse/state DEI #10 = #e0 * + +
@ -357,7 +358,7 @@ RTN
TOS 4// .wave-view/y1 LDZ2 ++ .Screen/y DEO2 TOS 4// .wave-view/y1 LDZ2 ++ .Screen/y DEO2
.Screen/x DEI2 #0001 ++ .Screen/x DEO2 .Screen/x DEI2 #0001 ++ .Screen/x DEO2
( draw ) DUP ( draw ) DUP
.Audio0/length DEI2 TOB > .Audio0/length DEI2 NIP >
.Audio0/length DEI2 #0100 !! #0101 == #02 * #01 + .Screen/pixel DEO .Audio0/length DEI2 #0100 !! #0101 == #02 * #01 + .Screen/pixel DEO
#01 + GTHk ,&loop JCN #01 + GTHk ,&loop JCN
POP2 POP2

View File

@ -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_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_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_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); } 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 */ /* Logic */
static void op_equ(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b == a); } 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_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_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_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); } 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) */ /* Logic(16-bits) */
static void op_equ16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push8(u->src, b == a); } 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 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) = { 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_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_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, op_add, op_sub, op_mul, op_div, op_and, op_ora, op_eor, op_sft,
/* 16-bit */ /* 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_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_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 op_add16, op_sub16, op_mul16, op_div16, op_and16, op_ora16, op_eor16, op_sft16

View File

@ -40,7 +40,7 @@ Program p;
/* clang-format off */ /* clang-format off */
static char ops[][4] = { 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", "EQU", "NEQ", "GTH", "LTH", "JMP", "JCN", "JSR", "STH",
"LDZ", "STZ", "LDR", "STR", "LDA", "STA", "DEI", "DEO", "LDZ", "STZ", "LDR", "STR", "LDA", "STA", "DEI", "DEO",
"ADD", "SUB", "MUL", "DIV", "AND", "ORA", "EOR", "SFT" "ADD", "SUB", "MUL", "DIV", "AND", "ORA", "EOR", "SFT"