Prev: 58349 Up: Map Next: 58442
58351: Draw Cursor
Used by the routines at 57069, Display_PlayerCursor and 62586.
demo-game-cursor
Draw_Cursor 58351 LD A,(54602) B=*54602-1.
58354 DEC A
58355 LD B,A
58356 LD (58347),A Write B to *Cursor_AttributePosition_Y.
58359 LD A,(54603) C=*54603-1.
58362 DEC A
58363 LD C,A
58364 LD (58348),A Write C to *Cursor_AttributePosition_X.
58367 CALL Calculate_ScreenBlockAddress Call Calculate_ScreenBlockAddress.
58370 CALL Calculate_AttributeAddress Call Calculate_AttributeAddress.
58373 LD (58349),DE Write the calculated attribute buffer address to *Cursor_AttributePointer.
58377 LD B,4 B=4.
58379 LD HL,58331 HL=SavedAttributesBlock.
58382 EX DE,HL Exchange the DE and HL registers.
Draw_Cursor_0 58383 PUSH BC Stash BC on the stack.
58384 LD BC,4 Copy 0004 bytes from *HL to *DE.
58387 LDIR
58389 LD BC,28 HL+=0028.
58392 ADD HL,BC
58393 POP BC Restore BC from the stack.
58394 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.
58396 LD HL,58554 Copy 0004 bytes from CursorAttributes to *Cursor_AttributePointer.
58399 LD DE,(58349)
58403 LD BC,4
58406 LDIR
Paint the middle section of the cursor.
58408 LD B,2 B=2.
Draw_Cursor_Loop 58410 PUSH BC Stash BC on the stack.
58411 EX DE,HL Exchange the DE and HL registers.
58412 LD BC,28 HL+=0028.
58415 ADD HL,BC
58416 EX DE,HL Exchange the DE and HL registers.
58417 LD A,(HL) Write *HL to *DE.
58418 LD (DE),A
58419 INC HL Increment HL by one.
58420 INC DE Increment DE by three.
58421 INC DE
58422 INC DE
58423 LD A,(HL) Write *HL to *DE.
58424 LD (DE),A
58425 INC HL Increment HL by one.
58426 INC DE Increment DE by one.
58427 POP BC Restore BC from the stack.
58428 DJNZ Draw_Cursor_Loop Decrease counter by one and loop back to Draw_Cursor_Loop until counter is zero.
58430 EX DE,HL Exchange the DE and HL registers.
58431 LD BC,28 HL+=0028.
58434 ADD HL,BC
58435 EX DE,HL Exchange the DE and HL registers.
Paint the bottom section of the cursor.
58436 LD BC,4 Copy 0004 bytes from *HL to *DE.
58439 LDIR
58441 RET Return.
Prev: 58349 Up: Map Next: 58442