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.
 
... 10 posts hidden. Click here to view all posts....
 
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:

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
iAN CooG/HVSC
MCM/ONSLAUGHT
TheRyk/MYD!
Youth
Laddh
Holy Moses/Role
Smasher/F4CG
Acidchild/Padua
zscs
Mike
rambo/Therapy/ Resou..
LKP/CFN
𝘁𝗡𝗚/FairLight
grasstust/Hoaxers
Steve/Laser, Zenith,..
Guests online: 126
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 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.045 sec.