Store instance device in Uxn itself
This commit is contained in:
parent
0d055306a8
commit
99c492d385
|
@ -48,7 +48,7 @@ uxn_eval(Uxn *u, Uint16 pc)
|
|||
case 0x00: case 0x20:
|
||||
switch(ins) {
|
||||
case 0x00: /* BRK */ return 1;
|
||||
case 0x20: /* JCI */ t=T; SHIFT(-1) if(!t) { pc += 2; break; }
|
||||
case 0x20: /* JCI */ t=T; SHIFT(-1) if(!t) { pc += 2; break; } /* fall-through */
|
||||
case 0x40: /* JMI */ rr = ram + pc; pc += 2 + PEEK2(rr); break;
|
||||
case 0x60: /* JSI */ SHIFT( 2) rr = ram + pc; pc += 2; T2_(pc); pc += PEEK2(rr); break;
|
||||
case 0x80: /* LIT */ case 0xc0: SHIFT( 1) T = ram[pc++]; break;
|
||||
|
|
|
@ -29,7 +29,7 @@ typedef struct {
|
|||
} Stack;
|
||||
|
||||
typedef struct Uxn {
|
||||
Uint8 *ram, *dev;
|
||||
Uint8 *ram, dev[0x100];
|
||||
Stack wst, rst;
|
||||
} Uxn;
|
||||
|
||||
|
|
|
@ -64,9 +64,7 @@ emu_end(Uxn *u)
|
|||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
Uint8 dev[0x100] = {0};
|
||||
Uxn u;
|
||||
u.dev = (Uint8 *)&dev;
|
||||
Uxn u = {0};
|
||||
int i = 1;
|
||||
if(i == argc)
|
||||
return system_error("usage", "uxncli [-v] file.rom [args..]");
|
||||
|
|
16
src/uxnemu.c
16
src/uxnemu.c
|
@ -486,11 +486,9 @@ emu_end(Uxn *u)
|
|||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
Uint8 dev[0x100] = {0};
|
||||
Uxn u = {0};
|
||||
Uxn u_audio = {0};
|
||||
u.dev = (Uint8 *)&dev;
|
||||
u_audio.dev = (Uint8 *)&dev;
|
||||
Uint8 *ram;
|
||||
char *rom;
|
||||
Uxn u = {0}, u_audio = {0};
|
||||
int i = 1;
|
||||
if(i == argc)
|
||||
return system_error("usage", "uxnemu [-v] | uxnemu [-f | -2x | -3x | --] file.rom [args...]");
|
||||
|
@ -508,11 +506,9 @@ main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
/* Start system. */
|
||||
Uint8 *ram = (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8));
|
||||
char *rom = argv[i++];
|
||||
if(!system_init(&u, ram, rom))
|
||||
return system_error("Init", "Failed to initialize uxn.");
|
||||
if(!system_init(&u_audio, ram, rom))
|
||||
ram = (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8));
|
||||
rom = argv[i++];
|
||||
if(!system_init(&u, ram, rom) || !system_init(&u_audio, ram, rom))
|
||||
return system_error("Init", "Failed to initialize uxn.");
|
||||
if(!emu_init(&u_audio))
|
||||
return system_error("Init", "Failed to initialize varvara.");
|
||||
|
|
Loading…
Reference in New Issue