-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove redundant `asm` segments * create asmtu * Avoid writing sections that start with a dot * Hack to avoid bss not being generated until the bug is fixed upstream * docs * Update tests and run black * Remove hack
- Loading branch information
1 parent
2868251
commit 0660458
Showing
22 changed files
with
145 additions
and
121 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
from pathlib import Path | ||
from typing import Optional, TextIO | ||
|
||
from ...util import log, options | ||
|
||
from .asm import CommonSegAsm | ||
from .codesubsegment import CommonSegCodeSubsegment | ||
|
||
|
||
class CommonSegAsmtu(CommonSegAsm): | ||
def split(self, rom_bytes: bytes): | ||
if self.rom_start == self.rom_end: | ||
return | ||
|
||
if self.spim_section is None: | ||
return | ||
|
||
out_path = self.out_path() | ||
assert out_path is not None, str(self) | ||
|
||
out_path.parent.mkdir(parents=True, exist_ok=True) | ||
|
||
self.print_file_boundaries() | ||
|
||
with open(out_path, "w", newline="\n") as f: | ||
# Write `.text` contents | ||
for line in self.get_file_header(): | ||
f.write(line + "\n") | ||
f.write(self.spim_section.disassemble()) | ||
|
||
# Disassemble the siblings to this file by respecting the `section_order` | ||
for sect in self.section_order: | ||
if sect == self.get_linker_section_linksection(): | ||
continue | ||
|
||
sibling = self.siblings.get(sect) | ||
if sibling is None: | ||
continue | ||
|
||
if ( | ||
isinstance(sibling, CommonSegCodeSubsegment) | ||
and sibling.spim_section is not None | ||
and not sibling.should_split() | ||
): | ||
f.write("\n") | ||
f.write(f"{sibling.get_section_asm_line()}\n\n") | ||
f.write(sibling.spim_section.disassemble()) | ||
|
||
# Another loop to check anything that somehow may not be present on the `section_order` | ||
for sect, sibling in self.siblings.items(): | ||
if sect == self.get_linker_section_linksection(): | ||
continue | ||
|
||
if sect in self.section_order: | ||
# Already handled on the above loop | ||
continue | ||
|
||
if ( | ||
isinstance(sibling, CommonSegCodeSubsegment) | ||
and sibling.spim_section is not None | ||
and not sibling.should_split() | ||
): | ||
f.write("\n") | ||
f.write(f"{sibling.get_section_asm_line()}\n\n") | ||
f.write(sibling.spim_section.disassemble()) |
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
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
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
from . import asm as asm | ||
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
from . import asm as asm | ||
from . import header as header |
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
.include "macro.inc" | ||
|
||
.section .bss | ||
.section .bss, "wa" | ||
|
||
glabel D_80000540 | ||
/* 80000540 */ .space 0x80 |
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
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