dasm-assembler / dasm-assembler/dasm

More control over use of macro parameters

Open
#162 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C
Stars
257
Forks
55
PR merge metrics
No merged PRs in 30d

Description

Macro parameters are sometimes handled as values and sometimes as string. But the user has no control over it.

Example:

  MAC TEST
    .byte   {1}
  ENDM

_VAL SET 0
  REPEAT 3
    TEST _VAL
_VAL SET _VAL + 1
  REPEND

This results into:

  .byte 0
  .byte 1
  .byte 2

Now, if I want to do the same with a label, this doesn't work.

    MAC TEST
Label{1}
    ENDM

_VAL SET 10
    TEST _VAL

Results into Label_VAL. But what I need is Label10,

And sometimes I even want both, value and string. E.g.

  MAC TESTP
    IF (>{1}) != (>{2})
      ECHO {1}, "not on same page as", {2}
    ENDIF
  ENDM

Label1
  .byte 1,2, 3
Label2
    TESTP Label1, Label2

Here I want to print out the labels names, not the values.

Therefore it would be good if the user get some control over the output. Maybe similar to [value]d, which outputs a number as decimal. So [value]v would output as value (also [value]d as decimal value, not only in strings) and [value]s would output as string.

So my 2nd example from above would look like this:

    MAC TEST
Label[{1}]d
    ENDM

_VAL SET 10
    TEST _VAL

And create Label10.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by tracing how macro parameters are expanded as values versus strings, then examine how macro syntax is parsed. Done means a defined parameter-formatting syntax supports numeric and string expansion in the label and comparison examples without breaking existing macro behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.