The room format in Technician Ted is very different from Manic Miner and Jet Set Willy,
which have a fixed grid that is simple to decode.
Instead, it has a mini Logo-style language, which takes advantage of the fact that most rooms
in platform games contain either empty space to move into, or long rows or columns.
The tables for each room are pointed to by the value in (A471) - normally E1E6 and are
offsets from a base pointer stored in (A473) - normally E248. The structure is then:
1 byte for the border
1 byte for the background colour
Three UDG tables. The first is for the main screen, the others for the alternative screens (not always used).
Each byte is a command that moves a direction on screen and optionally does something else:
Bit 0 - If set, the direction is up / down, otherwise it is left / right
Bit 1 - If set, the direction if left or up, otherwise it is right or down
Bit 2 - If set, draw the current UDG here, otherwise draw whitespace
Bit 3 - If set, change to a UDG stored in bits 1-7 of the following byte. If bit 0 of that byte is set, change the attribute to the byte after that.
If the UDG is 7F (ie: byte is FE), it marks the end of the table.
However, if bit n + 2 in this room's flag table (stored as an offset from 7DC0) is set,
and this is the 'n'th UDG change in the room (counting from 0), the UDG will NOT be printed.
Bit 4 - 7 : The direction to move in (0 - 15)
If the room has task buttons, the room has the following additional data:
Two sets of three bytes containing task button information, with the format:
Byte 0 - If bit 0 is set, the button is in the top half of the screen,
otherwise it is in the bottom half. Bits 1-7 hold the attribute of the button.
Byte 1 - The character position of the button (row x $20 + column)
Byte 2 - Bits 0 - 4 contain the offset of the button graphic
relative to the value in (A467) - normally C609
Followed by three bytes :
Byte 0 - If bit 4 is set, the task must be completed megaquickly!
Byte 1 - Bits 0 - 5 hold the number of a room where an effect
should be triggered if the task in this room is completed. If the room
is this room, the effect is triggered as soon as the first task box is touched instead.
Byte 2 - A bitmask that flips bits on on the respective room flag (stored as an offset from 7DC0).
This allows the same room to change multiple times in different places.
If a room has no task buttons, 0 is stored here instead.
A 0 terminated list of WATER attributes that can be walked through. A pointer to this is copied to A41D
A 0 terminated list of EARTH attributes that can be stood on but not walked through.
A 0 terminated list of conveyor belt attributes in the room. A pointer to this is copied to A41F
Note, if Ted walks into any other attribute not defined in this list (or is the background colour), it is deadly
and will forfeit a life.
Either Ted has touched a moving object or a dangerous static object (eg: coat hook)
A list of moving objects in the room. Each entry has the following format:
Byte 0 : Various flags. Bit 0 - Set to appear in top half of screen, reset to appear in bottom half
Bit 7 - Set for up / down, reset for left : right
Byte 1 : Initial position (row * $20 + column)
Byte 2 - 3 : Screen bounds
Byte 4 : Attribute
Byte 5 : Graphic ID
If bit 3 of byte 0 is set, the next byte is the offset to apply between animation frames. If the bit is reset, this is 1.
Byte 6 / 7 : Bits 0 - 2 are put into offset 12. Bits 3 - 5 contain the number of set bits to put in entry 1C
If bit 3 of byte 0 is set, the next byte is put into offset 18 / 19, otherwise 1 is put there
If bit 2 of byte 0 is set, the next byte is the speed, otherwise 0 is put there
The list is ended with two null bytes.
1 byte for the attribute for the status text
1 byte for the attribute for the title
1 byte for the X offset where the title should start
The title, in ASCII format, with bit 7 set on the last character.