SNES menu: helper script for map creation

This commit is contained in:
ikari 2012-01-14 02:22:42 +01:00
parent 059966f06a
commit d139fdb40c
4 changed files with 44 additions and 5 deletions

View File

@ -1,19 +1,23 @@
OBJS = header.ips reset.o65 main.o65 font.o65 palette.o65 data.o65 const.o65 logo.o65 logospr.o65 text.o65 dma.o65 menu.o65 pad.o65 time.o65 mainmenu.o65 sysinfo.o65 # gfx.o65 # vars.o65
all: menu.bin
all: clean menu.bin map
smc: menu.bin
cat menu.bin sd2snes.rom > menu.smc
map: menu.bin
utils/mkmap.sh $(OBJS)
menu.bin: $(OBJS)
sneslink -fsmc -o $@ $^
sneslink -fsmc -o $@ $^ 2>&1 | tee link.log
# Generic rule to create .o65 out from .a65
%.o65: %.a65
snescom -J -Wall -o $@ $<
snescom -J -Wall -o $@ $< 2>&1 | tee $@.log
# Generic rule to create .ips out from .a65
%.ips: %.a65
snescom -I -J -Wall -o $@ $<
snescom -I -J -Wall -o $@ $< 2>&1 | tee $@.log
clean:
rm -f *.ips *.o65 *~ menu.bin

View File

@ -1,3 +1,4 @@
*=$7E0000
.data
;don't anger the stack!
dirptr_addr .word 0

View File

@ -1,6 +1,16 @@
; This file is part of the snescom-asm demo - a demo of how to build a SNES program.
; This file is a modified version of the header.a65 file from:
; snescom-asm demo - a demo of how to build a SNES program.
; See http://bisqwit.iki.fi/source/snescom.html for details.
; fill whole area beforehand so the linker does not create multiple
; objects from it. (necessary for map creation)
*= $C0FF00
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
; Begin assembling to this address.
*= $C0FF00

24
snes/utils/mkmap.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
args=("$@")
objcount=0
grep object_ link.log | \
sed -e 's/object_//g; s/_code//g; s/_data//g' | \
while read obj; do
objcount=$((objcount+1))
read base idx <<< "$obj"
base="0x${base}"
fn=${args[$idx-1]}
echo ======$fn, base=$base====== > ${fn%%.*}.map
sed -e '/^Externs/,$d;/^Labels/d' < $fn.log | \
while read line; do
read addr label <<< "$line"
addr="0x$addr"
decaddr=`printf "%d" $addr`
[ "$decaddr" -gt "65535" ] && base=0
ea=`printf "%X" $((base+addr))`
echo $ea $label >> ${fn%%.*}.map
done
done