Closed shazz closed 3 years ago
I did a little prototype using https://github.com/afeique/MOS6502.js Easy to integrate, there is only 2 callbacks to add to the disassembler:
// This function should return the byte at the specified memory address.
mem_read(address);
// This function should write the specified byte to the specified address.
mem_write(address, value);
then calling run_instruction()
on the simulator will execute on instruction and give the number of cycles consumed.
But I had some issue to map the address read by the simulator and the disassembler byte buffer (this.buf
).
So finally I only used timing per opcode table.
This could be closed -- @shazz's code is merged. But thinking about this: perhaps disasm should show conditional cycles like in the above screenshot for the bne
instructions (2 if branch not taken, 3 if taken)?
Maybe just add 2/3 is enough
Yeah, that's what I intended.
I'll do this.
done in ebde48104a73421e7b65a83b4795a842938e22d3
it's possible to be slightly more precise with the cycle counts. it's possible to check for page crossing when disassembling branches -- I'm going to fix this too at some point. Not today though.
all done here 478e07bec06e2f2525cd252d6203f1b5bb8d4864
It would be great if in the disassembly, an estimation of the cycles consumed could be added.
A little like in the Stella disassembly:
Some existing js 6502 simulator source code:
I'll try to test them to see how good they are