Created
June 2, 2024 20:49
-
-
Save sozud/ae6837a24bc8bb4e8bcc89d3e14d83f4 to your computer and use it in GitHub Desktop.
split
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
import re | |
def parse_data(data): | |
result = [] | |
lines = data.strip().split('\n') | |
current_label = None | |
for i in range(len(lines) - 1): | |
line = lines[i] | |
if line.startswith('glabel'): | |
current_label = line.split()[1] | |
split = lines[i + 1].split(' ') | |
num = int(split[1], 16) | |
if num % 16 == 0: | |
result.append(f" - [0x{split[1]}, data] # {current_label}") | |
return result | |
f = open("./asm/pspeu/st/wrp_psp/data/E980.data.s", "r") | |
data = f.read() | |
parsed_data = parse_data(data) | |
for line in parsed_data: | |
print(line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment