Let the console_input do the cast
This commit is contained in:
parent
9b9aae555e
commit
b3fcbe9874
|
@ -82,12 +82,11 @@ clean_after_child(void)
|
|||
}
|
||||
|
||||
int
|
||||
console_input(char c, int type)
|
||||
console_input(Uint8 c, int type)
|
||||
{
|
||||
Uint8 *d = &uxn.dev[0x10];
|
||||
d[0x2] = c;
|
||||
d[0x7] = type;
|
||||
return uxn_eval(PEEK2(d));
|
||||
uxn.dev[0x12] = c;
|
||||
uxn.dev[0x17] = type;
|
||||
return uxn_eval(PEEK2(&uxn.dev[0x10]));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -14,7 +14,7 @@ WITH REGARD TO THIS SOFTWARE.
|
|||
#define CONSOLE_EOA 0x3
|
||||
#define CONSOLE_END 0x4
|
||||
|
||||
int console_input(char c, int type);
|
||||
int console_input(Uint8 c, int type);
|
||||
void console_listen(int i, int argc, char **argv);
|
||||
Uint8 console_dei(Uint8 addr);
|
||||
void console_deo(Uint8 port);
|
||||
|
|
|
@ -172,7 +172,7 @@ emu_event(void)
|
|||
if(e->button == 4)
|
||||
mouse_scroll(0, 1);
|
||||
else if(e->button == 5)
|
||||
mouse_scroll( 0, -1);
|
||||
mouse_scroll(0, -1);
|
||||
else if(e->button == 6)
|
||||
mouse_scroll(1, 0);
|
||||
else if(e->button == 7)
|
||||
|
|
36
src/uxncli.c
36
src/uxncli.c
|
@ -34,9 +34,9 @@ emu_dei(Uint8 addr)
|
|||
void
|
||||
emu_deo(Uint8 addr, Uint8 value)
|
||||
{
|
||||
Uint8 p = addr & 0x0f, d = addr & 0xf0;
|
||||
Uint8 p = addr & 0x0f;
|
||||
uxn.dev[addr] = value;
|
||||
switch(d) {
|
||||
switch(addr & 0xf0) {
|
||||
case 0x00: system_deo(p); break;
|
||||
case 0x10: console_deo(p); break;
|
||||
case 0xa0: file_deo(0, p); break;
|
||||
|
@ -44,26 +44,6 @@ emu_deo(Uint8 addr, Uint8 value)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
emu_run(void)
|
||||
{
|
||||
while(!uxn.dev[0x0f]) {
|
||||
int c = fgetc(stdin);
|
||||
if(c == EOF) {
|
||||
console_input(0x00, CONSOLE_END);
|
||||
break;
|
||||
}
|
||||
console_input((Uint8)c, CONSOLE_STD);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
emu_end(void)
|
||||
{
|
||||
free(uxn.ram);
|
||||
return uxn.dev[0x0f] & 0x7f;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
|
@ -79,7 +59,15 @@ main(int argc, char **argv)
|
|||
uxn.dev[0x17] = argc - i;
|
||||
if(uxn_eval(PAGE_PROGRAM) && PEEK2(uxn.dev + 0x10)) {
|
||||
console_listen(i, argc, argv);
|
||||
emu_run();
|
||||
while(!uxn.dev[0x0f]) {
|
||||
int c = fgetc(stdin);
|
||||
if(c == EOF) {
|
||||
console_input(0x00, CONSOLE_END);
|
||||
break;
|
||||
}
|
||||
console_input(c, CONSOLE_STD);
|
||||
}
|
||||
}
|
||||
return emu_end();
|
||||
free(uxn.ram);
|
||||
return uxn.dev[0x0f] & 0x7f;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue