build-emu.sh (1068 bytes)
1 #!/bin/sh 2 # build-emu.sh -- fetch and build the z80pack cpmsim emulator (MIT licence) and its 3 # z80asm reference assembler in ~/src/z80pack. Named pipes for the auxiliary device 4 # are switched off: they need a cpmrecv helper and are shared between instances. 5 set -e 6 Z=${Z80PACK:-$HOME/src/z80pack} 7 [ -d "$Z" ] || git clone --depth 1 https://github.com/udo-munk/z80pack.git "$Z" 8 sed -i 's|^#define PIPES|/* #define PIPES */|' "$Z/cpmsim/srcsim/sim.h" 9 # upstream's no-PIPES path still names the old constant STOPPED 10 sed -i 's/= STOPPED;/= ST_STOPPED;/' "$Z/cpmsim/srcsim/simio.c" 11 # a TCP console peer that disconnects (read returns 0) stops the CPU with a fatal I/O 12 # error upstream; drop the connection instead, so the next one can attach 13 sed -i 's/if ((errno == EAGAIN) || (errno == EINTR)) {/if (1) { \/* peer gone: drop it *\//' "$Z/cpmsim/srcsim/simio.c" 14 (cd "$Z/cpmsim/srcsim" && nice make clean >/dev/null && nice make >/dev/null) 15 (cd "$Z/z80asm" && nice make >/dev/null) 16 echo "built $Z/cpmsim/cpmsim and $Z/z80asm/z80asm ($(git -C "$Z" rev-parse --short HEAD))"