Page 1 of 1

Coding with macroes ?

Posted: Wed May 16, 2018 8:15 am
by Admiral_dk
I got a piece of hardware using the FV-1 that has 3 different programs where the only difference i a single coefficient in the code between the 3.

So my question ; is it possible to use something like a macro so I only have to have one source code that results in 3 programs - but only one code to maintain ?

Posted: Wed May 16, 2018 12:01 pm
by frank
SpinASM does not have a macro processor built in so for simple things like a coefficient you should be able to use an EQU statement like:

coeff EQU 0.5 ; version 1 code
; coeff EQU 0.6 ; version 2 code
; coeff EQU 0.7 ; version 3 code

later in the code you could use the value of coeff like:

sof coeff, 0.5

So you would just uncomment the desired coefficient and comment out the other two.

Posted: Thu May 17, 2018 1:22 am
by Admiral_dk
Thank you Frank - that is what I do now - I just hoped that I could get away with having only one source file and a conditional assembly ….