Prev: 60770 Up: Map Next: 60882
60783: Draw Game Over
Used by the routine at Controller_GameOver.
Input
C Colour attribute value
Draw_GameOver 60783 LD IX,60913 Set the data pointer in IX to the start of the data in GameOver_Data.
60787 LD DE,32 Set DE with 0032 (the number of character blocks in one line).
Set the base drawing pointer in the attribute buffer from the data.
Draw_GameOver_Loop 60790 LD L,(IX+0) Load the low byte of the attribute buffer address into L.
60793 INC IX Load the high byte of the attribute buffer address into H.
60795 LD H,(IX+0)
Skip moving "up" if the offset is OFF.
60798 LD A,(60912) Jump to WriteAttributeToScreen if *GameOver_Y_Offset is equal to 0.
60801 CP 0
60803 JR Z,WriteAttributeToScreen
Else, move up one row.
60805 SBC HL,DE Subtract 0032 from the drawing pointer.
WriteAttributeToScreen 60807 LD (HL),C Write the attribute value to *HL.
60808 INC IX Move the data pointer to the next item of data.
Movement_Loop 60810 LD B,(IX+0) Load the repeat count into B.
60813 INC IX
60815 LD A,(IX+0) Load the direction code into A.
60818 INC IX Move the data pointer to the next item of data.
60820 CP 1 Jump to GameOver_Move_Right if the direction code is "right".
60822 JR Z,GameOver_Move_Right
60824 CP 2 Jump to GameOver_Move_Left if the direction code is "left".
60826 JR Z,GameOver_Move_Left
60828 CP 4 Jump to GameOver_Move_Down if the direction code is "down".
60830 JR Z,GameOver_Move_Down
60832 CP 8 Jump to GameOver_Move_Up if the direction code is "up".
60834 JR Z,GameOver_Move_Up
60836 CP 0 Return if the terminator has been reached.
60838 RET Z
Else, this is a new starting point, so rewind the pointer and jump back to the start of the loop.
60839 DEC IX Decrease the data pointer by two.
60841 DEC IX
60843 JR Draw_GameOver_Loop Jump to Draw_GameOver_Loop.
Handle moving right:
GameOver_Move_Right 60845 INC HL Increment the drawing pointer by one (move right).
60846 LD (HL),C Write the attribute value to *HL.
60847 CALL Sound_GameOver Call Sound_GameOver.
60850 DJNZ GameOver_Move_Right Decrease the repeat counter by one and loop back to GameOver_Move_Right until the repeat counter is zero.
60852 JR Movement_Loop Jump to Movement_Loop.
Handle moving left:
GameOver_Move_Left 60854 DEC HL Decrease the drawing pointer by one (move left).
60855 LD (HL),C Write the attribute value to *HL.
60856 CALL Sound_GameOver Call Sound_GameOver.
60859 DJNZ GameOver_Move_Left Decrease the repeat counter by one and loop back to GameOver_Move_Left until the repeat counter is zero.
60861 JR Movement_Loop Jump to Movement_Loop.
Handle moving down:
GameOver_Move_Down 60863 ADD HL,DE Add 0032 to the drawing pointer (move down).
60864 LD (HL),C Write the attribute value to *HL.
60865 CALL Sound_GameOver Call Sound_GameOver.
60868 DJNZ GameOver_Move_Down Decrease the repeat counter by one and loop back to GameOver_Move_Down until the repeat counter is zero.
60870 JR Movement_Loop Jump to Movement_Loop.
Handle moving up:
GameOver_Move_Up 60872 SBC HL,DE Subtract 0032 from the drawing pointer (move up).
60874 LD (HL),C Write the attribute value to *HL.
60875 CALL Sound_GameOver Call Sound_GameOver.
60878 DJNZ GameOver_Move_Up Decrease the repeat counter by one and loop back to GameOver_Move_Up until the repeat counter is zero.
60880 JR Movement_Loop Jump to Movement_Loop.
Prev: 60770 Up: Map Next: 60882