Added fill command, memory address reg now auto-increments, version 0.29

Change-Id: I685da6a14cea3dd343dde28c4316bb06ab924bc9
This commit is contained in:
David Banks 2015-06-18 12:58:37 +01:00
parent 35ad735420
commit 824c40f31e
3 changed files with 52 additions and 17 deletions

View File

@ -113,10 +113,10 @@ char *triggerStrings[NUM_TRIGGERS] = {
}; };
#define VERSION "0.28" #define VERSION "0.29"
#ifdef EMBEDDED_6502 #ifdef EMBEDDED_6502
#define NUM_CMDS 24 #define NUM_CMDS 25
#else #else
#define NUM_CMDS 19 #define NUM_CMDS 19
#endif #endif
@ -175,6 +175,7 @@ char *cmdStrings[NUM_CMDS] = {
"dis", "dis",
"read", "read",
"write", "write",
"fill",
#endif #endif
"reset", "reset",
"step", "step",
@ -373,30 +374,43 @@ int lookupBreakpoint(char *params) {
#ifdef EMBEDDED_6502 #ifdef EMBEDDED_6502
unsigned int readMem(unsigned int addr) { void loadData(unsigned int data) {
int i;
for (i = 0; i <= 15; i++) {
hwCmd(CMD_LOAD_MEM, addr & 1);
addr >>= 1;
}
hwCmd(CMD_RD_MEM, 0);
Delay_us(10);
return hwRead8(OFFSET_DATA);
}
void writeMem(unsigned int addr, unsigned int data) {
int i; int i;
for (i = 0; i <= 7; i++) { for (i = 0; i <= 7; i++) {
hwCmd(CMD_LOAD_MEM, data & 1); hwCmd(CMD_LOAD_MEM, data & 1);
data >>= 1; data >>= 1;
} }
}
void loadAddr(unsigned int addr) {
int i;
for (i = 0; i <= 15; i++) { for (i = 0; i <= 15; i++) {
hwCmd(CMD_LOAD_MEM, addr & 1); hwCmd(CMD_LOAD_MEM, addr & 1);
addr >>= 1; addr >>= 1;
} }
}
unsigned int readByte() {
hwCmd(CMD_RD_MEM, 0);
Delay_us(10);
return hwRead8(OFFSET_DATA);
}
void writeByte() {
hwCmd(CMD_WR_MEM, 0); hwCmd(CMD_WR_MEM, 0);
} }
unsigned int readMem(unsigned int addr) {
loadAddr(addr);
return readByte();
}
void writeMem(unsigned int addr, unsigned int data) {
loadData(data);
loadAddr(addr);
writeByte();
}
unsigned int disMem(unsigned int addr) { unsigned int disMem(unsigned int addr) {
return disassemble(addr, readMem(addr), readMem(addr + 1), readMem(addr + 2)); return disassemble(addr, readMem(addr), readMem(addr + 1), readMem(addr + 2));
} }
@ -492,10 +506,11 @@ void doCmdRegs(char *params) {
void doCmdMem(char *params) { void doCmdMem(char *params) {
int i, j; int i, j;
unsigned int row[16]; unsigned int row[16];
sscanf(params, "%x", &memAddr); sscanf(params, "%x", &memAddr);
loadAddr(memAddr);
for (i = 0; i < 0x100; i+= 16) { for (i = 0; i < 0x100; i+= 16) {
for (j = 0; j < 16; j++) { for (j = 0; j < 16; j++) {
row[j] = readMem(memAddr + i + j); row[j] = readByte();
} }
log0("%04X ", memAddr + i); log0("%04X ", memAddr + i);
for (j = 0; j < 16; j++) { for (j = 0; j < 16; j++) {
@ -539,6 +554,20 @@ void doCmdRead(char *params) {
writeMem(addr, data); writeMem(addr, data);
} }
void doCmdFill(char *params) {
unsigned int i;
unsigned int start;
unsigned int end;
unsigned int data;
sscanf(params, "%x %x %x", &start, &end, &data);
log0("Wr: %04X to %04X = %X\n", start, end, data);
loadData(data);
loadAddr(start);
for (i = start; i < end; i++) {
hwCmd(CMD_WR_MEM, 0);
}
}
#endif #endif
void doCmdTrace(char *params) { void doCmdTrace(char *params) {
@ -809,6 +838,7 @@ void (*cmdFuncs[NUM_CMDS])(char *params) = {
doCmdDis, doCmdDis,
doCmdRead, doCmdRead,
doCmdWrite, doCmdWrite,
doCmdFill,
#endif #endif
doCmdReset, doCmdReset,
doCmdStep, doCmdStep,

View File

@ -25,7 +25,7 @@ char dopname[256][6] =
/*F0*/ "BEQ", "SBC", "SBC", "---", "---", "SBC", "INC", "---", "SED", "SBC", "PLX", "---", "---", "SBC", "INC", "---", /*F0*/ "BEQ", "SBC", "SBC", "---", "---", "SBC", "INC", "---", "SED", "SBC", "PLX", "---", "---", "SBC", "INC", "---",
}; };
int dopaddr[256] = unsigned char dopaddr[256] =
{ {
/*00*/ IMP, INDX, IMP, IMP, ZP, ZP, ZP, IMP, IMP, IMM, IMPA, IMP, ABS, ABS, ABS, IMP, /*00*/ IMP, INDX, IMP, IMP, ZP, ZP, ZP, IMP, IMP, IMM, IMPA, IMP, ABS, ABS, ABS, IMP,
/*10*/ BRA, INDY, IND, IMP, ZP, ZPX, ZPX, IMP, IMP, ABSY, IMPA, IMP, ABS, ABSX, ABSX, IMP, /*10*/ BRA, INDY, IND, IMP, ZP, ZPX, ZPX, IMP, IMP, ABSY, IMPA, IMP, ABS, ABSX, ABSX, IMP,

View File

@ -397,6 +397,11 @@ begin
end if; end if;
end if; end if;
-- Auto increment the memory address reg the cycle after a rd/wr
if (memory_rd = '1' or memory_wr = '1') then
addr_dout_reg(23 downto 8) <= addr_dout_reg(23 downto 8) + 1;
end if;
-- Single Stepping -- Single Stepping
if ((single = '0') or (cmd_edge2 = '0' and cmd_edge1 = '1' and cmd = "1000")) then if ((single = '0') or (cmd_edge2 = '0' and cmd_edge1 = '1' and cmd = "1000")) then