| Post Your Message | |
| |
| Previous Messages | Posted By
Sirhadisen on 2024-05-30 09:57:32
| Re: Need help with raster interrupt
Thank you @Verona,
I also figured that I overloaded my IRQ-extension with too many tasks, causing a distorted music rythm. In order to stabelize the music rythm, I want to migrate tasks out of the IRQ, while the music player shall stay inside the IRQ. However, since all my tasks are located under the ROM >$8000, I am not quite sure how to make them interruptable. When returning from the IRQ, the correct bank-configurations must have been restored. The thread on "Cartridge and raster interrupts" was useful, but still left me wondering:
1) Can I still use parts of the system IRQ-handler (those after $ce38 for clock, sound, and scnkey), if sta $ff3f has disabled the ROM in my main? The question is whether the code at $fcbe ("pulse") eventually restores whatever bank-configuration was active before entering the IRQ. 2) What does it mean that the KERNAL jump table ends with sta $ff3e? Does that have anything to do with the IRQ at all?
Maybe not related, but curious: 3) Why does the IRQ-handler save-and-restore the module and enable ROM only for the call of scnkey at $ce51 (which is only reached, if the last interrupt occured at rasterline 204)?
Unfortunately, the "current bank configuration" at $fb does not seem to include the RAM/ROM status, which leads me to believe that whenever the machine returns from a system IRQ, ROM is switched on? In that case the only solution would be to ignore the system IRQ code (at $ce0e - $ce5d) altogether and write my own version of it that does a conditional sta $ff3e before the rti?
If one of you guys could throw me a bone here, it would be much appreciated
|
|
Posted By
Verona on 2024-02-25 07:39:20
| Re: Need help with raster interrupt
I use it this way: (But I not use ROM at all, so you must modify it to your needs)
irq_start_point: php pha txa pha tya pha
lda $FF09 and #$02 bne raster_irq jmp notraszter
raster_irq: sta $FF09 lda $FF1C and #1 beq not_hi_bit jmp hi_bit_on
not_hi_bit: lda $FF0A and #255 ora #2 sta $FF0A
rrirq_start:
... Here comes what I do when raster IRQ happens. An example:
lda $FF1D rrirq_1: cmp #22//22 bcc first_line_jobs rrirq_2: cmp #54 bcc second line jobs
...
jmp title_hi_bit_on
first_line_jobs:
...
second_line_jobs:
....
hi_bit_on:
lda $FF0A and #255 ora #2 sta $FF0A
notraster:
pla tay pla tax pla plp rti
|
|
Posted By
Sirhadisen on 2024-02-19 18:45:18
| Re: Need help with raster interrupt
Great, thanks for the references, I will have a look at those. They were not in my collection yet and seem to have information about interrupts to provide a good context for the ultimate map
|
|
Posted By
gerliczer on 2024-02-19 03:07:53
| Re: Need help with raster interrupt
@Sirhadisen: Unfortunately I do not speak Hungarian and there seems to be a lack of detailed documentation for the TED.
What about German books? Here are listed a number of them in the Publications section. Like Alles Über Den Plus/4 or Das Große Plus/4 Buch. Those look to be useful. Or one of the many others.
|
|
Posted By
Sirhadisen on 2024-02-19 03:02:46
| Re: Need help with raster interrupt
@Luca Oops, sorry.. hmm, let's say I'm just a chemist in the banking sector (true story).
@gerliczer What had me puzzled with the register: I check if a bit equals 1, which indicates that that was the cause of the interrupt, and then, to acknowledge the interrupt and make it possible for the next one to occur, I have to "clear" it by writing 1 into it (and not 0), which promots the cpu to set it to zero .. I suppose it is called hardware IRQ because there is no code involved that compares $FF1D to $FF0B and sets bit 1 of $FF09 to 1 once that happens? But then isn't that also the case for the timer-based "user-interrupts"? Or is it because I can only "mask" the raster-irq while I can completely disable the user-irq by stopping the timer. But that's rather philosophical now.
|
|
Posted By
gerliczer on 2024-02-19 01:06:14
| Re: Need help with raster interrupt
@Sirhadisen: Yes, i was mistaken in 1). IDK why, but my mind always comes up with this answer and it is always wrong.
|
|
Posted By
Lavina on 2024-02-18 17:49:57
| Re: Need help with raster interrupt
Yeah that's your excuse I'm just an economist.
|
|
Posted By
Luca on 2024-02-18 17:07:36
| Re: Need help with raster interrupt
@Sirhadisen heeey you've stolen my motto! I'm just a chemist!
|
|
Posted By
Sirhadisen on 2024-02-18 15:19:33
| Re: Need help with raster interrupt
Thank you gerliczer!
I had seen parts of the map, but did not realize the useful details on the sheet "TED & Music". As you suggested, to solve my problems with the slightly irregular music rythm, I might have to take control over SCNKEY, UTDIM, music propagation myself (and avoid that $FF0B is reset to #$A1 among other things). I mainly decided to jump back to $CE0E due to a lack of experience.
I had issues with the interpretation of an "IRQ acknowledge" event, can you confirm whether I finally understand the cause of $FF09 = #$FF?:
- Bit 7 = 1 tells me the IRQ has just been acknowledged by the KERNAL, explaining the mere fact that my IRQ routine is running - Bit 6, 4 and 3 = 1 tell me that all timers "have reached 0 since their last acknowledgement", which is the default as long as I do not activate them as additional IRQ-triggers in $FF0A - Bit 5, 2, 0 = 1 because they are not used - Bit 1 = 1 because it actually was the raster line reaching the value at $FF0B that triggered my IRQ
At which address do I find the IRQ-acknowledgement done by the KERNAL? I do not see it in the range $CE00-$CE0A, and the extension seems to happen BEFORE the redirection to $CE0E where i find the KERNAL tasks and the STA $FF09 and STA $FF0B statements.
Thanks for your help, I already spent around 100 hours just on IRQ experiments, likely because my approach is not systematic enough, I'm just a chemist .
|
|
Posted By
gerliczer on 2024-02-18 09:20:41
| Re: Need help with raster interrupt
there seems to be a lack of detailed documentation for the TED. I cannot count how many times I recommended in this forum the Ultimate Map by SVS. It is a very good source on everything about 264 machines.
1) You answered your question in 2). Raster interrupt is used by KERNAL. It is not a surprise that the interrupt status register does not shows any interrupt event. By the time your routine gets control, interrupt requests are already acknowledged.
3) While you are operate under KERNAL control, you don't have to manipulate $FF09 in any way. Those statements are for acknowledging interrupt request when you take over the system and manage interrupts yourself. It works like read the value of $FF09, check interrupt flag, if interrupt happened write back the value to do acknowledgement, evaluate the value to see what caused the interrupt. Similarly to the C64 with register $D019 of the VIC-II.
BTW, there are many programmes here that have their sources made public. Those are good resources for learning about these machines. plus4emu and YapeSDL sources are also good reads to see and understand "what makes them tick."
|
|
Posted By
Sirhadisen on 2024-02-18 15:04:03
| Re: Need help with raster interrupt
Thanks Luca, I might have some fundamental misconceptions that cause me trouble. Unfortunately I do not speak Hungarian and there seems to be a lack of detailed documentation for the TED. I would be very grateful if you could answer three basic questions
1) How often is the plus4 system code at $CE00, which checks for interrupts and their origins, executed? "continuously", at some timed frequency, only every 60th of a second? I always assumed the latter, but that would not make much sense I guess. LDA $FF09 at the beginning of my IRQ-extension always returns #$FF, which I find odd :-/
2) Per default $FF0A = #$A2, meaning only EI-RAS is not masked. Does that mean the raster counter is the only thing that causes hardware-interrupts that will branch into my IRQ-extension that I have set up via the vector at $0314-$0315?
3) How, if at all, can TED register $FF09 be manipulated? Do I need to go via some temporary zeropage variable? I found statements like STA $FF09, INC $FF09, ASL $FF09 in other threads, yet in my program their results seem to be identical?
Cheers!
|
|
Posted By
Luca on 2024-02-17 03:50:59
| Re: Need help with raster interrupt
Mmmh... I'm probably misunderstanding both your goals and your trouble. But.
$FF09 Bit1 activates when the raster matches $FF0B value, which is $CC in the normal JMP$CE0E routine of the machine and $A1 in the JMP$CE42 of the vblank at $0312/$0313. Maybe you didn't set up the right value of the scanline where to start printing on the screen? Just a blind arguing...
|
|
Posted By
Sirhadisen on 2024-02-18 15:01:48
| Need help with raster interrupt
I am trying to synchronize music and PETSCII animations that are done within an IRQ-extension (vector at $0314 was toggled to $034C) while keeping the KERNAL routines in the IRQ (JMP $CE0E) for a simple BASIC program that is running parallel. In order to stabilize the music rythm, I would like to alternate the sequence of tasks that are to be performed when the IRQ is triggered by
.034C LDA $FF09 .034F AND #$02 .0351 BEQ $0356 .0353 JMP $CE0E .0356 (propagation of music and PETSCII frames ...)
however, all that is left when I do that is the regular IRQ routine of the system that calls SCNKEY etc., meaning I can interrupt the program with the STOP button, but no frames are being played or displayed. If I use BNE instead of BEQ, everything works, but that is trivial. The way I understand this is that every trigger events of my IRQ seem to be raster interrupts, but how can that be? Does reading $FF09 change any registers? Or, if I am mistaken: Why would $FF09 & #$02 != 0 indicate a raster interrupt in the "regular" IRQ routine at $CE0E and not in my copy of it?
Hope that one of you can shed some light on this
|
|
| |
Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon |