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 > Mixing multiple effects is messing up stuff
2011-11-08 22:29
Cobrakid

Registered: Oct 2011
Posts: 23
Mixing multiple effects is messing up stuff

I am doing a small and very lowtech demo but I seem to be confused about the raster timing - probably like any other C64 newbie out there(?).

I know(?) this is related to the raster interrupt I am using plus my routines and that everyone will shout out "learn to code before you do a demo" and you are right but I really need some directions or hints here as I cannot get my head around this problem. I have read a lot on the C64 Codebase and here in the forum but still I don't get it (no hope for me!?).

I am trying to get a static (not moving) rasterbar below a 2x2 scroll plus some music - this must be "demo programming day 1". I have done each part individually and they work but together they are screwing up things (of course!?). Well, the music and the 2x2 scroll I can get working but introducing the raster gets ne problems.

What I have is a rasterbar... fired up at raster pos #$80 (as an example). A few lines below I am starting my scroll and this is totally messing up things... the scroll is veeery slow and shifting between the 2x2 charset and the system charset and when playing music I can hear it is slowing down to 1/4 of the normal pace or alike. This must be because the rasters are overlapping but how can I overcome this?

This is not a matter of getting the rasterbars looking nice but a more fundamental problem I think - then the prettyness of the bars will be a problem for later on.

If anyone would explain me how or point me to a fool-proof-dummy-guide on how I might can solve this I would really appreciate it as I am getting really frustrated now and I don't see any solutions for it (though there obvioulsy is one).
 
... 21 posts hidden. Click here to view all posts....
 
2011-11-10 11:49
ready.

Registered: Feb 2003
Posts: 441
this will help also:
http://unusedino.de/ec64/technical/aay/c64/
as a reference for hardware registers involved with IRQs
2011-11-10 15:22
Cobrakid

Registered: Oct 2011
Posts: 23
@Frantic and ready - thanks for the links.

I have just tried doing the most simple piece of code - with two interrupts and flashing the border. There I can trigger the "sta $d019" so I must (naturally) be doing something wrong in my other part but I cannot see what.

What I still don't get is when something takes (for example) 50 raster lines (as seen with flashing $d020) and I need to place something else in that area (for example a scroll in front of a rasterbar)... how the h... is this done correctly with IRQ?

If you see this picture:
http://cobrakid.dk/asm/mydmo5.png

The yellow is the raster time for the rasterbar and the green is for the splitscreen for the scroll.

I cannot get this working in a way which I understand (currently I don't ACK the IRQ in my first interrupt - see previously posted code). I would appreciate some phseudo code or alike to get it right?
2011-11-10 15:36
Oswald

Registered: Apr 2002
Posts: 5094
the problem is you dont have the basic understanding of what a(n raster) interrupt is, how the screen is drawn and how it is timed with the cpu, whats is drawn with the help of the cpu / gfx chip. You dont see the whole picture only some very small fragments of it.

for example, placing a scroller in front of a rasterbar is no problem, because you D O N ' T need any timing / raster irqs to do that. You simply set up the screen memory and the video chip will display the scroller, you dont need timed raster irqs to do that ! ! !

You have to start out with very basic stuff and experiment. Do the scroller / rasterbar individually first, understand them fully, then put them together, etc.

2011-11-10 15:38
ready.

Registered: Feb 2003
Posts: 441
for the effect you want, you need only 1 IRQ that triggers always at raster $70 (not #70!!! # means it's a number and not an address in assembly code, $ means it's hexadecimal).

So the steps you need are:

- enter IRQ at raster $70
- set screen x position ($d016 bits 0,1,2)
- change $d020/$d021 for raster bars until line $80+$16
- exit IRQ

then inside the background program (outside IRQ) you do the scrolling and prepare the screen position (written inside the IRQ to $d016). Don't do the scrolling in the IRQ. Now your background program is just "jmp *"
2011-11-10 15:40
Oswald

Registered: Apr 2002
Posts: 5094
pseudocode for your Q:

raster irq starts:

-> setup X fine scroll
for x=0 to number of lines
get rastercolor: poke $d020, rastercolor: poke $d021, rastercolor
next x
-> reset X fine scroll to default value
-> redraw scroller
-> play music

raster irq stops.
2011-11-10 15:42
Oswald

Registered: Apr 2002
Posts: 5094
Quote: for the effect you want, you need only 1 IRQ that triggers always at raster $70 (not #70!!! # means it's a number and not an address in assembly code, $ means it's hexadecimal).

So the steps you need are:

- enter IRQ at raster $70
- set screen x position ($d016 bits 0,1,2)
- change $d020/$d021 for raster bars until line $80+$16
- exit IRQ

then inside the background program (outside IRQ) you do the scrolling and prepare the screen position (written inside the IRQ to $d016). Don't do the scrolling in the IRQ. Now your background program is just "jmp *"


No. Do the scroller _IN_ the irq, after the rasterbars have been drawn. Some stuff are timing critical, some are not. Doing the scroller is not timing critical, but you have to do it once per frame exactly, so simply you execute it after having draw the rasters.
2011-11-10 15:50
Cobrakid

Registered: Oct 2011
Posts: 23
But Oswald - how do I then setup the splitscreen? This splitscreen has to be within the rasterbar area!?

I do want a splitscreen as I am getting another 1x1 scroll or maybe some text in the top.
2011-11-10 16:19
Cobrakid

Registered: Oct 2011
Posts: 23
@ready - THIS I get... of course... it is so simple. As I don't care for other characters in the rasterbar I just start the splitscreen the same time as the rasterbar starts... and end it afterwards.

That was simple (and I have fixed it). I need to tweak it for a badline but I know how to do that (hmmm.. my method with x number of "bit $ff").

Well, in my case the problem was not the technical part... hmmm OK, it was that too, but it was the "ahhhhhh" I got from seeing your phseudo code that solved it and I guess I am just not meant for being a programmer since I had a much more complex approach for doing this.

Thanks (all) for your help. I suspect I will write again some day (maybe sooner than I hope) :-)

BTW @ready - I do know the diff on #70 and $#70 ;-) It is completely diff positions (line 70 vs 112).
2011-11-10 19:01
Cobrakid

Registered: Oct 2011
Posts: 23
Just a followup on this one - the code can be seen here, http://cobrakid.dk/asm/mydmo5-asm.txt. Maybe someone else can benefit from it.
I am not too proud of this one (in the start if the IRQ):
; Prevent badline (by having
; bad code!? Hmmm...)
; This is the only(?) part
; which I do not fully
; understand - why cant this
; part be in the setup irq?
bit $ff    ; 3 cycles
bit $ff    ; 3 cycles
bit $ff    ; 3 cycles
bit $ff    ; 3 cycles
nop        ; 2 cycles
nop        ; 2 cycles
It clearly states I am not in full control but I hope to get there - I need to study more and maybe even ask a few questions here yet.
2011-11-10 19:06
tlr

Registered: Sep 2003
Posts: 1790
The irq always triggers when the raster counter changes. You cannot alter that by "setting up" the raster irq differently so if you need a different starting point in the raster line you have to add a delay like you do.

There are ways to do it more compact though. Consider jsr-ing directly to an rts for wasting 12 cycles for instance.
Previous - 1 | 2 | 3 | 4 - 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
Acidchild/Padua
rexbeng
Alakran_64
Andy/AEG
Avalanche/Atlantis
JonEgg
Guests online: 110
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 Censor Design  (9.3)
5 Triad  (9.3)
Top NTSC-Fixers
1 Pudwerx  (10)
2 Booze  (9.7)
3 Stormbringer  (9.7)
4 Fungus  (9.6)
5 Grim Reaper  (9.3)

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