For an (indirect,x) operation, can the read word pass a page boundary? Because I've read this:
So, what does the cpu read when executing:6502_cpu.txt wrote: Write instructions (STA, SAX)
# address R/W description
--- ----------- --- ------------------------------------------
1 PC R fetch opcode, increment PC
2 PC R fetch pointer address, increment PC
3 pointer R read from the address, add X to it
4 pointer+X R fetch effective address low
5 pointer+X+1 R fetch effective address high
6 address W write to effective address
Note: The effective address is always fetched from zero page,
i.e. the zero page boundary crossing is not handled.
Code: Select all
lda ($FF,x) ;x=0
.....dangit, I went and ate some food and forgot the rest of my questions.
Well, here's one. How's my basic emulation theory look, I got some ideas from http://www.slack.net/~ant/nes-emu/6502.html , but my actual code in progress is quite a bit different.
my emulation cycle wrote: My 6502 emulation function takes in the number of cycles to run(although, it can go over since I don't do cycle-by-cycle emulation).
I grab the opcode.
Adjust the "cycles to run" value with the current instructions cycle count, taken from a table.
Grab the addressing mode of the instruction from a table, and resolve the final address needed for the instruction, also adjusting for page boundary cycle hits on the necessary instructions.
Run the instruction.
Check to see if we've ran through enough cycles. If not, go back to grabbing an opcode.
How do I handle NMI's and IRQ's? Where do they fit into my emulation cycle?
....if I remember my other questions, I'll come back and add them....