commit eab7930
Devine Lu Linvega
·
2025-05-18 00:15:13 +0000 UTC
parent 288a78e
Rename device addr to port
2 files changed,
+17,
-17
+12,
-12
1@@ -35,8 +35,8 @@ static Window window;
2 static Uint8 *ram, dev[0x100];
3 static Stack wst, rst;
4
5-unsigned char emu_dei(Uint8 addr);
6-void emu_deo(Uint8 addr, Uint8 value);
7+Uint8 emu_dei(const Uint8 port);
8+void emu_deo(const Uint8 port, const Uint8 value);
9
10 /* clang-format off */
11
12@@ -909,10 +909,10 @@ static unsigned int rL1, rL2;
13
14 #define CONINBUFSIZE 256
15
16-unsigned char
17-emu_dei(Uint8 addr)
18+Uint8
19+emu_dei(const Uint8 port)
20 {
21- switch(addr) {
22+ switch(port) {
23 /* System */
24 case 0x04: return wst.ptr;
25 case 0x05: return rst.ptr;
26@@ -931,12 +931,12 @@ emu_dei(Uint8 addr)
27 case 0x2c: return rA >> 8;
28 case 0x2d: return rA;
29 }
30- if((addr & 0xf0) == 0xc0) {
31+ if((port & 0xf0) == 0xc0) {
32 time_t seconds = time(NULL);
33 struct tm zt = {0};
34 struct tm *t = localtime(&seconds);
35 if(t == NULL) t = &zt;
36- switch(addr) {
37+ switch(port) {
38 case 0xc0: return (t->tm_year + 1900) >> 8;
39 case 0xc1: return (t->tm_year + 1900);
40 case 0xc2: return t->tm_mon;
41@@ -950,14 +950,14 @@ emu_dei(Uint8 addr)
42 case 0xca: return t->tm_isdst;
43 }
44 }
45- return dev[addr];
46+ return dev[port];
47 }
48
49 void
50-emu_deo(Uint8 addr, Uint8 value)
51+emu_deo(const Uint8 port, const Uint8 value)
52 {
53- dev[addr] = value;
54- switch(addr) {
55+ dev[port] = value;
56+ switch(port) {
57 /* System */
58 case 0x03: system_expansion(PEEK2(dev + 2)); return;
59 case 0x04: wst.ptr = dev[4]; return;
60@@ -1142,7 +1142,7 @@ display_floating(Display *dpy, Window win)
61 Atom wmType = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
62 Atom wmDialog = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
63 XSetWMProtocols(display, window, &wmDelete, 1);
64- XChangeProperty(dpy, win, wmType, 4, 32, PropModeReplace, (unsigned char *)&wmDialog, 1);
65+ XChangeProperty(dpy, win, wmType, 4, 32, PropModeReplace, (Uint8 *)&wmDialog, 1);
66 }
67
68 static unsigned int
+5,
-5
1@@ -26,8 +26,8 @@ typedef struct {
2 static Uint8 *ram, dev[0x100];
3 static Stack wst, rst;
4
5-unsigned char emu_dei(Uint8 port);
6-void emu_deo(Uint8 port, Uint8 value);
7+Uint8 emu_dei(const Uint8 port);
8+void emu_deo(const Uint8 port, const Uint8 value);
9
10 /* clang-format off */
11
12@@ -618,8 +618,8 @@ static unsigned int rL1, rL2;
13 /*
14 @|Core -------------------------------------------------------------- */
15
16-unsigned char
17-emu_dei(Uint8 port)
18+Uint8
19+emu_dei(const Uint8 port)
20 {
21 switch(port) {
22 /* System */
23@@ -653,7 +653,7 @@ emu_dei(Uint8 port)
24 }
25
26 void
27-emu_deo(Uint8 port, Uint8 value)
28+emu_deo(const Uint8 port, const Uint8 value)
29 {
30 dev[port] = value;
31 switch(port) {