Prev: 46463 Up: Map Next: 46560
46490: Draw objects in Magic Knight's inventory if he is carrying the Mirror
Used by the routine at 38780.
46490 LD A,20 If Magic Knight is not carrying the Mirror (20)...
46492 CALL 45510 ...
46495 RET NZ ...then return
46496 LD HL,24848 Point HL at start of Magic Knight's current inventory (carrying)
46499 LD B,5 Load B with 5 (five inventory slots)
46501 LD DE,528 Load DE with x- and y-coordinates respectively to start drawing object graphics (D, or x = 2, E, or y = 16)
46504 PUSH BC Store BC (B = remaining number of inventory slots to process)
46505 PUSH HL Store HL (pointer to current position in Magic Knight's current inventory)
46506 PUSH DE Store DE (coordinates in characters to draw object)
46507 LD A,(HL) Load index of object in current slot in Magic Knight's inventory into A
46508 OR A If this is zero...
46509 JR Z,46556 ...then restore registers and return
46511 LD E,6 Load 6 (index of objects' attribute property) into E
46513 CALL 45390 Point HL at the attribute property of the object in the current inventory slot
46516 LD A,(HL) Store attribute at 23695...
46517 LD (23695),A ...
46520 INC HL Advance HL to point to graphic index property...
46521 LD A,(HL) ...and load into A
46522 POP BC Restore BC (coordinates in characters to draw object, was in DE)
46523 PUSH BC Store BC (coordinates in characters to draw object)
46524 PUSH BC Store BC (coordinates in characters to draw object)
46525 CALL 63499 Draw 2 × 2 graphic with lookup index A at character coordinates (C, B)
46528 POP BC Restore BC (coordinates in characters to draw object)
46529 CALL 63219 Load HL with attribute file address for coordinates (C, B)
46532 LD A,(23695) Load A with attribute stored at 23695...
46535 LD (HL),A ...and apply this attribute to attribute file at coordinates (C, B)...
46536 INC HL ...
46537 LD (HL),A ...(C + 1, B)...
46538 LD BC,31 ...
46541 ADD HL,BC ...
46542 LD (HL),A ...(C, B + 1)...
46543 INC HL ...
46544 LD (HL),A ...and (C + 1, B + 1)
46545 POP DE Restore DE (coordinates in characters to draw object)
46546 LD A,E Advance right by three characters (i.e. add three to x-coordinate in E)...
46547 ADD A,3 ...
46549 LD E,A ...
46550 POP HL Restore HL (pointer to current position in Magic Knight's current inventory)
46551 INC HL Advance HL to next inventory slot
46552 POP BC Restore BC (B = remaining number of inventory slots to process)
46553 DJNZ 46504 Decrease B, and loop back to 46504 if not zero
46555 RET Return
46556 POP DE Restore DE (coordinates in characters to draw object)
46557 POP HL Restore HL (pointer to current position in Magic Knight's current inventory)
46558 POP BC Restore BC (B = remaining number of inventory slots to process)
46559 RET Return
Prev: 46463 Up: Map Next: 46560