![]() |
Routines |
| Prev: A80B | Up: Map | Next: A8D9 |
|
Used by the routine at DrawShot.
Adds one or two units to the height of the stack at StackHeight (which hangs below the ship) if the item that is carried at F601 is item number 06. The limit is 12. The screen is cleared where the new units will be drawn. This is a best reading of the code. An object with a state of zero does not add anything.
|
||||||||
| AddToStack | A8A5 | LD A,(IX+$13) | Fetch the state of the object. | |||||
| A8A8 | AND A | Return if it is zero. | ||||||
| A8A9 | RET Z | |||||||
|
This entry point is used by the routine at CheckShotCollisions.
The routine is entered here with a state in A when the number of units is random.
|
||||||||
| AddToStack_Units | A8AA | AND %00000010 | Keep bit 1 of the state... | |||||
| A8AC | SRL A | ...move it to bit 0... | ||||||
| A8AE | INC A | ...and add one to get one or two units. | ||||||
| A8AF | LD B,A | Store the number of units in B. | ||||||
| A8B0 | LD A,($F601) | Fetch the item that is carried. | ||||||
| A8B3 | CP $06 | Return if it is not item number 06. | ||||||
| A8B5 | RET NZ | |||||||
| A8B6 | LD A,($C905) | Fetch the height of the stack and keep the old height in E. | ||||||
| A8B9 | LD E,A | |||||||
| A8BA | ADD A,B | Add the new units. | ||||||
| A8BB | CP $12 | Jump to AddToStack_Store if the height is below the limit of 12. | ||||||
| A8BD | JR C,AddToStack_Store | |||||||
| A8BF | LD A,$12 | Use the limit. | ||||||
| AddToStack_Store | A8C1 | LD ($C905),A | Store the new height of the stack. | |||||
| A8C4 | LD A,($C903) | Fetch the vertical position of the ship. | ||||||
| A8C7 | SUB E | Subtract the old height to find the first new row. | ||||||
| A8C8 | LD H,A | Store it in H. | ||||||
| A8C9 | LD L,$70 | Use the horizontal position of the stack. | ||||||
| A8CB | CALL GetScreenAddress | Find the screen address. | ||||||
| AddToStack_Clear | A8CE | LD (HL),$00 | Clear the left byte of the row. | |||||
| A8D0 | INC L | Move on to the right. | ||||||
| A8D1 | LD (HL),$00 | Clear the right byte of the row. | ||||||
| A8D3 | DEC L | Move back to the left. | ||||||
| A8D4 | CALL MoveUpARowDE | Move up a row. | ||||||
| A8D7 | DJNZ AddToStack_Clear | Loop back to AddToStack_Clear for each new unit. | ||||||
|
Continue on to BuildStackGraphic.
|
||||||||
| Prev: A80B | Up: Map | Next: A8D9 |