| |
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. |
|
... 5 posts hidden. Click here to view all posts.... |
| |
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. |
| |
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.
|
| |
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.
|
| |
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. |
| |
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. |
| |
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.
|
| |
Digger
Registered: Mar 2005 Posts: 437 |
The method described by Oswald is exactly what Toaster did (AFAIT by quickly looking into the code) |
| |
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 |
| |
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.
|
| |
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 |