21 lines
387 B
Sed
Executable file
21 lines
387 B
Sed
Executable file
#!/bin/sed -Ef
|
|
/^[0-9A-F]{8}/ {
|
|
# address hexdump disasm
|
|
h
|
|
# Extract address and code into a comment
|
|
s/^0*(([0-9A-F]{4})+) +[0-9A-F]+ +(.*)$/; \1 \3/
|
|
x
|
|
# Extract hexdump
|
|
s/^[0-9A-F]+ +([0-9A-F]+) +.*$/\1/
|
|
# Combine
|
|
G
|
|
s/^([0-9A-F]+)./\1 /
|
|
}
|
|
# -hexdump
|
|
s/^ +-//
|
|
|
|
: separate
|
|
s/^((0x[0-9A-F]{2}, )*)([0-9A-F]{2})/\10x\3, /
|
|
t separate
|
|
|
|
s/^((0x[0-9A-F]{2}, )*0x[0-9A-F]{2}), /db \1/
|