6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 21, 2024 9:25 pm

All times are UTC




Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Mon May 30, 2022 12:07 am 
Offline

Joined: Sun May 29, 2022 1:10 pm
Posts: 7
Hi folks, newbie here learning 6502 assembly via the path of Ben Eater's 6502 computer project.

My 65c02 is being logic probed using Ben's method of an Arduino Mega 2560. I am setting the reset vector as per part 1 of his video series but no matter what I do, the vector always shows as going to FFFE and FFFF rather than FFFC and FFFD - as if IRQB is low.

I've checked NMI and IRQB - both are pegged high during testing.
Grounds are good. Voltage is 5.09V
The address bits change on all 16 bits. None of the bits are "stuck".

If I let the clock run (slowly of course) and ground the NMI pin, the vector goes to FFFA and FFFB as expected.
Here's the kicker though. If I let the clock run and ground the IRQB pin, nothing changes. It just keeps iterating through memory as it reads the NOP (EA) instruction I have hard wired to the data pins.

It's as if IRQB is internally shorted to ground in the 65c02. I've probed this and there are no shorts to ground between IRQB and VSS.

Here's the output of the serial monitor after reset:
Code:
1110101100010101   11101010   eb15  r ea
1111111111111111   11101010   ffff  r ea
1110101100010101   11101010   eb15  r ea
0000000101110111   11101010   0177  r ea
0000000101110110   11101010   0176  r ea
0000000101110101   11101010   0175  r ea
1111111111111110   11101010   fffe  r ea
1111111111111111   11101010   ffff  r ea
1110101011101010   11101010   eaea  r ea
1110101011101011   11101010   eaeb  r ea
1110101011101011   11101010   eaeb  r ea
1110101011101100   11101010   eaec  r ea


Thoughts? Could it just be a dud 65c02?


Top
 Profile  
Reply with quote  
PostPosted: Mon May 30, 2022 12:31 am 
Offline

Joined: Sun May 29, 2022 1:10 pm
Posts: 7
Ok this is weird. I just un-seated and re-seated the CPU in the breadboard, re-powered it and I got this sequence just now:

Code:
1111111111111110   11101010   fffe  r ea
1111111111111111   11101010   ffff  r ea
1111111111111111   11101010   ffff  r ea
1110101011101111   11101010   eaef  r ea
0000000111111010   11101010   01fa  r ea
0000000111111001   11101010   01f9  r ea
0000000111111000   11101010   01f8  r ea
1111111111111100   11101010   fffc  r ea
1111111111111111   11101010   ffff  r ea
1110101011101010   11101010   eaea  r ea


FFFC followed by FFFF?


Top
 Profile  
Reply with quote  
PostPosted: Mon May 30, 2022 12:39 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Hello, and welcome. :)

I'm not familiar with Ben's videos, but I or someone else here might be able to help anyway. Just be prepared to supply lots of detail about what you're doing. Can you supply some photos of your project, please? These can be quite helpful, and you can simply attach them to your post (no need for a third-party image sharing site).

What brand of 65C02 are you using? If you're running the chip very slowly then Rockwell and other brands may present a problem, but WDC will be OK.

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Mon May 30, 2022 12:45 am 
Offline

Joined: Sun May 29, 2022 1:10 pm
Posts: 7
I appear to have found the issue. If I press down on the IRQB pin really hard, I can make it give a consistent FFFC and FFFD, but otherwise it's either randomly FFFC but nearly always FFFE and FFFF.

I think I have a broken 65c02. Rare? This is a WDC chip.


Top
 Profile  
Reply with quote  
PostPosted: Mon May 30, 2022 1:00 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Could well be a bad connection, but it's far more likely to be due to a low-quality breadboard than a flaky chip.

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Mon May 30, 2022 1:17 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
Welcome.

It sounds like bad connections. As long as you buy new parts from legitimate suppliers (and don't damage the parts yourself with careless static handling), bad parts are almost non-existent. At work, we buy ICs by the tens of thousands, and we get zero bad ones. Really.

When the '02 boots up, it comes up with the interrupt-disable status bit I set, and it will not respond to IRQ\ until you clear that bit in software.

Be sure to go through the 6502 primer at http://wilsonminesco.com/6502primer/ . It was written to address problems and questions that kept coming up on the forum. That was 20+ years ago, and it didn't get published until I got my own site 10 years ago, but I keep updating it regularly.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Mon May 30, 2022 1:47 am 
Offline

Joined: Sun May 29, 2022 1:10 pm
Posts: 7
GARTHWILSON wrote:
Welcome.
When the '02 boots up, it comes up with the interrupt-disable status bit I set, and it will not respond to IRQ\ until you clear that bit in software.


Thanks - I checked that in the tutorials page here. It seems that a correctly functioning 65c02 should never go to FFFE after either a a power-on or reset signal, regardless of the level of the IRQB pin.

It really seems to suggest that maybe the Arduino is mis-reading A1, but I'm monitoring the pin with an oscilloscope and sure enough, when the Arduino says the pin is high, the oscilloscope sees A1 go high.

It's not even as if there is bleed over from the neigbouring pins because the serial monitor shows examples of A0 and A2 at a different level to A1.


Top
 Profile  
Reply with quote  
PostPosted: Mon May 30, 2022 1:55 am 
Offline

Joined: Sun May 29, 2022 1:10 pm
Posts: 7
I think the best test here is to wire up the ROM in the upper 32KB as per Ben's guide and flash it with values in 0xFFFC and 0xFFFD (technically, 0x7FFC and 0x7FFD in the ROM itself). It doesn't really matter what the values are - as long as regardless of what the Arduino says the address is, the returned hex value is what I programmed into those addresses.

I can also play this out by putting different values in FFFE and FFFF so that I can validate if indeed the processor is really borked and reading from FFFE and FFFF after reset.

Ultimately it's not like this is a problem because the goal is to learn the 6502. I'm certainly getting a crash course in that.


Top
 Profile  
Reply with quote  
PostPosted: Mon May 30, 2022 1:59 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Post some photos of your project if you can. In situations like this they can prove helpful.

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Mon May 30, 2022 7:44 am 
Offline

Joined: Sun May 29, 2022 1:10 pm
Posts: 7
Problem solved folks. It was the fact that I had removed the power rail filter capacitors. It caused both the 65c02 and also the Arduino clock pulse detection to wig out. I didn't consider the two issues related, but alas they were symptoms of the same cause.

The system is running now with the ROM and is behaving consistently and as expected.

Geez imaging doing this in the '70s. Then again they probably wouldn't have done something so idiotic as forget to filter the power supply.


Top
 Profile  
Reply with quote  
PostPosted: Mon May 30, 2022 2:27 pm 
Offline

Joined: Fri Mar 18, 2022 6:33 pm
Posts: 491
It's funny; Ben doesn't use many decoupling caps in his videos, but everything always seems to work, and he gets nice clean signals on his oscilloscope. He has a video where he talks about stray capacitance in breadboards and loopy jumper wires, but I don't think he ever has more than 2 - 4 decoupling caps on his power rails. After reading the primer and these forums I've started putting one at each end of the power rails on my breadboards, plus one per IC next to its VCC connection. That has helped a lot.

_________________
"The key is not to let the hardware sense any fear." - Radical Brad


Top
 Profile  
Reply with quote  
PostPosted: Mon May 30, 2022 4:28 pm 
Offline

Joined: Tue Sep 03, 2002 12:58 pm
Posts: 336
Ben uses 74LS chips. They have a fairly high constant current draw, with relatively low peaks when switching. They don't need a lot of decoupling. CMOS is different - it needs very little current while nothing is happening, but suddenly needs a lot when switching. Power distribution becomes a lot more important with CMOS.

The 74LS is also how he gets away with leaving unused inputs floating. TTL inputs will safely float high if you don't connect them. CMOS gets unhappy and can oscillate.

He cuts a lot of corners that I wouldn't, but those details would get in the way of the main point of the videos. And his designs do work.


Top
 Profile  
Reply with quote  
PostPosted: Mon May 30, 2022 4:34 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
Paganini wrote:
It's funny; Ben doesn't use many decoupling caps in his videos, but everything always seems to work, and he gets nice clean signals on his oscilloscope. He has a video where he talks about stray capacitance in breadboards and loopy jumper wires, but I don't think he ever has more than 2 - 4 decoupling caps on his power rails. After reading the primer and these forums I've started putting one at each end of the power rails on my breadboards, plus one per IC next to its VCC connection. That has helped a lot.


This is a good watch if interested...

https://www.youtube.com/watch?v=P8MpZGjwgR0

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Mon May 30, 2022 4:52 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Kaldek wrote:
I had removed the power rail filter capacitors.
Checking this sort of detail is one of the reasons I asked for photos of your project.

John West wrote:
Ben uses 74LS chips. [...] Power distribution becomes a lot more important with CMOS. [...] The 74LS is also how he gets away with leaving unused inputs floating.
Good points, John.

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Mon May 30, 2022 5:46 pm 
Offline

Joined: Sat Feb 19, 2022 10:14 pm
Posts: 147
drogon wrote:
This is a good watch if interested...

https://www.youtube.com/watch?v=P8MpZGjwgR0

His followup video, Bypass Capacitors Visualised, is quite good as well.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 39 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: