mirror of
https://github.com/digarok/gsplus.git
synced 2024-06-23 02:29:32 +00:00
Debugger: %pc++, %s++, %s--
This commit is contained in:
parent
5cb4f63993
commit
44acfd5434
|
@ -281,7 +281,7 @@ word32 do_list(word32 address, int *psr_ptr, int lines) {
|
||||||
while (lines--) {
|
while (lines--) {
|
||||||
pc = address;
|
pc = address;
|
||||||
|
|
||||||
opcode = get_memory_c(address++, 0) & 0xff;
|
opcode = get_memory_c(address++, 0);
|
||||||
dtype = disasm_types[opcode];
|
dtype = disasm_types[opcode];
|
||||||
args = dtype >> 8;
|
args = dtype >> 8;
|
||||||
|
|
||||||
|
@ -747,9 +747,47 @@ static int parse_command(const char *cp) {
|
||||||
|
|
||||||
"%pc++" eol {
|
"%pc++" eol {
|
||||||
/* todo */
|
/* todo */
|
||||||
|
unsigned opcode = get_memory_c(engine.kpc, 0);
|
||||||
|
unsigned dtype = disasm_types[opcode];
|
||||||
|
unsigned args = dtype >> 8;
|
||||||
|
word32 tmp;
|
||||||
|
|
||||||
|
switch (args) {
|
||||||
|
case 4:
|
||||||
|
args = engine.psr & 0x20 ? 1 : 2;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
args = engine.psr & 0x10 ? 1 : 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
tmp = engine.kpc + 1 + args;
|
||||||
|
tmp &= 0xffff;
|
||||||
|
engine.kpc = (engine.kpc & 0xff0000) | tmp;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"%s++" eol {
|
||||||
|
unsigned tmp = engine.stack + 1;
|
||||||
|
if (engine.psr & 0x0100) {
|
||||||
|
tmp &= 0xff;
|
||||||
|
tmp |= 0x0100;
|
||||||
|
} else {
|
||||||
|
tmp &= 0xffff;
|
||||||
|
}
|
||||||
|
engine.stack = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
"%s--" eol {
|
||||||
|
unsigned tmp = engine.stack + 1;
|
||||||
|
if (engine.psr & 0x0100) {
|
||||||
|
tmp &= 0xff;
|
||||||
|
tmp |= 0x0100;
|
||||||
|
} else {
|
||||||
|
tmp &= 0xffff;
|
||||||
|
}
|
||||||
|
engine.stack = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
"%a=" { return do_assign(YYCURSOR, REG_A); }
|
"%a=" { return do_assign(YYCURSOR, REG_A); }
|
||||||
"%x=" { return do_assign(YYCURSOR, REG_X); }
|
"%x=" { return do_assign(YYCURSOR, REG_X); }
|
||||||
"%y=" { return do_assign(YYCURSOR, REG_Y); }
|
"%y=" { return do_assign(YYCURSOR, REG_Y); }
|
||||||
|
@ -984,6 +1022,7 @@ int debug_shell(int code) {
|
||||||
|
|
||||||
g_prev_stack_address = engine.stack;
|
g_prev_stack_address = engine.stack;
|
||||||
g_prev_stack_bank = engine.kpc & 0xff0000;
|
g_prev_stack_bank = engine.kpc & 0xff0000;
|
||||||
|
g_prev_address = engine.kpc;
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
cp = x_readline("> ");
|
cp = x_readline("> ");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user