Prev: C481 Up: Map Next: C4DC
C489: Take up a thing the knight touches, if he has room
Used by the routines at OBJECT_LYING and FIND_WANDER.
Called by the update routines of an object lying in the street (OBJECT_LYING) and of a find (FIND_WANDER) when it touches him. The thing goes into the first empty place of the eleven in CARRIED -- an object as 1-4, its graphic less 3, a find as 5-8 -- its record is emptied, and its icon is drawn in its place on the panel, the first place at the bottom and each above the last. With all eleven full nothing is taken, and the thing stays where it is.
KNIGHT_THROWS enters at DRAW_CARRIED to draw a place again after a throw, with 0, the blank icon, for an empty place.
Input
IX the thing's record
PICK_UP_THING C489 LD HL,CARRIED the first empty place; none: nothing is taken
C48C LD B,$0B
PICK_UP_THING_0 C48E LD A,(HL)
C48F AND A
C490 JR Z,PICK_UP_THING_1
C492 INC HL
C493 DJNZ PICK_UP_THING_0
C495 RET
PICK_UP_THING_1 C496 LD A,(IX+$00) an object (graphics 4-7) is thing 1-4; a find goes to PICK_UP_FIND
C499 CP $30
C49B JR NC,PICK_UP_FIND
C49D SUB $03
This entry point is used by the routine at PICK_UP_FIND.
PICK_UP_THING_2 C49F LD (HL),A carried; the record emptied
C4A0 LD (IX+$00),$00
This entry point is used by the routine at KNIGHT_THROWS.
DRAW_CARRIED C4A4 EX DE,HL DRAW_CARRIED: DE = the place; the icons' characters (ICONS)
C4A5 LD HL,ICONS
C4A8 LD (FONT_BASE),HL
C4AB LD A,B the place's number (11 - B) sets the height: 16 pixels a place up from the bottom, 16 in
C4AC NEG
C4AE ADD A,$0B
C4B0 RLCA
C4B1 RLCA
C4B2 RLCA
C4B3 RLCA
C4B4 AND $F0
C4B6 ADD A,$17
C4B8 LD H,A
C4B9 LD L,$10
C4BB CALL CALC_VRAM_ADDR
C4BE LD A,(DE) the thing's four characters, two over two
C4BF ADD A,A
C4C0 ADD A,A
C4C1 PUSH AF
C4C2 CALL PRINT_CODE
C4C5 POP AF
C4C6 INC A
C4C7 INC L
C4C8 PUSH AF
C4C9 CALL PRINT_CODE
C4CC DEC L
C4CD CALL NEXT_CHAR_ROW
C4D0 POP AF
C4D1 INC A
C4D2 PUSH AF
C4D3 CALL PRINT_CODE
C4D6 POP AF
C4D7 INC A
C4D8 INC L
C4D9 JP PRINT_CODE
Prev: C481 Up: Map Next: C4DC