add memory access highlighting to emulator
This commit is contained in:
@@ -36,8 +36,8 @@
|
||||
#define storeq(x) writememory(cpu->q, x);
|
||||
#define storeqinc(x) writememory(cpu->q++, x);
|
||||
#define storeqp1(x) writememory((cpu->q+1)%65536, x);
|
||||
#define pushretaddr1 writememory(cpu->s++, hibyte(cpu->i));
|
||||
#define pushretaddr2 writememory(cpu->s++, lobyte(cpu->i));
|
||||
#define pushretaddr1 writememory(cpu->s++, hibyte((cpu->i-1)%65536));
|
||||
#define pushretaddr2 writememory(cpu->s++, lobyte((cpu->i-1)%65536));
|
||||
#define lni cpu->instr = readmemory(cpu->i++); cpu->cycle = 0;
|
||||
#define ldi cpu->instr = readmemory(cpu->i); cpu->cycle = 0;
|
||||
#define addf(x,y) { x=(x+y); cpu->cf=x>=256; x&=0xFF; setzf(x); }
|
||||
@@ -83,7 +83,7 @@ struct CPU {
|
||||
int instr;
|
||||
int cycle;
|
||||
int instrpre;
|
||||
int tick;
|
||||
int frame;
|
||||
};
|
||||
struct Event {
|
||||
int id;
|
||||
@@ -109,7 +109,7 @@ void postEvent(struct Memory* const mem, int id, int addr) {
|
||||
}
|
||||
int _readmemory(const struct CPU* const cpu, struct Memory* const mem, const int addr) {
|
||||
int addr2 = addr%65536;
|
||||
mem->reads[addr2] = cpu->tick;
|
||||
mem->reads[addr2] = cpu->frame;
|
||||
if(mem->onread[addr2]) {
|
||||
postEvent(mem, mem->onread[addr2], addr2);
|
||||
}
|
||||
@@ -118,7 +118,7 @@ int _readmemory(const struct CPU* const cpu, struct Memory* const mem, const int
|
||||
int _writememory(const struct CPU* const cpu, struct Memory* const mem, const int addr, const int data) {
|
||||
int addr2 = addr%65536;
|
||||
if(mem->canwrite[addr2]) {
|
||||
mem->writes[addr2] = cpu->tick;
|
||||
mem->writes[addr2] = cpu->frame;
|
||||
mem->data[addr2] = data%256;
|
||||
}
|
||||
if(mem->onwrite[addr2]) {
|
||||
|
||||
Reference in New Issue
Block a user