| ... | ... |
@@ -17,8 +17,6 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 17 | 17 |
WITH REGARD TO THIS SOFTWARE. |
| 18 | 18 |
*/ |
| 19 | 19 |
|
| 20 |
-#define SUPPORT 0x1c03 /* devices mask */ |
|
| 21 |
- |
|
| 22 | 20 |
static int |
| 23 | 21 |
emu_error(char *msg, const char *err) |
| 24 | 22 |
{
|
| ... | ... |
@@ -37,11 +35,15 @@ console_input(Uxn *u, char c) |
| 37 | 35 |
static void |
| 38 | 36 |
console_deo(Uint8 *d, Uint8 port) |
| 39 | 37 |
{
|
| 40 |
- FILE *fd = port == 0x8 ? stdout : port == 0x9 ? stderr |
|
| 41 |
- : 0; |
|
| 42 |
- if(fd) {
|
|
| 43 |
- fputc(d[port], fd); |
|
| 44 |
- fflush(fd); |
|
| 38 |
+ switch(port) {
|
|
| 39 |
+ case 0x8: |
|
| 40 |
+ fputc(d[port], stdout); |
|
| 41 |
+ fflush(stdout); |
|
| 42 |
+ return; |
|
| 43 |
+ case 0x9: |
|
| 44 |
+ fputc(d[port], stderr); |
|
| 45 |
+ fflush(stderr); |
|
| 46 |
+ return; |
|
| 45 | 47 |
} |
| 46 | 48 |
} |
| 47 | 49 |
|
| ... | ... |
@@ -61,7 +63,6 @@ static void |
| 61 | 63 |
emu_deo(Uxn *u, Uint8 addr, Uint8 v) |
| 62 | 64 |
{
|
| 63 | 65 |
Uint8 p = addr & 0x0f, d = addr & 0xf0; |
| 64 |
- Uint16 mask = 0x1 << (d >> 4); |
|
| 65 | 66 |
u->dev[addr] = v; |
| 66 | 67 |
switch(d) {
|
| 67 | 68 |
case 0x00: system_deo(u, &u->dev[d], p); break; |
| ... | ... |
@@ -69,8 +70,6 @@ emu_deo(Uxn *u, Uint8 addr, Uint8 v) |
| 69 | 70 |
case 0xa0: file_deo(0, u->ram, &u->dev[d], p); break; |
| 70 | 71 |
case 0xb0: file_deo(1, u->ram, &u->dev[d], p); break; |
| 71 | 72 |
} |
| 72 |
- if(p == 0x01 && !(SUPPORT & mask)) |
|
| 73 |
- fprintf(stderr, "Warning: Incompatible emulation, device: %02x.\n", d); |
|
| 74 | 73 |
} |
| 75 | 74 |
|
| 76 | 75 |
int |
| ... | ... |
@@ -70,14 +70,19 @@ console_input(Uxn *u, char c) |
| 70 | 70 |
return uxn_eval(u, PEEK16(d)); |
| 71 | 71 |
} |
| 72 | 72 |
|
| 73 |
+ |
|
| 73 | 74 |
static void |
| 74 | 75 |
console_deo(Uint8 *d, Uint8 port) |
| 75 | 76 |
{
|
| 76 |
- FILE *fd = port == 0x8 ? stdout : port == 0x9 ? stderr |
|
| 77 |
- : 0; |
|
| 78 |
- if(fd) {
|
|
| 79 |
- fputc(d[port], fd); |
|
| 80 |
- fflush(fd); |
|
| 77 |
+ switch(port) {
|
|
| 78 |
+ case 0x8: |
|
| 79 |
+ fputc(d[port], stdout); |
|
| 80 |
+ fflush(stdout); |
|
| 81 |
+ return; |
|
| 82 |
+ case 0x9: |
|
| 83 |
+ fputc(d[port], stderr); |
|
| 84 |
+ fflush(stderr); |
|
| 85 |
+ return; |
|
| 81 | 86 |
} |
| 82 | 87 |
} |
| 83 | 88 |
|