CPU Updates
I am about half-way done adding the logic needed to support cycles properly. What I have done is added another 0x100 sized array called opCycles, and updated my OPH macro to have a 3rd param that sets this array accordingly. I have noticed that the +1 cycle on page boundaries crossing is only for specific operand types, and is the same accross all ops (great news for me!). So I only need to store the base cycle count. I have also added a function called getCyclesForNextOp() which will pre-read the next instruction and operands, and return.. well.. the number of cycles needed to run it. Then, in my logic that runs the CPU, where I determine the number of cycles that need to be ran, I loop until the cyclesToRun is less than getcyclesForNextOp(). I then store the left over cycles in a variable called.. leftoverCpuCycles. This value gets added back in to the cyclesToRun on the next call for processor execution. Whew...
0 comments:
Post a Comment