Created
July 9, 2018 11:17
-
-
Save zonque/83ee303fe434e3da7df935261d09b1b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# | |
# Reads lines from STDIN such as | |
# | |
# 00000001 01234578 | |
# | |
# and assumes that the first column is a register offset and the 2nd is a value. | |
# | |
# Will then output the all registers ever accessed with the value they were set to last. | |
# | |
regs = {} | |
STDIN.read.split("\n").each do |line| | |
a = line.split(' ') | |
regs[a[0]] = a[1] | |
end | |
regs.sort.to_h.each do |reg, val| | |
print "#{reg}: #{val}\n" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment