DOS port now compiles and works. Issues #8 and #58 need revisiting.
authorDavid Griffith <dave@661.org>
Sun, 19 May 2019 04:52:20 +0000 (21:52 -0700)
committerDavid Griffith <dave@661.org>
Mon, 27 May 2019 02:32:11 +0000 (19:32 -0700)
Loading an executable in a Blorb file works, but very slowly. Audio and
graphics support through Blorb are not yet attempted, though sometimes
old-style works.  For instance, in Sherlock, blowing the sound of a cab
approaching is heard (blow the whistle on the first move).  However,
playing the violin after you go upstairs is not.

Makefile.tc
src/common/frotz.h
src/dos/bcblorb.c
src/dos/bcinput.c

index f674c651501d58586a490e67b0bbbdbf3b6b72eb..785dea0762ba84b46c2863e208c70cf894460f52 100644 (file)
@@ -14,10 +14,11 @@ RENAME = ren
 BINNAME = frotz.exe\r
 LIBRARY = frotz.lib\r
 \r
-SOUND_DEF = -DSOUND_SUPPORT\r
-DOS_DEF = -DMSDOS_16BIT\r
+VERSION = "2.45pre"\r
 \r
-DEFS = $(SOUND_DEF) $(DOS_DEF)\r
+VER = -DVERSION=$(VERSION)\r
+\r
+DEFS = src\common\defs.h\r
 \r
 DOS_DIR = src\dos\r
 DOS_OBJECTS =   $(DOS_DIR)\bcinit.o \\r
@@ -53,15 +54,25 @@ CORE_OBJECTS =  $(CORE_DIR)\buffer.o \
 \r
 .SUFFIXES: .c .o .h\r
 \r
+all:   defs frotz\r
+\r
+defs: $(DEFS)\r
+$(DEFS):\r
+       @echo "** Generating $@"\r
+       @echo "#ifndef COMMON_DEFINES_H" > $@\r
+       @echo "#define COMMON_DEFINES_H" >> $@\r
+       @echo "#define MSDOS_16BIT" >> $@\r
+       @echo "#define SOUND_SUPPORT" >> $@\r
+       @echo "#endif /* COMMON_DEFINES_H */" >> $@\r
+\r
 .c.o:\r
-       $(CC) $(CFLAGS) $(DEFS) -I$(DOS_DIR) -I$(CORE_DIR) -c -o$@ $<\r
+       $(CC) $(CFLAGS) $(VER) -I$(DOS_DIR) -I$(CORE_DIR) -c -o$@ $<\r
        $(TLIB) $(LIBRARY) +-$@\r
 \r
-all:   frotz\r
-\r
 clean:\r
        $(RM) $(CORE_DIR)\*.o\r
        $(RM) $(DOS_DIR)\*.o\r
+       $(RM) $(DEFS)\r
        $(RM) *.lib\r
        $(RM) *.exe\r
        $(RM) *.bak\r
index 7c78df6f57d347df46e212b06615112b3df8ea24..8bc77a505d662b21648c69a537ce1da1a335ba6f 100644 (file)
@@ -8,11 +8,15 @@
 #ifndef FROTZ_H_
 #define FROTZ_H_
 
+#include "defs.h"
+
 /* Unfortunately, frotz's bool definition conflicts with that of curses.
    But since no os_* function uses it, it's safe to let the frotz core see
    this definition, but have the unix port see the curses version. */
 
+#ifndef MSDOS_16BIT
 #include "git_hash.h"
+#endif
 
 #ifndef __UNIX_PORT_FILE
 #include <signal.h>
@@ -125,7 +129,6 @@ typedef struct {
 
 
 #include "setup.h"
-#include "defs.h"
 #include "missing.h"
 #include "unused.h"
 
index 0d0578bb9e074f9a7d88d15e1c382b2688baee4b..be56cdf2ea1c4db086c3a26eb61d1159f4efab0d 100644 (file)
@@ -56,8 +56,8 @@ static bb_err_t bb_initialize()
     } test;
     uint32 val;
 
-    if (sizeof(uint32) != 4 || sizeof(uint16) != 2)
-        return bb_err_CompileTime; /* Basic types are the wrong size. */
+//    if (sizeof(uint32) != 4 || sizeof(uint16) != 2)
+//        return bb_err_CompileTime; /* Basic types are the wrong size. */
 
     test.ch[0] = 0x13;
     test.ch[1] = 0x57;
index d4231c02d1f43fee20baa0132f1c496c71ec5ba3..0a5843dcb9244c4b79c461d72aceb628682ab23e 100644 (file)
@@ -918,7 +918,7 @@ zchar os_read_key (int timeout, bool cursor)
  *
  */
 
-int os_read_file_name (char *file_name, const char *default_name, int flag)
+char *os_read_file_name (const char *default_name, int flag)
 {
     char *extension;
     FILE *fp;
@@ -930,6 +930,7 @@ int os_read_file_name (char *file_name, const char *default_name, int flag)
 
     int i;
     char *tempname;
+    char file_name[FILENAME_MAX + 1];
 
     /* Turn off playback and recording temporarily */
 
@@ -1015,6 +1016,18 @@ finished:
     istream_replay = saved_replay;
     ostream_record = saved_record;
 
-    return result;
+    if (!result) return NULL;
+
+    return strdup(file_name);
 
 }/* os_read_file_name */
+
+
+/*
+ * Called regularly by the interpreter, at least every few instructions
+ * (only when interpreting: e.g., not when waiting for input).
+ */
+void os_tick(void)
+{
+       /* do nothing */
+}