Syscall 2: Firmware, home

DriverChapter 6: Trees

D15PAIR SUM

The task

Bytes arrive in pairs. Transmit the low byte of each pair's sum.

Bytes arrive in pairs. Transmit the low byte of each pair's sum.

The board

The line card of PAIR SUMThe line card: registers A B, 8 lines of ROM, no RAM, a 16 byte receive buffer, a stack 8 deep. It talks to the line.LINETHE FAR ENDRXTXCARDREGISTERSA BROM8 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

A pair that sums past 255 still transmits one byte. Do not send the carry.

Hints

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

Hint 1Show

Read the first byte into A and the second into B. ADD A, B adds them.

Hint 2Show

200 plus 100 is 300. The low byte of 300 is 44, and that is what OUT sends.

Hint 3Show

IN A, IN B, ADD A, B, OUT A. Then the card waits for the next pair.

Solution

Reveal the Full SolutionThe complete program for PAIR SUM. 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
        IN B
        ADD A, B
        OUT A
TICKS
35
at par
LINES
4
at par