@@ 17,8 17,6 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE.
*/
-#define SUPPORT 0x1c03 /* devices mask */
-
static int
emu_error(char *msg, const char *err)
{
@@ 37,11 35,15 @@ console_input(Uxn *u, char c)
static void
console_deo(Uint8 *d, Uint8 port)
{
- FILE *fd = port == 0x8 ? stdout : port == 0x9 ? stderr
- : 0;
- if(fd) {
- fputc(d[port], fd);
- fflush(fd);
+ switch(port) {
+ case 0x8:
+ fputc(d[port], stdout);
+ fflush(stdout);
+ return;
+ case 0x9:
+ fputc(d[port], stderr);
+ fflush(stderr);
+ return;
}
}
@@ 61,7 63,6 @@ static void
emu_deo(Uxn *u, Uint8 addr, Uint8 v)
{
Uint8 p = addr & 0x0f, d = addr & 0xf0;
- Uint16 mask = 0x1 << (d >> 4);
u->dev[addr] = v;
switch(d) {
case 0x00: system_deo(u, &u->dev[d], p); break;
@@ 69,8 70,6 @@ emu_deo(Uxn *u, Uint8 addr, Uint8 v)
case 0xa0: file_deo(0, u->ram, &u->dev[d], p); break;
case 0xb0: file_deo(1, u->ram, &u->dev[d], p); break;
}
- if(p == 0x01 && !(SUPPORT & mask))
- fprintf(stderr, "Warning: Incompatible emulation, device: %02x.\n", d);
}
int
@@ 70,14 70,19 @@ console_input(Uxn *u, char c)
return uxn_eval(u, PEEK16(d));
}
+
static void
console_deo(Uint8 *d, Uint8 port)
{
- FILE *fd = port == 0x8 ? stdout : port == 0x9 ? stderr
- : 0;
- if(fd) {
- fputc(d[port], fd);
- fflush(fd);
+ switch(port) {
+ case 0x8:
+ fputc(d[port], stdout);
+ fflush(stdout);
+ return;
+ case 0x9:
+ fputc(d[port], stderr);
+ fflush(stderr);
+ return;
}
}