base:launching_long_tasks_from_irq_handler
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
base:launching_long_tasks_from_irq_handler [2016-03-15 12:33] – bitbreaker | base:launching_long_tasks_from_irq_handler [2016-11-23 10:54] (current) – bitbreaker | ||
---|---|---|---|
Line 76: | Line 76: | ||
sta $d012 | sta $d012 | ||
| | ||
- | ;now allow irq2 happen on top of this task and return to this task when done | + | ;now allow irq2 to happen on top of this task and return to this task when done |
cli | cli | ||
| | ||
Line 110: | Line 110: | ||
rti | rti | ||
</ | </ | ||
+ | |||
+ | A even more convenient variant is to use the stack for register saving: | ||
+ | |||
+ | < | ||
+ | irq1 | ||
+ | pha | ||
+ | txa | ||
+ | pha | ||
+ | tya | ||
+ | pha | ||
+ | dec $d019 | ||
+ | | ||
+ | dec counter | ||
+ | bne + | ||
+ | | ||
+ | lda #$08 | ||
+ | sta counter | ||
+ | cli | ||
+ | jsr long_task | ||
+ | + | ||
+ | pla | ||
+ | tay | ||
+ | pla | ||
+ | tax | ||
+ | pla | ||
+ | rti | ||
+ | </ | ||
+ | |||
+ | Now you can run a long task that can finish somewhen between the next 8 interrupts. |
base/launching_long_tasks_from_irq_handler.txt · Last modified: 2016-11-23 10:54 by bitbreaker