Prev: E2FD Up: Map Next: E352
E320: Handler: Home Arrow
Used by the routines at Handler_Bombs and F801.
To indicate when the cursor is "docked", the home box cycles through a bunch of attribute values:
home-arrow-animation
Handler_HomeArrow E320 LD HL,$E695 Point HL at HomeArrowAttributes where the attributes are stored.
Validate the attribute offset value.
E323 LD A,($D836) Jump to HomeArrow_SkipReset if *HomeArrow_AttributeTable_Offset is not equal to 0E.
E326 CP $0E
E328 JR NZ,HomeArrow_SkipReset
If *HomeArrow_AttributeTable_Offset is at the end of the table, reset it back to 00.
E32A LD A,$00 Reset *HomeArrow_AttributeTable_Offset back to the first colour.
E32C LD ($D836),A
Fetch the attribute value using the offset.
HomeArrow_SkipReset E32F LD C,A Create an offset in BC against the arrow attribute table.
E330 LD B,$00
E332 ADD HL,BC Add the offset to the arrow attribute table pointer.
E333 LD A,(HL) Fetch the attribute byte from the table and store it in A.
E334 CALL ColouriseHome Call ColouriseHome.
E337 HALT Halt operation (suspend CPU until the next interrupt).
Move the attribute offset to the next value in the attribute table.
E338 LD HL,$D836 HL=HomeArrow_AttributeTable_Offset.
E33B INC (HL) Increment the attribute offset value to the next colour value.
Set up playing a sound.
E33C LD A,(HL) Multiply the attribute offset value by 04 and store the result in C.
E33D RLCA
E33E RLCA
E33F LD C,A
E340 LD B,$06 Set a counter in B for the number of times to make the sound.
E342 LD A,$05 Set the initial border/ speaker state in A.
HomeArrow_Sound_Loop E344 OUT ($FE),A Set the border colour/ play sound.
E346 XOR %00010000 Flip the speaker bit.
E348 PUSH BC Stash the loop counter on the stack.
E349 LD B,C Set the delay counter to the value held in REGc.
HomeArrow_Sound_Delay E34A DJNZ HomeArrow_Sound_Delay Decrease the delay counter by one and loop back to HomeArrow_Sound_Delay until the delay counter is zero.
E34C POP BC Restore the loop counter from the stack.
E34D DJNZ HomeArrow_Sound_Loop Decrease the loop counter by one and loop back to HomeArrow_Sound_Loop until the loop counter is zero.
E34F JP Handler_CheckTime Jump to Handler_CheckTime.
Prev: E2FD Up: Map Next: E352