![]() |
Routines |
| Prev: C10E | Up: Map | Next: C184 |
|
Used by the routine at UpdateStars.
Makes a scroll speed smaller for the stars of a layer further away, by shifting it right once for the second layer and twice for the third. For the third layer, on odd frames, a speed of FE is first changed to zero and a speed of 02 is changed to 04.
|
||||||||||||||
| ScaleScrollSpeed | C152 | LD A,B | A=B. | |||||||||||
| C153 | CP $01 | Return if A is 01. | ||||||||||||
| C155 | RET Z | |||||||||||||
| C156 | CP $02 | Jump to ScaleScrollSpeed_Third if A is 02. | ||||||||||||
| C158 | JR Z,ScaleScrollSpeed_Third | |||||||||||||
| C15A | LD A,H | A=H. | ||||||||||||
| C15B | CP $FE | Jump to ScaleScrollSpeed_Third if A is not FE. | ||||||||||||
| C15D | JR NZ,ScaleScrollSpeed_Third | |||||||||||||
| C15F | LD A,($9A64) | The frame counter. | ||||||||||||
| C162 | AND %00000001 | Keep the bits of A that are set in 01. | ||||||||||||
| C164 | JR Z,ScaleScrollSpeed_Third | Jump to ScaleScrollSpeed_Third if the zero flag is set. | ||||||||||||
| C166 | LD H,$00 | Clear H. | ||||||||||||
| C168 | RET | Return. | ||||||||||||
| ScaleScrollSpeed_Third | C169 | LD A,B | A=B. | |||||||||||
| C16A | CP $03 | Jump to ScaleScrollSpeed_Shift if A is not 03. | ||||||||||||
| C16C | JR NZ,ScaleScrollSpeed_Shift | |||||||||||||
| C16E | LD A,H | A=H. | ||||||||||||
| C16F | CP $02 | Jump to ScaleScrollSpeed_Shift if A is not 02. | ||||||||||||
| C171 | JR NZ,ScaleScrollSpeed_Shift | |||||||||||||
| C173 | LD A,($9A64) | The frame counter. | ||||||||||||
| C176 | AND %00000001 | Keep the bits of A that are set in 01. | ||||||||||||
| C178 | JR Z,ScaleScrollSpeed_Shift | Jump to ScaleScrollSpeed_Shift if the zero flag is set. | ||||||||||||
| C17A | LD H,$04 | H=04. | ||||||||||||
| ScaleScrollSpeed_Shift | C17C | LD A,B | A=B. | |||||||||||
| C17D | DEC A | Step A back. | ||||||||||||
| ScaleScrollSpeed_Loop | C17E | SRA H | Shift H right keeping the sign. | |||||||||||
| C180 | DEC A | Step A back. | ||||||||||||
| C181 | JR NZ,ScaleScrollSpeed_Loop | Jump to ScaleScrollSpeed_Loop if the zero flag is clear. | ||||||||||||
| C183 | RET | Return. | ||||||||||||
| Prev: C10E | Up: Map | Next: C184 |