Beispiel #1
0
def _peek(snapshot, specs):
    for addr1, addr2, step in _get_address_ranges(specs):
        for a in range(addr1, addr2 + 1, step):
            value = snapshot[a]
            char = get_char(value, '', 'UDG-{}', True)
            print('{0:>5} {0:04X}: {1:>3}  {1:02X}  {1:08b}  {2}'.format(
                a, value, char))
Beispiel #2
0
def _get_str(data):
    text = ''
    for b in data:
        if b == 13:
            text += '\n'
        else:
            text += get_char(b, '?', '?')
    return text
Beispiel #3
0
def _get_str(data):
    text = ''
    for b in data:
        if b == 13:
            text += '\n'
        else:
            text += get_char(b, '?', '?')
    return text
Beispiel #4
0
def _hex_dump(data, row_size=16):
    lines = []
    for index in range(0, len(data), row_size):
        values = data[index:index + row_size]
        values_hex = ' '.join('{:02X}'.format(b)
                              for b in values).ljust(row_size * 3)
        values_text = ''.join(get_char(b, '.', '.') for b in values)
        lines.append('{:04X}  {} {}'.format(index, values_hex, values_text))
    return '\n'.join(lines)
Beispiel #5
0
def _get_str(data, dump=False):
    if dump and any(b > 127 or (b < 31 and b not in CHARS) for b in data):
        return _hex_dump(data, False)
    text = ''
    for b in data:
        if b in CHARS:
            text += CHARS[b]
        else:
            text += get_char(b, '?', '?')
    return text
Beispiel #6
0
def _peek(snapshot, specs, fmt):
    for addr1, addr2, step in _get_address_ranges(specs):
        for a in range(addr1, addr2 + 1, step):
            value = snapshot[a]
            char = get_char(value, '', 'UDG-{}', True)
            print(fmt.format(address=a, value=value, char=char))
Beispiel #7
0
def _peek(snapshot, specs):
    for addr1, addr2, step in _get_address_ranges(specs):
        for a in range(addr1, addr2 + 1, step):
            value = snapshot[a]
            char = get_char(value, '', 'UDG-{}', True)
            print('{0:>5} {0:04X}: {1:>3}  {1:02X}  {1:08b}  {2}'.format(a, value, char))