commit 5f6c9a8
Devine Lu Linvega
·
2024-12-15 17:28:15 +0000 UTC
parent 4ab4beb
Removed uxn core indirection
11 files changed,
+89,
-89
+6,
-6
1@@ -196,7 +196,7 @@ console_input(Uint8 c, int type)
2 {
3 uxn.dev[0x12] = c;
4 uxn.dev[0x17] = type;
5- return uxn_eval(&uxn, PEEK2(&uxn.dev[0x10]));
6+ return uxn_eval(PEEK2(&uxn.dev[0x10]));
7 }
8
9 void
10@@ -210,22 +210,22 @@ console_listen(int i, int argc, char **argv)
11 }
12
13 Uint8
14-console_dei(Uxn *u, Uint8 addr)
15+console_dei(Uint8 addr)
16 {
17 switch(addr) {
18 case CMD_LIVE:
19 case CMD_EXIT: check_child(); break;
20 }
21- return u->dev[addr];
22+ return uxn.dev[addr];
23 }
24
25 void
26-console_deo(Uxn *u, Uint8 addr)
27+console_deo(Uint8 addr)
28 {
29 FILE *fd;
30 switch(addr) {
31- case 0x18: fd = stdout, fputc(u->dev[0x18], fd), fflush(fd); break;
32- case 0x19: fd = stderr, fputc(u->dev[0x19], fd), fflush(fd); break;
33+ case 0x18: fd = stdout, fputc(uxn.dev[0x18], fd), fflush(fd); break;
34+ case 0x19: fd = stderr, fputc(uxn.dev[0x19], fd), fflush(fd); break;
35 case CMD_EXEC: start_fork(); break;
36 }
37 }
+2,
-2
1@@ -16,6 +16,6 @@ WITH REGARD TO THIS SOFTWARE.
2
3 int console_input(Uint8 c, int type);
4 void console_listen(int i, int argc, char **argv);
5-Uint8 console_dei(Uxn *u, Uint8 addr);
6-void console_deo(Uxn *u, Uint8 addr);
7+Uint8 console_dei(Uint8 addr);
8+void console_deo(Uint8 addr);
9 void close_console(void);
+3,
-3
1@@ -17,7 +17,7 @@ controller_down(Uint8 mask)
2 {
3 if(mask) {
4 uxn.dev[0x82] |= mask;
5- uxn_eval(&uxn, PEEK2(&uxn.dev[0x80]));
6+ uxn_eval(PEEK2(&uxn.dev[0x80]));
7 }
8 }
9
10@@ -26,7 +26,7 @@ controller_up(Uint8 mask)
11 {
12 if(mask) {
13 uxn.dev[0x82] &= (~mask);
14- uxn_eval(&uxn, PEEK2(&uxn.dev[0x80]));
15+ uxn_eval(PEEK2(&uxn.dev[0x80]));
16 }
17 }
18
19@@ -35,7 +35,7 @@ controller_key(Uint8 key)
20 {
21 if(key) {
22 uxn.dev[0x83] = key;
23- uxn_eval(&uxn, PEEK2(&uxn.dev[0x80]));
24+ uxn_eval(PEEK2(&uxn.dev[0x80]));
25 uxn.dev[0x83] = 0;
26 }
27 }
+4,
-4
1@@ -16,14 +16,14 @@ void
2 mouse_down(Uint8 mask)
3 {
4 uxn.dev[0x96] |= mask;
5- uxn_eval(&uxn, PEEK2(&uxn.dev[0x90]));
6+ uxn_eval(PEEK2(&uxn.dev[0x90]));
7 }
8
9 void
10 mouse_up(Uint8 mask)
11 {
12 uxn.dev[0x96] &= (~mask);
13- uxn_eval(&uxn, PEEK2(&uxn.dev[0x90]));
14+ uxn_eval(PEEK2(&uxn.dev[0x90]));
15 }
16
17 void
18@@ -31,7 +31,7 @@ mouse_pos(Uint16 x, Uint16 y)
19 {
20 uxn.dev[0x92] = x >> 8, uxn.dev[0x93] = x;
21 uxn.dev[0x94] = y >> 8, uxn.dev[0x95] = y;
22- uxn_eval(&uxn, PEEK2(&uxn.dev[0x90]));
23+ uxn_eval(PEEK2(&uxn.dev[0x90]));
24 }
25
26 void
27@@ -39,7 +39,7 @@ mouse_scroll(Uint16 x, Uint16 y)
28 {
29 uxn.dev[0x9a] = x >> 8, uxn.dev[0x9b] = x;
30 uxn.dev[0x9c] = -y >> 8, uxn.dev[0x9d] = -y;
31- uxn_eval(&uxn, PEEK2(&uxn.dev[0x90]));
32+ uxn_eval(PEEK2(&uxn.dev[0x90]));
33 uxn.dev[0x9a] = 0, uxn.dev[0x9b] = 0;
34 uxn.dev[0x9c] = 0, uxn.dev[0x9d] = 0;
35 }
+11,
-11
1@@ -147,7 +147,7 @@ screen_redraw(void)
2 static int rX, rY, rA, rMX, rMY, rMA, rML, rDX, rDY;
3
4 Uint8
5-screen_dei(Uxn *u, Uint8 addr)
6+screen_dei(Uint8 addr)
7 {
8 switch(addr) {
9 case 0x22: return uxn_screen.width >> 8;
10@@ -160,25 +160,25 @@ screen_dei(Uxn *u, Uint8 addr)
11 case 0x2b: return rY;
12 case 0x2c: return rA >> 8;
13 case 0x2d: return rA;
14- default: return u->dev[addr];
15+ default: return uxn.dev[addr];
16 }
17 }
18
19 void
20-screen_deo(Uxn *u, Uint8 addr)
21+screen_deo(Uint8 addr)
22 {
23 switch(addr) {
24 case 0x23: screen_resize(PEEK2(&uxn.dev[0x22]), uxn_screen.height, uxn_screen.scale); return;
25 case 0x25: screen_resize(uxn_screen.width, PEEK2(&uxn.dev[0x24]), uxn_screen.scale); return;
26- case 0x26: rMX = u->dev[0x26] & 0x1, rMY = u->dev[0x26] & 0x2, rMA = u->dev[0x26] & 0x4, rML = u->dev[0x26] >> 4, rDX = rMX << 3, rDY = rMY << 2; return;
27+ case 0x26: rMX = uxn.dev[0x26] & 0x1, rMY = uxn.dev[0x26] & 0x2, rMA = uxn.dev[0x26] & 0x4, rML = uxn.dev[0x26] >> 4, rDX = rMX << 3, rDY = rMY << 2; return;
28 case 0x28:
29- case 0x29: rX = (u->dev[0x28] << 8) | u->dev[0x29], rX = twos(rX); return;
30+ case 0x29: rX = (uxn.dev[0x28] << 8) | uxn.dev[0x29], rX = twos(rX); return;
31 case 0x2a:
32- case 0x2b: rY = (u->dev[0x2a] << 8) | u->dev[0x2b], rY = twos(rY); return;
33+ case 0x2b: rY = (uxn.dev[0x2a] << 8) | uxn.dev[0x2b], rY = twos(rY); return;
34 case 0x2c:
35- case 0x2d: rA = (u->dev[0x2c] << 8) | u->dev[0x2d]; return;
36+ case 0x2d: rA = (uxn.dev[0x2c] << 8) | uxn.dev[0x2d]; return;
37 case 0x2e: {
38- int ctrl = u->dev[0x2e];
39+ int ctrl = uxn.dev[0x2e];
40 int color = ctrl & 0x3;
41 int len = MAR2(uxn_screen.width);
42 Uint8 *layer = ctrl & 0x40 ? uxn_screen.fg : uxn_screen.bg;
43@@ -211,7 +211,7 @@ screen_deo(Uxn *u, Uint8 addr)
44 }
45 case 0x2f: {
46 int i;
47- int ctrl = u->dev[0x2f];
48+ int ctrl = uxn.dev[0x2f];
49 int twobpp = !!(ctrl & 0x80);
50 int blend = ctrl & 0xf;
51 int fx = ctrl & 0x10 ? -1 : 1, fy = ctrl & 0x20 ? -1 : 1;
52@@ -223,7 +223,7 @@ screen_deo(Uxn *u, Uint8 addr)
53 for(i = 0; i <= rML; i++, x += dyx, y += dxy, rA += addr_incr) {
54 Uint16 xx = MAR(x), yy = MAR(y);
55 if(xx < MAR(uxn_screen.width) && MAR(yy) < MAR2(uxn_screen.height)) {
56- Uint8 *sprite = &u->ram[rA];
57+ Uint8 *sprite = &uxn.ram[rA];
58 int opaque = blend % 5, by = (yy + 8) * len;
59 for(ay = yy * len, qy = fy < 0 ? 7 : 0; ay < by; ay += len, qy += fy) {
60 int ch1 = sprite[qy], ch2 = sprite[qy + 8] << 1, bx = xx + 8 + ay;
61@@ -238,7 +238,7 @@ screen_deo(Uxn *u, Uint8 addr)
62 for(i = 0; i <= rML; i++, x += dyx, y += dxy, rA += addr_incr) {
63 Uint16 xx = MAR(x), yy = MAR(y);
64 if(xx < MAR(uxn_screen.width) && MAR(yy) < MAR2(uxn_screen.height)) {
65- Uint8 *sprite = &u->ram[rA];
66+ Uint8 *sprite = &uxn.ram[rA];
67 int opaque = blend % 5, by = (yy + 8) * len;
68 for(ay = yy * len, qy = fy < 0 ? 7 : 0; ay < by; ay += len, qy += fy) {
69 int ch1 = sprite[qy], bx = xx + 8 + ay;
+2,
-2
1@@ -24,7 +24,7 @@ void screen_palette(void);
2 void screen_resize(Uint16 width, Uint16 height, int scale);
3 void screen_redraw();
4
5-Uint8 screen_dei(Uxn *u, Uint8 addr);
6-void screen_deo(Uxn *u, Uint8 addr);
7+Uint8 screen_dei(Uint8 addr);
8+void screen_deo(Uint8 addr);
9
10 #define twos(v) (v & 0x8000 ? (int)v - 0x10000 : (int)v)
+25,
-25
1@@ -19,14 +19,14 @@ WITH REGARD TO THIS SOFTWARE.
2 char *boot_rom;
3
4 static void
5-system_zero(Uxn *u, int soft)
6+system_zero(int soft)
7 {
8 int i;
9 for(i = soft ? 0x100 : 0; i < 0x10000; i++)
10- u->ram[i] = 0;
11+ uxn.ram[i] = 0;
12 for(i = 0x0; i < 0x100; i++)
13- u->dev[i] = 0;
14- u->wst.ptr = u->rst.ptr = 0;
15+ uxn.dev[i] = 0;
16+ uxn.wst.ptr = uxn.rst.ptr = 0;
17 }
18
19 static int
20@@ -68,9 +68,9 @@ system_error(char *msg, const char *err)
21 void
22 system_reboot(int soft)
23 {
24- system_zero(&uxn, soft);
25+ system_zero(soft);
26 if(system_load(&uxn.ram[PAGE_PROGRAM], boot_rom))
27- uxn_eval(&uxn, PAGE_PROGRAM);
28+ uxn_eval(PAGE_PROGRAM);
29 }
30
31 int
32@@ -83,46 +83,46 @@ system_boot(Uint8 *ram, char *boot)
33 /* IO */
34
35 Uint8
36-system_dei(Uxn *u, Uint8 addr)
37+system_dei(Uint8 addr)
38 {
39 switch(addr) {
40 case 0x4: return uxn.wst.ptr;
41 case 0x5: return uxn.rst.ptr;
42- default: return u->dev[addr];
43+ default: return uxn.dev[addr];
44 }
45 }
46
47 void
48-system_deo(Uxn *u, Uint8 port)
49+system_deo(Uint8 port)
50 {
51 switch(port) {
52 case 0x3: {
53- Uint16 addr = PEEK2(u->dev + 2);
54- if(u->ram[addr] == 0x0) {
55- Uint16 i, value = u->ram[addr + 7], length = PEEK2(u->ram + addr + 1);
56- unsigned int dst_page = PEEK2(u->ram + addr + 3), dst_addr = PEEK2(u->ram + addr + 5);
57+ Uint16 addr = PEEK2(uxn.dev + 2);
58+ if(uxn.ram[addr] == 0x0) {
59+ Uint16 i, value = uxn.ram[addr + 7], length = PEEK2(uxn.ram + addr + 1);
60+ unsigned int dst_page = PEEK2(uxn.ram + addr + 3), dst_addr = PEEK2(uxn.ram + addr + 5);
61 unsigned int dst = dst_page * 0x10000;
62 if(dst_page < RAM_PAGES)
63 for(i = 0; i < length; i++)
64- u->ram[dst + (Uint16)(dst_addr + i)] = value;
65- } else if(u->ram[addr] == 0x1) {
66- Uint16 i, length = PEEK2(u->ram + addr + 1);
67- unsigned int a_page = PEEK2(u->ram + addr + 3), a_addr = PEEK2(u->ram + addr + 5);
68- unsigned int b_page = PEEK2(u->ram + addr + 7), b_addr = PEEK2(u->ram + addr + 9);
69+ uxn.ram[dst + (Uint16)(dst_addr + i)] = value;
70+ } else if(uxn.ram[addr] == 0x1) {
71+ Uint16 i, length = PEEK2(uxn.ram + addr + 1);
72+ unsigned int a_page = PEEK2(uxn.ram + addr + 3), a_addr = PEEK2(uxn.ram + addr + 5);
73+ unsigned int b_page = PEEK2(uxn.ram + addr + 7), b_addr = PEEK2(uxn.ram + addr + 9);
74 unsigned int src = a_page * 0x10000, dst = b_page * 0x10000;
75 if(a_page < RAM_PAGES && b_page < RAM_PAGES)
76 for(i = 0; i < length; i++)
77- u->ram[dst + (Uint16)(b_addr + i)] = u->ram[src + (Uint16)(a_addr + i)];
78- } else if(u->ram[addr] == 0x2) {
79- Uint16 i, length = PEEK2(u->ram + addr + 1);
80- unsigned int a_page = PEEK2(u->ram + addr + 3), a_addr = PEEK2(u->ram + addr + 5);
81- unsigned int b_page = PEEK2(u->ram + addr + 7), b_addr = PEEK2(u->ram + addr + 9);
82+ uxn.ram[dst + (Uint16)(b_addr + i)] = uxn.ram[src + (Uint16)(a_addr + i)];
83+ } else if(uxn.ram[addr] == 0x2) {
84+ Uint16 i, length = PEEK2(uxn.ram + addr + 1);
85+ unsigned int a_page = PEEK2(uxn.ram + addr + 3), a_addr = PEEK2(uxn.ram + addr + 5);
86+ unsigned int b_page = PEEK2(uxn.ram + addr + 7), b_addr = PEEK2(uxn.ram + addr + 9);
87 unsigned int src = a_page * 0x10000, dst = b_page * 0x10000;
88 if(a_page < RAM_PAGES && b_page < RAM_PAGES)
89 for(i = length - 1; i != 0xffff; i--)
90- u->ram[dst + (Uint16)(b_addr + i)] = u->ram[src + (Uint16)(a_addr + i)];
91+ uxn.ram[dst + (Uint16)(b_addr + i)] = uxn.ram[src + (Uint16)(a_addr + i)];
92 } else
93- fprintf(stderr, "Unknown Expansion Command 0x%02x\n", u->ram[addr]);
94+ fprintf(stderr, "Unknown Expansion Command 0x%02x\n", uxn.ram[addr]);
95 break;
96 }
97 case 0x4:
+2,
-2
1@@ -16,5 +16,5 @@ void system_inspect(void);
2 int system_error(char *msg, const char *err);
3 int system_boot(Uint8 *ram, char *rom);
4
5-Uint8 system_dei(Uxn *u, Uint8 addr);
6-void system_deo(Uxn *u, Uint8 addr);
7+Uint8 system_dei(Uint8 addr);
8+void system_deo(Uint8 addr);
+19,
-19
1@@ -16,18 +16,18 @@ WITH REGARD TO THIS SOFTWARE.
2 case 0x20|opc: {const int _2=1,_r=0;init body;} break;\
3 case 0x40|opc: {const int _2=0,_r=1;init body;} break;\
4 case 0x60|opc: {const int _2=1,_r=1;init body;} break;\
5- case 0x80|opc: {const int _2=0,_r=0,k=u->wst.ptr;init u->wst.ptr=k;body;} break;\
6- case 0xa0|opc: {const int _2=1,_r=0,k=u->wst.ptr;init u->wst.ptr=k;body;} break;\
7- case 0xc0|opc: {const int _2=0,_r=1,k=u->rst.ptr;init u->rst.ptr=k;body;} break;\
8- case 0xe0|opc: {const int _2=1,_r=1,k=u->rst.ptr;init u->rst.ptr=k;body;} break;\
9+ case 0x80|opc: {const int _2=0,_r=0,k=uxn.wst.ptr;init uxn.wst.ptr=k;body;} break;\
10+ case 0xa0|opc: {const int _2=1,_r=0,k=uxn.wst.ptr;init uxn.wst.ptr=k;body;} break;\
11+ case 0xc0|opc: {const int _2=0,_r=1,k=uxn.rst.ptr;init uxn.rst.ptr=k;body;} break;\
12+ case 0xe0|opc: {const int _2=1,_r=1,k=uxn.rst.ptr;init uxn.rst.ptr=k;body;} break;\
13 }
14
15 /* Microcode */
16
17-#define JMI a = u->ram[pc] << 8 | u->ram[pc + 1], pc += a + 2;
18-#define REM if(_r) u->rst.ptr -= 1 + _2; else u->wst.ptr -= 1 + _2;
19-#define INC(s) u->s.dat[u->s.ptr++]
20-#define DEC(s) u->s.dat[--u->s.ptr]
21+#define JMI a = uxn.ram[pc] << 8 | uxn.ram[pc + 1], pc += a + 2;
22+#define REM if(_r) uxn.rst.ptr -= 1 + _2; else uxn.wst.ptr -= 1 + _2;
23+#define INC(s) uxn.s.dat[uxn.s.ptr++]
24+#define DEC(s) uxn.s.dat[--uxn.s.ptr]
25 #define JMP(i) pc = _2 ? i : pc + (Sint8)i;
26 #define PO1(o) o = _r ? DEC(rst) : DEC(wst);
27 #define PO2(o) o = _r ? DEC(rst) | DEC(rst) << 8 : DEC(wst) | DEC(wst) << 8;
28@@ -37,26 +37,26 @@ WITH REGARD TO THIS SOFTWARE.
29 #define PUx(i) { if(_2) { c = (i); PU1(c >> 8) PU1(c) } else PU1(i) }
30 #define GET(o) { if(_2) PO1(o[1]) PO1(o[0]) }
31 #define PUT(i) { PU1(i[0]) if(_2) PU1(i[1]) }
32-#define DEI(i,o) o[0] = emu_dei(u, i); if(_2) o[1] = emu_dei(u, i + 1); PUT(o)
33-#define DEO(i,j) emu_deo(u, i, j[0]); if(_2) emu_deo(u, i + 1, j[1]);
34-#define PEK(i,o,m) o[0] = u->ram[i]; if(_2) o[1] = u->ram[(i + 1) & m]; PUT(o)
35-#define POK(i,j,m) u->ram[i] = j[0]; if(_2) u->ram[(i + 1) & m] = j[1];
36+#define DEI(i,o) o[0] = emu_dei(i); if(_2) o[1] = emu_dei(i + 1); PUT(o)
37+#define DEO(i,j) emu_deo(i, j[0]); if(_2) emu_deo(i + 1, j[1]);
38+#define PEK(i,o,m) o[0] = uxn.ram[i]; if(_2) o[1] = uxn.ram[(i + 1) & m]; PUT(o)
39+#define POK(i,j,m) uxn.ram[i] = j[0]; if(_2) uxn.ram[(i + 1) & m] = j[1];
40
41 int
42-uxn_eval(Uxn *u, Uint16 pc)
43+uxn_eval(Uint16 pc)
44 {
45 unsigned int a, b, c, x[2], y[2], z[2], step;
46- if(!pc || u->dev[0x0f]) return 0;
47+ if(!pc || uxn.dev[0x0f]) return 0;
48 for(step = STEP_MAX; step; step--) {
49- switch(u->ram[pc++]) {
50+ switch(uxn.ram[pc++]) {
51 /* BRK */ case 0x00: return 1;
52 /* JCI */ case 0x20: if(DEC(wst)) { JMI break; } pc += 2; break;
53 /* JMI */ case 0x40: JMI break;
54 /* JSI */ case 0x60: c = pc + 2; INC(rst) = c >> 8; INC(rst) = c; JMI break;
55- /* LI2 */ case 0xa0: INC(wst) = u->ram[pc++]; /* fall-through */
56- /* LIT */ case 0x80: INC(wst) = u->ram[pc++]; break;
57- /* L2r */ case 0xe0: INC(rst) = u->ram[pc++]; /* fall-through */
58- /* LIr */ case 0xc0: INC(rst) = u->ram[pc++]; break;
59+ /* LI2 */ case 0xa0: INC(wst) = uxn.ram[pc++]; /* fall-through */
60+ /* LIT */ case 0x80: INC(wst) = uxn.ram[pc++]; break;
61+ /* L2r */ case 0xe0: INC(rst) = uxn.ram[pc++]; /* fall-through */
62+ /* LIr */ case 0xc0: INC(rst) = uxn.ram[pc++]; break;
63 /* INC */ OPC(0x01,POx(a),PUx(a + 1))
64 /* POP */ OPC(0x02,REM ,{})
65 /* NIP */ OPC(0x03,GET(x) REM ,PUT(x))
+3,
-3
1@@ -34,8 +34,8 @@ typedef struct Uxn {
2 Stack wst, rst;
3 } Uxn;
4
5-extern Uint8 emu_dei(Uxn *u, Uint8 addr);
6-extern void emu_deo(Uxn *u, Uint8 addr, Uint8 value);
7+extern Uint8 emu_dei(Uint8 addr);
8+extern void emu_deo( Uint8 addr, Uint8 value);
9 extern Uxn uxn;
10
11-int uxn_eval(Uxn *u, Uint16 pc);
12+int uxn_eval(Uint16 pc);
+12,
-12
1@@ -46,29 +46,29 @@ clamp(int val, int min, int max)
2 }
3
4 Uint8
5-emu_dei(Uxn *u, Uint8 addr)
6+emu_dei(Uint8 addr)
7 {
8 switch(addr & 0xf0) {
9- case 0x00: return system_dei(u, addr);
10- case 0x10: return console_dei(u, addr);
11- case 0x20: return screen_dei(u, addr);
12+ case 0x00: return system_dei(addr);
13+ case 0x10: return console_dei(addr);
14+ case 0x20: return screen_dei(addr);
15 case 0xc0: return datetime_dei(addr);
16 }
17- return u->dev[addr];
18+ return uxn.dev[addr];
19 }
20
21 void
22-emu_deo(Uxn *u, Uint8 addr, Uint8 value)
23+emu_deo(Uint8 addr, Uint8 value)
24 {
25- u->dev[addr] = value;
26+ uxn.dev[addr] = value;
27 switch(addr & 0xf0) {
28 case 0x00:
29- system_deo(u, addr);
30+ system_deo(addr);
31 if(addr > 0x7 && addr < 0xe)
32 screen_palette();
33 break;
34- case 0x10: console_deo(u, addr); break;
35- case 0x20: screen_deo(u, addr); break;
36+ case 0x10: console_deo(addr); break;
37+ case 0x20: screen_deo(addr); break;
38 case 0xa0: file_deo(addr); break;
39 case 0xb0: file_deo(addr); break;
40 }
41@@ -238,7 +238,7 @@ emu_run(void)
42 if(poll(&fds[1], 1, 0)) {
43 read(fds[1].fd, expirations, 8);
44 if(uxn.dev[0x20])
45- uxn_eval(&uxn, uxn.dev[0x20] << 8 | uxn.dev[0x21]);
46+ uxn_eval(uxn.dev[0x20] << 8 | uxn.dev[0x21]);
47 if(screen_changed()) {
48 int x = uxn_screen.x1 * uxn_screen.scale, y = uxn_screen.y1 * uxn_screen.scale;
49 int w = uxn_screen.x2 * uxn_screen.scale - x, h = uxn_screen.y2 * uxn_screen.scale - y;
50@@ -269,7 +269,7 @@ main(int argc, char **argv)
51 else if(!system_boot((Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++]))
52 return !fprintf(stdout, "Could not load %s.\n", argv[i - 1]);
53 uxn.dev[0x17] = argc - i;
54- if(uxn_eval(&uxn, PAGE_PROGRAM))
55+ if(uxn_eval(PAGE_PROGRAM))
56 console_listen(i, argc, argv), emu_run();
57 close_console();
58 XDestroyImage(ximage), XDestroyWindow(display, window), XCloseDisplay(display);