Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
AngheloAlf committed Mar 19, 2024
1 parent 1ac8368 commit 2da5509
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 30 deletions.
6 changes: 1 addition & 5 deletions src/splat/segtypes/common/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,7 @@ def split(self, rom_bytes: bytes):
if preamble:
f.write(preamble + "\n")

f.write(f".section {self.get_linker_section_linksection()}")
section_flags = self.get_section_flags()
if section_flags:
f.write(f', "{section_flags}"')
f.write("\n\n")
f.write(f"{self.get_section_asm_line()}\n\n")

f.write(self.spim_section.disassemble())

Expand Down
6 changes: 1 addition & 5 deletions src/splat/segtypes/common/textbin.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ def write_asm_contents(self, rom_bytes, f: TextIO):
assert isinstance(self.rom_start, int)
assert isinstance(self.rom_end, int)

f.write(f".section {self.get_linker_section_linksection()}")
section_flags = self.get_section_flags()
if section_flags:
f.write(f', "{section_flags}"')
f.write("\n\n")
f.write(f"{self.get_section_asm_line()}\n\n")

# Check if there's a symbol at this address
sym = None
Expand Down
6 changes: 1 addition & 5 deletions src/splat/segtypes/n64/asm.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ def get_file_header(self):
ret.append(preamble)
ret.append("")

line = f".section {self.get_linker_section_linksection()}"
section_flags = self.get_section_flags()
if section_flags:
line += f', "{section_flags}"'
ret.append(line)
ret.append(self.get_section_asm_line())
ret.append("")

return ret
6 changes: 1 addition & 5 deletions src/splat/segtypes/n64/hasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ def get_file_header(self):
ret.append(preamble)
ret.append("")

line = f".section {self.get_linker_section_linksection()}"
section_flags = self.get_section_flags()
if section_flags:
line += f', "{section_flags}"'
ret.append(line)
ret.append(self.get_section_asm_line())
ret.append("")

return ret
6 changes: 1 addition & 5 deletions src/splat/segtypes/ps2/asm.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ def get_file_header(self):
ret.append(preamble)
ret.append("")

line = f".section {self.get_linker_section_linksection()}"
section_flags = self.get_section_flags()
if section_flags:
line += f', "{section_flags}"'
ret.append(line)
ret.append(self.get_section_asm_line())
ret.append("")

return ret
6 changes: 1 addition & 5 deletions src/splat/segtypes/psx/asm.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ def get_file_header(self):
ret.append(preamble)
ret.append("")

line = f".section {self.get_linker_section_linksection()}"
section_flags = self.get_section_flags()
if section_flags:
line += f', "{section_flags}"'
ret.append(line)
ret.append(self.get_section_asm_line())
ret.append("")

return ret
7 changes: 7 additions & 0 deletions src/splat/segtypes/segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,13 @@ def get_section_flags(self) -> Optional[str]:
"""
return None

def get_section_asm_line(self) -> str:
line = f".section {self.get_linker_section_linksection()}"
section_flags = self.get_section_flags()
if section_flags:
line += f', "{section_flags}"'
return line

def out_path(self) -> Optional[Path]:
return None

Expand Down

0 comments on commit 2da5509

Please sign in to comment.