@echo off
echo *
echo * Building %1.ICB 
echo *

REM Two different as11 runs...
REM zero page increases by 3
REM main high byte increases by 7
REM main low byte increases by 11

rem copy to 'C' filename for GCC
copy %1.asm %1.c

@echo on
gcc -E -traditional -DZERO_PAGE_START=$10 -DMAIN_START=$8020 -o ascpp1.asm %1.c 
gcc -E -traditional -DZERO_PAGE_START=$13 -DMAIN_START=$872B -o ascpp2.asm %1.c
as11 ascpp1.asm
as11 ascpp2.asm - cre > ascpp.cre
@echo off

rem concantenate these files together
copy ascpp1.s19+ascpp2.s19+ascpp.cre %1.icb

rem get rid of temp files
del ascpp1.asm
del ascpp1.s19 
del ascpp2.asm 
del ascpp2.s19 
del ascpp.cre 
del %1.c

rem strip carriage returns from the new icb file
@echo on
strip_cr %1.icb
@echo off
echo * %1.ICB build complete.
