D27IDLE LINE
The task
Deliver received bytes; after 20 quiet ticks, deliver $0A once.
The cab radios send each message as one burst with no length and no end byte. The dispatcher's terminal can only tell that a message is over when the line goes quiet.
Deliver every received byte to the host. When 20 ticks pass after a byte with no byte following it, deliver $0A to end the message. Deliver one $0A per message, however long the quiet lasts.
This card has a timer. TMR 20 sets it to run out 20 ticks from now. IN A, QUIET waits for a byte as usual, but jumps to QUIET instead if the timer runs out first.
The board
Key idea
Within a burst the bytes come no more than 8 ticks apart, and between messages the line stays quiet for far longer than 20 ticks.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Wait for the first byte of a message with a plain IN A, which ignores the timer: nothing should time out between messages.
Hint 2Show
After each byte, start the timer again with TMR 20, so it measures the quiet since the last byte, then wait with IN A, QUIET.
Hint 3Show
TOP: IN A. BYTE: HOUT A, TMR 20, IN A, QUIET, JMP BYTE. QUIET: HOUT $0A, and the card wraps back to top.
Solution
Reveal the Full SolutionThe complete program for IDLE LINE. 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: IN A
BYTE: HOUT A
TMR 20
IN A, QUIET
JMP BYTE
QUIET: HOUT $0A- TICKS
- 316
- at par
- LINES
- 6
- at par