ASM80.com News

A log of new features

View on GitHub
3 June 2019

Version 2.5.2 - nested IFs and better macros

This version brings you a two big news. The first is the possibility of nested IFs. So you can write constructions like:

IF foo
 ...something
 IF bar
 ...something
 ELSE
 ...something else
 ENDIF
ELSE
 ...something
ENDIF

The second improvement is the slightly enriched syntax for the macros.

Old form is .macro name. New macro can be defined as name: .macro or name .macro.

Now you can name formal parameters too. For example - assume a macro cpymem for copy memory content. Such macro has three arguments - source, destination and length. The old form of macro has mute parameters, just referenced by its number:

.macro cpymem
LD HL,%%1
LD DE,%%2
LD BC,%%3
LDIR
.endm

New formal parameters, introduced in revision 2.5.2, allows to write this:

.macro cpymem, src, dst, len
LD HL,src
LD DE,dst
LD BC,len
LDIR
.endm

Preprocessor also check if the number of given parameters is sufficient for the macro, i.e. you cannot specify less parameters than formal, like cpymem 100, 200.

All those named parameters are strictly local (in fact, they are replaced with its values before assembly phase).