Browse code

Removed extraneous j variable

Devine Lu Linvega authored on 02/01/2023 02:26:28
Showing 3 changed files
... ...
@@ -46,8 +46,6 @@ rm -f ./bin/*
46 46
 if [ $format = 1 ];
47 47
 then
48 48
 	echo "Formatting.."
49
-	clang-format -i src/uxn.h
50
-	clang-format -i src/uxn.c
51 49
 	clang-format -i src/devices/system.h
52 50
 	clang-format -i src/devices/system.c
53 51
 	clang-format -i src/devices/screen.h
... ...
@@ -11,18 +11,16 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 11
 WITH REGARD TO THIS SOFTWARE.
12 12
 */
13 13
 
14
-/* clang-format off */
15
-
16 14
 /*	a,b,c: general use.  bs: byte/short bool. src, dst: stack ptrs, swapped in return mode.
17 15
 	pc: program counter. sp: ptr to src stack ptr. kptr: "keep" mode copy of src stack ptr.
18
-	x,y: macro in params. d: macro in device. j,k,dev: macro temp variables. o: macro out param. */
16
+	x,y: macro in params. d: macro in device. j: macro temp variables. o: macro out param. */
19 17
 
20 18
 #define HALT(c) { return uxn_halt(u, instr, (c), pc - 1); }
21 19
 #define LITERAL { if(bs) { PEEK16(a, pc) PUSH16(src, a) pc += 2; } else { a = u->ram[pc]; PUSH8(src, a) pc += 1; } }
22 20
 #define CALL { if(bs){ PEEK16(a, pc) PUSH16(u->rst, pc + 2) pc = a; } else { a = u->ram[pc]; PUSH16(u->rst, pc + 1) pc += (Sint8)a + 2; } }
23 21
 #define JUMP(x) { if(bs) pc = (x); else pc += (Sint8)(x); }
24 22
 #define PUSH8(s, x) { if(s->ptr == 0xff) HALT(2) s->dat[s->ptr++] = (x); }
25
-#define PUSH16(s, x) { if((j = s->ptr) >= 0xfe) HALT(2) k = (x); s->dat[j] = k >> 8; s->dat[j + 1] = k; s->ptr = j + 2; }
23
+#define PUSH16(s, x) { if((j = s->ptr) >= 0xfe) HALT(2) s->dat[j] = (x) >> 8; s->dat[j + 1] = (x); s->ptr = j + 2; }
26 24
 #define PUSH(s, x) { if(bs) { PUSH16(s, (x)) } else { PUSH8(s, (x)) } }
27 25
 #define POP8(o) { if(!(j = *sp)) HALT(1) o = (Uint16)src->dat[--j]; *sp = j; }
28 26
 #define POP16(o) { if((j = *sp) <= 1) HALT(1) o = src->dat[j - 1]; o += src->dat[j - 2] << 8; *sp = j - 2; }
... ...
@@ -36,7 +34,7 @@ WITH REGARD TO THIS SOFTWARE.
36 34
 int
37 35
 uxn_eval(Uxn *u, Uint16 pc)
38 36
 {
39
-	unsigned int a, b, c, j, k, bs, instr;
37
+	unsigned int a, b, c, j, bs, instr;
40 38
 	Uint8 kptr, *sp;
41 39
 	Stack *src, *dst;
42 40
 	if(!pc || u->dev[0x0f]) return 0;
... ...
@@ -87,8 +85,6 @@ uxn_eval(Uxn *u, Uint16 pc)
87 85
 	return 1;
88 86
 }
89 87
 
90
-/* clang-format on */
91
-
92 88
 int
93 89
 uxn_boot(Uxn *u, Uint8 *ram, Dei *dei, Deo *deo)
94 90
 {
... ...
@@ -39,6 +39,6 @@ typedef struct Uxn {
39 39
 typedef Uint8 Dei(Uxn *u, Uint8 addr);
40 40
 typedef void Deo(Uxn *u, Uint8 addr, Uint8 value);
41 41
 
42
+int uxn_halt(Uxn *u, Uint8 instr, Uint8 err, Uint16 addr);
42 43
 int uxn_boot(Uxn *u, Uint8 *ram, Dei *dei, Deo *deo);
43 44
 int uxn_eval(Uxn *u, Uint16 pc);
44
-int uxn_halt(Uxn *u, Uint8 instr, Uint8 err, Uint16 addr);