Hide

Problem E
R0: Disassemble

This is the $1$st of $4$ steps in the SRE problem. The complete problem specification is on the NSA Cyber Challenge website.

Encoding

The input lines are binary data encoded as a string using the “hexlify” method (named for the way Python implements it in the binascii module). The binary $16$-bit unsigned integer represented in hexadecimal as 0xBEEF would simply be converted into an ASCII string “beef” (always use lower-case letters). The most significant bytes come first.

Input

The input is a binary MARIE program image represented as a series of hexadecimal strings. Each line will contain one string (a $16$-bit word) for each memory location. There will be less than or equal to $4\, 096$ lines.

Output

Output one line per compiled instruction. Each line should contain the memory address of that instruction, the symbolic name of the instruction, and, if an argument is used, the value of that argument.

Memory values should be output as $4$ zero-padded hexadecimal digits. Addresses (and immediate operands) should be output as $3$ zero-padded hexadecimal digits.

Sample Input 1 Sample Output 1
a000
5000
8800
9007
300a
200a
9001
100a
6000
7000
0000
000: Clear
001: Input
002: Skipcond 800
003: Jump 007
004: Add 00a
005: Store 00a
006: Jump 001
007: Load 00a
008: Output
009: Halt
00a: HEX 0000

Please log in to submit a solution to this problem

Log in