Updated Hardware: LiDAR (markdown)

DBJ314 2018-12-22 21:13:34 -05:00
parent 7e55611dba
commit 0d9572c788

@ -13,7 +13,7 @@ Hardware ID: `0x0003`
| `2` | `LIDAR_GET_PATH` | `50 kJ` | Calculates the shortest path to the specified coordinates and copies it into memory ([more info](#lidar_get_path)). | | `2` | `LIDAR_GET_PATH` | `50 kJ` | Calculates the shortest path to the specified coordinates and copies it into memory ([more info](#lidar_get_path)). |
| `3` | `LIDAR_GET_MAP` | `10 kJ` | Generates a map of the [world](./World) the Cubot is currently in and copies it into memory ([more info](#lidar_get_map)). | | `3` | `LIDAR_GET_MAP` | `10 kJ` | Generates a map of the [world](./World) the Cubot is currently in and copies it into memory ([more info](#lidar_get_map)). |
| `4` | `LIDAR_GET_WORLD_POS` | `0 kJ` | Copies the current (x,y) [universe coordinates](./Game-Universe) of the Cubot into the X and Y registers. | | `4` | `LIDAR_GET_WORLD_POS` | `0 kJ` | Copies the current (x,y) [universe coordinates](./Game-Universe) of the Cubot into the X and Y registers. |
| `5` | `LIDAR_GET_WORLD_SIZE` | `0 kJ` | Copies the current world dimensions into the X and Y registers. |
#### LIDAR_GET_PATH #### LIDAR_GET_PATH
Generates a path as a sequence of words, each representing a direction. The generated path starts at the address specified in the C register but varies in length. It is terminated with the word `0xAAAA`, which represents the end of the path. If a path could not be generated, then the memory at address specified in the C register is set to `0xFFFF` (Note: The path terminator is not written for invalid paths). Generates a path as a sequence of words, each representing a direction. The generated path starts at the address specified in the C register but varies in length. It is terminated with the word `0xAAAA`, which represents the end of the path. If a path could not be generated, then the memory at address specified in the C register is set to `0xFFFF` (Note: The path terminator is not written for invalid paths).
@ -35,7 +35,7 @@ The memory of a 4 tile path consisting of moving the Cubot north twice, once wes
| Value | `0x00` | `0x00` | `0x03` | `0x01` | `0xAAAA` | | Value | `0x00` | `0x00` | `0x03` | `0x01` | `0xAAAA` |
#### LIDAR_GET_MAP #### 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. Generates a map of the current world as a sequence of words, each word representing a tile. The starting address of the generated map must be specified with the X register. The exact size depends on the world you are in. The LiDAR reads the tiles west to east, north to south: (0,0) (1,0) (2,0) ... (world-size-x -1,0) (0,1) (1,1) ... The first world-size-X words will be the north-most row from west to east, the next world-size-X words will be the next row down (south), etc. Ending with the south-east most tile.
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. 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.