Prev: 56823 Up: Map Next: 57057
56824: Scroll World
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 3, 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 56824 LD A,(52410) The vertical scroll speed.
56827 BIT 7,A Jump to ScrollWorld_Speed if bit 7 of A is clear.
56829 JR Z,ScrollWorld_Speed
56831 NEG Negate A.
ScrollWorld_Speed 56833 LD (52799),A Update the vertical distance.
56836 LD C,0 Clear C.
56838 LD HL,(52823) Fetch the word at MapPosition into HL.
ScrollWorld_Vertical 56841 LD A,(52802) The vertical offset.
56844 LD B,A B=A.
56845 LD A,(52410) The vertical scroll speed.
56848 ADD A,B A gains B.
56849 LD (52802),A Update the vertical offset.
56852 LD A,(52410) The vertical scroll speed.
56855 NEG Negate A.
56857 LD B,A B=A.
56858 LD A,(52806) The position down.
56861 ADD A,B A gains B.
56862 LD (52806),A Update the position down.
56865 CP 184 Jump to ScrollWorld_Down if A is 184 or more.
56867 JR NC,ScrollWorld_Down
56869 CP 22 Jump to ScrollWorld_Horizontal if A is 22 or more.
56871 JR NC,ScrollWorld_Horizontal
ScrollWorld_Up 56873 LD A,183 A=183.
56875 LD (52806),A Update the position down.
56878 XOR A Clear A.
56879 LD (52802),A Update the vertical offset.
56882 DEC H Step H back.
56883 INC C Advance C.
56884 JP ScrollWorld_Vertical Jump to ScrollWorld_Vertical.
ScrollWorld_Down 56887 LD A,23 A=23.
56889 LD (52806),A Update the position down.
56892 LD A,160 A=160.
56894 LD (52802),A Update the vertical offset.
56897 INC H Advance H.
56898 INC C Advance C.
56899 JP ScrollWorld_Vertical Jump to ScrollWorld_Vertical.
ScrollWorld_Horizontal 56902 LD A,(52411) The horizontal scroll speed.
56905 LD B,A B=A.
56906 LD A,(52801) The horizontal offset.
56909 ADD A,B A gains B.
56910 LD (52801),A Update the horizontal offset.
56913 LD A,(52411) The horizontal scroll speed.
56916 NEG Negate A.
56918 LD B,A B=A.
56919 LD A,(52805) The position across.
56922 ADD A,B A gains B.
56923 LD (52805),A Update the position across.
56926 CP 233 Jump to ScrollWorld_Right if A is 233 or more.
56928 JR NC,ScrollWorld_Right
56930 CP 7 Jump to ScrollWorld_Redraw if A is 7 or more.
56932 JR NC,ScrollWorld_Redraw
ScrollWorld_Left 56934 LD A,232 A=232.
56936 LD (52805),A Update the position across.
56939 LD A,32 A=32.
56941 LD (52801),A Update the horizontal offset.
56944 DEC L Step L back.
56945 INC C Advance C.
56946 JP ScrollWorld_Horizontal Jump to ScrollWorld_Horizontal.
ScrollWorld_Right 56949 LD A,8 A=8.
56951 LD (52805),A Update the position across.
56954 XOR A Clear A.
56955 LD (52801),A Update the horizontal offset.
56958 INC L Advance L.
56959 INC C Advance C.
56960 JP ScrollWorld_Horizontal Jump to ScrollWorld_Horizontal.
ScrollWorld_Redraw 56963 LD A,C A=C.
56964 LD (23613),A Update the tiles changed.
56967 AND A Call MakeTiles if A is not zero.
56968 CALL NZ,MakeTiles
56971 CALL SetRowAttributes Call SetRowAttributes.
56974 LD DE,56457 The tile script addresses.
56977 LD (56455),DE Update the tile script pointer.
56981 LD A,(52410) The vertical scroll speed.
56984 BIT 7,A Call UpdateMapObjects if bit 7 of A is set.
56986 CALL NZ,UpdateMapObjects
56989 LD A,(52824) The map row.
56992 CP 3 Jump to ScrollWorld_Terrain if A is 3 or more.
56994 JR NC,ScrollWorld_Terrain
56996 XOR A Clear A.
56997 LD (23424),A Update the decryption routine.
57000 LD (23461),A Clear the second tile record.
57003 LD (23498),A Clear the third tile record.
57006 LD (23535),A Clear the fourth tile record.
57009 JR ScrollWorld_Objects Jump to ScrollWorld_Objects.
ScrollWorld_Terrain 57011 CALL DrawTerrain Call DrawTerrain.
ScrollWorld_Objects 57014 LD A,(52410) The vertical scroll speed.
57017 BIT 7,A Call UpdateMapObjects if bit 7 of A is clear.
57019 CALL Z,UpdateMapObjects
57022 CALL UpdateBeams Call UpdateBeams.
57025 CALL UpdateStars Call UpdateStars.
57028 LD A,255 A=255.
57030 LD (22241),A A solid pixel byte in the playfield.
57033 LD (21985),A A solid pixel byte in the playfield.
57036 LD (21217),A A solid pixel byte in the playfield.
57039 LD (20961),A A solid pixel byte in the playfield.
57042 LD A,(23612) The scroll-in flag.
57045 AND A Jump to RunFrame_Draw if A is zero.
57046 JP Z,RunFrame_Draw
57049 JP LookForGround Jump to LookForGround.
ScrollWorld_Record 57052 NOP Do nothing.
57053 NOP Do nothing.
57054 NOP Do nothing.
57055 NOP Do nothing.
57056 NOP Do nothing.
Prev: 56823 Up: Map Next: 57057