#!/usr/bin/python

import string,sys
# Usage: strings wlan6061.txt.pdb | grep ^.80 | sed 's/^.8000//g' | python pretty-cis
# where wlan6061.txt.pdb is a dump of x8000000 with Haret/P

# base converter borrowed from:
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/111286 
#
BASE2 = "01"
BASE10 = "0123456789"
BASE16 = "0123456789ABCDEF"
BASE62 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"

def baseconvert(number,fromdigits,todigits):
    if str(number)[0]=='-':
        number = str(number)[1:]
        neg=1
    else:
        neg=0

    # make an integer out of the number
    x=long(0)
    for digit in str(number):
       x = x*len(fromdigits) + fromdigits.index(digit)
    
    # create the result in base 'len(todigits)'
    res=""
    while x>0:
        digit = x % len(todigits)
        res = todigits[digit] + res
        x /= len(todigits)
    if neg:
        res = "-"+res

    return res

def outb(addr, b):
	char =  chr(b) in string.printable and chr(b) not in '\r\n\t' and chr(b) or ' '
	bin = baseconvert(b,BASE10,BASE2)
	bin = (8-len(bin))*'0' + bin
	print '%3x: %2x %3d %s %s' % (addr, b, b, char, bin) 
	
for line in sys.stdin:
	line = line.strip()
	addr, bytes = line.split(':')
	bytes = bytes.strip()
	byte0 = int(bytes[4:6],16)
	byte1 = int(bytes[0:2],16)
	addr = int(addr,16)
	
	if addr >= 0x200: break
	outb(addr, byte0)
	outb(addr+2, byte1)
	
	
