ASM6809 conditional compiling

A place to discuss everything Dragon related that doesn't fall into the other categories.
Post Reply
pser1
Posts: 1672
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

ASM6809 conditional compiling

Post by pser1 »

Hello,
is there any way to add a conditional clause to control an INCLUDEBIN command?
The condition should be the existence of that file in the compilation folder, for instance

Code: Select all

	IF EXIST "SONG01.PT3"
	      includebin "SONG01.PT3"
	ENDIF
By now it doesn't work. The file is never included when ASM6809 compiler is called
Maybe I am forgetting about a parameter that allows this construct?
Any hint would be really appreciated
cheers!
pere
pser1
Posts: 1672
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: ASM6809 conditional compiling

Post by pser1 »

By now, I have overcome the problem with a very long construct affecting the caller and the source file
to be copiled, doing this
- In the caller

Code: Select all

@set flagmus=0
if exist "SONG01.PTM" @set flagmus=1
if exist "SONG02.PTM" @set flagmus=2
if exist "SONG03.PTM" @set flagmus=3
if exist "SONG04.PTM" @set flagmus=4
if exist "SONG05.PTM" @set flagmus=5
if exist "SONG06.PTM" @set flagmus=6
if exist "SONG07.PTM" @set flagmus=7
if exist "SONG08.PTM" @set flagmus=8
if exist "SONG09.PTM" @set flagmus=9
if exist "SONG10.PTM" @set flagmus=10
asm6809 -3 -D -v --define NSONGS=%flagmus% --define MPI=1 --define COCO=0 --l=%1.LSD.ASM --o=%1.BIN %1.ASM
And then in the file to be compiled, added at the end of the text.ASM

Code: Select all

DataBeg
	IF NSONGS > 0
		includebin "SONG01.PTM"
	ENDIF
	IF NSONGS > 1
		includebin "SONG02.PTM"
	ENDIF
	IF NSONGS > 2
		includebin "SONG03.PTM"
	ENDIF
	IF NSONGS > 3
		includebin "SONG04.PTM"
	ENDIF
	IF NSONGS > 4
		includebin "SONG05.PTM"
	ENDIF
	IF NSONGS > 5
		includebin "SONG06.PTM"
	ENDIF
	IF NSONGS > 6
		includebin "SONG07.PTM"
	ENDIF
	IF NSONGS > 7
		includebin "SONG08.PTM"
	ENDIF
	IF NSONGS > 8
		includebin "SONG09.PTM"
	ENDIF
	IF NSONGS > 9
		includebin "SONG10.PTM"
	ENDIF
EndPgm	equ	*
That way the data beginning is always at the same place ($3000) and the end is calculated
upon the length of the included songs.

sorchard
Posts: 531
Joined: Sat Jun 07, 2014 9:43 pm
Location: Norwich UK

Re: ASM6809 conditional compiling

Post by sorchard »

Hi Pere,

Could you make use of the following batch commands to create a file called 'files.inc' that can be included in the main assembly?

Code: Select all

echo ; files to include > files.inc
for %%f in (*.PTM) do echo   include.bin "%%f" >> files.inc
asm6809 ...
Note the extra spaces between 'echo' and 'include.bin' to make asm6809 directives instead of labels.
Stew
pser1
Posts: 1672
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: ASM6809 conditional compiling

Post by pser1 »

sorchard wrote: Tue May 30, 2023 3:38 pm Hi Pere,

Could you make use of the following batch commands to create a file called 'files.inc' that can be included in the main assembly?

Code: Select all

echo ; files to include > files.inc
for %%f in (*.PTM) do echo   include.bin "%%f" >> files.inc
asm6809 ...
Note the extra spaces between 'echo' and 'include.bin' to make asm6809 directives instead of labels.
Excellent, Stew!
I thought of using the 'for' construct, but did not got the smart idea of using 'echo' to add the include directives!
Thanks a lot
pere
Post Reply