Skip to content

Commit

Permalink
WIP libticalcs: switch the TI-Z80 DBUS ROM dumpers from spasm to pasm…
Browse files Browse the repository at this point in the history
…o, which has been packaged by Debian for a long time, so that more ROM dumpers can be integrated in Debian packages.

TODO switch the 84+ DUSB ROM dumper as well.

I tried to use other Z80 cross-assemblers packaged by Debian, but:
* z80asm, SDCC's sdasz80 and crasm do not support defining stuff through the CLI, which would require annoying workarounds;
* binutils-z80's z80-unknown-coff-as doesn't handle .org the same way as other assemblers, and the multiple section + ldscript workaround does not work either, because as forbids + or - between symbols from different sections (even if they're both ".text.X" sections)...
No cross-assembler packaged by Debian supports eZ80 instructions.

Signed-off-by: Lionel Debroux <[email protected]>
  • Loading branch information
debrouxl committed Oct 13, 2019
1 parent c803f17 commit 39b2e4a
Show file tree
Hide file tree
Showing 17 changed files with 708 additions and 534 deletions.
24 changes: 21 additions & 3 deletions libticalcs/trunk/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,15 @@ AC_ARG_ENABLE([builtin-rom-dumpers],
[], [enable_builtin_rom_dumpers=yes])

AC_ARG_VAR([SPASM], [SPASM Z80 assembler])
AC_ARG_VAR([PASMO], [PASMO Z80 assembler])
AC_ARG_VAR([TIPACK], [Tool for creating TI variable files])
have_spasm=no
have_pasmo=no
have_tipack=no
have_tigcc=no
have_m68klinuxgnu=no
: ${SPASM=spasm}
: ${PASMO=pasmo}
: ${TIPACK=tipack}

if test "x$enable_builtin_rom_dumpers" != "xyes" ; then
Expand All @@ -226,7 +229,22 @@ EOF
fi
AC_MSG_RESULT([$have_spasm])

if test "x$have_spasm" = "xyes" ; then
AC_MSG_CHECKING([whether $PASMO works])
cat >conftest.asm <<EOF
macro B_CALL, arg
db 0EFh
dw arg
endm
org 9d95h
B_CALL 4972h
ret
EOF
if "$PASMO" conftest.asm conftest.bin >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
have_pasmo=yes
fi
AC_MSG_RESULT([$have_pasmo])

if test "x$have_spasm$have_pasmo" = "xyesyes" ; then
AC_MSG_CHECKING([whether $TIPACK works])
if "$TIPACK" conftest.bin -p -o conftest.8xp >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
have_tipack=yes
Expand Down Expand Up @@ -266,12 +284,12 @@ EOF
AC_MSG_RESULT([$have_m68klinuxgnu])
fi

if test "x$have_spasm$have_tipack" = "xyesyes" ; then
if test "x$have_spasm$have_pasmo$have_tipack" = "xyesyesyes" ; then
build_z80_rom_dumpers=yes
else
build_z80_rom_dumpers=no
if test "x$enable_builtin_rom_dumpers" = "xno" ; then
AC_MSG_FAILURE([spasm and/or tipack are not installed or are not usable.])
AC_MSG_FAILURE([spasm, pasmo and/or tipack are not installed or are not usable.])
fi
fi

Expand Down
23 changes: 15 additions & 8 deletions libticalcs/trunk/src/romdump_8x/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
EXTRA_DIST = *.asm *.inc
CLEANFILES = *.bin *.lst *.73p *.82y *.83p *.8xp *.85s *.86p

SPASMFLAGS = -N -T
PASMOFLAGS =

rom_dumpers = dump73.73p dump82.82y dump83.83p dump83p.8xp dump84pc.8xp dump85.85s dump86.86p

Expand All @@ -11,33 +11,40 @@ endif

dump73.bin: romdump.asm romdump.inc ti73defs.inc defs.inc main.asm \
unlock73.asm packet.asm link.asm linksw.asm data.asm
$(SPASM) $(SPASMFLAGS) -A -DTI73 -I $(srcdir) $(srcdir)/romdump.asm dump73.bin
$(PASMO) $(PASMOFLAGS) -E TI73 -E CALC_FLASH -I $(srcdir) $(srcdir)/romdump.asm dump73_.bin
sed -e "s/\xaa\xaa//g" < dump73_.bin | sed -e "s/\xaa\xe9/\xe9/g" > dump73.bin

dump82.bin: romdump.asm romdump.inc ti82defs.inc defs.inc main.asm \
packet.asm link.asm linksw.asm display.asm display82.asm data.asm \
font.asm
$(SPASM) $(SPASMFLAGS) -A -DTI82 -I $(srcdir) $(srcdir)/romdump.asm dump82.bin
$(PASMO) $(PASMOFLAGS) -E TI82 -E NEED_DISPLAY_ROUTINES -I $(srcdir) $(srcdir)/romdump.asm dump82_.bin
sed -e "s/\xaa\xaa//g" < dump82_.bin | sed -e "s/\xaa\xe9/\xe9/g" > dump82.bin

dump83.bin: romdump.asm romdump.inc ti83defs.inc defs.inc main.asm \
packet.asm link.asm linksw.asm data.asm
$(SPASM) $(SPASMFLAGS) -A -DTI83 -I $(srcdir) $(srcdir)/romdump.asm dump83.bin
$(PASMO) $(PASMOFLAGS) -E TI83 -I $(srcdir) $(srcdir)/romdump.asm dump83_.bin
sed -e "s/\xaa\xaa//g" < dump83_.bin | sed -e "s/\xaa\xe9/\xe9/g" > dump83.bin

dump83p.bin: romdump.asm romdump.inc ti83pdefs.inc defs.inc main.asm \
unlock83p.asm packet.asm link.asm link83p.asm data.asm
$(SPASM) $(SPASMFLAGS) -A -DTI83P -I $(srcdir) $(srcdir)/romdump.asm dump83p.bin
$(PASMO) $(PASMOFLAGS) -E TI83P -E CALC_FLASH -E CALC_LINK_ASSIST -I $(srcdir) $(srcdir)/romdump.asm dump83p_.bin
sed -e "s/\xaa\xaa//g" < dump83p_.bin | sed -e "s/\xaa\xe9/\xe9/g" > dump83p.bin

dump84pc.bin: romdump.asm romdump.inc ti84pcdefs.inc defs.inc main.asm \
packet.asm link.asm link83p.asm data.asm
$(SPASM) $(SPASMFLAGS) -A -DTI84PC -I $(srcdir) $(srcdir)/romdump.asm dump84pc.bin
$(PASMO) $(PASMOFLAGS) -E TI84PC -E CALC_LINK_ASSIST -I $(srcdir) $(srcdir)/romdump.asm dump84pc_.bin
sed -e "s/\xaa\xaa//g" < dump84pc_.bin | sed -e "s/\xaa\xe9/\xe9/g" > dump84pc.bin

dump85.bin: romdump.asm romdump.inc ti85defs.inc defs.inc main.asm \
packet.asm link.asm linksw.asm display.asm display85.asm data.asm \
font.asm
$(SPASM) $(SPASMFLAGS) -A -DTI85 -I $(srcdir) $(srcdir)/romdump.asm dump85.bin
$(PASMO) $(PASMOFLAGS) -E TI85 -E NEED_DISPLAY_ROUTINES -I $(srcdir) $(srcdir)/romdump.asm dump85_.bin
sed -e "s/\xaa\xaa//g" < dump85_.bin | sed -e "s/\xaa\xe9/\xe9/g" > dump85.bin

dump86.bin: romdump.asm romdump.inc ti86defs.inc defs.inc main.asm \
packet.asm link.asm linksw.asm data.asm
$(SPASM) $(SPASMFLAGS) -A -DTI86 -I $(srcdir) $(srcdir)/romdump.asm dump86.bin
$(PASMO) $(PASMOFLAGS) -E TI86 -I $(srcdir) $(srcdir)/romdump.asm dump86_.bin
sed -e "s/\xaa\xaa//g" < dump86_.bin | sed -e "s/\xaa\xe9/\xe9/g" > dump86.bin

dump73.73p: dump73.bin
$(TIPACK) -n 'ROMDUMP' dump73.bin -p -o dump73.73p
Expand Down
20 changes: 10 additions & 10 deletions libticalcs/trunk/src/romdump_8x/data.asm
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@ ErrorString: db "Errors:", 0

KString: db "0K of "

#if CALC_ROM_SIZE == 4096
if CALC_ROM_SIZE = 4096
db "4096K"
ROMSize: dw 0000h, 0040h
#endif
endif

#if CALC_ROM_SIZE == 512
if CALC_ROM_SIZE = 512
db "512K"
ROMSize: dw 0000h, 0008h
#endif
endif

#if CALC_ROM_SIZE == 128
if CALC_ROM_SIZE = 128
db "128K"
ROMSize: dw 0000h, 0002h
#endif
endif

#if CALC_ROM_SIZE == 256
if CALC_ROM_SIZE = 256
db "256K"
ROMSize: dw 0000h, 0004h
#endif
endif

#if CALC_ROM_SIZE == 0
if CALC_ROM_SIZE = 0
ROMSize: dw 0000h, 0008h
#endif
endif
Loading

0 comments on commit 39b2e4a

Please sign in to comment.