*.o
*.rel
*.rst
+/dkong/c-2k-2j.bpr
/emu_z80/cg_default/*.inc
/emu_z80/cg_default/*.pbm
/emu_z80/cg_default/*.png
/pacman/pacman.6f
/pacman/pacman.6h
/pacman/pacman.6j
+/orig/dkong/l_4r_b.bin
+/orig/dkong/l_4s_b.bin
+/orig/dkong/s_3i_b.bin
+/orig/dkong/l_4n_b.bin
+/orig/dkong/c_5et_g.bin
+/orig/dkong/v_5h_b.bin
+/orig/dkong/c_5ct_g.bin
+/orig/dkong/c_5bt_g.bin
+/orig/dkong/v_3pt.bin
+/orig/dkong/v-5e.bpr
+/orig/dkong/l_4m_b.bin
+/orig/dkong/c_5at_g.bin
+/orig/dkong/s_3j_b.bin
+/orig/dkong/c-2j.bpr
+/orig/dkong/c-2k.bpr
/orig/galaxian.zip
/orig/invaders.zip
/orig/mspacman.zip
--- /dev/null
+ASZ80=../asxv5pxx/asxmak/linux/exe/asz80
+ASLINK=../asxv5pxx/asxmak/linux/exe/aslink
+
+# need to install intelhex package in Python first:
+# pip3 install --user intelhex
+BIN2HEX=bin2hex.py
+HEX2BIN=hex2bin.py
+
+IO_PAGE=0x7800
+
+# some ROMs are loaded into emulator addresses not accessible by software,
+# this is for convenience so we can build entire game from one source file
+ROM_C_5ET_G_ADDR=0
+ROM_C_5CT_G_ADDR=0x1000
+ROM_C_5BT_G_ADDR=0x2000
+ROM_C_5AT_G_ADDR=0x3000
+ROM_C_2K_2J_ADDR=0x7e00
+ROM_V_5E_ADDR=0x7f00
+ROM_S_3I_B_ADDR=0x8000
+ROM_S_3J_B_ADDR=0x8800
+ROM_V_5H_B_ADDR=0xa000
+ROM_V_3PT_ADDR=0xa800
+ROM_L_4M_B_ADDR=0xb000
+ROM_L_4N_B_ADDR=0xb800
+ROM_L_4R_B_ADDR=0xc000
+ROM_L_4S_B_ADDR=0xc800
+
+ROMS= \
+c_5et_g.bin \
+c_5ct_g.bin \
+c_5bt_g.bin \
+c_5at_g.bin \
+c-2k-2j.bpr \
+v-5e.bpr \
+s_3i_b.bin \
+s_3j_b.bin \
+v_5h_b.bin \
+v_3pt.bin \
+l_4m_b.bin \
+l_4n_b.bin \
+l_4r_b.bin \
+l_4s_b.bin
+
+all: dkong0.ihx
+
+dkong0.ihx: ${ROMS:%=%.ihx} io_page.ihx
+ hexmerge.py -o $@ $^
+
+c_5et_g.bin.ihx: ../orig/dkong/c_5et_g.bin
+ ${BIN2HEX} --offset=${ROM_C_5ET_G_ADDR} $< $@
+
+c_5ct_g.bin.ihx: ../orig/dkong/c_5ct_g.bin
+ ${BIN2HEX} --offset=${ROM_C_5CT_G_ADDR} $< $@
+
+c_5bt_g.bin.ihx: ../orig/dkong/c_5bt_g.bin
+ ${BIN2HEX} --offset=${ROM_C_5BT_G_ADDR} $< $@
+
+c_5at_g.bin.ihx: ../orig/dkong/c_5at_g.bin
+ ${BIN2HEX} --offset=${ROM_C_5AT_G_ADDR} $< $@
+
+c-2k-2j.bpr.ihx: c-2k-2j.bpr
+ ${BIN2HEX} --offset=${ROM_C_2K_2J_ADDR} $< $@
+
+v-5e.bpr.ihx: ../orig/dkong/v-5e.bpr
+ ${BIN2HEX} --offset=${ROM_V_5E_ADDR} $< $@
+
+s_3i_b.bin.ihx: ../orig/dkong/s_3i_b.bin
+ ${BIN2HEX} --offset=${ROM_S_3I_B_ADDR} $< $@
+
+s_3j_b.bin.ihx: ../orig/dkong/s_3j_b.bin
+ ${BIN2HEX} --offset=${ROM_S_3J_B_ADDR} $< $@
+
+v_5h_b.bin.ihx: ../orig/dkong/v_5h_b.bin
+ ${BIN2HEX} --offset=${ROM_V_5H_B_ADDR} $< $@
+
+v_3pt.bin.ihx: ../orig/dkong/v_3pt.bin
+ ${BIN2HEX} --offset=${ROM_V_3PT_ADDR} $< $@
+
+l_4m_b.bin.ihx: ../orig/dkong/l_4m_b.bin
+ ${BIN2HEX} --offset=${ROM_L_4M_B_ADDR} $< $@
+
+l_4n_b.bin.ihx: ../orig/dkong/l_4n_b.bin
+ ${BIN2HEX} --offset=${ROM_L_4N_B_ADDR} $< $@
+
+l_4r_b.bin.ihx: ../orig/dkong/l_4r_b.bin
+ ${BIN2HEX} --offset=${ROM_L_4R_B_ADDR} $< $@
+
+l_4s_b.bin.ihx: ../orig/dkong/l_4s_b.bin
+ ${BIN2HEX} --offset=${ROM_L_4S_B_ADDR} $< $@
+
+# low nibble is in c-2k.bpr, high nibble is in c-2j.bpr
+# combine them to save address space at 0x7e00..0x7eff
+c-2k-2j.bpr: ../orig/dkong/c-2k.bpr ../orig/dkong/c-2j.bpr
+ xxd -c 1 <../orig/dkong/c-2k.bpr >__temp__k.xxd
+ xxd -c 1 <../orig/dkong/c-2j.bpr >__temp__j.xxd
+ paste __temp__j.xxd __temp__k.xxd |\
+sed -e 's/^\(........\): 0\(.\).*\t........: 0\(.\).*/\1: \2\3/' \
+>__temp__kj.xxd
+ xxd -c 1 -r <__temp__kj.xxd >$@
+ rm __temp__k.xxd __temp__j.xxd __temp__kj.xxd
+
+io_page.ihx: io_page.rel
+ ${ASLINK} -n -m -u -i -b io_page=${IO_PAGE} $@ $^
+
+io_page.rel: io_page.asm
+ ${ASZ80} -l -o $<
+
+clean:
+ rm -f *.hlr *.ihx *.lst *.map *.o *.rel *.rst c-2k-2j.bpr
--- /dev/null
+; we implement the I/O page as RAM, basically used as communication
+; area between the program and the emulator -- for example, if the
+; joystick moves, the emulator saves the new state in the I/O page,
+; then the program picks it up later using an ordinary memory read
+; this file contains the initial contents, e.g. to set DIP switches
+
+ .area io_page
+
+ ; read
+ .db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff ; 7800
+ .db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff ; 7808
+ .ds 0x30
+
+ ; write
+ .db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff ; 7840 (z80 7800)
+ .db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff ; 7848 (z80 7808)
+ .ds 0x30
+
+ .ds 0x380
+
+ ; read
+ .db 0xff ; 7c00
+ .ds 0x3f
+
+ ; write
+ .db 0xff ; 7c40 (z80 7c00)
+ .ds 0x3f
+
+ ; read
+ .db 0xff ; 7c80
+ .ds 0x3f
+
+ ; write
+ .db 0xff ; 7cc0 (z80 7c80)
+ .ds 0x3f
+
+ ; read
+ .db 0xff ; 7d00
+ .ds 0x3f
+
+ ; write
+ .db 0xff ; 7d40 (z80 7d00)
+ .ds 0x3f
+
+ ; read
+ .db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff ; 7d80
+ .ds 0x38
+
+ ; write
+ .db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff ; 7dc0 (z80 7d80)
+ .ds 0x38
.PHONY: all
all: \
+dkong \
galaxian.zip \
invaders.zip \
mspacman.zip \
pacman.zip
+.PHONY: dkong
+dkong:
+ ${MAKE} ${MAKEFLAGS} -C $@
+
galaxian.zip:
rm -f $@
wget https://archive.org/download/Namco-Classics-MAME-Roms/$@
wget https://archive.org/download/Namco-Classics-MAME-Roms/$@
# avoid hitting archive.org every time, use "make realclean" to really delete
+.PHONY: clean
clean:
+ ${MAKE} ${MAKEFLAGS} -C dkong $@
+.PHONY: realclean
realclean:
+ ${MAKE} ${MAKEFLAGS} -C dkong $@
rm -f \
galaxian.zip \
invaders.zip \
--- /dev/null
+.PHONY: all
+all: \
+c-2j.bpr \
+c-2k.bpr \
+c_5at_g.bin \
+c_5bt_g.bin \
+c_5ct_g.bin \
+c_5et_g.bin \
+l_4m_b.bin \
+l_4n_b.bin \
+l_4r_b.bin \
+l_4s_b.bin \
+s_3i_b.bin \
+s_3j_b.bin \
+v-5e.bpr \
+v_3pt.bin \
+v_5h_b.bin
+
+c-2j.bpr:
+ rm -f $@
+ wget https://archive.org/download/arcade_dkong_202105/$@
+
+c-2k.bpr:
+ rm -f $@
+ wget https://archive.org/download/arcade_dkong_202105/$@
+
+c_5at_g.bin:
+ rm -f $@
+ wget https://archive.org/download/arcade_dkong_202105/$@
+
+c_5bt_g.bin:
+ rm -f $@
+ wget https://archive.org/download/arcade_dkong_202105/$@
+
+c_5ct_g.bin:
+ rm -f $@
+ wget https://archive.org/download/arcade_dkong_202105/$@
+
+c_5et_g.bin:
+ rm -f $@
+ wget https://archive.org/download/arcade_dkong_202105/$@
+
+l_4m_b.bin:
+ rm -f $@
+ wget https://archive.org/download/arcade_dkong_202105/$@
+
+l_4n_b.bin:
+ rm -f $@
+ wget https://archive.org/download/arcade_dkong_202105/$@
+
+l_4r_b.bin:
+ rm -f $@
+ wget https://archive.org/download/arcade_dkong_202105/$@
+
+l_4s_b.bin:
+ rm -f $@
+ wget https://archive.org/download/arcade_dkong_202105/$@
+
+s_3i_b.bin:
+ rm -f $@
+ wget https://archive.org/download/arcade_dkong_202105/$@
+
+s_3j_b.bin:
+ rm -f $@
+ wget https://archive.org/download/arcade_dkong_202105/$@
+
+v-5e.bpr:
+ rm -f $@
+ wget https://archive.org/download/arcade_dkong_202105/$@
+
+v_3pt.bin:
+ rm -f $@
+ wget https://archive.org/download/arcade_dkong_202105/$@
+
+v_5h_b.bin:
+ rm -f $@
+ wget https://archive.org/download/arcade_dkong_202105/$@
+
+# avoid hitting archive.org every time, use "make realclean" to really delete
+.PHONY: clean
+clean:
+
+.PHONY: realclean
+realclean:
+ rm -f \
+c-2j.bpr \
+c-2k.bpr \
+c_5at_g.bin \
+c_5bt_g.bin \
+c_5ct_g.bin \
+c_5et_g.bin \
+l_4m_b.bin \
+l_4n_b.bin \
+l_4r_b.bin \
+l_4s_b.bin \
+s_3i_b.bin \
+s_3j_b.bin \
+v-5e.bpr \
+v_3pt.bin \
+v_5h_b.bin