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 > Restoring vectors between parts in a trackmo
2015-08-24 17:20
Trap

Registered: Jul 2010
Posts: 223
Restoring vectors between parts in a trackmo

Hi,

So I'm fiddling with Spindle and I am at the point where I need to take a good look at how to make the shift from one part to another. Obviously I have to save the IRQ vectors FFFE/FFFF when I start my part after loading and restore the vectors again when I am done.
Now I wanted to hear if there is anything in particular I need to do other than that?
So the only thing I do when the part is complete is to wait for VSYNC and then restore the old vectors. One thing I have been thinking about is if I should in fact change the vectors in the last part of my existing IRQ. In my logic that would be a smoother/stable approach. I am not sure however and I hope that this thread will save me a headache or two when it comes to final linking.

Thanks.

/Trap
2015-08-24 17:43
chatGPZ

Registered: Dec 2001
Posts: 11386
i have a small irq handler in my framework (code that is always there) which only plays the music and increments a counter for syncing. then at the end of a part/effect the pointers will be updated to point to that handler, from within the interrupt of the previous part - that avoids a bunch of potential problems (glitchy music between parts, one broken frame that happens randomly, etc). in the last two demos the general rule was to never touch the irq pointers in the main loop - since that is asking for trouble unless you are *very* careful (imho too much hazzle).
2015-08-24 19:03
lft

Registered: Jul 2007
Posts: 369
I prefer to do it in main context. SEI, update vector, call init routine of new effect, CLI. If there's a visual glitch, I add a delay before the SEI, waiting for a good spot (e.g. vblank). If there's a music hiccup, I add an extra call to the playroutine before or after the wait.
2015-08-24 19:36
Oswald

Registered: Apr 2002
Posts: 5094
once there was thread on how to change the place of the music jsr without hiccups, some guy was talking about X frames of moving the irq place, maybe a good idea to automate this in the framework :)
2015-08-24 19:37
chatGPZ

Registered: Dec 2001
Posts: 11386
thats the old, glitchy way. DONT :=) it'll save you a few WTFs during debugging. (you hardly ever want a CLI anywhere unless doing recursive IRQs)

Oswald: thats not required often enough to put it into the framework... mostly you are calling the music in the border anyways.
2015-08-25 07:05
Axis/Oxyron
Account closed

Registered: Apr 2007
Posts: 91
I mostly do the IRQ-switching the lazy way (in the mainloop with a VSYNC before). Sometimes this can cause trouble/glitches, e.g. if an IRQ occupies the rastertime around the VSYNC.

What Oswald is talking about, is the fact that not only missing or doubling a music playback-IRQ in the switch-frame can cause glitches, even changing the rasterline of the playback-IRQ can cause a glitch. Not as noticeable as the normal case, but hearable. The glitch gets bigger linearly with the amount of rasterlines your IRQ´s jump. So moving the IRQ-rasterline smoothly is sometimes the only way to get rid of it.
2015-08-25 07:19
Bitbreaker

Registered: Oct 2002
Posts: 508
Also, refrain from stuffing all kind of functionality into a framework or other resident parts like a loader script when it could easily be added statically and still very comfortably with the use of some simple macros or at least includes.
2015-08-25 10:13
chatGPZ

Registered: Dec 2001
Posts: 11386
axis: "sometimes" is they important part there... unless its "nearly always", then putting it into a (static) framework is a waste of memory and should be linked when needed, like faker said.
2015-08-25 20:02
Trap

Registered: Jul 2010
Posts: 223
Thank you guys. So, what I gather from all this is that I should probably redirect the last irq handler in my irq chain to the saved vectors. Makes sense to me. Not sure I fully grasp the timing issues around music mentioned here, but I guess I'll see it.

cheers
Trap
2015-08-25 20:19
algorithm

Registered: May 2002
Posts: 705
if your music routine will be running at a fixed area, you can also set up a nmi running once per frame along with the required io values (d011,dd00,d018 etc) then no need to worry about syncing the audio.
2015-08-25 20:40
chatGPZ

Registered: Dec 2001
Posts: 11386
i wouldnt worry about it unless you really notice a glitch... its seldom a problem :)
2015-08-26 06:54
Trap

Registered: Jul 2010
Posts: 223
ok. thanks.
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
Alakran_64
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 No Listen  (9.6)
2 Layers  (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 Crackers
1 Mr. Z  (9.9)
2 Antitrack  (9.8)
3 OTD  (9.8)
4 Fungus  (9.8)
5 S!R  (9.8)

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