| Routines

FC6A: Scroll the screen up and down 7 times

Used by the routine at FB52 to scroll the screen up and down a row 7 times when Sam hits the ground after being dropped from the roof of a building by a gangster. Your browser doesn't support HTML5 audio. Here is a link to the audio instead.
FC6A | LD HL,$E8A0 | Change the instruction at E8A0 to RET
FC6D | LD (HL),$C9
FC6F | LD L,$DC | Change the instruction at E8DC to RET
FC71 | LD (HL),$C9
FC73 | LD HL,$E7EC | Set the instruction at E7EB to 'LD BC,$0020'
FC76 | LD (HL),$20
FC78 | LD L,$EF | Set the instruction at E7EE to 'LDIR'
FC7A | LD (HL),$B0
FC7C | LD H,$07 | We will scroll the screen up and down a row 7 times
FC7E | PUSH HL | Save the scroll counter
FC7F | LD HL,$4000 | Save the top 8 rows of pixels on the screen in page 0x7E
FC82 | LD DE,$7E00
FC85 | LD BC,$0020
FC88 | LD A,$08
FC8A | LDIR
FC8C | INC H
FC8D | LD L,B
FC8E | LD C,$20
FC90 | DEC A
FC91 | JR NZ,$FC8A
FC93 | LD H,$58 | Save the top row of attribute bytes (5800-581F) in the first 32 bytes of the screen refresh buffer at 7F00
FC95 | LDIR
FC97 | CALL $E888 | Scroll the screen up a row
FC9A | LD HL,$5060 | Fill the top line of bytes on the 20th row of the screen with 9s; this is a bug
FC9D | LD B,$20
FC9F | LD (HL),$09
FCA1 | INC L
FCA2 | DJNZ $FC9F
FCA4 | POP HL | Restore the scroll counter (1-7) to H
FCA5 | PUSH HL | Save the scroll counter again
FCA6 | LD A,H | Prepare the sound effect parameters
FCA7 | LD DE,$0180
FCAA | LD C,$C0
FCAC | CALL $FCE4 | Make a sound effect
FCAF | CALL $E8C3 | Scroll the screen down a row
FCB2 | LD HL,$7E00 | Restore the top 8 rows of pixels on the screen from page 0x7E
FCB5 | LD DE,$4000
FCB8 | LD A,$08
FCBA | LD C,$20
FCBC | LDIR
FCBE | INC D
FCBF | LD E,B
FCC0 | LD C,$20
FCC2 | DEC A
FCC3 | JR NZ,$FCBC
FCC5 | LD D,$58 | Restore the top row of attribute bytes (5800-581F) from where they were saved earlier
FCC7 | LDIR
FCC9 | POP HL | Restore the scroll counter (1-7) to H
FCCA | LD DE,$0100 | Prepare the sound effect parameters
FCCD | LD C,$60
FCCF | LD A,H
FCD0 | CALL $FCE4 | Make a sound effect
FCD3 | DEC H | Decrement the scroll counter
FCD4 | JR NZ,$FC7E | Jump back until we've scrolled the screen up and down 7 times
FCD6 | LD HL,$E8A0 | Change the instruction at E8A0 back to 'LD HL,$7FFF'
FCD9 | LD (HL),$21
FCDB | LD L,$DC | Change the instruction at E8DC back to 'LD HL,$7FFF'
FCDD | LD (HL),$21
FCDF | JP $FC46 | Regenerate the table of mirrored values of 0x00-0xFF at 7E00