Repository: jrincayc/ucblogo-code
Pull request #207: Remove Think-C and Turbo C support
Author: login: n1ywb-1
Created: 2025-03-10T22:02:34Z | Merged: 2025-03-12T02:26:12Z

Removes code inside the following ifdefs, and fixes up resulting ripple effect, but conservatively.

```
__ZTC__
__RZTC__
THINK_C
__TURBOC__
```

This gets rid of a lot of the DOS-specific code, but there is more hiding inside 
```
#if defined(ibm) && !defined(WIN32)
```
and other spots. I'll get that to next. It's a bit hairy. Syntax highlighting is helpful though, as long as I define the right macros it shows me what to delete.

Built and tested on Windows 11 and Linux Mint 22


Diff:
diff --git a/.gitignore b/.gitignore
index a6410bbc..e140b45a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,3 +26,9 @@
 /ucblogo
 Makefile
 Makefile.in
+*.i
+*.ii
+*.s
+*.exe
+git.c
+logo_win.res
diff --git a/Makefile.am b/Makefile.am
index 40c68bff..d0d7aa38 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -95,9 +95,6 @@ EXTRA_DIST += evaluator.ps evaluator.pdf evaluator.svg
 # Win32 API compliant graphics routines (unused)
 EXTRA_DIST += win32trm.c win32trm.h
 
-# IBM-specific graphics routines (unused)
-EXTRA_DIST += ztcterm.c ztcterm.h
-
 # makehelp_SOURCES = makehelp.c
 
 # Make sure pdf built for distributions
diff --git a/coms.c b/coms.c
index ed182605..0ba5c23a 100644
--- a/coms.c
+++ b/coms.c
@@ -34,15 +34,6 @@ extern int check_wx_stop(int force_yield, int pause_return_value);
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#ifdef ibm
-#include "process.h"
-#endif
-#ifdef __RZTC__
-#include <time.h>
-#include <controlc.h>
-#include <dos.h>
-#include <msmouse.h>
-#endif
 
 #ifdef HAVE_TERMIO_H
 #ifdef HAVE_WX
@@ -67,17 +58,8 @@ extern int check_wx_stop(int force_yield, int pause_return_value);
 #endif
 
 NODE *make_cont(enum labels cont, NODE *val) {
-#ifdef __RZTC__
-    union { enum labels lll;
-	    NODE *ppp;} cast;
-#endif
     NODE *retval = cons(NIL, val);
-#ifdef __RZTC__
-    cast.lll = cont;
-    retval->n_car = cast.ppp;
-#else
     retval->n_car = (NODE *)cont;
-#endif
     settype(retval, CONT);
     return retval;
 }
@@ -350,18 +332,6 @@ void prepare_to_exit(BOOLEAN okay) {
 	wxLogoExit (0);
 #endif
 
-#ifndef WIN32 /* sowings */
-#ifdef ibm
-    ltextscreen(NIL);
-    ibm_plain_mode();
-#ifdef __RZTC__
-    msm_term();
-    zflush();
-    controlc_close();
-#endif
-#endif
-#endif /* !WIN32 */
-
 #ifdef unix
 #ifndef HAVE_UNISTD_H
     extern int getpid();
@@ -383,9 +353,6 @@ NODE *lbye(NODE *args) {
 	lcleartext(NIL);
     ndprintf(stdout, "%t\n", message_texts[THANK_YOU]);
     ndprintf(stdout, "%t\n", message_texts[NICE_DAY]);
-#ifdef __RZTC__
-    printf("\n");
-#endif
     
 #ifdef HAVE_WX
     wx_leave_mainloop++;
@@ -421,9 +388,6 @@ NODE *lwait(NODE *args) {
       //fflush(stdout); /* csls v. 1 p. 7 */
 #endif
 
-#if defined(__RZTC__)
-	zflush();
-#endif
 	fix_turtle_shownness();
 
 #ifdef HAVE_WX
@@ -445,16 +409,6 @@ NODE *lwait(NODE *args) {
 	    n = (unsigned int)getint(num) / 60;
 	    sleep(n);
 #endif
-#elif defined(__RZTC__)
-	    usleep(getint(num) * 16667L);
-#elif defined(_MSC_VER)
-	    n = (unsigned int)getint(num);
-	    while (n > 60) {
-		_sleep(1000);
-		n -= 60;
-		if (check_throwing) n = 0;
-	    }
-	    if (n > 0) _sleep(n*1000/60);
 #else	/* unreachable, I think */
 	    if (!setjmp(iblk_buf)) {
 		input_blocking++;
@@ -470,54 +424,6 @@ NODE *lwait(NODE *args) {
 }
 
 NODE *lshell(NODE *args) {
-#ifdef ibm
-    NODE *arg;
-    char doscmd[200];
-/*  union REGS r;     */
-    char *old_stringptr = print_stringptr;
-    int old_stringlen = print_stringlen;
-
-    arg = car(args);
-    while (!is_list(arg) && NOT_THROWING) {
-	setcar(args, err_logo(BAD_DATA, arg));
-	arg = car(args);
-    }
-    if (arg == NIL) {
-	ndprintf(stdout, "%t\n", message_texts[TYPE_EXIT]);
-	if (spawnlp(P_WAIT, "command", "command", NULL))
-	    err_logo(FILE_ERROR,
-	      make_static_strnode
-		 ("Could not open shell (probably due to low memory)"));
-    }
-    else {
-	print_stringlen = 199;
-	print_stringptr = doscmd;
-	ndprintf((FILE *)NULL,"%p",arg);
-	*print_stringptr = '\0';
-	if (system(doscmd) < 0)
-	    err_logo(FILE_ERROR,
-	      make_static_strnode
-		 ("Could not open shell (probably due to low memory)"));
-	print_stringptr = old_stringptr;
-	print_stringlen = old_stringlen;
-    }
-/*
-    r.h.ah = 0x3;
-    r.h.al = 0;
-    r.h.dh = 0; r.h.dl = 0;
-    int86(0x21, &r, &r);
-    x_coord = x_margin;
-    y_coord = r.h.dh;
- */
-#ifndef WIN32
-    x_coord = x_margin;
-    y_coord = y_max;
-    ibm_gotoxy(x_coord, y_coord);
-#else
-    win32_repaint_screen();
-#endif
-    return(UNBOUND);
-#else
     char cmdbuf[300];
     FILE *strm;
     NODE *head = NIL, *tail = NIL, *this;
@@ -562,7 +468,6 @@ NODE *lshell(NODE *args) {
     pclose(strm);
 #endif
     return(head);
-#endif
 }
 
 NODE *ltime(NODE *args) {
diff --git a/error.c b/error.c
index 4e3d05ef..46975c34 100644
--- a/error.c
+++ b/error.c
@@ -285,9 +285,6 @@ NODE *lpause(NODE *args) {
 	    else elist = NIL;
 #ifndef WIN32
 	    if (feof(stdin) && !isatty(0)) lbye(NIL);
-#endif
-#ifdef __RZTC__
-	    if (feof(stdin)) rewind(stdin);
 #endif
 	    if (elist != NIL) eval_driver(elist);
 	    if (stopping_flag == THROWING) {
diff --git a/eval.c b/eval.c
index cc914dd8..e37256ad 100644
--- a/eval.c
+++ b/eval.c
@@ -714,9 +714,6 @@ return(val);
 
 compound_apply:
     debprint("compound_apply");
-#ifdef ibm
-    check_ibm_stop();
-#endif
 #ifdef HAVE_WX
     check_wx_stop(0, 0);
 #endif
@@ -1305,9 +1302,6 @@ nofix:	this_line = unparsed__line(unev);
     }
     if (repcount > 0)    /* negative means forever */
 	--repcount;
-#ifdef ibm
-    check_ibm_stop();
-#endif
     if (RUNNING) goto repeat_again;
     val = UNBOUND;
     goto repeat_done;
diff --git a/files.c b/files.c
index 1f5230b6..38dcca1f 100644
--- a/files.c
+++ b/files.c
@@ -54,19 +54,6 @@ int reading_char_now = 0;
 #include <unistd.h>
 #endif
 
-#ifdef ibm
-#ifndef _MSC_VER
-#include <bios.h>
-#ifndef __RZTC__
-#include <alloc.h>
-#endif /* ZTC */
-#endif /* MSC_VER */
-extern int getch(), kbhit();
-#ifdef __RZTC__
-#include <conio.h>
-#endif
-#endif
-
 NODE *file_list = NULL;
 NODE *reader_name = NIL, *writer_name = NIL, *file_prefix = NIL;
 int need_save = 0;  /* nonzero if workspace changed since save */
@@ -603,44 +590,7 @@ NODE *lreadchar(NODE *args) {
 	else
 	    c = (char)sysGetC(readstream);
 #else
-#ifdef ibm
-	if (interactive && readstream==stdin)
-#ifndef WIN32
-		c = (char)getch();
-#else /* WIN32 */
-	{
-	  win32_update_text();
-	  if (!char_avail)
-	    while(GetMessage(&msg, NULL, 0, 0))
-	    {
-	      TranslateMessage(&msg);
-	      DispatchMessage(&msg);
-	      if (char_avail)
-		break;
-	    }
-	  c = buffered_char;
-	  char_avail = 0;
-	}
-#endif /* WIN32 */	
-	else
-		c = (char)sysGetC(readstream);
-
-	if (c == 17) { /* control-q */
-	    to_pending = 0;
-	    err_logo(STOP_ERROR,NIL);
-	}
-	if (c == 23) { /* control-w */
-
-#ifdef SIG_TAKES_ARG
-	    logo_pause(0);
-#else
-	    logo_pause();
-#endif
-	    return(lreadchar(NIL));
-	}
-#else /* !ibm */
 	c = (char)sysGetC(readstream);
-#endif /* ibm */
 #endif /* wx */
     }
     input_blocking = 0;
@@ -735,31 +685,11 @@ NODE *lkeyp(NODE *args) {
 #ifdef HAVE_WX
 	return(wxKeyp() ? TrueName() : FalseName());
 #else
-#if defined(__RZTC__) && !defined(WIN32) /* sowings */
-	zflush();
-#endif
 
 #ifdef WIN32
 	win32_update_text();
 #endif
 
-#if defined(ibm)
-#ifdef WIN32
-	old_mode = char_mode;
-	char_mode = 1;
-	while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE))
-	{
-	  TranslateMessage(&msg);
-	  DispatchMessage(&msg);
-	  if (char_avail/* ||cur_index */ )
-	    break;
-	}
-	char_mode = old_mode;
-	return ((char_avail /* ||cur_index */ ) ? TrueName() : FalseName());
-#else
-	return(kbhit() ? TrueName() : FalseName());
-#endif
-#else
 #ifdef FIONREAD
 	ioctl(0,FIONREAD,(int *)(&nc));
 #else
@@ -770,7 +700,6 @@ NODE *lkeyp(NODE *args) {
 	    return(TrueName());
 	else
 	    return(FalseName());
-#endif
 #endif /* wx */
     }
     c = sysGetC(readstream);
diff --git a/globals.h b/globals.h
index 814ab927..fe1ddefb 100644
--- a/globals.h
+++ b/globals.h
@@ -549,34 +549,6 @@ extern NODE *set_text_color(NODE *);
 #endif
 
 
-#ifdef __RZTC__   /* ztcterm.c */
-extern BOOLEAN in_graphics_mode, in_splitscreen;
-extern int ibm_screen_bottom;
-#include <fg.h>
-extern fg_coord_t MaxX, MaxY;
-extern void outtext(char *);
-extern void init_ibm_memory(void);
-extern volatile int ctrl_c_count;
-extern BOOLEAN check_ibm_stop(void);
-extern void term_init_ibm(void);
-extern void ibm_gotoxy(int, int);
-extern void ibm_clear_text(void);
-extern void ibm_clear_screen(void);
-extern void ibm_plain_mode(void);
-extern void ibm_bold_mode(void);
-extern void erase_graphics_top(void);
-extern void ztc_set_penc(FIXNUM);
-extern void t_screen(void);
-extern void s_screen(void);
-extern void check_scroll(void);
-extern void ztc_put_char(int);
-extern void fix_cursor(void);
-extern void zflush(void);
-extern void newline_bugfix(void);
-extern void ztc_getcr(void);
-extern NODE *set_text_color(NODE *);
-#endif
-
 #ifdef HAVE_WX
 extern void init_wx(int, char**);
 extern void printToScreen(char c, FILE * stream);
diff --git a/graphics.c b/graphics.c
index 1d0eecee..6f4e5dba 100644
--- a/graphics.c
+++ b/graphics.c
@@ -36,13 +36,8 @@
 #include "wxGraphics.h"
 #elif defined(WIN32)
 #include "win32trm.h"
-#elif defined(__RZTC__)
-#include <fg.h>
-#include "ztcterm.h"
 #elif defined(x_window)
 #include "xgraphics.h"
-#elif defined(ibm)
-#include "ibmterm.h"
 #else
 #include "nographics.h"
 #endif /* end this whole big huge tree */
@@ -56,11 +51,7 @@ int turtlePosition_y=0;
 extern void wx_adjust_label_height();
 #endif
 
-#if defined(__RZTC__) && !defined(WIN32) /* sowings */
-#define total_turtle_bottom_max (-(MaxY/2))
-#else
 #define total_turtle_bottom_max turtle_bottom_max
-#endif
 
 /* types of graphics moves that can be recorded */
 #define FINISHED       0    /* must be zero */
@@ -80,9 +71,6 @@ extern void wx_adjust_label_height();
 #define ENDFILL	      14
 #define COLORFILL     15
 
-/* NOTE: See the files ibmterm.c and ibmterm.h
-   for examples of the functions and macros that this file assumes exist. */
-
 #define One (sizeof(void *))
 #define Two (2*One)
 #define Three (3*One)
@@ -1262,20 +1250,6 @@ NODE *lsetscrunch(NODE *args) {
 			       (FLONUM)getint(ynode);
 	draw_turtle();
 	done_drawing;
-#ifdef __RZTC__
-	{
-	    FILE *fp = fopen("scrunch.dat","r");
-	    if (fp != NULL) {
-		fclose(fp);
-		fp = fopen("scrunch.dat","w");
-		if (fp != NULL) {
-		    fwrite(&x_scale, sizeof(FLONUM), 1, fp);
-		    fwrite(&y_scale, sizeof(FLONUM), 1, fp);
-		    fclose(fp);
-		}
-	    }
-	}
-#endif
 #ifdef HAVE_WX
 	//update the label height!
 
@@ -1836,9 +1810,6 @@ void redraw_graphics(void) {
     int lastx, lasty;
     pen_info saved_pen;
     BOOLEAN saved_shown;
-#if defined(__RZTC__) && !defined(WIN32)
-    BOOLEAN save_splitscreen = in_splitscreen;
-#endif
 #ifdef HAVE_WX
     char *start, *ptr;
     int start_idx, idx, count, color;
@@ -1865,10 +1836,6 @@ void redraw_graphics(void) {
     save_pen(&saved_pen);
     restore_pen(&orig_pen);
 	
-#if defined(__RZTC__) && !defined(WIN32)
-    full_screen;
-#endif
-
     erase_screen();
     wanna_x = wanna_y = turtle_x = turtle_y = turtle_heading = 0.0;
     out_of_bounds = FALSE;
@@ -1879,10 +1846,6 @@ void redraw_graphics(void) {
     set_pen_width(1);
     set_pen_height(1);
 
-#ifdef __TURBOC__
-    moveto(p_info_x(orig_pen),p_info_y(orig_pen));
-#endif
-
     lastx = lasty = 0;
 
     while (bufp[r_index] != FINISHED) {
@@ -2013,10 +1976,6 @@ void redraw_graphics(void) {
     restore_pen(&saved_pen);
     turtle_shown = saved_shown;
 
-#if defined(__RZTC__) && !defined(WIN32)
-    if (save_splitscreen) {split_screen;}
-#endif
-
     turtle_x = save_tx;
     turtle_y = save_ty;
     turtle_heading = save_th;
@@ -2032,7 +1991,7 @@ NODE *lsavepict(NODE *args) {
     char *p;
     char *buf = record_buffer;
 	
-#if defined(WIN32)||defined(ibm)
+#if defined(WIN32)
 	extern NODE *lopen(NODE *, char *);
 	lopen(args,"wb");
 #else
@@ -2087,7 +2046,7 @@ NODE *lloadpict(NODE *args) {
     size_t records_read;
     int palette_read_status;
 
-#if defined(WIN32)||defined(ibm)
+#if defined(WIN32)
 	extern NODE *lopen(NODE *, char *);
 	lopen(args,"rb");
 #else
diff --git a/init.c b/init.c
index 82a52a72..9b15d379 100644
--- a/init.c
+++ b/init.c
@@ -407,7 +407,7 @@ PRIMTYPE prims[] = {
     {"setread", 1, 1, 1, PREFIX_PRIORITY, lsetread},
     {"setreadpos", 1, 1, 1, PREFIX_PRIORITY, lsetreadpos},
     {"setscrunch", 2, 2, 2, PREFIX_PRIORITY, lsetscrunch},
-#if defined(WIN32)|defined(ibm)|defined(HAVE_WX)
+#if defined(WIN32)|defined(HAVE_WX)
     {"settc", 2, 2, 2, PREFIX_PRIORITY, set_text_color},
     {"settextcolor", 2, 2, 2, PREFIX_PRIORITY, set_text_color},
 #endif
diff --git a/logo.h b/logo.h
index ea8074f2..70ca4874 100644
--- a/logo.h
+++ b/logo.h
@@ -36,45 +36,20 @@
 #define SIG_TAKES_ARG
 
 #ifdef WIN32
-#define ibm
-#undef __RZTC__
 #define HAVE_MEMCPY
 #define SIG_TAKES_ARG
+#define RETSIGTYPE void
+#ifndef STDC_HEADERS
+#define STDC_HEADERS
 #endif
-
-#ifdef __ZTC__
-#ifndef THINK_C
-#define __RZTC__
-#endif
-#endif
-
-#ifdef __TURBOC__
-#define ibm
-#endif
-
-#ifdef __RZTC__
-#define ibm
-#define HAVE_MEMCPY
-#define SIG_TAKES_ARG
-#endif
-
-#ifdef _MSC_VER
-#define ibm
-#endif
-
-#if !defined(ibm)
+#else
 #ifndef unix
 #define unix
-#endif
 #define SIG_TAKES_ARG
 #include "config.h"
 #ifndef X_DISPLAY_MISSING
 #define x_window
 #endif
-#else
-#define RETSIGTYPE void
-#ifndef STDC_HEADERS
-#define STDC_HEADERS
 #endif
 #endif
 
@@ -89,26 +64,15 @@
 extern char *getenv();
 #endif
 
-#ifndef HAVE_WX
-#ifdef ibm
-#include <dos.h>
-#endif
-#endif
-
 #ifdef HAVE_WX
-#undef ibm
 #define check_throwing (check_wx_stop(0, 0) || stopping_flag == THROWING)
 #else
-#if defined(ibm)
-#define check_throwing (check_ibm_stop() || stopping_flag == THROWING)
-#else
 #if defined(HAVE_X11)
 #define check_throwing (check_X11_stop() , (stopping_flag == THROWING))
 #else
 #define check_throwing (stopping_flag == THROWING)
 #endif
 #endif
-#endif
 
 typedef enum {wrapmode, fencemode, windowmode} mode_type;
 
@@ -119,16 +83,8 @@ typedef enum {wrapmode, fencemode, windowmode} mode_type;
 #define UNDEFINED       Unbound
 #define END_OF_LIST     ((NODE *) 2)
 #define HASH_LEN        1021	/* a prime number */
-#ifdef __RZTC__
-#define SEG_SIZE	2000
-#else
-#ifdef THINK_C
-#define SEG_SIZE	4000
-#else
 #define SEG_SIZE        16000 /* Should be a fairly big number for optimal GC
                                  Performance */
-#endif
-#endif
 #define MAX_PHYS_LINE   5000
 #define MAX_NUMBER      200	/* max number of digits in a float */
 #define HIST_MAX	50	/* number of remembered instruction lines */
diff --git a/logodata.c b/logodata.c
index ada145ed..9443b7e7 100644
--- a/logodata.c
+++ b/logodata.c
@@ -26,11 +26,6 @@
 #include "logo.h"
 #include "globals.h"
 #include <stdarg.h>
-#ifdef ibm
-#if !defined(__RZTC__) && !defined(_MSC_VER)
-#include <alloc.h>
-#endif
-#endif
 
 char special_chars[] = " \t\n(?????+++~)[]-*/=<>\"\\:;|{}";
 
diff --git a/main.c b/main.c
index f396128a..e74330dc 100644
--- a/main.c
+++ b/main.c
@@ -42,12 +42,6 @@
 #endif
 #endif
 
-#ifdef __RZTC__
-#include <signal.h>
-#define SIGQUIT SIGTERM
-#include <controlc.h>
-#endif
-
 #ifndef TIOCSTI
 #include <setjmp.h>
 jmp_buf iblk_buf;
@@ -92,9 +86,6 @@ void logo_stop()
         if (!stop_quietly_flag)
             err_logo(STOP_ERROR,NIL);
         stop_quietly_flag = 0;
-#ifdef __RZTC__
-	if (!input_blocking)
-#endif
 	  signal(SIGINT, logo_stop);
 	unblock_input();
     }
@@ -116,9 +107,7 @@ void logo_pause()
 #ifdef HAVE_SIGSETMASK
 	sigsetmask(0);
 #else
-#if !defined(_MSC_VER)
 	signal(SIGQUIT, logo_pause);
-#endif
 #endif
 	lpause(NIL);
     }
@@ -204,12 +193,6 @@ void delayed_int() {
 #endif
 }
 
-#if defined(__RZTC__) && !defined(WIN32) /* sowings */
-void _far _cdecl do_ctrl_c(void) {
-    ctrl_c_count++;
-}
-#endif
-
 #ifdef HAVE_WX
 extern char * wx_get_original_dir_name(void);
 extern char * wx_get_current_dir_name(void);
@@ -225,12 +208,6 @@ int main(int argc, char *argv[]) {
     int argc2;
     char **argv2;
 
-#ifdef SYMANTEC_C
-    extern void (*openproc)(void);
-    extern void __open_std(void);
-    openproc = &__open_std;
-#endif
-
     bottom_stack = &exec_list; /*GC*/
 
 #ifndef HAVE_WX
@@ -244,16 +221,7 @@ int main(int argc, char *argv[]) {
 
     math_init();
 
-#ifdef ibm
-    signal(SIGINT, SIG_IGN);
-#if defined(__RZTC__) && !defined(WIN32) /* sowings */
-    _controlc_handler = do_ctrl_c;
-    controlc_open();
-#endif
-#else /* !ibm */
     signal(SIGINT, logo_stop);
-#endif /* ibm */
-    /* SIGQUITs never happen on the IBM */
 
     if (argc < 2) {
 #ifndef WIN32
@@ -324,20 +292,11 @@ int main(int argc, char *argv[]) {
 	if (NOT_THROWING) {
 	    check_reserve_tank();
 	    current_line = reader(stdin,"? ");
-#ifdef __RZTC__
-		(void)feof(stdin);
-		if (!in_graphics_mode)
-		    printf(" \b");
-		fflush(stdout);
-#endif
 
 #ifndef WIN32
 	    if (feof(stdin) && !isatty(0)) lbye(NIL);
 #endif
 
-#ifdef __RZTC__
-	    if (feof(stdin)) clearerr(stdin);
-#endif
 	    if (NOT_THROWING) {
 		exec_list = parser(current_line, TRUE);
 		if (exec_list != NIL) eval_driver(exec_list);
diff --git a/makefile.msys b/makefile.msys
index 989521c1..9b04882e 100644
--- a/makefile.msys
+++ b/makefile.msys
@@ -66,6 +66,8 @@ makehelp:	makehelp.c
 clean:
 	rm -f *.o libloc.c
 	rm -Rf UCBLogo/
+	rm -f logo.exe
+	rm -f *.i *.ii *.s
 
 ship:
 	rm -f config.h config.cache config.log config.status
diff --git a/math.c b/math.c
index 724e01c9..660ac5f6 100644
--- a/math.c
+++ b/math.c
@@ -166,12 +166,7 @@ int matherr(struct exception *x) {
 
 FLONUM degrad = 3.141592653589793227020265931059839203954/180.0;
 
-#if defined(ibm)
-#define errchk(x) {errno = 0; x; if (errno) err_logo(BAD_DATA_UNREC,arg);}
-#include <errno.h>
-#else
 #define errchk(x) x
-#endif
 
 NODE *binary(NODE *args, char fcn) {
     NODE *arg, *val;
diff --git a/mem.c b/mem.c
index b606ab0f..6eed8bf2 100644
--- a/mem.c
+++ b/mem.c
@@ -28,32 +28,14 @@
 #include "globals.h"
 extern NODE *stack, *numstack, *expresn, *val, *parm, *catch_tag, *arg;
 
-/* #ifdef ibm */
-/* #ifndef __RZTC__ */
-/* #include <alloc.h> */
-/* #endif */
-/* #endif */
-
 #ifdef PUNY
 #define GCMAX 1000
 #else
-#ifdef THINK_C
-#define GCMAX 8000
-#else
-#ifdef __RZTC__
-#define GCMAX 3000
-#else
 #define GCMAX 16000
 
-#endif
-#endif
 #endif
 
-#ifdef THINK_C
-extern NODE *gcstack[];
-#else
 NODE *gcstack[GCMAX];
-#endif
 
 NODE **mark_gcstack = gcstack;
 NODE **gctop = gcstack;
@@ -145,9 +127,6 @@ BOOLEAN addseg(void) {
   	return 0;
 }
 
-#ifdef THINK_C
-#pragma options(!global_optimizer)
-#endif
 #ifdef WIN32
 #pragma optimize("",off)
 #endif
@@ -182,9 +161,6 @@ BOOLEAN valid_pointer (volatile NODE *ptr_val) {
     return 0;
 }
 
-#ifdef THINK_C
-#pragma options(global_optimizer)
-#endif
 #ifdef WIN32
 /* #pragma optimize("",on) */
 #endif
@@ -259,9 +235,6 @@ void setcdr(NODE *nd, NODE *newcdr) {
     check_valid_oldyoung(nd, newcdr);
 }
 
-#ifdef THINK_C
-#pragma options(honor_register)
-#endif
 #ifdef WIN32
 #pragma optimize("",off)
 #endif
@@ -311,9 +284,6 @@ NODE *newnode(NODETYPES type) {
     } else return &phony;
 }
 
-#ifdef THINK_C
-#pragma options(!honor_register)
-#endif
 #ifdef WIN32
 /* #pragma optimize("",on) */
 #endif
@@ -653,7 +623,7 @@ void gc(BOOLEAN no_error) {
 
     if (top_stack < bottom_stack) { /* check direction stack grows */
 	for (tmp_ptr = top_stack; tmp_ptr <= bottom_stack; 
-#if defined(THINK_C) || defined(__RZTC__) || defined(GC_TWOBYTE)
+#if defined(GC_TWOBYTE)
 	     tmp_ptr = (NODE **)(((unsigned long int)tmp_ptr)+2)
 #else
 	     tmp_ptr++
@@ -665,7 +635,7 @@ void gc(BOOLEAN no_error) {
 	}
     } else {
 	for (tmp_ptr = top_stack; tmp_ptr >= bottom_stack; 
-#if defined(THINK_C) || defined(__RZTC__) || defined(GC_TWOBYTE)
+#if defined(GC_TWOBYTE)
 	     tmp_ptr = (NODE **)(((unsigned long int)tmp_ptr)-2)
 #else
 	     tmp_ptr--
@@ -861,9 +831,6 @@ void gc(BOOLEAN no_error) {
 	    if (free_list == NIL)
 		err_logo(OUT_OF_MEM_UNREC, NIL);
 	}
-#ifdef __RZTC__
-	(void)addseg();
-#endif
     }
 
 #ifdef GC_DEBUG
diff --git a/parse.c b/parse.c
index eddfa2b4..91f21717 100644
--- a/parse.c
+++ b/parse.c
@@ -52,17 +52,7 @@
 
 #include <ctype.h>
 
-#ifdef ibm
-#ifndef _MSC_VER
-#include <bios.h>
-extern int getch(void);
-#endif /* _MSC_VER */
-#endif
-#ifdef __RZTC__
-#include <disp.h>
-#endif
-
-# ifdef HAVE_WX
+#ifdef HAVE_WX
 #ifdef getc
 #undef getc
 #endif
@@ -93,40 +83,9 @@ int rd_getc(FILE *strm) {
 #endif
 
 #ifndef WIN32 /* skip this section ... */
-#ifdef __RZTC__
-    if (strm == stdin) zflush();
-    c = ztc_getc(strm);
-#else
     c = getc(strm);
-#endif
     if (strm == stdin && c != EOF) update_coords(c);
     if (c == '\r') return rd_getc(strm);
-#ifdef ibm
-    if (c == 17 && interactive && strm==stdin) { /* control-q */
-	to_pending = 0;
-	err_logo(STOP_ERROR,NIL);
-	if (input_blocking) {
-#ifdef SIG_TAKES_ARG
-	    logo_stop(0);
-#else
-	    logo_stop();
-#endif
-	}
-    }
-    if (c == 23 && interactive && strm==stdin) { /* control-w */
-#ifndef __RZTC__
-	getc(strm); /* eat up the return */
-#endif
-
-#ifdef SIG_TAKES_ARG
-	logo_pause(0);
-#else
-	logo_pause();
-#endif
-
-	return(rd_getc(strm));
-    }
-#endif
 #else /* WIN32 */
     if (strm == stdin) {
 	if (winPasteText && !line_avail) winDoPaste();
@@ -171,36 +130,15 @@ int rd_getc(FILE *strm) {
 }
 
 void rd_print_prompt(char *str) {
-#ifdef ibm
-#if defined(__RZTC__) || defined(WIN32)
-    if (in_graphics_mode && !in_splitscreen)
-#else
-#ifndef _MSC_VER
-    if (in_graphics_mode && ibm_screen_top == 0)
-#endif /* _MSC_VER */
-#endif
-	lsplitscreen(NIL);
-#endif
-	
 #ifdef HAVE_WX
 	if(in_graphics_mode && !in_splitscreen)
 		lsplitscreen(NIL);
 #endif
 
     ndprintf(stdout,"%t",str);
-#if defined(__RZTC__) && !defined(WIN32) /* sowings */
-    zflush();
-#endif
 }
 
-#if defined(__RZTC__) && !defined(WIN32) /* sowings */
-void zrd_print_prompt(char *str) {
-    newline_bugfix();
-    rd_print_prompt(str);
-}
-#else
 #define zrd_print_prompt rd_print_prompt
-#endif
 
 #define into_line(chr) {if (phys_line >= p_end) { \
 				p_len += MAX_PHYS_LINE; \
@@ -363,10 +301,6 @@ charmode_off();
 #endif
     *phys_line = '\0';
     input_blocking = 0;
-#if defined(__RZTC__) && !defined(WIN32) /* sowings */
-    fix_cursor();
-    if (interactive && strm == stdin) newline_bugfix();
-#endif
     if (dribbling)
 	rd_putc('\n', dribblestream);
     if (c == EOF && strm == stdin) {
diff --git a/print.c b/print.c
index d2a804d5..7a550da8 100644
--- a/print.c
+++ b/print.c
@@ -34,12 +34,6 @@ void real_print_node(FILE *, NODE *, int, int);
 void update_coords(char ch) {
     int i;
 
-#ifdef ibm
-#if !defined(__RZTC__) && !defined(_MSC_VER) && !defined(WIN32)
-    check_scroll();
-#endif
-#endif
-	
 #ifdef HAVE_WX
 	int getTermInfo(int type);
 #if 0
@@ -100,27 +94,7 @@ void update_coords(char ch) {
 void print_char(FILE *strm, char ch) {
     if (strm != NULL) {
 	if (interactive && strm==stdout) {
-#ifdef ibm
-	    if (ch == '\1')
-		ibm_bold_mode();
-	    if (ch == '\2')
-		ibm_plain_mode();
-#if defined(__RZTC__) && !defined(WIN32) /* sowings */
-	    ztc_put_char(ch);
-#elif defined(TURBO_C)
-	    if (in_graphics_mode && ibm_screen_top == 0)
-		lsplitscreen();
-	    if (ch == '\n' || in_graphics_mode)
-		rd_putc(ch, strm);
-	    else if (ch != '\1' && ch != '\2')
-		rd_putc(ch, stdout); /* takes advantage of bold attribute */
-#else /* WIN32 */
-	    if (ch != '\1' && ch != '\2')
-	      rd_putc(ch, strm);
-#endif /* ibm */
-#else /* Unix */
-	    rd_putc(ch, strm);
-#endif
+    rd_putc(ch, strm);
 	} else	    /* printing to stream but not screen */
 	    rd_putc(ch, strm);
 	if (strm == stdout) {
diff --git a/term.c b/term.c
index 67bdce00..fbd3dc03 100644
--- a/term.c
+++ b/term.c
@@ -123,11 +123,6 @@ void term_init(void) {
     interactive = isatty(0);
 #endif
 
-#ifdef ibm
-#ifndef WIN32
-    term_init_ibm();
-#endif /* WIN32 */
-#else
     if (interactive) {
 #ifdef HAVE_TERMIO_H
 	ioctl(0,TCGETA,(char *)(&tty_cooked));
@@ -184,8 +179,6 @@ void term_init(void) {
     /* if we still don't know our size, set some defaults */
     if (x_max <= 0) x_max = 80;
     if (y_max <= 0) y_max = 24;
-
-#endif
 }
 
 void charmode_on() {
@@ -221,17 +214,8 @@ void charmode_off() {
 }
 
 NODE *lcleartext(NODE *args) {
-#ifdef ibm
-#ifndef WIN32 /* sowings */
-    ibm_clear_text();
-    ibm_gotoxy(x_margin, y_margin);
-#else /* WIN32 */
-    win32_clear_text();
-#endif /* WIN32 || !Win32 */
-#else /* !ibm */
     printf("%s", cl_arr);
     printf("%s", tgoto(cm_arr, x_margin, y_margin));
-#endif /* ibm */
 
 #ifdef WIN32
 	win32_update_text();
@@ -239,9 +223,6 @@ NODE *lcleartext(NODE *args) {
 	fflush(stdout); /* do it now! */
 #endif
 	fix_turtle_shownness();
-#if defined(__RZTC__)
-	zflush();
-#endif
 
     x_coord = x_margin;
     y_coord = y_margin;
@@ -252,9 +233,6 @@ NODE *lcursor(NODE *args) {
 
     // Flush buffer so it doesn't impact cursor position.
     fflush(stdout);
-#ifdef __RZTC__
-    zflush();
-#endif
 
     return(cons(make_intnode((FIXNUM)(x_coord-x_margin)),
 		cons(make_intnode((FIXNUM)(y_coord-y_margin)), NIL)));
@@ -281,15 +259,8 @@ NODE *lsetcursor(NODE *args) {
 	}
     }
     if (NOT_THROWING) {
-#ifdef ibm
-	ibm_gotoxy(x_coord, y_coord);
-#else
 	printf("%s", tgoto(cm_arr, x_coord, y_coord));
-#endif
 	fflush(stdout);
-#ifdef __RZTC__
-	zflush();
-#endif
     }
     return(UNBOUND);
 #endif /* !win32 (for non-windows version of this code) */
diff --git a/winbuild.sh b/winbuild.sh
new file mode 100644
index 00000000..75db6a64
--- /dev/null
+++ b/winbuild.sh
@@ -0,0 +1,13 @@
+#/bin/bash -v
+
+export PATH=/mingw32/bin:$PATH
+export MINGW_BIN_DIR=/mingw32/bin
+export WX_DIR=/home/User/wxWidgets-3.2.2.1
+
+# dangerous; stash changes first
+#git clean -x -d -f .
+
+mingw32-make -f makefile.msys clean
+mingw32-make -f makefile.msys git.c
+rm libloc.c
+mingw32-make -f makefile.msys MINGW_BIN_DIR=$MINGW_BIN_DIR WX_DIR=$WX_DIR install_win
\ No newline at end of file
diff --git a/wrksp.c b/wrksp.c
index ca5b65ae..b4dc688b 100644
--- a/wrksp.c
+++ b/wrksp.c
@@ -42,10 +42,6 @@ long wxLaunchExternalEditor(char *, char *);
 #include <unistd.h>
 #endif
 
-#ifdef ibm
-#include "process.h"
-#endif
-
 #ifdef HAVE_TERMIO_H
 #ifdef HAVE_WX
 #include <termios.h>
@@ -1597,9 +1593,6 @@ NODE *ledit(NODE *args) {
     extern int getpid();
 #endif
 #endif
-#ifdef __RZTC__
-    BOOLEAN was_graphics;
-#endif
 #ifdef HAVE_WX
     BOOLEAN use_internal_editor = (editor == NULL || strlen(editor) < 1);
 #endif
@@ -1653,31 +1646,11 @@ NODE *ledit(NODE *args) {
         }
     }
 #else
-#ifdef ibm
-#ifdef __RZTC__
-    was_graphics = in_graphics_mode;
-    if (in_graphics_mode) t_screen();
-    zflush();
-#endif	/* ztc */
-    if (spawnlp(P_WAIT, editor, editorname, tmp_filename, NULL)) {
-	err_logo(FILE_ERROR, make_static_strnode
-		 ("Could not launch the editor"));
-	return(UNBOUND);
-    }
-#ifdef __RZTC__
-    if (was_graphics) s_screen();
-    else lcleartext(NIL);
-#endif	/* ztc */
-#ifdef WIN32
-    win32_repaint_screen();
-#endif
-#else	/* !ibm (so unix) */
     if (fork() == 0) {
 	execlp(editor, editorname, tmp_filename, 0);
 	exit(1);
     }
     wait(0);
-#endif	/* ibm */
 #endif /* wx */
     holdstrm = loadstream;
     tmp_line = current_line;
@@ -1888,9 +1861,6 @@ NODE *lhelp(NODE *args) {
 #endif
     FILE *fp;
     int lines;
-#ifdef __RZTC__
-    size_t len;
-#endif
 
     if (args == NIL) {
 /*
@@ -1924,16 +1894,6 @@ NODE *lhelp(NODE *args) {
 		fixhelp(getstrptr(arg), getstrlen(arg)));
 			//printf("Buffer: %s\n", buffer);
 
-#ifdef __RZTC__    /* defined(ibm) || defined(WIN32) */
-	if (strlen(buffer) > (len = strlen(addsep(helpfiles))+8)) {
-	    buffer[len+5] = '\0';
-	    buffer[len+4] = buffer[len+3];
-	    buffer[len+3] = buffer[len+2];
-	    buffer[len+2] = buffer[len+1];
-	    buffer[len+1] = buffer[len];
-	    buffer[len] = '.';
-	}
-#endif
     } else {
         err_logo(BAD_DATA_UNREC, car(args));
 	return UNBOUND;
@@ -1967,15 +1927,10 @@ NODE *lhelp(NODE *args) {
 #ifndef TIOCSTI
 		if (!setjmp(iblk_buf))
 #endif
-#ifdef __RZTC__
-		    ztc_getcr();
-		    print_char(stdout, '\n');
-#else
 #ifdef WIN32
 		    (void)reader(stdin, "");
 #else
 		    fgets(junk, 19, stdin);
-#endif
 #endif
 		input_blocking = 0;
 		update_coords('\n');
diff --git a/ztcterm.c b/ztcterm.c
deleted file mode 100644
index 0dcf0d3e..00000000
--- a/ztcterm.c
+++ /dev/null
@@ -1,715 +0,0 @@
-/*
- *      ztcterm.c           IBM screen module             mak
- *
- *	Copyright (C) 1993 by the Regents of the University of California
- *
- *      This program is free software: you can redistribute it and/or modify
- *      it under the terms of the GNU General Public License as published by
- *      the Free Software Foundation, either version 3 of the License, or
- *      (at your option) any later version.
- *
- *      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.
- *
- *      You should have received a copy of the GNU General Public License
- *      along with this program.  If not, see <https://www.gnu.org/licenses/>.
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "logo.h"
-#include "globals.h"
-#include <math.h>
-#include <bios.h>
-#include <fg.h>
-#include <conio.h>
-#include <disp.h>
-#include <sound.h>
-#include <io.h>
-#include <msmouse.h>
-#include "ztcterm.h"
-
-char *LogoPlatformName="DOS";
-
-/************************************************************/
-
-unsigned _stack = 8000; /* 5000 for debugging, 65000 for real */
-
-BOOLEAN in_graphics_mode = FALSE, in_splitscreen = FALSE;
-BOOLEAN have_been_in_graphics_mode = FALSE, can_do_color = FALSE;
-BOOLEAN in_erase_mode = FALSE;
-
-/* NOTE NOTE NOTE:  graphics.c really really believes that the top left
- * corner of the screen has hardware coords (0,0).  Zortech has (0,0)
- * in the BOTTOM left.  It's hopeless to fix graphics.c so instead we
- * use the following kludge: go ahead and think the screen is upside down,
- * and switch to Zortech coords only in draw_line! */
-
-int ibm_screen_bottom;
-int current_write_mode = FG_MODE_SET;
-int current_vis = 0;
-fg_color_t turtle_color, bg_color;
-fg_color_t dull, bright;
-fg_coord_t texth;
-fg_coord_t MaxX, MaxY;
-int ztc_penwidth = 1, ztc_linepattern = -1;
-fg_box_t ztc_box, ztc_textbox, text_scroll_box, text_last_line_box, clear_box;
-void rgb_init(void);
-int scrunching = FALSE;
-
-fg_line_t the_line;
-fg_coord_t ztc_x, ztc_y;
-fg_color_t ztc_textcolor;
-fg_color_t ztc_text_bgcolor = 0;
-fg_coord_t ztc_graph_textx, ztc_graph_texty;
-FIXNUM pen_color = 0, back_ground = 7;
-
-void moveto(int x, int y) {
-    ztc_x = (fg_coord_t)x;
-    ztc_y = (fg_coord_t)y;
-}
-
-void lineto(int x, int y) {
-    msm_hidecursor();
-    fg_make_line(the_line, ztc_x, MaxY-ztc_y,
-    		 (fg_coord_t)x, MaxY-(fg_coord_t)y);
-    fg_drawthickline((in_erase_mode ? bg_color : turtle_color),
-		   current_write_mode, ~0, FG_LINE_SOLID, the_line, ztc_box,
-		   ztc_penwidth);
-    moveto(x, y);
-    msm_showcursor();
-}
-
-void outtext(char *s) {
-    msm_hidecursor();
-    fg_puts((in_erase_mode ? bg_color : turtle_color),
-    	    current_write_mode, ~0, FG_ROT0, ztc_x, MaxY-ztc_y,
-    	    s, fg.displaybox);
-    msm_showcursor();
-}
-
-void gr_mode(void) {
-    int errorcode;
-
-    if (!in_graphics_mode) {
-	msm_hidecursor();
-	x_coord = x_margin;
-	y_coord = y_margin;
-	errorcode = fg_init();
-	if (have_been_in_graphics_mode) {
-	    in_graphics_mode = TRUE;
-	    if (turtle_shown && !refresh_p) draw_turtle();
-	    redraw_graphics();
-	}
-	else {
-	    if (errorcode == 0)
-		err_logo(BAD_GRAPH_INIT, NIL);
-	    else {
-		in_graphics_mode = have_been_in_graphics_mode = TRUE;
-		if (can_do_color = (fg.nsimulcolor > 16 /* != fg.ncolormap */ )) {
-			rgb_init();
-			dull = fg.nsimulcolor-1;
-			bright = 7;
-		} else {
-			turtle_color = FG_HIGHLIGHT;
-			dull = FG_WHITE;
-			bright = FG_HIGHLIGHT;
-		}
-		bg_color = FG_BLACK;
-		ztc_set_penc(7);
-		if (ztc_textcolor == FG_WHITE) ztc_textcolor = dull;
-		back_ground = 0;
-		ztc_box[FG_X1] = ztc_textbox[FG_X1]
-			       = text_scroll_box[FG_X1]
-			       = text_last_line_box[FG_X1]
-			       = clear_box[FG_X1]
-			       = fg.displaybox[FG_X1];
-		ztc_textbox[FG_Y1] = fg.displaybox[FG_Y1];
-		ztc_box[FG_X2] = ztc_textbox[FG_X2]
-			       = text_scroll_box[FG_X2]
-			       = text_last_line_box[FG_X2]
-			       = clear_box[FG_X2]
-			       = MaxX = fg.displaybox[FG_X2];
-		ztc_box[FG_Y2] = MaxY
-			       = clear_box[FG_Y2]
-			       = fg.displaybox[FG_Y2];
-		y_scale = (double)fg.pixelx/(double)fg.pixely;
-		{
-		    FILE *fp = fopen("scrunch.dat","r");
-		    if (fp != NULL) {
-		    	scrunching = TRUE;
-			if (filelength(fileno(fp)) > 0) {
-			    fread(&x_scale, sizeof(FLONUM), 1, fp);
-			    fread(&y_scale, sizeof(FLONUM), 1, fp);
-			}
-			fclose(fp);
-		    }
-		}
-		if (MaxY == 479)
-		    texth = 16;
-		else
-		    texth = (MaxY+1)/25;
-		ztc_box[FG_Y1] = 4*texth+1;
-		clear_box[FG_Y1] = 4*texth;
-		ibm_screen_bottom = MaxY - (ztc_box[FG_Y1]);
-		ztc_textbox[FG_Y2] = 4*texth-1;
-		text_scroll_box[FG_Y2] = 3*texth-1;
-		text_scroll_box[FG_Y1] = 0;
-		text_last_line_box[FG_Y2] = texth-1;
-		lclearscreen(NIL);
-		lcleartext(NIL);
-		in_splitscreen = TRUE;
-	   }
-	}
-	msm_showcursor();
-    }
-}
-
-void nop() {
-}
-
-void init_ibm_memory(void) {
-}
-
-volatile int ctrl_c_count = 0;
-
-BOOLEAN check_ibm_stop(void) {
-    int key;
-    int __ss *p;
-
-/*    if (kbhit())
-	getch(); */   /* allow DOS to test for control-C */
-
-    p = &key;
-    if ((int)p < 500) {
-	err_logo(STACK_OVERFLOW, NIL);
-	return(1);
-    }
-
-    if (((key = bioskey(1)) == (4113)) || ctrl_c_count > 0) { /* control-q */
-	if (ctrl_c_count == 0) getch();
-	ctrl_c_count = 0;
-	err_logo(STOP_ERROR,NIL);
-	return(1);
-    }
-    if (key == (4375)) { /* control-w */
-	getch();
-	to_pending = 0;
-	lpause(NIL);
-    }
-    return (0);
-}
-
-void term_init_ibm(void) {
-    disp_open();
-    msm_init();
-    msm_setareay(0,(disp_numrows-1)*8);
-    msm_showcursor();
-    ztc_textcolor = FG_WHITE;
-    tty_charmode = 0;
-    x_max = 80;
-    y_max = 25;
-    x_coord = y_coord = 0;
-    so_arr[0] = '\1'; so_arr[1] = '\0';
-    se_arr[0] = '\2'; se_arr[1] = '\0';
-}
-
-void ibm_gotoxy(int x, int y) {
-    if (in_graphics_mode) {
-	if (!in_splitscreen)
-	    lsplitscreen(NIL);
-	if (y >= 4) y = 3;
-	ztc_graph_texty = texth*(3-y);
-	fg_adjustxy(FG_ROT0, x, &ztc_graph_textx,
-		    &ztc_graph_texty, fg.charbox);
-    } else {
-        disp_move(y, x);
-	msm_hidecursor();
-    	disp_flush();
-	msm_showcursor();
-    }
-}
-
-fg_color_t color_table[8] = {0, 9, 10, 11, 12, 13, 14, 15};
-
-FIXNUM hw_color(FIXNUM c) {
-    if (can_do_color) return c;
-    if (c >= 0 && c < 8) return color_table[c];
-    if (c < 0) return c;
-    return c-8;
-}
-
-void ibm_clear_text(void) {
-    if (in_graphics_mode) {
-	if (in_splitscreen)
-	    erase_graphics_top();
-    } else {
-	disp_move(0,0);
-	disp_eeop();
-	msm_hidecursor();
-	disp_flush();
-	msm_showcursor();
-    }
-}
-
-void ibm_clear_screen(void)
-{
-    msm_hidecursor();
-    fg_fillbox(bg_color, FG_MODE_SET, ~0, clear_box);
-    msm_showcursor();
-}
-
-void ibm_plain_mode(void) {
-    if (in_graphics_mode)
-	ztc_textcolor = dull;
-    else
-	disp_endstand();
-}
-
-void ibm_bold_mode(void) {
-    if (in_graphics_mode)
-	ztc_textcolor = bright;
-    else
-	disp_startstand();
-}
-
-NODE *set_text_color(NODE *args) {
-    int fore, back;
-
-    fore = getint(pos_int_arg(args));
-    if (NOT_THROWING) {
-        back = getint(pos_int_arg(cdr(args)));
-        if (NOT_THROWING) {
-	    ztc_textcolor = hw_color(fore);
-	    ztc_text_bgcolor = hw_color(back);
-	    disp_setattr((back&07)<<4 | (fore&07));
-        }
-    }
-    return UNBOUND;
-}
-
-void erase_graphics_top(void) {
-    msm_hidecursor();
-    fg_fillbox(FG_BLACK, FG_MODE_SET, ~0, ztc_textbox);
-    msm_showcursor();
-    ztc_graph_textx = 0;
-    ztc_graph_texty = 3*texth;
-}
-
-/************************************************************/
-/* These are the machine-specific graphics definitions.  All versions must
-   provide a set of functions analogous to these. */
-
-void save_pen(pen_info *p) {
-    p->h = ztc_x;
-    p->v = ztc_y;
-    p->vis = current_vis;
-    p->width = ztc_penwidth;
-    p->color = turtle_color;
-    get_pen_pattern(p->pattern);
-    p->mode = get_ibm_pen_mode();
-}
-
-void restore_pen(pen_info *p) {
-    moveto(p->h, p->v);
-    current_vis = p->vis;
-    ztc_penwidth = p->width;
-    set_ibm_pen_mode(p->mode);  /* must restore mode before color */
-    turtle_color = p->color;
-    set_pen_pattern(p->pattern);
-}
-
-struct rgbcolor { int red, green, blue; } the_palette[256] = { 
-	{0,0,0}, {0,0,0},    /* entries -2 and -1 */
-	{0, 0, 0}, {0, 0, 255}, {0, 255, 0}, {0, 255, 255},
-	{255, 0, 0}, {255, 0, 255}, {255, 255, 0}, {255, 255, 255},
-	{155, 96, 59}, {197, 136, 18}, {100, 162, 64}, {120, 187, 187},
-	{255, 149, 119}, {144, 113, 208}, {255, 163, 0}, {183, 183, 183}};
-
-void rgb_init(void) {
-	int i,j;
-
-	for (i=0; i<16; i++) {
-		fg_setpalette(i+2, the_palette[i+2].red,
-					the_palette[i+2].green,
-					the_palette[i+2].blue);
-		for (j=i+16; j<fg.nsimulcolor; j += 16) {
-			the_palette[j+2] = the_palette[i+2];
-			fg_setpalette(j+2, the_palette[i+2].red,
-					the_palette[i+2].green,
-					the_palette[i+2].blue);
-		}
-	}
-}
-
-void plain_xor_pen(void) {
-    ztc_penwidth = 1;
-    turtle_color = hw_color(pen_color)^bg_color;
-    current_write_mode = FG_MODE_XOR;
-    in_erase_mode = FALSE;
-}
-
-void ztc_set_penc(FIXNUM c) {
-    draw_turtle();
-    pen_color = c;
-    turtle_color = hw_color(c) % fg.nsimulcolor;
-    if (current_write_mode == FG_MODE_XOR)
-	turtle_color = hw_color(pen_color)^bg_color;
-    msm_hidecursor();
-    draw_turtle();
-    msm_showcursor();
-}
-
-void ztc_set_bg(FIXNUM c) {
-    back_ground = c;
-    bg_color = hw_color(c);
-    msm_hidecursor();
-    if (!refresh_p) ibm_clear_screen();
-    if (turtle_shown && !refresh_p) draw_turtle();
-    redraw_graphics();
-    msm_showcursor();
-}
-
-void set_palette(int slot, unsigned int r, unsigned int g, unsigned int b) {
-	slot+=2;
-	if (slot >= 255) return;
-	the_palette[slot].red = (r+128)/256;
-	the_palette[slot].green = (g+128)/256;
-	the_palette[slot].blue = (b+128)/256;
-	fg_setpalette(slot-1, the_palette[slot].red, the_palette[slot].green,
-					the_palette[slot].blue);
-}
-
-void get_palette(int slot, unsigned int *r, unsigned int *g, unsigned int *b) {
-	slot+=2;
-	*r = the_palette[slot % 256].red * 256;
-	*g = the_palette[slot % 256].green * 256;
-	*b = the_palette[slot % 256].blue * 256;
-}
-
-void ibm_pen_down(void) {
-    current_write_mode = FG_MODE_SET;
-    turtle_color = hw_color(pen_color);
-    in_erase_mode = FALSE;
-}
-
-void ibm_pen_xor(void) {
-    current_write_mode = FG_MODE_XOR;
-    turtle_color = hw_color(pen_color)^bg_color;
-    in_erase_mode = FALSE;
-}
-
-void ibm_pen_erase(void) {
-    if (!in_erase_mode) {
-	current_write_mode = FG_MODE_SET;
-	turtle_color = hw_color(pen_color);
-	in_erase_mode = TRUE;
-    }
-}
-
-int get_ibm_pen_mode(void) {
-    if (in_erase_mode)
-	return 2;
-    else
-	return current_write_mode;
-}
-
-void set_ibm_pen_mode(int m) {
-    switch (m) {
-	case 2: ibm_pen_erase(); break;
-	case FG_MODE_SET: ibm_pen_down(); break;
-	case FG_MODE_XOR: ibm_pen_xor(); break;
-    }
-}
-
-int get_ibm_pen_width(void) {
-    return ztc_penwidth;
-}
-
-void set_pen_pattern(char *pat) {
-    ztc_linepattern = *(int *)pat;
-}
-
-void set_list_pen_pattern(NODE *arg) {
-    NODE *temp;
-
-    temp = cnv_node_to_numnode(car(arg));
-    ztc_linepattern = getint(temp);
-}
-
-void get_pen_pattern(char *pat) {
-    *(int *)pat = ztc_linepattern;
-}
-
-NODE *Get_node_pen_pattern(void) {
-    return(cons(make_intnode(0-1L), NIL));
-}
-
-void label(char *s) {
-    gr_mode();
-    moveto(g_round(screen_x_coord), g_round(screen_y_coord));
-    outtext(s);
-}
-
-void logofill(void) {
-    msm_hidecursor();
-    fg_fill(ztc_x, MaxY-ztc_y, turtle_color, turtle_color);
-    msm_showcursor();
-}
-
-void erase_screen(void) {
-    ibm_clear_screen();
-}
-
-void t_screen(void) {
-    if (in_graphics_mode) {
-	fg_term();
-	in_graphics_mode = FALSE;
-	in_splitscreen = FALSE;
-	y_max = 25;
-    }
-}
-
-void s_screen(void) {
-    int save_vis;
-
-    if (in_graphics_mode && !in_splitscreen) {
-	if (turtle_shown && (screen_y_coord > (MaxY - (4*texth+1)))) {
-	    save_vis = current_vis;
-	    current_vis = -1;
-	    lhome(NIL);
-	    current_vis = save_vis;
-	}
-	erase_graphics_top();
-    }
-    if (!have_been_in_graphics_mode) gr_mode();
-    in_splitscreen = TRUE;
-    ztc_box[FG_Y1] = 4*texth+1;
-    clear_box[FG_Y1] = 4*texth;
-    ibm_screen_bottom = MaxY - (ztc_box[FG_Y1]);
-    y_max = 4;
-    gr_mode();
-}
-
-void f_screen(void) {
-    if (in_graphics_mode && in_splitscreen)
-	erase_graphics_top();
-    in_splitscreen = FALSE;
-    ztc_box[FG_Y1] = clear_box[FG_Y1] = 0;
-    ibm_screen_bottom = MaxY;
-    gr_mode();
-}
-
-FIXNUM mickey_x(void) {
-    int x,y;
-
-    (void)msm_getstatus(&x,&y);
-    return x-screen_x_center;
-}
-
-#define screen_x_coord ((screen_x_center) + turtle_x)
-#define screen_y_coord ((screen_y_center) - turtle_y)
-
-FIXNUM mickey_y(void) {
-    int x,y;
-
-    (void)msm_getstatus(&x,&y);
-    return screen_y_center-y;
-}
-
-BOOLEAN Button(void) {
-    int x,y,b;
-
-    b = msm_getstatus(&x,&y);
-    if (b&1) return 1;
-    if (b&2) return 2;
-    if (b&4) return 3;
-    return 0;
-}
-
-void tone(FIXNUM pitch, FIXNUM duration) {
-    FIXNUM period = 2400000L/pitch;		/* 200000 */
-    FIXNUM cycles = duration * pitch/60;
-    if (cycles > 0)
-        sound_tone((int)cycles, (int)period, (int)period);
-}
-
-FIXNUM t_height(void) {
-    return 18;
-}
-
-FLONUM t_half_bottom(void) {
-    return 6.0;
-}
-
-FLONUM t_side(void) {
-    return 19.0;
-}
-
-void check_scroll(void) {
-    msm_hidecursor();
-    fg_blit(text_scroll_box, 0, texth, fg.activepage, fg.activepage);
-    fg_fillbox(FG_BLACK, FG_MODE_SET, ~0, text_last_line_box);
-    msm_showcursor();
-}
-
-void ztc_put_char(int ch) {
-    fg_box_t temp_box;
-    
-    msm_hidecursor();
-    if (in_graphics_mode && !in_splitscreen)
-	lsplitscreen(NIL);
-    if (ch != '\1' && ch != '\2') {
-	if (in_graphics_mode) {
-	    if (ch == '\n') {
-		ztc_graph_textx = 0;
-		if (ztc_graph_texty - texth >= 0)
-		    ztc_graph_texty -= texth;
-		else check_scroll();
-	    } else if (ch == '\b') {
-		if (ztc_graph_textx > 0)
-		    fg_adjustxy(FG_ROT180, 1, &ztc_graph_textx,
-				&ztc_graph_texty, fg.charbox);
-	    } else if (ch == '\t') {
-		fg_adjustxy(FG_ROT0, 8 - (x_coord&07),
-			    &ztc_graph_textx,
-			    &ztc_graph_texty, fg.charbox);
-		if (ztc_graph_textx >= MaxX) print_char(stdout,'\n');
-	    } else {
-		if (ztc_text_bgcolor != 0) {
-		    temp_box[FG_X1] = temp_box[FG_X2] = ztc_graph_textx;
-		    temp_box[FG_Y1] = temp_box[FG_Y2] = ztc_graph_texty;
-		    fg_adjustxy(FG_ROT0, 2, &temp_box[FG_X2],
-		    	&temp_box[FG_Y2], fg.charbox);
-		    temp_box[FG_Y2] += texth-1;
-		    fg_fillbox(ztc_text_bgcolor, FG_MODE_SET, ~0, temp_box);
-		}
-		fg_putc(ztc_textcolor, FG_MODE_SET, ~0, FG_ROT0,
-			ztc_graph_textx, ztc_graph_texty,
-			ch, fg.displaybox);
-		fg_adjustxy(FG_ROT0, 1, &ztc_graph_textx,
-			    &ztc_graph_texty, fg.charbox);
-		if (ztc_graph_textx >= MaxX) print_char(stdout,'\n');
-	    }
-	} else
-    	    disp_putc(ch);
-    }
-    msm_showcursor();
-}
-
-BOOLEAN cursor_off = 0;
-
-void fix_cursor(void) {
-    if (!cursor_off && !in_graphics_mode) {
-	msm_hidecursor();
-    	disp_hidecursor();
-	msm_showcursor();
-	cursor_off++;
-    }
-}
-
-void zflush(void) {
-    msm_hidecursor();
-    if (in_graphics_mode)
-	fg_flush();
-    else {
-	disp_flush();
-	if (cursor_off) disp_showcursor();
-	cursor_off = 0;
-    }
-    msm_showcursor();
-}
-
-void newline_bugfix(void) {
-    msm_hidecursor();
-    if (!in_graphics_mode) {
-	if (disp_cursorrow+1 < disp_numrows)
-    	    new_line(stdout);
-	else
-	    disp_move(disp_numrows-1,0);
-	disp_flush();
-    }
-    msm_showcursor();
-    y_coord--;
-}
-
-char graph_line_buffer[200];
-char *graph_line_pointer = NULL;
-
-int ztc_getc(FILE *strm) {
-    int ch;
-    fg_color_t save_textcolor;
-
-    if (strm != stdin || !interactive || !in_graphics_mode)
-	return getc(strm);
-    if (graph_line_pointer != NULL) {
-	ch = *graph_line_pointer++;
-	if (ch == '\t') graph_line_pointer += 2;
-	if (ch != '\0') return ch;
-    }
-    graph_line_pointer = graph_line_buffer;
-    do {
-	msm_hidecursor();
-	fg_putc(dull, FG_MODE_XOR, ~0, FG_ROT0,
-		ztc_graph_textx, ztc_graph_texty,
-		'_', fg.displaybox);
-	msm_showcursor();
-	ch = getch();
-	msm_hidecursor();
-	fg_putc(dull, FG_MODE_XOR, ~0, FG_ROT0,
-		ztc_graph_textx, ztc_graph_texty,
-		'_', fg.displaybox);
-	if (ch == '\r' || ch == '\n') {
-	    ch = '\n';
-	    *graph_line_pointer++ = ch;
-	    print_char(stdout,'\n');
-	    *graph_line_pointer = '\0';
-	    graph_line_pointer = graph_line_buffer;
-	    msm_showcursor();
-	    return *graph_line_pointer++;
-	} else if (ch == '\t') {
-	    int i = 8 - (x_coord & 07);
-	    *graph_line_pointer++ = '\t';
-	    *graph_line_pointer++ = (char)i;
-	    *graph_line_pointer++ = '\t';
-	    print_char(stdout, '\t');
-	} else if (ch == 0177 || ch == '\b') {
-	    if (graph_line_pointer != graph_line_buffer) {
-		graph_line_pointer--;
-		if (*graph_line_pointer == '\t') {
-		    int i = (int)*--graph_line_pointer;
-		    --graph_line_pointer;
-		    while (i-- > 0) print_char(stdout, '\b');
-		} else {
-		    print_char(stdout, '\b');
-		    save_textcolor = ztc_textcolor;
-		    ztc_textcolor = ztc_text_bgcolor;
-		    print_char(stdout, *graph_line_pointer);
-		    ztc_textcolor = save_textcolor;
-		    print_char(stdout, '\b');
-		}
-	    }
-	} else if (ch == 17 || ch == 23) {
-	    print_char(stdout,'\n');
-	    graph_line_pointer = NULL;
-	    msm_showcursor();
-	    return ch;
-	} else {
-	    *graph_line_pointer++ = ch;
-	    print_char(stdout, ch);
-	}
-	msm_showcursor();
-    } while (ch != '\n');
-    graph_line_pointer = graph_line_buffer;
-    return *graph_line_pointer++;
-}
-
-void ztc_getcr(void) {
-    (void) ztc_getc(stdin);
-    graph_line_pointer = NULL;
-}
diff --git a/ztcterm.h b/ztcterm.h
deleted file mode 100644
index 335acdee..00000000
--- a/ztcterm.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- *      ztcterm.h          IBM-specific graphics macros         mak
- *
- *	Copyright (C) 1993 by the Regents of the University of California
- *
- *      This program is free software: you can redistribute it and/or modify
- *      it under the terms of the GNU General Public License as published by
- *      the Free Software Foundation, either version 3 of the License, or
- *      (at your option) any later version.
- *
- *      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.
- *
- *      You should have received a copy of the GNU General Public License
- *      along with this program.  If not, see <https://www.gnu.org/licenses/>.
- *
- */
-
-#define GR_SIZE 15000
-
-#define prepare_to_draw gr_mode()
-#define done_drawing nop()
-
-#define prepare_to_draw_turtle nop()
-#define done_drawing_turtle nop()
-
-#define screen_left 0
-#define screen_right (MaxX)
-#define screen_top 0
-#define screen_bottom (ibm_screen_bottom)
-#define max_screen_bottom (MaxY)
-
-#define screen_height (1 + screen_bottom - screen_top)
-#define max_screen_height (1 + max_screen_bottom - screen_top)
-#define screen_width (1 + screen_right - screen_left)
-
-#define screen_x_center (screen_left + (screen_width)/2)
-#define screen_y_center (screen_top + (max_screen_height)/2)
-
-#define turtle_left_max ((screen_left) - (screen_x_center))
-#define turtle_right_max ((screen_right) - (screen_x_center))
-#define turtle_top_max ((screen_y_center) - (screen_top))
-#define turtle_bottom_max ((screen_y_center) - (screen_bottom))
-
-#define screen_x_coord ((screen_x_center) + turtle_x)
-#define screen_y_coord ((screen_y_center) - turtle_y)
-
-#define turtle_height t_height()
-#define turtle_half_bottom t_half_bottom()
-#define turtle_side t_side()
-
-#define clear_screen erase_screen()
-
-#define line_to(x,y) {if (current_vis==0) lineto((int)x,(int)y); else moveto((int)x,(int)y);}
-#define move_to(x,y) moveto((int)x,(int)y)
-#define draw_string(s) outtext((char *)s)
-#define set_pen_vis(v) current_vis = v
-#define set_pen_mode(m) set_ibm_pen_mode(m)
-#define set_pen_color(c) {ztc_set_penc(c);}
-#define set_back_ground(c) {ztc_set_bg(c);}
-#define set_pen_width(w) {ztc_penwidth = w;}
-#define set_pen_height(h) {ztc_penwidth = h;}
-#define set_pen_x(x) moveto((int)x, ztc_y)
-#define set_pen_y(y) moveto(ztc_x, (int)y)
-
-/* pen_info is a stucture type with fields for the various
-   pen characteristics including the location, size, color,
-   mode (e.g. XOR or COPY), pattern, visibility (0 = visible) */
-
-typedef struct { int    h;
-		 int	v;
-		 int	vis;
-		 int	width;
-		 int    color;
-		 char	pattern[8];
-		 int	mode; } pen_info;
-
-#define p_info_x(p) p.h
-#define p_info_y(p) p.v
-
-#define pen_width ztc_penwidth
-#define pen_height ztc_penwidth
-#define pen_mode get_ibm_pen_mode()
-#define pen_vis current_vis
-#define pen_x ztc_x
-#define pen_y ztc_y
-#define get_node_pen_pattern Get_node_pen_pattern()
-
-#define pen_reverse ibm_pen_xor()
-#define pen_erase ibm_pen_erase()
-#define pen_down ibm_pen_down()
-
-#define button Button()
-#define mouse_x mickey_x()
-#define mouse_y mickey_y()
-
-#define full_screen f_screen()
-#define split_screen s_screen()
-#define text_screen t_screen()
-
-/* definitions from term.c and math.c for ibmterm.c */
-extern int x_coord, y_coord, x_max, y_max, tty_charmode;
-extern char so_arr[], se_arr[];
-
-/* definitions from ibmterm.c for graphics.c */
-extern void gr_mode();
-extern void ibm_pen_erase(), ibm_pen_down(), ibm_pen_xor();
-extern void set_ibm_pen_mode();
-extern int get_ibm_pen_mode();
-extern void save_pen(), restore_pen(), set_pen_pattern();
-extern void plain_xor_pen();
-extern void set_list_pen_pattern(), get_pen_pattern(), erase_screen();
-extern void label(), logofill();
-extern void t_screen(), s_screen(), f_screen(), tone();
-extern FIXNUM mickey_x(), mickey_y();
-extern NODE *Get_node_pen_pattern();
-extern FIXNUM t_height();
-extern FIXNUM pen_color, back_ground;
-extern FLONUM t_half_bottom(), t_side();
-extern int current_vis, ibm_screen_bottom;
-extern BOOLEAN in_erase_mode;
-extern int ztc_penwidth;
-extern fg_coord_t ztc_x, ztc_y;
-extern void get_palette(int slot,
-			unsigned int *r, unsigned int *g, unsigned int *b);
-extern void set_palette(int slot,
-			unsigned int r, unsigned int g, unsigned int b);


Reviews:
user: login: jrincayc
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-11T02:29:48Z
user: login: n1ywb-1
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-11T05:47:17Z
user: login: jrincayc
body: Reviewed and approved.
state: APPROVED
author_association: OWNER
submitted_at: 2025-03-12T02:25:36Z

Review comments:
diff_hunk: @@ -0,0 +1,13 @@
+#/bin/bash -v
+
+export PATH=/mingw32/bin:$PATH
+export MINGW_BIN_DIR=/mingw32/bin
+export WX_DIR=/home/User/wxWidgets-3.2.2.1
path: winbuild.sh
user: login: jrincayc
body: Hm, this looks user specific.
created_at: 2025-03-11T02:29:48Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,13 @@
+#/bin/bash -v
+
+export PATH=/mingw32/bin:$PATH
+export MINGW_BIN_DIR=/mingw32/bin
+export WX_DIR=/home/User/wxWidgets-3.2.2.1
path: winbuild.sh
user: login: n1ywb-1
body: More like documentation. I had to extract this from the CD config to be able to build locally at all. Trying to save the trouble for the next developer.

Eventually I'd like to have a 1-command debug build but it's not quite there yet and I'm still figuring out the details of the build process.

I could try a local github actions runner I suppose.

Feel free to reject it, I can resubit it when it's fully baked.
created_at: 2025-03-11T05:47:17Z
author_association: CONTRIBUTOR

PR comments:
user: login: jrincayc
created_at: 2025-03-11T02:26:59Z
body: Hm, can ztcterm.c  and ztcterm.h  be removed?
author_association: OWNER
user: login: brianharvey
created_at: 2025-03-11T05:48:02Z
body: > Hm, can ztcterm.c and ztcterm.h be removed?

Yes.  They're for DOS.
author_association: COLLABORATOR
user: login: n1ywb-1
created_at: 2025-03-11T05:48:03Z
body: > Hm, can ztcterm.c and ztcterm.h be removed?

Yeah they're gone in my next push. It's too big a set of changes to make all at once, so I'm doing it in stages.
author_association: CONTRIBUTOR
user: login: n1ywb-1
created_at: 2025-03-11T17:33:09Z
body: Scope has expanded to include the `ibm` macro code, which I determined is NOT used in current windows builds, and _MSC_VER code which is also not used and some other dos cruft.

This should represent the bulk of the DOS code.

There might be some straggling dos code nestled in non-obvious spots where it's coupled to obsolete win32 code or hidden by negated macros, unreachable functions, etc.

The next step is to clean out obsolete win32 code. I'll do that in a separate PR, unless you want me to keep this one going.
author_association: CONTRIBUTOR
user: login: jrincayc
created_at: 2025-03-12T02:14:03Z
body: No, this PR is getting long enough as is.  I will review it.

author_association: OWNER
user: login: n1ywb-1
created_at: 2025-03-12T13:50:36Z
body: Thanks @jrincayc and @brianharvey. It was nearly 40 years ago when I wrote my first computer program ever in LOGO on an Apple II and I knew immediately what I wanted to do with my life. It's my privilege to be able to contribute.
author_association: CONTRIBUTOR