Code

Hardware fade technique (1996)

There is a hardware trick to achieve truecolor fullscreen fading on the Falcon030. A hidden feature of the ViDEL chip allows you to control the intensity of a true color screen. The magic trick is to clear the HBE and VBE at the start of each VBL, then set the palette register to different values. This idea was probably first conceived by the Aggression crew. Reine wrote an article about this which was published in Maggie 20 (July 1996).

Using standard logical shifts

move.w #0,$ff8286 ; horizontal border end
move.w #0,$ff82a6 ; vertical border end
movem.l d1-d2/a0,-(sp)
lea $ff9800,a0
move.w d0,d1 ; green intensity (0-63)
lsl.w #2,d1
move.w d0,d2 ; red intensity (0-63)
lsl.w #2,d2
lsl.w #8,d2
add.w d2,d1
move.w d1,(a0)
move.w d0,d1 ; blue intensity (0-63)
lsl.w #2,d1
move.w d1,2(a0)
movem.l (sp)+,d1-d2/a0

Using 68030 instructions

This is a shorter way to set the register by using the extended 68030 instruction set:

move.w #0,$ff8286 ; horizontal border end
move.w #0,$ff82a6 ; vertical border end
movem.l d1-d2,-(sp)
bfins d0,d1{0:6} ; red intensity
bfins d0,d1{8:6} ; green intensity
bfins d0,d1{24:6} ; blue intensity
move.l d1,$ffff9800.w
movem.l (sp)+,d1-d2