Improved cli stack debugger
This commit is contained in:
parent
81a3dbee5e
commit
8e976310d3
|
@ -96,16 +96,16 @@ screen_debugger(Uxn *u)
|
|||
int i;
|
||||
for(i = 0; i < 0x08; i++) {
|
||||
Uint8 pos = u->wst.ptr - 4 + i;
|
||||
Uint8 color = i > 4 ? 0x01 : !pos ? 0xc :
|
||||
i == 4 ? 0x8 :
|
||||
0x2;
|
||||
Uint8 color = i > 4 ? 0x01 : !pos ? 0xc
|
||||
: i == 4 ? 0x8
|
||||
: 0x2;
|
||||
draw_byte(u->wst.dat[pos], i * 0x18 + 0x8, uxn_screen.height - 0x18, color);
|
||||
}
|
||||
for(i = 0; i < 0x08; i++) {
|
||||
Uint8 pos = u->rst.ptr - 4 + i;
|
||||
Uint8 color = i > 4 ? 0x01 : !pos ? 0xc :
|
||||
i == 4 ? 0x8 :
|
||||
0x2;
|
||||
Uint8 color = i > 4 ? 0x01 : !pos ? 0xc
|
||||
: i == 4 ? 0x8
|
||||
: 0x2;
|
||||
draw_byte(u->rst.dat[pos], i * 0x18 + 0x8, uxn_screen.height - 0x10, color);
|
||||
}
|
||||
screen_blit(uxn_screen.fg, arrow, 0, 0x68, uxn_screen.height - 0x20, 3, 0, 0, 0);
|
||||
|
|
|
@ -16,8 +16,7 @@ WITH REGARD TO THIS SOFTWARE.
|
|||
*/
|
||||
|
||||
char *boot_rom;
|
||||
Uint8 dei_masks[0x100], deo_masks[0x100];
|
||||
Uint16 dev_vers[0x10], dei_mask[0x10], deo_mask[0x10];
|
||||
Uint16 dev_vers[0x10];
|
||||
|
||||
static int
|
||||
system_load(Uxn *u, char *filename)
|
||||
|
@ -37,11 +36,13 @@ static void
|
|||
system_print(Stack *s, char *name)
|
||||
{
|
||||
Uint8 i;
|
||||
fprintf(stderr, "<%s>", name);
|
||||
for(i = 0; i < s->ptr; i++)
|
||||
fprintf(stderr, " %02x", s->dat[i]);
|
||||
if(!i)
|
||||
fprintf(stderr, " empty");
|
||||
fprintf(stderr, "%s ", name);
|
||||
for(i = 0; i < 9; i++) {
|
||||
Uint8 pos = s->ptr - 4 + i;
|
||||
fprintf(stderr, !pos ? "[%02x]" : i == 4 ? "<%02x>"
|
||||
: " %02x ",
|
||||
s->dat[pos]);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
|
@ -60,28 +61,10 @@ system_inspect(Uxn *u)
|
|||
system_print(&u->rst, "rst");
|
||||
}
|
||||
|
||||
void
|
||||
system_connect(Uint8 device, Uint8 ver, Uint16 dei, Uint16 deo)
|
||||
{
|
||||
int i, d = (device << 0x4);
|
||||
for(i = 0; i < 0x10; i++) {
|
||||
dei_masks[d + i] = (dei >> i) & 0x1;
|
||||
deo_masks[d + i] = (deo >> i) & 0x1;
|
||||
}
|
||||
dev_vers[device] = ver;
|
||||
dei_mask[device] = dei;
|
||||
deo_mask[device] = deo;
|
||||
}
|
||||
|
||||
int
|
||||
system_version(char *name, char *date)
|
||||
{
|
||||
int i;
|
||||
printf("%s, %s.\n", name, date);
|
||||
printf("Device Version Dei Deo\n");
|
||||
for(i = 0; i < 0x10; i++)
|
||||
if(dev_vers[i])
|
||||
printf("%6x %7d %04x %04x\n", i, dev_vers[i], dei_mask[i], deo_mask[i]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ WITH REGARD TO THIS SOFTWARE.
|
|||
|
||||
extern char *boot_rom;
|
||||
|
||||
void system_connect(Uint8 device, Uint8 ver, Uint16 dei, Uint16 deo);
|
||||
void system_reboot(Uxn *u, char *rom, int soft);
|
||||
void system_inspect(Uxn *u);
|
||||
int system_version(char *emulator, char *date);
|
||||
|
|
|
@ -37,8 +37,6 @@ typedef struct Uxn {
|
|||
|
||||
extern Uint8 emu_dei(Uxn *u, Uint8 addr);
|
||||
extern void emu_deo(Uxn *u, Uint8 addr, Uint8 value);
|
||||
extern Uint8 dei_masks[0x100], deo_masks[0x100];
|
||||
extern Uint16 dev_vers[0x10], dei_mask[0x10], deo_mask[0x10];
|
||||
|
||||
/* built-ins */
|
||||
|
||||
|
|
|
@ -68,15 +68,9 @@ main(int argc, char **argv)
|
|||
int i = 1;
|
||||
if(i == argc)
|
||||
return system_error("usage", "uxncli [-v] file.rom [args..]");
|
||||
/* Connect Varvara */
|
||||
system_connect(0x0, SYSTEM_VERSION, SYSTEM_DEIMASK, SYSTEM_DEOMASK);
|
||||
system_connect(0x1, CONSOLE_VERSION, CONSOLE_DEIMASK, CONSOLE_DEOMASK);
|
||||
system_connect(0xa, FILE_VERSION, FILE_DEIMASK, FILE_DEOMASK);
|
||||
system_connect(0xb, FILE_VERSION, FILE_DEIMASK, FILE_DEOMASK);
|
||||
system_connect(0xc, DATETIME_VERSION, DATETIME_DEIMASK, DATETIME_DEOMASK);
|
||||
/* Read flags */
|
||||
if(argv[i][0] == '-' && argv[i][1] == 'v')
|
||||
return system_version("Uxncli - Console Varvara Emulator", "30 Oct 2023");
|
||||
return system_version("Uxncli - Console Varvara Emulator", "31 Oct 2023");
|
||||
if(!system_init(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++]))
|
||||
return system_error("Init", "Failed to initialize uxn.");
|
||||
/* Game Loop */
|
||||
|
|
15
src/uxnemu.c
15
src/uxnemu.c
|
@ -546,23 +546,10 @@ main(int argc, char **argv)
|
|||
int i = 1;
|
||||
if(i == argc)
|
||||
return system_error("usage", "uxnemu [-v] | uxnemu [-f | -2x | -3x | --] file.rom [args...]");
|
||||
/* Connect Varvara */
|
||||
system_connect(0x0, SYSTEM_VERSION, SYSTEM_DEIMASK, SYSTEM_DEOMASK);
|
||||
system_connect(0x1, CONSOLE_VERSION, CONSOLE_DEIMASK, CONSOLE_DEOMASK);
|
||||
system_connect(0x2, SCREEN_VERSION, SCREEN_DEIMASK, SCREEN_DEOMASK);
|
||||
system_connect(0x3, AUDIO_VERSION, AUDIO_DEIMASK, AUDIO_DEOMASK);
|
||||
system_connect(0x4, AUDIO_VERSION, AUDIO_DEIMASK, AUDIO_DEOMASK);
|
||||
system_connect(0x5, AUDIO_VERSION, AUDIO_DEIMASK, AUDIO_DEOMASK);
|
||||
system_connect(0x6, AUDIO_VERSION, AUDIO_DEIMASK, AUDIO_DEOMASK);
|
||||
system_connect(0x8, CONTROL_VERSION, CONTROL_DEIMASK, CONTROL_DEOMASK);
|
||||
system_connect(0x9, MOUSE_VERSION, MOUSE_DEIMASK, MOUSE_DEOMASK);
|
||||
system_connect(0xa, FILE_VERSION, FILE_DEIMASK, FILE_DEOMASK);
|
||||
system_connect(0xb, FILE_VERSION, FILE_DEIMASK, FILE_DEOMASK);
|
||||
system_connect(0xc, DATETIME_VERSION, DATETIME_DEIMASK, DATETIME_DEOMASK);
|
||||
/* Read flag. Right now, there can be only one. */
|
||||
if(argv[i][0] == '-') {
|
||||
if(argv[i][1] == 'v')
|
||||
return system_version("Uxnemu - Graphical Varvara Emulator", "30 Oct 2023");
|
||||
return system_version("Uxnemu - Graphical Varvara Emulator", "31 Oct 2023");
|
||||
if(argv[i][1] == '-')
|
||||
i++;
|
||||
if(strcmp(argv[i], "-2x") == 0 || strcmp(argv[i], "-3x") == 0)
|
||||
|
|
Loading…
Reference in New Issue