Posted By
Fuzzweed on 2024-10-29 05:27:46
| Checking interrupt status
Hi, I'm trying to understand the logic of using the interrupt register for timing, but without causing an interrupt. The programmers guide says bits in $FF09 are set even if device interrupt is not enabled. Is this also true if 'global' interrupts are not set (sei)? And I guess I would also need to clear $FF09 quite regularly still?
The application is to update screen without flickering, so I guess I need to wait for the raster to pass before moving any screen data. I tried something like this, but I don't think it's working
sei ;disable int. lda #$CB ;last onscreen raster sta $FF0B ;raster compare lda $FF09 sta $FF09 ;clear status register lda #$02 ;raster interrupt is bit 1 - bit $FF09 ;loop until bit one is set beq - ;if bit 1 = 0, AND #$02 = 0 Z=1, loop [MOVE SCREEN DATA]
|
|
Posted By
gerliczer on 2024-10-29 07:03:10
| Re: Checking interrupt status
What's the point of overcomplicating it like that? Clear all interrupts then poll and compare $FF1D in a busy loop, done. You don't have to wait for the raster to pass the active display area. All you have to do is taking care not to overtake the beam during screen update.
|
|
Posted By
Fuzzweed on 2024-10-29 10:07:45
| Re: Checking interrupt status
Thankyou. I will look at this. I've only been learning 6502 a few weeks, I don't know if it's complicated or not yet
Edit. Yes that has worked very nicely thanks again
|
|
Posted By
Csabo on 2024-10-29 12:23:14
| Re: Checking interrupt status
One small thing to add: waiting for a given vertical position (raster line) by checking $FF1D is very common, and there's a C64 equivalent of this as well. However, on Plus/4 we also have this for the horizontal position: $FF1E (which can be both read and written). This is often used for simple raster bars:
ldx #17 ; 18 colors ldy #$A8 ; horizontal position check loop06 lda colors,x ; get next color loop05 cpy $FF1E ; wait for horizontal position bcs loop05 ; keep waiting ** ; sta $FF19 ; change border and... sta $FF15 ; background color dex bpl loop06
|
|
Posted By
Fuzzweed on 2024-10-29 13:22:43
| Re: Checking interrupt status
yes I just saw that register when I looked in the PG Soooo glad I hadn't quite got onto that as I was thinking about lots of very clever timing otherwise.
|
|