GST addembler GENIF

Anything QL Software or Programming Related.
Post Reply
prime
Trump Card
Posts: 192
Joined: Fri Feb 18, 2011 8:58 pm

GST addembler GENIF

Post 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.


User avatar
tofro
Font of All Knowledge
Posts: 2702
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: GST addembler GENIF

Post 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


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
prime
Trump Card
Posts: 192
Joined: Fri Feb 18, 2011 8:58 pm

Re: GST addembler GENIF

Post 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.


Post Reply