Skip to content

asm-5: fix single-argument PRINT macro with %strlen - #99

Open
0xAX wants to merge 1 commit into
masterfrom
improve-print-macro
Open

0xAX wants to merge 1 commit into
masterfrom
improve-print-macro

Conversation

@0xAX

@0xAX 0xAX commented Oct 19, 2026

Copy link
Copy Markdown
Owner

Description

The single-argument PRINT macro in the %strlen section passed a label to %strlen. Since %strlen is evaluated by the preprocessor, it returned the length of the label name instead of the length of the data, so the macro printed only part of the message.

Rework the macro to take a string literal, define it in the .data section under a macro-local label, and explain in the text why a label can't be used here.

Related issues

#98

The single-argument PRINT macro in the %strlen section passed a
label to %strlen. Since %strlen is evaluated by the preprocessor,
it returned the length of the label name instead of the length of
the data, so the macro printed only part of the message.

Rework the macro to take a string literal, define it in the .data
section under a macro-local label, and explain in the text why a
label can't be used here.

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants