Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user tubesockor ! (Registered 2024-05-12) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > C64 interrupts
2010-03-25 10:31
breeze
Account closed

Registered: Mar 2009
Posts: 20
C64 interrupts

Hi pplz :)

Please, explain to me the principle of work interrupts in the C64:

1. The Z80 cpu has a HALT command, which allows to wait for the interruption at the main loop of code.Is there such a command to CPU 6510 or is not possible?

2. In the processor Z80 when it comes to interrupt code execution in the code of main loop is stops and execute the code of interrupt. After execute the code of interrupt, continue to execute code of the main loop. Processor 6510 operates on the same principle? Or code of main loop will continue run and the code of interupt will start parallel ?
2010-03-25 10:49
chatGPZ

Registered: Dec 2001
Posts: 11136
1. no such instruction on the 6502
2. thats just the basic principle of how interrupts work - on every cpu :)
2010-03-25 11:19
Oswald

Registered: Apr 2002
Posts: 5025
1.

SEI (SEt I(nterrupt) flag) instruction does disable interrupts
CLI (CLear I(nterrupt) flag) instruction does enable interrupts


the 6510 can receive two types of interrupts. SEI/CLI ony affects 'Normal' interrupts (VICII generated & CIA generated), While NMI (Non Maskable Interrupt) interrupts may not be blocked (unless you use some trickery), these are generated by the 'other' CIA. the CIA chips amongst other stuff have timers which can be used to generate interrupts.

2.

works same as on z80. 6510 saves return address and CPU status register on stack, everything else you have to take care of.
2010-03-25 11:27
chatGPZ

Registered: Dec 2001
Posts: 11136
oswald: HALT is nothing like SEI/CLI :) it makes the cpu stop executing opcodes until an external interrupt occurs, which is usually used for putting the cpu into some sort of powersaving state in this time. (gameboy code uses this extensivly for example, to save battery power)
2010-03-25 11:40
breeze
Account closed

Registered: Mar 2009
Posts: 20
Big thanks for the clarification!
2010-03-25 11:43
Skate

Registered: Jul 2003
Posts: 491
so, if we use HALT without setting any interrupts, CPU will completely stop working. I mean it's not like "jmp *", no opcodes would be fetched and executed. Did I get it right?
2010-03-25 12:00
breeze
Account closed

Registered: Mar 2009
Posts: 20
Quote: so, if we use HALT without setting any interrupts, CPU will completely stop working. I mean it's not like "jmp *", no opcodes would be fetched and executed. Did I get it right?

if interrupts is disabled (DI) then you right, the Z80 will HALT. But by default way interrupts is enabled.
2010-03-25 12:10
Frantic

Registered: Mar 2003
Posts: 1628
When I coded the mega-stretcher in "Demontronic" (by Megaboys) for the Gameboy Color, I used HALT to get stable raster timing, since there is no jitter in the onset of the interrupt after putting the CPU in halted mode (unlike "jmp *"). On c64 this is of course a bit more complicated, since the jitter must be neutralized/compensated for in various ways if one wants perfectly stable timing of the onset of the interrupt code.
2010-03-25 20:10
Krill

Registered: Apr 2002
Posts: 2852
We have a couple of op-codes which would perform a complete HALT without any wake-on-interrupt option, most commonly called JAM or HLT. :)
2010-03-25 20:20
Mr. SID

Registered: Jan 2003
Posts: 421
Yeah, would be cool if you could still service an IRQ after a JAM and wake it up again...
2010-03-25 21:05
assiduous
Account closed

Registered: Jun 2007
Posts: 343
Quoting Mr. SID
Yeah, would be cool if you could still service an IRQ after a JAM and wake it up again...

run FLI DXPP in Vice or Vice"SC" and close the jam popup window after pressing space. poof,magic ensues:)

dont hold your breath though- its one of Vice bugs and it doesnt work in Hoxs&Ccs or on the real box.
 
... 3 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Majikeyric
Sentinel/Excess/TREX
trident
Exocet
Trasher/Fairlight
JEZ
MightyAxle
psych
w4rp8
q0w/ATL
Twilight/Excess/Arcade
tubesockor
Dave/SIDNIFY
encore
Asphodel
Isildur/Samar
Youth
Apollyon/ALD
Harry/Alivers
Guests online: 144
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Layers  (9.6)
4 Cubic Dream  (9.6)
5 Copper Booze  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Rainbow Connection  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Booze Design  (9.3)
3 Nostalgia  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Original Suppliers
1 Black Beard  (9.7)
2 Derbyshire Ram  (9.5)
3 hedning  (9.2)
4 Baracuda  (9.1)
5 Jazzcat  (8.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.078 sec.