![]() |
Routines |
| Prev: B16F | Up: Map | Next: B2D5 |
|
Used by the routine at RunFrame.
Reads the controls, then changes the horizontal and vertical speeds of the ship by the amounts in the table at ShipAccelerationTable, depending on what is pressed and on the speed it already has, limits them, and works out the vertical scroll speed in VerticalSpeed with UpdateVerticalScrollSpeed.
|
||||||||
| UpdateShipSpeeds | B234 | CALL ReadControls | Call ReadControls. | |||||
| B237 | XOR A | Clear A. | ||||||
| B238 | LD ($5C36),A | Update the steering direction. | ||||||
| B23B | LD DE,($B31A) | Fetch the word at B31A into DE. | ||||||
| B23F | LD A,($96AB) | The crystal-delivery flag. | ||||||
| B242 | AND A | Jump to UpdateShipSpeeds_Drag if A is zero. | ||||||
| B243 | JR Z,UpdateShipSpeeds_Drag | |||||||
| B245 | LD A,$08 | A=08. | ||||||
| B247 | LD ($5C37),A | Update the controls. | ||||||
| B24A | LD A,$04 | A=04. | ||||||
| B24C | LD ($5C3F),A | Update the vertical scroll limit. | ||||||
| B24F | LD A,($CE58) | The map row. | ||||||
| B252 | AND A | Jump to UpdateShipSpeeds_Sideways if A is not zero. | ||||||
| B253 | JR NZ,UpdateShipSpeeds_Sideways | |||||||
| B255 | LD ($CCBA),A | Update the vertical scroll speed. | ||||||
| B258 | RET | Return. | ||||||
| UpdateShipSpeeds_Drag | B259 | LD A,(IX+$07) | Read offset 07 of IX. | |||||
| B25C | NEG | Negate A. | ||||||
| B25E | AND A | Jump to UpdateShipSpeeds_Sideways if A is zero. | ||||||
| B25F | JR Z,UpdateShipSpeeds_Sideways | |||||||
| B261 | LD DE,($B31E) | Fetch the word at B31E into DE. | ||||||
| B265 | BIT 7,A | Jump to UpdateShipSpeeds_Sideways if bit 7 of A is set. | ||||||
| B267 | JR NZ,UpdateShipSpeeds_Sideways | |||||||
| B269 | LD DE,($B31C) | Fetch the word at B31C into DE. | ||||||
| UpdateShipSpeeds_Sideways | B26D | LD A,($5C37) | The controls. | |||||
| B270 | BIT 1,A | Jump to UpdateShipSpeeds_Right if bit 1 of A is clear. | ||||||
| B272 | JR Z,UpdateShipSpeeds_Right | |||||||
| B274 | EX DE,HL | Swap DE and HL. | ||||||
| B275 | LD DE,($B318) | Fetch the word at B318 into DE. | ||||||
| B279 | LD A,$80 | A=80. | ||||||
| B27B | LD ($5C36),A | Update the steering direction. | ||||||
| B27E | LD A,H | A=H. | ||||||
| B27F | CP $FF | Jump to UpdateShipSpeeds_Vertical if A is FF. | ||||||
| B281 | JR Z,UpdateShipSpeeds_Vertical | |||||||
| B283 | ADD HL,DE | HL gains DE. | ||||||
| B284 | EX DE,HL | Swap DE and HL. | ||||||
| B285 | JR UpdateShipSpeeds_Vertical | Jump to UpdateShipSpeeds_Vertical. | ||||||
| UpdateShipSpeeds_Right | B287 | BIT 0,A | Jump to UpdateShipSpeeds_Vertical if bit 0 of A is clear. | |||||
| B289 | JR Z,UpdateShipSpeeds_Vertical | |||||||
| B28B | EX DE,HL | Swap DE and HL. | ||||||
| B28C | LD DE,($B316) | Fetch the word at B316 into DE. | ||||||
| B290 | LD A,$03 | A=03. | ||||||
| B292 | LD ($5C36),A | Update the steering direction. | ||||||
| B295 | LD A,H | A=H. | ||||||
| B296 | AND A | Jump to UpdateShipSpeeds_Vertical if A is zero. | ||||||
| B297 | JR Z,UpdateShipSpeeds_Vertical | |||||||
| B299 | ADD HL,DE | HL gains DE. | ||||||
| B29A | EX DE,HL | Swap DE and HL. | ||||||
| UpdateShipSpeeds_Vertical | B29B | LD A,($5C40) | The ship was just hit. | |||||
| B29E | AND A | Jump to UpdateShipSpeeds_Thrust if A is zero. | ||||||
| B29F | JR Z,UpdateShipSpeeds_Thrust | |||||||
| B2A1 | LD DE,$0000 | DE=00. | ||||||
| UpdateShipSpeeds_Thrust | B2A4 | CALL UpdateHorizontalSpeed | Call UpdateHorizontalSpeed. | |||||
| B2A7 | LD DE,($B312) | Fetch the word at ShipAccelerationTable into DE. | ||||||
| B2AB | LD A,($5C37) | The controls. | ||||||
| B2AE | AND %00001000 | Keep the bits of A that are set in 08. | ||||||
| B2B0 | JR Z,UpdateShipSpeeds_Gravity | Jump to UpdateShipSpeeds_Gravity if the zero flag is set. | ||||||
| B2B2 | LD DE,($B314) | Fetch the word at B314 into DE. | ||||||
| UpdateShipSpeeds_Gravity | B2B6 | LD H,(IX+$1B) | Read offset 1B of IX into H. | |||||
| B2B9 | LD L,(IX+$1C) | Read offset 1C of IX into L. | ||||||
| B2BC | LD A,($B832) | The special-shot flag. | ||||||
| B2BF | AND A | Jump to UpdateShipSpeeds_Limit if A is zero. | ||||||
| B2C0 | JR Z,UpdateShipSpeeds_Limit | |||||||
| B2C2 | LD HL,$0000 | HL=00. | ||||||
| B2C5 | LD DE,$0000 | DE=00. | ||||||
| B2C8 | LD ($B320),HL | Update the vertical scroll fraction. | ||||||
| UpdateShipSpeeds_Limit | B2CB | ADD HL,DE | HL gains DE. | |||||
| B2CC | CALL LimitVerticalSpeed | Call LimitVerticalSpeed. | ||||||
| B2CF | LD (IX+$1B),H | Write H to offset 1B of IX. | ||||||
| B2D2 | LD (IX+$1C),L | Write L to offset 1C of IX. | ||||||
|
Continue on to UpdateVerticalScrollSpeed.
|
||||||||
| Prev: B16F | Up: Map | Next: B2D5 |