From 72d6efa5393354e7f98518c0ae58ab475e6853b9 Mon Sep 17 00:00:00 2001 From: Simon Fortier Date: Tue, 27 Nov 2018 16:00:06 -0500 Subject: [PATCH] Updated GET_MAP with newest commit --- Hardware:-LiDAR.md | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/Hardware:-LiDAR.md b/Hardware:-LiDAR.md index 7218da5..744a052 100644 --- a/Hardware:-LiDAR.md +++ b/Hardware:-LiDAR.md @@ -37,27 +37,31 @@ The memory of a 4 tile path consisting of moving the Cubot north twice, once wes #### LIDAR_GET_MAP Generates a map of the current world as a sequence of 256 words, each word representing a tile. The starting address of the generated map must be specified with the X register. The LiDAR reads the tiles west to east, north to south: (0,0) (1,0) (2,0) ... (15,0) (0,1) (1,1) ... The first 16 words will be the north-most row from west to east, the next 16 words will be the next row down (south), etc. Ending with the south-east most tile. -Each tile is encoded as a bit field. Tiles may contain more than one thing, in which case the value is the bit fields of each thing it contains `OR`'d together. For example, a tile with copper and an NPC would have the bit field `0000 0001 0100 0000` (`0x0140`). +Each tile is encoded as a bit field with the following format `OOOOOOOO TTTTTTTB`. Starting from the left, the first byte specifies the object ID on this tile, the next 7 bits specifies the tile ID. The rightmost bit indicates if the tile is `blocked` or not. -##### Tile content bit fields +##### Object IDs: | Bit field | Value | Content | | :---------------------| :------- | :------------------- | -| `1000 0000 0000 0000` | `0x8000` | Blocked (wall) tile | -| `0100 0000 0000 0000` | `0x4000` | Biomass | -| `0010 0000 0000 0000` | `0x2000` | Factory* | -| `0001 0000 0000 0000` | `0x1000` | Radio Tower | -| `0000 1000 0000 0000` | `0x0800` | Vault | -| `0000 0100 0000 0000` | `0x0400` | Electric Box | -| `0000 0010 0000 0000` | `0x0200` | Iron tile | -| `0000 0001 0000 0000` | `0x0100` | Copper tile | -| `0000 0000 1000 0000` | `0x0080` | Cubot | -| `0000 0000 0100 0000` | `0x0040` | NPC | -| `0000 0000 0010 0000` | `0x0020` | Portal | -| `0000 0000 0001 0000` | `0x0010` | | -| `0000 0000 0000 1000` | `0x0008` | | -| `0000 0000 0000 0100` | `0x0004` | | -| `0000 0000 0000 0010` | `0x0002` | | -| `0000 0000 0000 0001` | `0x0001` | | -| `0000 0000 0000 0000` | `0x0000` | Nothing | +| `0000 0001 0000 0001` | `0x0101` | [Biomass blob](https://github.com/simon987/Much-Assembly-Required/wiki/Biomass) | +| `0000 0010 0000 0001` | `0x0201` | [Cubot](https://github.com/simon987/Much-Assembly-Required/wiki/The-Cubot-Manuals) | +| `0000 0011 0000 0001` | `0x0301` | [Electric Box]() | +| `0000 0100 0000 0001` | `0x0401` | [Factory](https://github.com/simon987/Much-Assembly-Required/wiki/NPC-Factory) | +| `0000 0101 0000 0001` | `0x0501` | [NPC](https://github.com/simon987/Much-Assembly-Required/wiki/Non-Player-Character-(NPC)) | +| `0000 0110 0000 0001` | `0x0601` | Reserved | +| `0000 0111 0000 0001` | `0x0701` | Reserved | +| `0000 1000 0000 0001` | `0x0801` | [Portal]() | +| `0000 1001 0000 0001` | `0x0901` | [Radio Tower](https://github.com/simon987/Much-Assembly-Required/wiki/Radio-Tower) | +| `0000 1010 0000 0001` | `0x0A01` | Reserved | +| `0000 1011 0000 0000` | `0x0B00` | Reserved | + +##### Tile IDs: +| Bit field | Value | Content | +| :---------------------| :------- | :------------------- | +| `0000 0000 1111 1111` | `0x00FF` | Void | +| `0000 0000 0000 0000` | `0x0000` | Plain | +| `0000 0000 0000 0011` | `0x0003` | Wall | +| `0000 0000 0000 0100` | `0x0004` | Iron tile | +| `0000 0000 0000 0110` | `0x0006` | Copper tile | +| `0000 0000 0000 1000` | `0x0008` | Vault floor | +| `0000 0000 0000 1011` | `0x000B` | Vault wall | -\* Factories are supposed to use the bit field `0x2000` but due to a bug they instead use the same bit field as iron tiles (`0x0200`). See [#170](https://github.com/simon987/Much-Assembly-Required/issues/170). \ No newline at end of file