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

Implement stringization of loop indices in FOR loops #72

Open
ian-h-chamberlain opened this issue May 8, 2021 · 0 comments
Open

Implement stringization of loop indices in FOR loops #72

ian-h-chamberlain opened this issue May 8, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@ian-h-chamberlain
Copy link
Member

Stringization and declaration inside FOR/ROF:

FOR 5
imp mov imp, imp + 5
ROF

Declaration of the above example causes the assembler to complain for
duplicating declarations. pMARS however offers the stringization feature
to accomplish the same goal. Its syntax is: abel"&"label"&"...
The first label can be any valid alphanums and it goes untranslated.
The rest of the labels have to be a FOR index and it is to be substituted
accordingly. Thus:

N FOR 5
  imp&N mov imp&N, imp&N + 1
  ROF

are expanded into:

imp01 mov imp01, imp01 + 5
imp02 mov imp02, imp02 + 5
imp03 mov imp03, imp03 + 5
imp04 mov imp04, imp04 + 5
imp05 mov imp05, imp05 + 5

It is then correctly compiled.

The following form is also valid:

prime01 equ 2
prime02 equ 3
prime03 equ 5
prime04 equ 7
prime05 equ 11
N FOR 5
  dat prime&N
  ROF
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

1 participant