Skip to content

Commit

Permalink
Fix No$gba debug messages; account for empty message and max length e…
Browse files Browse the repository at this point in the history
…dge cases
  • Loading branch information
Prof9 committed Apr 22, 2022
1 parent a756be7 commit c875333
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Archs/ARM/ArmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,18 @@ std::unique_ptr<CAssemblerCommand> parseDirectivePool(Parser& parser, int flags)

const char* msgTemplate = R"(
mov r12,r12
"b %after%
".byte 0x64,0x64,0x00,0x00
".ascii %text%
".align %alignment%
"%after%:"
)"
;
b %after%
.byte 0x64,0x64,0x00,0x00
.if strlen(%text%) > 120
.error "Maximum length of No$gba debug message is 120 bytes"
.elseif strlen(%text%) > 0
.ascii %text%
.else
.byte 0x00
.endif
.align %alignment%,0x00
%after%:
)";

std::unique_ptr<CAssemblerCommand> parseDirectiveMsg(Parser& parser, int flags)
{
Expand Down

0 comments on commit c875333

Please sign in to comment.