Browse code

Removed CLN

neauoire authored on 27/03/2021 03:16:48
Showing 4 changed files
... ...
@@ -28,7 +28,7 @@ else
28 28
 fi
29 29
 
30 30
 echo "Assembling.."
31
-./bin/assembler projects/software/left.usm bin/boot.rom
31
+./bin/assembler projects/software/noodle.usm bin/boot.rom
32 32
 
33 33
 echo "Running.."
34 34
 if [ "${2}" = '--cli' ]; 
... ...
@@ -20,6 +20,7 @@
20 20
 %RTN   { JMP2r }
21 21
 %RTN? { #00 EQU #02 JNZ STH2r JMP2 }
22 22
 %ABS2 { DUP2 #000f SFT2 EQU #04 JNZ #ffff MUL2 }
23
+%CLN2r { DUP2 STH2 }
23 24
 %STEP8 { #0033 SFT2 }
24 25
 %MOD8 { #0007 AND2  }
25 26
 %SFL { #40 SFT SFT }
... ...
@@ -46,8 +46,8 @@ Program p;
46 46
 
47 47
 char ops[][4] = {
48 48
 	"BRK", "NOP", "LIT", "POP", "DUP", "SWP", "OVR", "ROT",
49
-	"EQU", "NEQ", "GTH", "LTH", "GTS", "LTS", "JMP", "JSR",
50
-	"PEK", "POK", "LDR", "STR", "JNZ", "---", "CLN", "STH",
49
+	"EQU", "NEQ", "GTH", "LTH", "GTS", "LTS", "---", "---",
50
+	"PEK", "POK", "LDR", "STR", "JMP", "JNZ", "JSR", "STH",
51 51
 	"ADD", "SUB", "MUL", "DIV", "AND", "ORA", "EOR", "SFT"
52 52
 };
53 53
 
... ...
@@ -45,15 +45,14 @@ void op_gth(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b
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_gts(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, (Sint8)b > (Sint8)a); }
47 47
 void op_lts(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, (Sint8)b < (Sint8)a); }
48
-void op_jmp(Uxn *u) { Uint8 a = pop8(u->src); u->ram.ptr += (Sint8)a; }
49
-void op_jnz(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); if (b) u->ram.ptr += (Sint8)a; }
50
-void op_jsr(Uxn *u) { Uint8 a = pop8(u->src); push16(u->dst, u->ram.ptr); u->ram.ptr += (Sint8)a; }
51 48
 /* Memory */
52 49
 void op_pek(Uxn *u) { Uint8 a = pop8(u->src); push8(u->src, mempeek8(u, a)); }
53 50
 void op_pok(Uxn *u) { Uint8 a = pop8(u->src); Uint8 b = pop8(u->src); mempoke8(u, a, b); }
54 51
 void op_ldr(Uxn *u) { Uint8 a = pop8(u->src); push16(u->src, mempeek16(u, a)); }
55 52
 void op_str(Uxn *u) { Uint8 a = pop8(u->src); Uint16 b = pop16(u->src); mempoke16(u, a, b); }
56
-void op_cln(Uxn *u) { push8(u->src, peek8(u->dst, 0)); }
53
+void op_jmp(Uxn *u) { Uint8 a = pop8(u->src); u->ram.ptr += (Sint8)a; }
54
+void op_jnz(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); if (b) u->ram.ptr += (Sint8)a; }
55
+void op_jsr(Uxn *u) { Uint8 a = pop8(u->src); push16(u->dst, u->ram.ptr); u->ram.ptr += (Sint8)a; }
57 56
 void op_sth(Uxn *u) { Uint8 a = pop8(u->src); push8(u->dst, a); }
58 57
 /* Arithmetic */
59 58
 void op_add(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b + a); }
... ...
@@ -79,15 +78,14 @@ void op_gth16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push8(u->sr
79 78
 void op_lth16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push8(u->src, b < a); }
80 79
 void op_gts16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push8(u->src, (Sint16)b > (Sint16)a); }
81 80
 void op_lts16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push8(u->src, (Sint16)b < (Sint16)a); }
82
-void op_jmp16(Uxn *u) { u->ram.ptr = pop16(u->src); }
83
-void op_jnz16(Uxn *u) { Uint16 a = pop16(u->src); Uint8 b = pop8(u->src); if (b) u->ram.ptr = a; }
84
-void op_jsr16(Uxn *u) { push16(u->dst, u->ram.ptr); u->ram.ptr = pop16(u->src); }
85 81
 /* Memory(16-bits) */
86 82
 void op_pek16(Uxn *u) { Uint16 a = pop16(u->src); push8(u->src, mempeek8(u, a)); }
87 83
 void op_pok16(Uxn *u) { Uint16 a = pop16(u->src); Uint8 b = pop8(u->src); mempoke8(u, a, b); }
88 84
 void op_ldr16(Uxn *u) { Uint16 a = pop16(u->src); push16(u->src, mempeek16(u, a)); }
89 85
 void op_str16(Uxn *u) { Uint16 a = pop16(u->src); Uint16 b = pop16(u->src); mempoke16(u, a, b); }
90
-void op_cln16(Uxn *u) { push16(u->src, peek16(u->dst, 0)); }
86
+void op_jmp16(Uxn *u) { u->ram.ptr = pop16(u->src); }
87
+void op_jnz16(Uxn *u) { Uint16 a = pop16(u->src); Uint8 b = pop8(u->src); if (b) u->ram.ptr = a; }
88
+void op_jsr16(Uxn *u) { push16(u->dst, u->ram.ptr); u->ram.ptr = pop16(u->src); }
91 89
 void op_sth16(Uxn *u) { Uint16 a = pop16(u->src); push16(u->dst, a); }
92 90
 /* Arithmetic(16-bits) */
93 91
 void op_add16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->src, b + a); }
... ...
@@ -101,13 +99,13 @@ void op_sft16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); Uint8 left
101 99
 
102 100
 void (*ops[])(Uxn *u) = {
103 101
 	op_brk, op_nop, op_lit, op_pop, op_dup, op_swp, op_ovr, op_rot,
104
-	op_equ, op_neq, op_gth, op_lth, op_gts, op_lts, op_jmp, op_jsr, 
105
-	op_pek, op_pok, op_ldr, op_str, op_jnz, op_nop, op_cln, op_sth, 
102
+	op_equ, op_neq, op_gth, op_lth, op_gts, op_lts, op_nop, op_nop,
103
+	op_pek, op_pok, op_ldr, op_str, op_jmp, op_jnz, op_jsr, op_sth, 
106 104
 	op_add, op_sub, op_mul, op_div, op_and, op_ora, op_eor, op_sft,
107 105
 	/* 16-bit */
108 106
 	op_brk,   op_nop16, op_lit16, op_pop16, op_dup16, op_swp16, op_ovr16, op_rot16,
109
-	op_equ16, op_neq16, op_gth16, op_lth16, op_gts16, op_lts16, op_jmp16, op_jsr16, 
110
-	op_pek16, op_pok16, op_ldr16, op_str16, op_jnz16, op_nop,   op_cln16, op_sth16, 
107
+	op_equ16, op_neq16, op_gth16, op_lth16, op_gts16, op_lts16, op_nop,   op_nop, 
108
+	op_pek16, op_pok16, op_ldr16, op_str16, op_jmp16, op_jnz16, op_jsr16, op_sth16, 
111 109
 	op_add16, op_sub16, op_mul16, op_div16, op_and16, op_ora16, op_eor16, op_sft16
112 110
 };
113 111