home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CBM Funet Archive
/
cbm-funet-archive-2003.iso
/
cbm
/
programming
/
msdos
/
xa214f.lzh
/
xa214f
/
misc
/
mkrom.sh
< prev
next >
Wrap
Linux/UNIX/POSIX Shell Script
|
1997-01-03
|
2KB
|
93 lines
#!/BIN/BASH
#
# XA65 - 6502 CROSS ASSEMBLER AND UTILITY SUITE
# MKROM.SH - ASSEMBLE SEVERAL 'ROMABLE' FILES INTO ONE BINARY
# cOPYRIGHT (c) 1997 aNDR{$e9} fACHAT (A.FACHAT@PHYSIK.TU-CHEMNITZ.DE)
#
# tHIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
# IT UNDER THE TERMS OF THE gnu gENERAL pUBLIC lICENSE AS PUBLISHED BY
# THE fREE sOFTWARE fOUNDATION; EITHER VERSION 2 OF THE lICENSE, OR
# (AT YOUR OPTION) ANY LATER VERSION.
#
# tHIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
# BUT without any warranty; WITHOUT EVEN THE IMPLIED WARRANTY OF
# merchantability OR fitness for a particular purpose. sEE THE
# gnu gENERAL pUBLIC lICENSE FOR MORE DETAILS.
#
# yOU SHOULD HAVE RECEIVED A COPY OF THE gnu gENERAL pUBLIC lICENSE
# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO THE fREE sOFTWARE
# fOUNDATION, iNC., 675 mASS aVE, cAMBRIDGE, ma 02139, usa.
#
xa="../XA"
file=../FILE65
START=32768
ENDE=65536
ROMFILE=ROM65
NEXT=$[ START + 2 ];
PARS="-a $NEXT"
UMASK 077
TMP1=/TMP/MKROM65.SH.$$.A
TMP2=/TMP/MKROM65.SH.$$.B
TMP3=/TMP/MKROM65.SH.$$.C
ECHO -E "#INCLUDE <STDIO.H>\NVOID MAIN(INT ARGC, CHAR *ARGV[]) {$7b} PRINTF(\"%C%C\",ATOI(ARGV[1])&255,(ATOI(ARGV[1])/256)&255);{$7d}" \
> $TMP3;
CC $TMP3 -O $TMP2
WHILE [ $# -NE 0 ]; DO
CASE $1 IN
-a)# GET START ADDRESS
START=$[ $2 ];
SHIFT
;;
-e)# GET END ADDRESS
ENDE=$[ $2 ];
SHIFT
;;
-r) # GET rom FILENAME
ROMFILE=$2;
SHIFT
;;
-o)# XA OPTIONS
xa="$xa $2";
SHIFT
;;
-s) # SEGMENT ADDRESSES - IN XA OPTION FORMAT
PARS="$PARS $2";
SHIFT
;;
*)
BREAK;
;;
ESAC;
SHIFT
DONE
#GET FILE LIST
LIST="$*"
ECHO -N > $ROMFILE
FOR I IN $LIST; DO
#ECHO "NEXT=$NEXT, START=$START, PARS=$PARS"
#ECHO "CMD= ${$7b}xa{$7d} -r $PARS -O $TMP1 $I"
$xa -r $PARS -O $TMP1 $I
PARS={$60}$file -A 2 -p $TMP1{$60};
NEXT={$60}$file -a 0 $TMP1{$60};
$TMP2 $NEXT >> $ROMFILE
CAT $TMP1 >> $ROMFILE;
DONE;
$TMP2 65535 >> $ROMFILE
RM -F $TMP1 $TMP2 $TMP3