dasm-assembler / dasm-assembler/dasm
request for new feature, EQADD assembler directive
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 257
- Forks
- 55
- PR merge metrics
- No merged PRs in 30d
Description
several attempts have been made in the past to get dasm to define a string "in pieces" aka "stepwise". (see issues #32, #98 and testcases segfault, reverse_segfault, recursive_eqm, recursive_set, concat_str)
They all are doomed to fail since the way how dasm works implies (endless) recursion.
To address this use-case I propose to add the new assembly directive EQADD to globals.c and a new function v_eqadd(..) to main.c. The function should not deepen the evaluation / should not lead to recursion, should replace a previously made equation by appending the argument(s).
Example usage that defines a string cpu_variant according to the capabilities of the processor
cpu_variant .SET "68HC" ; initial declaration of the symbol
.IF FLASH_START == $F800
cpu_variant .EQADD "8" ; appending char "8" (this variant has 8k mask ROM )
.ENDIF
cpu_variant .EQADD "11" ; appending string "11"
.IF BOOTROM_START == $BF40
.IF FLASH_START == $F800
cpu_variant .EQADD "e"
.ELSE
cpu_variant .EQADD "a"
.ENDIF
.ELSE
cpu_variant .EQADD "e"
.ENDIF
.IF FLASH_SIZE == 2048
cpu_variant .EQADD "2"
.ELSE
cpu_variant .EQUADD "1" ; only 512 bytes flash
.ENDIF
; should produce "68HC11a1", "68HC11e1" or "68HC811e2" depending on the given variable definitions
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing globals.c and main.c, including the existing equation handling and the v_eqadd(..) entry point requested in the issue. Read the referenced cases—segfault, reverse_segfault, recursive_eqm, recursive_set, and concat_str—to understand the failed stepwise definitions. Done means EQADD appends to an existing equation without deepening evaluation or causing recursion, producing the shown cpu_variant results.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100