autoconf / configure issue with porting miniVMac's AppleTalk support to PCE/macplus

Snial

Well-known member
First a recap: it's possible to use AirTalk to connect to miniVmac version 37 (beta) via a host system and magically it can see an AppleTalk connection on a physical classic Mac (i.e. one with a proper serial port, i.e. every Mac prior to the iMac G3/233). However, because of the coarse emulation granularity of miniVMac (basically it executes 68000 code in 1/60.15th of a second blocks), there's a lot of latency, which in turn has a real impact on performance at 1x speed. And this is explained in one of the AirTalk threads (not this one, but I haven't tracked down the right thread).

The PCE/macplus emulator has a much finer emulation granularity (it executes 1ms's worth of code at a time, and I've reduced that to 500µs on my PI 2; it could probably go about 3x lower on the PI 5 I'm using to write this); so that'd reduce the latency and improve AppleTalk performance, when running MacPlus emulation at 1x speed (i.e. for an authentic feel).

However, I've been having problems trying to get PCE/macplus to recognise support for this AppleTalk connection. PCE/macplus uses an autoconf generated configure script where you can pass setup options to generate a customised makefile. For example, if I do:

./configure --with-sdl2 --enable-sound-sdl2 --enable-char-tcp --enable-char-aptk

then my intention is that Linux's tcp connection (telnet) would be mapped to serial port 0 (modem) and appletalk/udp to serial port 1 (printer).

I know I could modify the makefile directly, but I'd like to do it properly, because otherwise if people grab my (future) fork, they'll just start by running configure and then it'll all get messed up and if someone added another feature properly the same problem would occur.

The trouble is, I can't get it to work. I've scoured the files I thought referenced --enable-char-tcp and duplicated it for --enable-char-aptk and as far as I can tell, all the relevant information is in the configure script itself. I've even added a dummy appletalk driver in ....MacEmuPce/src/drivers/char which duplicates tcp, but with the function names and appropriate file names for appletalk (aptk).

It all looks OK initially, the script generates a confdefs.h file containing:

Code:
/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define PCE_VERSION_MAJ 0
#define PCE_VERSION_MIN 2
#define PCE_VERSION_MIC 2
#define PCE_VERSION_STR "20220220-991c55d9"
#define PCE_HOST_LINUX 1
#define HAVE_STDIO_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_STRINGS_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_UNISTD_H 1
#define STDC_HEADERS 1
#define HAVE_ARPA_INET_H 1
#define HAVE_FCNTL_H 1
#define HAVE_LINUX_IF_TUN_H 1
#define HAVE_LINUX_TCP_H 1
#define HAVE_LIMITS_H 1
#define HAVE_NETDB_H 1
#define HAVE_NETINET_IN_H 1
#define HAVE_POLL_H 1
#define HAVE_SYS_IOCTL_H 1
#define HAVE_SYS_POLL_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_SYS_SOUNDCARD_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_TERMIOS_H 1
#define HAVE_UNISTD_H 1
#define HAVE_STDINT_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_FSEEKO 1
#define HAVE_FTRUNCATE 1
#define HAVE_FUTIMES 1
#define HAVE_GETTIMEOFDAY 1
#define HAVE_NANOSLEEP 1
#define HAVE_SLEEP 1
#define HAVE_USLEEP 1
#define PCE_ENABLE_X11 1
#define PCE_ENABLE_SDL 1
#define PCE_ENABLE_SDL2 1
#define PCE_LARGE_FILE 1
#define PCE_BUILD_ATARIST 1
#define PCE_BUILD_CPM80 1
#define PCE_BUILD_IBMPC 1
#define PCE_BUILD_MACPLUS 1
#define PCE_BUILD_RC759 1
#define PCE_BUILD_SIM405 1
#define PCE_BUILD_SIMS32 1
#define PCE_BUILD_SIMARM 1
#define PCE_BUILD_VIC20 1
#define PCE_ENABLE_TUN 1
#define PCE_ENABLE_CHAR_POSIX 1
#define PCE_ENABLE_CHAR_PPP 1
#define PCE_ENABLE_CHAR_PTY 1
#define PCE_ENABLE_CHAR_SLIP 1
#define PCE_ENABLE_CHAR_TCP 1
#define PCE_ENABLE_CHAR_APTK 1
#define PCE_ENABLE_CHAR_TIOS 1
#define PCE_ENABLE_SOUND_OSS 1
#define PCE_DIR_ETC "NONE/etc"
#define PCE_DIR_DATA "NONE/share"

So, PCE_ENABLE_CHAR_APTK is there, which would enable the compilation of the code in the .c files from make. Then it appears to generate another file called config.status which contains a whole pile of interwoven shell, sed and awk scripting, but the critical part is that it embeds a couple of arrays called D and S, which also contain flags for enabling CHAR_x drivers:

Code:
echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
cat >>"$ac_tmp/subs1.awk" <<\_ACAWK &&
S["LTLIBOBJS"]=""
S["LIBOBJS"]=""
S["PCE_DIR_DATA"]="NONE/share"
S["PCE_DIR_ETC"]="NONE/etc"
S["PCE_READLINE_LIBS"]=""
S["PCE_ENABLE_READLINE"]="0"
S["PCE_ENABLE_SOUND_OSS"]="1"
S["PCE_ENABLE_CHAR_WINCOM"]="0"
S["PCE_ENABLE_CHAR_TIOS"]="1"
S["PCE_ENABLE_CHAR_APTK"]="1"
S["PCE_ENABLE_CHAR_TCP"]="1"
S["PCE_ENABLE_CHAR_SLIP"]="1"
S["PCE_ENABLE_CHAR_PTY"]="1"
S["PCE_ENABLE_CHAR_PPP"]="1"
S["PCE_ENABLE_CHAR_POSIX"]="1"
S["PCE_ENABLE_TUN"]="1"
S["PCE_BUILD_VIC20"]="1"
S["PCE_BUILD_SIMARM"]="1"
S["PCE_BUILD_SIMS32"]="1"
S["PCE_BUILD_SIM405"]="1"
S["PCE_BUILD_RC759"]="1"
S["PCE_BUILD_MACPLUS_ROM"]="0"
S["PCE_BUILD_MACPLUS"]="1"
S["PCE_BUILD_IBMPC_ROM"]="0"
S["PCE_BUILD_IBMPC"]="1"
S["PCE_BUILD_CPM80"]="1"
S["PCE_BUILD_ATARIST"]="1"
S["PCE_LARGE_FILE"]="1"
S["PCE_SDL_LIBS"]="-lSDL2"
S["PCE_SDL_CFLAGS"]="-I/usr/include/SDL2 -D_REENTRANT"
S["PCE_ENABLE_SDL2"]="1"
S["PCE_ENABLE_SDL1"]="0"
S["PCE_ENABLE_SDL"]="1"
S["PCE_X11_LIBS"]="-lX11"
S["PCE_X11_CFLAGS"]=""
S["PCE_ENABLE_X11"]="1"
S["CPP"]="gcc -E"
S["XMKMF"]=""
S["PCE_HAVE_INTTYPES_H"]="1"
S["PCE_HAVE_STDINT_H"]="1"
S["PCE_HAVE_IHEX"]="0"
S["IHEX"]=""
S["PCE_HAVE_NASM"]="0"
S["NASM"]=""
S["LN_S"]="ln -s"
S["SET_MAKE"]=""
S["RANLIB"]="ranlib"
S["AR"]="/usr/bin/ar"
S["INSTALL_DATA"]="${INSTALL} -m 644"
S["INSTALL_SCRIPT"]="${INSTALL}"
S["INSTALL_PROGRAM"]="${INSTALL}"
S["OBJEXT"]="o"
S["EXEEXT"]=""
S["ac_ct_CC"]="gcc"
S["CPPFLAGS"]=""
S["LDFLAGS"]=""
S["CFLAGS"]="-g -O2"
S["CC"]="gcc"
S["PCE_HOST_SPARC"]="0"
S["PCE_HOST_PPC"]="0"
S["PCE_HOST_IA32"]="0"
S["PCE_HOST_NETBSD"]="0"
S["PCE_HOST_SUNOS"]="0"
S["PCE_HOST_WINDOWS"]="0"
S["PCE_HOST_LINUX"]="1"
S["host_os"]="linux-gnu"
S["host_vendor"]="unknown"
S["host_cpu"]="aarch64"
S["host"]="aarch64-unknown-linux-gnu"
S["build_os"]="linux-gnu"
S["build_vendor"]="unknown"
S["build_cpu"]="aarch64"
S["build"]="aarch64-unknown-linux-gnu"
S["PCE_VERSION_STR"]="20220220-991c55d9"
S["PCE_VERSION_MIC"]="2"
S["PCE_VERSION_MIN"]="2"
S["PCE_VERSION_MAJ"]="0"
S["target_alias"]=""
S["host_alias"]=""
S["build_alias"]=""
S["LIBS"]=""
S["ECHO_T"]=""
S["ECHO_N"]="-n"
S["ECHO_C"]=""
S["DEFS"]="-DHAVE_CONFIG_H"
S["mandir"]="${datarootdir}/man"
S["localedir"]="${datarootdir}/locale"
S["libdir"]="${exec_prefix}/lib"
S["psdir"]="${docdir}"
S["pdfdir"]="${docdir}"
S["dvidir"]="${docdir}"
S["htmldir"]="${docdir}"
S["infodir"]="${datarootdir}/info"
S["docdir"]="${datarootdir}/doc/${PACKAGE}"
S["oldincludedir"]="/usr/include"
S["includedir"]="${prefix}/include"
S["runstatedir"]="${localstatedir}/run"
S["localstatedir"]="${prefix}/var"
S["sharedstatedir"]="${prefix}/com"
S["sysconfdir"]="${prefix}/etc"
S["datadir"]="${datarootdir}"
S["datarootdir"]="${prefix}/share"
S["libexecdir"]="${exec_prefix}/libexec"
S["sbindir"]="${exec_prefix}/sbin"
S["bindir"]="${exec_prefix}/bin"
S["program_transform_name"]="s,x,x,"
S["prefix"]="/usr/local"
S["exec_prefix"]="${prefix}"
S["PACKAGE_URL"]=""
S["PACKAGE_BUGREPORT"]=""
S["PACKAGE_STRING"]=""
S["PACKAGE_VERSION"]=""
S["PACKAGE_TARNAME"]=""
S["PACKAGE_NAME"]=""
S["PATH_SEPARATOR"]=":"
S["SHELL"]="/bin/bash"
_ACAWK
cat >>"$ac_tmp/subs1.awk" <<_ACAWK &&
  for (key in S) S_is_set[key] = 1
  FS = ""

}
{
  line = $ 0
  nfields = split(line, field, "@")
  substed = 0
  len = length(field[1])
  for (i = 2; i < nfields; i++) {
    key = field[i]
    keylen = length(key)
    if (S_is_set[key]) {
      value = S[key]
      line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
      len += length(value) + length(field[++i])
      substed = 1
    } else
      len += 1 + keylen
  }

  print line
}

_ACAWK
if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
  sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
else
  cat
fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
fi # test -n "$CONFIG_FILES"

# Set up the scripts for CONFIG_HEADERS section.
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
BEGIN {
D["PACKAGE_NAME"]=" \"\""
D["PACKAGE_TARNAME"]=" \"\""
D["PACKAGE_VERSION"]=" \"\""
D["PACKAGE_STRING"]=" \"\""
D["PACKAGE_BUGREPORT"]=" \"\""
D["PACKAGE_URL"]=" \"\""
D["PCE_VERSION_MAJ"]=" 0"
D["PCE_VERSION_MIN"]=" 2"
D["PCE_VERSION_MIC"]=" 2"
D["PCE_VERSION_STR"]=" \"20220220-991c55d9\""
D["PCE_HOST_LINUX"]=" 1"
D["HAVE_STDIO_H"]=" 1"
D["HAVE_STDLIB_H"]=" 1"
D["HAVE_STRING_H"]=" 1"
D["HAVE_INTTYPES_H"]=" 1"
D["HAVE_STDINT_H"]=" 1"
D["HAVE_STRINGS_H"]=" 1"
D["HAVE_SYS_STAT_H"]=" 1"
D["HAVE_SYS_TYPES_H"]=" 1"
D["HAVE_UNISTD_H"]=" 1"
D["STDC_HEADERS"]=" 1"
D["HAVE_ARPA_INET_H"]=" 1"
D["HAVE_FCNTL_H"]=" 1"
D["HAVE_LINUX_IF_TUN_H"]=" 1"
D["HAVE_LINUX_TCP_H"]=" 1"
D["HAVE_LIMITS_H"]=" 1"
D["HAVE_NETDB_H"]=" 1"
D["HAVE_NETINET_IN_H"]=" 1"
D["HAVE_POLL_H"]=" 1"
D["HAVE_SYS_IOCTL_H"]=" 1"
D["HAVE_SYS_POLL_H"]=" 1"
D["HAVE_SYS_SOCKET_H"]=" 1"
D["HAVE_SYS_SOUNDCARD_H"]=" 1"
D["HAVE_SYS_STAT_H"]=" 1"
D["HAVE_SYS_TIME_H"]=" 1"
D["HAVE_SYS_TYPES_H"]=" 1"
D["HAVE_TERMIOS_H"]=" 1"
D["HAVE_UNISTD_H"]=" 1"
D["HAVE_STDINT_H"]=" 1"
D["HAVE_INTTYPES_H"]=" 1"
D["HAVE_FSEEKO"]=" 1"
D["HAVE_FTRUNCATE"]=" 1"
D["HAVE_FUTIMES"]=" 1"
D["HAVE_GETTIMEOFDAY"]=" 1"
D["HAVE_NANOSLEEP"]=" 1"
D["HAVE_SLEEP"]=" 1"
D["HAVE_USLEEP"]=" 1"
D["PCE_ENABLE_X11"]=" 1"
D["PCE_ENABLE_SDL"]=" 1"
D["PCE_ENABLE_SDL2"]=" 1"
D["PCE_LARGE_FILE"]=" 1"
D["PCE_BUILD_ATARIST"]=" 1"
D["PCE_BUILD_CPM80"]=" 1"
D["PCE_BUILD_IBMPC"]=" 1"
D["PCE_BUILD_MACPLUS"]=" 1"
D["PCE_BUILD_RC759"]=" 1"
D["PCE_BUILD_SIM405"]=" 1"
D["PCE_BUILD_SIMS32"]=" 1"
D["PCE_BUILD_SIMARM"]=" 1"
D["PCE_BUILD_VIC20"]=" 1"
D["PCE_ENABLE_TUN"]=" 1"
D["PCE_ENABLE_CHAR_POSIX"]=" 1"
D["PCE_ENABLE_CHAR_PPP"]=" 1"
D["PCE_ENABLE_CHAR_PTY"]=" 1"
D["PCE_ENABLE_CHAR_SLIP"]=" 1"
D["PCE_ENABLE_CHAR_TCP"]=" 1"
D["PCE_ENABLE_CHAR_APTK"]=" 1"
D["PCE_ENABLE_CHAR_TIOS"]=" 1"
D["PCE_ENABLE_SOUND_OSS"]=" 1"
D["PCE_DIR_ETC"]=" \"NONE/etc\""
D["PCE_DIR_DATA"]=" \"NONE/share\""

Then what the awk / sed script appears to do is checks these entries against some other list of features, and filters out the ones it can't possibly support in order to produce the file src/config.h and then it filters out PCE_ENABLE_CHAR_APTK to get:

C:
/* src/config.h.  Generated from config.h.in by configure.  */
/*****************************************************************************
 * pce                                                                       *
 *****************************************************************************/

/*****************************************************************************
 * File name:   src/config.h.in                                              *
 * Created:     2002-12-16 by Hampa Hug <hampa@hampa.ch>                     *
 * Copyright:   (C) 2002-2022 Hampa Hug <hampa@hampa.ch>                     *
 *****************************************************************************/

/*****************************************************************************
 * This program is free software. You can redistribute it and / or modify it *
 * under the terms of the GNU General Public License version 2 as  published *
 * by the Free Software Foundation.                                          *
 *                                                                           *
 * This program is distributed in the hope  that  it  will  be  useful,  but *
 * WITHOUT  ANY   WARRANTY,   without   even   the   implied   warranty   of *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General *
 * Public License for more details.                                          *
 *****************************************************************************/


#ifndef PCE_CONFIG_H
#define PCE_CONFIG_H 1


#ifndef _GNU_SOURCE
#define _GNU_SOURCE 1
#endif

#ifndef _NETBSD_SOURCE
#define _NETBSD_SOURCE 1
#endif

#define PCE_LARGE_FILE 1

#ifdef PCE_LARGE_FILE
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
#endif

#define HAVE_FCNTL_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_LIMITS_H 1
#define HAVE_STDINT_H 1
#define HAVE_TERMIOS_H 1
#define HAVE_UNISTD_H 1
#define HAVE_LINUX_IF_TUN_H 1
#define HAVE_LINUX_TCP_H 1
#define HAVE_SYS_IOCTL_H 1
#define HAVE_SYS_POLL_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_SYS_SOUNDCARD_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1

#define HAVE_FSEEKO 1
#define HAVE_FTRUNCATE 1
#define HAVE_FUTIMES 1
#define HAVE_USLEEP 1
#define HAVE_NANOSLEEP 1
#define HAVE_SLEEP 1
#define HAVE_GETTIMEOFDAY 1

#define PCE_YEAR "2022"

#define PCE_VERSION_MAJ 0
#define PCE_VERSION_MIN 2
#define PCE_VERSION_MIC 2
#define PCE_VERSION_STR "20220220-991c55d9"

#define PCE_HOST_LINUX 1
/** #undef PCE_HOST_WINDOWS **/
/** #undef PCE_HOST_SUNOS **/
/** #undef PCE_HOST_NETBSD **/

/** #undef PCE_HOST_IA32 **/
/** #undef PCE_HOST_PPC **/
/** #undef PCE_HOST_SPARC **/

#define PCE_DIR_ETC "NONE/etc"

#define PCE_BUILD_IBMPC 1

#define PCE_ENABLE_X11 1

#define PCE_ENABLE_SDL 1
/** #undef PCE_ENABLE_SDL1 **/
#define PCE_ENABLE_SDL2 1

/** #undef PCE_ENABLE_READLINE **/

#define PCE_ENABLE_TUN 1

#define PCE_ENABLE_CHAR_POSIX 1
#define PCE_ENABLE_CHAR_PPP 1
#define PCE_ENABLE_CHAR_PTY 1
#define PCE_ENABLE_CHAR_SLIP 1
#define PCE_ENABLE_CHAR_TCP 1
#define PCE_ENABLE_CHAR_TIOS 1
/** #undef PCE_ENABLE_CHAR_WINCOM **/

#define PCE_ENABLE_SOUND_OSS 1

/* directory separator */
#define PCE_DIR_SEP '/'


#endif

And I've no idea where it gets this other list of features from in order to filter it out. Also, I'm like 99% ignorant of sed and awk - it all looks like BrainF*** to me. I'm wondering if there's someone else who knows enough about autoconf, configure or PCE/macplus who can tell me where it might be getting those other list of features from. I've attached the configure.sh.
 

Attachments

  • configure.txt.zip
    47.3 KB · Views: 1

cheesestraws

Well-known member
you should really edit config.in instead and let autoconf generate the configure script for you. Nothing good will come of trying to edit autoconf-generated shell scripts by hand, and your changes will all be wiped out if anyone runs autoconf.

you could fix the bug on line 771 of configure.in while you're at it ;-)
 

Snial

Well-known member
you should really edit config.in instead and let autoconf generate the configure script for you. Nothing good will come of trying to edit autoconf-generated shell scripts by hand, and your changes will all be wiped out if anyone runs autoconf.

you could fix the bug on line 771 of configure.in while you're at it ;-)
Thanks. erm, can't see a config.in. There's a config.ac is that it? Do I need to install autoconf too?
 

robin-fo

Well-known member
real impact on performance at 1x speed
1x speed with LocalTalk is only required for booting. It will run stable even with „all out“ after the extensions loaded. Just don‘t reboot, re-enable AppleTalk or start/stop the AIR after you changed the execution speed of Mini vMac. Even if you go back to 1x…
 

Snial

Well-known member
What source distribution are you looking at?
Aaaah, I was using pce-0.2.2.tar.gz from here: http://www.hampa.ch/pce/download.html
I should have gone to http://www.hampa.ch/pub/pce/pre/pce-20200914-698603e2/

which is the latest build and does have a configure.in. OK, I'll look into that! One interesting aspect of PCE/MacPlus even the version from 2013 is that BeiHierarchic 1.2 works using the same System 7.0.1 HD image; wheras it doesn't appear to on miniVMac 37.

1x speed with LocalTalk is only required for booting. It will run stable even with „all out“ after the extensions loaded. Just don‘t reboot, re-enable AppleTalk or start/stop the AIR after you changed the execution speed of Mini vMac. Even if you go back to 1x…
I see your point about only needing 1x for booting, but peversely I quite like running miniVMac at 1x, because it feels more like a real Mac Plus. Also, I think LocalTalk should work with something like the correct latency even if it runs at 1x or 8x or whatever. It's a bug that needs fixing either by fixing miniVMac to improve the emulation granularity or by porting -lto udp to PCE/macplus.

-cheers from Julz
 

robin-fo

Well-known member
I‘m really excited about any additional LocalTalk support in emulators. I really wish MAME would support it! But still looking forward to LToUDP support in PCE! Might this work using both serial ports at the same time and connected to different LToUDP „networks“?
 

cheesestraws

Well-known member
Might this work using both serial ports at the same time and connected to different LToUDP „networks“?

You could run LToUDP on different UDP ports to do LocalTalk "vlans" but none of the existing implementations currently have a configuration option for this. That's not a structural issue with the protocol though.
 

Snial

Well-known member
you should really edit config.in instead and let autoconf generate the configure script for you. Nothing good will come of trying to edit autoconf-generated shell scripts by hand, and your changes will all be wiped out if anyone runs autoconf.

you could fix the bug on line 771 of configure.in while you're at it ;-)
Hi @cheesestraws , thanks for the advice. I downloaded the latest version, http://www.hampa.ch/pub/pce/pre/pce-20200914-698603e2/; unpacked it; followed the normal ./configure; make -j4; sudo make install and got a working version of pce/Macplus (haven't checked any other emulator).

Then I did autoconf -o config.sh configure.in. It generated a few warnings, but no errors; then I ran ./config.sh which seemed to work as before; then I tried make, but it didn't make (sic) anything, because no source code had been updated.

Then I modified configure.in to add aptk (appletalk) to the set of supported char drivers. I also copied my char-aptk.c and .h to the src/drivers/char folder.

Code:
AC_MSG_CHECKING([whether to enable the APTK character driver])
AC_ARG_ENABLE(char-aptk,
  [AS_HELP_STRING([--enable-char-aptk], [Enable the APTK character driver [guessed]])],
  [
    if test "x$enableval" = "xyes" ; then
        PCE_ENABLE_CHAR_APTK=1
        AC_MSG_RESULT([yes])
    else
        PCE_ENABLE_CHAR_APTK=0
        AC_MSG_RESULT([no])
    fi
  ],[
    PCE_ENABLE_CHAR_APTK=1
    test "x$ac_cv_header_arpa_inet_h" = "xyes" || PCE_ENABLE_CHAR_APTK=0
    test "x$ac_cv_header_fcntl_h" = "xyes" || PCE_ENABLE_CHAR_TIOS=0
    test "x$ac_cv_header_netinet_in_h" = "xyes" || PCE_ENABLE_CHAR_APTK=0
    test "x$ac_cv_header_netdb_h" = "xyes" || PCE_ENABLE_CHAR_APTK=0
    test "x$ac_cv_header_sys_socket_h" = "xyes" || PCE_ENABLE_CHAR_APTK=0
    test "x$ac_cv_header_poll_h" = "xyes" || PCE_ENABLE_CHAR_APTK=0
    test "x$ac_cv_header_unistd_h" = "xyes" || PCE_ENABLE_CHAR_APTK=0
    if test "x$PCE_ENABLE_CHAR_APTK" = "x1" ; then
        AC_MSG_RESULT([yes (guess)])
    else
        AC_MSG_RESULT([no (guess)])
    fi
  ]
)
AC_SUBST(PCE_ENABLE_CHAR_APTK)
if test "x$PCE_ENABLE_CHAR_APTK" = "x1" ; then
    AC_DEFINE(PCE_ENABLE_CHAR_APTK)
fi

This time when I ran autoconf -o config.sh configure.in I had the same result as before: good. I then ran ./config.sh --with-sdl2 --enable-sound-sdl2 --enable-char-aptk and got this near the end:

Code:
checking whether to enable the posix file character driver... yes (guess)
checking whether to enable the PPP character driver... yes (guess)
checking whether to enable the pty character driver... yes (guess)
checking whether to enable the SLIP character driver... yes (guess)
checking whether to enable the TCP character driver... yes (guess)
checking whether to enable the APTK character driver... yes
checking whether to enable the termios character driver... yes (guess)
checking whether to enable the windows COM character driver... no (guess)
checking whether to enable the OSS sound driver... yes (guess)
checking whether to enable readline... maybe
checking for initscr in -lncurses... no
checking whether to enable readline... no (guess)
config.sh: creating ./config.status
config.status: creating Makefile
config.status: creating Makefile.inc
config.status: creating src/config.inc
config.status: creating src/config.h
config.status: src/config.h is unchanged
config.sh: WARNING: unrecognized options: --with-sdl2, --enable-sound-sdl2

pce 20200914-698603e2 is now configured:

So, it looks like it's accepted the aptk entry via configure.in. However, you can also see that config.h is unchanged. So, the mystery remains; there must still be something missing about my attempt to add support for APTK that prevents config.h from being updated. Any ideas?

I‘m really excited about any additional LocalTalk support in emulators. I really wish MAME would support it! But still looking forward to LToUDP support in PCE! Might this work using both serial ports at the same time and connected to different LToUDP „networks“?
Does that work with a real Mac Plus or other Mac? Recently from the What Did You Do Recently With Your Mac, I added a bit about adding a few control panels to my installation of System 7.1 on my actual Mac Plus. I was puzzled that the Network panel had been missing, which allows you to select the serial port for AppleTalk. However, even when I added the control panel, it only gave me the option of the Printer Port; and I think someone later said that there was some kind of other hack/control panel which did enable it to be switched, but I forget where.

-cheers from Julz
 

cheesestraws

Well-known member
So, it looks like it's accepted the aptk entry via configure.in. However, you can also see that config.h is unchanged. So, the mystery remains; there must still be something missing about my attempt to add support for APTK that prevents config.h from being updated. Any ideas?

I think you might need to go and read the autoconf manual here. I don't know it well and I'd only be guessing if I were to try to help.

Does that work with a real Mac Plus or other Mac?

Yes. By default, under the old networking stack, you can only use the Printer port, I'm not sure why. There's a couple of extensions you can use to enable it on multiple ports - and if you are using Open Transport (which won't work on a Plus but you get my drift) you can always select both ports.

I assume it's meant to be just a UI restriction for "one less thing for the user to set up wrong" but that won't stop them plugging it into the wrong port on the back...
 

Snial

Well-known member
I think you might need to go and read the autoconf manual here. I don't know it well and I'd only be guessing if I were to try to help.

Woohoo! I solved the problem! The file src/config.h.in has a #undef for every configuration parameter. That's what it's checking against. By adding

#undef PCE_ENABLE_CHAR_APTK

and then running ./config.sh --with-sdl2 --enable-sound-sdl2 --enable-char-aptk again,

#define PCE_ENABLE_CHAR_APTK 1

appeared in the config.h!

Yes. By default, under the old networking stack, you can only use the Printer port, I'm not sure why. There's a couple of extensions you can use to enable it on multiple ports - and if you are using Open Transport (which won't work on a Plus but you get my drift) you can always select both ports.

I assume it's meant to be just a UI restriction for "one less thing for the user to set up wrong" but that won't stop them plugging it into the wrong port on the back...
I‘m really excited about any additional LocalTalk support in emulators. I really wish MAME would support it! But still looking forward to LToUDP support in PCE! Might this work using both serial ports at the same time and connected to different LToUDP „networks“?
Well, I'm now a step closer to being able to handle LocalTalk on PCE/MacPlus. Thinking about your message above, I'm slightly confused as to why we'd want to have multiple LToUDP "networks". This is really my ignorance rather than anything, but it's worth bringing up at this point as I can now get to the lower levels and start porting the actual miniVMac LToUDP code to PCE. They both work in a fairly similar way, there's a structure containing a bunch of callback functions ( a similar set) so that you can hook in any kind of serial driver. In PCE the ones to use are specified in its own .cfg file at runtime.

So, this means that in the runtime .cfg we could have something like:

Code:
#...earlier parts of the .cfg for CPU, Screen, Terminal etc.

serial {
    # The port number. Use 0 for the modem port and 1 for
    # the printer port.
    port = 0

    # Up to multichar characters are sent or received
    # without any transmission delay. For a real serial port
    # this value is 1 but larger values can speed up
    # transmission.
    multichar = 1

    # Not all character drivers are supported on
    # all platforms.
    #driver = "null"
    #driver = "posix:file=ser_a.out"
    #driver = "pty:symlink=ser_a"
    #driver = "stdio:file=ser_a.out:flush=1"
    #driver = "tios:file=/dev/ttyAMA0"
    #driver = "tcp:port=5555:telnet=1:telnetinit=1:usectl=1"
    driver = "aptk:port=5556:usectl=1"
}

serial {
    port = 1
    #driver = "stdio:file=ser_b.out"
    driver = "aptk:port=5555:usectl=1"
}

#...later parts of the .cfg... SCSI etc.

I don't yet know the real UDP port numbers, so 5555 and 5556 are just dummies. So, you'd be able to do it, if there's a System 7.x update for the Mac Plus that could support both, which there might be.

What I don't understand is how it helps to have two appletalk subnets on an emulator. Won't all the external interfaces, e.g. AirTalk or Netatalk (however that's done, which I don't know) all just chuck data onto the same multicast UDP address and port and read from the same UDP address:port? What do we gain if we can have two?
 

cheesestraws

Well-known member
Don't get sidetracked by the multiple addresses thing. Start with one port.

Bear in mind here that LocalTalk is not RS232, and it uses the hardware SDLC support in the SCC. So you'll likely need to port the SDLC support from mini vmac's SCC emulation to PCE-macplus, which doesn't seem to have it (if I'm reading the code right).
 

Snial

Well-known member
Don't get sidetracked by the multiple addresses thing. Start with one port.
It's OK, I wasn't going to do anything special to support both yet.

Bear in mind here that LocalTalk is not RS232, and it uses the hardware SDLC support in the SCC. So you'll likely need to port the SDLC support from mini vmac's SCC emulation to PCE-macplus, which doesn't seem to have it (if I'm reading the code right).
OK, wow. I thought TashTalk would un-SDLC the data on its non-localtalk interface and the UDP packets would be just plain non-SDLC. Anyway, progress. I can now compile my fake char-aptk.c into the build. There were a couple of other things I'd failed to do:

src/drivers/char/Makefile.inc and top level Makefile.inc.in need specific references for char-aptk, which as usual I copied from the tcp versions and renamed the tcp/TCP refs to aptk/APTK.
 

cheesestraws

Well-known member
OK, wow. I thought TashTalk would un-SDLC the data on its non-localtalk interface and the UDP packets would be just plain non-SDLC.

They are. But in order to enable the LocalTalk interface, the OS switches the SCC into SDLC mode and uses the framing stuff in the SCC. So it's not that you need to emulate the output of the SDLC mode, but the interface it provides to software.
 

Snial

Well-known member
OK, I thought I'd provide a little update: I've ported the main miniVMac LToUDP code to PCE/macPlus. Pre-testing steps are:

  1. Get it compiling (haven't tried yet, but I know it compiles my fake duplicate char-tcp.c). It will fail to compile in a few areas, I've probably forgotten to convert some of miniVMac's strange types (and I converted them rather than creating new typedefs to map standard types to miniVMac); I've probably forgotten to pass the drv driver pointer or forgotten to use drv-> somewhere where miniVMac uses its static/global equivalent. I've probably forgotten to reference a function properly. Anyway, that kind of normal thing.
  2. Add the SDLC changes referenced by @cheesestraws .
  3. Get those SDLC changes compiled.
  4. Port the debugging interface to PCE's expectations - the debugging enables won't be enabled yet, but I'll need to for testing.
 
Top