Page 1 of 1

GST addembler GENIF

Posted: Sun Oct 19, 2014 10:32 pm
by prime
Hi all,

Is there an easy way of combining several conditions on a GENIF conditional assembly directive?

I have looked in the pdf manuals for both the original and the QUANTA versions but neither seem to document GENIF (that I can find).

I tried :

Code: Select all

	GENIF	((IS_ROM = 0) or (ROM_ISREL = 0))

IF_BASE		equ	$17FF0
SPI_XFER	equ	$17FF0
SPI_BG_READ	equ	$17FFF

	ENDGEN
For example but this complains about unmatched brackets.

Cheers.

Phill.

Re: GST addembler GENIF

Posted: Mon Oct 20, 2014 9:24 am
by tofro
Phill,

GENIF is described un an "updates_txt" that comes with QMAC:
A new conditional assembly construct has been added, which is nestable down to
256 levels, which should be enough for most occasions. It is useful if you want
to produce several different versions of code from one source with only minor
changes, eg a rom version and a ram version of the same file. Example :-
GENIF romversion = 1
dc.l $4afb0001 etc.
ENDGEN
GENIF romversion <> 1
bra.s start
ENDGEN
It doesn't say anything more detailed about the expression that is used than that here or anywhere else in the documents - I pretty much doubt it can be more than one of the simple expressions above. AND and OR must then be simulated by appropriately nesting GENIFS.
(Even considering those limited usages, it is still a greatly helpful directive)

There is, however, always the possibility to create more complex expressions "outside" the GENIF and feed the result in there like

Code: Select all

null      setnum       0
one       setnum       1
nullorone setnum       [null]+[one]

res       equ       [nullorone]
          GENIF     res <> 0
          blahblah....
          ENDGEN
(I guess this would do exactly what you want)
Tobias

Re: GST addembler GENIF

Posted: Mon Oct 20, 2014 3:03 pm
by prime
Cheers for that, real shame that there is not an ELSE clause for GENIF so something like :

GENIF test = 1
blah blah
ELSE
blah blah
ENDGEN

Rather than having to do GENIF test = 1 ... ENDGEN then GENIF test=0 ENDGEN :(

Cheers.

Phill.