I'm currently planning a computer build, having been inspired by the wonderful videos that Ben Eater has produced.
I have a very basic setup right now. It's simply a 6502 on a breadboard, with the address lines hooked to 16 LEDs and a Rasp Pi Pico. The data bus is also hooked to the Pico, which I've coded to provide the clock signal, as well as to monitor the address lines and provide the `NOP` instruction that Ben initially hard wired with 8 resister (11101010). I can run this as slow as 0.385Hz which I'm pleased with.
Clearly, that's not a practical speed, but the point is, that I'm learning and I need to be able to control what I'm seeing. I've not tried to single step this yet, as I've no machine code to run, but the CPU is doing something, which brings me to my question: what is it doing?
I can see that the code that I'm presenting to the data bus, is in fact echoed to the address bus, twice, from T-State 10: once the low order byte, and again in the high order address byte. This is the first 20 clock pulses, as recorded by my monitor app, running on my Pico:
Code: Select all
MPY: soft reboot
Freq: 0
Running...
T-State: 1 ........................................
ADD BUS: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | 0xFFFF
R: Writing to DATA BUS...
1 1 1 0 1 0 1 0 | H:EA
T-State: 2 ........................................
ADD BUS: 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 | 0x00FF
R: Writing to DATA BUS...
1 1 1 0 1 0 1 0 | H:EA
T-State: 3 ........................................
ADD BUS: 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 | 0x00FF
W: Reading from DATA BUS...
0 0 0 0 0 0 0 0 | 0x00
T-State: 4 ........................................
ADD BUS: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 | 0x0001
R: Writing to DATA BUS...
1 1 1 0 1 0 1 0 | H:EA
T-State: 5 ........................................
ADD BUS: 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 | 0x0100
W: Reading from DATA BUS...
0 0 0 0 0 0 0 0 | 0x00
T-State: 6 ........................................
ADD BUS: 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 | 0x0100
W: Reading from DATA BUS...
0 0 0 0 0 0 1 0 | 0x02
T-State: 7 ........................................
ADD BUS: 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 | 0x0100
W: Reading from DATA BUS...
0 0 1 1 0 1 1 0 | 0x36
T-State: 8 ........................................
ADD BUS: 0 0 0 0 0 0 0 1 1 1 1 1 1 0 1 0 | 0x01FA
R: Writing to DATA BUS...
1 1 1 0 1 0 1 0 | H:EA
T-State: 9 ........................................
ADD BUS: 0 0 0 0 0 0 0 1 1 1 1 1 1 0 1 0 | 0x01FA
R: Writing to DATA BUS...
1 1 1 0 1 0 1 0 | H:EA
T-State: 10 ........................................
ADD BUS: 1 1 1 0 1 0 1 0 1 1 1 0 1 0 1 0 | 0xEAEA
R: Writing to DATA BUS...
1 1 1 0 1 0 1 0 | H:EA
T-State: 11 ........................................
ADD BUS: 1 1 1 0 1 0 1 0 1 1 1 0 1 0 1 1 | 0xEAEB
R: Writing to DATA BUS...
1 1 1 0 1 0 1 0 | H:EA
T-State: 12 ........................................
ADD BUS: 1 1 1 0 1 0 1 0 1 1 1 0 1 0 1 1 | 0xEAEB
R: Writing to DATA BUS...
1 1 1 0 1 0 1 0 | H:EA
T-State: 13 ........................................
ADD BUS: 1 1 1 0 1 0 1 0 1 1 1 0 1 1 0 0 | 0xEAEC
R: Writing to DATA BUS...
1 1 1 0 1 0 1 0 | H:EA
T-State: 14 ........................................
ADD BUS: 1 1 1 0 1 0 1 0 1 1 1 0 1 1 0 0 | 0xEAEC
R: Writing to DATA BUS...
1 1 1 0 1 0 1 0 | H:EA
T-State: 15 ........................................
ADD BUS: 1 1 1 0 1 0 1 0 1 1 1 0 1 1 0 1 | 0xEAED
R: Writing to DATA BUS...
1 1 1 0 1 0 1 0 | H:EA
T-State: 16 ........................................
ADD BUS: 1 1 1 0 1 0 1 0 1 1 1 0 1 1 0 1 | 0xEAED
R: Writing to DATA BUS...
1 1 1 0 1 0 1 0 | H:EA
T-State: 17 ........................................
ADD BUS: 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 0 | 0xEAEE
R: Writing to DATA BUS...
1 1 1 0 1 0 1 0 | H:EA
T-State: 18 ........................................
ADD BUS: 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 0 | 0xEAEE
R: Writing to DATA BUS...
1 1 1 0 1 0 1 0 | H:EA
T-State: 19 ........................................
ADD BUS: 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 1 | 0xEAEF
R: Writing to DATA BUS...
1 1 1 0 1 0 1 0 | H:EA
T-State: 20 ........................................
ADD BUS: 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 1 | 0xEAEF
R: Writing to DATA BUS...
1 1 1 0 1 0 1 0 | H:EAThis bit progression, simply continues and does something rather interesting after around 6K clock pulses, which I'm sure that anyone with any 6502 experience, will know about and fully understand.
As this is clearly not simply random noise, the code that is running this sequence, has to have come from the CPU and as such, I assume it's documented? My feeling is that it's running some kind of a 'memory' test routine, or maybe it's trying to find a 'boot loader'?
Finding out what is going on here, I feel is the next step I need to take and as such, I'd appreciate any information that would show me what's happening.
There's a tonne of information about the CPU and how to code it, but finding this specific info, is proving more of a challenge than was the coding of my monitor app!
I'm looking forward to this new area of electronics and related computer build, as I plan on recreating what the homebrew guys did (back in the day) and build my very own 6502 computer.
With thanks, in advance.
Rob.