beholder wrote:
if I use the opcode LDA($A5) $00,
Better write it differently. LDA($A5) is the syntax for
indirect, that is, for reading the pair of bytes at address 00A5-00A6 to get the address where you want to read the final data. After assembly, for what you want, a list file might have the line:
Code:
123 8000 A5 00 LDA $00
showing the line number in the source code (for which I just put "123" as an example), then the starting address of that line (for which I put "8000" as a hex example), then the hex values laid down there by that line.
Quote:
which has 2 bytes of length and 3 cycles... does it mean that I need to tick the 6502 3 cycles?
1 for the opcode LDA, 1 for the address $00 and an extra last one? Like, using a NOP to have the 3rd cycle?
You never have to add a NOP for these. 6502 instructions will take anywhere from 2 to 7 cycles, but its own internal sequencer takes care of it. LDA 00 will take three cycles by itself. The first one will read the op code. The second one will read the operand. In the third one, the contents of address 00 will be read. After those three, it will read the next op code. Even if you put a NOP there, it won't read it until the three cycles of LDA 00 are done. NOP will just be a waste.
Quote:
So far it looks like the 6502 is resetting at the end of my code instead of falling into an infinite loop.
Here's what I got:
LDA($A9) #$03
STA($85) $00
LDA($A5) $00
JMP($4C) $00 $80 (Jump is at $8000)
the 2nd LDA is what is causing the 6502 t reset.
If I remove it, the code works and it will fall into the infinite loop.
There's nothing wrong with your code here, assuming it really does start at address $8000 and is available in ROM.
Quote:
Have 6502 A15 and +v into a NAND gate. Have that output into a second NAND gate + 6502 Phase2 out. Have that output into the SRAM cs(ce) pin.
So RAM is 0000-7FFF (but you can only read 0000-3FFF, according to your later line about A14); but your jump to $8000 above is out of the RAM area. Is you little program in ROM then, instead of RAM?
Quote:
Hmm ... is it possible that your Arduino code is buggy?
Likely candidate.