![]() |
Routines |
| Prev: CB92 | Up: Map | Next: CD26 |
|
Used by the routine at FF5B.
|
||||
| CB93 | LD A,($CD32) | Has the bucket been collected? | ||
| CB96 | OR A | |||
| CB97 | JR Z,$CBC3 | Jump forward if so. | ||
|
The bucket is animated after 4 calls to this routine.
|
||||
| CB99 | LD A,($CD33) | Decrement the tick counter. | ||
| CB9C | DEC A | |||
| CB9D | LD ($CD33),A | |||
| CBA0 | JR NZ,$CBC3 | Jump forward if the counter hasn't reached 0. | ||
| CBA2 | LD A,$03 | Otherwise reset it to 3. | ||
| CBA4 | LD ($CD33),A | |||
| CBA7 | LD A,($CD34) | Increment the frame counter for the bucket. | ||
| CBAA | INC A | |||
| CBAB | AND $03 | If the counter reaches 3, reset it to 0. | ||
| CBAD | LD ($CD34),A | |||
| CBB0 | CALL $CD26 | Convert into an offset. | ||
| CBB3 | LD HL,$6000 | Add to the base address of the bucket (6000). | ||
| CBB6 | ADD HL,DE | |||
| CBB7 | LD ($ECE0),HL | Next graphic to print | ||
| CBBA | LD HL,$4F2F | Set Location to print. | ||
| CBBD | LD ($ECDE),HL | |||
| CBC0 | CALL $EBE0 | |||
| CBC3 | LD A,($CD32) | Has the bucket been collected? | ||
| CBC6 | OR A | |||
| CBC7 | JR NZ,$CC13 | Jump forward if not. | ||
|
As the bucket has been collected, the miner needs to chase Monty.
|
||||
| CBC9 | LD A,($CD35) | Increment the miner's X co-ordinate (CD35). | ||
| CBCC | INC A | |||
| CBCD | LD ($CD35),A | |||
| CBD0 | LD HL,$6080 | 6080 - base address of miner graphic. | ||
| CBD3 | LD A,($CD36) | Get the frame ID of the miner. | ||
| CBD6 | CALL $CD26 | Get the actual graphic offset in DE. | ||
| CBD9 | PUSH DE | Remember the offset. | ||
| CBDA | ADD HL,DE | Add this to the base address. | ||
| CBDB | LD ($ECE0),HL | Store the graphic to copy. | ||
| CBDE | LD A,($CD35) | Store the X co-ordinate. | ||
| CBE1 | LD ($ECDE),A | |||
| CBE4 | LD A,$5F | Y co-ordinate is always 5F. | ||
| CBE6 | LD ($ECDF),A | |||
| CBE9 | CALL $EBE0 | Draw the graphic. | ||
| CBEC | LD HL,$6100 | Point HL to the bottom half of the graphic. | ||
| CBEF | POP DE | Restore the offset. | ||
| CBF0 | ADD HL,DE | Add the offset. | ||
| CBF1 | LD ($ECE0),HL | Store the graphic to copy. | ||
| CBF4 | LD A,$4F | Y co-ordinate is always 4F. | ||
| CBF6 | LD ($ECDF),A | |||
| CBF9 | CALL $EBE0 | Draw the graphic. | ||
|
The miner is animated after 4 calls to this routine.
|
||||
| CBFC | LD A,($CD37) | Decrement the frame counter. | ||
| CBFF | DEC A | |||
| CC00 | LD ($CD37),A | |||
| CC03 | JR NZ,$CC13 | Jump forward if it is not 0. | ||
| CC05 | LD A,$03 | Otherwise set it back to 3. | ||
| CC07 | LD ($CD37),A | |||
| CC0A | LD A,($CD36) | Increment the animination frame for the miner, but if it reaches 4, reset it to 0. | ||
| CC0D | INC A | |||
| CC0E | AND $03 | |||
| CC10 | LD ($CD36),A | |||
|
Draw the squirrel, and if necessary, a nut.
|
||||
| CC13 | LD A,($CD38) | Get the direction. | ||
| CC16 | CP $FF | Is it left? | ||
| CC18 | JR Z,$CC6E | Jump forward if so. | ||
|
The squirrel is moving right.
|
||||
| CC1A | LD A,($CD39) | Increment the X co-ordinate. | ||
| CC1D | INC A | |||
| CC1E | LD ($CD39),A | |||
| CC21 | LD A,($CD3A) | Decrement the frame counter. | ||
| CC24 | DEC A | |||
| CC25 | LD ($CD3A),A | |||
| CC28 | LD A,($CD3B) | Get the animation frame for the squirrel. | ||
| CC2B | JR NZ,$CC3B | Jump forward if it is not 0. | ||
| CC2D | LD A,$03 | Otherwise set it back to 3. | ||
| CC2F | LD ($CD3A),A | |||
| CC32 | LD A,($CD3B) | Increment the animination frame for the squirrel, but if it reaches 4, reset it to 0. | ||
| CC35 | INC A | |||
| CC36 | AND $03 | |||
| CC38 | LD ($CD3B),A | |||
| CC3B | CALL $CD26 | Convert the graphic ID into a screen offset. | ||
| CC3E | LD HL,$6200 | Base address of the squirrel - left (6200). | ||
| CC41 | ADD HL,DE | Add the offset. | ||
| CC42 | LD ($ECE0),HL | Store the graphic to copy. | ||
| CC45 | LD A,($CD39) | Store the X co-ordinate. | ||
| CC48 | LD ($ECDE),A | |||
| CC4B | LD A,$AF | Y co-ordinate is always AF. | ||
| CC4D | LD ($ECDF),A | |||
| CC50 | CALL $EBE0 | Draw the graphic. | ||
| CC53 | LD A,($CD39) | Has the squirrel reached the tree trunk? | ||
| CC56 | CP $80 | |||
| CC58 | JR NZ,$CCA9 | Jump forward if not. | ||
| CC5A | DEC A | Otherwise set the X co-ordinate to the maximum of 7F. | ||
| CC5B | LD ($CD39),A | |||
| CC5E | LD A,($CD3C) | Is there a nut? | ||
| CC61 | OR A | |||
| CC62 | JR NZ,$CCA9 | Jump forward if not. | ||
|
The squirrel has reached the trunk, drop a nut.
|
||||
| CC64 | LD A,($CD38) | Invert the direction from right to left. | ||
| CC67 | NEG | |||
| CC69 | LD ($CD38),A | |||
| CC6C | JR $CCA9 | Jump forward. | ||
|
The squirrel is moving left.
|
||||
| CC6E | LD A,($CD39) | Decrement the X co-ordinate. | ||
| CC71 | DEC A | |||
| CC72 | LD ($CD39),A | |||
| CC75 | LD A,($CD3A) | Decrement the frame counter. | ||
| CC78 | DEC A | |||
| CC79 | LD ($CD3A),A | |||
| CC7C | LD A,($CD3B) | Get the animation frame for the squirrel. | ||
| CC7F | JR NZ,$CC8F | Jump forward if the counter is not 0. | ||
| CC81 | LD A,$03 | Otherwise reset to 3. | ||
| CC83 | LD ($CD3A),A | |||
| CC86 | LD A,($CD3B) | Get the animation frame for the squirrel. | ||
| CC89 | INC A | Increment the frame, but if it reaches 4, reset to 0. | ||
| CC8A | AND $03 | |||
| CC8C | LD ($CD3B),A | |||
| CC8F | CALL $CD26 | Get the graphic offset. | ||
| CC92 | LD HL,$6280 | Base address of the squirrel - right (6280). | ||
| CC95 | LD A,($CD39) | Get the X co-ordinate. | ||
| CC98 | CP $70 | Has the squirrel reached the end of the branch? | ||
| CC9A | JR NZ,$CC41 | Jump if not. | ||
| CC9C | LD A,($CD38) | Change the direction from left to right. | ||
| CC9F | NEG | |||
| CCA1 | LD ($CD38),A | |||
| CCA4 | LD ($CD3C),A | Signal that a nut should be dropped and loop back to draw the squirrel. | ||
| CCA7 | JR $CC41 | |||
|
Draw the nut if it exists.
|
||||
| CCA9 | LD A,($CD3C) | Is there a nut? | ||
| CCAC | OR A | |||
| CCAD | RET Z | Return if not, nothing more to do. | ||
| CCAE | LD A,($CD3D) | Is the nut exploding? | ||
| CCB1 | OR A | |||
| CCB2 | JR NZ,$CCD6 | Jump forward if so. | ||
| CCB4 | LD A,($CD3E) | Decrement the height of the nut by 1. | ||
| CCB7 | DEC A | |||
| CCB8 | LD ($CD3E),A | |||
| CCBB | LD HL,$6300 | Base address of the nut (6300). | ||
| CCBE | LD ($ECE0),HL | Store graphic to copy. | ||
| CCC1 | LD ($ECDF),A | Store the Y co-ordinate. | ||
| CCC4 | LD A,$68 | X co-ordinate is always 68. | ||
| CCC6 | LD ($ECDE),A | |||
| CCC9 | CALL $EBE0 | Draw the graphic. | ||
| CCCC | LD A,($CD3E) | Has the nut reached the floor? | ||
| CCCF | CP $4F | |||
| CCD1 | RET NZ | Return if not, nothing more to do. | ||
| CCD2 | LD ($CD3D),A | Set the flag (CD3D) to denote the nut should now explode and return. | ||
| CCD5 | RET | |||
|
The nut has reached the floor and should explode.
|
||||
| CCD6 | LD A,($CD3F) | Decrement the timer. | ||
| CCD9 | DEC A | |||
| CCDA | LD ($CD3F),A | |||
| CCDD | RET NZ | Return if the timer is not yet zero. | ||
| CCDE | LD A,$03 | Otherwise restore to 3. | ||
| CCE0 | LD ($CD3F),A | |||
| CCE3 | LD A,($CD40) | Increment the graphic ID, but if it reaches 4, reset to 0. | ||
| CCE6 | INC A | |||
| CCE7 | AND $03 | |||
| CCE9 | LD ($CD40),A | |||
| CCEC | JR Z,$CD0A | If the last frame was reached, the nut has gone. | ||
| CCEE | LD A,($CD3E) | Otherwise store the Y co-ordinate (was 4F). | ||
| CCF1 | LD ($ECDF),A | |||
| CCF4 | LD A,$68 | X co-ordinate is always 68. | ||
| CCF6 | LD ($ECDE),A | |||
| CCF9 | LD A,($CD40) | Get the graphic ID. | ||
| CCFC | CALL $CD26 | Convert this to an offset. | ||
| CCFF | LD HL,$6300 | 6300 is the base address for the nut graphic. | ||
| CD02 | ADD HL,DE | Add the offset. | ||
| CD03 | LD ($ECE0),HL | Store this as the graphic to copy. | ||
| CD06 | CALL $EBE0 | Draw the graphic and return. | ||
| CD09 | RET | |||
|
The nut exploded and is no more.
|
||||
| CD0A | XOR A | Set A to 0 to clear some flags. | ||
| CD0B | LD ($CD3C),A | Squirrel is not dropping a nut. | ||
| CD0E | LD ($CD3D),A | Nut will be falling when next dropped. | ||
| CD11 | LD HL,$7780 | 7780 is the empty graphic. | ||
| CD14 | LD ($ECE0),HL | Store the graphic to copy. | ||
| CD17 | LD HL,$4F68 | Erase the graphic at 68 4F. | ||
| CD1A | LD ($ECDE),HL | Store the co-ordinates. | ||
| CD1D | CALL $EBE0 | Print the graphic. | ||
| CD20 | LD A,$9F | Set the nut back to the top of the tree and return. | ||
| CD22 | LD ($CD3E),A | |||
| CD25 | RET | |||
| Prev: CB92 | Up: Map | Next: CD26 |