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 > Screen blanking: "curtain" effect
2011-05-11 08:29
ready.

Registered: Feb 2003
Posts: 441
Screen blanking: "curtain" effect

Hello,
I am linking some parts for a demo and I want to exit from one part using a "curtain" effect (that's how I call it), by making the screen black raster line after raster line from top to bottom, moving slowly.
My first attempt was to use a CIA-timer-based IRQ counting O2 cylces from X to zero starting it at raster line $000. At every frame X is incremented by some value, so that the delay gets bigger every time, thus extending the black area slowly towards the bottom of the screen.

When IRQ triggers I set the VIC into an illegal mode (multicolor and extended color mode both on), so that VIC outputs just black color (setting to 1: $d016 bit 4 and $d011 bit 6, then $d020 to 0).

This works, but the switching point between black screen and the rest below is jittering. I don't want the switching point to happen in the middle of a raster line.

So I implemented a double IRQ to stabilize the raster, but I soon discovered that I still get some jittering. I think mostly because of badlines, which screw up the stabilizing routine.

I am wondering how to do this properly.
One chance would be to put a band of X-expanded sprites to cover the area of the jitter and move them down as the "curtain" is lowered. But I wanted to avoid using sprites, if possible.

Any suggestion is welcome!

thanx,
Ready.
2011-05-11 08:50
Oswald

Registered: Apr 2002
Posts: 5094
one approach is to code it properly for one character row (8 rasterlines including the badline) then you can extend that to work on all 25 lines.
2011-05-11 09:04
Testa
Account closed

Registered: Oct 2004
Posts: 197
hi Ready, what i always do to blanc out line for line is
set up at stable rasterirq. set up a big loop with a
delay table (as you would do with rasterbars),
but instead of using $d020 and $d021 use $d020 and $d011.
$d020 ofcourse for the sideborder and $d011 ($68 - $6f)
for blanc out the graphics.. simply do the vic writes
somewhere outside the visible area and the trick is
done. For the upper/lower border you can use only $d020

now it just a matter of putting the right values at
the right adress in your read value tables frame for
frame..

hope this is what you mean



2011-05-11 09:05
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: Hello,
I am linking some parts for a demo and I want to exit from one part using a "curtain" effect (that's how I call it), by making the screen black raster line after raster line from top to bottom, moving slowly.
My first attempt was to use a CIA-timer-based IRQ counting O2 cylces from X to zero starting it at raster line $000. At every frame X is incremented by some value, so that the delay gets bigger every time, thus extending the black area slowly towards the bottom of the screen.

When IRQ triggers I set the VIC into an illegal mode (multicolor and extended color mode both on), so that VIC outputs just black color (setting to 1: $d016 bit 4 and $d011 bit 6, then $d020 to 0).

This works, but the switching point between black screen and the rest below is jittering. I don't want the switching point to happen in the middle of a raster line.

So I implemented a double IRQ to stabilize the raster, but I soon discovered that I still get some jittering. I think mostly because of badlines, which screw up the stabilizing routine.

I am wondering how to do this properly.
One chance would be to put a band of X-expanded sprites to cover the area of the jitter and move them down as the "curtain" is lowered. But I wanted to avoid using sprites, if possible.

Any suggestion is welcome!

thanx,
Ready.


I know you don't wanna use sprites... but that's the simple approach and enables you to fill with any color you like, and not just black. I did that in Mekanix. A more simple approach is to fill quickly with 8 lines per frame. :) I did that in The Super Larsson Bros.

If you really wanna do it without sprites etc, the listen to Oswald.

Otoh your initial timer method should work, just make sure the IRQ is triggered just at the beginning of the right border. This would give you time to handle the IRQ and set the mode properly before the bad line DMA kicks in (causing the jitter).
2011-05-11 10:10
ready.

Registered: Feb 2003
Posts: 441
@ Testa: I tried your trick, you are right: $d016 is not necessary to set VIC in illegal mode. But I think $68-$6f are not correct values, I can blank screen all the way (bit 4 of $d011 is zero), while it works with $78-$7f (bit 4 at 1).

2011-05-11 12:02
Testa
Account closed

Registered: Oct 2004
Posts: 197
hi Ready i probably made a type mistake.. but to be honest
, i dont know al the bitsettings whithout reading it
first in a manual, i should be ashamed of myself..

you can combinate Oswald and my methode together.
just do the loop every 8th line. then you have
enough rastertime left for other things..

have fun!
2011-05-11 12:45
Digger

Registered: Mar 2005
Posts: 437
There's a linker for that made by Toaster. He did it for Atlantic (exclusively) years ago so I suppose it can be now released. I will dig it out soon.
2011-05-11 13:43
ready.

Registered: Feb 2003
Posts: 441
thanks Diggger, looking forward to it.
I also realized that the sprite solution is not so easy either, since the sprites do not cover the border area (unless you have open left and right borders) and depending on what raster line you are on, the side border sometimes gets misaligned with the sprites.

2011-05-11 15:33
Testa
Account closed

Registered: Oct 2004
Posts: 197
the sprite solution is a good methode when you want to blanc out
lines in other colours dan black... just use
$d020 for the sideborder en use blanc spritepointers.
to make the sprites shorter or larger.

for example: when you have a bitmap picture and you
want to blanc it out line for line than set up
a loop as i mentioned before and use $d020 en $d018
to blanc out..

after each 8th line you increment the $d012 poll so the
rasterloop begins on the next 8 lines, add 8 lines to
the y pos of the sprites en fill the previous text
raw ($0400 and/or $d800) with the colour values you
want.

you need 2 screens with the same bitmap color data:
lets say $0400 and $0c00, at $07f8/$07ff,
you point to a filled sprite and at $0ff8/$0ffff you point to an empty sprite.
2011-05-11 16:59
Digger

Registered: Mar 2005
Posts: 437
Found and added it: Start Linker V3.0

Decompile to see how it was done. Each line can be switched on/off independently.
2011-05-11 19:22
Mace

Registered: May 2002
Posts: 1799
Funny... I was just working on something like this, though not entirely identical.

I made a double raster IRQ and timed the entire screen with NOPs and BITs so that every 'unit' I want to blank is stable and exactly of the desired height.
Works like a charm.
2011-05-11 21:52
Testa
Account closed

Registered: Oct 2004
Posts: 197
mace: i don't fully understand what you mean,,
once you have a stable rasterirq
it should be stable for the entire screen,
except when you execute a routine that causes
a new jitter...

you can use the half variance technique for this,
with this routine from Krill you can get a new
stable raster in less than the half of a goodline.

2011-05-12 07:42
Digger

Registered: Mar 2005
Posts: 437
The method described by Oswald is exactly what Toaster did (AFAIT by quickly looking into the code)
2011-05-12 09:59
Mace

Registered: May 2002
Posts: 1799
@ Testa: of course it stays stable, but to create the exact height of each raster, I use BITs and NOPs to time the change of $d021 and $d020.

I don't have rasterbars of 1 pixel height.
Also, there's a difference in timing when you're in the upper and lower border, right on the edge, or where the screen is 'open'.

So I do:
{create stable raster IRQ}
  - time exact starting point
    - change $d020/$d021
      - create delay with loop, BITs and NOPs
    - change $d020/$d021
      - create delay with loop, BITs and NOPs
    - change $d020/$d021
      - create delay with loop, BITs and NOPs
    - change $d020/$d021
      - create delay with loop, BITs and NOPs
    - change $d020/$d021
    etc.
  - end of IRQ

At this moment I'm extending the things that need to be done during the IRQ, so some of the delays will be changed into routines that in turn need de-jitter branches :-P
2011-05-12 10:44
ready.

Registered: Feb 2003
Posts: 441
\o/
it is so much joy to succesfully fine tune a cycle-exact piece of code for the first time!
I got it working finally, thank you all. Actually I never needed such strict timing before. This means I never coded such effects.

Anyhow, I used the $d013 approach for stabilizing the raster:

$d013 sync ??

and it is real nice. Especially in my case I have:
- music played via $d012 raster IRQ
- NMI timer controlling the switch point between black screen and gfx screen

Using the double raster I had the problem that at some point the stabilizing $d012 IRQ got in conflict with music IRQ. But using the $d013 approach, there's no need for such IRQ anymore.

So I used this to get stable raster:

stabilize_raster		 
		 lda $d019
         sta $d019
         ldx #$ff
         ldy #$00
         stx $dc00
         sty $dc02
         stx $dc03
         stx $dc01
         sty $dc01
         stx $dc01
         lda $d013
         stx $dc02
         sty $dc03
         stx $dc01
         ldx #$7f
         stx $dc00
         lsr a
         lsr a
         lsr a
         sta timeout+1
         bcc timing
timing   clv
timeout  bvc timeout
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
		 
		 nop
		 nop
		 nop
		 nop
		 nop
		 
		 lda $d012 
		 and #%00000111 
		 tax
		 lda delay,x		 
		 tax
		 dex
		 bne *-1
stabilizer_raster_000		 
		 rts
delay .byte 1,1,1,1,$10,$10,1,1



NMI code does
jsr stabilize_raster

right before setting $d020 and $d011 to get out of VIC illegal mode. At raster $000 $d020 and $d011 are set to enter illegal mode (black screen). raster is where I want after rts.

Only thing to fix now is timing while raster is in upper and lower border, but it won't be difficult now.
2011-05-12 10:52
Mace

Registered: May 2002
Posts: 1799
It is not really necessary to start at $d012 == #$00, because the first, say, 8 line aren't visual on ANY screen (except Vice in debug-mode).

My example:

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
MWR/Visdom
algorithm
Steffan/BOOM!
Sulevi/Virtual Dreams
Barfly/Extend
DJB/Onslaught / Blue..
Guests online: 99
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 Fullscreen Graphicians
1 Joe  (9.7)
2 Sulevi  (9.6)
3 The Sarge  (9.6)
4 Veto  (9.6)
5 Facet  (9.6)

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