Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Force a queded IRQ
2017-05-27 08:12
oziphantom

Registered: Oct 2014
Posts: 478
Force a queded IRQ

Is there a way to pogrammatically ( without the CIAs ) to en-queue an IRQ from within an NMI?

BRK will interrupt an NMI.But is there some other trick, maybe some stack fiddling?
2017-05-27 08:33
TWW

Registered: Jul 2009
Posts: 541
I perhaps do not understand what you are trying to achieve but the Interrupt flag let's you control IRQs so whenever the flag is set, no IRQ's will trigger and when clear, they will.

This should allow you to control when they are triggering from a NMI or in general.

If you need timed (delayed with a certain amount of cycles) you could use the CIA and allow the IRQ to trigger just to set a flag and return which you in then could monitor in the NMI.

Can you elaborate a bit on what you are trying to do?
2017-05-27 09:15
oziphantom

Registered: Oct 2014
Posts: 478
A software interrupt.
However it can if needed rely on the fact it is in a NMI.

I doubt its possible, but you never know there might be some fancy trick to get it ;)
2017-05-27 10:09
TWW

Registered: Jul 2009
Posts: 541
You can trigger a SW interrupt whenever you want by using BRK or SEI/CLI in combination with a timer or raster IRQ which always is set to trigger.

I think I still don't get what you are trying to do ;-)
2017-05-27 10:33
oziphantom

Registered: Oct 2014
Posts: 478
BRK won't force an interrupt, as it will invoke the break handler right then and there, even if you are in an NMI.

So the ideal path is

Enter NMI
Do stuff
Optionally Queue IRQ
Do other stuff
Exit NMI
IRQ triggers when it can, if queued.
2017-05-27 10:46
Oswald

Registered: Apr 2002
Posts: 5007
how about setting up a raster irq (outside of available raster range), and using d019 to artifically fire a raster irq ? not sure if d019 can be used in this way tho.

similar thing could be achieved via timer interrupts too.
2017-05-27 11:46
Flavioweb

Registered: Nov 2011
Posts: 442
If you do a CLI as first instruction of your irq code, when another irq happens it will be triggered as well...
If it's what you mean...
2017-05-27 13:22
Mixer

Registered: Apr 2008
Posts: 418
If you wish to exit NMI directly to irq handler, you have to push the irq handler address to stack so that RTI fetches it correctly.

The irq handler then runs, but there is no flagged interrupt going on, so this execution can be interrupted, unless masked.

If you want some certain interrupt to take place, then set the conditions for that interrupt(VIC/CIA) etc.
2017-05-27 14:04
chatGPZ

Registered: Dec 2001
Posts: 11088
Quote:
BRK won't force an interrupt

in fact that is _exactly_ what a BRK does.
2017-05-27 17:04
White Flame

Registered: Sep 2002
Posts: 136
It's faster to just tail-call right into the IRQ, than it is to exit the NMI and then fake entering the IRQ handler via stack munging.

Neither the stack nor the interrupted program see any difference whether or not it was interrupted via NMI or IRQ, or if it were interrupted twice (NMI falling into IRQ after RTI) instead of once. If the prologues of both interrupt handlers match (which normally would be pushing regs to stack, instead of STA'ing them), you can do a "real" tail call:

nmi:
  prologue
  process
  test
  JMP irq_noprologue
  epilogue

irq:
  prologue
irq_noprologue:
  process
  epilogue


If the prologue/epilogue don't match, then you should do a simple test & compare after restoring saved registers. Since the processor status flags are restored as part of RTI, you don't have to worry about them, so a BCS or a BIT+BNE can perform the test right before the RTI instruction of the NMI handler, depending on how you saved the result of the decision to branch to IRQ.
2017-05-28 06:29
oziphantom

Registered: Oct 2014
Posts: 478
Quoting Groepaz
Quote:
BRK won't force an interrupt

in fact that is _exactly_ what a BRK does.


Fair I was loose with my terminology.
BRK won't force an IRQ.
It will force a jump to the FFFE/FFFF vector, but not under the rules of an IRQ.
 
... 21 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 | 3 | 4 - 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
Dr. Doom/RAD
hedning/G★P
csabanw
Laurent
Mr SQL
CA$H/TRiAD
Airwolf/F4CG
Guests online: 311
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 No Bounds  (9.6)
6 Comaland 100%  (9.6)
7 Uncensored  (9.6)
8 The Ghost  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 Party Elk 2  (9.7)
2 Cubic Dream  (9.6)
3 Copper Booze  (9.5)
4 Rainbow Connection  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Onscreen 5k  (9.5)
7 Dawnfall V1.1  (9.5)
8 Quadrants  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (9.5)
Top Groups
1 Booze Design  (9.3)
2 Nostalgia  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Swappers
1 Derbyshire Ram  (10)
2 Jerry  (9.8)
3 Violator  (9.8)
4 Acidchild  (9.7)
5 Starlight  (9.6)

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