Files
vt1200/lat/notes/ua.py
T

29 lines
628 B
Python

#!/usr/bin/env python3
"""Dump unidasm lines for a BYTE-offset range (address = byte_offset*8).
Usage: ua.py START_OFF END_OFF
"""
import sys
PATH = "/tmp/opencode/v22.asm"
def main():
start = int(sys.argv[1], 0) * 8
end = int(sys.argv[2], 0) * 8
with open(PATH) as f:
for line in f:
head = line.split(":", 1)[0].strip()
if not head:
continue
try:
a = int(head, 16)
except ValueError:
continue
if start <= a < end:
print(line.rstrip("\n"))
if __name__ == "__main__":
main()