commit 276e5086db208753a339b8c3c60d7007481487bc
parent b01b74bad479c83de1d5e48169a9cb0905863e29
Author: neauoire <aliceffekt@gmail.com>
Date: Wed, 21 Apr 2021 10:23:58 -0700
Implemented PEK/POK/GET/PUT
Diffstat:
6 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/README.md b/README.md
@@ -41,9 +41,9 @@ BRK
@print ( addr -- )
&loop
- ( send ) DUP2 PEK2 .Console/char IOW
+ ( send ) DUP2 GET .Console/char IOW
( incr ) #0001 ADD2
- ( loop ) DUP2 PEK2 #00 NEQ ,&loop JNZ
+ ( loop ) DUP2 GET #00 NEQ ,&loop JNZ
POP2
RTN
diff --git a/build.sh b/build.sh
@@ -32,7 +32,7 @@ else
fi
echo "Assembling.."
-./bin/assembler projects/examples/dev.mouse.usm bin/boot.rom
+./bin/assembler projects/examples/dev.console.usm bin/boot.rom
echo "Running.."
if [ "${2}" = '--cli' ];
diff --git a/projects/examples/dev.console.usm b/projects/examples/dev.console.usm
@@ -17,9 +17,9 @@ BRK
@print ( addr -- )
&loop
- ( send ) DUP2 PEK2 .Console/char IOW
+ ( send ) DUP2 GET .Console/char IOW
( incr ) #0001 ADD2
- ( loop ) DUP2 PEK2 #00 NEQ ,&loop JNZ
+ ( loop ) DUP2 GET #00 NEQ ,&loop JNZ
POP2
RTN
diff --git a/projects/examples/dev.mouse.usm b/projects/examples/dev.mouse.usm
@@ -40,18 +40,18 @@ BRK
( clear last cursor )
;clear .Screen/addr IOW2
- .pointer/x LDR .Screen/x IOW2
- .pointer/y LDR .Screen/y IOW2
+ .pointer/x PEK2 .Screen/x IOW2
+ .pointer/y PEK2 .Screen/y IOW2
#30 .Screen/color IOW
( record pointer positions )
- .Mouse/x IOR2 .pointer/x STR
- .Mouse/y IOR2 .pointer/y STR
+ .Mouse/x IOR2 .pointer/x POK2
+ .Mouse/y IOR2 .pointer/y POK2
( draw new cursor )
;cursor .Screen/addr IOW2
- .pointer/x LDR .Screen/x IOW2
- .pointer/y LDR .Screen/y IOW2
+ .pointer/x PEK2 .Screen/x IOW2
+ .pointer/y PEK2 .Screen/y IOW2
( colorize on state )
.Mouse/state IOR #00 NEQ
diff --git a/src/assembler.c b/src/assembler.c
@@ -42,7 +42,7 @@ Program p;
char ops[][4] = {
"BRK", "LIT", "NOP", "POP", "DUP", "SWP", "OVR", "ROT",
"EQU", "NEQ", "GTH", "LTH", "GTS", "LTS", "IOR", "IOW",
- "PEK", "POK", "LDR", "STR", "JMP", "JNZ", "JSR", "STH",
+ "PEK", "POK", "GET", "PUT", "JMP", "JNZ", "JSR", "STH",
"ADD", "SUB", "MUL", "DIV", "AND", "ORA", "EOR", "SFT"
};
diff --git a/src/uxn.c b/src/uxn.c
@@ -51,8 +51,8 @@ void op_iow(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); devpoke8(&u->dev
/* Memory */
void op_pek(Uxn *u) { Uint8 a = pop8(u->src); push8(u->src, mempeek8(u->ram.dat, a)); }
void op_pok(Uxn *u) { Uint8 a = pop8(u->src); Uint8 b = pop8(u->src); mempoke8(u->ram.dat, a, b); }
-void op_ldr(Uxn *u) { Uint8 a = pop8(u->src); push16(u->src, mempeek16(u->ram.dat, a)); }
-void op_str(Uxn *u) { Uint8 a = pop8(u->src); Uint16 b = pop16(u->src); mempoke16(u->ram.dat, a, b); }
+void op_get(Uxn *u) { Uint16 a = pop16(u->src); push8(u->src, mempeek8(u->ram.dat, a)); }
+void op_put(Uxn *u) { Uint16 a = pop16(u->src); Uint8 b = pop8(u->src); mempoke8(u->ram.dat, a, b); }
void op_jmp(Uxn *u) { Uint8 a = pop8(u->src); u->ram.ptr += (Sint8)a; }
void op_jnz(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); if (b) u->ram.ptr += (Sint8)a; }
void op_jsr(Uxn *u) { Uint8 a = pop8(u->src); push16(u->dst, u->ram.ptr); u->ram.ptr += (Sint8)a; }
@@ -83,10 +83,10 @@ void op_lts16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push8(u->sr
void op_ior16(Uxn *u) { Uint8 a = pop8(u->src); push16(u->src, devpeek16(&u->dev[a >> 4], a)); }
void op_iow16(Uxn *u) { Uint8 a = pop8(u->src); Uint16 b = pop16(u->src); devpoke16(&u->dev[a >> 4], a, b); }
/* Memory(16-bits) */
-void op_pek16(Uxn *u) { Uint16 a = pop16(u->src); push8(u->src, mempeek8(u->ram.dat, a)); }
-void op_pok16(Uxn *u) { Uint16 a = pop16(u->src); Uint8 b = pop8(u->src); mempoke8(u->ram.dat, a, b); }
-void op_ldr16(Uxn *u) { Uint16 a = pop16(u->src); push16(u->src, mempeek16(u->ram.dat, a)); }
-void op_str16(Uxn *u) { Uint16 a = pop16(u->src); Uint16 b = pop16(u->src); mempoke16(u->ram.dat, a, b); }
+void op_pek16(Uxn *u) { Uint8 a = pop8(u->src); push16(u->src, mempeek16(u->ram.dat, a)); }
+void op_pok16(Uxn *u) { Uint8 a = pop8(u->src); Uint16 b = pop16(u->src); mempoke16(u->ram.dat, a, b); }
+void op_get16(Uxn *u) { Uint16 a = pop16(u->src); push16(u->src, mempeek16(u->ram.dat, a)); }
+void op_put16(Uxn *u) { Uint16 a = pop16(u->src); Uint16 b = pop16(u->src); mempoke16(u->ram.dat, a, b); }
void op_jmp16(Uxn *u) { u->ram.ptr = pop16(u->src); }
void op_jnz16(Uxn *u) { Uint16 a = pop16(u->src); Uint8 b = pop8(u->src); if (b) u->ram.ptr = a; }
void op_jsr16(Uxn *u) { push16(u->dst, u->ram.ptr); u->ram.ptr = pop16(u->src); }
@@ -104,12 +104,12 @@ void op_sft16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->s
void (*ops[])(Uxn *u) = {
op_brk, op_lit, op_nop, op_pop, op_dup, op_swp, op_ovr, op_rot,
op_equ, op_neq, op_gth, op_lth, op_gts, op_lts, op_ior, op_iow,
- op_pek, op_pok, op_ldr, op_str, op_jmp, op_jnz, op_jsr, op_sth,
+ op_pek, op_pok, op_get, op_put, op_jmp, op_jnz, op_jsr, op_sth,
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_equ16, op_neq16, op_gth16, op_lth16, op_gts16, op_lts16, op_ior16, op_iow16,
- op_pek16, op_pok16, op_ldr16, op_str16, op_jmp16, op_jnz16, op_jsr16, op_sth16,
+ op_pek16, op_pok16, op_get16, op_put16, op_jmp16, op_jnz16, op_jsr16, op_sth16,
op_add16, op_sub16, op_mul16, op_div16, op_and16, op_ora16, op_eor16, op_sft16
};