Prev: 58109 Up: Map Next: 58194
58144: Handler: Home Arrow
Used by the routines at Handler_Bombs and 63489.
To indicate when the cursor is "docked", the home box cycles through a bunch of attribute values:
home-arrow-animation
Handler_HomeArrow 58144 LD HL,59029 Point HL at HomeArrowAttributes where the attributes are stored.
Validate the attribute offset value.
58147 LD A,(55350) Jump to HomeArrow_SkipReset if *HomeArrow_AttributeTable_Offset is not equal to 14.
58150 CP 14
58152 JR NZ,HomeArrow_SkipReset
If *HomeArrow_AttributeTable_Offset is at the end of the table, reset it back to 0.
58154 LD A,0 Reset *HomeArrow_AttributeTable_Offset back to the first colour.
58156 LD (55350),A
Fetch the attribute value using the offset.
HomeArrow_SkipReset 58159 LD C,A Create an offset in BC against the arrow attribute table.
58160 LD B,0
58162 ADD HL,BC Add the offset to the arrow attribute table pointer.
58163 LD A,(HL) Fetch the attribute byte from the table and store it in A.
58164 CALL ColouriseHome Call ColouriseHome.
58167 HALT Halt operation (suspend CPU until the next interrupt).
Move the attribute offset to the next value in the attribute table.
58168 LD HL,55350 HL=HomeArrow_AttributeTable_Offset.
58171 INC (HL) Increment the attribute offset value to the next colour value.
Set up playing a sound.
58172 LD A,(HL) Multiply the attribute offset value by 4 and store the result in C.
58173 RLCA
58174 RLCA
58175 LD C,A
58176 LD B,6 Set a counter in B for the number of times to make the sound.
58178 LD A,5 Set the initial border/ speaker state in A.
HomeArrow_Sound_Loop 58180 OUT (254),A Set the border colour/ play sound.
58182 XOR %00010000 Flip the speaker bit.
58184 PUSH BC Stash the loop counter on the stack.
58185 LD B,C Set the delay counter to the value held in REGc.
HomeArrow_Sound_Delay 58186 DJNZ HomeArrow_Sound_Delay Decrease the delay counter by one and loop back to HomeArrow_Sound_Delay until the delay counter is zero.
58188 POP BC Restore the loop counter from the stack.
58189 DJNZ HomeArrow_Sound_Loop Decrease the loop counter by one and loop back to HomeArrow_Sound_Loop until the loop counter is zero.
58191 JP Handler_CheckTime Jump to Handler_CheckTime.
Prev: 58109 Up: Map Next: 58194