![]() |
Routines |
| Prev: DDF7 | Up: Map | Next: DEE1 |
|
Used by the routines at RunFrame and ScrollInWorld.
Moves the view of the world by the scroll speeds, which are the vertical speed at VerticalSpeed and the horizontal speed at HorizontalSpeed. The speeds are added to the offsets within the tile and when an edge of the tile is passed the map position at MapPosition moves to the next tile. If any tile has changed the four visible tiles are found again. Unless the map row is above row 03, where there is no terrain, the tile scripts are then run to draw the tiles and to make the boxes for the terrain. The map objects, beams and stars are updated, and the lines at the bottom of the frame that the drawing may have damaged are drawn again.
|
||||
| ScrollWorld | DDF8 | LD A,($CCBA) | The vertical scroll speed. | |
| DDFB | BIT 7,A | Jump to ScrollWorld_Speed if bit 7 of A is clear. | ||
| DDFD | JR Z,ScrollWorld_Speed | |||
| DDFF | NEG | Negate A. | ||
| ScrollWorld_Speed | DE01 | LD ($CE3F),A | Update the vertical distance. | |
| DE04 | LD C,$00 | Clear C. | ||
| DE06 | LD HL,($CE57) | Fetch the word at MapPosition into HL. | ||
| ScrollWorld_Vertical | DE09 | LD A,($CE42) | The vertical offset. | |
| DE0C | LD B,A | B=A. | ||
| DE0D | LD A,($CCBA) | The vertical scroll speed. | ||
| DE10 | ADD A,B | A gains B. | ||
| DE11 | LD ($CE42),A | Update the vertical offset. | ||
| DE14 | LD A,($CCBA) | The vertical scroll speed. | ||
| DE17 | NEG | Negate A. | ||
| DE19 | LD B,A | B=A. | ||
| DE1A | LD A,($CE46) | The position down. | ||
| DE1D | ADD A,B | A gains B. | ||
| DE1E | LD ($CE46),A | Update the position down. | ||
| DE21 | CP $B8 | Jump to ScrollWorld_Down if A is B8 or more. | ||
| DE23 | JR NC,ScrollWorld_Down | |||
| DE25 | CP $16 | Jump to ScrollWorld_Horizontal if A is 16 or more. | ||
| DE27 | JR NC,ScrollWorld_Horizontal | |||
| ScrollWorld_Up | DE29 | LD A,$B7 | A=B7. | |
| DE2B | LD ($CE46),A | Update the position down. | ||
| DE2E | XOR A | Clear A. | ||
| DE2F | LD ($CE42),A | Update the vertical offset. | ||
| DE32 | DEC H | Step H back. | ||
| DE33 | INC C | Advance C. | ||
| DE34 | JP ScrollWorld_Vertical | Jump to ScrollWorld_Vertical. | ||
| ScrollWorld_Down | DE37 | LD A,$17 | A=17. | |
| DE39 | LD ($CE46),A | Update the position down. | ||
| DE3C | LD A,$A0 | A=A0. | ||
| DE3E | LD ($CE42),A | Update the vertical offset. | ||
| DE41 | INC H | Advance H. | ||
| DE42 | INC C | Advance C. | ||
| DE43 | JP ScrollWorld_Vertical | Jump to ScrollWorld_Vertical. | ||
| ScrollWorld_Horizontal | DE46 | LD A,($CCBB) | The horizontal scroll speed. | |
| DE49 | LD B,A | B=A. | ||
| DE4A | LD A,($CE41) | The horizontal offset. | ||
| DE4D | ADD A,B | A gains B. | ||
| DE4E | LD ($CE41),A | Update the horizontal offset. | ||
| DE51 | LD A,($CCBB) | The horizontal scroll speed. | ||
| DE54 | NEG | Negate A. | ||
| DE56 | LD B,A | B=A. | ||
| DE57 | LD A,($CE45) | The position across. | ||
| DE5A | ADD A,B | A gains B. | ||
| DE5B | LD ($CE45),A | Update the position across. | ||
| DE5E | CP $E9 | Jump to ScrollWorld_Right if A is E9 or more. | ||
| DE60 | JR NC,ScrollWorld_Right | |||
| DE62 | CP $07 | Jump to ScrollWorld_Redraw if A is 07 or more. | ||
| DE64 | JR NC,ScrollWorld_Redraw | |||
| ScrollWorld_Left | DE66 | LD A,$E8 | A=E8. | |
| DE68 | LD ($CE45),A | Update the position across. | ||
| DE6B | LD A,$20 | A=20. | ||
| DE6D | LD ($CE41),A | Update the horizontal offset. | ||
| DE70 | DEC L | Step L back. | ||
| DE71 | INC C | Advance C. | ||
| DE72 | JP ScrollWorld_Horizontal | Jump to ScrollWorld_Horizontal. | ||
| ScrollWorld_Right | DE75 | LD A,$08 | A=08. | |
| DE77 | LD ($CE45),A | Update the position across. | ||
| DE7A | XOR A | Clear A. | ||
| DE7B | LD ($CE41),A | Update the horizontal offset. | ||
| DE7E | INC L | Advance L. | ||
| DE7F | INC C | Advance C. | ||
| DE80 | JP ScrollWorld_Horizontal | Jump to ScrollWorld_Horizontal. | ||
| ScrollWorld_Redraw | DE83 | LD A,C | A=C. | |
| DE84 | LD ($5C3D),A | Update the tiles changed. | ||
| DE87 | AND A | Call MakeTiles if A is not zero. | ||
| DE88 | CALL NZ,MakeTiles | |||
| DE8B | CALL SetRowAttributes | Call SetRowAttributes. | ||
| DE8E | LD DE,$DC89 | The tile script addresses. | ||
| DE91 | LD ($DC87),DE | Update the tile script pointer. | ||
| DE95 | LD A,($CCBA) | The vertical scroll speed. | ||
| DE98 | BIT 7,A | Call UpdateMapObjects if bit 7 of A is set. | ||
| DE9A | CALL NZ,UpdateMapObjects | |||
| DE9D | LD A,($CE58) | The map row. | ||
| DEA0 | CP $03 | Jump to ScrollWorld_Terrain if A is 03 or more. | ||
| DEA2 | JR NC,ScrollWorld_Terrain | |||
| DEA4 | XOR A | Clear A. | ||
| DEA5 | LD ($5B80),A | Update the decryption routine. | ||
| DEA8 | LD ($5BA5),A | Clear the second tile record. | ||
| DEAB | LD ($5BCA),A | Clear the third tile record. | ||
| DEAE | LD ($5BEF),A | Clear the fourth tile record. | ||
| DEB1 | JR ScrollWorld_Objects | Jump to ScrollWorld_Objects. | ||
| ScrollWorld_Terrain | DEB3 | CALL DrawTerrain | Call DrawTerrain. | |
| ScrollWorld_Objects | DEB6 | LD A,($CCBA) | The vertical scroll speed. | |
| DEB9 | BIT 7,A | Call UpdateMapObjects if bit 7 of A is clear. | ||
| DEBB | CALL Z,UpdateMapObjects | |||
| DEBE | CALL UpdateBeams | Call UpdateBeams. | ||
| DEC1 | CALL UpdateStars | Call UpdateStars. | ||
| DEC4 | LD A,$FF | A=FF. | ||
| DEC6 | LD ($56E1),A | A solid pixel byte in the playfield. | ||
| DEC9 | LD ($55E1),A | A solid pixel byte in the playfield. | ||
| DECC | LD ($52E1),A | A solid pixel byte in the playfield. | ||
| DECF | LD ($51E1),A | A solid pixel byte in the playfield. | ||
| DED2 | LD A,($5C3C) | The scroll-in flag. | ||
| DED5 | AND A | Jump to RunFrame_Draw if A is zero. | ||
| DED6 | JP Z,RunFrame_Draw | |||
| DED9 | JP LookForGround | Jump to LookForGround. | ||
| ScrollWorld_Record | DEDC | NOP | Do nothing. | |
| DEDD | NOP | Do nothing. | ||
| DEDE | NOP | Do nothing. | ||
| DEDF | NOP | Do nothing. | ||
| DEE0 | NOP | Do nothing. | ||
| Prev: DDF7 | Up: Map | Next: DEE1 |