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 > unexpected lost cycles (with sprites)
2018-03-27 17:14
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....
 
2018-03-28 16:42
enthusi

Registered: May 2004
Posts: 677
I am (ab)using this to again declare MACROs the devil's work! ;-)
2018-03-28 17:17
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 ?
2018-03-28 17:54
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?
2018-03-28 19:46
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.
2018-03-28 20:17
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
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
Doc Snyder/ONS
slimeysmine
Magic/Nah-Kolor
iAN CooG/HVSC
Martinland
Freeze/Blazon
WVL/Xenon
Mason/Unicess
Steffan/BOOM!
ΛΛdZ
astaroth/TRSI
Copyfault/Extend^tsn..
A3/AFL
E$G/HF ⭐ 7
The Syndrom/TIA/Pret..
Walt/Bonzai
Guests online: 103
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Swappers
1 Derbyshire Ram  (10)
2 Jerry  (9.8)
3 Violator  (9.7)
4 Acidchild  (9.7)
5 Cash  (9.6)

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