TileMap: Store map as an array of tiles rather than references of tiles.

Removes a level of indirection. Halves the maximum tile map size, but it was
limited already so we will need to deal with that in the future anyway.
Additionally, the Tile object size could be reduced to two bytes because the
aligned tile data address really only needs 13-14 bits depending on screen mode,
and can be packed with 2-3 collision bits.
5 files changed, 128 insertions(+), 138 deletions(-)

M res/field/tilemap.tmx
M src/MapView.asm
M src/Player.asm
M src/TileMap.asm
M tools/tilemaps.js
M res/field/tilemap.tmx +66 -66
@@ 1,5 1,5 @@ 
 <?xml version="1.0" encoding="UTF-8"?>
-<map version="1.2" tiledversion="1.3.4" orientation="orthogonal" renderorder="right-down" width="64" height="64" tilewidth="16" tileheight="16" infinite="0" nextlayerid="2" nextobjectid="1">
+<map version="1.4" tiledversion="1.4.1" orientation="orthogonal" renderorder="right-down" width="32" height="64" tilewidth="16" tileheight="16" infinite="0" nextlayerid="2" nextobjectid="1">
  <tileset firstgid="1" name="FieldSet" tilewidth="16" tileheight="16" tilecount="256" columns="16">
   <image source="tileset.png" width="256" height="256"/>
   <tile id="66">

          
@@ 98,72 98,72 @@ 
    </properties>
   </tile>
  </tileset>
- <layer id="1" name="Tilelaag 1" width="64" height="64">
+ <layer id="1" name="Background" width="32" height="64">
   <data encoding="csv">
-130,145,130,145,130,99,100,99,100,130,145,99,100,99,100,145,130,145,130,145,19,21,36,22,145,130,145,130,145,130,145,130,145,130,145,130,145,130,145,130,145,130,145,130,145,130,145,130,145,130,145,130,145,130,145,130,145,130,145,130,145,130,145,130,
-129,98,1,1,1,97,1,1,1,1,3,4,5,4,5,5,5,4,4,5,50,36,37,38,1,1,98,1,1,3,4,5,6,1,1,1,1,1,1,1,1,1,1,97,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,98,1,129,
-145,3,5,4,6,1,117,1,118,1,19,20,21,37,36,36,37,20,36,21,37,36,21,22,1,3,5,6,1,19,37,113,49,6,1,1,1,1,1,1,1,1,1,97,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
-130,35,37,20,38,1,1,1,1,1,35,36,37,36,37,21,21,36,37,36,21,20,37,38,1,35,83,38,1,35,37,20,21,22,1,1,98,1,1,3,4,5,6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,130,
-129,19,83,36,22,1,102,1,101,1,19,37,36,33,52,53,53,53,52,53,52,53,53,54,1,51,53,54,1,51,34,36,37,38,1,3,5,4,6,19,37,37,49,6,1,1,1,1,1,1,98,1,1,1,1,1,1,1,1,1,1,1,1,129,
-145,51,53,53,54,1,1,1,1,1,19,36,21,38,97,1,70,1,1,1,1,1,1,1,1,1,1,1,1,1,51,52,53,54,1,35,37,20,38,35,37,20,21,22,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
-130,1,1,1,130,1,1,1,1,97,35,37,37,38,1,129,1,1,1,1,1,1,1,97,1,1,1,1,70,3,4,5,6,1,1,19,21,36,22,51,34,36,37,38,1,1,1,98,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,130,
-129,129,1,129,1,98,1,1,1,1,35,21,36,38,130,145,98,1,1,3,4,5,6,1,1,129,130,129,1,19,20,21,22,1,1,51,53,53,54,1,51,52,53,54,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,129,
-145,145,130,145,1,3,4,5,6,1,19,36,21,22,129,3,5,4,6,19,37,37,49,6,130,145,1,145,1,35,36,83,38,1,1,1,1,1,1,3,4,5,6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,97,1,1,1,145,
-130,1,129,130,3,50,37,21,22,1,19,36,20,22,145,35,37,20,38,35,37,20,21,22,129,130,1,1,129,51,52,53,54,1,1,97,1,1,1,19,20,21,22,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,129,
-129,1,145,1,19,20,21,36,38,68,19,37,36,38,130,19,21,36,22,51,34,83,37,38,145,1,1,1,145,1,1,1,65,66,1,1,1,1,1,35,36,37,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
-145,1,65,66,35,36,37,33,54,1,35,36,21,38,129,51,53,53,54,1,51,52,53,54,1,1,1,67,1,1,1,1,81,82,1,1,1,1,1,51,52,53,54,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,130,
-130,1,81,82,51,34,33,54,67,1,19,36,21,38,145,130,3,5,6,3,4,5,6,1,1,1,1,1,1,98,1,1,1,97,1,1,1,1,1,1,1,1,65,66,1,1,1,1,97,1,1,1,1,1,1,98,1,1,1,1,1,1,1,129,
-129,1,98,3,4,50,22,1,99,100,35,37,37,38,129,97,35,86,38,19,20,21,22,1,1,1,1,1,1,3,4,5,6,1,1,1,1,1,98,1,1,1,81,82,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
-145,1,1,19,83,37,49,6,1,1,35,21,36,38,145,130,51,53,54,35,36,37,38,1,98,3,5,4,6,19,37,37,49,6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,129,
-130,1,1,35,37,20,21,22,1,1,19,36,21,22,130,1,1,1,67,51,52,53,54,1,1,35,37,20,38,35,37,20,21,22,1,1,1,1,1,1,1,1,1,97,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
-129,1,1,51,34,36,37,38,1,1,19,36,21,38,131,132,133,134,67,67,1,1,65,66,1,19,21,36,22,51,34,36,37,38,1,1,98,1,1,3,4,5,6,1,97,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,130,
-145,1,1,1,51,52,53,54,1,1,35,37,37,38,147,148,149,150,98,1,1,1,81,82,1,51,53,53,54,1,51,52,53,54,1,3,5,4,6,19,37,37,49,6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,97,1,1,129,
-130,1,1,1,69,3,4,5,6,1,35,21,36,38,163,164,165,166,1,1,1,1,1,97,1,1,1,1,1,3,4,5,6,1,1,35,37,20,38,35,37,20,21,22,1,1,97,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
-129,97,1,1,1,19,20,21,22,1,19,36,21,22,179,180,181,98,1,3,4,5,6,1,1,97,1,1,1,19,114,21,22,1,1,19,21,36,22,51,34,36,37,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,98,1,1,1,1,129,
-145,1,1,1,1,35,36,37,38,1,19,20,36,22,1,3,5,4,6,19,37,37,49,6,131,132,133,134,1,35,36,37,38,1,1,51,53,53,54,1,51,52,53,54,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
-130,1,1,1,1,51,52,53,54,1,19,36,21,38,1,35,37,20,38,35,37,20,21,22,147,148,149,150,1,51,52,53,54,1,1,1,1,1,1,3,4,5,6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,130,
-129,1,1,1,1,3,5,6,65,66,35,37,37,38,1,19,21,36,22,51,34,36,37,38,163,164,165,166,1,1,1,1,65,66,1,97,1,1,1,19,20,21,22,1,1,1,1,1,1,1,98,1,1,1,1,1,1,1,1,1,1,1,1,129,
-145,1,1,1,98,35,84,38,81,82,35,21,36,38,1,51,53,53,54,1,51,52,53,54,179,180,181,182,98,1,1,1,81,82,1,1,1,1,1,35,36,37,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
-130,1,1,1,1,51,53,54,1,97,19,36,21,22,1,1,1,1,1,3,4,5,6,1,1,1,1,1,1,1,1,1,1,97,1,1,1,1,1,51,52,53,54,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,129,
-129,1,98,1,1,3,4,5,6,1,19,36,20,22,1,97,1,130,1,19,20,21,22,1,1,1,98,1,1,3,4,5,6,1,1,1,1,1,1,1,1,1,65,66,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
-145,3,5,4,6,19,37,37,49,6,19,37,36,38,131,132,133,134,1,35,36,37,38,1,1,3,5,4,6,19,37,37,49,6,1,1,1,1,98,1,1,1,81,82,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,97,1,1,1,130,
-130,35,37,20,38,35,37,20,21,22,35,36,21,38,147,148,149,150,1,51,52,53,54,1,1,35,37,20,38,35,37,20,21,22,1,1,1,1,97,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,129,
-129,19,21,36,22,51,34,36,37,38,19,36,21,38,163,164,165,166,1,1,1,1,65,66,1,19,21,36,22,51,34,36,37,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
-145,51,53,53,54,1,51,52,53,54,35,37,37,38,179,180,181,182,98,1,1,1,81,82,1,51,53,53,54,1,51,52,53,54,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,130,
-130,1,1,1,1,3,4,5,6,1,35,21,36,38,1,1,1,97,1,1,1,1,1,1,1,1,1,1,1,3,4,5,6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,97,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,129,
-129,97,1,1,1,19,20,21,22,1,19,36,21,22,1,1,1,1,1,1,1,1,1,1,1,97,1,1,1,19,20,21,22,1,1,1,1,1,1,1,1,98,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
-145,1,1,1,1,35,36,37,38,1,19,20,36,22,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,35,36,37,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,98,1,1,1,1,1,129,
-130,1,1,1,1,51,52,53,54,1,19,36,21,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,51,52,53,54,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
-129,1,1,1,1,1,1,1,65,66,35,37,37,38,1,1,1,1,1,1,1,98,1,1,1,1,1,1,1,1,1,1,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1,1,35,21,36,38,1,1,1,1,1,97,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,98,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,129,
-145,1,1,1,1,1,1,1,1,1,19,36,21,22,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
-130,1,1,98,1,1,1,1,1,1,19,36,20,22,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,97,1,130,
-129,1,1,1,1,1,1,1,1,1,19,37,36,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,98,1,1,1,1,1,1,129,
-145,1,1,1,1,1,1,97,1,1,35,36,21,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,98,1,1,1,1,1,1,1,1,1,1,1,1,1,97,1,1,1,1,1,1,1,1,1,1,1,1,145,
-130,129,130,129,130,129,130,129,130,129,35,21,36,38,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130
+130,145,130,145,130,99,100,99,100,130,145,99,100,99,100,145,130,145,130,145,19,21,36,22,145,130,145,130,145,130,145,130,
+129,98,1,1,1,97,1,1,1,1,3,4,5,4,5,5,5,4,4,5,50,36,37,38,1,1,98,1,1,1,1,129,
+145,3,5,4,6,1,117,1,118,1,19,20,21,37,36,36,37,20,36,21,37,36,21,22,1,3,5,6,1,1,1,145,
+130,35,37,20,38,1,1,1,1,1,35,36,37,36,37,21,21,36,37,36,21,20,37,38,1,35,83,38,1,1,1,130,
+129,19,83,36,22,1,102,1,101,1,19,37,36,33,52,53,53,53,52,53,52,53,53,54,1,51,53,54,1,1,1,129,
+145,51,53,53,54,1,1,1,1,1,19,36,21,38,97,1,70,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
+130,1,1,1,130,1,1,1,1,97,35,37,37,38,1,129,1,1,1,1,1,1,1,97,1,1,1,1,70,1,1,130,
+129,129,1,129,1,98,1,1,1,1,35,21,36,38,130,145,98,1,1,3,4,5,6,1,1,129,130,129,1,1,1,129,
+145,145,130,145,1,3,4,5,6,1,19,36,21,22,129,3,5,4,6,19,37,37,49,6,130,145,1,145,1,1,1,145,
+130,1,129,130,3,50,37,21,22,1,19,36,20,22,145,35,37,20,38,35,37,20,21,22,129,130,1,1,129,1,1,129,
+129,1,145,1,19,20,21,36,38,68,19,37,36,38,130,19,21,36,22,51,34,83,37,38,145,1,1,1,145,1,1,145,
+145,1,65,66,35,36,37,33,54,1,35,36,21,38,129,51,53,53,54,1,51,52,53,54,1,1,1,67,1,1,1,130,
+130,1,81,82,51,34,33,54,67,1,19,36,21,38,145,130,3,5,6,3,4,5,6,1,1,1,1,1,1,98,1,129,
+129,1,98,3,4,50,22,1,99,100,35,37,37,38,129,97,35,86,38,19,20,21,22,1,1,1,1,1,1,1,1,145,
+145,1,1,19,83,37,49,6,1,1,35,21,36,38,145,130,51,53,54,35,36,37,38,1,98,3,5,4,6,1,1,129,
+130,1,1,35,37,20,21,22,1,1,19,36,21,22,130,1,1,1,67,51,52,53,54,1,1,35,37,20,38,1,1,145,
+129,1,1,51,34,36,37,38,1,1,19,36,21,38,131,132,133,134,67,67,1,1,65,66,1,19,21,36,22,1,1,130,
+145,1,1,1,51,52,53,54,1,1,35,37,37,38,147,148,149,150,98,1,1,1,81,82,1,51,53,53,54,1,1,129,
+130,1,1,1,69,3,4,5,6,1,35,21,36,38,163,164,165,166,1,1,1,1,1,97,1,1,1,1,1,1,1,145,
+129,97,1,1,1,19,20,21,22,1,19,36,21,22,179,180,181,98,1,3,4,5,6,1,1,97,1,1,1,1,1,129,
+145,1,1,1,1,35,36,37,38,1,19,20,36,22,1,3,5,4,6,19,37,37,49,6,131,132,133,134,1,1,1,145,
+130,1,1,1,1,51,52,53,54,1,19,36,21,38,1,35,37,20,38,35,37,20,21,22,147,148,149,150,1,1,1,130,
+129,1,1,1,1,3,5,6,65,66,35,37,37,38,1,19,21,36,22,51,34,36,37,38,163,164,165,166,1,1,1,129,
+145,1,1,1,98,35,84,38,81,82,35,21,36,38,1,51,53,53,54,1,51,52,53,54,179,180,181,182,98,1,1,145,
+130,1,1,1,1,51,53,54,1,97,19,36,21,22,1,1,1,1,1,3,4,5,6,1,1,1,1,1,1,1,1,129,
+129,1,98,1,1,3,4,5,6,1,19,36,20,22,1,97,1,130,1,19,20,21,22,1,1,1,98,1,1,1,1,145,
+145,3,5,4,6,19,37,37,49,6,19,37,36,38,131,132,133,134,1,35,36,37,38,1,1,3,5,4,6,1,1,130,
+130,35,37,20,38,35,37,20,21,22,35,36,21,38,147,148,149,150,1,51,52,53,54,1,1,35,37,20,38,1,1,129,
+129,19,21,36,22,51,34,36,37,38,19,36,21,38,163,164,165,166,1,1,1,1,65,66,1,19,21,36,22,1,1,145,
+145,51,53,53,54,1,51,52,53,54,35,37,37,38,179,180,181,182,98,1,1,1,81,82,1,51,53,53,54,1,1,130,
+130,1,1,1,1,3,4,5,6,1,35,21,36,38,1,1,1,97,1,1,1,1,1,1,1,1,1,1,1,1,1,129,
+129,97,1,1,1,19,20,21,22,1,19,36,21,22,1,1,1,1,1,1,1,1,1,1,1,97,1,1,1,1,1,145,
+145,1,1,1,1,35,36,37,38,1,19,20,36,22,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,129,
+130,1,1,1,1,51,52,53,54,1,19,36,21,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
+129,1,1,1,1,1,1,1,65,66,35,37,37,38,1,1,1,1,1,1,1,98,1,1,1,1,1,1,1,1,1,130,
+145,1,1,1,98,1,1,1,81,82,35,21,36,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,98,1,1,129,
+130,1,1,1,1,98,1,1,1,1,19,36,21,22,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
+129,1,1,1,1,1,1,1,1,1,19,36,21,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,129,
+145,1,1,1,1,1,1,1,1,1,35,37,37,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,98,1,1,145,
+130,1,1,1,1,1,97,1,1,1,35,21,36,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,130,
+129,1,1,1,1,1,1,1,1,1,19,36,21,22,1,1,1,1,1,1,1,97,1,1,1,1,1,1,1,1,1,129,
+145,1,98,1,1,1,1,1,1,1,19,36,20,22,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
+130,1,1,1,1,1,1,1,1,1,19,37,36,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,129,
+129,1,1,1,1,1,1,1,1,97,35,36,21,38,1,1,1,1,1,1,1,1,1,97,1,1,1,1,1,1,1,145,
+145,1,1,1,1,1,1,1,1,1,19,36,21,38,1,1,1,1,1,1,1,1,98,1,1,1,1,1,1,1,1,130,
+130,97,1,1,1,1,1,1,1,1,35,37,37,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,129,
+129,1,1,1,1,1,1,1,1,1,35,21,36,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
+145,1,1,1,1,1,1,1,1,1,19,36,21,22,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,129,
+130,1,1,1,1,1,1,1,1,1,19,36,20,22,1,1,1,97,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
+129,1,1,1,1,1,1,1,1,1,19,36,21,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,98,1,130,
+145,1,1,1,1,98,1,1,1,1,35,20,37,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,129,
+130,1,1,1,1,1,1,1,1,1,35,21,36,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
+129,1,1,1,1,1,1,1,1,1,19,36,21,22,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,129,
+145,1,1,1,1,1,1,1,1,1,19,36,36,22,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
+130,1,1,1,1,1,1,1,1,1,19,37,36,38,1,1,1,1,1,1,1,1,98,1,1,1,1,1,1,1,1,130,
+129,1,1,1,1,1,1,1,97,1,35,36,21,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,129,
+145,1,1,1,1,1,1,1,1,1,19,36,21,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,97,145,
+130,1,97,1,1,1,1,1,1,1,35,37,37,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,130,
+129,1,1,1,1,1,1,1,1,1,35,21,36,38,1,1,1,1,1,97,1,1,1,1,1,1,1,1,1,1,1,129,
+145,1,1,1,1,1,1,1,1,1,19,36,21,22,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
+130,1,1,98,1,1,1,1,1,1,19,36,20,22,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,130,
+129,1,1,1,1,1,1,1,1,1,19,37,36,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,129,
+145,1,1,1,1,1,1,97,1,1,35,36,21,38,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,145,
+130,129,130,129,130,129,130,129,130,129,35,21,36,38,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130,129,130
 </data>
  </layer>
 </map>

          
M src/MapView.asm +27 -30
@@ 47,10 47,10 @@ MapView_GetCamera:
 ; bc = x
 ; de = y
 ; ix = this
-; hl <- tile pointer pointer
+; hl <- tile
 ; de <- row stride
 ; Modifies: af, bc, de
-MapView_GetTileDataPointer:
+MapView_GetTile:
 	push ix
 	REPT 4
 	sra b

          
@@ 63,11 63,13 @@ MapView_GetTileDataPointer:
 	push de
 	call MapView_GetTileMap
 	pop de
-	call TileMap_GetTileDataPointer
+	call TileMap_GetTile
 	ld e,(ix + TileMap.size.x)
 	ld d,(ix + TileMap.size.x + 1)
 	sla e
 	rl d
+	sla e
+	rl d
 	pop ix
 	ret
 

          
@@ 243,7 245,7 @@ MapView_DrawTileColumn: PROC
 	exx
 	inc d       ; set-up tile iteration
 	ld e,0
-	call MapView_GetTileDataPointer
+	call MapView_GetTile
 	push hl
 	pop ix
 	ld hl,0

          
@@ 274,13 276,13 @@ MapView_DrawTileColumn: PROC
 	ld (hl),l
 	pop ix
 	ret
-; bc = tile pointer wrap stride
-; de = tile pointer stride
+; bc = tile wrap stride
+; de = tile stride
 ; l = tile count
 ; h = distance to split
 ; c' = VDP port 3
-; de' = tile source stride
-; ix = tile pointer
+; de' = tile pixels stride
+; ix = tile
 ; iyl = x offset
 Loop:
 	exx

          
@@ 364,8 366,8 @@ DrawColumnTile4:
 	ENDP
 
 ; c = VDP port 3
-; de = tile source stride
-; hl = tile source
+; de = tile pixels stride
+; hl = tile pixels
 MapView_DrawColumnTile_M: MACRO ?lines
 	REPT ?lines
 	REPT 4 / Video_X_BYTE

          
@@ 417,11 419,11 @@ MapView_DrawTileRow: PROC
 	exx
 	inc b       ; set-up tile iteration
 	ld c,0
-	call MapView_GetTileDataPointer
+	call MapView_GetTile
 	push hl
 	pop ix
-	ld de,2
-	ld bc,-16 * 2
+	ld de,Tile._size
+	ld bc,-16 * Tile._size
 	ld a,iyl
 	ld h,a
 	rrca

          
@@ 441,13 443,13 @@ MapView_DrawTileRow: PROC
 	ld (hl),l
 	pop ix
 	ret
-; bc = tile pointer wrap stride
-; de = tile pointer stride
+; bc = tile wrap stride
+; de = tile stride
 ; l = tile count
 ; h = distance to split
 ; c' = VDP port 0
 ; de' = VRAM address (14-bit | 4000H)
-; ix = tile pointer
+; ix = tile
 ; iyh = y offset
 Loop:
 	exx

          
@@ 532,30 534,25 @@ DrawRowTile12:
 	ret
 	ENDP
 
-; ix = tile pointer
-; hl <- tile source
+; ix = tile
+; hl <- tile pixels
 MapView_GetTileSource_M: MACRO ?offset
-	ld l,(ix)
-	ld h,(ix + 1)
-	ld a,(hl)
+	ld a,(ix + Tile.image.bank)
 	ld (ROMMapper_instance.pageA000.BANK_SELECT),a
-	inc hl
 	IF Video_X_BYTE = 2
-	ld a,(hl)
-	ENDIF
-	inc hl
-	ld h,(hl)
-	IF Video_X_BYTE = 2
+	ld a,(ix + Tile.image.address)
 	or ?offset
+	ld l,a
 	ELSE
 	ld a,?offset
+	ld l,a
 	ENDIF
-	ld l,a
+	ld h,(ix + Tile.image.address + 1)
 	ENDM
 
 ; c = VDP port 0
 ; de = VRAM destination (14-bit | 4000H)
-; hl = tile source
+; hl = tile pixels
 MapView_DrawRowTile_M: MACRO ?pixels
 	ld a,e
 	MapView_DrawRowTileLine_M ?pixels, a, d

          
@@ 588,7 585,7 @@ MapView_DrawRowTile_M: MACRO ?pixels
 	ENDM
 
 ; c = VDP port 0
-; hl = tile source
+; hl = tile pixels
 MapView_DrawRowTileLine_M: MACRO ?pixels, ?vramLSB, ?vramMSB
 	inc c
 	di

          
M src/Player.asm +17 -19
@@ 79,7 79,7 @@ Player_SetPosition:
 	call Player_GetTileMap
 	ex de,hl
 	call TileMap_PixelToTilePosition
-	call TileMap_GetTileDataPointer
+	call TileMap_GetTile
 	pop ix
 	ld (ix + Player.currentTile),l
 	ld (ix + Player.currentTile + 1),h

          
@@ 88,33 88,27 @@ Player_SetPosition:
 ; ix = this
 ; ix <- tile
 Player_GetTile:
-	ld l,(ix + Player.currentTile)
-	ld h,(ix + Player.currentTile + 1)
-	ld a,(hl)
-	ld ixl,a
-	inc l
-	ld a,(hl)
-	ld ixh,a
+	ld e,(ix + Player.currentTile)
+	ld d,(ix + Player.currentTile + 1)
+	ld ixl,e
+	ld ixh,d
 	ret
 
 ; c = x offset (range: -16 .. 16)
 ; e = y offset (range: -16 .. 16)
 ; ix = this
 ; ix <- tile
-Player_GetTileWithOffset:
-	call Player_GetTileDataPointerWithOffset
-	ld a,(hl)
-	ld ixl,a
-	inc l
-	ld a,(hl)
-	ld ixh,a
+Player_GetTileWithOffset_IX:
+	call Player_GetTileWithOffset
+	push hl
+	pop ix
 	ret
 
 ; c = x offset (range: -16 .. 16)
 ; e = y offset (range: -16 .. 16)
 ; ix = this
-; hl <- tile pointer
-Player_GetTileDataPointerWithOffset: PROC
+; hl <- tile
+Player_GetTileWithOffset: PROC
 	ld l,(ix + Player.currentTile)
 	ld h,(ix + Player.currentTile + 1)
 	ld a,(ix + Player.position.x)

          
@@ 126,10 120,14 @@ Player_GetTileDataPointerWithOffset: PRO
 DecreaseX:
 	dec hl
 	dec hl
+	dec hl
+	dec hl
 	jr ContinueX
 IncreaseX:
 	inc hl
 	inc hl
+	inc hl
+	inc hl
 ContinueX:
 	ld a,(ix + Player.position.y)
 	and 0FH

          
@@ 173,7 171,7 @@ Player_TickPrimary:
 Player_TickPosition:
 	ld c,(ix + Player.velocity.x)
 	ld e,(ix + Player.velocity.y)
-	call Player_GetTileDataPointerWithOffset
+	call Player_GetTileWithOffset
 	ld (ix + Player.currentTile),l
 	ld (ix + Player.currentTile + 1),h
 	ld l,(ix + Player.position.x)

          
@@ 262,7 260,7 @@ Player_CanMove:
 	push bc
 	push de
 	push ix
-	call Player_GetTileWithOffset
+	call Player_GetTileWithOffset_IX
 	Tile_IsSolid_M ix
 	pop ix
 	pop de

          
M src/TileMap.asm +13 -13
@@ 5,7 5,7 @@ TileMap: MACRO ?width, ?height, ?palette
 	size:
 		Vector2W ?width, ?height
 	widthStride:
-		dw ?width * 2
+		dw ?width * Tile._size
 	palette:
 		dw ?palette
 	data:

          
@@ 54,21 54,18 @@ TileMap_PixelToTilePosition:
 ; ix = this
 ; ix <- tile
 ; Modifies: af, bc, de, hl
-TileMap_GetTile:
-	call TileMap_GetTileDataPointer
-	ld a,(hl)
-	ld ixl,a
-	inc l
-	ld a,(hl)
-	ld ixh,a
+TileMap_GetTile_IX:
+	call TileMap_GetTile
+	push hl
+	pop ix
 	ret
 
 ; bc = x
 ; de = y
 ; ix = this
-; hl <- tile data pointer
+; hl <- tile
 ; Modifies: af, bc, de
-TileMap_GetTileDataPointer: PROC
+TileMap_GetTile: PROC
 	bit 7,d
 	jr nz,Negative
 	ld h,(ix + TileMap.size.x)

          
@@ 87,6 84,7 @@ Negative:
 Continue:
 	add hl,bc
 	add hl,hl
+	add hl,hl
 	ld e,(ix + TileMap.data.address)
 	ld d,(ix + TileMap.data.address + 1)
 	add hl,de

          
@@ 95,16 93,18 @@ Continue:
 
 ; c = x offset
 ; e = y offset
-; hl = tile data pointer
+; hl = tile
 ; ix = this
-; hl <- tile data pointer
-TileMap_OffsetTileDataPointer: PROC
+; hl <- tile
+TileMap_OffsetTile: PROC
 	ld a,c
 	add a,a
 	sbc a,a  ; sign extend
 	ld b,a
 	add hl,bc
 	add hl,bc
+	add hl,bc
+	add hl,bc
 	ld a,e
 	and a
 	ret z

          
M tools/tilemaps.js +5 -10
@@ 21,14 21,14 @@ class TileMap {
 	toAsm(screenMode) {
 		checkTypes(arguments, "number");
 		const lines = [];
-		lines.push(`${this.name}_instance:`)
-		lines.push(`\tTileMap ${this.tiles.width}, ${this.tiles.height}, ${this.tileSet.name}_palette, ${this.name}_data`);
+		lines.push(`${this.name}_instance:`);
+		lines.push(`\tTileMap ${this.tiles.width}, ${this.tiles.height}, ${this.tileSet.name}_palette, ${this.name}_tiles`);
 		lines.push("");
 		lines.push("\tSECTION ROM_DATA");
 		lines.push("\tALIGN ROMMapper_BANK_SIZE");
-		lines.push(`${this.name}_data:`);
+		lines.push(`${this.name}_tiles:`);
 		for (const tile of this.tiles.toArray()) {
-			lines.push(`\tdw ${this.tileSet.name}_${tile.getName()}`);
+			lines.push(`\tTile ${this.tileSet.name}_${tile.getName()}_pixels, ${tile.collision}`);
 		}
 		lines.push("\tENDS");
 		lines.push("");

          
@@ 71,15 71,10 @@ class TileSet {
 	toAsm(screenMode) {
 		checkTypes(arguments, "number");
 		const lines = [];
-		lines.push(`${this.name}_tiles:`);
-		for (const tile of this.tiles) {
-			lines.push(`${this.name}_${tile.getName()}: Tile ${this.name}_pixelData_${tile.getName()}, ${tile.collision}`);
-		}
-		lines.push("");
 		lines.push("\tSECTION ROM_DATA");
 		lines.push("\tALIGN 100H");
 		for (const tile of this.tiles) {
-			lines.push(`${this.name}_pixelData_${tile.getName()}:`);
+			lines.push(`${this.name}_${tile.getName()}_pixels:`);
 			lines.push(tile.toAsm(screenMode));
 		}
 		lines.push("\tENDS");