- [NEW] Simbols de sistema de la Atari 2600 inclosos
- [FIX] opcodes accesibles - [NEW] El desensamblador ja no mostra parts del mapa de memòria que no son RAM o ROM - [FIX] Ja se mostren gràficament tots els branch - [NEW] memdebuginfo de tots els dispositius mapejats disponible
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
|
||||
namespace m6502
|
||||
{
|
||||
namespace opcodes
|
||||
{
|
||||
enum instruction {
|
||||
iADC, iAND, iASL, iBCC, iBCS, iBEQ, iBIT, iBMI, iBNE, iBPL, iBRK, iBVC, iBVS, iCLC,
|
||||
iCLD, iCLI, iCLV, iCMP, iCPX, iCPY, iDEC, iDEX, iDEY, iEOR, iINC, iINX, iINY, iJMP,
|
||||
@@ -23,7 +25,7 @@ namespace m6502
|
||||
const char *description;
|
||||
};
|
||||
|
||||
const instructionProperties instructions[] = {
|
||||
inline const instructionProperties instructions[] = {
|
||||
{"ADC", fgArithmetic, "Add with Carry", "", "This instruction adds the contents of a memory location to the accumulator together with the carry bit. If overflow occurs the carry bit is set, this enables multiple byte addition to be performed." },
|
||||
{"AND", fgLogical, "Logical AND", "", "A logical AND is performed, bit by bit, on the accumulator contents using the contents of a byte of memory." },
|
||||
{"ASL", fgShift, "Arithmetic Shift Left", "", "This operation shifts all the bits of the accumulator or memory contents one bit left. Bit 0 is set to 0 and bit 7 is placed in the carry flag. The effect of this operation is to multiply the memory contents by 2 (ignoring 2's complement considerations), setting the carry if the result will not fit in 8 bits." },
|
||||
@@ -95,7 +97,7 @@ namespace m6502
|
||||
const char *postText;
|
||||
};
|
||||
|
||||
const addressingModeProperties addressingModes[] = {
|
||||
inline const addressingModeProperties addressingModes[] = {
|
||||
{"Implicit", 1, "", ""},
|
||||
{"Accumulator", 1, "A", ""},
|
||||
{"Immediate", 2, "#", ""},
|
||||
@@ -119,7 +121,7 @@ namespace m6502
|
||||
bool ifBranchTaken;
|
||||
};
|
||||
|
||||
const opcodeProperties opcodeDescriptors[256] = {
|
||||
inline const opcodeProperties opcodeDescriptors[256] = {
|
||||
{iBRK, amImplicit, 7, false, false},
|
||||
{iORA, amIndirectX, 6, false, false},
|
||||
{iILL, amImplicit, 2, false, false},
|
||||
@@ -377,4 +379,6 @@ namespace m6502
|
||||
{iINC, amAbsoluteX, 7, false, false},
|
||||
{iILL, amImplicit, 2, false, false},
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
+24
-4
@@ -5,6 +5,7 @@
|
||||
#include "mem.h"
|
||||
#include "6502m.h"
|
||||
#include "6502dis.h"
|
||||
#include "6502_opcodes.h"
|
||||
#include "display.h"
|
||||
#include "ui.h"
|
||||
#include "ui_window.h"
|
||||
@@ -435,6 +436,8 @@ namespace m6502debugger
|
||||
|
||||
void printDissasemblerLine(const uint16_t address, const int line, const bool heuristics=false)
|
||||
{
|
||||
const bool isMemory = mem::debug::getInfo(address).memType & mdtMemory;
|
||||
|
||||
uint8_t colors[4] = { COLOR_RED, COLOR_CYAN, COLOR_WHITE, COLOR_WHITE};
|
||||
const uint8_t tag = tags[address];
|
||||
if ( !(tag & (MEMTAG_TINST | MEMTAG_TREPEAT)) ) colors[3]=COLOR_GRAY;
|
||||
@@ -448,6 +451,8 @@ namespace m6502debugger
|
||||
if (breakpoints[address]&9) ui::printtxt(0,line,"*", colors[0]);
|
||||
ui::printtxt(1,line,tohex(address,4), colors[1]);
|
||||
|
||||
if (!isMemory) return;
|
||||
|
||||
if ( (tag & MEMTAG_INST) || heuristics ) {
|
||||
const char *sym = m6502dis::getSymbol(address);
|
||||
if (sym[0]!=0) ui::printtxt(7,line, sym, COLOR_YELLOW);
|
||||
@@ -493,20 +498,21 @@ namespace m6502debugger
|
||||
printDissasemblerLine(pc, (num_lines/2)-1, true);
|
||||
|
||||
for (int i=num_lines/2;i<num_lines;++i) {
|
||||
pos += m6502dis::getOpcodeSize(pos);
|
||||
pos += mem::debug::getInfo(pos).memType&mdtMemory ? m6502dis::getOpcodeSize(pos) : 1;
|
||||
line_address[i] = pos;
|
||||
printDissasemblerLine(pos, i, true);
|
||||
}
|
||||
|
||||
pos = pc;
|
||||
for (int i=(num_lines/2)-2;i>=0;--i) {
|
||||
pos = find_previous_opcode(pos);
|
||||
pos = mem::debug::getInfo(pos).memType&mdtMemory ? find_previous_opcode(pos) : 1;
|
||||
line_address[i] = pos;
|
||||
printDissasemblerLine(pos, i, true);
|
||||
}
|
||||
|
||||
for (int i=0;i<num_lines;++i) {
|
||||
if (mem::read(line_address[i])==0xd0) {
|
||||
if (m6502::opcodes::instructions[m6502::opcodes::opcodeDescriptors[mem::read(line_address[i])].instr].group == m6502::opcodes::fgBranch) {
|
||||
// if (mem::read(line_address[i])==0xd0) {
|
||||
int8_t offset = mem::read(line_address[i]+1);
|
||||
uint16_t target_address = line_address[i] + 2 + offset;
|
||||
if (offset<0) {
|
||||
@@ -526,7 +532,21 @@ namespace m6502debugger
|
||||
ui::printvline(17,i,-1,COLOR_RED);
|
||||
}
|
||||
} else {
|
||||
|
||||
int j = i;
|
||||
while (j<num_lines){
|
||||
if (line_address[j] == target_address) {
|
||||
ui::printhline(17,i,18,COLOR_RED);
|
||||
ui::printhline(17,j,18,COLOR_RED);
|
||||
ui::printvline(17,i,j,COLOR_RED);
|
||||
break;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
if (j==num_lines) {
|
||||
ui::printhline(17,i,18,COLOR_RED);
|
||||
//ui::printhline(17,0,18,COLOR_RED);
|
||||
ui::printvline(17,i,num_lines,COLOR_RED);
|
||||
}
|
||||
}
|
||||
//ui::printtxt(6,i,tohex(target_address,4),COLOR_BLACK);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
enum mappedDeviceType {
|
||||
mdtMemory = 1,
|
||||
mdtRead = 2,
|
||||
mdtWrite = 4,
|
||||
mdtROM = 3,
|
||||
mdtRAM = 7,
|
||||
mdtRegister = 8
|
||||
};
|
||||
|
||||
struct memDebugInfo {
|
||||
const char* name;
|
||||
uint8_t memType;
|
||||
|
||||
+5
-1
@@ -127,7 +127,11 @@ namespace pia
|
||||
{
|
||||
const memDebugInfo getInfo(uint16_t address)
|
||||
{
|
||||
|
||||
if (address & 0x200) {
|
||||
return {"PIA", mdtRegister, address};
|
||||
} else {
|
||||
return {"RAM", mdtRAM, address & 0xff};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,4 +37,11 @@ namespace rom
|
||||
data[address & mask] = value;
|
||||
}
|
||||
|
||||
namespace debug
|
||||
{
|
||||
const memDebugInfo getInfo(uint16_t address)
|
||||
{
|
||||
return {"ROM", mdtROM, 0x1000 | (address & mask)};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,4 +461,12 @@ namespace tia
|
||||
return rdy_low;
|
||||
}
|
||||
|
||||
namespace debug
|
||||
{
|
||||
const memDebugInfo getInfo(uint16_t address)
|
||||
{
|
||||
return {"TIA", mdtRegister, address};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+72
-1
@@ -1 +1,72 @@
|
||||
0x283 SWBCNT
|
||||
0x0000 VSYNC
|
||||
0x0001 VBLANK
|
||||
0x0002 WSYNC
|
||||
0x0003 RSYNC
|
||||
0x0004 NUSIZ0
|
||||
0x0005 NUSIZ1
|
||||
0x0006 COLUP0
|
||||
0x0007 COLUP1
|
||||
0x0008 COLUPF
|
||||
0x0009 COLUBK
|
||||
0x000A CTRLPF
|
||||
0x000B REFP0
|
||||
0x000C REFP1
|
||||
0x000D PF0
|
||||
0x000E PF1
|
||||
0x000F PF2
|
||||
0x0010 RESP0
|
||||
0x0011 RESP1
|
||||
0x0012 RESM0
|
||||
0x0013 RESM1
|
||||
0x0014 RESBL
|
||||
0x0015 AUDC0
|
||||
0x0016 AUDC1
|
||||
0x0017 AUDF0
|
||||
0x0018 AUDF1
|
||||
0x0019 AUDV0
|
||||
0x001A AUDV1
|
||||
0x001B GRP0
|
||||
0x001C GRP1
|
||||
0x001D ENAM0
|
||||
0x001E ENAM1
|
||||
0x001F ENABL
|
||||
0x0020 HMP0
|
||||
0x0021 HMP1
|
||||
0x0022 HMM0
|
||||
0x0023 HMM1
|
||||
0x0024 HMBL
|
||||
0x0025 VDELP0
|
||||
0x0026 VDELP1
|
||||
0x0027 VDELBL
|
||||
0x0028 RESMP0
|
||||
0x0029 RESMP1
|
||||
0x002A HMOVE
|
||||
0x002B HMCLR
|
||||
0x002C CXCLR
|
||||
0x0030 CXM0P
|
||||
0x0031 CXM1P
|
||||
0x0032 CXP0FB
|
||||
0x0033 CXP1FB
|
||||
0x0034 CXM0FB
|
||||
0x0035 CXM1FB
|
||||
0x0036 CXBLPF
|
||||
0x0037 CXPPMM
|
||||
0x0038 INPT0
|
||||
0x0039 INPT1
|
||||
0x003A INPT2
|
||||
0x003B INPT3
|
||||
0x003C INPT4
|
||||
0x003D INPT5
|
||||
0x0280 SWCHA
|
||||
0x0281 SWACNT
|
||||
0x0282 SWCHB
|
||||
0x0283 SWBCNT
|
||||
0x0284 INTIM
|
||||
0x0285 TIMINT
|
||||
0x0294 TIM1T
|
||||
0x0295 TIM8T
|
||||
0x0296 TIM64T
|
||||
0x0297 T1024T
|
||||
0xFFFA NMI_VECTOR
|
||||
0xFFFC RESET_VECTOR
|
||||
0xFFFE IRQ_VECTOR
|
||||
|
||||
Reference in New Issue
Block a user