Skip to content

Implement stringization of loop indices in FOR loops #72

@ian-h-chamberlain

Description

@ian-h-chamberlain

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

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions