www.retrosoftware.co.uk
http://www.retrosoftware.co.uk/forum/

Conditional assembly
http://www.retrosoftware.co.uk/forum/viewtopic.php?f=17&t=465
Page 1 of 1

Author:  PhillHS [ Tue Mar 23, 2010 8:52 pm ]
Post subject:  Conditional assembly

Here's the problem, I'm porting my SWR utils to be able to be used on the Electron, which means that I have to use a different method for selecting the RAM bank, so
a different block of code.

Handling the above situation is not too much of a problem I can just use something like :

Code:
if (Electron=1)
        lda     ROMPageElk      ; Page out basic
        sta     RomSel
        sta     ROMPageElk

   lda   OurID           ; Retieve our ROM id
   sta   RomSel      ; Save here first
        sta     ROMPageElk      ; then page rom

else
   lda   OurID      ; Retieve our ROM id
   sta   RomSel      ; Save here first
   sta   ROMPage      ; then page rom
endif


This works, however the only place I seem to be able to define a variable is within another source file. What I would like to be able to do is define it on the command line (as you can in C) something like :

Code:
   beebasm -i Ramutils.asm -DElectron=0 -v > RamUtils.txt
   beebasm -i Ramutils.asm -DElectron=1 -v > RamUtils.txt


That way I could build both with the same Makefile, without having to edit source files.

If there is another way to do this I'm quite happy to use that too.

Cheers.

Phill.

Author:  RichTW [ Wed Mar 24, 2010 11:05 am ]
Post subject:  Re: Conditional assembly

There's no way of importing a variable via the command-line at the moment, but my best suggestion would be to create two new source files:

RamUtils_Beeb.asm:
Code:
Electron=0
INCLUDE "RamUtils.asm"

RamUtils_Elk.asm:
Code:
Electron=1
INCLUDE "RamUtils.asm"

...and then pass these two files on each command-line instead of RamUtils.asm. Not brilliant, but it should work.

Author:  PhillHS [ Wed Mar 24, 2010 5:06 pm ]
Post subject:  Re: Conditional assembly

RichTW wrote:
There's no way of importing a variable via the command-line at the moment, but my best suggestion would be to create two new source files:

RamUtils_Beeb.asm:
Code:
Electron=0
INCLUDE "RamUtils.asm"

RamUtils_Elk.asm:
Code:
Electron=1
INCLUDE "RamUtils.asm"

...and then pass these two files on each command-line instead of RamUtils.asm. Not brilliant, but it should work.


HummI'm sure I tried that and it didn't work, but I have just done that again and it does :)

Cheers,

Phill.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/