Strange NOP results

Building your first 6502-based project? We'll help you get started here.
Post Reply
Cypress-25
Posts: 5
Joined: 28 Jul 2021

Strange NOP results

Post by Cypress-25 »

Hello!

So I'm just starting out with 6502s after a long while, and I'm getting some strange results.
I'm using a modified version of the arduino code Ben Eater used output. (Just changed the pin numbers)

The address jumps around despite a NOP being shown.

The resets also seem to be working weirdly.

Code: Select all

First reset: address reads 3fff


0011111000010111   11101010   3e17  r ea
0101001001111111   11101010   527f  r ea
0000101000010000   11101010   0a10  r ea
0110011001001000   11101010   6648  r ea
0010111000000100   11101010   2e04  r ea
1000010001001100   11101010   844c  r ea
1101100100000010   11101010   d902  r ea
1011000101010010   11101010   b152  r ea
1111010100011010   11101010   f51a  r ea
0001111101010110   11101010   1f56  r ea

Second reset: address reads 9777

0100000010001111   11101010   408f  r ea
1010100111000000   11101010   a9c0  r ea
1110010110001000   11101010   e588  r ea
1000110111100100   11101010   8de4  r ea
1111011110010100   11101010   f794  r ea
0011001111111100   11101010   33fc  r ea
0101101110010010   11101010   5b92  r ea
0001011101001010   11101010   174a  r ea
0110111100000110   11101010   6f06  r ea
0010000101001110   11101010   214e  r ea

Third reset: address reads d685

1000110111101111   11101010   8def  r ea
1101011110000000   11101010   d780  r ea
1011101111101000   11101010   bbe8  r ea
1111101110111000   11101010   fbb8  r ea
1001011101110100   11101010   9774  r ea
1110111100111100   11101010   ef3c  r ea
0010000101000010   11101010   2142  r ea
0100100000001010   11101010   480a  r ea
0000000001000110   11101010   0046  r ea
0011110000001110   11101010   3c0e  r ea
Results from 3 different resets.

I am using an old Rockwell 6502 instead of the Western CMOS version used in his videos.
tmr4
Posts: 147
Joined: 19 Feb 2022

Re: Strange NOP results

Post by tmr4 »

What clock speed are you using? It's likely the 6502 you're using isn't stable at that speed.
leepivonka
Posts: 167
Joined: 15 Apr 2016

Re: Strange NOP results

Post by leepivonka »

If you're using a Rockwell R6502 CPU (older NMOS part with dynamic memory in its logic), it has a maximum clock period of 10usec. Clocking it much slower will probably make it fail.
The W65C02S CPU that Ben uses has no limit how slow it can be clocked.
Check the spec sheet for your particular CPU model. 6502.org has a wide selection of spec sheets you may find helpful.

The Ben Eater 6502_monitor.ino program will probably be much too slow to keep up with a 100KHz (10usec period) or faster CPU clock. I think it is intended for use with much slower clock rates.
Cypress-25
Posts: 5
Joined: 28 Jul 2021

Re: Strange NOP results

Post by Cypress-25 »

tmr4 wrote:
What clock speed are you using? It's likely the 6502 you're using isn't stable at that speed.
Using a 1MHz Crystal oscillator connected to phi in.
Cypress-25
Posts: 5
Joined: 28 Jul 2021

Re: Strange NOP results

Post by Cypress-25 »

leepivonka wrote:
The Ben Eater 6502_monitor.ino program will probably be much too slow to keep up with a 100KHz (10usec period) or faster CPU clock. I think it is intended for use with much slower clock rates.
That’s probably the issue. When connecting some LEDs to pins A15 and A14, they flash as expected.
tmr4
Posts: 147
Joined: 19 Feb 2022

Re: Strange NOP results

Post by tmr4 »

Cypress-25 wrote:
leepivonka wrote:
The Ben Eater 6502_monitor.ino program will probably be much too slow to keep up with a 100KHz (10usec period) or faster CPU clock. I think it is intended for use with much slower clock rates.
That’s probably the issue. When connecting some LEDs to pins A15 and A14, they flash as expected.
Yes, I couldn't get even an optimized Ben Eater monitor to work at 1 MHz. I had to buy a logic analyzer to monitor at that speed.
noneya
Posts: 39
Joined: 12 Feb 2021
Contact:

Re: Strange NOP results

Post by noneya »

Hi Cypress,

As mentioned at 1MHz you will have zero chance to catch the restart cycle ( .... fffc fffd ) .

Ben is using the "breadboard" clock module at that stage, single stepping with a 65c02. Even with a 65c02, the button to single step has to be debounced well, i.e. even a poorly debounced button will cause several clock cycles to occur rapidly enough that the Arduino monitor will miss many clock cycles, and this button bounce rate is far below the 1mhz speed.

If you didn't build the clock module do not worry, just proceed with the build, soon you will be adding the ram/rom, writing code to send messages to the LCD, finishing the videos and begin taking it further, adding an ACIA (6551 for example) so as to connect via serial to your pc, maybe another 6522, sd card, vga, sound...

Good luck, enjoy the journey and have fun.
Shaking out the dirty bits!

https://github.com/DonaldMoran
Post Reply