|
hmm... as it stands, my memory emulation is integrated completly with my CPU emulation - i dont have any read_mem or write_mem functions - each individual opcode has the ability to read or write at will...
which created my dilemna in the first place - i didnt want to code by hand checks for registers for each potential opcode, but rather write a top-level function that could handle registers as special cases ... the opcodes would still do the actual reading/writing, but my check_registers() function would set flags indicating what registers were being written or read to.
see, the way my CPU emulation works is that i call a function Step() that executes one opcode - it reads the opcode from the program counter, then switches based on the opcode - creating a 256 case switch statement. each case is emulated individually. right now im trying to streamline things by writing a common group of functions for addressing modes and stuff...
|