D17BYTE ORDER
The task
Transmit each pair of host bytes in the opposite order.
The tide gauge keeps every reading as a 16-bit number with the low byte first. The harbor office's receiver reads the high byte first.
Each host message is a run of readings, two bytes each, low byte first. Transmit every reading high byte first. A message may be empty, and it never ends halfway through a reading.
The board
Key idea
OUT sends the low byte of a register, as before. The end of a message can only come where a new reading would start, so the second HIN needs no check.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Read the low byte into A and the high byte into B, then transmit B before A.
Hint 2Show
Only the first byte of a reading can be the end of the message. When HIN gives -1 there, go back to the top for the next message.
Hint 3Show
TOP: HIN A, JEQ A, -1, TOP, HIN B, OUT B, OUT A. The card wraps back to top by itself.
Solution
Reveal the Full SolutionThe complete program for BYTE ORDER. Open it only when you want the answer.
The reference program
The game's own solution to this ticket. It passes every test and scores exactly par on every benchmark.
TOP: HIN A
JEQ A, -1, TOP
HIN B
OUT B
OUT A- TICKS
- 87
- at par
- LINES
- 5
- at par