Prev: AFC8 Up: Map Next: B001
AFD1: Fade-out screen wipe
Right-shifts every pixel in the display file ($4000–$57FF) 8 times,
creating a wipe-to-black effect. Then fills the attribute file with
the fade colour stored in var_fade_attr.
fade_out AFD1 LD A,$08 A = 8 (outer loop count — 8 shift passes)
Per-pass: shift all 24×32 pixels right by 1 bit
fade_out_0 AFD3 LD HL,$4000 HL = $4000 (start of display file)
AFD6 LD C,$18 C = 24 (row count)
fade_out_1 AFD8 LD B,$00 B = 0 (256 bytes per row)
fade_out_2 AFDA SRL (HL) SRL (HL) + INC HL (shift then advance pointer)
AFDC INC HL LD A,$23 (unused byte — artifact of encoding)
AFDD DJNZ fade_out_2 DJNZ — repeat for all 256 bytes in row
AFDF DEC C DEC C
AFE0 JR NZ,fade_out_1 JR NZ — next row
Inter-pass delay
AFE2 LD B,$00 B = 0 (256 iterations)
fade_out_3 AFE4 DEC B DJNZ self — inner spin (+ padding byte $FD)
AFE5 JR NZ,fade_out_3
AFE7 LD C,$00 C = 0 (256 iterations)
fade_out_4 AFE9 DEC C DJNZ self — outer spin (+ padding byte $FD)
AFEA JR NZ,fade_out_4
AFEC DEC A DEC A
AFED JR NZ,fade_out_0 JR NZ — repeat all 8 passes
Fill attribute file with fade colour
AFEF LD HL,$5800 HL = $5800 (attribute file start)
AFF2 LD A,($C34F) A = fade colour (var_fade_attr)
AFF5 LD C,$18 C = 24 (row count)
fade_out_5 AFF7 LD B,$20 B = 32 (columns per row)
fade_out_6 AFF9 LD (HL),A Write A to (HL)
AFFA INC HL INC HL
AFFB DJNZ fade_out_6 DJNZ — fill 32 columns
AFFD DEC C DEC C
AFFE JR NZ,fade_out_5 JR NZ — next row
B000 RET
Prev: AFC8 Up: Map Next: B001