| ... | ... |
@@ -15,25 +15,25 @@ WITH REGARD TO THIS SOFTWARE. |
| 15 | 15 |
*/ |
| 16 | 16 |
|
| 17 | 17 |
Uint8 |
| 18 |
-datetime_dei(Uint8 *d, Uint8 port) |
|
| 18 |
+datetime_dei(Uxn *u, Uint8 addr) |
|
| 19 | 19 |
{
|
| 20 | 20 |
time_t seconds = time(NULL); |
| 21 | 21 |
struct tm zt = {0};
|
| 22 | 22 |
struct tm *t = localtime(&seconds); |
| 23 | 23 |
if(t == NULL) |
| 24 | 24 |
t = &zt; |
| 25 |
- switch(port) {
|
|
| 26 |
- case 0x0: return (t->tm_year + 1900) >> 8; |
|
| 27 |
- case 0x1: return (t->tm_year + 1900); |
|
| 28 |
- case 0x2: return t->tm_mon; |
|
| 29 |
- case 0x3: return t->tm_mday; |
|
| 30 |
- case 0x4: return t->tm_hour; |
|
| 31 |
- case 0x5: return t->tm_min; |
|
| 32 |
- case 0x6: return t->tm_sec; |
|
| 33 |
- case 0x7: return t->tm_wday; |
|
| 34 |
- case 0x8: return t->tm_yday >> 8; |
|
| 35 |
- case 0x9: return t->tm_yday; |
|
| 36 |
- case 0xa: return t->tm_isdst; |
|
| 37 |
- default: return d[port]; |
|
| 25 |
+ switch(addr) {
|
|
| 26 |
+ case 0xc0: return (t->tm_year + 1900) >> 8; |
|
| 27 |
+ case 0xc1: return (t->tm_year + 1900); |
|
| 28 |
+ case 0xc2: return t->tm_mon; |
|
| 29 |
+ case 0xc3: return t->tm_mday; |
|
| 30 |
+ case 0xc4: return t->tm_hour; |
|
| 31 |
+ case 0xc5: return t->tm_min; |
|
| 32 |
+ case 0xc6: return t->tm_sec; |
|
| 33 |
+ case 0xc7: return t->tm_wday; |
|
| 34 |
+ case 0xc8: return t->tm_yday >> 8; |
|
| 35 |
+ case 0xc9: return t->tm_yday; |
|
| 36 |
+ case 0xca: return t->tm_isdst; |
|
| 37 |
+ default: return u->dev[addr]; |
|
| 38 | 38 |
} |
| 39 | 39 |
} |
| ... | ... |
@@ -139,14 +139,14 @@ screen_mono(UxnScreen *p, Uint32 *pixels) |
| 139 | 139 |
/* IO */ |
| 140 | 140 |
|
| 141 | 141 |
Uint8 |
| 142 |
-screen_dei(Uint8 *d, Uint8 port) |
|
| 142 |
+screen_dei(Uxn *u, Uint8 addr) |
|
| 143 | 143 |
{
|
| 144 |
- switch(port) {
|
|
| 145 |
- case 0x2: return uxn_screen.width >> 8; |
|
| 146 |
- case 0x3: return uxn_screen.width; |
|
| 147 |
- case 0x4: return uxn_screen.height >> 8; |
|
| 148 |
- case 0x5: return uxn_screen.height; |
|
| 149 |
- default: return d[port]; |
|
| 144 |
+ switch(addr) {
|
|
| 145 |
+ case 0x22: return uxn_screen.width >> 8; |
|
| 146 |
+ case 0x23: return uxn_screen.width; |
|
| 147 |
+ case 0x24: return uxn_screen.height >> 8; |
|
| 148 |
+ case 0x25: return uxn_screen.height; |
|
| 149 |
+ default: return u->dev[addr]; |
|
| 150 | 150 |
} |
| 151 | 151 |
} |
| 152 | 152 |
|
| ... | ... |
@@ -155,14 +155,12 @@ screen_deo(Uint8 *ram, Uint8 *d, Uint8 port) |
| 155 | 155 |
{
|
| 156 | 156 |
switch(port) {
|
| 157 | 157 |
case 0x3: |
| 158 |
- if(!FIXED_SIZE) {
|
|
| 158 |
+ if(!FIXED_SIZE) |
|
| 159 | 159 |
screen_resize(&uxn_screen, clamp(PEEK16(d + 2), 1, 1024), uxn_screen.height); |
| 160 |
- } |
|
| 161 | 160 |
break; |
| 162 | 161 |
case 0x5: |
| 163 |
- if(!FIXED_SIZE) {
|
|
| 162 |
+ if(!FIXED_SIZE) |
|
| 164 | 163 |
screen_resize(&uxn_screen, uxn_screen.width, clamp(PEEK16(d + 4), 1, 1024)); |
| 165 |
- } |
|
| 166 | 164 |
break; |
| 167 | 165 |
case 0xe: {
|
| 168 | 166 |
Uint16 x = PEEK16(d + 0x8), y = PEEK16(d + 0xa); |
| ... | ... |
@@ -31,6 +31,6 @@ void screen_clear(UxnScreen *p, Layer *layer); |
| 31 | 31 |
void screen_redraw(UxnScreen *p, Uint32 *pixels); |
| 32 | 32 |
void screen_mono(UxnScreen *p, Uint32 *pixels); |
| 33 | 33 |
|
| 34 |
-Uint8 screen_dei(Uint8 *d, Uint8 port); |
|
| 34 |
+Uint8 screen_dei(Uxn *u, Uint8 addr); |
|
| 35 | 35 |
void screen_deo(Uint8 *ram, Uint8 *d, Uint8 port); |
| 36 | 36 |
int clamp(int val, int min, int max); |
| ... | ... |
@@ -52,7 +52,7 @@ emu_dei(Uxn *u, Uint8 addr) |
| 52 | 52 |
switch(d) {
|
| 53 | 53 |
case 0xa0: return file_dei(0, &u->dev[d], p); |
| 54 | 54 |
case 0xb0: return file_dei(1, &u->dev[d], p); |
| 55 |
- case 0xc0: return datetime_dei(&u->dev[d], p); |
|
| 55 |
+ case 0xc0: return datetime_dei(u, addr); |
|
| 56 | 56 |
} |
| 57 | 57 |
return u->dev[addr]; |
| 58 | 58 |
} |
| ... | ... |
@@ -109,14 +109,14 @@ emu_dei(Uxn *u, Uint8 addr) |
| 109 | 109 |
{
|
| 110 | 110 |
Uint8 p = addr & 0x0f, d = addr & 0xf0; |
| 111 | 111 |
switch(d) {
|
| 112 |
- case 0x20: return screen_dei(&u->dev[d], p); |
|
| 112 |
+ case 0x20: return screen_dei(u, addr); |
|
| 113 | 113 |
case 0x30: return audio_dei(0, &u->dev[d], p); |
| 114 | 114 |
case 0x40: return audio_dei(1, &u->dev[d], p); |
| 115 | 115 |
case 0x50: return audio_dei(2, &u->dev[d], p); |
| 116 | 116 |
case 0x60: return audio_dei(3, &u->dev[d], p); |
| 117 | 117 |
case 0xa0: return file_dei(0, &u->dev[d], p); |
| 118 | 118 |
case 0xb0: return file_dei(1, &u->dev[d], p); |
| 119 |
- case 0xc0: return datetime_dei(&u->dev[d], p); |
|
| 119 |
+ case 0xc0: return datetime_dei(u, addr); |
|
| 120 | 120 |
} |
| 121 | 121 |
return u->dev[addr]; |
| 122 | 122 |
} |