Prev: E3ED Up: Map Next: E44A
E3EF: Draw Cursor
Used by the routines at DEED, Display_PlayerCursor and F47A.
demo-game-cursor
Draw_Cursor E3EF LD A,($D54A) B=*D54A-01.
E3F2 DEC A
E3F3 LD B,A
E3F4 LD ($E3EB),A Write B to *Cursor_AttributePosition_Y.
E3F7 LD A,($D54B) C=*D54B-01.
E3FA DEC A
E3FB LD C,A
E3FC LD ($E3EC),A Write C to *Cursor_AttributePosition_X.
E3FF CALL Calculate_ScreenBlockAddress Call Calculate_ScreenBlockAddress.
E402 CALL Calculate_AttributeAddress Call Calculate_AttributeAddress.
E405 LD ($E3ED),DE Write the calculated attribute buffer address to *Cursor_AttributePointer.
E409 LD B,$04 B=04.
E40B LD HL,$E3DB HL=SavedAttributesBlock.
E40E EX DE,HL Exchange the DE and HL registers.
Draw_Cursor_0 E40F PUSH BC Stash BC on the stack.
E410 LD BC,$0004 Copy 0004 bytes from *HL to *DE.
E413 LDIR
E415 LD BC,$001C HL+=001C.
E418 ADD HL,BC
E419 POP BC Restore BC from the stack.
E41A 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.
E41C LD HL,$E4BA Copy 0004 bytes from CursorAttributes to *Cursor_AttributePointer.
E41F LD DE,($E3ED)
E423 LD BC,$0004
E426 LDIR
Paint the middle section of the cursor.
E428 LD B,$02 B=02.
Draw_Cursor_Loop E42A PUSH BC Stash BC on the stack.
E42B EX DE,HL Exchange the DE and HL registers.
E42C LD BC,$001C HL+=001C.
E42F ADD HL,BC
E430 EX DE,HL Exchange the DE and HL registers.
E431 LD A,(HL) Write *HL to *DE.
E432 LD (DE),A
E433 INC HL Increment HL by one.
E434 INC DE Increment DE by three.
E435 INC DE
E436 INC DE
E437 LD A,(HL) Write *HL to *DE.
E438 LD (DE),A
E439 INC HL Increment HL by one.
E43A INC DE Increment DE by one.
E43B POP BC Restore BC from the stack.
E43C DJNZ Draw_Cursor_Loop Decrease counter by one and loop back to Draw_Cursor_Loop until counter is zero.
E43E EX DE,HL Exchange the DE and HL registers.
E43F LD BC,$001C HL+=001C.
E442 ADD HL,BC
E443 EX DE,HL Exchange the DE and HL registers.
Paint the bottom section of the cursor.
E444 LD BC,$0004 Copy 0004 bytes from *HL to *DE.
E447 LDIR
E449 RET Return.
Prev: E3ED Up: Map Next: E44A