![]() |
Routines |
| Prev: AA94 | Up: Map | Next: AB98 |
|
Used by the routine at UpdateMapObjects.
Checks whether the ship can pick up an object. A type 1E object can only be picked up when its item number is the one that is wanted at F602; objects with an item number of 0A can never be picked up. CheckItemPickup_Touch does the pick up if the ship is touching the object.
|
||||||||
| CheckItemPickup | AAD7 | LD A,(IX+$00) | The type. | |||||
| AADA | CP $1E | Jump to CheckItemPickup_Kind if A is not 1E. | ||||||
| AADC | JR NZ,CheckItemPickup_Kind | |||||||
| AADE | LD A,($F5EE) | The first part flag. | ||||||
| AAE1 | AND A | Return if A is zero. | ||||||
| AAE2 | RET Z | |||||||
| AAE3 | LD A,(IX+$13) | The state. | ||||||
| AAE6 | AND %00001111 | Keep the bits of A that are set in 0F. | ||||||
| AAE8 | LD B,A | B=A. | ||||||
| AAE9 | LD A,($F602) | The crystal count. | ||||||
| AAEC | CP B | Return if A is not B. | ||||||
| AAED | RET NZ | |||||||
| AAEE | LD (IX+$0D),$FA | Store FA at offset 0D of IX. | ||||||
| CheckItemPickup_Kind | AAF2 | LD A,(IX+$13) | The state. | |||||
| AAF5 | AND %00001111 | Keep the bits of A that are set in 0F. | ||||||
| AAF7 | CP $0A | Return if A is 0A. | ||||||
| AAF9 | RET Z | |||||||
| AAFA | CP $09 | Jump to CheckItemPickup_Touch if A is not 09. | ||||||
| AAFC | JR NZ,CheckItemPickup_Touch | |||||||
| AAFE | LD A,($F5F6) | The ninth part flag. | ||||||
| AB01 | AND A | Return if A is zero. | ||||||
| AB02 | RET Z | |||||||
|
Test whether the ship is touching the object, and give up if the object is not on the screen.
|
||||||||
| CheckItemPickup_Touch | AB03 | LD A,($A1D7) | The rows of the first sprite. | |||||
| AB06 | AND A | Return if A is zero. | ||||||
| AB07 | RET Z | |||||||
| AB08 | LD ($ABA7),A | The height of the collision box. | ||||||
| AB0B | LD HL,($A1D3) | Fetch the word at SpritePositions into HL. | ||||||
| AB0E | LD A,H | A=H. | ||||||
| AB0F | CP $28 | Return if A is less than 28. | ||||||
| AB11 | RET C | |||||||
| AB12 | LD A,L | A=L. | ||||||
| AB13 | CP $30 | Return if A is less than 30. | ||||||
| AB15 | RET C | |||||||
| AB16 | CP $90 | Return if A is 90 or more. | ||||||
| AB18 | RET NC | |||||||
| AB19 | LD ($ABA4),HL | Update the collision box. | ||||||
| AB1C | LD A,($5C28) | The sprite width in bytes. | ||||||
| AB1F | ADD A,A | Double A. | ||||||
| AB20 | ADD A,A | Double A. | ||||||
| AB21 | ADD A,A | Double A. | ||||||
| AB22 | LD ($ABA6),A | The width of the collision box. | ||||||
| AB25 | LD HL,($C902) | Fetch the word at C902 into HL. | ||||||
| AB28 | LD L,$70 | L=70. | ||||||
| AB2A | LD D,$10 | D=10. | ||||||
| AB2C | LD A,($C1A9) | The height of the ship. | ||||||
| AB2F | SUB $0A | Subtract 0A from A. | ||||||
| AB31 | LD E,A | E=A. | ||||||
|
Test the box of the object against a box around the ship.
|
||||||||
| AB32 | CALL TestBoxAgainstShip | Call TestBoxAgainstShip. | ||||||
| AB35 | LD A,($5C1C) | The hit flag. | ||||||
| AB38 | AND A | Return if A is zero. | ||||||
| AB39 | RET Z | |||||||
|
The ship has picked the object up: play a sound, score 03E8 points, then record the item that is now carried.
|
||||||||
| AB3A | CALL PlayPickUpSound | Call PlayPickUpSound. | ||||||
| AB3D | LD BC,$1000 | BC=1000. | ||||||
| AB40 | CALL AddToScore | Call AddToScore. | ||||||
| AB43 | LD A,(IX+$00) | The type. | ||||||
| AB46 | CP $1E | Jump to CheckItemPickup_Site if A is not 1E. | ||||||
| AB48 | JR NZ,CheckItemPickup_Site | |||||||
| AB4A | LD A,(IX+$13) | The state. | ||||||
| AB4D | AND %00001111 | Keep the bits of A that are set in 0F. | ||||||
| AB4F | OR %11000000 | Set the bits of A that are set in C0. | ||||||
| AB51 | LD ($C904),A | Update the item the ship is about to pick up. | ||||||
| AB54 | LD HL,$F630 | The twelfth item site. | ||||||
| AB57 | AND %00001111 | Keep the bits of A that are set in 0F. | ||||||
| AB59 | LD ($F601),A | Update the carried item. | ||||||
| AB5C | JR CheckItemPickup_Record | Jump to CheckItemPickup_Record. | ||||||
|
The object is not type 1E: the item is recorded in the table of item sites at ItemSites and the carried item at C904 is set to its number.
|
||||||||
| CheckItemPickup_Site | AB5E | LD A,(IX+$13) | The state. | |||||
| AB61 | INC A | Advance A. | ||||||
| AB62 | LD ($C904),A | Update the item the ship is about to pick up. | ||||||
| AB65 | DEC A | Step A back. | ||||||
| AB66 | LD HL,$F604 | The item sites. | ||||||
|
Set bit 7 of the record for the item, remove the object from the screen and free its slot.
|
||||||||
| CheckItemPickup_Record | AB69 | ADD A,A | Double A. | |||||
| AB6A | ADD A,A | Double A. | ||||||
| AB6B | CALL AddAToHL | Call AddAToHL. | ||||||
| AB6E | SET 7,(HL) | Set bit 7 of the byte at the address in HL. | ||||||
| AB70 | SET 4,(IX+$10) | Set bit 4 of offset 10 of IX. | ||||||
| AB74 | LD (IX+$00),$FF | Store FF at offset 00 of IX. | ||||||
| AB78 | LD A,(IX+$13) | The state. | ||||||
| AB7B | CP $09 | Return if A is not 09. | ||||||
| AB7D | RET NZ | |||||||
|
Item number 09 is special.
|
||||||||
| CheckItemPickup_Special | AB7E | XOR A | Clear A. | |||||
| AB7F | LD ($C904),A | Update the item the ship is about to pick up. | ||||||
| AB82 | LD ($C279),A | The pieces beside the ship are cleared. | ||||||
| AB85 | LD A,$09 | A=09. | ||||||
| AB87 | LD ($F5F7),A | Update the flag set when item 09 has been picked up. | ||||||
| AB8A | LD A,($A89D) | Bit 4 of the sixth map object's flags. | ||||||
| AB8D | OR %00010000 | Set the bits of A that are set in 10. | ||||||
| AB8F | LD ($A89D),A | Bit 4 of the sixth map object's flags. | ||||||
| AB92 | LD HL,$F62C | The eleventh item site. | ||||||
| AB95 | SET 7,(HL) | Set bit 7 of the byte at the address in HL. | ||||||
| AB97 | RET | Return. | ||||||
| Prev: AA94 | Up: Map | Next: AB98 |