Syscall 2: Firmware, home

DriverChapter 4: Stars and hubs

D2LOOPBACK

The task

Transmit every received byte back, unchanged.

A loopback test sends bytes down the line and checks that they come back.

Transmit every byte the card receives, unchanged, as soon as it arrives.

IN waits until a byte has arrived and stores it in a register. OUT transmits the low byte of a register.

The board

The line card of LOOPBACKThe line card: registers A, 4 lines of ROM, no RAM, a 16 byte receive buffer, a stack 8 deep. It talks to the line.LINETHE FAR ENDRXTXCARDREGISTERSAROM4 LINESRAMNONERX BUFFER16 BYTESSTACK8 DEEPUNITSNONE
The line card this ticket gives you, with its registers, memory, buffers, and units. On a narrow screen, scroll the board sideways to see all of it.

Key idea

After the last line the card continues at the first, so this program needs no jump.

Hints

Each hint goes a step further than the one before. Open them one at a time.

Hint 1Show

IN A waits for the next received byte and puts it in register A.

Hint 2Show

Receive a byte, then transmit it. The card repeats the program by itself after the last line.

Hint 3Show

Two lines: IN A, then OUT A.

Solution

Reveal the Full SolutionThe complete program for LOOPBACK. 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.

        IN A
        OUT A
TICKS
37
at par
LINES
2
at par