Skip to content

Commit

Permalink
Avoid emitting a rom offset comment on bss symbols.
Browse files Browse the repository at this point in the history
  • Loading branch information
AngheloAlf committed Aug 9, 2024
1 parent c61aa42 commit 5334c6e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Avoid emitting "global" visibility on labels.
- Avoid emitting a rom offset comment on bss symbols.

## [1.28.0] - 2024-08-09

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[project]
name = "spimdisasm"
# Version should be synced with spimdisasm/__init__.py
version = "1.28.0"
version = "1.28.1-dev0"
description = "MIPS disassembler"
readme = "README.md"
license = {file = "LICENSE"}
Expand Down
4 changes: 2 additions & 2 deletions spimdisasm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

from __future__ import annotations

__version_info__: tuple[int, int, int] = (1, 28, 0)
__version__ = ".".join(map(str, __version_info__))# + "-dev0"
__version_info__: tuple[int, int, int] = (1, 28, 1)
__version__ = ".".join(map(str, __version_info__)) + "-dev0"
__author__ = "Decompollaborate"

from . import common as common
Expand Down
9 changes: 6 additions & 3 deletions spimdisasm/mips/symbols/MipsSymbolBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,14 @@ def canUseConstantsOnData(self) -> bool:
return self.contextSym.allowedToReferenceConstants


def generateAsmLineComment(self, localOffset: int, wordValue: int|None=None, *, isDouble: bool=False) -> str:
def generateAsmLineComment(self, localOffset: int, wordValue: int|None=None, *, isDouble: bool=False, emitRomOffset: bool=True) -> str:
if not common.GlobalConfig.ASM_COMMENT:
return ""

offsetHex = "{0:0{1}X}".format(localOffset + self.inFileOffset + self.commentOffset, common.GlobalConfig.ASM_COMMENT_OFFSET_WIDTH)
if emitRomOffset:
offsetHex = "{0:0{1}X} ".format(localOffset + self.inFileOffset + self.commentOffset, common.GlobalConfig.ASM_COMMENT_OFFSET_WIDTH)
else:
offsetHex = ""

currentVram = self.getVramOffset(localOffset)
vramHex = f"{currentVram:08X}"
Expand All @@ -80,7 +83,7 @@ def generateAsmLineComment(self, localOffset: int, wordValue: int|None=None, *,
else:
wordValueHex = f"{common.Utils.wordToCurrenEndian(wordValue):08X} "

return f"/* {offsetHex} {vramHex} {wordValueHex}*/"
return f"/* {offsetHex}{vramHex} {wordValueHex}*/"


def getSymbolAsmDeclaration(self, symName: str, useGlobalLabel: bool=True) -> str:
Expand Down
2 changes: 1 addition & 1 deletion spimdisasm/mips/symbols/MipsSymbolBss.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def disassembleAsBss(self, useGlobalLabel: bool = True) -> str:
output += self.getPrevAlignDirective(0)

output += self.getSymbolAsmDeclaration(self.getName(), useGlobalLabel)
output += self.generateAsmLineComment(0)
output += self.generateAsmLineComment(0, emitRomOffset=False)
output += f" .space 0x{self.spaceSize:02X}{common.GlobalConfig.LINE_ENDS}"

nameEnd = self.getNameEnd()
Expand Down

0 comments on commit 5334c6e

Please sign in to comment.