Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request for new feature, EQADD assembler directive #100

Open
thomas374b opened this issue Oct 15, 2020 · 0 comments
Open

request for new feature, EQADD assembler directive #100

thomas374b opened this issue Oct 15, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@thomas374b
Copy link
Contributor

thomas374b commented Oct 15, 2020

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

   
@thrust26 thrust26 added the enhancement New feature or request label Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants