Only in .: .cvsignore.orig
diff -c ./bios.c ../../vmint/vmint/bios.c
*** ./bios.c	Mon Aug 21 23:34:14 1995
--- ../../vmint/vmint/bios.c	Wed Aug 23 23:15:44 1995
***************
*** 18,27 ****
--- 18,29 ----
  
  #define UNDEF 0		/* should match definition in tty.c */
  
+ #ifndef	VMINT
  /* some key definitions */
  #define CTRLALT 0xc
  #define DEL 0x53	/* scan code of delete key */
  #define UNDO 0x61	/* scan code of undo key */
+ #endif
  
  /* BIOS device definitions */
  #define CONSDEV 2
***************
*** 37,44 ****
--- 39,51 ----
  const short boutput[MAX_BHANDLE] = { -3, -2, -1, -5 };
  
  /* tty structures for the BIOS devices -- see biosfs.c */
+ #ifndef	VMINT
  extern struct tty con_tty, aux_tty, midi_tty, sccb_tty, scca_tty, ttmfp_tty;
  extern struct bios_tty bttys[], midi_btty;
+ #else
+ extern struct tty con_tty, aux_tty, sccb_tty, scca_tty;
+ extern struct bios_tty bttys[];
+ #endif
  extern short btty_max;
  
  extern int tosvers;	/* from main.c */
***************
*** 54,62 ****
--- 61,75 ----
   * things to registers!
   */
  
+ #ifndef	VMINT
  #define RWABS *((long *)0x476L)
  #define MEDIACH *((long *)0x47eL)
  #define GETBPB *((long *)0x472L)
+ #else
+ #define RWABS *((long *)0x4476L)
+ #define MEDIACH *((long *)0x447eL)
+ #define GETBPB *((long *)0x4472L)
+ #endif
  
  
  /* these are supposed to be tables holding the addresses of the
***************
*** 65,74 ****
--- 78,94 ----
   * we don't use that device (raw console) anyway).
   */
  
+ #ifndef	VMINT
  #define xconstat ((long *)0x51eL)
  #define xconin 	((long *)0x53eL)
  #define xcostat ((long *)0x55eL)
  #define xconout	((long *)0x57eL)
+ #else
+ #define xconstat ((long *)0x451eL)
+ #define xconin 	((long *)0x453eL)
+ #define xcostat ((long *)0x455eL)
+ #define xconout	((long *)0x457eL)
+ #endif
  
  #if 1
  /* if the system has Bconmap the ones >= 6 are in a table available
***************
*** 142,151 ****
--- 162,181 ----
  isonline (struct bios_tty *b)
  {
  	if (b->tty == &aux_tty) {
+ #ifndef	VMINT
  	/* modem1 */
  	/* CD is !bit 1 on the 68901 GPIP port */
  		return (1 << 1) & ~*((volatile char *) 0xfffffa01L);
+ #else
+ 	/* tty01 */
+ 	/* CD is bit 3 of read register 0 on SCC #0 port B */
+ 	/* Note: I fail to see the need for spl7() here... */
+ 		unsigned char r;
+ 		r = (1 << 3) & *((volatile char *) 0xfffe3000L);
+ 		return r;
+ #endif
  	} else if (b->tty == &sccb_tty) {
+ #ifndef	VMINT
  	/* modem2 */
  	/* CD is bit 3 of read register 0 on SCC port B */
  		short sr = spl7();
***************
*** 155,161 ****
--- 185,200 ----
  		r = (1 << 3) & *((volatile char *) 0xffff8c85L);
  		spl(sr);
  		return r;
+ #else
+ 	/* tty03 */
+ 	/* CD is bit 3 of read register 0 on SCC #1 port B */
+ 	/* Note: I fail to see the need for spl7() here... */
+ 		unsigned char r;
+ 		r = (1 << 3) & *((volatile char *) 0xfffe3800L);
+ 		return r;
+ #endif
  	} else if (b->tty == &scca_tty) {
+ #ifndef	VMINT
  	/* serial2 */
  	/* like modem2, only port A */
  		short sr = spl7();
***************
*** 165,170 ****
--- 204,217 ----
  		r = (1 << 3) & *((volatile char *) 0xffff8c81L);
  		spl(sr);
  		return r;
+ #else
+ 	/* tty02 */
+ 	/* CD is bit 3 of read register 0 on SCC #1 port A */
+ 	/* Note: I fail to see the need for spl7() here... */
+ 		unsigned char r;
+ 		r = (1 << 3) & *((volatile char *) 0xfffe3802L);
+ 		return r;
+ #endif
  	} else {
  	/* unknown port, assume CD always on. */
  		return 1;
***************
*** 175,184 ****
--- 222,240 ----
  isbrk (struct bios_tty *b)
  {
  	if (b->tty == &aux_tty) {
+ #ifndef	VMINT
  	/* modem1 */
  	/* break is bit 3 in the 68901 RSR */
  		return (1 << 3) & *((volatile char *) 0xfffffa2bL);
+ #else
+ 	/* tty01 */
+ 	/* break is bit 7 of read register 0 on SCC #0 port B */
+ 		unsigned char r;
+ 		r = (1 << 7) & *((volatile char *) 0xfffe3000L);
+ 		return r;
+ #endif
  	} else if (b->tty == &sccb_tty) {
+ #ifndef	VMINT
  	/* modem2 */
  	/* break is bit 7 of read register 0 on SCC port B */
  		short sr = spl7();
***************
*** 188,194 ****
--- 244,258 ----
  		r = (1 << 7) & *((volatile char *) 0xffff8c85L);
  		spl(sr);
  		return r;
+ #else
+ 	/* tty03 */
+ 	/* break is bit 7 of read register 0 on SCC #1 port B */
+ 		unsigned char r;
+ 		r = (1 << 7) & *((volatile char *) 0xfffe3800L);
+ 		return r;
+ #endif
  	} else if (b->tty == &scca_tty) {
+ #ifndef	VMINT
  	/* serial2 */
  	/* like modem2, only port A */
  		short sr = spl7();
***************
*** 198,206 ****
--- 262,279 ----
  		r = (1 << 7) & *((volatile char *) 0xffff8c81L);
  		spl(sr);
  		return r;
+ #else
+ 	/* tty02 */
+ 	/* break is bit 7 of read register 0 on SCC #1 port A */
+ 		unsigned char r;
+ 		r = (1 << 7) & *((volatile char *) 0xfffe3802L);
+ 		return r;
+ #endif
+ #ifndef	VMINT
  	} else if (b->tty == &ttmfp_tty) {
  	/* serial1 */
  		return (1 << 3) & *((volatile char *) 0xfffffaabL);
+ #endif
  	} else {
  	/* unknown port, cannot detect breaks... */
  		return 0;
***************
*** 233,238 ****
--- 306,312 ----
  btty_ionread(b)
  	struct bios_tty *b;
  {
+ #ifndef	VMINT
  	long ret = 0;
  #if 1
  /* try trap #1 first, to read hardware fifos too...
***************
*** 242,251 ****
--- 316,330 ----
  	    !rsvf_ioctl (b->tosfd, &ret, FIONREAD))
  		return (unsigned) ret;
  #endif
+ #endif
  	return ionread (b->irec);
  }
  
+ #ifndef	VMINT
  #define _hz_200 (*((long *)0x4baL))
+ #else
+ #define _hz_200 (*((long *)0x44baL))
+ #endif
  
  INLINE static void
  checkbtty (struct bios_tty *b, int sig)
***************
*** 343,348 ****
--- 422,428 ----
  	for (b=bttys;b<bttys+btty_max;b++) {
  		checkbtty(b, 1);
  	}
+ #ifndef	VMINT
  	b=&midi_btty;
  	if (!b->vticks || _hz_200 - b->vticks > 0) {
  		long r;
***************
*** 361,366 ****
--- 441,447 ----
  		} else
  			b->vticks = 0;
  	}
+ #endif
  }
  
  void
***************
*** 479,489 ****
  		}
  
  		if (checkkeys()) goto again;
! 
  		h = k->head + 4;
  		if (h >= k->buflen)
  			h = 0;
  		r = *((long *)(k->bufaddr + h));
  		k->head = h;
  		return r;
  	}
--- 560,577 ----
  		}
  
  		if (checkkeys()) goto again;
! #ifndef	VMINT
  		h = k->head + 4;
+ #else
+ 		h = k->head + 1;
+ #endif
  		if (h >= k->buflen)
  			h = 0;
+ #ifndef	VMINT
  		r = *((long *)(k->bufaddr + h));
+ #else
+ 		r = ((long)(k->bufaddr[h])) & 0xffL;
+ #endif
  		k->head = h;
  		return r;
  	}
***************
*** 497,504 ****
--- 585,597 ----
  		} else
  			h = dev-SERDEV;
  
+ #ifndef	VMINT
  		if ((unsigned)h < btty_max || dev == 3) {
  			if (has_bconmap && dev != 3) {	/* help the compiler... :) */
+ #else
+ 		if ((unsigned)h < btty_max) {
+ 			if (has_bconmap) {
+ #endif
  				long *statc;
  
  				while (!callout1(*(statc=&MAPTAB[dev-SERDEV].bconstat), dev))
***************
*** 506,522 ****
--- 599,627 ----
  				return callout1(statc[1], dev);
  			}
  			while (!BCONSTAT(dev))
+ #ifndef	VMINT
  				sleep(IO_Q, (long)(dev == 3 ? &midi_btty :
  								&bttys[h]));
+ #else
+ 				sleep(IO_Q, (long)(&bttys[h]));
+ #endif
  		} else if (dev > 0) {
  			unsigned long tick;
  
+ #ifndef	VMINT
  			tick = *((unsigned long *)0x4baL);
+ #else
+ 			tick = *((unsigned long *)0x44baL);
+ #endif
  			while (!BCONSTAT(dev)) {
  /* make blocking (for longer) reads eat less CPU...
   * if yield()ed > 2 seconds and still no data continue with nap
   */
+ #ifndef	VMINT
  			if ((*((unsigned long *)0x4baL) - tick) > 400)
+ #else
+ 			if ((*((unsigned long *)0x44baL) - tick) > 400)
+ #endif
  				nap(60);
  			else
  				yield();
***************
*** 574,585 ****
--- 679,695 ----
  {
  	int statdev;
  	long endtime;
+ #ifndef	VMINT
  #define curtime *((unsigned long *)0x4baL)
+ #else
+ #define curtime *((unsigned long *)0x44baL)
+ #endif
  
  	if (dev == AUXDEV && has_bconmap) {
  		dev = curproc->bconmap;
  	}
  
+ #ifndef	VMINT
  /* compensate for a known BIOS bug; MIDI and IKBD are switched */
  	if (dev == 3) {		/* MIDI */
  		statdev = 4;
***************
*** 588,593 ****
--- 698,706 ----
  	} else {
  		statdev = dev;
  	}
+ #else
+ 	statdev = dev;
+ #endif
  
  /* provide a 10 second time out for the printer */
  	if (!BCOSTAT(statdev)) {
***************
*** 601,612 ****
--- 714,732 ----
  		} else {
  			endtime = curtime + 10*200L;
  			do {
+ #ifndef	VMINT
  #if 0
  	/* Speedo GDOS isn't re-entrant, so we can't give up CPU
  	 * time here :-(
  	 */
  				yield();
  #endif
+ #else
+ 	/*
+ 	 * We can under VTOS...
+ 	 */
+ 				yield();
+ #endif
  			} while (!BCOSTAT(statdev) && curtime < endtime);
  			if ( curtime >= endtime) return 0;
  		}
***************
*** 686,691 ****
--- 806,818 ----
  	extern int no_mem_prot;				/* in main.c */
  
  	place = (long *)(((long)number) << 2);
+ 
+ #ifdef	VMINT
+ 	/* adjust place for relocated VTOS sysvars */
+ 	if ( (long)place >= 0x0400L )
+ 		place = (long *)(((long)place) + 0x4000L);
+ #endif
+ 
  	if (number == 0x21)				/* trap_1 */
  		old = save_dos;
  	else if (number == 0x2d)			/* trap_13 */
***************
*** 758,764 ****
--- 885,895 ----
  long ARGS_ON_STACK
  tickcal()
  {
+ #ifndef	VMINT
  	return (long) (*( (unsigned *) 0x0442L ));
+ #else
+ 	return (long) (*( (unsigned *) 0x4442L ));
+ #endif
  }
  
  /* getbpb: get BIOS parameter block */
***************
*** 803,808 ****
--- 934,940 ----
  {
  	FILEPTR *f;
  
+ #ifndef	VMINT
  /* the BIOS switches MIDI (3) and IKBD (4) (a bug, but it can't be corrected) */
  	if (dev == 4) {		/* really the MIDI port */
  		f = curproc->handle[boutput[3]];
***************
*** 810,815 ****
--- 942,948 ----
  	}
  	if (dev == 3)
  		return BCOSTAT(dev);
+ #endif
  
  	if (dev < MAX_BHANDLE) {
  		f = curproc->handle[boutput[dev]];
***************
*** 822,839 ****
  bcostat(dev)
  int dev;
  {
! 
  	if (dev == CONSDEV) {
  		return -1;
  	}
! 	else if (dev == AUXDEV && has_bconmap) {
  		dev = curproc->bconmap;
  	}
  /* compensate here for the BIOS bug, so that the MIDI and IKBD files work
   * correctly
   */
  	else if (dev == 3) dev = 4;
  	else if (dev == 4) dev = 3;
  
  	return BCOSTAT(dev);
  }
--- 955,982 ----
  bcostat(dev)
  int dev;
  {
! /*
!  * Under VTOS, the console is almost always a *real* serial port, so
!  * output is not always possible. Just treat it like any other bios
!  * device.
!  */
! #ifndef	VMINT
  	if (dev == CONSDEV) {
  		return -1;
  	}
! 	else
! #endif
! 	if (dev == AUXDEV && has_bconmap) {
  		dev = curproc->bconmap;
  	}
+ 
+ #ifndef	VMINT
  /* compensate here for the BIOS bug, so that the MIDI and IKBD files work
   * correctly
   */
  	else if (dev == 3) dev = 4;
  	else if (dev == 4) dev = 3;
+ #endif
  
  	return BCOSTAT(dev);
  }
***************
*** 855,861 ****
--- 998,1008 ----
  long ARGS_ON_STACK
  drvmap()
  {
+ #ifndef	VMINT
  	return *( (long *)0x4c2L );
+ #else
+ 	return *( (long *)0x44c2L );
+ #endif
  }
  
  /* kbshift: return (and possibly change) keyboard shift key status */
***************
*** 999,1009 ****
--- 1146,1158 ----
  	if ((ret = iwrite (dev, bconbuf, bsiz, 0, 0)) != EUNDEV) {
  		bconbdev = 0;
  		return ret;
+ #ifndef	VMINT
  	} else if (dev == 3) {		/* MIDI */
  	/* compensate for a known BIOS bug; MIDI and IKBD are switched */
  		statdev = 4;
  	} else if (dev == 4) {
  		statdev = 3;
+ #endif
  	} else
  		statdev = dev;
  		
***************
*** 1102,1131 ****
   * switch where a keyboard event occured). returns 1 if a special
   * control character was eaten, 0 if not
   */
! 
  int
  checkkeys()
  {
  	char scan, ch;
  	short shift;
  	int sig, ret;
  	struct tty *tty = &con_tty;
  	extern char mshift;		/* for mouse -- see biosfs.c */
  	static short oldktail = 0;
  
  	ret = 0;
  	mshift = kbshift(-1);
  	while (oldktail != keyrec->tail) {
  
  /* BUG: we really should check the shift status _at the time the key was
   * pressed_, not now!
   */
  		sig = 0;
  		shift = mshift;
  		oldktail += 4;
  		if (oldktail >= keyrec->buflen)
  			oldktail = 0;
! 
  		scan = (keyrec->bufaddr + oldktail)[1];
  /* function key?? */
  		if ( (scan >= 0x3b && scan <= 0x44) ||
--- 1251,1297 ----
   * switch where a keyboard event occured). returns 1 if a special
   * control character was eaten, 0 if not
   */
! /*
!  * Note for VMINT running under VTOS:
!  * Since we don't currently have a real Atari keyboard connected to the
!  * console port, this stuff doesn't do a lot. For now, it does the bare
!  * minimum required to handle console input...
!  */
  int
  checkkeys()
  {
+ #ifndef	VMINT
  	char scan, ch;
+ #else
+ 	char ch;
+ #endif
  	short shift;
  	int sig, ret;
  	struct tty *tty = &con_tty;
+ #ifndef	VMINT
  	extern char mshift;		/* for mouse -- see biosfs.c */
+ #endif
  	static short oldktail = 0;
  
  	ret = 0;
+ #ifndef	VMINT
  	mshift = kbshift(-1);
+ #endif
  	while (oldktail != keyrec->tail) {
  
  /* BUG: we really should check the shift status _at the time the key was
   * pressed_, not now!
   */
  		sig = 0;
+ #ifndef	VMINT
  		shift = mshift;
  		oldktail += 4;
+ #else
+ 		oldktail += 1;
+ #endif
  		if (oldktail >= keyrec->buflen)
  			oldktail = 0;
! #ifndef	VMINT
  		scan = (keyrec->bufaddr + oldktail)[1];
  /* function key?? */
  		if ( (scan >= 0x3b && scan <= 0x44) ||
***************
*** 1141,1153 ****
--- 1307,1325 ----
  				continue;
  			}
  		}
+ #endif
  
  /* check for special control keys, etc. */
  /* BUG: this doesn't exactly match TOS' behavior, particularly for
   * ^S/^Q
   */
+ #ifndef	VMINT
  		if ((tty->state & TS_COOKED) || (shift & CTRLALT) == CTRLALT) {
  			ch = (keyrec->bufaddr + keyrec->tail)[3];
+ #else
+ 		if ( tty->state & TS_COOKED ) {
+ 			ch = (keyrec->bufaddr + keyrec->tail)[0];
+ #endif
  			if (ch == UNDEF)
  				;	/* do nothing */
  			else if (ch == tty->tc.t_intrc)
***************
*** 1236,1243 ****
--- 1408,1420 ----
  {A(0x134), 0},
  {A(0x138), 0},
  {A(0x13c), 0},
+ #ifndef	VMINT
  {A(0x400), 0},	/* etv_timer */
  {A(0x4f6), 0},  /* shell_p */
+ #else
+ {A(0x4400), 0},	/* etv_timer */
+ {A(0x44f6), 0},  /* shell_p */
+ #endif
  
  {A(0), 0}	/* special tag indicating end of list */
  };
***************
*** 1307,1314 ****
--- 1484,1496 ----
  	int i;
  
  /* first, unhook any VBL handlers */
+ #ifndef	VMINT
  	i = *((short *)0x454L);	/* i = nvbls */
  	p = *((long **)0x456L);	/* p = _vblqueue */
+ #else
+ 	i = *((short *)0x4454L);	/* i = nvbls */
+ 	p = *((long **)0x4456L);	/* p = _vblqueue */
+ #endif
  	while (i-- > 0) {
  		where = *p;
  		if (where >= start && where < end)
diff -c ./biosfs.c ../../vmint/vmint/biosfs.c
*** ./biosfs.c	Mon Aug 21 23:34:14 1995
--- ../../vmint/vmint/biosfs.c	Fri Sep  1 19:35:04 1995
***************
*** 60,71 ****
--- 60,73 ----
  long	ARGS_ON_STACK null_select	P_((FILEPTR *f, long p, int mode));
  void	ARGS_ON_STACK null_unselect	P_((FILEPTR *f, long p, int mode));
  
+ #ifndef	VMINT
  static long ARGS_ON_STACK mouse_open	P_((FILEPTR *f));
  static long ARGS_ON_STACK mouse_read	P_((FILEPTR *f, char *buf, long nbytes));
  static long ARGS_ON_STACK mouse_ioctl P_((FILEPTR *f, int mode, void *buf));
  static long ARGS_ON_STACK mouse_close P_((FILEPTR *f, int pid));
  static long ARGS_ON_STACK mouse_select P_((FILEPTR *f, long p, int mode));
  static void ARGS_ON_STACK mouse_unselect P_((FILEPTR *f, long p, int mode));
+ #endif
  
  /* device driver for BIOS terminals */
  
***************
*** 87,105 ****
--- 89,111 ----
  	null_datime, null_close, null_select, null_unselect
  };
  
+ #ifndef	VMINT
  DEVDRV mouse_device = {
  	mouse_open, null_write, mouse_read, null_lseek, mouse_ioctl,
  	null_datime, mouse_close, mouse_select, mouse_unselect
  };
+ #endif
  
  /* this special driver is checked for in dosfile.c, and indicates that
   * a dup operation is actually wanted rather than an open
   */
  DEVDRV fakedev;
  
+ #ifndef	VMINT
  #ifdef FASTTEXT
  extern DEVDRV screen_device;	/* see fasttext.c */
  #endif
+ #endif
  
  FILESYS bios_filesys = {
  	(FILESYS *)0,
***************
*** 113,129 ****
  	bios_symlink, bios_readlink, nohardlink, bios_fscntl, nodskchng
  };
  
! 
  struct tty con_tty, aux_tty, midi_tty;
  struct tty sccb_tty, scca_tty, ttmfp_tty;
  
  struct bios_file BDEV[] = {
  
  /* "real" bios devices present on all machines */
  	{"centr", &bios_ndevice, 0, 0, 0, 0},
  	{"console", &bios_tdevice, 2, O_TTY, &con_tty, 0},
  	{"midi", &bios_tdevice, 3, O_TTY, &midi_tty, 0},
  	{"kbd", &bios_ndevice, 4, 0, 0, 0},
  /* devices that duplicate handles */
  	{"prn", &fakedev, -3, 0, 0, 0}, /* handle -3 (printer) */
  	{"aux", &fakedev, -2, 0, 0, 0}, /* handle -2 (aux. terminal) */
--- 119,141 ----
  	bios_symlink, bios_readlink, nohardlink, bios_fscntl, nodskchng
  };
  
! #ifndef	VMINT
  struct tty con_tty, aux_tty, midi_tty;
  struct tty sccb_tty, scca_tty, ttmfp_tty;
+ #else
+ struct tty con_tty, aux_tty;	/* console, tty01 */
+ struct tty scca_tty, sccb_tty;	/* tty02,   tty03 */
+ #endif
  
  struct bios_file BDEV[] = {
  
  /* "real" bios devices present on all machines */
  	{"centr", &bios_ndevice, 0, 0, 0, 0},
  	{"console", &bios_tdevice, 2, O_TTY, &con_tty, 0},
+ #ifndef	VMINT
  	{"midi", &bios_tdevice, 3, O_TTY, &midi_tty, 0},
  	{"kbd", &bios_ndevice, 4, 0, 0, 0},
+ #endif
  /* devices that duplicate handles */
  	{"prn", &fakedev, -3, 0, 0, 0}, /* handle -3 (printer) */
  	{"aux", &fakedev, -2, 0, 0, 0}, /* handle -2 (aux. terminal) */
***************
*** 135,163 ****
--- 147,195 ----
  	{"fd", &fakedev, S_IFDIR, 0, 0, 0}, /* file descriptor directory */
  
  /* other miscellaneous devices */
+ #ifndef	VMINT
  	{"mouse", &mouse_device, 0, 0, 0, 0},
+ #endif
  	{"null", &null_device, 0, 0, 0, 0},
  
+ #ifndef	VMINT
  #ifdef FASTTEXT
  /* alternate console driver */
  	{"fasttext", &screen_device, 2, O_TTY, &con_tty, 0},
  #endif
+ #endif
  
  /* serial port things *must* come last, because not all of these
   * are present on all machines (except for modem1, which does however
   * have a different device number on TTs and STs)
   */
+ #ifndef	VMINT
  	{"modem1", &bios_tdevice, 6, O_TTY, &aux_tty, 0},
  	{"modem2", &bios_tdevice, 7, O_TTY, &sccb_tty, 0},
  	{"serial1", &bios_tdevice, 8, O_TTY, &ttmfp_tty, 0},
  	{"serial2", &bios_tdevice, 9, O_TTY, &scca_tty, 0},
+ #else
+ /*
+  * Change the names to correspond to what's written on the XXXXXXX board
+  */
+ 	{"tty01", &bios_tdevice, 6, O_TTY, &aux_tty, 0},
+ 	{"tty02", &bios_tdevice, 7, O_TTY, &scca_tty, 0},
+ 	{"tty03", &bios_tdevice, 8, O_TTY, &sccb_tty, 0},
+ #endif
  	{"", 0, 0, 0, 0, 0}
  };
  
+ #ifndef	VMINT
  #define xconstat ((long *)0x51eL)
  #define xconin 	((long *)0x53eL)
  #define xcostat ((long *)0x55eL)
  #define xconout	((long *)0x57eL)
+ #else
+ #define xconstat ((long *)0x451eL)
+ #define xconin 	((long *)0x453eL)
+ #define xcostat ((long *)0x455eL)
+ #define xconout	((long *)0x457eL)
+ #endif
  
  extern BCONMAP2_T *bconmap2;		/* bconmap struct */
  #define MAPTAB (bconmap2->maptab)
***************
*** 165,174 ****
--- 197,215 ----
  #define MAXBAUD 16
  
  /* keep these sorted in descending order */
+ #ifndef	VMINT
  static long baudmap[MAXBAUD] = {
  19200L, 9600L, 4800L, 3600L, 2400L, 2000L, 1800L, 1200L,
  600L, 300L, 200L, 150L, 134L, 110L, 75L, 50L
  };
+ #else
+ static long real_baudmap[MAXBAUD + 4] = {
+ 57600L, 38400L, 38400L, 38400L,	/* The extended VTOS speeds (-4, -3) */
+ 19200L, 9600L, 4800L, 3600L, 2400L, 2000L, 1800L, 1200L,
+ 600L, 300L, 200L, 150L, 134L, 110L, 75L, 50L
+ };
+ static long *baudmap = &(real_baudmap[4]);
+ #endif
  
  INLINE static void scc_set5 P_((volatile char *control, int setp,
  	unsigned bits, IOREC_T *iorec));
***************
*** 184,193 ****
  unsigned bits;
  IOREC_T *iorec;
  {
  	volatile char dummy;
  
  	short sr = spl7();
- 
  #if 1
  /* sanity check: if the w5 copy at offset 1d has bit 3 off something is wrong */
  	if (!(((char *) iorec)[0x1d] & 8)) {
--- 225,234 ----
  unsigned bits;
  IOREC_T *iorec;
  {
+ #ifndef	VMINT
  	volatile char dummy;
  
  	short sr = spl7();
  #if 1
  /* sanity check: if the w5 copy at offset 1d has bit 3 off something is wrong */
  	if (!(((char *) iorec)[0x1d] & 8)) {
***************
*** 199,204 ****
--- 240,246 ----
  	dummy = *((volatile char *) 0xfffffa01L);
  	*control = 5;
  	dummy = *((volatile char *) 0xfffffa01L);
+ 	*control = 5;
  	if (setp)
  		*control = (((char *) iorec)[0x1d] |= bits);
  	else
***************
*** 207,215 ****
--- 249,272 ----
  #ifdef __TURBOC__
  	setp = dummy; /* jr: get rid of warning regarding dummy */
  #endif
+ 
+ #else /* VMINT */
+ 
+ 	short sr = spl7();
+ 	*control = 5;
+ 	if (setp)
+ 		*control = (((char *) iorec)[0x1d] |= bits);
+ 	else
+ 		*control = (((char *) iorec)[0x1d] &= ~bits);
+ 	spl(sr);
+ #endif
  }
  
+ #ifndef	VMINT
  #define	MAX_BTTY	4	/* 4 bios_tty structs */
+ #else
+ #define	MAX_BTTY	3	/* 3 bios_tty structs */
+ #endif
  
  /* find bios_tty struct for a FILEPTR
   */
***************
*** 217,225 ****
--- 274,287 ----
  		 ((has_bconmap && (unsigned)(f)->fc.aux-6 < btty_max) ? \
  		    bttys+(f)->fc.aux-6 : 0))
  
+ #ifndef	VMINT
  struct bios_tty bttys[MAX_BTTY], midi_btty;
+ #else
+ struct bios_tty bttys[MAX_BTTY];
+ #endif
  short	btty_max;
  
+ #ifndef	VMINT
  /* RSVF cookie value (read in main.c) */
  long rsvf;
  
***************
*** 287,292 ****
--- 349,355 ----
  	/* is there a more direct way than this? */
  	return Fcntl (f, (long)arg, mode);
  }
+ #endif /* VMINT */
  
  extern int tosvers;	/* from main.c */
  
***************
*** 365,370 ****
--- 428,434 ----
  	/* device has DEVDRV calls beyond unselect */
  			b->drvsize = offsetof (DEVDRV, readb) + sizeof (long);
  
+ #ifndef	VMINT
  	/* if not a TT or Mega STE, adjust the MODEM1 device to be BIOS
  	 * device 1
  	 * and ignore the remaining devices, since they're not present
***************
*** 385,390 ****
--- 449,455 ----
  			b->next = 0;
  			break;
  		}
+ #endif
  	}
  	bdevlast = b;
  	if (b->name[0] == 0) {
***************
*** 413,418 ****
--- 478,484 ----
  	}
  	btty_max = i;
  
+ #ifndef	VMINT
  	midi_btty.irec = Iorec(2);
  	midi_btty.rsel = &midi_tty.rsel;
  	midi_btty.wsel = &midi_tty.wsel;
***************
*** 421,426 ****
--- 487,493 ----
  	midi_btty.clocal = 1;
  	midi_btty.tosfd = EUNDEV;
  	midi_btty.bdev = 3;
+ #endif
  
  	defaultaux = new_fileptr();
  	defaultaux->links = 1;		/* so it never gets freed */
***************
*** 1340,1351 ****
--- 1407,1428 ----
  	FILEPTR *f;
  {
  	struct tty *tty = (struct tty *)f->devinfo;
+ #ifndef	VMINT
  	int bdev = f->fc.aux;
+ #endif
  	struct bios_tty *b;
  
  	f->flags |= O_TTY;
+ #ifndef	VMINT
  	if (!tty->use_cnt && NULL != (b = BTTY(f)) && b->tosfd == EUNDEV)
  		b->tosfd = rsvf_open (bdev);
+ #else
+ 	/*
+ 	 * Just to be on the safe side...
+ 	 */
+ 	if (!tty->use_cnt && NULL != (b = BTTY(f)) )
+ 		b->tosfd = EUNDEV;
+ #endif
  	return 0;
  }
  
***************
*** 1483,1493 ****
  {
  	IOREC_T *ior = 0;
  	long *cout = 0;	/* keep compiler happy */
! 	long *ospeed;
  	struct tty *tty = 0; /* still not happy yet? */
  	const char *p = buf;
  	int slept = 0;
  
  #if 1
  #define _hz_200 (*((long *)0x4baL))
  
--- 1560,1571 ----
  {
  	IOREC_T *ior = 0;
  	long *cout = 0;	/* keep compiler happy */
! 	long *ospeed = 0;
  	struct tty *tty = 0; /* still not happy yet? */
  	const char *p = buf;
  	int slept = 0;
  
+ #ifndef	VMINT
  #if 1
  #define _hz_200 (*((long *)0x4baL))
  
***************
*** 1515,1520 ****
--- 1593,1599 ----
  		return p - buf;
  	}
  #endif
+ #endif
  
  	if (has_bconmap) {
  		if ((unsigned)bdev-6 < btty_max) {
***************
*** 1708,1726 ****
  {
  	IOREC_T *ior = 0;
  	long *cin = 0;	/* keep compiler happy */
! 	long *cinstat;
  	struct bios_tty *t = 0;
  	char *p;
  	unsigned short head, bsize, wrap;
  	long left;
  
  	if (bdev == 3 && tosvers >= 0x0102) {
  		/* midi */
  		t = &midi_btty;
  		ior = t->irec;
  		cin = &xconin[3];
  		cinstat = &xconstat[3];
! 	} else if (has_bconmap) {
  		if ((unsigned)bdev-6 < btty_max) {
  			t = bttys+bdev-6;
  			ior = MAPTAB[bdev-6].iorec;
--- 1787,1808 ----
  {
  	IOREC_T *ior = 0;
  	long *cin = 0;	/* keep compiler happy */
! 	long *cinstat = 0;
  	struct bios_tty *t = 0;
  	char *p;
  	unsigned short head, bsize, wrap;
  	long left;
  
+ #ifndef	VMINT
  	if (bdev == 3 && tosvers >= 0x0102) {
  		/* midi */
  		t = &midi_btty;
  		ior = t->irec;
  		cin = &xconin[3];
  		cinstat = &xconstat[3];
! 	} else
! #endif
! 	if (has_bconmap) {
  		if ((unsigned)bdev-6 < btty_max) {
  			t = bttys+bdev-6;
  			ior = MAPTAB[bdev-6].iorec;
***************
*** 1746,1753 ****
--- 1828,1839 ----
  	 */
  	if (buf && !ndelay) {
  		while (t ? (!(t->tty->state & TS_BLIND) &&
+ #ifndef	VMINT
  			    (bdev == 3 ? ionread(ior) :
  					btty_ionread(t)) < (long)t->tty->vmin)
+ #else
+ 			 btty_ionread(t) < (long)t->tty->vmin)
+ #endif
  			 : !(int)callout1(*cinstat, bdev)) {
  			if (t)
  				sleep(IO_Q, (long)t);
***************
*** 1915,1920 ****
--- 2001,2007 ----
  	int oldmap = curproc->bconmap;
  
  	if (has_bconmap) {
+ #ifndef	VMINT
  /* YABB (Yet Another BIOS Bug):
   * SCC Rsconf looks for the break bit in the wrong place...  if this
   * dev's Rsconf is in ROM do it ourselves, otherwise assume the user
***************
*** 1928,1933 ****
--- 2015,2021 ----
  				  (mode == TIOCSBRK), (1 << 4), t->irec);
  			return 0;
  		}
+ #endif
  		if (bdev >= 6)
  			curproc->bconmap = bdev;
  	}
***************
*** 1978,1984 ****
--- 2066,2076 ----
  				t->clocal = !(flags & TF_CAR);
  /* update TS_BLIND without signalling */
  				checkbtty_nsig (t);
+ #ifndef	VMINT
  				if ((bdev == 7 || tty == &scca_tty) &&
+ #else
+ 				if ((bdev==1 || (bdev>=6 && bdev<btty_max)) &&
+ #endif
  				    !(mask & (T_RTSCTS|T_TANDEM))) {
  /* force rsconf be called so it can adjust w3 bit 5 (see xbios.c) */
  					mask |= (T_RTSCTS|T_TANDEM);
***************
*** 2071,2077 ****
--- 2163,2171 ----
  {
  	long *r = (long *)buf;
  	struct winsize *ws;
+ #ifndef	VMINT
  	char *aline;
+ #endif
  	short dev;
  	int i;
  	struct bios_file *b;
***************
*** 2081,2088 ****
--- 2175,2184 ----
  	case FIONREAD:
  		if (t)
  			*r = btty_ionread(t);
+ #ifndef	VMINT
  		else if (f->fc.aux == 3)
  			*r = ionread(midi_btty.irec);
+ #endif
  		else if (bconstat(f->fc.aux))
  			*r = 1;
  		else
***************
*** 2135,2140 ****
--- 2231,2237 ----
  				ior->head = ior->tail = 0;
  				spl(sr);
  			}
+ #ifndef	VMINT
  		} else if (dev == 3 || dev == 2 || dev == 5) {
  			if (dev == 3) {
  				/* midi */
***************
*** 2148,2153 ****
--- 2245,2259 ----
  				ior->head = ior->tail = 0;
  				spl(sr);
  			}
+ #else
+ 		} else if (dev == 2) {
+ 			ior = (IOREC_T *) uiorec(1);
+ 			if (flushtype & 1) {
+ 				sr = spl7();
+ 				ior->head = ior->tail = 0;
+ 				spl(sr);
+ 			}
+ #endif
  		}
  		return 0;
  	    }
***************
*** 2164,2176 ****
  		dev = f->fc.aux;
  
  		if (dev == 1 || dev >= 6) {
! 			long ret;
  #ifdef TIONOTSEND
  /* try trap #1 first, to know about the last char too :) */
  			if (t &&
  			    (ret = rsvf_ioctl (t->tosfd, r, TIONOTSEND)) != EINVFN)
  				return ret;
  #endif
  			if (t)
  				ior = t->orec;
  			else
--- 2270,2284 ----
  		dev = f->fc.aux;
  
  		if (dev == 1 || dev >= 6) {
! #ifndef	VMINT
  #ifdef TIONOTSEND
+ 			long ret;
  /* try trap #1 first, to know about the last char too :) */
  			if (t &&
  			    (ret = rsvf_ioctl (t->tosfd, r, TIONOTSEND)) != EINVFN)
  				return ret;
  #endif
+ #endif
  			if (t)
  				ior = t->orec;
  			else
***************
*** 2185,2194 ****
--- 2293,2308 ----
  	    }
  	case TIOCGWINSZ:
  		if (f->fc.aux == 2) {
+ #ifndef	VMINT
  			aline = lineA0();
  			ws = (struct winsize *)buf;
  			ws->ws_row = *((short *)(aline - 42)) + 1;
  			ws->ws_col = *((short *)(aline - 44)) + 1;
+ #else
+ 			ws = (struct winsize *)buf;
+ 			ws->ws_row = 25;
+ 			ws->ws_col = 80;
+ #endif
  		} else {
  			return EINVFN;
  		}
***************
*** 2203,2208 ****
--- 2317,2323 ----
  
  		newbaud = *r;
  		if (dev == 1 || dev >= 6) {
+ #ifndef	VMINT
  /* can we pass it to trap #1 and set speeds rsconf doesn't know about? */
  			if (t &&
  			    (oldbaud = rsvf_ioctl (t->tosfd, r, mode)) != EINVFN) {
***************
*** 2218,2235 ****
  				t->vticks = 0;
  				return oldbaud;
  			}
  /* trick rsconf into setting the correct port (it uses curproc->bconmap) */
  			oldmap = curproc->bconmap;
  			if (has_bconmap && dev >= 6)
  				curproc->bconmap = dev;
  			i = (int)rsconf(-2, -1, -1, -1, -1, -1);
! 
  			if (i < 0 || i >= MAXBAUD)
  				oldbaud = -1L;
  			else
  				oldbaud = baudmap[i];
  			*r = oldbaud;
  			if (newbaud > 0) {
  	/* assert DTR works only on modem1 and SCC lines */
  				if (dev == 1 || dev == 6) {
  					Offgibit(0xef);
--- 2333,2355 ----
  				t->vticks = 0;
  				return oldbaud;
  			}
+ #endif
  /* trick rsconf into setting the correct port (it uses curproc->bconmap) */
  			oldmap = curproc->bconmap;
  			if (has_bconmap && dev >= 6)
  				curproc->bconmap = dev;
  			i = (int)rsconf(-2, -1, -1, -1, -1, -1);
! #ifndef	VMINT
  			if (i < 0 || i >= MAXBAUD)
+ #else
+ 			if ((i < 0 || i >= MAXBAUD) && (i != -3) && (i != -4))
+ #endif
  				oldbaud = -1L;
  			else
  				oldbaud = baudmap[i];
  			*r = oldbaud;
  			if (newbaud > 0) {
+ #ifndef	VMINT
  	/* assert DTR works only on modem1 and SCC lines */
  				if (dev == 1 || dev == 6) {
  					Offgibit(0xef);
***************
*** 2239,2250 ****
--- 2359,2388 ----
  						    0xffff8c85L : 0xffff8c81L),
  						  1, (1 << 7), t->irec);
  				}
+ #else
+ 	/* assert DTR works on all 3 tty ports */
+ 				if (dev == 1 || dev == 6)
+ 					scc_set5((volatile char *)0xfffe3000,
+ 			 			1, (1 << 7), t->irec);
+ 				else
+ 				if (dev == 7)
+ 					scc_set5((volatile char *)0xfffe3802,
+ 						1, (1 << 7), t->irec);
+ 				else
+ 				if (dev == 8)
+ 					scc_set5((volatile char *)0xfffe3800,
+ 						1, (1 << 7), t->irec);
+ #endif
  				if (newbaud == oldbaud ||
  				    ((struct tty *)f->devinfo)->hup_ospeed) {
  					curproc->bconmap = oldmap;
  					return 0;
  				}
+ #ifndef	VMINT
  				for (i = 0; i < MAXBAUD; i++) {
+ #else
+ 				for (i = -4; i < MAXBAUD; i++) {
+ #endif
  					if (baudmap[i] == newbaud) {
  						rsconf(i, -1, -1, -1, -1, -1);
  						curproc->bconmap = oldmap;
***************
*** 2257,2262 ****
--- 2395,2401 ----
  				curproc->bconmap = oldmap;
  				return ERANGE;
  			} else if (newbaud == 0L) {
+ #ifndef	VMINT
  	/* drop DTR: works only on modem1 and SCC lines */
  				if (dev == 1 || dev == 6) {
  					Ongibit(0x10);
***************
*** 2266,2280 ****
--- 2405,2435 ----
  						    0xffff8c85L : 0xffff8c81L),
  						  0, (1 << 7), t->irec);
  				}
+ #else
+ 	/* drop DTR works on all 3 tty ports */
+ 				if (dev == 1 || dev == 6)
+ 					scc_set5((volatile char *)0xfffe3000,
+ 			 			0, (1 << 7), t->irec);
+ 				else
+ 				if (dev == 7)
+ 					scc_set5((volatile char *)0xfffe3802,
+ 						0, (1 << 7), t->irec);
+ 				else
+ 				if (dev == 8)
+ 					scc_set5((volatile char *)0xfffe3800,
+ 						0, (1 << 7), t->irec);
+ #endif
  			}
  			curproc->bconmap = oldmap;
  			return 0;
  		} else if (dev == 2 || dev == 5) {
  			/* screen: assume 9600 baud */
  			oldbaud = 9600L;
+ #ifndef	VMINT
  		} else if (dev == 3) {
  			/* midi */
  			oldbaud = 31250L;
+ #endif
  		} else {
  			oldbaud = -1L;	/* unknown speed */
  		}
***************
*** 2301,2309 ****
  	    {
  		unsigned short *v = buf;
  		struct tty *tty = (struct tty *)f->devinfo;
! 
  		if (f->fc.aux == 3)
  			t = &midi_btty;
  		if (!tty || !t)
  			return EINVFN;
  		if (mode == TIOCGVMIN) {
--- 2456,2465 ----
  	    {
  		unsigned short *v = buf;
  		struct tty *tty = (struct tty *)f->devinfo;
! #ifndef	VMINT
  		if (f->fc.aux == 3)
  			t = &midi_btty;
+ #endif
  		if (!tty || !t)
  			return EINVFN;
  		if (mode == TIOCGVMIN) {
***************
*** 2332,2342 ****
--- 2488,2503 ----
  	case TCURSON:
  	case TCURSBLINK:
  	case TCURSSTEADY:
+ #ifndef	VMINT
  		if (f->fc.aux != 2)
  			return EINVFN;
  		return Cursconf(mode - TCURSOFF, 0);
+ #else
+ 		return EINVFN;
+ #endif
  	case TCURSSRATE:
  	case TCURSGRATE:
+ #ifndef	VMINT
  	    {
  		long r;
  
***************
*** 2349,2354 ****
--- 2510,2518 ----
  		}
  		return r;
  	    }
+ #else
+ 		return EINVFN;
+ #endif
  	case F_SETLK:
  	case F_SETLKW:
  	    {
***************
*** 2391,2396 ****
--- 2555,2561 ----
  		}
  		break;
  	    }
+ #ifndef	VMINT
  #ifndef TIOCCTLMAP
  #define TIOCCTLMAP (('T'<<8) | 129)
  #define TIOCCTLGET (('T'<<8) | 130)
***************
*** 2414,2419 ****
--- 2579,2586 ----
  		}
  		/*FALLTHRU*/
  	    }
+ #endif /* VMINT */
+ 
  	default:
  	/* Fcntl will automatically call tty_ioctl to handle
  	 * terminal calls that we didn't deal with
***************
*** 2431,2436 ****
--- 2598,2604 ----
  	int dev = f->fc.aux;
  
  	if (mode == O_RDONLY) {
+ #ifndef	VMINT
  		struct bios_tty *t = &midi_btty;
  		if (tty && (dev == 3 || NULL != (t = BTTY(f)))) {
  			if (!(tty->state & TS_BLIND) &&
***************
*** 2438,2443 ****
--- 2606,2619 ----
  					btty_ionread(t)) >= (long)tty->vmin) {
  				return 1;
  			}
+ #else
+ 		struct bios_tty *t;
+ 		if (tty && NULL != (t = BTTY(f))) {
+ 			if (!(tty->state & TS_BLIND) &&
+ 					btty_ionread(t) >= (long)tty->vmin) {
+ 				return 1;
+ 			}
+ #endif
  		} else if (bconstat(dev)) {
  			TRACE(("bios_select: data present for device %d", dev));
  			return 1;
***************
*** 2451,2457 ****
--- 2627,2637 ----
  		return 0;
  	} else if (mode == O_WRONLY) {
  		if ((!tty || !(tty->state & (TS_BLIND|TS_HOLD))) &&
+ #ifndef	VMINT
  		    (dev == 3 || bcostat(dev))) {
+ #else
+ 		    bcostat(dev)) {
+ #endif
  			TRACE(("bios_select: ready to output on %d", dev));
  			return 1;
  		}
***************
*** 2489,2495 ****
--- 2669,2677 ----
  {
  	struct tty *tty = (struct tty *)f->devinfo;
  	struct bios_file *b;
+ #ifndef	VMINT
  	struct bios_tty *t;
+ #endif
  
  	b = (struct bios_file *)f->fc.index;
  	if ((f->flags & O_LOCK) && (b->lockpid == pid)) {
***************
*** 2500,2512 ****
--- 2682,2697 ----
  	if (tty && f->links <= 0 && f->pos)
  /* f->pos used as flag that f came from Bconmap (/dev/aux) */
  		tty->aux_cnt--;
+ #ifndef	VMINT
  	if (tty && !tty->use_cnt && (NULL != (t = BTTY(f)) && t->tosfd != EUNDEV)) {
  		rsvf_close (t->tosfd);
  		t->tosfd = EUNDEV;
  	}
+ #endif
  	return 0;
  }
  
+ #ifndef	VMINT
  /*
   * mouse device driver
   */
***************
*** 2733,2739 ****
  	if (mode == O_RDONLY && mousersel == p)
  		mousersel = 0;
  }
! 
  
  /*
   * UTILITY ROUTINE called by Bconmap() in xbios.c:
--- 2918,2924 ----
  	if (mode == O_RDONLY && mousersel == p)
  		mousersel = 0;
  }
! #endif /* VMINT */
  
  /*
   * UTILITY ROUTINE called by Bconmap() in xbios.c:
diff -c ./context.spp ../../vmint/vmint/context.spp
*** ./context.spp	Mon Aug 21 23:34:14 1995
--- ../../vmint/vmint/context.spp	Tue Aug 22 09:36:44 1995
***************
*** 70,76 ****
--- 70,80 ----
  	move.w	(a1)+,d0	; 68000 fake frame format
  
  %ifndef ONLY030
+ %ifndef	VMINT
  	move.w	($59e).w,d7	; get process frame flag
+ %else
+ 	move.w	($459e).w,d7	; get process frame flag
+ %endif
  	bne.s	nojunk		; we have some junk on the stack
  	move.w	d0,C_SFMT(a0)	; save fake frame format
  	subq.w	#$8,d0		; if bus error (note: subq is faster than
***************
*** 119,125 ****
--- 123,133 ----
  	move.l	C_SSP(a0),a1	; was using super stack pointer before interrupt
  				; 
  L_CONT1:
+ %ifndef	VMINT
  	move.l	($408).w,C_TERM(a0) ; save GEMDOS terminate vector
+ %else
+ 	move.l	($4408).w,C_TERM(a0) ; save GEMDOS terminate vector
+ %endif
  	move.l	(sp)+,C_A0(a0)	; save old register a0
  	rts
  
***************
*** 160,166 ****
--- 168,178 ----
  	move.l	usp,a1
  	move.l	a1,C_USP(a0)	; save user stack pointer
  	move.w	sr,C_SR(a0)	; save status register
+ %ifndef	VMINT
  	move.l	($408).w,C_TERM(a0)	; save GEMDOS terminate vector
+ %else
+ 	move.l	($4408).w,C_TERM(a0)	; save GEMDOS terminate vector
+ %endif
  	move.l	(sp)+,C_A0(a0)	; save old a0
  	moveq.l	#0,d0		; return 0
  	rts
***************
*** 179,185 ****
--- 191,201 ----
  	move.l	a1,sp
  	move.l	C_USP(a0),a1
  	move.l	a1,usp		; set user stack pointer
+ %ifndef	VMINT
  	move.l	C_TERM(a0),($408).w	; restore GEMDOS terminate vector
+ %else
+ 	move.l	C_TERM(a0),($4408).w	; restore GEMDOS terminate vector
+ %endif
  
  ; Set memory context now: actually, this isn't necessary, since
  ; we're coming back to a context in the same process as is running
***************
*** 191,197 ****
--- 207,217 ----
  noprot3:
  
  %ifndef ONLY030
+ %ifndef	VMINT
  	tst.w	($59e).w	; test longframe (AKP)
+ %else
+ 	tst.w	($459e).w	; test longframe (AKP)
+ %endif
  	beq.s	short3
  %endif
  ; was moveq.l #0,d0, but I don't think that's what was desired */
***************
*** 246,252 ****
--- 266,276 ----
  	move.l	a1,sp
  	move.l	C_USP(a0),a1
  	move.l	a1,usp		; set user stack pointer
+ %ifndef	VMINT
  	move.l	C_TERM(a0),($408).w	; restore GEMDOS terminate vector
+ %else
+ 	move.l	C_TERM(a0),($4408).w	; restore GEMDOS terminate vector
+ %endif
  
  ; Set memory context now
  	tst.w	_no_mem_prot
***************
*** 255,261 ****
--- 279,289 ----
  	pmove	C_TC(a0),tc	; restore MMU control register
  noprot4:
  %ifndef ONLY030
+ %ifndef	VMINT
  	tst.w	($59e).w	; test longframe (AKP)
+ %else
+ 	tst.w	($459e).w	; test longframe (AKP)
+ %endif
  	beq.s	short6
  %endif
  ; was moveq.l #0,d0, but I don't think that's what was desired */
diff -c ./cookie.h ../../vmint/vmint/cookie.h
*** ./cookie.h	Mon Aug 21 23:34:14 1995
--- ../../vmint/vmint/cookie.h	Tue Aug 22 09:41:36 1995
***************
*** 15,21 ****
--- 15,25 ----
  
  typedef struct cookie COOKIE;
  
+ #ifndef	VMINT
  #define CJAR	   ((COOKIE **) 0x5a0)
+ #else
+ #define CJAR	   ((COOKIE **) 0x45a0)
+ #endif
  
  
  /* List of currently available tag values */
diff -c ./debug.c ../../vmint/vmint/debug.c
*** ./debug.c	Mon Aug 21 23:34:14 1995
--- ../../vmint/vmint/debug.c	Wed Aug 23 22:51:00 1995
***************
*** 386,392 ****
--- 386,396 ----
  	char *lp;
  	char *lptemp;
  
+ #ifndef	VMINT
  	logtime[logptr] = (short)(*(long *)0x4baL);
+ #else
+ 	logtime[logptr] = (short)(*(long *)0x54baL);
+ #endif
  	lp = logbuf[logptr];
  	if (++logptr == LBSIZE) logptr = 0;
  
***************
*** 579,585 ****
--- 583,591 ----
  			extern int no_mem_prot;
  			if (!no_mem_prot)
  				restr_mmu();
+ #ifndef	VMINT
  			restr_screen();
+ #endif
  			(void)Super((void *)tosssp);	/* gratuitous (void *) for Lattice */
  #ifdef PROFILING
  			_exit(0);
***************
*** 647,653 ****
--- 653,661 ----
  			}
  			if (!no_mem_prot)
  				restr_mmu();
+ #ifndef	VMINT
  			restr_screen();
+ #endif
  			(void)Super((void *)tosssp);	/* gratuitous (void *) for Lattice */
  #ifdef PROFILING
  			_exit(0);
diff -c ./dosfile.c ../../vmint/vmint/dosfile.c
*** ./dosfile.c	Mon Aug 21 23:34:14 1995
--- ../../vmint/vmint/dosfile.c	Thu Aug 31 00:39:24 1995
***************
*** 1155,1160 ****
--- 1155,1162 ----
  		return 0;
  	case FSTAT:
  		return (*f->fc.fs->getxattr)(&f->fc, (XATTR *)arg);
+ 	case F_GETOPENS:
+ 		return get_opens (&f->fc, (struct listopens *)arg);
  	case F_SETLK:
  	case F_SETLKW:
  	/* make sure that the file was opened with appropriate permissions */
***************
*** 1167,1174 ****
  				return EACCDN;
  		}
  		/* fall through to device ioctl */
- 	case F_GETOPENS:
- 		return get_opens (&f->fc, (struct listopens *)arg);
  	default:
  		TRACE(("Fcntl mode %x: calling ioctl",cmd));
  		if (is_terminal(f)) {
--- 1169,1174 ----
***************
*** 1345,1350 ****
--- 1345,1351 ----
  		mask = mask << 1L;
  	}
  
+ #ifndef	VMINT
  #if 1
  /* GEM kludges part #xxx :(
   *
***************
*** 1374,1379 ****
--- 1375,1381 ----
  		}
  	}
  #endif
+ #endif
  	if (count == 0) {	/* no data is ready yet */
  		if (timeout && !t) {
  			t = addtimeout((long)timeout, unselectme);
***************
*** 1523,1528 ****
--- 1525,1531 ----
  f_midipipe(pid, in, out)
  	int pid, in, out;
  {
+ #ifndef	VMINT
  	PROC *p;
  	FILEPTR *fin, *fout;
  
***************
*** 1556,1559 ****
--- 1559,1565 ----
  	(void)do_pclose(p, p->midiout);
  	p->midiin = fin; p->midiout = fout;
  	return 0;
+ #else
+ 	return EFILNF;
+ #endif
  }
diff -c ./dosmem.c ../../vmint/vmint/dosmem.c
*** ./dosmem.c	Mon Aug 21 23:34:14 1995
--- ../../vmint/vmint/dosmem.c	Tue Aug 22 10:16:42 1995
***************
*** 122,127 ****
--- 122,128 ----
  
  	TRACE(("Mxalloc(%ld,%x)",size,mode));
  
+ #ifndef	VMINT
  /*
   * AKP: Hack here: if the calling process' PC is in ROM, then this is a
   * Malloc call made by VDI's v_opnvwk routine.  So we change mode to
***************
*** 146,151 ****
--- 147,154 ----
  		TRACE(("m_xalloc: VDI special (call from ROM)"));
  	    }
  	}
+ #endif
+ 
  /*
   * If the mode argument comes in a zero, then set it to the default
   * value from prgflags.  Otherwise subtract one from it to bring it
***************
*** 342,350 ****
--- 345,355 ----
  	char localname[PNAMSIZ+1];
  	XATTR xattr;
  	int newpid;
+ #ifndef	VMINT
  #ifndef MULTITOS
  	extern BASEPAGE *gem_base;
  #endif
+ #endif
  
  #ifdef DEBUG_INFO
  /* tfmt and tail_offs are used for debugging only */
***************
*** 413,418 ****
--- 418,424 ----
  		    DEBUG (("Pexec: invalid protection mode changed to private"));
  		    flags = (flags & ~F_PROTMODE) | F_PROT_P;
  		}
+ #ifndef	VMINT
  #ifndef MULTITOS
  		if ((flags & F_PROTMODE) == 0 && curproc->base == gem_base)
  		  {
***************
*** 420,425 ****
--- 426,432 ----
  		    TRACE (("p_exec: AES special"));
  		  }
  #endif
+ #endif
  					/* and fall through */
  	case 5:
  		mkbase = 1;
***************
*** 623,629 ****
  
  		if (ptrace)
  			p->ptracer = pid2proc(p->ppid);
! 
  #ifdef MULTITOS
  	/* Stephan Haslbeck: GEM kludge no. x+1
  	 * If a program is started by AESSYS, reset its euid/egid,
--- 630,636 ----
  
  		if (ptrace)
  			p->ptracer = pid2proc(p->ppid);
! #ifndef	VMINT
  #ifdef MULTITOS
  	/* Stephan Haslbeck: GEM kludge no. x+1
  	 * If a program is started by AESSYS, reset its euid/egid,
***************
*** 635,641 ****
  			p->egid = p->sgid = p->rgid;
  		}
  #endif
! 
  	/* Even though the file system won't allow unauthorized access
  	 * to setuid/setgid programs, it's better to err on the side of
  	 * caution and forbid them to be traced (since the parent can arrange
--- 642,648 ----
  			p->egid = p->sgid = p->rgid;
  		}
  #endif
! #endif
  	/* Even though the file system won't allow unauthorized access
  	 * to setuid/setgid programs, it's better to err on the side of
  	 * caution and forbid them to be traced (since the parent can arrange
diff -c ./dossig.c ../../vmint/vmint/dossig.c
*** ./dossig.c	Mon Aug 21 23:34:16 1995
--- ../../vmint/vmint/dossig.c	Tue Aug 22 10:18:44 1995
***************
*** 287,292 ****
--- 287,298 ----
  			break;
  #endif
  		}
+ 
+ /*
+  * For VMINT, probably the best thing to do is remove sig_user support
+  * entirely. For now, though, this will have to do...
+  */
+ #ifndef	VMINT
  	/*
  	 * Clear in-service bit for ST MFP interrupts
  	 */
***************
*** 301,306 ****
--- 307,313 ----
  
  		*mfp = ~c;
  	}
+ #endif
  }
  
  /*
diff -c ./filesys.c ../../vmint/vmint/filesys.c
*** ./filesys.c	Mon Aug 21 23:34:16 1995
--- ../../vmint/vmint/filesys.c	Mon Aug 28 15:47:30 1995
***************
*** 26,32 ****
--- 26,34 ----
  
  FILESYS *active_fs;
  FILESYS *drives[NUM_DRIVES];
+ #ifndef	VMINT
  extern FILESYS tos_filesys;	/* declaration needed for debugging only */
+ #endif
  
  /* "aliased" drives are different names
   * for real drives/directories
***************
*** 96,102 ****
--- 98,109 ----
  {
  	static FILEPTR initial[NUMFPS+1];
  	int i;
+ #ifndef	VMINT
  	extern FILESYS tos_filesys, bios_filesys, pipe_filesys,
+ #else
+ 	extern void minixfs_init(void);
+ 	extern FILESYS minix_filesys, bios_filesys, pipe_filesys,
+ #endif
  		proc_filesys, uni_filesys;
  
  /* get the vector of connected GEMDOS drives */
***************
*** 114,127 ****
--- 121,144 ----
  	flist = initial;
  
  /* set up the file systems */
+ #ifndef	VMINT
  	tos_filesys.next = 0;
  	bios_filesys.next = &tos_filesys;
+ #else
+ 	minix_filesys.next = 0;
+ 	bios_filesys.next = &minix_filesys;
+ #endif
  	pipe_filesys.next = &bios_filesys;
  	proc_filesys.next = &pipe_filesys;
  	uni_filesys.next = &proc_filesys;
  
  	active_fs = &uni_filesys;
  
+ #ifdef	VMINT
+ /* initialise the Minix file system */
+ 	minixfs_init();
+ #endif
+ 
  /* initialize the BIOS file system */
  	biosfs_init();
  
***************
*** 155,161 ****
   * processes are run
   *
   * NOTE that a number of directory changes take place here: we look first
!  * in the current directory, then in the directory \mint.
   */
  
  typedef FILESYS * ARGS_ON_STACK (*FSFUNC) P_((struct kerinfo *));
--- 172,180 ----
   * processes are run
   *
   * NOTE that a number of directory changes take place here: we look first
!  * in the current directory, then for a normal MINT kernel we look in the
!  * directory \mint. Under VMINT, we know that drive 'c' is always going
!  * to be the boot drive, so we check for /c/mint then /c/etc/mint.
   */
  
  typedef FILESYS * ARGS_ON_STACK (*FSFUNC) P_((struct kerinfo *));
***************
*** 164,170 ****
--- 183,193 ----
   *     load_devdriver() need access to it.
   */
  #define NPATHS 3
+ #ifndef	VMINT
  static const char *const ext_paths[NPATHS] = {"", "\\MINT", "\\MULTITOS"};
+ #else
+ static const char *const ext_paths[NPATHS] = {"", "\\mint", "\\etc\\mint"};
+ #endif
  
  void
  load_filesys()
diff -c ./inline.h ../../vmint/vmint/inline.h
*** ./inline.h	Mon Aug 21 23:34:16 1995
--- ../../vmint/vmint/inline.h	Wed Aug 23 21:59:38 1995
***************
*** 34,39 ****
--- 34,40 ----
      : "d"(N) ); })
  
  
+ #if 1
  /*
   * note that we must save some registers ourselves,
   * or else gcc will run out of reggies to use
***************
*** 90,95 ****
--- 91,107 ----
  	);					\
  	retvalue;				\
  })
+ 
+ #else /* VMINT */
+ 
+ /*
+  * For VMINT, we can safely call a VTOS function without worrying
+  * about registers being clobbered. Plus it makes things go faster :)
+  */
+ #define callout1(func, a)		((long (*)(short))(func)((a)))
+ #define callout2(func, a, b)	((long (*)(short, short))(func)((a),(b)))
+ 
+ #endif
  
  #define flush_pmmu() __asm__ volatile("pflusha");
  #endif
diff -c ./intr.spp ../../vmint/vmint/intr.spp
*** ./intr.spp	Mon Aug 21 23:38:52 1995
--- ../../vmint/vmint/intr.spp	Wed Aug 23 23:21:14 1995
***************
*** 71,77 ****
--- 71,81 ----
  
  _mint_vbl:
  %ifndef ONLY030
+ %ifndef	VMINT
  	tst.w	($59e).w		; test longframe (AKP)
+ %else
+ 	tst.w	($459e).w		; test longframe (AKP)
+ %endif
  	beq.s	L_short1
  %endif
  	clr.w	-(sp)			; yes, long frames: push a frame word
***************
*** 97,103 ****
--- 101,112 ----
  L_expired:
  	btst	#5,(sp)			; user mode?
  	bne.s	L_out			; no -- switching is not possible
+ %ifndef	VMINT
  	tst.w	($43e).w		; test floppy disk lock variable
+ %else
+ ; This isn't strictly required for VMINT
+ 	tst.w	($443e).w		; test floppy disk lock variable
+ %endif
  	bne.s	L_out			; if locked, can't switch
  	tst.w	_in_kernel		; are we doing a kernel operation?
  	bne.s	L_out
***************
*** 157,162 ****
--- 166,172 ----
  	move.l	(4).w,a6		; get new reboot address
  	jmp	_reset
  
+ %ifndef	VMINT
  ;
  ; routine for mouse packet handling
  ;
***************
*** 234,239 ****
--- 244,251 ----
  	move.l	_old_ikbd+8,-(sp)
  	rts			; jump to system interrupt routine
  
+ %endif
+ 
  ; Generic routine for handling any user-specified interrupts. On 68000, the
  ; vector number is stored in the high byte of the program counter.
  ;
***************
*** 244,250 ****
--- 256,266 ----
  	movem.l	d0-d2/a0-a2,-(sp)	; save regs
  
  %ifndef ONLY030
+ %ifndef	VMINT
  	tst.w	($59e).w	; is frame format on stack?
+ %else
+ 	tst.w	($459e).w	; is frame format on stack?
+ %endif
  	bne.s	nvec		; yes, go use it
  	bsr.s	ndummy		; push PC to stack
  	nop
***************
*** 274,279 ****
--- 290,298 ----
  	XDEF	_new_bus,_new_addr,_new_ill,_new_divzero,_new_priv,_new_linef
  	XDEF	_new_trace,_new_chk,_new_trapv,_new_fpcp,_new_mmu,_new_pmmuacc
  	XDEF	_new_uninit,_new_spurious,_new_format,_new_cpv
+ %ifdef	VMINT
+ 	XREF	_new_linea
+ %endif
  	XREF	_in_kernel,_sig_routine
  	XREF	_sigbus,_sigaddr,_sigill,_sigfpe,_sigpriv,_sigtrap
  	XREF	_haltformat,_haltcpv
***************
*** 370,376 ****
--- 389,399 ----
  	move.l	_curproc,a0
  	move.l	P_EXCSSP(a0),a1
  	lea	$10(a1),a1		; point to access address
+ %ifndef	VMINT
  	tst.w	($59e).w		; test longframe
+ %else
+ 	tst.w	($459e).w		; test longframe
+ %endif
  	beq.s	NOMMU1
  	addq.w	#8,a1			; on 68000, address is 8 bytes further
  NOMMU1:
***************
*** 402,407 ****
--- 425,438 ----
  %endif
  	move.l	#_sigill,_sig_routine
  	bra	Do_sig
+ %ifdef	VMINT
+ _new_linea:
+ %ifndef ONLY030
+ 	move.w	#$28,_sig_exc
+ %endif
+ 	move.l	#_sigill,_sig_routine
+ 	bra	Do_sig
+ %endif
  _new_chk:
  %ifndef ONLY030
  	move.w	#$18,_sig_exc
***************
*** 452,458 ****
--- 483,493 ----
  %endif
  	move.l	#_sigpriv,_sig_routine
  %ifndef ONLY030
+ %ifndef	VMINT
  	tst.w	($59e).w		; 68000s always get SIGPRIV
+ %else
+ 	tst.w	($459e).w		; 68000s always get SIGPRIV
+ %endif
  	beq	Do_sig
  %endif
  	movem.l	d0/a0,-(a7)
***************
*** 572,577 ****
--- 607,613 ----
  	moveq.l	#0,d0		; 0 means "successful operation"
  	rts
  
+ %ifndef	VMINT
  	DATA
  ; buffer for faked mouse packet (actually only 3 bytes)
  
***************
*** 581,585 ****
--- 617,622 ----
  ; here we store the additional button state
  third_button:
  	dc.w	0
+ %endif
  
  	END
diff -c ./main.c ../../vmint/vmint/main.c
*** ./main.c	Mon Aug 21 23:34:16 1995
--- ../../vmint/vmint/main.c	Tue Aug 29 21:07:34 1995
***************
*** 17,24 ****
--- 17,26 ----
  /* the kernel's stack size */
  #define STACK	8*1024L
  
+ #ifndef	VMINT
  /* if the user is holding down the magic shift key, we ask before booting */
  #define MAGIC_SHIFT 0x2		/* left shift */
+ #endif
  
  /* magic number to show that we have captured the reset vector */
  #define RES_MAGIC 0x31415926L
***************
*** 30,35 ****
--- 32,38 ----
  #endif
  void shutdown P_((void));
  static long ARGS_ON_STACK mint_criticerr P_((long));
+ #ifndef	VMINT
  static void ARGS_ON_STACK do_exec_os P_((register long basepage));
  
  static int gem_active;	/* 0 if AES has not started, nonzero otherwise */
***************
*** 37,42 ****
--- 40,46 ----
  #define EXEC_OS 0x4feL
  static int  check_for_gem P_((void));
  static void run_auto_prgs P_((void));
+ #endif /* VMINT */
  
  #ifdef LATTICE
  /*
***************
*** 78,84 ****
--- 82,90 ----
  #endif
  #endif
  
+ #ifndef	VMINT
  int curs_off = 0;	/* set if we should turn the cursor off when exiting */
+ #endif
  int mint_errno = 0;	/* error return from open and creat filesystem calls */
  
  /*
***************
*** 94,99 ****
--- 100,106 ----
   */
  long mch = 0;
  
+ #ifndef	VMINT
  /*
   * "screen_boundary+1" tells us how screens must be positioned
   * (to a 256 byte boundary on STs, a 16 byte boundary on other
***************
*** 102,107 ****
--- 109,115 ----
   * we're using this as a mask in the ROUND() macro in mem.h.
   */
  int screen_boundary = 255;
+ #endif
  
  /*
   * variable holds processor type
***************
*** 118,123 ****
--- 126,132 ----
   */
  int flk = 0;
  
+ #ifndef	VMINT
  /*
   * variable set to 1 if the _VDO cookie indicates Falcon style video
   */
***************
*** 131,136 ****
--- 140,146 ----
  BASEPAGE *gem_base = 0;
  long gem_start = 0;
  #endif
+ #endif /* VMINT */
  static const char *init_prg = 0;
  
  /* note: init_tail is also used as a temporary stack for resets in
***************
*** 155,163 ****
--- 165,175 ----
  /* version of TOS we're running over */
  int tosvers;
  
+ #ifndef	VMINT
  /* structures for keyboard/MIDI interrupt vectors */
  KBDVEC *syskey, oldkey;
  xbra_vec old_ikbd;			/* old ikbd vector */
+ #endif
  
  /* values the user sees for the DOS, BIOS, and XBIOS vectors */
  long save_dos, save_bios, save_xbios;
***************
*** 165,171 ****
--- 177,185 ----
  /* values for original system vectors */
  xbra_vec old_dos, old_bios, old_xbios, old_timer, old_vbl, old_5ms;
  xbra_vec old_criticerr;
+ #ifndef	VMINT
  xbra_vec old_execos;
+ #endif
  
  long old_term;
  
***************
*** 177,182 ****
--- 191,199 ----
  xbra_vec old_bus, old_addr, old_ill, old_divzero, old_trace, old_priv;
  xbra_vec old_linef, old_chk, old_trapv, old_mmuconf, old_format, old_cpv;
  xbra_vec old_uninit, old_spurious, old_fpcp[7], old_pmmuill, old_pmmuacc;
+ #ifdef	VMINT
+ xbra_vec old_linea;
+ #endif
  #endif
  
  /* BIOS disk vectors */
***************
*** 265,270 ****
--- 282,288 ----
  	return (*curproc->criticerr)(error);
  }
  
+ #ifndef	VMINT
  /*
   * if we are MultiTOS, and if we are running from the AUTO folder,
   * then we grab the exec_os vector and use that to start GEM; that
***************
*** 300,305 ****
--- 318,324 ----
  		Pterm((int)r);
  	}
  }
+ #endif /* VMINT */
  
  
  /* initialize all interrupt vectors and new trap routines
***************
*** 318,324 ****
--- 337,345 ----
  	extern long ARGS_ON_STACK mint_5ms();
  	extern long ARGS_ON_STACK mint_xbios();
  	extern long ARGS_ON_STACK reset();
+ #ifndef	VMINT
    	extern long ARGS_ON_STACK new_ikbd();
+ #endif
    	extern long ARGS_ON_STACK new_bus();
    	extern long ARGS_ON_STACK new_addr();
    	extern long ARGS_ON_STACK new_ill();
***************
*** 326,331 ****
--- 347,355 ----
    	extern long ARGS_ON_STACK new_trace();
    	extern long ARGS_ON_STACK new_priv();
    	extern long ARGS_ON_STACK new_linef();
+ #ifdef	VMINT
+   	extern long ARGS_ON_STACK new_linea();
+ #endif
    	extern long ARGS_ON_STACK new_chk();
    	extern long ARGS_ON_STACK new_trapv();
    	extern long ARGS_ON_STACK new_fpcp();
***************
*** 338,348 ****
--- 362,381 ----
  	short savesr;
  	int i;
  
+ #ifndef	VMINT
  	syskey = (KBDVEC *)Kbdvbase();
  	oldkey = *syskey;
  
  	xbra_install(&old_ikbd, (long)(&syskey->ikbdsys), new_ikbd);
+ #endif
  
+ #ifdef	VMINT
+ /*
+  * Note that although Setexc(0x102 ...) refers to addres 0x408, the
+  * VTOS implementation of Setexc() will modify this so it refers to
+  * the _real_ vector in VTOS system variables (0x4400 -> 0x4600)
+  */
+ #endif
  /* gratuitous (void *) for Lattice */
  	old_term = (long)Setexc(0x102, (void *)-1UL);
  
***************
*** 357,362 ****
--- 390,396 ----
  	xbra_install(&old_xbios, 0xb8L, mint_xbios);
  	save_xbios = (long)old_xbios.next;
  
+ #ifndef	VMINT
  	xbra_install(&old_timer, 0x400L, mint_timer);
  	xbra_install(&old_criticerr, 0x404L, mint_criticerr);
  	xbra_install(&old_5ms, 0x114L, mint_5ms);
***************
*** 364,378 ****
--- 398,442 ----
  	xbra_install(&old_resvec, 0x42aL, reset);
  	old_resval = *((long *)0x426L);
  	*((long *)0x426L) = RES_MAGIC;
+ #else
+ 	xbra_install(&old_timer, 0x4400L, mint_timer);
+ 	xbra_install(&old_criticerr, 0x4404L, mint_criticerr);
+ 	xbra_install(&old_5ms, 0x124L, mint_5ms);
+ 	xbra_install(&old_vbl, 0x120L, mint_vbl);
+ 	xbra_install(&old_resvec, 0x442aL, reset);
+ 	old_resval = *((long *)0x4426L);
+ 	*((long *)0x4426L) = RES_MAGIC;
+ #endif
  
  	spl(savesr);
  
  #ifdef EXCEPTION_SIGS
  /* set up signal handlers */
+ #ifdef	VMINT
+ 	/*
+ 	 * install new buserr handler only if not debugging the kernel.
+ 	 * (indicated by non-zero 0xfffe0000 in NV-RAM
+ 	 */
+ 	if ( *((char *)0xfffe0000) == 0 )
+ #endif
  	xbra_install(&old_bus, 8L, new_bus);
  	xbra_install(&old_addr, 12L, new_addr);
+ #ifdef	VMINT
+ 	/*
+ 	 * install new buserr handler only if not debugging the kernel.
+ 	 * (indicated by non-zero 0xfffe0000 in NV-RAM
+ 	 */
+ 	if ( *((char *)0xfffe0000) == 0 )
+ #endif
  	xbra_install(&old_ill, 16L, new_ill);
  	xbra_install(&old_divzero, 20L, new_divzero);
+ #ifdef	VMINT
+ 	/*
+ 	 * install new trace handler only if not debugging the kernel.
+ 	 * (indicated by non-zero 0xfffe0000 in NV-RAM
+ 	 */
+ 	if ( *((char *)0xfffe0000) == 0 )
+ #endif
  	xbra_install(&old_trace, 36L, new_trace);
  	xbra_install(&old_priv, 32L, new_priv);
  	if (tosvers >= 0x106)
***************
*** 389,401 ****
--- 453,475 ----
  	xbra_install(&old_cpv, 52L, new_cpv);
  	xbra_install(&old_uninit, 60L, new_uninit);
  	xbra_install(&old_spurious, 96L, new_spurious);
+ #ifdef	VMINT
+ 	xbra_install(&old_linea, 40L, new_linea);
+ #endif
  #endif
  
  /* set up disk vectors */
+ #ifndef	VMINT
  	xbra_install(&old_mediach, 0x47eL, new_mediach);
  	xbra_install(&old_rwabs, 0x476L, new_rwabs);
  	xbra_install(&old_getbpb, 0x472L, new_getbpb);
  	olddrvs = *((long *)0x4c2L);
+ #else
+ 	xbra_install(&old_mediach, 0x447eL, new_mediach);
+ 	xbra_install(&old_rwabs, 0x4476L, new_rwabs);
+ 	xbra_install(&old_getbpb, 0x4472L, new_getbpb);
+ 	olddrvs = *((long *)0x44c2L);
+ #endif
  
  /* set up cookie jar */
  	oldcookie = *CJAR;	/* CJAR defined in cookie.h */
***************
*** 421,436 ****
--- 495,521 ----
  	int i;
  
  	savesr = spl7();
+ #ifndef	VMINT
  	*syskey = oldkey;		/* restore keyboard vectors */
+ #endif
  	*tosbp = _base;			/* restore GEMDOS basepage pointer */
  	*CJAR = oldcookie;		/* restore old cookie jar */
  
  #ifdef EXCEPTION_SIGS
+ #ifdef	VMINT
+ 	if ( *((char *)0xfffe0000) == 0 )
+ #endif
  	*((long *)0x08L) = (long) old_bus.next;
  	*((long *)0x0cL) = (long) old_addr.next;
+ #ifdef	VMINT
+ 	if ( *((char *)0xfffe0000) == 0 )
+ #endif
  	*((long *)0x10L) = (long) old_ill.next;
  	*((long *)0x14L) = (long) old_divzero.next;
  	*((long *)0x20L) = (long) old_priv.next;
+ #ifdef	VMINT
+ 	if ( *((char *)0xfffe0000) == 0 )
+ #endif
  	*((long *)0x24L) = (long) old_trace.next;
  	if (old_linef.next)
  		*((long *)0x2cL) = (long) old_linef.next;
***************
*** 446,455 ****
--- 531,544 ----
  	*((long *)0x34L) = (long) old_cpv.next;
  	*((long *)0x3cL) = (long) old_uninit.next;
  	*((long *)0x60L) = (long) old_spurious.next;
+ #ifdef	VMINT
+ 	*((long *)0x28L) = (long) old_linea.next;
+ #endif
  #endif
  	*((long *)0x84L) = (long) old_dos.next;
  	*((long *)0xb4L) = (long) old_bios.next;
  	*((long *)0xb8L) = (long) old_xbios.next;
+ #ifndef	VMINT
  	*((long *)0x408L) = old_term;
  	*((long *)0x404L) = (long) old_criticerr.next;
  	*((long *)0x114L) = (long) old_5ms.next;
***************
*** 461,466 ****
--- 550,568 ----
  	*((long *)0x47eL) = (long) old_mediach.next;
  	*((long *)0x472L) = (long) old_getbpb.next;
  	*((long *)0x4c2L) = olddrvs;
+ #else
+ 	*((long *)0x4408L) = old_term;
+ 	*((long *)0x4404L) = (long) old_criticerr.next;
+ 	*((long *)0x0124L) = (long) old_5ms.next;
+ 	*((long *)0x4400L) = (long) old_timer.next;
+ 	*((long *)0x0120L) = (long) old_vbl.next;
+ 	*((long *)0x4426L) = old_resval;
+ 	*((long *)0x442aL) = (long) old_resvec.next;
+ 	*((long *)0x4476L) = (long) old_rwabs.next;
+ 	*((long *)0x447eL) = (long) old_mediach.next;
+ 	*((long *)0x4472L) = (long) old_getbpb.next;
+ 	*((long *)0x44c2L) = olddrvs;
+ #endif
  
  	spl(savesr);
  }
***************
*** 585,590 ****
--- 687,694 ----
  	s_ync();
  }
  
+ #ifndef	VMINT
+ 
  #ifdef AUTO_FIX
  static char *my_name = "MINT.PRG" ;
  
***************
*** 630,635 ****
--- 734,741 ----
  long GEM_memflags = F_FASTLOAD | F_ALTLOAD | F_ALTALLOC | F_PROT_S;
  #endif
  
+ #endif	/* VMINT */
+ 
  #if defined(__GNUC__) || defined(__MINT__)
  int
  main(argc, argv, envp)
***************
*** 674,679 ****
--- 780,786 ----
  	}
  #endif
  
+ #ifndef	VMINT
  /* Ask the user if s/he wants to boot MiNT */
  	if ((Kbshift(-1) & MAGIC_SHIFT) == MAGIC_SHIFT) {
  		yn = boot_kernel_p();
***************
*** 685,690 ****
--- 792,798 ----
  	if (argv[0][0] == 0) {	/* maybe started from the desktop */
  		curs_off = 1;
  	}
+ #endif
  
  	yn = 0; /* by default, don't print basepage */
  	--argc, ++argv;
***************
*** 748,754 ****
--- 856,864 ----
      	    ksprintf(buf,"MiNT@%lx\r\nhit a key...",_base);
  	    Cconws(buf);
  	    (void)Crawcin();
+ #ifndef	VMINT
  	    Cconws("\r\033K");
+ #endif
  	}
  
  #ifdef notdef
***************
*** 760,765 ****
--- 870,877 ----
  	}
  #endif
  
+ #ifndef	VMINT
+ 
  #ifndef AUTO_FIX
  /* look for ourselves as \AUTO\MINTNP.PRG; if so, we turn memory
   * protection off
***************
*** 786,801 ****
--- 898,920 ----
  	}
  #endif
  
+ #endif	/* VMINT */
+ 
  /*
   * get the current directory, so that we can switch back to it after
   * the file systems are properly initialized
   */
+ #ifndef	VMINT
  /* set the current directory for the current process */
  	Dgetpath(curpath, 0);
  	if (!*curpath) {
  		curpath[0] = '\\';
  		curpath[1] = 0;
  	}
+ #else
+ 	curpath[0] = '\\';
+ 	curpath[1] = 0;
+ #endif
  	tosssp = (long)Super(0L);	/* enter supervisor mode */
  	if (!no_mem_prot)
  		save_mmu();		/* save current MMU setup */
***************
*** 805,811 ****
--- 924,934 ----
     date, and (in newer versions of TOS) where the current basepage pointer
     is kept; in older versions of TOS, it's at 0x602c
   */
+ #ifndef	VMINT
  	sysbase = *((long **)(0x4f2L));	/* gets the RAM OS header */
+ #else
+ 	sysbase = *((long **)(0x44f2L));/* gets the RAM OS header */
+ #endif
  	sysbase = (long *)sysbase[2];	/* gets the ROM one */
  
  	tosvers = (int)(sysbase[0] & 0x0000ffff);
***************
*** 858,866 ****
   */
  	init_intr();
  
- 	Cconws("DBG: Entering Kernel\r\n");
  	enter_kernel(1);	/* we'll be making GEMDOS calls */
  
  #if 0
  	if (!gem_active) {
  /* make MiNT invisible in the basepage chain, so that
--- 981,989 ----
   */
  	init_intr();
  
  	enter_kernel(1);	/* we'll be making GEMDOS calls */
  
+ #ifndef	VMINT
  #if 0
  	if (!gem_active) {
  /* make MiNT invisible in the basepage chain, so that
***************
*** 874,883 ****
  		rootproc->base = _base->p_parent;
  	} else
  #endif
  		rootproc->base = _base;
  
- 	Cconws("DBG: Creating devs\r\n");
- 
  /* set up standard file handles for the current process
   * do this here, *after* init_intr has set the Rwabs vector,
   * so that AHDI doesn't get upset by references to drive U:
--- 997,1005 ----
  		rootproc->base = _base->p_parent;
  	} else
  #endif
+ #endif
  		rootproc->base = _base;
  
  /* set up standard file handles for the current process
   * do this here, *after* init_intr has set the Rwabs vector,
   * so that AHDI doesn't get upset by references to drive U:
***************
*** 891,897 ****
--- 1013,1023 ----
  	curproc->handle[1] = f;
  	f->links = 3;
  
+ #ifndef	VMINT
  	f = do_open("U:\\DEV\\MODEM1", O_RDWR, 0, (XATTR *)0);
+ #else
+ 	f = do_open("U:\\DEV\\TTY01", O_RDWR, 0, (XATTR *)0);
+ #endif
  	curproc->aux = f;
  	((struct tty *)f->devinfo)->aux_cnt = 1;
  	f->pos = 1;	/* flag for close to --aux_cnt */
***************
*** 911,916 ****
--- 1037,1043 ----
  		curproc->handle[3] = curproc->prn = f;
  		f->links = 2;
  	}
+ #ifndef	VMINT
  	f = do_open("U:\\DEV\\MIDI", O_RDWR, 0, (XATTR *)0);
  	if (f) {
  		curproc->midiin = curproc->midiout = f;
***************
*** 918,932 ****
  		f->pos = 1;	/* flag for close to --aux_cnt */
  		f->links = 2;
  	}
  
  /* load external file systems */
  /* set path first to make sure that MiNT's directory matches
   * GEMDOS's
   */
- 	Cconws("DBG: Set path #1\r\n");
  	d_setpath(curpath);
  
- 	Cconws("DBG: Loading Device Drivers\r\n");
  	load_devdriver();
  
  #ifndef PROFILING
--- 1045,1058 ----
  		f->pos = 1;	/* flag for close to --aux_cnt */
  		f->links = 2;
  	}
+ #endif
  
  /* load external file systems */
  /* set path first to make sure that MiNT's directory matches
   * GEMDOS's
   */
  	d_setpath(curpath);
  
  	load_devdriver();
  
  #ifndef PROFILING
***************
*** 937,954 ****
  /* note that load_filesys changed the
   * directory on us!!
   */
- 	Cconws("DBG: Set path #2\r\n");
  	d_setpath(curpath);
  	
  /* load the configuration file */
- 	Cconws("DBG: Set path #1\r\n");
  	load_config();
  
  /* start system update daemon */
! 	Cconws("DBG: Starting sysupdate\r\n");
! 	start_sysupdate();
! 
  	*((long *)0x4c2L) |= PSEUDODRVS;
  
  	if (init_env == 0)
  		init_env = (char *)_base->p_env;
--- 1063,1087 ----
  /* note that load_filesys changed the
   * directory on us!!
   */
  	d_setpath(curpath);
  	
  /* load the configuration file */
  	load_config();
  
  /* start system update daemon */
! 	if (sync_time > 0) {
! #ifdef SYSUPDATE_DAEMON
! 		start_sysupdate();
! #else
! 		addroottimeout(1000l*sync_time, do_sync, 0);
! #endif
! 	}
!   
! #ifndef	VMINT
  	*((long *)0x4c2L) |= PSEUDODRVS;
+ #else
+ 	*((long *)0x44c2L) |= PSEUDODRVS;
+ #endif
  
  	if (init_env == 0)
  		init_env = (char *)_base->p_env;
***************
*** 960,965 ****
--- 1093,1099 ----
  		init_env = path_env;
  	}
  
+ #ifndef	VMINT
  /* if we are MultiTOS, we're running in the AUTO folder, and our INIT is
   * in fact GEM, take the exec_os() vector. (We know that INIT is GEM
   * if the user told us so by using GEM= instead of INIT=.)
***************
*** 969,983 ****
  	}
  
  /* run any programs appearing after us in the AUTO folder */
- 	Cconws("DBG: Running auto_prgs\r\n");
  	run_auto_prgs();
  
  /* prepare to run the init program as PID 1. */
- 	Cconws("DBG: Setting pid_1\r\n");
  	set_pid_1();
  
  /* run the initial program */
! /* if that program is in fact GEM, we start it via exec_os, otherwise
   * we do it with Pexec.
   * the logic is: if the user specified init_prg, and it is not
   * GEM, then we try to execute it; if it *is* GEM (e.g. gem.sys),
--- 1103,1117 ----
  	}
  
  /* run any programs appearing after us in the AUTO folder */
  	run_auto_prgs();
+ #endif
  
  /* prepare to run the init program as PID 1. */
  	set_pid_1();
  
  /* run the initial program */
! /* but if we're a normal MINT kernel, as opposed to VMINT, and if
!  * that program is in fact GEM, we start it via exec_os, otherwise
   * we do it with Pexec.
   * the logic is: if the user specified init_prg, and it is not
   * GEM, then we try to execute it; if it *is* GEM (e.g. gem.sys),
***************
*** 986,991 ****
--- 1120,1126 ----
   * order to start it. We *never* go through exec_os if we're not in
   * the AUTO folder.
   */
+ #ifndef	VMINT
  	if (init_prg && (!init_is_gem || gem_active)) {
  		r = p_exec(0, (char *)init_prg, init_tail, init_env);
  	} else if (!gem_active) {   
***************
*** 1012,1017 ****
--- 1147,1166 ----
  			r = 0;
  	}
  
+ #else /* VMINT */
+ 
+ 	if (!init_prg) {
+ 		Cconws("No INIT program specified. Defaulting to /bin/init\r\n");
+ 		init_prg = "\\bin\\init";
+ 	}
+ 	if ( (r = p_exec(0, (char *)init_prg, init_tail, init_env)) < 0 ) {
+ 		Cconws("Unable to run INIT program. Trying /bin/sh ...\r\n");
+ 		init_prg = "\\bin\\sh";
+ 		r = p_exec(0, (char *)init_prg, init_tail, init_env);
+ 	}
+ 
+ #endif /* VMINT */
+ 
  	if (r < 0 && init_prg) {
  		ksprintf(buf, "FATAL: couldn't run %s\r\n", init_prg);
  		Cconws(buf);
***************
*** 1028,1048 ****
--- 1177,1203 ----
  	shutdown();
  
  /* put everything back and exit */
+ #ifndef	VMINT
  	if (!gem_active && init_is_gem) {
  	/* we stole exec_os above */
  		*((long *)EXEC_OS) = (long)old_execos.next;
  	}
+ #endif
  	restr_intr();
  	close_filesys();
  	if (!no_mem_prot)
  		restr_mmu();
+ #ifndef	VMINT
  	restr_screen();
+ #endif
  
  	(void)Super((void *)tosssp);	/* gratuitous (void *) for Lattice */
  	Cconws("leaving MiNT\r\n");
  
+ #ifndef	VMINT
  	if (curs_off)
  		Cconws("\033f");	/* disable cursor */
+ #endif
  
  	return 0;
  }
***************
*** 1069,1075 ****
--- 1224,1232 ----
  	COOKIE *cookie;
  	int i, ncookies;
  	long ncsize;
+ #ifndef	VMINT
  	extern long rsvf;
+ #endif
  
  	/* note that init_intr sets oldcookie to the old cookie jar */
  
***************
*** 1084,1092 ****
--- 1241,1251 ----
  		/* check for _FLK cookie */
  			else if (cookie->tag == COOKIE__FLK)
  				flk = 1;
+ #ifndef	VMINT
  		/* ..and for RSVF */
  			else if (cookie->tag == COOKIE_RSVF)
  				rsvf = cookie->value;
+ #endif
  			cookie++; ncookies++;
  		}
  	}
***************
*** 1186,1195 ****
--- 1345,1356 ----
  				mcpu = jar->value;
  	    			if (jar->value != 30) no_mem_prot = 1;
  	    			foundcpu = 1;
+ #ifndef	VMINT
  			} else if (jar->tag == COOKIE__VDO) {
  				FalconVideo = (jar->value == 0x00030000L);
  				if (jar->value & 0xffff0000L)
  					screen_boundary = 15;
+ #endif
  			} else if (jar->tag == COOKIE_MiNT) {
  				Cconws("MiNT is already installed!!\r\n");
  				Pterm(2);
***************
*** 1209,1215 ****
--- 1370,1380 ----
   * if no preference found, look at the country code to decide
   */
  	if (gl_lang < 0) {
+ #ifndef	VMINT
  		sysbase = *((long **)(0x4f2L)); /* gets the RAM OS header */
+ #else
+ 		sysbase = *((long **)(0x44f2L));/* gets the RAM OS header */
+ #endif
  		sysbase = (long *)sysbase[2];	/* gets the ROM one */
  		i = (int) ((sysbase[7] & 0x7ffe0000L) >> 17L);
  		switch(i) {
***************
*** 1263,1268 ****
--- 1428,1435 ----
   * BUG: if you use setenv in mint.cnf, *none* of the original environment
   * gets passed to children. This is rarely a problem if mint.prg is
   * in the auto folder.
+  * In VMINT, 'HARDSCROLL' is silently ignored, 'GEM' is ignored, but a
+  * warning message is printed.
   */
  
  extern short bconbdev, bconbsiz;	/* from bios.c */
***************
*** 1273,1284 ****
--- 1440,1458 ----
  	char *t;
  
  	if (!strcmp(name, "GEM")) {
+ #ifndef	VMINT
  		init_is_gem = 1;
  		goto setup_init;
+ #else
+ 		FORCE("GEM= not supported under VMINT. Use INIT= instead");
+ 		return;
+ #endif
  	} 
  	if (!strcmp(name, "INIT")) {
+ #ifndef	VMINT
  		init_is_gem = 0;
  setup_init:
+ #endif
  		if (!*val) return;
  		t = kmalloc(strlen(val)+1);
  		if (!t) return;
***************
*** 1366,1371 ****
--- 1540,1546 ----
  		return;
  	}
  
+ #ifndef	VMINT
  #ifdef FASTTEXT
  	if (!strcmp(name, "HARDSCROLL")) {
  		int i;
***************
*** 1384,1389 ****
--- 1559,1565 ----
  		return;
  	}
  #endif
+ #endif
  	if (!strcmp(name, "MAXMEM")) {
  		long r;
  
***************
*** 1626,1641 ****
--- 1802,1824 ----
  {
  	int fd;
  
+ #ifndef	VMINT
  	fd = (int) f_open("mint.cnf", 0);
  	if (fd < 0)
  		fd = (int) f_open("\\mint\\mint.cnf", 0);
  	if (fd < 0)
  		fd = (int) f_open("\\multitos\\mint.cnf", 0);
+ #else
+ 	fd = (int) f_open("\\mint\\mint.cnf", 0);
+ 	if (fd < 0)
+ 		fd = (int) f_open("\\etc\\mint\\mint.cnf", 0);
+ #endif
  	if (fd < 0) return;
  	do_file(fd);
  	f_close(fd);
  }
  
+ #ifndef	VMINT
  /*
   * run programs in the AUTO folder that appear after MINT.PRG
   * some things to watch out for:
***************
*** 1697,1699 ****
--- 1880,1883 ----
  		r = f_snext();
  	}
  }
+ #endif	/* VMINT */
Only in .: main.c.rej
diff -c ./makefile ../../vmint/vmint/makefile
*** ./makefile	Mon Aug 21 23:34:16 1995
--- ../../vmint/vmint/makefile	Tue Oct 17 22:42:44 1995
***************
*** 4,10 ****
  #
  
  #
! # Makefile for MiNT using the GCC
  #
  
  # if you're cross-compiling, define NATIVECC
--- 4,10 ----
  #
  
  #
! # Makefile for MiNT/VMINT using the GCC
  #
  
  # if you're cross-compiling, define NATIVECC
***************
*** 42,47 ****
--- 42,48 ----
  MODEL = -mshort
  MODEL030 = -mshort -m68020
  LIBS = -liio16
+ LIBSVMINT = minixfs/minixfs/minixfs.olb
  
  # add -DDIRSEP_SLASH to make forward slash a path separator in kernel filesystems
  # add -DMULTITOS for a MultiTOS kernel
***************
*** 49,56 ****
  # add -DDEBUG_INFO for debugging information
  # add -DFASTTEXT for the u:\dev\fasttext fast console driver
  
! DEFS = #-DFASTTEXT #-DDEBUG_INFO
  #DEFS030 = -DONLY030
  
  #
  # if you have an older version of gcc, it won't understand -G;
--- 50,59 ----
  # add -DDEBUG_INFO for debugging information
  # add -DFASTTEXT for the u:\dev\fasttext fast console driver
  
! #DEFS = #-DFASTTEXT #-DDEBUG_INFO
  #DEFS030 = -DONLY030
+ #DEFSVMINT = -DVMINT -DDIRSEP_SLASH -DONLY030 -DDEBUG_INFO
+ DEFSVMINT = -DVMINT -DDIRSEP_SLASH -DONLY030 -DNDEBUG
  
  #
  # if you have an older version of gcc, it won't understand -G;
***************
*** 62,67 ****
--- 65,73 ----
  ASFLAGS = $(MODEL)
  CFLAGS030 = -G -Wall -Wmissing-prototypes -O2 -fno-defer-pop -fomit-frame-pointer $(MODEL030) $(DEFS030)
  ASFLAGS030 = $(MODEL030)
+ CFLAGSVMINT = -G -Wall -Wmissing-prototypes -O2 -fno-defer-pop \
+ 	-fomit-frame-pointer $(MODEL030) $(DEFSVMINT)
+ ASFLAGSVMINT = $(MODEL030)
  
  COBJS = bios.o xbios.o console.o dos.o dosdir.o dosfile.o dosmem.o dossig.o \
  	filesys.o main.o mem.o proc.o signal.o timeout.o tty.o util.o \
***************
*** 75,80 ****
--- 81,92 ----
  	unifs.o0 shmfs.o0 fasttext.o0 welcome.o0 nalloc2.o0 memprot.o realloc.o0 \
  	update.o0
  
+ COBJSVMINT = bios.oV xbios.oV console.oV dos.oV dosdir.oV dosfile.oV dosmem.oV dossig.oV \
+ 	filesys.oV main.oV mem.oV proc.oV signal.oV timeout.oV tty.oV util.oV \
+ 	biosfs.oV pipefs.oV procfs.oV debug.oV rendez.oV \
+ 	unifs.oV shmfs.oV welcome.oV nalloc2.oV memprot.o realloc.oV \
+ 	update.oV
+ 
  CFILES = bios.c xbios.c console.c dos.c dosdir.c dosfile.c dosmem.c dossig.c \
  	filesys.c main.c mem.c proc.c signal.c timeout.c tty.c util.c \
  	biosfs.c pipefs.c procfs.c tosfs.c debug.c rendez.c \
***************
*** 90,100 ****
--- 102,115 ----
  
  SOBJS = context.o intr.o syscall.o quickzer.o quickmov.o cpu.o
  SOBJS030 = context.o0 intr.o0 syscall.o0 quickzer.o0 quickmov.o0 cpu.o0
+ SOBJSVMINT = context.oV intr.oV syscall.oV quickzer.oV quickmov.oV cpu.oV
  
  OBJS = $(COBJS) $(SOBJS)
  OBJS030 = $(COBJS030) $(SOBJS030)
+ OBJSVMINT = $(COBJSVMINT) $(SOBJSVMINT)
  
  #all: mint.prg mint030.prg
+ all: vmint.prg
  
  mint.prg: $(OBJS)
  	$(CC) $(CFLAGS) -o mint.prg $(OBJS) $(LIBS)
***************
*** 104,128 ****
  	$(CC) $(CFLAGS030) -o mint030.prg $(OBJS030) $(LIBS)
  #	strip mint030.prg
  
  $(SOBJS): proc.h
  $(COBJS): mint.h proc.h file.h debug.h
  
  $(SOBJS030): proc.h
  $(COBJS030): mint.h proc.h file.h debug.h
  
  main.o: version.h
  welcome.o: version.h
  bios.o: inline.h
  proc.o dos.o: loadave.h
  
  memprot.o: memprot.c mint.h proc.h file.h
! 	$(CC) $(CFLAGS) -m68020 -c memprot.c
  
  main.o0: version.h
  welcome.o0: version.h
  bios.o0: inline.h
  proc.o0 dos.o0: loadave.h
  
  #
  # assembler source files are now handled in a radically different
  # fashion. We build a pre-processor program, asmtrans, that
--- 119,155 ----
  	$(CC) $(CFLAGS030) -o mint030.prg $(OBJS030) $(LIBS)
  #	strip mint030.prg
  
+ vmint.prg: $(OBJSVMINT)
+ 	$(CC) $(CFLAGSVMINT) -o vmint.prg $(OBJSVMINT) $(LIBSVMINT) $(LIBS)
+ 	reloc vmint.prg 0x13100
+ 
  $(SOBJS): proc.h
  $(COBJS): mint.h proc.h file.h debug.h
  
  $(SOBJS030): proc.h
  $(COBJS030): mint.h proc.h file.h debug.h
  
+ $(SOBJSVMINT): proc.h
+ $(COBJSVMINT): mint.h proc.h file.h debug.h
+ 
  main.o: version.h
  welcome.o: version.h
  bios.o: inline.h
  proc.o dos.o: loadave.h
  
  memprot.o: memprot.c mint.h proc.h file.h
! 	$(CC) $(CFLAGSVMINT) -m68020 -c memprot.c
  
  main.o0: version.h
  welcome.o0: version.h
  bios.o0: inline.h
  proc.o0 dos.o0: loadave.h
  
+ main.oV: version.h
+ welcome.oV: version.h
+ bios.oV: inline.h
+ proc.oV dos.oV: loadave.h
+ 
  #
  # assembler source files are now handled in a radically different
  # fashion. We build a pre-processor program, asmtrans, that
***************
*** 191,197 ****
  #
  # assembler source files
  #
! .SUFFIXES: .spp .o0
  
  .spp.o:
  	$(ATRANS) $(DEFS) -gas -o $*.s $<
--- 218,224 ----
  #
  # assembler source files
  #
! .SUFFIXES: .spp .o0 .oV
  
  .spp.o:
  	$(ATRANS) $(DEFS) -gas -o $*.s $<
***************
*** 199,208 ****
  	$(RM) $*.s
  .spp.o0:
  	$(ATRANS) $(DEFS030) -gas -o $*.s $<
! 	$(AS) $(ASFLAGS0) -o $@ -c $*.s
  	$(RM) $*.s
  .c.o0:
  	$(CC) $(CFLAGS030) -o $@ -c $<
  
  context.o: context.spp magic.i $(ATRANS)
  intr.o: intr.spp magic.i $(ATRANS)
--- 226,241 ----
  	$(RM) $*.s
  .spp.o0:
  	$(ATRANS) $(DEFS030) -gas -o $*.s $<
! 	$(AS) $(ASFLAGS030) -o $@ -c $*.s
  	$(RM) $*.s
  .c.o0:
  	$(CC) $(CFLAGS030) -o $@ -c $<
+ .spp.oV:
+ 	$(ATRANS) $(DEFSVMINT) -gas -o $*.s $<
+ 	$(AS) $(ASFLAGSVMINT) $(DEFSVMINT) -o $@ -c $*.s
+ 	$(RM) $*.s
+ .c.oV:
+ 	$(CC) $(CFLAGSVMINT) -o $@ -c $<
  
  context.o: context.spp magic.i $(ATRANS)
  intr.o: intr.spp magic.i $(ATRANS)
***************
*** 218,223 ****
--- 251,263 ----
  quickmov.o0: quickmov.spp $(ATRANS)
  cpu.o0: cpu.spp $(ATRANS)
  
+ context.oV: context.spp magic.i $(ATRANS)
+ intr.oV: intr.spp magic.i $(ATRANS)
+ syscall.oV: syscall.spp magic.i $(ATRANS)
+ quickzer.oV: quickzer.spp $(ATRANS)
+ quickmov.oV: quickmov.spp $(ATRANS)
+ cpu.oV: cpu.spp $(ATRANS)
+ 
  #
  # mkptypes generates prototypes from C source code. If you don't have it,
  # you'll have to add/delete function prototypes by hand.
***************
*** 232,238 ****
  #
  # macros for cleaning up
  #
! GENFILES= $(OBJS) $(OBJS030) $(ATRANSOBJ) $(ATRANS) $(GENMAGICPRG)
  EXTRAS= asmtab.c asmtab.h mint.prg
  
  clean:
--- 272,278 ----
  #
  # macros for cleaning up
  #
! GENFILES= $(OBJS) $(OBJS030) $(OBJSVMINT) $(ATRANSOBJ) $(ATRANS) $(GENMAGICPRG)
  EXTRAS= asmtab.c asmtab.h mint.prg
  
  clean:
diff -c ./mem.c ../../vmint/vmint/mem.c
*** ./mem.c	Mon Aug 21 23:34:16 1995
--- ../../vmint/vmint/mem.c	Tue Aug 29 23:02:54 1995
***************
*** 14,19 ****
--- 14,20 ----
   */
  
  #include "mint.h"
+ #ifndef	VMINT
  #include "fasttext.h" /* for line A stuff */
  
  #ifndef VgetSize
***************
*** 27,34 ****
--- 28,44 ----
  #endif
  #endif
  
+ #endif	/* VMINT */
+ 
  static long core_malloc P_((long, int));
+ #ifndef	VMINT
+ /*
+  * Memory should not be freed back to VTOS, since it _does not maintain_
+  * a pool of memory. VTOS was designed in the knowledge that VMINT would
+  * be doing all the memory management.
+  */
  static void core_free P_((long));
+ #endif
  static void terminateme P_((int code));
  
  /* macro for testing whether a memory region is free */
***************
*** 57,74 ****
--- 67,92 ----
   */
  int num_reg_requests = 0;
  
+ #ifndef	VMINT
  /* these variables are set in init_core(), and used in
   * init_mem()
   */
  static ulong scrnsize, scrnplace;
  static SCREEN *vscreen;
+ #endif
  
  void
  init_mem()
  {
  	int i;
  	MEMREGION *r;
+ #ifndef	VMINT
  	long newbase;
+ #else
+ #if 1
+ 	MEMREGION  sys;
+ #endif
+ #endif
  
  	use_regions[NREGIONS].next = 0;
  	for (i = 0; i < NREGIONS; i++) {
***************
*** 81,86 ****
--- 99,119 ----
  
  	init_tables();		    /* initialize MMU constants */
  
+ #ifdef	VMINT
+ 	/*
+ 	 * This should be in the normal kernel, but...
+ 	 * Make a fake region starting at zero, ending at the page just
+ 	 * before the first core region. This is the region containing
+ 	 * system variables, VTOS and VMINT. Give the whole lot protection
+ 	 * mode PROT_S.
+ 	 */
+ #if 1
+ 	sys.loc = 0;
+ 	sys.len = 0x4000;
+ 	mark_region(&sys, PROT_S);
+ #endif
+ #endif
+ 
  	/* mark all the regions in the core & alt lists as "invalid" */
  	for (r = *core; r; r = r->next) {
  	    mark_region(r,PROT_I);
***************
*** 89,94 ****
--- 122,128 ----
  	    mark_region(r,PROT_I);
  	}
  
+ #ifndef	VMINT
  	/* make sure the screen is set up properly */
  	newbase = s_realloc(scrnsize);
  
***************
*** 120,127 ****
--- 154,163 ----
  	/* fix the cursor */
  		Cconws("\r\n"); 
  	}
+ #endif
  }
  
+ #ifndef	VMINT
  void
  restr_screen()
  {
***************
*** 148,153 ****
--- 184,190 ----
        Cconws ("\r\n"); 
      }
  }
+ #endif
  
  /*
   * init_core(): initialize the core memory map (normal ST ram) and also
***************
*** 234,260 ****
--- 271,309 ----
  		return (long) Malloc(amt);
  }
  
+ #ifndef	VMINT
  static void
  core_free(where)
  	long where;
  {
  	Mfree((void *)where);
  }
+ #endif
  
  void
  init_core()
  {
+ #ifndef	VMINT
  	extern int FalconVideo;	/* set in main.c */
  	int scrndone = 0;
  	ulong size;
  	ulong place;
  	ulong temp;
  	void *tossave;
+ #else
+ 	ulong size;
+ 	ulong place;
+ #endif
  
+ /*
+  * VTOS has already got all the memory it'll ever need...
+  */
+ #ifndef	VMINT
  	tossave = (void *)core_malloc((long)TOS_MEM, 0);
  	if (!tossave) {
  		FATAL("Not enough memory to run MiNT");
  	}
+ #endif
  
  /* initialize kernel memory */
  	place = (ulong)core_malloc(KERNEL_MEM, 3);
***************
*** 262,267 ****
--- 311,317 ----
  		nalloc_arena_add((void *)place,KERNEL_MEM);
  	}
  
+ #ifndef	VMINT
  /*
   * find out where the screen is. We want to manage the screen
   * memory along with all the other memory, so that Srealloc()
***************
*** 315,339 ****
  			core_free(temp);
  		}
  	}
  
! /* initialize ST RAM */
  	size = (ulong)core_malloc(-1L, 0);
  	while (size > 0) {
  		place = (ulong)core_malloc(size, 0);
  		if (!scrndone && (place + size == scrnplace)) {
  			size += scrnsize;
  			scrndone = 1;
  		}
  		if (!add_region(core, place, size, M_CORE))
  			FATAL("init_mem: unable to add a region");
  		size = (ulong)core_malloc(-1L, 0);
  	}
  
  	if (!scrndone) {
  		(void)add_region(core, scrnplace, scrnsize, M_CORE);
  	}
  
! /* initialize alternate RAM */
  	size = (ulong)core_malloc(-1L, 1);
  	while (size > 0) {
  		place = (ulong)core_malloc(size, 1);
--- 365,399 ----
  			core_free(temp);
  		}
  	}
+ #endif /* VMINT */
  
! /* initialize ST RAM (For VMINT, VME expansion memory just looks like
!  * oodles of standard ST RAM as long as it's contiguous. There's no
!  * support in VTOS for non-contigous RAM yet...)
!  */
  	size = (ulong)core_malloc(-1L, 0);
  	while (size > 0) {
  		place = (ulong)core_malloc(size, 0);
+ #ifndef	VMINT
  		if (!scrndone && (place + size == scrnplace)) {
  			size += scrnsize;
  			scrndone = 1;
  		}
+ #endif
  		if (!add_region(core, place, size, M_CORE))
  			FATAL("init_mem: unable to add a region");
  		size = (ulong)core_malloc(-1L, 0);
  	}
  
+ #ifndef	VMINT
  	if (!scrndone) {
  		(void)add_region(core, scrnplace, scrnsize, M_CORE);
  	}
+ #endif
  
! /* initialize alternate RAM (Leave this here for VMINT. You never know;
!  * one day VTOS might support Mxalloc()... :-)
!  */
  	size = (ulong)core_malloc(-1L, 1);
  	while (size > 0) {
  		place = (ulong)core_malloc(size, 1);
***************
*** 342,348 ****
--- 402,410 ----
  		size = (ulong)core_malloc(-1L, 1);
  	}
  
+ #ifndef	VMINT
  	(void)Mfree(tossave);		/* leave some memory for TOS to use */
+ #endif
  }
  
  /*
***************
*** 2034,2048 ****
  	long addr;
  {
  	unsigned long ua = (unsigned long) addr;
! 
  	extern ulong mint_top_st, mint_top_tt;
  	MEMREGION *r;
  	MMAP map;
  
  	if (ua < mint_top_st) {
  		map = core;
  	} else if (ua < mint_top_tt) {
  		map = alt;
  	} else {
  		return 0;
  	}
--- 2096,2115 ----
  	long addr;
  {
  	unsigned long ua = (unsigned long) addr;
! #ifndef	VMINT
  	extern ulong mint_top_st, mint_top_tt;
+ #else
+ 	extern ulong mint_top_st;
+ #endif
  	MEMREGION *r;
  	MMAP map;
  
  	if (ua < mint_top_st) {
  		map = core;
+ #ifndef	VMINT
  	} else if (ua < mint_top_tt) {
  		map = alt;
+ #endif
  	} else {
  		return 0;
  	}
diff -c ./mem.h ../../vmint/vmint/mem.h
*** ./mem.h	Mon Aug 21 23:34:16 1995
--- ../../vmint/vmint/mem.h	Tue Aug 22 12:47:44 1995
***************
*** 151,159 ****
--- 151,163 ----
   * that holds the screen boundary stuff.
   */
  extern int no_mem_prot;
+ #ifndef	VMINT
  extern int screen_boundary;
  
  #define MASKBITS	(no_mem_prot ? screen_boundary : (QUANTUM-1))
+ #else
+ #define MASKBITS	(no_mem_prot ? 15 : (QUANTUM-1))
+ #endif
  #define ROUND(size) (((size) + MASKBITS) & ~MASKBITS)
  
  /* interesting memory constants */
diff -c ./memprot.c ../../vmint/vmint/memprot.c
*** ./memprot.c	Mon Aug 21 23:34:16 1995
--- ../../vmint/vmint/memprot.c	Wed Aug 23 14:02:26 1995
***************
*** 17,22 ****
--- 17,24 ----
   * Each entry in a pointer table points to another pointer table or to
   * a page table, or is a page descriptor.
   * 
+  * VMINT is described after this stuff...
+  *
   * Since, initially, the logical address space is the physical address space,
   * we only need to worry about 26MB plus 32K for I/O space.
   * 
***************
*** 68,73 ****
--- 70,103 ----
   * for each MB that actually has TT RAM, there's another table, containing
   * 128 RAM page tables.  Where there isn't RAM, there are "global"
   * pages, to let the hardware bus error or not as it sees fit.
+  *
+  * For VMINT users:
+  *
+  * 0	    - membot:    S (supervisor only)
+  * membot   - phystop:   P (protected TPA)
+  * phystop  - $EFFFFFFF: S (A32/A24, D32 VME) buserr if non-existant
+  * $F0000000- $F0FFFFFF: S (A24, D16 VME) buserr if non-existant
+  * $F1000000- $FF7FFFFF: S (A32, D16 VME) buserr if non-existant
+  * $FF800000- $FFFFFFFF: S ROM, on-board hardware and VMEbus short I/O
+  * 
+  * tbl_a
+  *     0   -> tbl_b0
+  *     1-E -> VMEbus A32/A24, D32, cache inhibit, supervisor only
+  *     F   -> ROM, on-board hardware and VMEbus short I/O, supervisor only
+  *
+  * tbl_b0 table: 16 entries (assumes 32MB of RAM)
+  *     0   -> tbl_c00 (First 16MB of RAM), low 8MB cache enable, else inhibit
+  *     1   -> tbl_c01 (Second 16MB of RAM), cache inhibit
+  *     2-F -> tbl_c0x (Subsequent 16MB blocks), cache inhibit
+  *
+  * tbl_c00 table: RAM address space, assuming 8MB on-board RAM
+  *     0-7 -> On-board RAM page tables, cache enable
+  *     8-F -> Off-board RAM page tables, VMEbus A32/A24, D32, cache inhibit
+  *
+  * For each 16MB containing any RAM, there's a tbl_cx.  Within those,
+  * for each MB that actually has RAM, there's another table, containing
+  * 128 RAM page tables.  Where there isn't RAM, there are "global"
+  * pages, to let the hardware bus error or not as it sees fit.
   * 
   * One RAM page table is allocated per megabyte of real RAM; each table has
   * 128 entries, which is 8K per page.  For a TT with 4MB ST RAM and 4MB TT RAM
***************
*** 119,128 ****
--- 149,162 ----
  tc_reg tc;
  
  /* mint_top_* get used in mem.c also */
+ #ifndef	VMINT
  ulong mint_top_tt;
+ #endif
  ulong mint_top_st;
  
+ #ifndef	VMINT
  int tt_mbytes;		/* number of megabytds of TT RAM */
+ #endif
  
  /*
   * global_mode_table: one byte per page in the system.  Initially all pages
***************
*** 152,157 ****
--- 186,194 ----
  page_type readable_page;
  page_type invalid_page;
  page_type page_ptr;
+ #ifdef VMINT
+ page_type s_ci_page;
+ #endif
  
  page_type *const proto_page_type[] =
      { &invalid_page, &g_page, &s_page, &readable_page, &invalid_page };
***************
*** 184,196 ****
--- 221,240 ----
  
      TRACE(("init_tables"));
  
+ #ifndef	VMINT
  #define phys_top_tt (*(ulong *)0x5a4L)
      if (phys_top_tt == 0x01000000L) mint_top_tt = 0;
      else mint_top_tt = phys_top_tt;
+ #endif
  
+ #ifndef	VMINT
  #define phys_top_st (*(ulong *)0x42eL)
+ #else
+ #define phys_top_st (*(ulong *)0x442eL)
+ #endif
      mint_top_st = phys_top_st;
  
+ #ifndef	VMINT
      if (mint_top_tt)
      	tt_mbytes = (int) ((mint_top_tt - 0x01000000L) / ONE_MEG);
      else
***************
*** 211,222 ****
--- 255,297 ----
      global_mode_table_size = ((SIXTEEN_MEG / QUANTUM) +
  			    (((ulong)tt_mbytes * ONE_MEG) / QUANTUM));
  
+ #else
+ 
+     n_megabytes = (int) (mint_top_st / ONE_MEG);
+ 
+     /*
+      * VMINT is as follows: room for A table, B0 table, 1st 16MB C table,
+      * one C table per each 16MB (or fraction) of extra RAM, and
+      * 1024 bytes per megabyte.
+      */
+ 
+     page_table_size = (2L * TBL_SIZE_BYTES) +
+ 		      (((n_megabytes + 15L) / 16L) * TBL_SIZE_BYTES) +
+ 		      (n_megabytes*1024L);
+     /*
+      * VMINT marks non-RAM VMEbus address space as supervisor only.
+      * In my opinion, if there's any hardware out there, it should be
+      * for use by device drivers only. This means that a user-mode
+      * access will see privilege violation regardless of whether there
+      * is any physical hardware at a VMEbus address. The supervisor will
+      * either succeed, or see buserr if there is no hardware.
+      * Hence, we don't include any non-RAM address space in the
+      * global mode table.
+      */
+     global_mode_table_size = (n_megabytes * ONE_MEG) / QUANTUM;
+ #endif
+ 
      global_mode_table = kmalloc(global_mode_table_size);
  
      assert(global_mode_table);
  
+ #ifndef	VMINT
      TRACELOW(("mint_top_st is $%lx; mint_top_tt is $%lx, n_megabytes is %d",
  	mint_top_st, mint_top_tt, n_megabytes));
+ #else
+     TRACELOW(("mint_top_st is $%lx; n_megabytes is %d",
+ 	mint_top_st, n_megabytes));
+ #endif
      TRACELOW(("page_table_size is %ld, global_mode_table_size %ld",
  	    page_table_size,
  	    global_mode_table_size));
***************
*** 242,247 ****
--- 317,327 ----
      s_page = g_page;		/* a page which is globally accessible */
      s_page.s = 1;		/* if you're supervisor */
  
+ #ifdef	VMINT
+     s_ci_page = s_page;		/* a page which is supervisor accessible */
+     s_ci_page.ci = 1;		/* cache inhibited */
+ #endif
+ 
      invalid_page = g_page;
      invalid_page.dt = 0;
  
***************
*** 328,339 ****
--- 408,421 ----
  	    return 1;
  	}
      }
+ #ifndef	VMINT
      else if (start >= 0x01000000L && start < mint_top_tt) {
  	/* start is in TT RAM; fail if not entirely in TT RAM */
  	if (start+len > mint_top_tt) {
  	    return 1;
  	}
      }
+ #endif
  
      /*
       * a_index is always zero.  Only the first 256MB is mapped.
***************
*** 679,685 ****
--- 761,769 ----
      long_desc *tptr;
      long_desc *tbl_a;		/* top-level table */
      long_desc *tbl_b0;		/* second level, handles $0 nybble */
+ #ifndef	VMINT
      long_desc *tbl_bf;		/* handles $F nybble */
+ #endif
      long_desc *tbl_c;		/* temp pointer to start of 16MB */
      ulong p, q, r;
      ulong i, j, k;
***************
*** 698,714 ****
--- 782,803 ----
      tptr += TBL_SIZE;
      tbl_b0 = tptr;
      tptr += TBL_SIZE;
+ #ifndef VMINT
      tbl_bf = tptr;
      tptr += TBL_SIZE;
+ #endif
  
      /*
       * table A indexes by the first nybble: $0 and $F refer to their tables,
       * $1-$7 are uncontrolled, cacheable; $8-$E are uncontrolled, ci.
+      * Except for VMINT: tables $1-$F are supervisor, non-cacheable.
       */
  
      tbl_a[0].page_type = page_ptr;
      tbl_a[0].tbl_address = tbl_b0;
  
+ #ifndef	VMINT
+ 
      for (i=1; i<0xf; i++) {
  	if (i < 8)  tbl_a[i].page_type = g_page;
  	else	    tbl_a[i].page_type = g_ci_page;
***************
*** 719,724 ****
--- 808,822 ----
      tbl_a[0xf].page_type = page_ptr;
      tbl_a[0xf].tbl_address = tbl_bf;
  
+ #else
+ 
+     for (i=1; i<0x10; i++) {
+ 	tbl_a[i].page_type = s_ci_page;
+ 	tbl_a[i].tbl_address = (long_desc *)(i << 28);
+     }
+ 
+ #endif
+ 
      /*
       * table B0: entry 0 is $00, the 16MB of ST address space.
       */
***************
*** 728,733 ****
--- 826,832 ----
      tbl_c = tptr;
      tptr += TBL_SIZE;
  
+ #ifndef	VMINT
      /* for each megabyte that is RAM, allocate a table */
      for (i = 0, k = 0, p = 0; p < mint_top_st; i++, p += 0x00100000L) {
  	tbl_c[i].page_type = page_ptr;
***************
*** 754,760 ****
      tbl_c[i].page_type = g_ci_page;
      tbl_c[i].tbl_address = (long_desc *)p;
  
!         /* Done with tbl_c for 0th 16MB; go on to TT RAM */
  
  /* 
      structure:
--- 853,901 ----
      tbl_c[i].page_type = g_ci_page;
      tbl_c[i].tbl_address = (long_desc *)p;
  
! #else /* VMINT */
! 
!     /* for each megabyte of on-board RAM, allocate a table */
!     /* Note, this only works correctly for MVME147's which have */
!     /* 8MB RAM on-board. Some generic way to do this should be */
!     /* used, like peeking into the NV-RAM config. area... */
! 
!     for (i = 0, k = 0, p = 0; p < (ONE_MEG * 8L); i++, p += 0x00100000L) {
! 	tbl_c[i].page_type = page_ptr;
! 	tbl_c[i].tbl_address = tptr;
! 
! 	/* for each page in this megabyte, write a page entry */
! 	for (q = p, j = 0; j < 128; j++, q += 0x2000, k++) {
! 	    tptr->page_type = *proto_page_type[global_mode_table[k]];
! 	    tptr->tbl_address = (long_desc *)q;
! 	    tptr++;
! 	}
!     }
! 
!     /* do the same for the next 8MB, if it exists, but this time mark */
!     /* the pages as non-cacheable <sigh> */
!     for (; p < mint_top_st && p < SIXTEEN_MEG; i++, p += 0x00100000L) {
! 	tbl_c[i].page_type = page_ptr;
! 	tbl_c[i].tbl_address = tptr;
! 
! 	/* for each page in this megabyte, write a page entry */
! 	for (q = p, j = 0; j < 128; j++, q += 0x2000, k++) {
! 	    tptr->page_type = *proto_page_type[global_mode_table[k]];
! 	    tptr->page_type.ci = 1;
! 	    tptr->tbl_address = (long_desc *)q;
! 	    tptr++;
! 	}
!     }
! 
!     /* now if we're still below 16MB, mark as supervisor, cache inhibit */
!     for ( ; p < SIXTEEN_MEG; i++, p += 0x00100000L) {
! 	tbl_c[i].page_type = s_ci_page;
! 	tbl_c[i].tbl_address = (long_desc *)p;
!     }
! 
! #endif /* VMINT */
! 
!         /* Done with tbl_c for 0th 16MB; go on to TT RAM or VME off-board RAM */
  
  /* 
      structure:
***************
*** 777,783 ****
--- 918,928 ----
  
      /* i counts 16MBs */
      for (i = 1, p = 0x01000000L, g = 2048;
+ #ifndef	VMINT
  	 p < mint_top_tt;
+ #else
+ 	 p < mint_top_st;
+ #endif
  	 p += SIXTEEN_MEG, i++) {
  	    tbl_b0[i].page_type = page_ptr;
  	    tbl_b0[i].tbl_address = tptr;
***************
*** 785,815 ****
  	    tptr += TBL_SIZE;
  
  	    /* j counts MBs */
  	    for (j = 0, q = p; j < 16 && q < mint_top_tt; q += ONE_MEG, j++) {
  		tbl_c[j].page_type = page_ptr;
  		tbl_c[j].tbl_address = tptr;
  		/* k counts pages (8K) */
  		for (r = q, k = 0; k < 128; k++, r += 0x2000, g++) {
  		    tptr->page_type = *proto_page_type[global_mode_table[g]];
  		    tptr->tbl_address = (long_desc *)r;
  		    tptr++;
  		}
  	    }
  	    for ( ; j < 16; j++, q += ONE_MEG) {
  		/* fill in the rest of this 16MB */
  		tbl_c[j].page_type = g_page;
  		tbl_c[j].tbl_address = (long_desc *)q;
  	    }
      }
  
!     /* fill in the rest of $00-$0F as cacheable */
      for ( ; i < 16; i++, p += SIXTEEN_MEG) {
  	tbl_b0[i].page_type = g_page;
  	tbl_b0[i].tbl_address = (long_desc *)p;
      }
  
      /* done with TT RAM in table b0; do table bf */
  
      /*
       * Table BF: translates addresses starting with $F.  First 15 are
       * uncontrolled, cacheable; last one translates $FF, which
--- 930,976 ----
  	    tptr += TBL_SIZE;
  
  	    /* j counts MBs */
+ #ifndef	VMINT
  	    for (j = 0, q = p; j < 16 && q < mint_top_tt; q += ONE_MEG, j++) {
+ #else
+ 	    for (j = 0, q = p; j < 16 && q < mint_top_st; q += ONE_MEG, j++) {
+ #endif
  		tbl_c[j].page_type = page_ptr;
  		tbl_c[j].tbl_address = tptr;
  		/* k counts pages (8K) */
  		for (r = q, k = 0; k < 128; k++, r += 0x2000, g++) {
  		    tptr->page_type = *proto_page_type[global_mode_table[g]];
+ #ifdef	VMINT
+ 		    tptr->page_type.ci = 1;	/* <sigh> */
+ #endif
  		    tptr->tbl_address = (long_desc *)r;
  		    tptr++;
  		}
  	    }
  	    for ( ; j < 16; j++, q += ONE_MEG) {
  		/* fill in the rest of this 16MB */
+ #ifndef	VMINT
  		tbl_c[j].page_type = g_page;
+ #else
+ 		tbl_c[j].page_type = s_ci_page;
+ #endif
  		tbl_c[j].tbl_address = (long_desc *)q;
  	    }
      }
  
!     /* fill in the rest of $00-$0F as cacheable (VMINT is S, cache inhibit) */
      for ( ; i < 16; i++, p += SIXTEEN_MEG) {
+ #ifndef	VMINT
  	tbl_b0[i].page_type = g_page;
+ #else
+ 	tbl_b0[i].page_type = s_ci_page;
+ #endif
  	tbl_b0[i].tbl_address = (long_desc *)p;
      }
  
      /* done with TT RAM in table b0; do table bf */
  
+ #ifndef	VMINT
      /*
       * Table BF: translates addresses starting with $F.  First 15 are
       * uncontrolled, cacheable; last one translates $FF, which
***************
*** 827,832 ****
--- 988,994 ----
      }
      tbl_bf[0xf] = tbl_b0[0];
      *(ulong *)(&(tbl_bf[0xf].tbl_address)) |= 1;
+ #endif
  
      proc->ctxt[0].crp.limit = 0x7fff;	/* disable limit function */
      proc->ctxt[0].crp.dt = 3;		/* points to valid 8-byte entries */
***************
*** 881,886 ****
--- 1043,1049 ----
       * the other of these is a bug, depending on how you want it to work.
       */
      mark_pages(proc->page_table,0,mint_top_st,1,0,0,proc);
+ #ifndef	VMINT
      if (mint_top_tt) {
  	mark_pages(proc->page_table,
  		    0x01000000L,
***************
*** 888,893 ****
--- 1051,1057 ----
  		    1,0,0,
  		    proc);
      }
+ #endif
  
      /*
       * In addition, mark all the pages the process already owns as "super"
***************
*** 971,976 ****
--- 1135,1141 ----
  	FORCE("%08lx: %s",i*8192L,outstr);
      }
  
+ #ifndef	VMINT
      if (mint_top_tt) {
  	FORCE("TTRAM global table:");
  	end = mint_top_tt / QUANTUM;
***************
*** 981,986 ****
--- 1146,1152 ----
  	    FORCE("%08lx: %s",i*8192L,outstr);
  	}
      }
+ #endif
  }
  
  const char *berr_msg[] = { 
***************
*** 1006,1012 ****
--- 1172,1182 ----
  
      aa = curproc->exception_addr;
      pc = curproc->exception_pc;
+ #ifndef	VMINT
      if ((mint_top_tt && aa < mint_top_tt) || (aa < mint_top_st)) {
+ #else
+     if (aa < mint_top_st) {
+ #endif
  	mode = global_mode_table[(curproc->exception_addr >> 13)];
  	if (mode == PROT_G) {
  	    /* page is global: obviously a hardware bus error */
diff -c ./mint.h ../../vmint/vmint/mint.h
*** ./mint.h	Mon Aug 21 23:34:16 1995
--- ../../vmint/vmint/mint.h	Wed Aug 23 14:36:46 1995
***************
*** 36,43 ****
--- 36,45 ----
  /* Freate() on pipes should not fail */
  #define CREATE_PIPES
  
+ #ifndef	VMINT
  /* try to gather the MiNT executable's name from the parent's DTA */
  #define AUTO_FIX
+ #endif
  
  /* define if you want a daemon process for sync'ing (otherwise uses timeout) */
  #undef SYSUPDATE_DAEMON
***************
*** 50,58 ****
--- 52,65 ----
  			   in kernel filesystems */
  #endif
  
+ #ifndef	VMINT
  #ifndef MULTITOS
  #define FASTTEXT	/* include the u:\dev\fasttext device */
  #endif
+ #else
+ #undef	FASTTEXT	/* don't need this at all */
+ #undef	MULTITOS
+ #endif
  
  /* PATH_MAX is the maximum path allowed. The kernel uses this in lots of
   * places, so there isn't much point in file systems allowing longer
***************
*** 274,279 ****
--- 281,287 ----
  
  extern short timestamp, datestamp;	/* in timeout.c */
  
+ #ifndef	VMINT
  typedef struct kbdvbase {
  	long midivec;
  	long vkbderr;
***************
*** 287,292 ****
--- 295,301 ----
  } KBDVEC;
  
  extern KBDVEC *syskey;
+ #endif
  
  #define ST	0
  #define STE	0x00010000L
diff -c ./proc.c ../../vmint/vmint/proc.c
*** ./proc.c	Mon Aug 21 23:34:16 1995
--- ../../vmint/vmint/proc.c	Tue Aug 22 14:05:50 1995
***************
*** 238,245 ****
  
  /* NOTE: in main.c this could be changed, later */
  	curproc->base = _base;
! 
  	strcpy(curproc->name, "MiNT");
  
  /* get some memory */
  	curproc->mem = (MEMREGION **)kmalloc(NUM_REGIONS*SIZEOF(MEMREGION *));
--- 238,248 ----
  
  /* NOTE: in main.c this could be changed, later */
  	curproc->base = _base;
! #ifndef	VMINT
  	strcpy(curproc->name, "MiNT");
+ #else
+ 	strcpy(curproc->name, "VMiNT");
+ #endif
  
  /* get some memory */
  	curproc->mem = (MEMREGION **)kmalloc(NUM_REGIONS*SIZEOF(MEMREGION *));
***************
*** 290,297 ****
--- 293,304 ----
  	else
  		curproc->bconmap = 1;
  
+ #ifndef	VMINT
  	curproc->logbase = (void *)Logbase();
  	curproc->criticerr = *((long ARGS_ON_STACK (**) P_((long)))0x404L);
+ #else
+ 	curproc->criticerr = *((long ARGS_ON_STACK (**) P_((long)))0x4404L);
+ #endif
  }
  
  /*
***************
*** 505,515 ****
--- 512,524 ----
  	ulong onsigs = curproc->nsigs;
  	extern short kintr;	/* in bios.c */
  	int newslice = 1;
+ #ifndef	VMINT
  #ifndef MULTITOS
  #ifdef FASTTEXT
  	extern int hardscroll;	/* in fasttext.c */
  #endif
  #endif
+ #endif
  
  /* save condition, checkbttys may just wake() it right away...
   * note this assumes the condition will never be waked from interrupts
***************
*** 633,654 ****
--- 642,667 ----
  /*
   * restore per-process variables here
   */
+ #ifndef	VMINT
  #ifndef MULTITOS
  #ifdef FASTTEXT
  		if (!hardscroll)
  			*((void **)0x44eL) = curproc->logbase;
  #endif
  #endif
+ #endif
  		do_wakeup_things(sr, 1, cond);
  		return (onsigs != curproc->nsigs);
  	}
  /*
   * save per-process variables here
   */
+ #ifndef	VMINT
  #ifndef MULTITOS
  #ifdef FASTTEXT
  	if (!hardscroll)
  		curproc->logbase = *((void **)0x44eL);
+ #endif
  #endif
  #endif
  
diff -c ./proc.h ../../vmint/vmint/proc.h
*** ./proc.h	Mon Aug 21 23:34:16 1995
--- ../../vmint/vmint/proc.h	Thu Aug 24 22:31:32 1995
***************
*** 170,175 ****
--- 170,179 ----
  					   process gets to run again */
  
  	short	bconmap;		/* Bconmap mapping		*/
+ /*
+  * Note: don't remove midiout and midiin, even for VMINT. Code depends on
+  * them being there even if they're not used.
+  */
  	FILEPTR *midiout;		/* MIDI output			*/
  	FILEPTR *midiin;		/* MIDI input			*/
  	FILEPTR	*prn;			/* printer			*/
***************
*** 214,220 ****
--- 218,226 ----
  	long	txtsize;		/* size of text region (for fork()) */
  
  	long ARGS_ON_STACK (*criticerr) P_((long)); /* critical error handler	*/
+ #ifndef	VMINT
  	void	*logbase;		/* logical screen base		*/
+ #endif
  
  	struct proc *ptracer;		/* process which is tracing this one */
  	short	ptraceflags;		/* flags for process tracing */
diff -c ./proto.h ../../vmint/vmint/proto.h
*** ./proto.h	Mon Aug 21 23:34:16 1995
--- ../../vmint/vmint/proto.h	Wed Aug 23 22:05:46 1995
***************
*** 68,76 ****
--- 68,78 ----
  long ARGS_ON_STACK f_getchar P_((int fh, int mode));
  long ARGS_ON_STACK f_putchar P_((int fh, long c, int mode));
  
+ #if 0
  /* cookie.c */
  #include "cookie.h"
  long ARGS_ON_STACK s_cookie P_((short Action, COOKIE *Yummy));
+ #endif
  
  /* dos.c */
  long ARGS_ON_STACK s_version P_((void));
***************
*** 244,250 ****
--- 246,254 ----
  
  /* mem.c */
  void init_mem P_((void));
+ #ifndef	VMINT
  void restr_screen P_((void));
+ #endif
  int add_region P_((MMAP map, ulong place, ulong size, unsigned mflags));
  void init_core P_((void));
  void init_swap P_((void));
***************
*** 369,380 ****
--- 373,388 ----
  #endif /* OWN_LIB */
  
  /* biosfs.c */
+ #ifndef	VMINT
  long rsvf_ioctl P_((int f, void *arg, int mode));
+ #endif
  void biosfs_init P_((void));
  long iwrite	P_((int bdev, const char *buf, long bytes, int ndelay, struct bios_file *b));
  long iread	P_((int bdev, char *buf, long bytes, int ndelay, struct bios_file *b));
  long iocsbrk	P_((int bdev, int mode, struct bios_tty *t));
+ #ifndef	VMINT
  void ARGS_ON_STACK mouse_handler P_((const char *buf));
+ #endif
  long ARGS_ON_STACK nocreat P_((fcookie *dir, const char *name, unsigned mode, int attrib,
  		 fcookie *fc));
  long ARGS_ON_STACK nomkdir	P_((fcookie *dir, const char *name, unsigned mode));
Common subdirectories: ./purec and ../../vmint/vmint/purec
diff -c ./sproto.h ../../vmint/vmint/sproto.h
*** ./sproto.h	Mon Aug 21 23:34:16 1995
--- ../../vmint/vmint/sproto.h	Wed Aug 23 14:57:30 1995
***************
*** 32,40 ****
--- 32,42 ----
  void ARGS_ON_STACK quickmovb P_((void *dst, const void *src, long nbytes));
  
  /* syscall.s */
+ #ifndef	VMINT
  char * ARGS_ON_STACK lineA0 P_((void));
  void ARGS_ON_STACK call_aes P_((short **));
  long ARGS_ON_STACK call_dosound P_((const void *));
+ #endif
  long ARGS_ON_STACK callout P_((long, ...));
  long ARGS_ON_STACK callout1 P_((long, int));
  long ARGS_ON_STACK callout2 P_((long, int, int));
diff -c ./syscall.spp ../../vmint/vmint/syscall.spp
*** ./syscall.spp	Mon Aug 21 23:39:38 1995
--- ../../vmint/vmint/syscall.spp	Tue Aug 22 14:25:24 1995
***************
*** 17,25 ****
--- 17,27 ----
  ; _sig_return: user signal handlers return to this routine (see signal.c)
  ;              it is responsible for restoring the kernel's old context
  ;              via the Psigreturn() system call
+ %ifndef	VMINT
  ; _lineA0:     calls the line A initialize routine
  ; _call_aes:   calls the GEM AES
  ; _call_dosound: calls the XBIOS Dosound() function
+ %endif
  ; _do_usrcall: calls a user supplied function (e.g. for Supexec), with
  ;	       arguments supplied from global variables usrarg1, usrarg2, etc.
  ; _callout:    calls an external function, after first saving all registers,
***************
*** 116,122 ****
--- 118,128 ----
  	lea	8(sp),a1
  %else
  	lea	6(sp),a1		; supervisor mode: args on stack
+ %ifndef	VMINT
  	tst.w	($59e).w		; test longframe
+ %else
+ 	tst.w	($459e).w		; test longframe
+ %endif
  	beq.s	LX_check
  	addq.w	#2,a1			; stack is a bit bigger
  %endif
***************
*** 124,132 ****
  LX_usr:
  	move.l	usp,a1			; user mode: args on user stack
  LX_check:
  	cmp.w	#5,(a1)			; check for Setscreen command
  	beq.s	LX_screen		; no -- fall through
! 
  	clr.w	-(sp)			; no frame format needed
  	move.l	_curproc,a0
  	pea	4(a0)			; push pointer to syscall context save
--- 130,139 ----
  LX_usr:
  	move.l	usp,a1			; user mode: args on user stack
  LX_check:
+ %ifndef	VMINT
  	cmp.w	#5,(a1)			; check for Setscreen command
  	beq.s	LX_screen		; no -- fall through
! %endif
  	clr.w	-(sp)			; no frame format needed
  	move.l	_curproc,a0
  	pea	4(a0)			; push pointer to syscall context save
***************
*** 154,159 ****
--- 161,168 ----
  	jsr	_enter_kernel		; set up vectors appropriately
  	addq.w	#2,sp
  	bra	_syscall
+ 
+ %ifndef	VMINT
  ;
  ; For setscreen, jump directly to the ROM vector --
  ; this avoids all hazards (like changing the vectors)
***************
*** 161,166 ****
--- 170,176 ----
  LX_screen:
  	move.l	_old_xbios+8,a0
  	jmp	(a0)
+ %endif
  
  
  _mint_bios:
***************
*** 308,314 ****
--- 318,328 ----
  	bne.s	nosleep			; no -- continue
  	btst	#13,d0			; caller in supervisor mode?
  	bne.s	nosleep			; yes -- don't interrupt
+ %ifndef	VMINT
  	tst.w	($43e).w		; test floppy disk lock variable
+ %else
+ 	tst.w	($443e).w		; test floppy disk lock variable
+ %endif
  	bne.s	nosleep			; if locked, can't switch
  sleep:
  	tst.l	_unwound_stack		; did we unwind sysstack?
***************
*** 415,420 ****
--- 429,435 ----
  	move.w	d0,_bconbdev		; no: OK, we have a new device
  	bra.s	put_buf
  
+ %ifndef	VMINT
  ;
  ; _lineA0: MiNT calls this to get the address of the line A variables
  ;
***************
*** 448,453 ****
--- 463,469 ----
  	trap	#14
  	addq.w	#6,sp
  	rts
+ %endif
  
  ;
  ; _callout: Call an external function, passing <32 bytes of arguments,
diff -c ./timeout.c ../../vmint/vmint/timeout.c
*** ./timeout.c	Mon Aug 21 23:34:16 1995
--- ../../vmint/vmint/timeout.c	Tue Aug 22 14:28:08 1995
***************
*** 76,82 ****
--- 76,86 ----
  dispose_old_timeouts (void)
  {
    TIMEOUT *t, **prev, *old;
+ #ifndef	VMINT
    long now = *(long *) 0x4ba;
+ #else
+   long now = *(long *) 0x44ba;
+ #endif
    short sr = spl7 ();
  
    for (prev = &expire_list, t = *prev; t; prev = &t->next, t = *prev)
***************
*** 376,382 ****
--- 380,390 ----
  
  	kintr = keyrec->head != keyrec->tail;
  
+ #ifndef	VMINT
  	ms = *((short *)0x442L);
+ #else
+ 	ms = *((short *)0x4442L);
+ #endif
  	if (proc_clock > 0)
  		proc_clock--;
  
***************
*** 429,435 ****
--- 437,447 ----
  		if (tlist)
  			tlist->when += delta;
  		old->next = expire_list;
+ #ifndef	VMINT
  		old->when = *(long *) 0x4ba + TIMEOUT_EXPIRE_LIMIT;
+ #else
+ 		old->when = *(long *) 0x44ba + TIMEOUT_EXPIRE_LIMIT;
+ #endif
  		expire_list = old;
  		spl(sr);
  /* ++kay: debug output at spl7 hangs the system, so moved it here */
diff -c ./tty.c ../../vmint/vmint/tty.c
*** ./tty.c	Mon Aug 21 23:34:16 1995
--- ../../vmint/vmint/tty.c	Sat Aug 26 02:12:14 1995
***************
*** 730,738 ****
--- 730,740 ----
  		}
  	/* set parity, etc. */
  		flags = TF_8BIT;
+ #if 0
  		if (sg->sg_flags & (T_EVENP|T_ODDP)) {
  			flags = TF_7BIT;
  		}
+ #endif
  		flags |= (sg->sg_flags & TF_FLAGS);
  	/* default allow breaks to SIGINT unless RAW and no echo... */
  		if (!(sg->sg_flags & T_RAW) || (sg->sg_flags & T_ECHO))
diff -c ./version.h ../../vmint/vmint/version.h
*** ./version.h	Mon Aug 21 23:34:16 1995
--- ../../vmint/vmint/version.h	Tue Aug 22 14:34:32 1995
***************
*** 6,12 ****
  #define MAJ_VERSION	1
  #define MIN_VERSION	12
  
! #define THIRD_PARTY	"FreeMiNT"
  #define PATCH_LEVEL	".4"
  #define BETA		"-BETA"
  
--- 6,12 ----
  #define MAJ_VERSION	1
  #define MIN_VERSION	12
  
! #define THIRD_PARTY	"VMiNT: Based on FreeMiNT"
  #define PATCH_LEVEL	".4"
  #define BETA		"-BETA"
  
diff -c ./welcome.c ../../vmint/vmint/welcome.c
*** ./welcome.c	Mon Aug 21 23:34:16 1995
--- ../../vmint/vmint/welcome.c	Tue Aug 22 11:17:08 1995
***************
*** 17,22 ****
--- 17,23 ----
  need to do this because MiNT will\r\n\
  do it for you automagically.\r\n";
  
+ #ifndef	VMINT
  const char *memprot_warning = "\033p\
              *** WARNING ***            \033q\r\n\
  You have turned off memory protection.\r\n\
***************
*** 28,33 ****
--- 29,48 ----
  Your system's memory is not large enough\r\n\
  to permit memory protection to be enabled.\r\n";
  
+ #else
+ 
+ const char *memprot_warning = "\
+             *** WARNING ***            \r\n\
+ You have turned off memory protection.\r\n\
+ This is not recommended, and may not be\r\n\
+ supported in the future.\r\n";
+ 
+ const char *insuff_mem_warning = "\
+             *** WARNING ***            \r\n\
+ Your system's memory is not large enough\r\n\
+ to permit memory protection to be enabled.\r\n";
+ #endif
+ 
  #ifndef THIRD_PARTY
  
  const char *greet1 = "\r\n\033p\033f\
***************
*** 83,95 ****
--- 98,118 ----
  #ifdef AUTO_FIX
  	" AUTO_FIX"
  #endif
+ #ifndef	VMINT
  ")\r\n\r\n" MINT_NAME " is a modified version of MiNT.\r\n\
  MiNT            \xbd 1990,1991,1992 Eric R. Smith\r\n\
  MultiTOS kernel \xbd 1992,1993,1994 Atari Corporation\r\n\
  All Rights Reserved. \033pUse this program at your own risk!\033q\r\n\r\n";
+ #else
+ ")\r\n\r\n" MINT_NAME " is a modified version of MiNT.\r\n\
+ MiNT            (c) 1990,1991,1992 Eric R. Smith\r\n\
+ MultiTOS kernel (c) 1992,1993,1994 Atari Corporation\r\n\
+ All Rights Reserved. Use this program at your own risk!\r\n\r\n";
+ #endif /* VMINT */
  
  #endif /* THIRD_PARTY */
  
+ #ifndef	VMINT
  /*
   * "boot MiNT?" messages, in various langauges:
   */
***************
*** 129,132 ****
  	else
  		return 0;
  }
! 
--- 152,155 ----
  	else
  		return 0;
  }
! #endif
diff -c ./xbios.c ../../vmint/vmint/xbios.c
*** ./xbios.c	Mon Aug 21 23:34:16 1995
--- ../../vmint/vmint/xbios.c	Thu Aug 24 14:22:24 1995
***************
*** 16,22 ****
--- 16,26 ----
  #include "mint.h"
  
  /* tty structures for the BIOS devices -- see biosfs.c */
+ #ifndef	VMINT
  extern struct tty sccb_tty, scca_tty, ttmfp_tty;
+ #else
+ extern struct tty sccb_tty, scca_tty;
+ #endif
  extern struct bios_tty bttys[];
  extern short btty_max;
  
***************
*** 106,111 ****
--- 110,116 ----
  	int cnt;
  	const char *buf;
  {
+ #ifndef	VMINT
  	FILEPTR *f;
  	long towrite = cnt+1;
  
***************
*** 134,139 ****
--- 139,147 ----
  		return towrite;
  	}
  	return (*f->dev->write)(f, buf, towrite);
+ #else
+ 	return EIHNDL;
+ #endif
  }
  
  /*
***************
*** 195,205 ****
--- 203,215 ----
  			t += b;
  		else
  			t = 0;
+ #ifndef	VMINT
  /* more bugs...  serial1 is three-wire, requesting hardware flowcontrol
   * on it can confuse BIOS
   */
  		if ((flow & 0x8002) == 2 && t && t->tty == &ttmfp_tty)
  			flow &= ~2;
+ #endif
  
  #ifndef DONT_ONLY030_THIS
  /* Note: the code below must be included, even on a 68030, thanks to a bug
***************
*** 255,260 ****
--- 265,271 ----
  
  	if (has_bconmap && t) {
  		rsval = MAPTAB[b].rsconf;
+ #ifndef	VMINT
  /* bug # x+1:  at least up to TOS 2.05 SCC Rsconf forgets to or #0x700,sr...
   * use MAPTAB to call it directly, at ipl7 if it points to ROM
   */
***************
*** 263,282 ****
--- 274,305 ----
  		    (b = 1, rsval > 0xe00000L) && rsval < 0xefffffL)
  			rsval = callout6spl7 (rsval, baud, flow, uc, rs, ts, sc);
  		else
+ #endif
  			rsval = callout6 (rsval, baud, flow, uc, rs, ts, sc);
  	} else {
  		if (has_bconmap)
  			mapin(curproc->bconmap);
  		rsval = Rsconf(baud, flow, uc, rs, ts, sc);
  	}
+ #ifndef	VMINT
  	if (!t || baud <= -2)
  		return rsval;
+ #else
+ 	if (!t || baud == -2 || baud < -4)
+ 		return rsval;
+ 	else
+ 		baud += 4;
+ #endif
  
  	if (baud >= 0) {
  		t->vticks = 0;
  		t->ospeed = t->ispeed = (unsigned)baud < t->maxbaud ?
  					t->baudmap[baud] : -1;
  	}
+ /*
+  * This hack is not needed for VTOS; the driver does it all.
+  */
+ #ifndef	VMINT
  #if 1
  	if (b == 1 && flow >= 0) {
  /*
***************
*** 300,305 ****
--- 323,329 ----
  		spl(sr);
  	}
  #endif
+ #endif
  	return rsval;
  }
  
***************
*** 352,357 ****
--- 376,382 ----
  dosound(ptr)
  	const char *ptr;
  {
+ #ifndef	VMINT
  	MEMREGION *r;
  
  	if (!no_mem_prot && ((long)ptr >= 0)) {
***************
*** 375,380 ****
--- 400,408 ----
  	}
  
  	return call_dosound(ptr);
+ #else
+ 	return 0;
+ #endif
  }
  
  void
