Arm/7seg

From ASMBits

arm/hexstrPrevious

Write a function that will compute a 7-bit value suitable for displaying one hexadecimal digit (0 to f) on a seven-segment display. Each of the display's segments maps to one bit of the number, as indicated in the diagram below (1=on, 0=off). Because the display has 7 segments, only the lowest 7 bits are used. Set the upper bits to zero.

Your function will be passed one parameter: The number to be displayed (guaranteed to be 0 to 15). Return the appropriate bit pattern.

Expected solution length: Around 3 lines.

Sample Input

r0=8

Sample Output

r0=0x7f

Write your solution here

Upload a source file...