6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Sep 22, 2024 10:20 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Sep 08, 2015 12:37 am 
Offline

Joined: Wed Jan 08, 2014 3:31 pm
Posts: 578
I have a pretty good handle on the direction and data registers of the 6522. But the timers are confusing me. I read the data sheet and it talks a lot about interrupts with the timer, but code samples I've seen simply set a value in the timer and busy wait until the timer pops. In the ISR they don't do anything to service the interrupt or clear the interrupt. But when I try that I'm getting an interrupt and since my ISR doesn't clear it, I get stuck.

There's a discussion in the data sheet about control registers which might disable interrupts, but I did not quite get what they were talking about. Some code samples would be helpful, but the data sheet is lacking them.

Any pointers to code samples? Thanks in advance.


Top
 Profile  
Reply with quote  
PostPosted: Tue Sep 08, 2015 12:49 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Martin_H wrote:
In the ISR they don't do anything to service the interrupt or clear the interrupt.
There are subtle ways an ISR or other code can clear a 6522 interrupt flag, so perhaps it's there but you don't recognize it. Simply reading some of these registers will clear the associated interrupt flag! This came up recently in connection to another topic. The attached table gives a rough idea -- HTH


Attachments:
6522 IFR.gif
6522 IFR.gif [ 31.22 KiB | Viewed 1745 times ]

_________________
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: Tue Sep 08, 2015 1:21 am 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1382
Take a look at the ISR and timer support in my C02 mini BIOS. It uses timer 1 for RTC and timer 2 for an accurate delay. Code is well commented and should be easy to understand. Link is here:

viewtopic.php?f=12&t=3045

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Tue Sep 08, 2015 1:44 am 
Offline

Joined: Wed Jan 08, 2014 3:31 pm
Posts: 578
Thanks, I'll take a look later.


Top
 Profile  
Reply with quote  
PostPosted: Tue Sep 08, 2015 6:18 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8510
Location: Southern California
And make sure you go through the interrupts primer at http://wilsonminesco.com/6502interrupts/ . It also has code associated with the timers, although not all modes.

_________________
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  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 12 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: