From 6a759197c7c5ed5e7fb4be8f7d278f3a1be83297 Mon Sep 17 00:00:00 2001 From: angie Date: Tue, 19 Nov 2024 17:25:51 -0300 Subject: [PATCH] Update tests and run black --- src/splat/segtypes/common/asm.py | 8 +++----- src/splat/segtypes/common/asmtu.py | 12 ++++++++++-- test/basic_app/expected/asm/data/main.bss.s | 2 +- test/basic_app/expected/asm/data/main.data.s | 2 +- test/basic_app/expected/asm/handwritten.s | 7 +++---- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/splat/segtypes/common/asm.py b/src/splat/segtypes/common/asm.py index 47c4af8e..a9f8edc6 100644 --- a/src/splat/segtypes/common/asm.py +++ b/src/splat/segtypes/common/asm.py @@ -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: diff --git a/src/splat/segtypes/common/asmtu.py b/src/splat/segtypes/common/asmtu.py index ddedc201..c726571b 100644 --- a/src/splat/segtypes/common/asmtu.py +++ b/src/splat/segtypes/common/asmtu.py @@ -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()) @@ -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()) diff --git a/test/basic_app/expected/asm/data/main.bss.s b/test/basic_app/expected/asm/data/main.bss.s index 244e606e..ff599a47 100644 --- a/test/basic_app/expected/asm/data/main.bss.s +++ b/test/basic_app/expected/asm/data/main.bss.s @@ -1,6 +1,6 @@ .include "macro.inc" -.section .bss +.section .bss, "wa" glabel D_80000540 /* 80000540 */ .space 0x80 diff --git a/test/basic_app/expected/asm/data/main.data.s b/test/basic_app/expected/asm/data/main.data.s index 262b33f3..f026c79e 100644 --- a/test/basic_app/expected/asm/data/main.data.s +++ b/test/basic_app/expected/asm/data/main.data.s @@ -1,6 +1,6 @@ .include "macro.inc" -.section .data +.section .data, "wa" glabel D_80000500 /* 1100 80000500 00000001 */ .word 0x00000001 diff --git a/test/basic_app/expected/asm/handwritten.s b/test/basic_app/expected/asm/handwritten.s index d2f5f579..b472ca57 100644 --- a/test/basic_app/expected/asm/handwritten.s +++ b/test/basic_app/expected/asm/handwritten.s @@ -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"