Skip to content

Commit

Permalink
Update tests and run black
Browse files Browse the repository at this point in the history
  • Loading branch information
AngheloAlf committed Nov 19, 2024
1 parent 237a415 commit 6a75919
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
8 changes: 3 additions & 5 deletions src/splat/segtypes/common/asm.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ def get_file_header(self) -> List[str]:

ret.append('.include "macro.inc"')
ret.append("")
ret.append(".set noat") # allow manual use of $at
ret.append(".set noreorder") # don't insert nops after branches
ret.append(".set noat") # allow manual use of $at
ret.append(".set noreorder") # don't insert nops after branches
if options.opts.add_set_gp_64:
ret.append(
".set gp=64" # allow use of 64-bit general purpose registers
)
ret.append(".set gp=64") # allow use of 64-bit general purpose registers
ret.append("")
preamble = options.opts.generated_s_preamble
if preamble:
Expand Down
12 changes: 10 additions & 2 deletions src/splat/segtypes/common/asmtu.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ def split(self, rom_bytes: bytes):
if sibling is None:
continue

if isinstance(sibling, CommonSegCodeSubsegment) and sibling.spim_section is not None and not sibling.should_split():
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())
Expand All @@ -51,7 +55,11 @@ def split(self, rom_bytes: bytes):
# Already handled on the above loop
continue

if isinstance(sibling, CommonSegCodeSubsegment) and sibling.spim_section is not None and not sibling.should_split():
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())
2 changes: 1 addition & 1 deletion test/basic_app/expected/asm/data/main.bss.s
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
2 changes: 1 addition & 1 deletion test/basic_app/expected/asm/data/main.data.s
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.include "macro.inc"

.section .data
.section .data, "wa"

glabel D_80000500
/* 1100 80000500 00000001 */ .word 0x00000001
Expand Down
7 changes: 3 additions & 4 deletions test/basic_app/expected/asm/handwritten.s
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
.include "macro.inc"

/* assembler directives */
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
.set gp=64 /* allow use of 64-bit general purpose registers */
.set noat
.set noreorder
.set gp=64

.section .text, "ax"

Expand Down

0 comments on commit 6a75919

Please sign in to comment.