- [FIX] el cursor del debugger sempre anava una instrucció per darrere de PC
- [NEW] El desensamblador sí que pot determinar opcodes cap enrere en el 6502 - [FIX] Fer wrap correcte dels uint16_t per a evitar desbordaments - [FIX] La pila ací va al reves, pintar com toca en el debugger - [FIX] arreglats (supostament) opcodes: PHP, JSR, PLP, RTI, JMP i RTS
This commit is contained in:
+15
-13
@@ -309,7 +309,7 @@ namespace m6502debugger
|
||||
if ( !(tag & MEMTAG_IGNORE) ) tag |= MEMTAG_INST;
|
||||
tag |= (!(tag&MEMTAG_TOUCHED) ? MEMTAG_TREPEAT : MEMTAG_TINST);
|
||||
|
||||
setcursor(m6502::getPC());
|
||||
setcursor(address);
|
||||
history::store();
|
||||
}
|
||||
|
||||
@@ -418,12 +418,14 @@ namespace m6502debugger
|
||||
|
||||
uint16_t find_previous_opcode(uint16_t pc)
|
||||
{
|
||||
pc--;
|
||||
if ( !(tags[pc] & (MEMTAG_CODE | MEMTAG_INST) ) ) return pc;
|
||||
|
||||
while ( !(tags[pc] & MEMTAG_INST) ) pc--;
|
||||
|
||||
return pc;
|
||||
if (m6502dis::getOpcodeSize(uint16_t(pc-3))==3) return uint16_t(pc-3);
|
||||
if (m6502dis::getOpcodeSize(uint16_t(pc-2))==2) return uint16_t(pc-2);
|
||||
return uint16_t(pc-1);
|
||||
//if ( !(tags[pc] & (MEMTAG_CODE | MEMTAG_INST) ) ) return pc;
|
||||
//
|
||||
//while ( !(tags[pc] & MEMTAG_INST) ) pc--;
|
||||
//
|
||||
//return pc;
|
||||
}
|
||||
|
||||
void printDissasemblerLine(const uint16_t address, const int line, const bool heuristics=false)
|
||||
@@ -447,7 +449,7 @@ namespace m6502debugger
|
||||
|
||||
const int opcodesize = m6502dis::getOpcodeSize(address);
|
||||
for (int i=0; i<opcodesize; ++i) {
|
||||
const uint8_t tag = tags[address+i];
|
||||
const uint8_t tag = tags[uint16_t(address+i)];
|
||||
const uint32_t color = !(tag & MEMTAG_KNOWN) ? COLOR_GRAY : (tag & MEMTAG_DATA) ? ( (tag & (MEMTAG_CODE|MEMTAG_INST)) ? COLOR_MAGENTA : COLOR_BLUE ) : COLOR_GREEN;
|
||||
ui::printrect(19+i*3,line,2,1,color);
|
||||
}
|
||||
@@ -495,7 +497,7 @@ namespace m6502debugger
|
||||
for (int i=(num_lines/2)-2;i>=0;--i) {
|
||||
pos = find_previous_opcode(pos);
|
||||
line_address[i] = pos;
|
||||
printDissasemblerLine(pos, i);
|
||||
printDissasemblerLine(pos, i, true);
|
||||
}
|
||||
|
||||
// REGISTERS
|
||||
@@ -540,17 +542,17 @@ namespace m6502debugger
|
||||
ui::printrect(midx+2,8, 8,1, COLOR_DARK);
|
||||
ui::printtxt(midx+3,8, "STACK:", COLOR_WHITE);
|
||||
ui::setoffset(midx+1, 9);
|
||||
uint16_t sp = 0x0100 | m6502::getS();//-(((sym_y-12)>>1)<<1);
|
||||
uint16_t sp = m6502::getS()+8;//-(((sym_y-12)>>1)<<1);
|
||||
for (int i=0; i<10; ++i) {
|
||||
uint8_t c1=COLOR_CYAN, c2=COLOR_GRAY;
|
||||
if ((sp & 0xff) == m6502::getS()) {
|
||||
if (sp == m6502::getS()) {
|
||||
ui::printrect(0,i,9,1,COLOR_BLUE);
|
||||
c1 = c2 = COLOR_YELLOW;
|
||||
}
|
||||
ui::printtxt(0,i, tohex(0x0100 | sp, 4), c1);
|
||||
uint16_t value = mem::read(0x0100 | sp) + (mem::read(0x0100 | (sp-1))<<8);
|
||||
uint16_t value = mem::read(0x0100 | sp-1) + (mem::read(0x0100 | (sp))<<8);
|
||||
ui::printtxt(5,i, tohex(value, 4), c2);
|
||||
sp+=2;
|
||||
sp-=2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user