Prev: ED62 Up: Map Next: EDD2
ED6F: Draw Game Over
Used by the routine at Controller_GameOver.
Input
C Colour attribute value
Draw_GameOver ED6F LD IX,$EDF1 Set the data pointer in IX to the start of the data in GameOver_Data.
ED73 LD DE,$0020 Set DE with 0020 (the number of character blocks in one line).
Set the base drawing pointer in the attribute buffer from the data.
Draw_GameOver_Loop ED76 LD L,(IX+$00) Load the low byte of the attribute buffer address into L.
ED79 INC IX Load the high byte of the attribute buffer address into H.
ED7B LD H,(IX+$00)
Skip moving "up" if the offset is OFF.
ED7E LD A,($EDF0) Jump to WriteAttributeToScreen if *GameOver_Y_Offset is equal to 00.
ED81 CP $00
ED83 JR Z,WriteAttributeToScreen
Else, move up one row.
ED85 SBC HL,DE Subtract 0020 from the drawing pointer.
WriteAttributeToScreen ED87 LD (HL),C Write the attribute value to *HL.
ED88 INC IX Move the data pointer to the next item of data.
Movement_Loop ED8A LD B,(IX+$00) Load the repeat count into B.
ED8D INC IX
ED8F LD A,(IX+$00) Load the direction code into A.
ED92 INC IX Move the data pointer to the next item of data.
ED94 CP $01 Jump to GameOver_Move_Right if the direction code is "right".
ED96 JR Z,GameOver_Move_Right
ED98 CP $02 Jump to GameOver_Move_Left if the direction code is "left".
ED9A JR Z,GameOver_Move_Left
ED9C CP $04 Jump to GameOver_Move_Down if the direction code is "down".
ED9E JR Z,GameOver_Move_Down
EDA0 CP $08 Jump to GameOver_Move_Up if the direction code is "up".
EDA2 JR Z,GameOver_Move_Up
EDA4 CP $00 Return if the terminator has been reached.
EDA6 RET Z
Else, this is a new starting point, so rewind the pointer and jump back to the start of the loop.
EDA7 DEC IX Decrease the data pointer by two.
EDA9 DEC IX
EDAB JR Draw_GameOver_Loop Jump to Draw_GameOver_Loop.
Handle moving right:
GameOver_Move_Right EDAD INC HL Increment the drawing pointer by one (move right).
EDAE LD (HL),C Write the attribute value to *HL.
EDAF CALL Sound_GameOver Call Sound_GameOver.
EDB2 DJNZ GameOver_Move_Right Decrease the repeat counter by one and loop back to GameOver_Move_Right until the repeat counter is zero.
EDB4 JR Movement_Loop Jump to Movement_Loop.
Handle moving left:
GameOver_Move_Left EDB6 DEC HL Decrease the drawing pointer by one (move left).
EDB7 LD (HL),C Write the attribute value to *HL.
EDB8 CALL Sound_GameOver Call Sound_GameOver.
EDBB DJNZ GameOver_Move_Left Decrease the repeat counter by one and loop back to GameOver_Move_Left until the repeat counter is zero.
EDBD JR Movement_Loop Jump to Movement_Loop.
Handle moving down:
GameOver_Move_Down EDBF ADD HL,DE Add 0020 to the drawing pointer (move down).
EDC0 LD (HL),C Write the attribute value to *HL.
EDC1 CALL Sound_GameOver Call Sound_GameOver.
EDC4 DJNZ GameOver_Move_Down Decrease the repeat counter by one and loop back to GameOver_Move_Down until the repeat counter is zero.
EDC6 JR Movement_Loop Jump to Movement_Loop.
Handle moving up:
GameOver_Move_Up EDC8 SBC HL,DE Subtract 0020 from the drawing pointer (move up).
EDCA LD (HL),C Write the attribute value to *HL.
EDCB CALL Sound_GameOver Call Sound_GameOver.
EDCE DJNZ GameOver_Move_Up Decrease the repeat counter by one and loop back to GameOver_Move_Up until the repeat counter is zero.
EDD0 JR Movement_Loop Jump to Movement_Loop.
Prev: ED62 Up: Map Next: EDD2