Prev: E5E2 Up: Map Next: E63F
E5E4: Draw Cursor
Used by the routines at E396, Display_PlayerCursor and F85D.
game-cursor
Draw_Cursor E5E4 LD A,($D82E) B=*PlayerCursor_Y_Position-01.
E5E7 DEC A
E5E8 LD B,A
E5E9 LD ($E5E0),A Write B to *Cursor_AttributePosition_Y.
E5EC LD A,($D82F) C=*PlayerCursor_X_Position-01.
E5EF DEC A
E5F0 LD C,A
E5F1 LD ($E5E1),A Write C to *Cursor_AttributePosition_X.
E5F4 CALL Calculate_ScreenBlockAddress Call Calculate_ScreenBlockAddress.
E5F7 CALL Calculate_AttributeAddress Call Calculate_AttributeAddress.
E5FA LD ($E5E2),DE Write the calculated attribute buffer address to *Cursor_AttributePointer.
E5FE LD B,$04 B=04.
E600 LD HL,$E5D0 HL=SavedAttributesBlock.
E603 EX DE,HL Exchange the DE and HL registers.
Draw_Cursor_0 E604 PUSH BC Stash BC on the stack.
E605 LD BC,$0004 Copy 0004 bytes from *HL to *DE.
E608 LDIR
E60A LD BC,$001C HL+=001C.
E60D ADD HL,BC
E60E POP BC Restore BC from the stack.
E60F DJNZ Draw_Cursor_0 Decrease counter by one and loop back to Draw_Cursor_0 until counter is zero.
Paint the top section of the cursor.
E611 LD HL,$E6AF Copy 0004 bytes from CursorAttributes to *Cursor_AttributePointer.
E614 LD DE,($E5E2)
E618 LD BC,$0004
E61B LDIR
Paint the middle section of the cursor.
E61D LD B,$02 B=02.
Draw_Cursor_Loop E61F PUSH BC Stash BC on the stack.
E620 EX DE,HL Exchange the DE and HL registers.
E621 LD BC,$001C HL+=001C.
E624 ADD HL,BC
E625 EX DE,HL Exchange the DE and HL registers.
E626 LD A,(HL) Write *HL to *DE.
E627 LD (DE),A
E628 INC HL Increment HL by one.
E629 INC DE Increment DE by three.
E62A INC DE
E62B INC DE
E62C LD A,(HL) Write *HL to *DE.
E62D LD (DE),A
E62E INC HL Increment HL by one.
E62F INC DE Increment DE by one.
E630 POP BC Restore BC from the stack.
E631 DJNZ Draw_Cursor_Loop Decrease counter by one and loop back to Draw_Cursor_Loop until counter is zero.
E633 EX DE,HL Exchange the DE and HL registers.
E634 LD BC,$001C HL+=001C.
E637 ADD HL,BC
E638 EX DE,HL Exchange the DE and HL registers.
Paint the bottom section of the cursor.
E639 LD BC,$0004 Copy 0004 bytes from *HL to *DE.
E63C LDIR
E63E RET Return.
Prev: E5E2 Up: Map Next: E63F