... | ... |
@@ -41,7 +41,7 @@ static const char *errors[] = {"underflow", "overflow", "division by zero"}; |
41 | 41 |
int |
42 | 42 |
haltuxn(Uxn *u, Uint8 error, char *name, int id) |
43 | 43 |
{ |
44 |
- printf("Halted: %s %s#%04x, at 0x%04x\n", name, errors[error - 1], id, u->ram.ptr); |
|
44 |
+ fprintf(stderr,"Halted: %s %s#%04x, at 0x%04x\n", name, errors[error - 1], id, u->ram.ptr); |
|
45 | 45 |
u->ram.ptr = 0; |
46 | 46 |
return 0; |
47 | 47 |
} |
... | ... |
@@ -4052,11 +4052,11 @@ loaduxn(Uxn *u, char *filepath) |
4052 | 4052 |
{ |
4053 | 4053 |
FILE *f; |
4054 | 4054 |
if(!(f = fopen(filepath, "rb"))) { |
4055 |
- printf("Halted: Missing input rom.\n"); |
|
4055 |
+ fprintf(stderr, "Halted: Missing input rom.\n"); |
|
4056 | 4056 |
return 0; |
4057 | 4057 |
} |
4058 | 4058 |
fread(u->ram.dat + PAGE_PROGRAM, sizeof(u->ram.dat) - PAGE_PROGRAM, 1, f); |
4059 |
- printf("Uxn loaded[%s].\n", filepath); |
|
4059 |
+ fprintf(stderr, "Uxn loaded[%s].\n", filepath); |
|
4060 | 4060 |
return 1; |
4061 | 4061 |
} |
4062 | 4062 |
|
... | ... |
@@ -4068,6 +4068,6 @@ portuxn(Uxn *u, Uint8 id, char *name, void (*talkfn)(Device *d, Uint8 b0, Uint8 |
4068 | 4068 |
d->u = u; |
4069 | 4069 |
d->mem = u->ram.dat; |
4070 | 4070 |
d->talk = talkfn; |
4071 |
- printf("Device added #%02x: %s, at 0x%04x \n", id, name, d->addr); |
|
4071 |
+ fprintf(stderr, "Device added #%02x: %s, at 0x%04x \n", id, name, d->addr); |
|
4072 | 4072 |
return d; |
4073 | 4073 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
#include <SDL.h> |
2 | 2 |
#include <stdio.h> |
3 |
+#include <unistd.h> |
|
3 | 4 |
#include <time.h> |
4 | 5 |
#include "uxn.h" |
5 | 6 |
#include "devices/ppu.h" |
... | ... |
@@ -231,10 +232,10 @@ console_talk(Device *d, Uint8 b0, Uint8 w) |
231 | 232 |
{ |
232 | 233 |
if(!w) return; |
233 | 234 |
switch(b0) { |
234 |
- case 0x8: printf("%c", d->dat[0x8]); break; |
|
235 |
- case 0x9: printf("0x%02x", d->dat[0x9]); break; |
|
236 |
- case 0xb: printf("0x%04x", mempeek16(d->dat, 0xa)); break; |
|
237 |
- case 0xd: printf("%s", &d->mem[mempeek16(d->dat, 0xc)]); break; |
|
235 |
+ case 0x8: write(1, &d->dat[0x8], 1); break; |
|
236 |
+ case 0x9: fprintf(stdout, "0x%02x", d->dat[0x9]); break; |
|
237 |
+ case 0xb: fprintf(stdout, "0x%04x", mempeek16(d->dat, 0xa)); break; |
|
238 |
+ case 0xd: fprintf(stdout, "%s", &d->mem[mempeek16(d->dat, 0xc)]); break; |
|
238 | 239 |
} |
239 | 240 |
fflush(stdout); |
240 | 241 |
} |