| Routines

64618: Scroll the screen up and down 7 times

Used by the routine at 64338 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.
64618 | LD HL,59552 | Change the instruction at 59552 to RET
64621 | LD (HL),201
64623 | LD L,220 | Change the instruction at 59612 to RET
64625 | LD (HL),201
64627 | LD HL,59372 | Set the instruction at 59371 to 'LD BC,32'
64630 | LD (HL),32
64632 | LD L,239 | Set the instruction at 59374 to 'LDIR'
64634 | LD (HL),176
64636 | LD H,7 | We will scroll the screen up and down a row 7 times
64638 | PUSH HL | Save the scroll counter
64639 | LD HL,16384 | Save the top 8 rows of pixels on the screen in page 126
64642 | LD DE,32256
64645 | LD BC,32
64648 | LD A,8
64650 | LDIR
64652 | INC H
64653 | LD L,B
64654 | LD C,32
64656 | DEC A
64657 | JR NZ,64650
64659 | LD H,88 | Save the top row of attribute bytes (22528-22559) in the first 32 bytes of the screen refresh buffer at 32512
64661 | LDIR
64663 | CALL 59528 | Scroll the screen up a row
64666 | LD HL,20576 | Fill the top line of bytes on the 20th row of the screen with 9s; this is a bug
64669 | LD B,32
64671 | LD (HL),9
64673 | INC L
64674 | DJNZ 64671
64676 | POP HL | Restore the scroll counter (1-7) to H
64677 | PUSH HL | Save the scroll counter again
64678 | LD A,H | Prepare the sound effect parameters
64679 | LD DE,384
64682 | LD C,192
64684 | CALL 64740 | Make a sound effect
64687 | CALL 59587 | Scroll the screen down a row
64690 | LD HL,32256 | Restore the top 8 rows of pixels on the screen from page 126
64693 | LD DE,16384
64696 | LD A,8
64698 | LD C,32
64700 | LDIR
64702 | INC D
64703 | LD E,B
64704 | LD C,32
64706 | DEC A
64707 | JR NZ,64700
64709 | LD D,88 | Restore the top row of attribute bytes (22528-22559) from where they were saved earlier
64711 | LDIR
64713 | POP HL | Restore the scroll counter (1-7) to H
64714 | LD DE,256 | Prepare the sound effect parameters
64717 | LD C,96
64719 | LD A,H
64720 | CALL 64740 | Make a sound effect
64723 | DEC H | Decrement the scroll counter
64724 | JR NZ,64638 | Jump back until we've scrolled the screen up and down 7 times
64726 | LD HL,59552 | Change the instruction at 59552 back to 'LD HL,32767'
64729 | LD (HL),33
64731 | LD L,220 | Change the instruction at 59612 back to 'LD HL,32767'
64733 | LD (HL),33
64735 | JP 64582 | Regenerate the table of mirrored values of 0-255 at 32256