Inverting disassembly line for m6502.PC

This commit is contained in:
tudnai 2022-10-28 11:30:25 -07:00
parent 4b74ab638c
commit b70fb8c85d
3 changed files with 29 additions and 3 deletions

View File

@ -155,6 +155,17 @@ N V - B D I Z C
}
func invertLine(line : String) -> String {
var converted = ""
for chr in line {
converted.append(ViewController.charConvTbl[Int(chr.asciiValue!)])
}
return converted
}
func DisplayDisassembly() {
let m6502_saved = m6502
var disass = ""
@ -162,8 +173,17 @@ N V - B D I Z C
// m6502.PC = 0xFF3A
for _ in 1...35 {
let current_line = m6502.PC == m6502_saved.PC
m6502_Disass_1_Instr()
disass += String(cString: disassemblyLine()!) + "\n"
var line = String(cString: disassemblyLine( current_line )!)
if current_line {
line = invertLine(line: line)
}
disass += line + "\n"
}
DispatchQueue.main.async {

View File

@ -159,7 +159,7 @@ void printDisassembly( FILE * f ) {
#endif // DISASSEMBLER
const char * disassemblyLine(void) {
const char * disassemblyLine(_Bool highlight) {
static char line[256];
snprintf( line, sizeof(line), "%s: %-11s%-4s%s",
@ -169,6 +169,12 @@ const char * disassemblyLine(void) {
disassembly.oper
);
if (highlight) {
for (int i = 0; i < sizeof(line); i++) {
line[i] &= 0x3F;
}
}
return line;
}

View File

@ -80,7 +80,7 @@ extern void printDisassembly( FILE * f );
#endif // DISASSEMBLER
extern const char * disassemblyLine(void);
extern const char * disassemblyLine(_Bool higlight);
#endif /* disassembler_h */