Logo  

Home - Old Man Programmer

Displaying projects/Aq/asm//eb//mkebas

#!/bin/sh

set -e
orig="${1:-../../roms/ExtendedBasic.rom}"
# ROM is 16K, but it's just 2 copies of Extended BASIC.  Use last one.
dd if="$orig" of=eb.bin skip=0 bs=4k count=1
# decrypt
"${XORCMD:-../../utils/xor}" eb.bin 220 >eb.bin.dec
# 1st 16 bytes are not encrypted
dd if=eb.bin conv=notrunc of=eb.bin.dec bs=16 count=1
# I originally used 1.1.6.
# The version number is line 1 of the output, so I removed that.
# The path to the executable (and command line args) are line 2, so I removed that.
# I also used -t, but 1.2.0 changed the output (no longer filters DEL correctly)
# I also used -a, but since I removed -t, there seems little point
# 1.2.0 also gratuitously changes whitespace, so I change all whitespace to 1 space.
# Don't bother reading the .dis file; just keep the above two notes in mind.
"${DASMCMD:-z80dasm}" -l -g 0xe000 eb.bin.dec | sed '1,2d;s/[ \t]*$//g;s/ *;next.*//g' >ebasic.dis
if [ -z "$XDELTA3" ]; then
  "${XDELTACMD:-xdelta}" -V >/dev/null 2>&1 || XDELTA3=1
fi
if [ 1 = "$XDELTA3" ]; then
  "${XDELTACMD:-xdelta}" -d -s ebasic.dis "${PATCH:-ebasic.xdelta3}" ebasic.as
else
  "${XDELTACMD:-xdelta}" patch "${PATCH:-ebasic.xdelta}" ebasic.dis ebasic.as
fi