| |
Golara Account closed
Registered: Jan 2018 Posts: 212 |
unexpected lost cycles (with sprites)
I'm trying to get a stable raster with the double irq method (I made it several times already) but it seems like the sprites or something else is stealing my cycles, even though they are way below my raster code. Here's the scenario:
first irq line 22, next irq 23, wobble check, line 24 we're stable. Here I do a bunch of stuff and setup the sprite Y position to the line number + 6 + value from $20 like:
lda $d012
clc
adc #6
adc $20
sta $d001
sta $d003
sta $d007
; i even started disabling sprites and enabling them just here to make sure.... still timing problems
lda #7
sta $d015
the value in $20 is always betwen 0 and 20, so the sprites are on lines (the code above starts at line 25) 31 - 51. Seems like there's no way for them to disrupt my timings in the lines 22/23/24. If I make them appear way below (replace adc #6 with let's say adc #50) it seems stable.
I'm looking in the vice monitor and see that the last instruction before nops in the first irq (cli) is on cycle 56 and then i get a nop on cycle 2 of the next line (and second irq after it). Seems like 7 cycles missing ? Any ideas ? |
|
... 10 posts hidden. Click here to view all posts.... |
| |
enthusi
Registered: May 2004 Posts: 677 |
I am (ab)using this to again declare MACROs the devil's work! ;-) |
| |
Golara Account closed
Registered: Jan 2018 Posts: 212 |
There's still something wrong.. While my code had a bug and after fixing it I managed to get a stable raster... but only after I disabled the sprites. While the sprites are enabled (and I tried other sprites too, without sprite 0) the raster is flickering... the sprites are 6 lines below the stable raster code. Stable raster codes sets their Y position and enables them with d015, d015 is set to 0 at line 10 (12 lines above the double_irq routine)
EDIT. Problem went away when I disabled 2x height of the sprites. Any clue why would it be the issue ? |
| |
Claus_2015
Registered: Oct 2012 Posts: 53 |
Are you sure that the sprites are not in the process of being drawn at a previous location when you set the y-position or erase the enable flag? |
| |
lft
Registered: Jul 2007 Posts: 369 |
Your sprites are at Y-position 31-51 (in hex $1f-$33). When the sprite Y-register is e.g. $33, it will match the raster position twice per frame, and sprite DMA will be enabled starting at lines 51 ($33) and 307 ($133). The copy at line 307 is hidden by the border, and normally ends at line 15, before the next irq. But with Y-expansion, it continues all the way to line 36, and interferes with the irq on the next frame. |
| |
Golara Account closed
Registered: Jan 2018 Posts: 212 |
Oh yeah that's it. All I have to do now is to disable the y expand (or sprites all together) before the line $11f. Thanks. |
Previous - 1 | 2 - Next |