diff --git a/README.md b/README.md index 07e0c19..1b551eb 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ If the emulator is run with no options, it prints a usage screen: E:\DEC> tu58em ERROR: no units were specified FATAL: illegal command line - tu58 tape emulator v1.4j + tu58 tape emulator v1.4k Usage: ./tu58em [-options] -[rwci] file1 ... -[rwci] file7 Options: -V | --version output version string -v | --verbose enable verbose output to terminal diff --git a/cygwin1.dll b/cygwin1.dll index 03ff8d9..7667961 100644 Binary files a/cygwin1.dll and b/cygwin1.dll differ diff --git a/main.c b/main.c index 61a94f4..dec72df 100644 --- a/main.c +++ b/main.c @@ -39,6 +39,8 @@ // v1.4j - 01 Nov 2014 - donorth - Change 'int' to 'long' where possible. // Only use char/short/long types, not int. // Fix source for ubuntu linux 12.04 (time structs) +// v1.4k - 11 Jun 2015 - donorth - Integrate Mark Blair's changes for MacOSX compilation +// - No functionality changes on other platforms // @@ -49,7 +51,7 @@ static char copyright[] = "(C) 2005-2014 Don North , " \ "(C) 1984 Dan Ts'o "; -static char version[] = "tu58 tape emulator v1.4j"; +static char version[] = "tu58 tape emulator v1.4k"; static char port[32] = "1"; // default port number (COM1, /dev/ttyS0) static long speed = 9600; // default line speed diff --git a/makefile b/makefile index 318d95d..90a6ccf 100644 --- a/makefile +++ b/makefile @@ -2,11 +2,15 @@ # tu58em emulator makefile # -ifeq ($(comm),win) +ifeq ($(comm),mac) +# UNIX comms model, but on a Mac +PROG = tu58em +COMM = -UWINCOMM -DMACOSX +else ifeq ($(comm),win) # WINDOWS comms model PROG = tu58ew COMM = -DWINCOMM -else +else # ifeq ($(comm),unix) # UNIX comms model PROG = tu58em COMM = -UWINCOMM @@ -16,7 +20,11 @@ BIN = ../../../../../tools/exe CC = gcc CFLAGS = -I. -O3 -Wall -c $(COMM) +ifeq ($(comm),mac) +LFLAGS = -lpthread +else LFLAGS = -lpthread -lrt +endif $(PROG) : main.o tu58drive.o file.o serial.o $(CC) -o $@ main.o tu58drive.o file.o serial.o $(LFLAGS) @@ -27,6 +35,10 @@ all : make --always comm=unix make clean +mac : + make --always comm=mac + make --clean + installall : make --always comm=win install make clean @@ -35,7 +47,7 @@ installall : clean : -rm -f *.o - -chmod a-x,ug+w,o-w *.c *.h Makefile + -chmod a-x,ug+w,o-w *.c *.h makefile -chmod a+rx $(PROG) $(PROG).exe -chown `whoami` * diff --git a/serial.c b/serial.c index 89ec73e..f80be1c 100644 --- a/serial.c +++ b/serial.c @@ -21,6 +21,12 @@ #include #endif // WINCOMM +#ifdef MACOSX +#define IUCLC 0 // Not POSIX +#define OLCUC 0 // Not POSIX +#define CBAUD 0 // Not POSIX +#endif + #include #define BUFSIZE 256 // size of serial line buffers (bytes, each way) diff --git a/tu58drive.c b/tu58drive.c index 30426dd..0e1cd24 100644 --- a/tu58drive.c +++ b/tu58drive.c @@ -20,6 +20,18 @@ #include "tu58.h" +#ifdef MACOSX +// clock_gettime() is not available under OSX +#define CLOCK_REALTIME 1 +#include + +void clock_gettime(int dummy, timespec_t *t) { + uint64_t mt; + mt = mach_absolute_time(); + t->tv_sec = mt / 1000000000; + t->tv_nsec = mt % 1000000000; +} +#endif // delays for modeling device access @@ -524,6 +536,12 @@ static void command (int8_t flag) char *name= "none"; uint8_t mode = 0; + // Avoid uninitialized variable warnings + time_start.tv_sec = 0; + time_start.tv_nsec = 0; + time_end.tv_sec = 0; + time_end.tv_nsec = 0; + pk.flag = flag; pk.length = devrxget(); diff --git a/tu58em.exe b/tu58em.exe index 244018d..0f65292 100644 Binary files a/tu58em.exe and b/tu58em.exe differ diff --git a/tu58ew.exe b/tu58ew.exe index c2ebe1d..4edf33a 100644 Binary files a/tu58ew.exe and b/tu58ew.exe differ