Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Building Z80pack dev : error: unknown type name ‘BYTE’, etc.

180 views
Skip to first unread message

Nathanael

unread,
Apr 16, 2022, 11:04:27 AM4/16/22
to
I’m trying to build the dev version of Z80Pack.

git clone https://GitHub.com/undo-munk/z80pack.git
cd z80pack/
git checkout dev
cd front panel
make -f Makefile.Linux
sudo cp lib front panel.so /use/lib
cd ../cromemcosim/srcsim
make

In file included from sim0.c:64:
./memory.h:44:2: error: unknown type name ‘BYTE’
44 | BYTE spage; /* start page of segment */
./memory.h:45:2: error: unknown type name ‘WORD’
45. | WORD size; /* size of segment in pages */
./memory.h:50:8error unknown type name ‘WORD’

Udo Munk

unread,
Apr 16, 2022, 12:06:36 PM4/16/22
to
Just tested on CentOS 8, not reproducible .
The C compiler has a problem to find include files for some reason on your system.

Nathanael

unread,
Apr 16, 2022, 9:13:09 PM4/16/22
to
Looks like the problem is it can find defs for BYTE and WORD.

Does anyone know where, on Ubuntu 20.04, those defs are? I’ve looked through most of the stuff in /usr/include/ and /usr/include/x86_64-linux-gnu/9/include including all the student.h I could find, but nothing.

Steve Nickolas

unread,
Apr 16, 2022, 9:17:03 PM4/16/22
to
I'm not aware of them being standard but on a C99 compiler such as you'll
find there you can use <stdint.h> and uint8_t/uint16_t respectively.

-uso.

Udo Munk

unread,
Apr 17, 2022, 2:54:33 AM4/17/22
to
BYTE and WORD are defined in z80pack's sim.h, not any C standard defines.
Leftover from decades ago when the software was written in K&R C.

rwd...@gmail.com

unread,
Apr 17, 2022, 5:17:52 AM4/17/22
to
net typo error, blocked me testing this on ubuntu before I realised - git clone https://GitHub.com/undo-munk/z80pack.git (undo-munk should be udo-munk :) )
cheers
richard

Udo Munk

unread,
Apr 17, 2022, 7:12:24 AM4/17/22
to
Really odd problem, sim0.c includes:

#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <libgen.h>
#include <ctype.h>
#include <fcntl.h>
#include <memory.h>
#include <sys/stat.h>
#include <sys/time.h>
#include "sim.h"
#include "simglb.h"
#include "config.h"
#ifdef FRONTPANEL
#include "../../frontpanel/frontpanel.h"
#endif
#include "memory.h"

sim.h typdefs BYTE and WORD but then unkown in later included memory.h
Don't know why and cannot reproduce this on OSX, Windows, Linux, BSD.

Nathanael

unread,
Apr 17, 2022, 9:40:44 AM4/17/22
to
All typing errors are due to iOS’ stupid spellchecker: "udo" became "undo", and so forth.

Nathanael

unread,
Apr 17, 2022, 11:43:04 AM4/17/22
to
Apparently it’s something broken on my system. Maybe a consequence of reinstalling a couple of months ago. I tried restoring /usr/lib from a backup copy without success.

So I spun up a new Ubuntu 20.04 virtual machine, ran

sudo apt-get install go make perl wget git build-essential libjpeg8-dev libx11-dev mesa-common-dev libglu1-dev freeglut3-dev libxmu-dev socat ffmpeg

Then successfully built tall the emulators.

When I find time this week I’ll reinstall Ubuntu on my desktop.

Nathanael

unread,
Apr 19, 2022, 1:48:45 AM4/19/22
to
As it turns out, I'm still having build problems. I've tried building 1.36, 1.37, master and dev branches and haven't been completely successful for any.

This is all being done in a fresh stock Ubuntu 20.04 desktop VM installed from the 20.04 iso downloaded from Ubuntu.

I'm using a BASH script for installation (attached in a separate post below), specifying the z80pack version on the command line:

zinstall dev | master | 1.37 | 1.36

Testing consists of attempting to run cpm2 or cpm22 for each simulator.

Results summary:

DEV branch -- no errors during build; everything runs except imsai, which complains it can't find /panel.conf.
MASTER branch -- errors during cromemco build; imsai fails to run.
1.37 -- cromemco build errors; everything else runs fine.
1.36 -- build errors for both cromemco and imsai. altair and cpmsim run fine.

Various error messages posted separately below.

Nathanael

unread,
Apr 19, 2022, 1:49:34 AM4/19/22
to
#!/bin/bash
rootdir=$(pwd)
[[ -z $1 ]] && zver=1.37 || zver=$1
cd $rootdir

function fetchz80pack () {
echo ""
echo "================================================"
echo " Fetching Z80Pack "
echo "================================================"
echo ""

case $zver in
master | dev ) git clone https://github.com/udo-munk/z80pack.git
cd $rootdir/z80pack
git checkout $zver
cd $rootdir
;;
1.37 | 1.36 )
echo "--------------------------"
echo Installing zpack80-$zver.tgz
echo "--------------------------"

wget https://www.autometer.de/unix4fun/z80pack/ftp/z80pack-$zver.tgz && tar -xvf z80pack-$zver.tgz && rm z80pack-$zver.tgz
mv z80pack-$zver z80pack
cd $rootdir
;;
* ) echo "Please specify the version of Z80Pack to install:"
echo ""
echo " ./doit xxxx"
echo ""
echo "Where 'xxxx' is one of dev master 1.36 1.37"
exit 1
;;
esac
}

function frontpanel () {

echo ""
echo "================================================"
echo " Building Frontpanel "
echo "================================================"
echo ""

cd $rootdir/z80pack/frontpanel
make -f Makefile.linux
echo "Enter your password if prompted:"
sudo cp libfrontpanel.so /usr/lib
cd $rootdir
}

function webfrontend () {
echo ""
echo "================================================"
echo " Building Webfrontend "
echo "================================================"
echo ""

cd $rootdir/z80pack/webfrontend/
rm -r civetweb/
git clone https://github.com/civetweb/civetweb.git
cd civetweb
git checkout 7259a80
make lib WITH_WEBSOCKET=1 COPT='-DNO_SSL -DNO_CACHING'
cd $rootdir
}

function cromemco () {
echo ""
echo "================================================"
echo " Building Cromemco "
echo "================================================"
echo ""

cd $rootdir/z80pack/cromemcosim/srcsim/
sed -i '46s/.*/#define HAS_DISKMANAGER/' sim.h
sed -i '47s/.*/#define HAS_NETSERVER/' sim.h
make -f Makefile.linux
cd $rootdir
}

function imsai () {
echo ""
echo "================================================"
echo " Building Imsai "
echo "================================================"
echo ""

cd $rootdir/z80pack/imsaisim/srcsim/
sed -i '46s/.*/#define HAS_DISKMANAGER/' sim.h
sed -i '47s/.*/#define HAS_NETSERVER/' sim.h
make -f Makefile.linux
echo "Enter your password if prompted:"
sudo mkdir -p /usr/local/share/imsaisim/roms
sudo cp $rootdir/z80pack/imsaisim/roms/*.* /usr/local/share/imsaisim/roms

for i in cpm22 imdos202 imsai-cpm13 um-cpm13; do
sed -i '8s|.*|env $BOOTENV ./imsaisim -r -z $*|' $rootdir/z80pack/imsaisim/$i
done

for i in cpm3 imdos205r0 ; do
sed -i '9s|.*|env $BOOTENV ./imsaisim -r -z $*|' $rootdir/z80pack/imsaisim/$i
done

for i in ucsd ; do
sed -i '10s|.*|env $BOOTENV ./imsaisim -r -z $*|' $rootdir/z80pack/imsaisim/$i
done

cd $rootdir
}

function altair () {

echo ""
echo "================================================"
echo " Building Altair "
echo "================================================"
echo ""

cd $rootdir/z80pack/altairsim/srcsim
make -f Makefile.linux
cd $rootdir
}

function mostek () {

echo ""
echo "================================================"
echo " Building Mostek "
echo "================================================"
echo ""

cd $rootdir/z80pack/mosteksim/srcsim
make -f Makefile
cd $rootdir
}

function cpm () {

echo ""
echo "================================================"
echo " Building CP/M "
echo "================================================"
echo ""

cd $rootdir/z80pack/cpmsim/srcsim
make -f Makefile.linux
cd $rootdir
}

function tools () {

echo ""
echo "================================================"
echo " Compiling the tools dude! "
echo "================================================"
echo ""

cd $rootdir/z80pack/cpmsim/srctools
make
echo "Enter your password if prompted:"
sudo make install
mkdir -p ~/bin
PATH=$PATH:/home/nathanael/bin; export PATH
for i in bin2hex cpmr.sh cpmw.sh mkdskimg ptp2bin receive send; do cp $i ~/bin; done
chmod +777 /tmp/z80pack/cpmsim.aux*
cd $rootdir
}

function preflight () {
[[ -d ./z80pack ]] && { echo "Directory z80pack already exists. Remove it, then re-run this script."; exit 1; }

dependencies="sudo wget git build-essential libjpeg8-dev libx11-dev mesa-common-dev libglu1-mesa-dev freeglut3-dev libxmu-dev socat"
unset missing

echo ""
echo "---------------------------"
echo "Testing for dependencies..."
echo "---------------------------"
echo ""

for dependency in $dependencies; do
echo $dependency
dpkg -S $dependency >/dev/null 2>/dev/null || missing=$missing$dependency" "
done

[[ ! -z "$missing" ]] && {
echo ""
echo "-------------------------------------------------------------------------------"
echo "ERROR: Some dependencies are missing. They must be installed before continuing."
echo " They may be installed with: "
echo " "
echo " sudo apt-get install $missing "
echo " "
echo " Would you like to install these now? "
echo "-------------------------------------------------------------------------------"
echo ""

while true; do
read -p "Install now (Y/N)? " ans
case ans in
[yY]* ) sudo apt-get install $missing; exit 0 ;;
[nN]* ) echo " "
echo "-------------------------------------------------------------------------------"
echo " **** Z80Pack installation is not complete. "
echo "-------------------------------------------------------------------------------"
echo ""
exit 2
;;
* ) echo "Please answer Y or N."; break ;;
esac
done
} || {
echo ""
echo "All dependencies checked. Let's go!"
echo ""
}
}

# ==========
# MAIN
# ==========

preflight
fetchz80pack
frontpanel
[[ ! "$zver"=="1.36" ]] && webfrontend
cpm
tools
cromemco
imsai
altair
mostek

echo ""
echo "Z80Pack successfully installed! YAY!"
echo ""

exit 0

Nathanael

unread,
Apr 19, 2022, 1:50:45 AM4/19/22
to
==============================
dev branch imsai runtime error
==============================

##### ### ##### ### ##### ### # #
# # # # # # # # # # # ## ##
# # # # # # # # # # # # # #
##### # # ##### # # ##### ##### # # # #
# # # # # # # # # # # #
# # # # # # # # # # # # #
##### ### ##### ### ##### ### # #

Release 1.38-dev, Copyright (C) 1987-2021 by Udo Munk
IMSAI 8080 Simulation Release 1.19,
Copyright (C) 2008-2021 by Udo Munk & 2018-2021 by David McNaughton

CPU speed is 2 MHz, CPU executes undocumented instructions
SIO 1A running at 115200 baud
SIO 1B running at 110 baud
SIO 2A running at 115200 baud
SIO 2B running at 2400 baud

Web server builtin, URL is http://localhost:8080

RAM 0000H - FFFFH
MMU has 7 additional RAM banks of 48 KB

Loader statistics for file /usr/local/share/imsaisim/roms:
START : FFFFH
END : 0000H
LOADED: 0002H (2)

W (4915) diskmanager: No disk map: -z/disk.map, attempting to create file.
W (4923) diskmanager: Can't create disk map: -z/disk.map
MODEM.init string: ATS15=1

SIO PORT MAP:
SIO1.portA = WEBTTY STDIO
SIO1.portB = VIOKBD
SIO2.portA = WEBPTR SCKTSRV
SIO2.portB = MODEM

FrontPanel Simulator v2.1 Copyright (C) 2007-2015 by John Kichury
readFile: could not open file /panel.conf
fp_init: error initializing the panel
E (6360) system: frontpanel error
I (7000) netsrv: Server stopped.
I (7016) netsrv: Bye!

Nathanael

unread,
Apr 19, 2022, 1:53:39 AM4/19/22
to
===================================
master branch cromemco build errors
===================================

./lnsrc
gcc -O3 -c -Wall -Wextra -U_FORTIFY_SOURCE -DCONFDIR=\"/usr/local/share/cromemcosim/conf\" -DDISKSDIR=\"/usr/local/share/cromemcosim/disks\" -DBOOTROM=\"/usr/local/share/cromemcosim/bootrom.hex\" sim0.c
In file included from sim0.c:66:
sim.h:48:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘on’
48 | * SIGIO on BSD sockets not working with Cygwin
| ^~
sim.h:48:10: error: unknown type name ‘on’
In file included from sim0.c:67:
simglb.h:55:8: error: unknown type name ‘WORD’
55 | extern WORD PC, SP, IX, IY;
| ^~~~
simglb.h:91:8: error: unknown type name ‘WORD’
91 | extern WORD t_start, t_end;
| ^~~~
simglb.h:96:8: error: unknown type name ‘WORD’
96 | extern WORD fp_led_address;
| ^~~~
simglb.h:98:8: error: unknown type name ‘WORD’
98 | extern WORD address_switch;
| ^~~~
In file included from sim0.c:72:
memory.h:30:27: error: unknown type name ‘WORD’; did you mean ‘SWORD’?
30 | static inline void memwrt(WORD addr, BYTE data)
| ^~~~
| SWORD
memory.h:56:27: error: unknown type name ‘WORD’; did you mean ‘SWORD’?
56 | static inline BYTE memrdr(WORD addr)
| ^~~~
| SWORD
memory.h:76:29: error: unknown type name ‘WORD’; did you mean ‘SWORD’?
76 | static inline BYTE dma_read(WORD addr)
| ^~~~
| SWORD
memory.h:81:30: error: unknown type name ‘WORD’; did you mean ‘SWORD’?
81 | static inline void dma_write(WORD addr, BYTE data)
| ^~~~
| SWORD
memory.h:89:27: error: unknown type name ‘WORD’; did you mean ‘SWORD’?
89 | static inline BYTE getmem(WORD addr)
| ^~~~
| SWORD
memory.h:94:27: error: unknown type name ‘WORD’; did you mean ‘SWORD’?
94 | static inline void putmem(WORD addr, BYTE data)
| ^~~~
| SWORD
sim0.c: In function ‘main’:
sim0.c:344:4: warning: implicit declaration of function ‘putmem’ [-Wimplicit-function-declaration]
344 | putmem(i, m_flag);
| ^~~~~~
sim0.c: In function ‘save_core’:
sim0.c:464:7: warning: implicit declaration of function ‘getmem’; did you mean ‘getdelim’? [-Wimplicit-function-declaration]
464 | d = getmem(i);
| ^~~~~~
| getdelim
make: *** [Makefile.linux:61: sim0.o] Error 1

Nathanael

unread,
Apr 19, 2022, 1:54:25 AM4/19/22
to
=================================
master branch imsai runtime error
=================================

####### ##### ### ##### ### # #
# # # # # # # # ## ##
# # # # # # # # # # #
# ##### # # ##### ##### # # # #
# # # # # # # # #
# # # # # # # # # #
####### ##### ### ##### ### # #

Release 1.37, Copyright (C) 1987-2021 by Udo Munk
IMSAI 8080 Simulation Release 1.18,
Copyright (C) 2008-2021 by Udo Munk & 2018-2021 by David McNaughton

CPU speed is 2 MHz, CPU executes undocumented instructions
RAM size bank 0 is 64 KB, MMU has 7 additional banks a 48 KB
SIO 1A running at 9600 baud
SIO 1B running at 1200 baud
SIO 2A running at 9600 baud
SIO 2B running at 2400 baud
MPU-B Banked ROM/RAM enabled

can't open file /usr/local/share/imsaisim/bootrom.hex

Nathanael

unread,
Apr 19, 2022, 1:55:07 AM4/19/22
to
=================================
1.37 branch cromemco build errors
=================================

./lnsrc
gcc -O3 -c -Wall -Wextra -U_FORTIFY_SOURCE -DCONFDIR=\"/usr/local/share/cromemcosim/conf\" -DDISKSDIR=\"/usr/local/share/cromemcosim/disks\" -DBOOTROM=\"/usr/local/share/cromemcosim/bootrom.hex\" sim0.c
In file included from sim0.c:66:
sim.h:48:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘on’
48 | * SIGIO on BSD sockets not working with Cygwin
| ^~
sim.h:48:10: error: unknown type name ‘on’
In file included from sim0.c:67:
simglb.h:55:8: error: unknown type name ‘WORD’
55 | extern WORD PC, SP, IX, IY;
| ^~~~
simglb.h:91:8: error: unknown type name ‘WORD’
91 | extern WORD t_start, t_end;
| ^~~~
simglb.h:96:8: error: unknown type name ‘WORD’
96 | extern WORD fp_led_address;
| ^~~~
simglb.h:98:8: error: unknown type name ‘WORD’
98 | extern WORD address_switch;
| ^~~~
In file included from sim0.c:72:
memory.h:29:27: error: unknown type name ‘WORD’; did you mean ‘SWORD’?
29 | static inline void memwrt(WORD addr, BYTE data)
| ^~~~
| SWORD
memory.h:53:27: error: unknown type name ‘WORD’; did you mean ‘SWORD’?
53 | static inline BYTE memrdr(WORD addr)
| ^~~~
| SWORD
memory.h:69:29: error: unknown type name ‘WORD’; did you mean ‘SWORD’?
69 | static inline BYTE dma_read(WORD addr)
| ^~~~
| SWORD
memory.h:74:30: error: unknown type name ‘WORD’; did you mean ‘SWORD’?
74 | static inline void dma_write(WORD addr, BYTE data)
| ^~~~
| SWORD
memory.h:82:27: error: unknown type name ‘WORD’; did you mean ‘SWORD’?
82 | static inline BYTE getmem(WORD addr)
| ^~~~
| SWORD
memory.h:87:27: error: unknown type name ‘WORD’; did you mean ‘SWORD’?
87 | static inline void putmem(WORD addr, BYTE data)
| ^~~~
| SWORD
sim0.c: In function ‘main’:
sim0.c:316:4: warning: implicit declaration of function ‘putmem’ [-Wimplicit-function-declaration]
316 | putmem(i, m_flag);
| ^~~~~~
sim0.c: In function ‘save_core’:
sim0.c:436:7: warning: implicit declaration of function ‘getmem’; did you mean ‘getdelim’? [-Wimplicit-function-declaration]
436 | d = getmem(i);

Nathanael

unread,
Apr 19, 2022, 1:55:49 AM4/19/22
to
====================================
1.36 cromemco and imsai build errors
====================================

================================================
Building Cromemco
================================================

./lnsrc
gcc -O3 -c -Wall -Wextra -U_FORTIFY_SOURCE -DCONFDIR=\"/usr/local/share/cromemcosim/conf\" -DDISKSDIR=\"/usr/local/share/cromemcosim/disks\" -DBOOTROM=\"/usr/local/share/cromemcosim/bootrom.hex\" sim0.c
sim0.c: In function ‘main’:
sim0.c:192:11: error: ‘I8080’ undeclared (first use in this function)
192 | cpu = I8080;
| ^~~~~
sim0.c:192:11: note: each undeclared identifier is reported only once for each function it appears in
sim0.c:196:11: error: ‘Z80’ undeclared (first use in this function)
196 | cpu = Z80;
| ^~~
sim0.c: In function ‘init_cpu’:
sim0.c:338:13: error: ‘I8080’ undeclared (first use in this function)
338 | if (cpu == I8080) { /* i8080 specific */
| ^~~~~
sim0.c: In function ‘reset_cpu’:
sim0.c:366:13: error: ‘Z80’ undeclared (first use in this function)
366 | if (cpu == Z80) {
| ^~~
make: *** [Makefile.linux:60: sim0.o] Error 1

================================================
Building Imsai
================================================

./lnsrc
gcc -O3 -c -Wall -Wextra -U_FORTIFY_SOURCE -DCONFDIR=\"/usr/local/share/imsaisim/conf\" -DDISKSDIR=\"/usr/local/share/imsaisim/disks\" -DBOOTROM=\"/usr/local/share/imsaisim/bootrom.hex\" sim0.c
In file included from sim0.c:65:
sim.h:54:21: warning: "/*" within comment [-Wcomment]
54 | #define LENCMD 80 /* length of command buffers etc */
|
sim0.c: In function ‘main’:
sim0.c:257:31: error: ‘RELEASE’ undeclared (first use in this function)
257 | printf("\nRelease %s, %s\n", RELEASE, COPYR);
| ^~~~~~~
sim0.c:257:31: note: each undeclared identifier is reported only once for each function it appears in
sim0.c:257:40: error: ‘COPYR’ undeclared (first use in this function)
257 | printf("\nRelease %s, %s\n", RELEASE, COPYR);
| ^~~~~
sim0.c: In function ‘load_file’:
sim0.c:459:10: error: ‘LENCMD’ undeclared (first use in this function)
459 | char fn[LENCMD];
| ^~~~~~
sim0.c:459:7: warning: unused variable ‘fn’ [-Wunused-variable]
459 | char fn[LENCMD];
| ^~
sim0.c:490:1: warning: control reaches end of non-void function [-Wreturn-type]
490 | }
| ^
make: *** [Makefile.linux:57: sim0.o] Error 1
Enter your password if prompted:
cp: cannot stat '/home/nathanael/temp/z80pack/imsaisim/roms/*.*': No such file or directory
sed: can't read /home/nathanael/temp/z80pack/imsaisim/cpm3: No such file or directory

Udo Munk

unread,
Apr 19, 2022, 2:13:48 AM4/19/22
to
Nathanael schrieb am Dienstag, 19. April 2022 um 07:50:45 UTC+2:
...
> Loader statistics for file /usr/local/share/imsaisim/roms:
...
> readFile: could not open file /panel.conf
> fp_init: error initializing the panel
> E (6360) system: frontpanel error
> I (7000) netsrv: Server stopped.
> I (7016) netsrv: Bye!

This looks like you try to run a system wide installation with data files in /usr/local/share/imsaisim,
but you didn't copy the conf directory to there. A complete installation looks like this:

udos-mbp:cpm udo$ ls /usr/local/share/imsaisim
conf disks roms

And all files in the subdirectories of course:

udos-mbp:cpm udo$ ls /usr/local/share/imsaisim/conf
blue_paint.jpg imsai_1600.jpg paddle_up_red.jpg
case_left.jpg paddle_cent_blue.jpg panel.conf
case_rear.jpg paddle_cent_red.jpg pwr_sw_dn.jpg
case_right.jpg paddle_dn_blue.jpg pwr_sw_up.jpg
envmap.jpg paddle_dn_red.jpg system.conf
imsai_1024.jpg paddle_up_blue.jpg

Udo Munk

unread,
Apr 19, 2022, 2:28:31 AM4/19/22
to
Nathanael schrieb am Dienstag, 19. April 2022 um 07:53:39 UTC+2:
...
> In file included from sim0.c:66:
> sim.h:48:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘on’
> 48 | * SIGIO on BSD sockets not working with Cygwin
> | ^~
> sim.h:48:10: error: unknown type name ‘on’
...

In this case you are using a C compiler that doesn't understand C comments anymore:

/*
* SIGIO on BSD sockets not working with Cygwin
*/
#ifdef __CYGWIN__
#undef TCPASYNC
#endif

No idea what kind of broken compiler environment produces this, on some systems I'm testing
with gcc 4, 5, 6, 7, 8, 9 and llvm.

Udo Munk

unread,
Apr 19, 2022, 2:31:02 AM4/19/22
to
Nathanael schrieb am Dienstag, 19. April 2022 um 07:54:25 UTC+2:
...
> can't open file /usr/local/share/imsaisim/bootrom.hex
...

System wide installation in /usr/local/share/imsaisim, but without copying the data files
there.

Dennis Boone

unread,
Apr 19, 2022, 12:25:07 PM4/19/22
to
> This is all being done in a fresh stock Ubuntu 20.04 desktop VM
> installed from the 20.04 iso downloaded from Ubuntu.

What version of gcc is installed?

De
0 new messages