Prev: 58850 Up: Map Next: 58943
58852: Draw Cursor
Used by the routines at 58262, Display_PlayerCursor and 63581.
game-cursor
Draw_Cursor 58852 LD A,(55342) B=*PlayerCursor_Y_Position-1.
58855 DEC A
58856 LD B,A
58857 LD (58848),A Write B to *Cursor_AttributePosition_Y.
58860 LD A,(55343) C=*PlayerCursor_X_Position-1.
58863 DEC A
58864 LD C,A
58865 LD (58849),A Write C to *Cursor_AttributePosition_X.
58868 CALL Calculate_ScreenBlockAddress Call Calculate_ScreenBlockAddress.
58871 CALL Calculate_AttributeAddress Call Calculate_AttributeAddress.
58874 LD (58850),DE Write the calculated attribute buffer address to *Cursor_AttributePointer.
58878 LD B,4 B=4.
58880 LD HL,58832 HL=SavedAttributesBlock.
58883 EX DE,HL Exchange the DE and HL registers.
Draw_Cursor_0 58884 PUSH BC Stash BC on the stack.
58885 LD BC,4 Copy 0004 bytes from *HL to *DE.
58888 LDIR
58890 LD BC,28 HL+=0028.
58893 ADD HL,BC
58894 POP BC Restore BC from the stack.
58895 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.
58897 LD HL,59055 Copy 0004 bytes from CursorAttributes to *Cursor_AttributePointer.
58900 LD DE,(58850)
58904 LD BC,4
58907 LDIR
Paint the middle section of the cursor.
58909 LD B,2 B=2.
Draw_Cursor_Loop 58911 PUSH BC Stash BC on the stack.
58912 EX DE,HL Exchange the DE and HL registers.
58913 LD BC,28 HL+=0028.
58916 ADD HL,BC
58917 EX DE,HL Exchange the DE and HL registers.
58918 LD A,(HL) Write *HL to *DE.
58919 LD (DE),A
58920 INC HL Increment HL by one.
58921 INC DE Increment DE by three.
58922 INC DE
58923 INC DE
58924 LD A,(HL) Write *HL to *DE.
58925 LD (DE),A
58926 INC HL Increment HL by one.
58927 INC DE Increment DE by one.
58928 POP BC Restore BC from the stack.
58929 DJNZ Draw_Cursor_Loop Decrease counter by one and loop back to Draw_Cursor_Loop until counter is zero.
58931 EX DE,HL Exchange the DE and HL registers.
58932 LD BC,28 HL+=0028.
58935 ADD HL,BC
58936 EX DE,HL Exchange the DE and HL registers.
Paint the bottom section of the cursor.
58937 LD BC,4 Copy 0004 bytes from *HL to *DE.
58940 LDIR
58942 RET Return.
Prev: 58850 Up: Map Next: 58943