It is currently Mon Oct 20, 2014 4:38 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Conditional assembly
PostPosted: Tue Mar 23, 2010 8:52 pm 
Offline
 Profile

Joined: Thu Nov 06, 2008 1:13 am
Posts: 14
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.


Top
 
 Post subject: Re: Conditional assembly
PostPosted: Wed Mar 24, 2010 11:05 am 
Offline
User avatar
 Profile

Joined: Mon Jan 07, 2008 6:46 pm
Posts: 380
Location: Málaga, Spain
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.


Top
 
 Post subject: Re: Conditional assembly
PostPosted: Wed Mar 24, 2010 5:06 pm 
Offline
 Profile

Joined: Thu Nov 06, 2008 1:13 am
Posts: 14
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.


Top
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron