Prev: $15B3 Up: Map Next: $169B
$1640: Check whether ERIC is standing on a boy
Used by the routine at $189D.
Output
P Carry flag set if ERIC is standing on a boy
$1640 LDA #$0B There are 11 little boys.
$1642 STA $57 Store this counter at $57.
$1644 LDA $FB Pick up ERIC's y-coordinate from $FB, store a copy at $D4 and increment it. If ERIC is standing on a boy, this would be the boy's y-coordinate.
$1646 STA $D4
$1648 INC $D4
$164A LDA $FC Pick up ERIC's x-coordinate from $FC and store a copy at $D3.
$164C STA $D3
$164E LDA #$00 Set the current character number at $60 to $00 (little boy no. 1).
$1650 STA $60
$1652 JSR $1662 Is ERIC standing on any of the little boys?
$1655 BCC $165A Branch if not.
$1657 JMP $169A Otherwise return with the carry flag set.
$165A LDA #$03 There are three main kids besides ERIC: ANGELFACE, BOY WONDER and EINSTEIN.
$165C STA $57 Store this counter at $57.
$165E LDA #$0F Set the current character number at $60 to $0F (ANGELFACE).
$1660 STA $60
$1662 JSR $3279 Copy the current character's buffer to page 0.
$1665 LDA $D4 Pick up the y-coordinate from $D4.
$1667 CMP $FB Does it match the character's y-coordinate?
$1669 BNE $168E Branch if not.
$166B DEC $D3 Decrement the x-coordinate at $D3.
$166D LDA $FC Pick up the character's x-coordinate from $FC.
$166F CMP $D3 Is the character's x-coordinate smaller?
$1671 BCC $168E Branch if so (without restoring the x-coordinate at $D3 to its original value, which is a bug).
$1673 INC $D3 Add two to the x-coordinate at $D3 and pick up its new value.
$1675 INC $D3
$1677 LDA $D3
$1679 CMP $FC Is the character's x-coordinate greater?
$167B BCC $168E Branch if so (without restoring the x-coordinate at $D3 to its original value, which is a bug).
$167D LDA $26 Pick up the boy's animatory state from $26.
$167F AND #$0F Keep only bits 0-3.
$1681 CMP #$07 Is the boy lying flat on his back?
$1683 BNE $168E Branch if not.
$1685 LDA #$14 Character number $14 is ERIC.
$1687 JSR $3279 Copy ERIC's character buffer into page 0.
$168A SEC Set the carry flag: ERIC is standing on a boy.
$168B JMP $169A Return.
$168E INC $60 Increment the current character number at $60.
$1690 DEC $57 Decrement the character counter at $57.
$1692 BNE $1662 Branch back to check any remaining boys.
$1694 LDA #$14 Character number $14 is ERIC.
$1696 JSR $3279 Copy ERIC's character buffer into page 0.
$1699 CLC Clear the carry flag: ERIC is not standing on a boy.
$169A RTS
Prev: $15B3 Up: Map Next: $169B