Index: Makefile
===================================================================
--- Makefile	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ Makefile	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,167 @@
+CROSS_DIR :=	/opt/cross-m68k/bin
+CROSS_TRI :=	m68k-none-elf
+CROSS_PRE :=	$(CROSS_DIR)/$(CROSS_TRI)
+
+CROSS_GCC :=	$(CROSS_PRE)-gcc
+CROSS_AS :=		$(CROSS_PRE)-as
+
+# -mshort sets the size of an int to 16 bits; important for interop with
+# the hand-written assembly language code
+
+FLAGS :=		-Os -m68000 -mshort -Wall -Wextra \
+				-Wpedantic -Wcast-align -Wcast-qual -Wconversion -Wsign-conversion \
+				-Wshadow -Wmissing-declarations -Wredundant-decls \
+				-I include
+
+FLAGS_COM :=	$(FLAGS) -std=c99 -ffreestanding \
+				-fno-strict-aliasing -fno-inline -fno-omit-frame-pointer
+
+FLAGS_ASM :=	$(FLAGS)
+
+HEADERS :=		$(wildcard include/*.h)
+
+PROLOG_C :=		croot.c
+PROLOG_S :=		fsmain.s
+
+PROLOG_CO :=	$(PROLOG_C:.c=.o)
+PROLOG_SO :=	$(PROLOG_S:.s=.o)
+
+PROLOG_SRC :=	$(PROLOG_C:%=prolog/%) $(PROLOG_S:%=prolog/%)
+PROLOG_OBJ :=	$(PROLOG_CO:%=build/%) $(PROLOG_SO:%=build/%)
+
+build/%.o:		prolog/%.c $(HEADERS) | build
+				$(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
+
+build/%.o:		prolog/%.s $(HEADERS) | build
+				$(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
+
+IOLIB_C :=		dofmt.c mdump.c pause.c printf.c rawio.c sprintf.c waitcr.c
+IOLIB_S :=		hwdefs.s rtraps.s setipl.s setsr.s traps.s
+
+IOLIB_CO :=		$(IOLIB_C:.c=.o)
+IOLIB_SO :=		$(IOLIB_S:.s=.o)
+
+IOLIB_SRC :=	$(IOLIB_C:%=iolib/%) $(IOLIB_S:%=iolib/%)
+IOLIB_OBJ :=	$(IOLIB_CO:%=build/%) $(IOLIB_SO:%=build/%)
+
+build/%.o:		iolib/%.c $(HEADERS) | build
+				$(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
+
+build/%.o:		iolib/%.s $(HEADERS) | build
+				$(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
+
+LIBCIO_C :=		atoi.c atol.c blkrd.c blkwr.c close.c clusmap.c conin.c conwr.c \
+				dirfns.c fgets.c filesys.c filname.c flread.c fopen.c fprintf.c \
+				fputs.c fread.c fscanf.c fseek.c fsinit.c fsize.c fstubs.c ftell.c \
+				fwrite.c getbuff.c getc.c getl.c getw.c lseek.c open.c posit.c putc.c \
+				putl.c putw.c read.c readrn.c rename.c scan.c setbuf.c ungetc.c \
+				unlink.c write.c writern.c
+
+LIBCIO_S :=		ptcl12.s
+
+LIBCIO_CO :=	$(LIBCIO_C:.c=.o)
+LIBCIO_SO :=	$(LIBCIO_S:.s=.o)
+
+LIBCIO_SRC :=	$(LIBCIO_C:%=libcio/%) $(LIBCIO_S:%=libcio/%)
+LIBCIO_OBJ :=	$(LIBCIO_CO:%=build/%) $(LIBCIO_SO:%=build/%)
+
+build/%.o:		libcio/%.c $(HEADERS) | build
+				$(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
+
+build/%.o:		libcio/%.s $(HEADERS) | build
+				$(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
+
+LIBSM_C :=		index.c memccpy.c memchr.c memcmp.c memcmpu.c memcpy.c memcpyw.c \
+				memset.c memsetw.c rindex.c str2lc.c str2uc.c strcat.c strccpy.c \
+				strchr.c strcmp.c strcpy.c strcspn.c strfill.c strlcmp.c strlen.c \
+				strltrm.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strrev.c \
+				strrevi.c strrtrm.c strspn.c strtok.c strtol.c
+
+LIBSM_CO :=		$(LIBSM_C:.c=.o)
+
+LIBSM_SRC :=	$(LIBSM_C:%=libsm/%)
+LIBSM_OBJ :=	$(LIBSM_CO:%=build/%)
+
+build/%.o:		libsm/%.c $(HEADERS) | build
+				$(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
+
+LIB700_C :=		bitrev.c ctype.c ispow2.c mangle.c micons.c tolower.c toupper.c
+
+LIB700_S :=		aldiv.s almul.s alrem.s blkfill.s blkmove.s finalone.s jumpto.s \
+				ldiv.s lmul.s lrem.s rand24.s setjmp.s uldiv.s
+
+LIB700_CO :=	$(LIB700_C:.c=.o)
+LIB700_SO :=	$(LIB700_S:.s=.o)
+
+LIB700_SRC :=	$(LIB700_C:%=lib700/%) $(LIB700_S:%=lib700/%)
+LIB700_OBJ :=	$(LIB700_CO:%=build/%) $(LIB700_SO:%=build/%)
+
+build/%.o:		lib700/%.c $(HEADERS) | build
+				$(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
+
+build/%.o:		lib700/%.s $(HEADERS) | build
+				$(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
+
+VLIB_C := 		cg2.c cg3.c glcinit.c lseg.c vbfill4.c vclrs.c vhinit.c vmput.c \
+				vobjfns.c vputs.c vputsv.c vsetpal.c vsinit.c vspray4.c vtext.c \
+				vwputm.c
+
+VLIB_S :=		acctrl.s glcplot.s tsplot4.s vbank.s vclrav.s vcputs.s vcputsv.s \
+				viint.s vputa.s vputc.s vputcv.s vputp.s vsetav.s vsetcv.s vsplot4.s \
+				vvputsv.s vwputp.s vwputs.s
+
+VLIB_CO :=		$(VLIB_C:.c=.o)
+VLIB_SO :=		$(VLIB_S:.s=.o)
+
+VLIB_SRC :=		$(VLIB_C:%=vlib/%) $(VLIB_S:%=vlib/%)
+VLIB_OBJ :=		$(VLIB_CO:%=build/%) $(VLIB_SO:%=build/%)
+
+build/%.o:		vlib/%.c $(HEADERS) | build
+				$(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
+
+build/%.o:		vlib/%.s $(HEADERS) | build
+				$(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
+
+all:			$(PROLOG_OBJ) $(IOLIB_OBJ) $(LIBCIO_OBJ) $(LIBSM_OBJ) $(LIB700_OBJ) \
+				$(VLIB_OBJ)
+
+ROM_C :=		booter.c romp.c
+ROM_S :=		bios.s timeint.s
+
+ROM_CO :=		$(ROM_C:.c=.o)
+ROM_SO :=		$(ROM_S:.s=.o)
+
+ROM_SRC :=		$(ROM_C:%=rom/%) $(ROM_S:%=rom/%)
+ROM_OBJ :=		$(ROM_CO:%=build/%) $(ROM_SO:%=build/%)
+
+build/%.o:		rom/%.c $(HEADERS) | build
+				$(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
+
+build/%.o:		rom/%.s $(HEADERS) | build
+				$(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
+
+all:			$(PROLOG_OBJ) $(IOLIB_OBJ) $(LIBCIO_OBJ) $(LIBSM_OBJ) $(LIB700_OBJ) \
+				$(VLIB_OBJ) $(ROM_OBJ)
+
+build:
+				mkdir build
+
+hatari/c.img:	$(wildcard hatari/c/bin/*)
+				rm -f hatari/c.img
+				atari-hd-image 8 hatari/c.img BUCHLA hatari/c
+
+emu:			hatari/c.img
+				hatari \
+				--control-socket /tmp/buchla.sock \
+				--vdi-width 1280 --vdi-height 960 \
+				--drive-a false --drive-b false \
+				--acsi 0=hatari/c.img \
+				--harddrive hatari/d --gemdos-drive d
+
+rem:
+				hatari/rem.py
+
+clean:
+				rm -rf build
+				rm -f hatari/c.img
+				rm -f hatari/d/out/*
Index: hatari/c/bin/as.sh
===================================================================
--- hatari/c/bin/as.sh	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/c/bin/as.sh	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,2 @@
+BASE=$1
+as68 -f \tmp\ -l -u -s \bin\ $BASE.s
Index: hatari/c/bin/as68init
===================================================================
--- hatari/c/bin/as68init	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/c/bin/as68init	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,243 @@
+**
+*   Copyright 1981
+*   Alcyon Corporation
+*   8716 Production Ave.
+*   San Diego, Ca.  92121
+*
+*	68010 added operands: movec, moves, rtd.
+*	68010 added control registers: sfc, dfc, vsr.
+*	[vlh] 3 august 83
+*	added vbr sw 2/5/84
+**
+R0:     .equ    0,r
+R1:     .equ    1,r
+R2:     .equ    2,r
+R3:     .equ    3,r
+R4:     .equ    4,r
+R5:     .equ    5,r
+R6:     .equ    6,r
+R7:     .equ    7,r
+R8:     .equ    8,r
+R9:     .equ    9,r
+R10:    .equ    10,r
+R11:    .equ    11,r
+R12:    .equ    12,r
+R13:    .equ    13,r
+R14:    .equ    14,r
+R15:    .equ    15,r
+D0:     .equ    0,r
+D1:     .equ    1,r
+D2:     .equ    2,r
+D3:     .equ    3,r
+D4:     .equ    4,r
+D5:     .equ    5,r
+D6:     .equ    6,r
+D7:     .equ    7,r
+A0:     .equ    @10,r
+A1:     .equ    @11,r
+A2:     .equ    @12,r
+A3:     .equ    @13,r
+A4:     .equ    @14,r
+A5:     .equ    @15,r
+A6:     .equ    @16,r
+A7:     .equ    @17,r
+SP:     .equ    15,r
+CCR:    .equ    16,r
+SR:     .equ    17,r
+r0:     .equ    0,r
+r1:     .equ    1,r
+r2:     .equ    2,r
+r3:     .equ    3,r
+r4:     .equ    4,r
+r5:     .equ    5,r
+r6:     .equ    6,r
+r7:     .equ    7,r
+r8:     .equ    8,r
+r9:     .equ    9,r
+r10:    .equ    10,r
+r11:    .equ    11,r
+r12:    .equ    12,r
+r13:    .equ    13,r
+r14:    .equ    14,r
+r15:    .equ    15,r
+d0:     .equ    0,r
+d1:     .equ    1,r
+d2:     .equ    2,r
+d3:     .equ    3,r
+d4:     .equ    4,r
+d5:     .equ    5,r
+d6:     .equ    6,r
+d7:     .equ    7,r
+a0:     .equ    @10,r
+a1:     .equ    @11,r
+a2:     .equ    @12,r
+a3:     .equ    @13,r
+a4:     .equ    @14,r
+a5:     .equ    @15,r
+a6:     .equ    @16,r
+a7:     .equ    @17,r
+sp:     .equ    15,r
+ccr:    .equ    16,r
+sr:     .equ    17,r
+usp:    .equ    18,r
+USP:    .equ    18,r
+pc:     .equ    22,r
+PC:     .equ    22,r
+sfc:	.equ	23,r
+SFC:	.equ	23,r
+dfc:	.equ	24,r
+DFC:	.equ	24,r
+vsr:	.equ	25,r
+VSR:	.equ	25,r
+vbr:	.equ	25,r
+VBR:	.equ	25,r
+.b:     .equ    19,r
+.B:     .equ    19,r
+.w:     .equ    20,r
+.W:     .equ    20,r
+.l:     .equ    21,r
+.L:     .equ    21,r
+abcd:   .opd    4,@140400
+add:    .opd    1,@150000
+adda:   .opd    15,@150000
+addi:   .opd    2,@003000
+addq:   .opd    17,@050000
+inc:    .opd    16,@050000
+addx:   .opd    27,@150400
+and:    .opd    1,@140000
+andi:   .opd    2,@001000
+asl:    .opd    8,@160400
+asr:    .opd    8,@160000
+bcc:    .opd    6,@062000
+bcs:    .opd    6,@062400
+beq:    .opd    6,@063400
+bze:    .opd    6,@063400
+bge:    .opd    6,@066000
+bgt:    .opd    6,@067000
+bhi:    .opd    6,@061000
+bhis:   .opd    6,@062000
+bhs:    .opd    6,@062000
+ble:    .opd    6,@067400
+blo:    .opd    6,@062400
+bls:    .opd    6,@061400
+blos:   .opd    6,@061400
+blt:    .opd    6,@066400
+bmi:    .opd    6,@065400
+bne:    .opd    6,@063000
+bnz:    .opd    6,@063000
+bpl:    .opd    6,@065000
+bvc:    .opd    6,@064000
+bvs:    .opd    6,@064400
+bchg:   .opd    7,@000100
+bclr:   .opd    7,@000200
+bra:    .opd    6,@060000
+bt:     .opd    6,@060000
+bset:   .opd    7,@000300
+bsr:    .opd    6,@060400
+btst:   .opd    7,@000000
+chk:    .opd    26,@040600
+clr:    .opd    24,@041000
+cmp:    .opd    26,@130000
+cmpa:   .opd    15,@130000
+cmpi:   .opd    2,@006000
+cmpm:   .opd    10,@130410
+dbcc:   .opd    11,@052310
+dbcs:   .opd    11,@052710
+dblo:   .opd    11,@052710
+dbeq:   .opd    11,@053710
+dbze:   .opd    11,@053710
+dbra:   .opd    11,@050710
+dbf:    .opd    11,@050710
+dbge:   .opd    11,@056310
+dbgt:   .opd    11,@057310
+dbhi:   .opd    11,@051310
+dbhs:   .opd    11,@051310
+dble:   .opd    11,@057710
+dbls:   .opd    11,@051710
+dblt:   .opd    11,@056710
+dbmi:   .opd    11,@055710
+dbne:   .opd    11,@053310
+dbnz:   .opd    11,@053310
+dbpl:   .opd    11,@055310
+dbt:    .opd    11,@050310
+dbvc:   .opd    11,@054310
+dbvs:   .opd    11,@054710
+divs:   .opd    5,@100700
+divu:   .opd    5,@100300
+eor:    .opd    23,@130000
+eori:   .opd    2,@005000
+exg:    .opd    12,@140400
+ext:    .opd    13,@044000
+jmp:    .opd    9,@047300
+jsr:    .opd    9,@047200
+illegal: .opd   0,@045374
+lea:    .opd    30,@040700
+link:   .opd    19,@047120
+lsr:    .opd    8,@160010
+lsl:    .opd    8,@160410
+move:   .opd    3,@000000
+movea:  .opd    3,@000100
+movec:	.opd	31,@047172	
+movem:  .opd    20,@044200
+movep:  .opd    21,@000010
+moveq:  .opd    22,@070000
+moves:	.opd	31,@007000
+muls:   .opd    5,@140700
+mulu:   .opd    5,@140300
+nbcd:   .opd    25,@044000
+neg:    .opd    24,@042000
+negx:   .opd    24,@040000
+nop:    .opd    0,@047161
+not:    .opd    24,@043000
+or:     .opd    1,@100000
+ori:    .opd    2,@000000
+pea:    .opd    29,@044100
+reset:  .opd    0,@047160
+rol:    .opd    8,@160430
+ror:    .opd    8,@160030
+roxl:   .opd    8,@160420
+roxr:   .opd    8,@160020
+rtd:    .opd    14,@047164
+rte:    .opd    0,@047163
+rtr:    .opd    0,@047167
+rts:    .opd    0,@047165
+sbcd:   .opd    4,@100400
+scc:    .opd    25,@052300
+shs:    .opd    25,@052300
+scs:    .opd    25,@052700
+slo:    .opd    25,@052700
+seq:    .opd    25,@053700
+sze:    .opd    25,@053700
+sf:     .opd    25,@050700
+sge:    .opd    25,@056300
+sgt:    .opd    25,@057300
+shi:    .opd    25,@051300
+sle:    .opd    25,@057700
+sls:    .opd    25,@051700
+slt:    .opd    25,@056700
+smi:    .opd    25,@055700
+sne:    .opd    25,@053300
+snz:    .opd    25,@053300
+spl:    .opd    25,@055300
+st:     .opd    25,@050300
+svc:    .opd    25,@054300
+svs:    .opd    25,@054700
+stop:   .opd    14,@047162
+sub:    .opd    1,@110000
+suba:   .opd    15,@110000
+subi:   .opd    2,@002000
+subq:   .opd    17,@050400
+dec:    .opd    16,@050400
+subx:   .opd    27,@110400
+swap:   .opd    28,@044100
+tas:    .opd    25,@045300
+trap:   .opd    18,@047100
+trapv:  .opd    0,@047166
+tst:    .opd    24,@045000
+unlk:   .opd    13,@047130
+        .end
+opd    13,@047130
+        .end
+opd    13,@047130
+        .end
+
Index: hatari/c/bin/cc.sh
===================================================================
--- hatari/c/bin/cc.sh	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/c/bin/cc.sh	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,8 @@
+BASE=$1
+cp68 -I d:\inc\ $BASE.c \tmp\cc.i
+c068 \tmp\cc.i \tmp\cc.1 \tmp\cc.2 \tmp\cc.3 -e
+rm \tmp\cc.i
+rm \tmp\cc.3
+c168 \tmp\cc.1 \tmp\cc.2 $BASE.s -l
+rm \tmp\cc.1
+rm \tmp\cc.2
Index: hatari/d/inc/ACIA.H
===================================================================
--- hatari/d/inc/ACIA.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/ACIA.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/ACIA.H
Index: hatari/d/inc/ASCII.H
===================================================================
--- hatari/d/inc/ASCII.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/ASCII.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/ASCII.H
Index: hatari/d/inc/ASGDSP.H
===================================================================
--- hatari/d/inc/ASGDSP.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/ASGDSP.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/ASGDSP.H
Index: hatari/d/inc/BIOSDEFS.H
===================================================================
--- hatari/d/inc/BIOSDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/BIOSDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/BIOSDEFS.H
Index: hatari/d/inc/BOOTSEC.H
===================================================================
--- hatari/d/inc/BOOTSEC.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/BOOTSEC.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/BOOTSEC.H
Index: hatari/d/inc/BPB.H
===================================================================
--- hatari/d/inc/BPB.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/BPB.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/BPB.H
Index: hatari/d/inc/CHARQ.H
===================================================================
--- hatari/d/inc/CHARQ.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/CHARQ.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/CHARQ.H
Index: hatari/d/inc/CHARSET.H
===================================================================
--- hatari/d/inc/CHARSET.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/CHARSET.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/CHARSET.H
Index: hatari/d/inc/CMETA.H
===================================================================
--- hatari/d/inc/CMETA.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/CMETA.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/CMETA.H
Index: hatari/d/inc/CONFIGS.H
===================================================================
--- hatari/d/inc/CONFIGS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/CONFIGS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/CONFIGS.H
Index: hatari/d/inc/CTYPE.H
===================================================================
--- hatari/d/inc/CTYPE.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/CTYPE.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/CTYPE.H
Index: hatari/d/inc/CURPAK.H
===================================================================
--- hatari/d/inc/CURPAK.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/CURPAK.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/CURPAK.H
Index: hatari/d/inc/DEBUG.H
===================================================================
--- hatari/d/inc/DEBUG.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/DEBUG.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/DEBUG.H
Index: hatari/d/inc/DEFGRAPH.H
===================================================================
--- hatari/d/inc/DEFGRAPH.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/DEFGRAPH.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/DEFGRAPH.H
Index: hatari/d/inc/DEFINE.H
===================================================================
--- hatari/d/inc/DEFINE.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/DEFINE.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/DEFINE.H
Index: hatari/d/inc/DFLTINS.H
===================================================================
--- hatari/d/inc/DFLTINS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/DFLTINS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/DFLTINS.H
Index: hatari/d/inc/DIRENT.H
===================================================================
--- hatari/d/inc/DIRENT.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/DIRENT.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/DIRENT.H
Index: hatari/d/inc/ERRDEFS.H
===================================================================
--- hatari/d/inc/ERRDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/ERRDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/ERRDEFS.H
Index: hatari/d/inc/ERRNO.H
===================================================================
--- hatari/d/inc/ERRNO.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/ERRNO.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/ERRNO.H
Index: hatari/d/inc/FCNTL.H
===================================================================
--- hatari/d/inc/FCNTL.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/FCNTL.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/FCNTL.H
Index: hatari/d/inc/FIELDS.H
===================================================================
--- hatari/d/inc/FIELDS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/FIELDS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/FIELDS.H
Index: hatari/d/inc/FPU.H
===================================================================
--- hatari/d/inc/FPU.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/FPU.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/FPU.H
Index: hatari/d/inc/FSPARS.H
===================================================================
--- hatari/d/inc/FSPARS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/FSPARS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/FSPARS.H
Index: hatari/d/inc/GETOPT.H
===================================================================
--- hatari/d/inc/GETOPT.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/GETOPT.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/GETOPT.H
Index: hatari/d/inc/GLCBARS.H
===================================================================
--- hatari/d/inc/GLCBARS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/GLCBARS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/GLCBARS.H
Index: hatari/d/inc/GLCDEFS.H
===================================================================
--- hatari/d/inc/GLCDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/GLCDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/GLCDEFS.H
Index: hatari/d/inc/GLCFNS.H
===================================================================
--- hatari/d/inc/GLCFNS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/GLCFNS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/GLCFNS.H
Index: hatari/d/inc/GLCGRAPH.H
===================================================================
--- hatari/d/inc/GLCGRAPH.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/GLCGRAPH.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/GLCGRAPH.H
Index: hatari/d/inc/GRAPHDEF.H
===================================================================
--- hatari/d/inc/GRAPHDEF.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/GRAPHDEF.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/GRAPHDEF.H
Index: hatari/d/inc/HWDEFS.H
===================================================================
--- hatari/d/inc/HWDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/HWDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/HWDEFS.H
Index: hatari/d/inc/INSTDSP.H
===================================================================
--- hatari/d/inc/INSTDSP.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/INSTDSP.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/INSTDSP.H
Index: hatari/d/inc/IO.H
===================================================================
--- hatari/d/inc/IO.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/IO.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/IO.H
Index: hatari/d/inc/IOREC.H
===================================================================
--- hatari/d/inc/IOREC.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/IOREC.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/IOREC.H
Index: hatari/d/inc/KNMTAB.H
===================================================================
--- hatari/d/inc/KNMTAB.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/KNMTAB.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/KNMTAB.H
Index: hatari/d/inc/LCDLINE.H
===================================================================
--- hatari/d/inc/LCDLINE.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/LCDLINE.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/LCDLINE.H
Index: hatari/d/inc/LIBC.H
===================================================================
--- hatari/d/inc/LIBC.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/LIBC.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/LIBC.H
Index: hatari/d/inc/LIBDSP.H
===================================================================
--- hatari/d/inc/LIBDSP.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/LIBDSP.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/LIBDSP.H
Index: hatari/d/inc/M7MIDI.H
===================================================================
--- hatari/d/inc/M7MIDI.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/M7MIDI.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/M7MIDI.H
Index: hatari/d/inc/MACROS.H
===================================================================
--- hatari/d/inc/MACROS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/MACROS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/MACROS.H
Index: hatari/d/inc/MALLOC.H
===================================================================
--- hatari/d/inc/MALLOC.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/MALLOC.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/MALLOC.H
Index: hatari/d/inc/MEMORY.H
===================================================================
--- hatari/d/inc/MEMORY.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/MEMORY.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/MEMORY.H
Index: hatari/d/inc/MENU.H
===================================================================
--- hatari/d/inc/MENU.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/MENU.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/MENU.H
Index: hatari/d/inc/MIDAS.H
===================================================================
--- hatari/d/inc/MIDAS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/MIDAS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/MIDAS.H
Index: hatari/d/inc/MTDEFS.H
===================================================================
--- hatari/d/inc/MTDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/MTDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/MTDEFS.H
Index: hatari/d/inc/MTFUNCS.H
===================================================================
--- hatari/d/inc/MTFUNCS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/MTFUNCS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/MTFUNCS.H
Index: hatari/d/inc/NEDDEFS.H
===================================================================
--- hatari/d/inc/NEDDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/NEDDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/NEDDEFS.H
Index: hatari/d/inc/NSGP.H
===================================================================
--- hatari/d/inc/NSGP.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/NSGP.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/NSGP.H
Index: hatari/d/inc/NSPAK.H
===================================================================
--- hatari/d/inc/NSPAK.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/NSPAK.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/NSPAK.H
Index: hatari/d/inc/OBJDEFS.H
===================================================================
--- hatari/d/inc/OBJDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/OBJDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/OBJDEFS.H
Index: hatari/d/inc/PANEL.H
===================================================================
--- hatari/d/inc/PANEL.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/PANEL.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/PANEL.H
Index: hatari/d/inc/PATCH.H
===================================================================
--- hatari/d/inc/PATCH.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/PATCH.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/PATCH.H
Index: hatari/d/inc/PORTAB.H
===================================================================
--- hatari/d/inc/PORTAB.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/PORTAB.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/PORTAB.H
Index: hatari/d/inc/PORTSTD.H
===================================================================
--- hatari/d/inc/PORTSTD.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/PORTSTD.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/PORTSTD.H
Index: hatari/d/inc/PTDISP.H
===================================================================
--- hatari/d/inc/PTDISP.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/PTDISP.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/PTDISP.H
Index: hatari/d/inc/PTOFTAB.H
===================================================================
--- hatari/d/inc/PTOFTAB.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/PTOFTAB.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/PTOFTAB.H
Index: hatari/d/inc/RATIO.H
===================================================================
--- hatari/d/inc/RATIO.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/RATIO.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/RATIO.H
Index: hatari/d/inc/RAWIO.H
===================================================================
--- hatari/d/inc/RAWIO.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/RAWIO.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/RAWIO.H
Index: hatari/d/inc/REGOPT.H
===================================================================
--- hatari/d/inc/REGOPT.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/REGOPT.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/REGOPT.H
Index: hatari/d/inc/REGS.H
===================================================================
--- hatari/d/inc/REGS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/REGS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/REGS.H
Index: hatari/d/inc/SCDSP.H
===================================================================
--- hatari/d/inc/SCDSP.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/SCDSP.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/SCDSP.H
Index: hatari/d/inc/SCFNS.H
===================================================================
--- hatari/d/inc/SCFNS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/SCFNS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/SCFNS.H
Index: hatari/d/inc/SCLOCK.H
===================================================================
--- hatari/d/inc/SCLOCK.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/SCLOCK.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/SCLOCK.H
Index: hatari/d/inc/SCORE.H
===================================================================
--- hatari/d/inc/SCORE.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/SCORE.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/SCORE.H
Index: hatari/d/inc/SCWHEEL.H
===================================================================
--- hatari/d/inc/SCWHEEL.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/SCWHEEL.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/SCWHEEL.H
Index: hatari/d/inc/SECDEFS.H
===================================================================
--- hatari/d/inc/SECDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/SECDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/SECDEFS.H
Index: hatari/d/inc/SECOPS.H
===================================================================
--- hatari/d/inc/SECOPS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/SECOPS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/SECOPS.H
Index: hatari/d/inc/SETJMP.H
===================================================================
--- hatari/d/inc/SETJMP.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/SETJMP.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/SETJMP.H
Index: hatari/d/inc/SLICE.H
===================================================================
--- hatari/d/inc/SLICE.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/SLICE.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/SLICE.H
Index: hatari/d/inc/SMDEFS.H
===================================================================
--- hatari/d/inc/SMDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/SMDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/SMDEFS.H
Index: hatari/d/inc/STDDEFS.H
===================================================================
--- hatari/d/inc/STDDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/STDDEFS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/STDDEFS.H
Index: hatari/d/inc/STDIO.H
===================================================================
--- hatari/d/inc/STDIO.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/STDIO.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/STDIO.H
Index: hatari/d/inc/STRINGS.H
===================================================================
--- hatari/d/inc/STRINGS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/STRINGS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/STRINGS.H
Index: hatari/d/inc/SWRTAB.H
===================================================================
--- hatari/d/inc/SWRTAB.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/SWRTAB.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/SWRTAB.H
Index: hatari/d/inc/TIMERS.H
===================================================================
--- hatari/d/inc/TIMERS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/TIMERS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/TIMERS.H
Index: hatari/d/inc/TUNDSP.H
===================================================================
--- hatari/d/inc/TUNDSP.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/TUNDSP.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/TUNDSP.H
Index: hatari/d/inc/UARTIO.H
===================================================================
--- hatari/d/inc/UARTIO.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/UARTIO.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/UARTIO.H
Index: hatari/d/inc/VARARGS.H
===================================================================
--- hatari/d/inc/VARARGS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/VARARGS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/VARARGS.H
Index: hatari/d/inc/VSDD.H
===================================================================
--- hatari/d/inc/VSDD.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/VSDD.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/VSDD.H
Index: hatari/d/inc/VSDDSW.H
===================================================================
--- hatari/d/inc/VSDDSW.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/VSDDSW.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/VSDDSW.H
Index: hatari/d/inc/VSDDVARS.H
===================================================================
--- hatari/d/inc/VSDDVARS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/VSDDVARS.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/VSDDVARS.H
Index: hatari/d/inc/WDCURTB.H
===================================================================
--- hatari/d/inc/WDCURTB.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/WDCURTB.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/WDCURTB.H
Index: hatari/d/inc/WORDQ.H
===================================================================
--- hatari/d/inc/WORDQ.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/WORDQ.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/WORDQ.H
Index: hatari/d/inc/WSDSP.H
===================================================================
--- hatari/d/inc/WSDSP.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/WSDSP.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/WSDSP.H
Index: hatari/d/inc/XPORT.H
===================================================================
--- hatari/d/inc/XPORT.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/inc/XPORT.H	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/lib/INCLUDE/XPORT.H
Index: hatari/d/lib/ACCTRL.S
===================================================================
--- hatari/d/lib/ACCTRL.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/ACCTRL.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/ACCTRL.S
Index: hatari/d/lib/ALDIV.S
===================================================================
--- hatari/d/lib/ALDIV.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/ALDIV.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/ALDIV.S
Index: hatari/d/lib/ALMUL.S
===================================================================
--- hatari/d/lib/ALMUL.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/ALMUL.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/ALMUL.S
Index: hatari/d/lib/ALREM.S
===================================================================
--- hatari/d/lib/ALREM.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/ALREM.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/ALREM.S
Index: hatari/d/lib/ATOI.C
===================================================================
--- hatari/d/lib/ATOI.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/ATOI.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/ATOI.C
Index: hatari/d/lib/ATOL.C
===================================================================
--- hatari/d/lib/ATOL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/ATOL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/ATOL.C
Index: hatari/d/lib/BITREV.C
===================================================================
--- hatari/d/lib/BITREV.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/BITREV.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/BITREV.C
Index: hatari/d/lib/BLKFILL.S
===================================================================
--- hatari/d/lib/BLKFILL.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/BLKFILL.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/BLKFILL.S
Index: hatari/d/lib/BLKMOVE.S
===================================================================
--- hatari/d/lib/BLKMOVE.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/BLKMOVE.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/BLKMOVE.S
Index: hatari/d/lib/BLKRD.C
===================================================================
--- hatari/d/lib/BLKRD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/BLKRD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/BLKRD.C
Index: hatari/d/lib/BLKWR.C
===================================================================
--- hatari/d/lib/BLKWR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/BLKWR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/BLKWR.C
Index: hatari/d/lib/CG2.C
===================================================================
--- hatari/d/lib/CG2.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/CG2.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/CG2.C
Index: hatari/d/lib/CG3.C
===================================================================
--- hatari/d/lib/CG3.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/CG3.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/CG3.C
Index: hatari/d/lib/CLOSE.C
===================================================================
--- hatari/d/lib/CLOSE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/CLOSE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/CLOSE.C
Index: hatari/d/lib/CLUSMAP.C
===================================================================
--- hatari/d/lib/CLUSMAP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/CLUSMAP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/CLUSMAP.C
Index: hatari/d/lib/CONIN.C
===================================================================
--- hatari/d/lib/CONIN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/CONIN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/CONIN.C
Index: hatari/d/lib/CONWR.C
===================================================================
--- hatari/d/lib/CONWR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/CONWR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/CONWR.C
Index: hatari/d/lib/CTYPE.C
===================================================================
--- hatari/d/lib/CTYPE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/CTYPE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/CTYPE.C
Index: hatari/d/lib/DIRFNS.C
===================================================================
--- hatari/d/lib/DIRFNS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/DIRFNS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/DIRFNS.C
Index: hatari/d/lib/DOFMT.C
===================================================================
--- hatari/d/lib/DOFMT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/DOFMT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/DOFMT.C
Index: hatari/d/lib/FGETS.C
===================================================================
--- hatari/d/lib/FGETS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/FGETS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/FGETS.C
Index: hatari/d/lib/FILESYS.C
===================================================================
--- hatari/d/lib/FILESYS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/FILESYS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/FILESYS.C
Index: hatari/d/lib/FILNAME.C
===================================================================
--- hatari/d/lib/FILNAME.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/FILNAME.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/FILNAME.C
Index: hatari/d/lib/FINALONE.S
===================================================================
--- hatari/d/lib/FINALONE.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/FINALONE.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/FINALONE.S
Index: hatari/d/lib/FLREAD.C
===================================================================
--- hatari/d/lib/FLREAD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/FLREAD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/FLREAD.C
Index: hatari/d/lib/FOPEN.C
===================================================================
--- hatari/d/lib/FOPEN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/FOPEN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/FOPEN.C
Index: hatari/d/lib/FPRINTF.C
===================================================================
--- hatari/d/lib/FPRINTF.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/FPRINTF.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/FPRINTF.C
Index: hatari/d/lib/FPUTS.C
===================================================================
--- hatari/d/lib/FPUTS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/FPUTS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/FPUTS.C
Index: hatari/d/lib/FREAD.C
===================================================================
--- hatari/d/lib/FREAD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/FREAD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/FREAD.C
Index: hatari/d/lib/FSCANF.C
===================================================================
--- hatari/d/lib/FSCANF.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/FSCANF.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/FSCANF.C
Index: hatari/d/lib/FSEEK.C
===================================================================
--- hatari/d/lib/FSEEK.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/FSEEK.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/FSEEK.C
Index: hatari/d/lib/FSINIT.C
===================================================================
--- hatari/d/lib/FSINIT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/FSINIT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/FSINIT.C
Index: hatari/d/lib/FSIZE.C
===================================================================
--- hatari/d/lib/FSIZE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/FSIZE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/FSIZE.C
Index: hatari/d/lib/FSTUBS.C
===================================================================
--- hatari/d/lib/FSTUBS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/FSTUBS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/FSTUBS.C
Index: hatari/d/lib/FTELL.C
===================================================================
--- hatari/d/lib/FTELL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/FTELL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/FTELL.C
Index: hatari/d/lib/FWRITE.C
===================================================================
--- hatari/d/lib/FWRITE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/FWRITE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/FWRITE.C
Index: hatari/d/lib/GETBUFF.C
===================================================================
--- hatari/d/lib/GETBUFF.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/GETBUFF.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/GETBUFF.C
Index: hatari/d/lib/GETC.C
===================================================================
--- hatari/d/lib/GETC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/GETC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/GETC.C
Index: hatari/d/lib/GETL.C
===================================================================
--- hatari/d/lib/GETL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/GETL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/GETL.C
Index: hatari/d/lib/GETW.C
===================================================================
--- hatari/d/lib/GETW.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/GETW.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/GETW.C
Index: hatari/d/lib/GLCINIT.C
===================================================================
--- hatari/d/lib/GLCINIT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/GLCINIT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/GLCINIT.C
Index: hatari/d/lib/GLCPLOT.S
===================================================================
--- hatari/d/lib/GLCPLOT.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/GLCPLOT.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/GLCPLOT.S
Index: hatari/d/lib/HWDEFS.S
===================================================================
--- hatari/d/lib/HWDEFS.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/HWDEFS.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/HWDEFS.S
Index: hatari/d/lib/INDEX.C
===================================================================
--- hatari/d/lib/INDEX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/INDEX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/INDEX.C
Index: hatari/d/lib/ISPOW2.C
===================================================================
--- hatari/d/lib/ISPOW2.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/ISPOW2.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/ISPOW2.C
Index: hatari/d/lib/JUMPTO.S
===================================================================
--- hatari/d/lib/JUMPTO.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/JUMPTO.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/JUMPTO.S
Index: hatari/d/lib/LDIV.S
===================================================================
--- hatari/d/lib/LDIV.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/LDIV.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/LDIV.S
Index: hatari/d/lib/LMUL.S
===================================================================
--- hatari/d/lib/LMUL.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/LMUL.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/LMUL.S
Index: hatari/d/lib/LREM.S
===================================================================
--- hatari/d/lib/LREM.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/LREM.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/LREM.S
Index: hatari/d/lib/LSEEK.C
===================================================================
--- hatari/d/lib/LSEEK.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/LSEEK.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/LSEEK.C
Index: hatari/d/lib/LSEG.C
===================================================================
--- hatari/d/lib/LSEG.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/LSEG.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/LSEG.C
Index: hatari/d/lib/MANGLE.C
===================================================================
--- hatari/d/lib/MANGLE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/MANGLE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/MANGLE.C
Index: hatari/d/lib/MDUMP.C
===================================================================
--- hatari/d/lib/MDUMP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/MDUMP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/MDUMP.C
Index: hatari/d/lib/MEMCCPY.C
===================================================================
--- hatari/d/lib/MEMCCPY.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/MEMCCPY.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/MEMCCPY.C
Index: hatari/d/lib/MEMCHR.C
===================================================================
--- hatari/d/lib/MEMCHR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/MEMCHR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/MEMCHR.C
Index: hatari/d/lib/MEMCMP.C
===================================================================
--- hatari/d/lib/MEMCMP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/MEMCMP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/MEMCMP.C
Index: hatari/d/lib/MEMCMPU.C
===================================================================
--- hatari/d/lib/MEMCMPU.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/MEMCMPU.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/MEMCMPU.C
Index: hatari/d/lib/MEMCPY.C
===================================================================
--- hatari/d/lib/MEMCPY.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/MEMCPY.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/MEMCPY.C
Index: hatari/d/lib/MEMCPYW.C
===================================================================
--- hatari/d/lib/MEMCPYW.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/MEMCPYW.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/MEMCPYW.C
Index: hatari/d/lib/MEMSET.C
===================================================================
--- hatari/d/lib/MEMSET.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/MEMSET.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/MEMSET.C
Index: hatari/d/lib/MEMSETW.C
===================================================================
--- hatari/d/lib/MEMSETW.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/MEMSETW.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/MEMSETW.C
Index: hatari/d/lib/MICONS.C
===================================================================
--- hatari/d/lib/MICONS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/MICONS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/MICONS.C
Index: hatari/d/lib/OPEN.C
===================================================================
--- hatari/d/lib/OPEN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/OPEN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/OPEN.C
Index: hatari/d/lib/PAUSE.C
===================================================================
--- hatari/d/lib/PAUSE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/PAUSE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/PAUSE.C
Index: hatari/d/lib/POSIT.C
===================================================================
--- hatari/d/lib/POSIT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/POSIT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/POSIT.C
Index: hatari/d/lib/PRINTF.C
===================================================================
--- hatari/d/lib/PRINTF.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/PRINTF.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/PRINTF.C
Index: hatari/d/lib/PTCL12.S
===================================================================
--- hatari/d/lib/PTCL12.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/PTCL12.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/PTCL12.S
Index: hatari/d/lib/PUTC.C
===================================================================
--- hatari/d/lib/PUTC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/PUTC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/PUTC.C
Index: hatari/d/lib/PUTL.C
===================================================================
--- hatari/d/lib/PUTL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/PUTL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/PUTL.C
Index: hatari/d/lib/PUTW.C
===================================================================
--- hatari/d/lib/PUTW.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/PUTW.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/PUTW.C
Index: hatari/d/lib/QSORT.C
===================================================================
--- hatari/d/lib/QSORT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/QSORT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/QSORT.C
Index: hatari/d/lib/RAND24.S
===================================================================
--- hatari/d/lib/RAND24.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/RAND24.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/RAND24.S
Index: hatari/d/lib/RAWIO.C
===================================================================
--- hatari/d/lib/RAWIO.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/RAWIO.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/RAWIO.C
Index: hatari/d/lib/READ.C
===================================================================
--- hatari/d/lib/READ.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/READ.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/READ.C
Index: hatari/d/lib/READRN.C
===================================================================
--- hatari/d/lib/READRN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/READRN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/READRN.C
Index: hatari/d/lib/RENAME.C
===================================================================
--- hatari/d/lib/RENAME.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/RENAME.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/RENAME.C
Index: hatari/d/lib/RINDEX.C
===================================================================
--- hatari/d/lib/RINDEX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/RINDEX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/RINDEX.C
Index: hatari/d/lib/RTRAPS.S
===================================================================
--- hatari/d/lib/RTRAPS.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/RTRAPS.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/RTRAPS.S
Index: hatari/d/lib/SCAN.C
===================================================================
--- hatari/d/lib/SCAN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/SCAN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/SCAN.C
Index: hatari/d/lib/SETBUF.C
===================================================================
--- hatari/d/lib/SETBUF.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/SETBUF.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/SETBUF.C
Index: hatari/d/lib/SETIPL.S
===================================================================
--- hatari/d/lib/SETIPL.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/SETIPL.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/SETIPL.S
Index: hatari/d/lib/SETJMP.S
===================================================================
--- hatari/d/lib/SETJMP.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/SETJMP.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/SETJMP.S
Index: hatari/d/lib/SETSR.S
===================================================================
--- hatari/d/lib/SETSR.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/SETSR.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/SETSR.S
Index: hatari/d/lib/SPRINTF.C
===================================================================
--- hatari/d/lib/SPRINTF.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/SPRINTF.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/SPRINTF.C
Index: hatari/d/lib/STR2LC.C
===================================================================
--- hatari/d/lib/STR2LC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STR2LC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STR2LC.C
Index: hatari/d/lib/STR2UC.C
===================================================================
--- hatari/d/lib/STR2UC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STR2UC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STR2UC.C
Index: hatari/d/lib/STRCAT.C
===================================================================
--- hatari/d/lib/STRCAT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRCAT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRCAT.C
Index: hatari/d/lib/STRCCPY.C
===================================================================
--- hatari/d/lib/STRCCPY.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRCCPY.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRCCPY.C
Index: hatari/d/lib/STRCHR.C
===================================================================
--- hatari/d/lib/STRCHR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRCHR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRCHR.C
Index: hatari/d/lib/STRCMP.C
===================================================================
--- hatari/d/lib/STRCMP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRCMP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRCMP.C
Index: hatari/d/lib/STRCPY.C
===================================================================
--- hatari/d/lib/STRCPY.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRCPY.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRCPY.C
Index: hatari/d/lib/STRCSPN.C
===================================================================
--- hatari/d/lib/STRCSPN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRCSPN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRCSPN.C
Index: hatari/d/lib/STRFILL.C
===================================================================
--- hatari/d/lib/STRFILL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRFILL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRFILL.C
Index: hatari/d/lib/STRLCMP.C
===================================================================
--- hatari/d/lib/STRLCMP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRLCMP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRLCMP.C
Index: hatari/d/lib/STRLEN.C
===================================================================
--- hatari/d/lib/STRLEN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRLEN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRLEN.C
Index: hatari/d/lib/STRLTRM.C
===================================================================
--- hatari/d/lib/STRLTRM.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRLTRM.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRLTRM.C
Index: hatari/d/lib/STRNCAT.C
===================================================================
--- hatari/d/lib/STRNCAT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRNCAT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRNCAT.C
Index: hatari/d/lib/STRNCMP.C
===================================================================
--- hatari/d/lib/STRNCMP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRNCMP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRNCMP.C
Index: hatari/d/lib/STRNCPY.C
===================================================================
--- hatari/d/lib/STRNCPY.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRNCPY.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRNCPY.C
Index: hatari/d/lib/STRPBRK.C
===================================================================
--- hatari/d/lib/STRPBRK.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRPBRK.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRPBRK.C
Index: hatari/d/lib/STRRCHR.C
===================================================================
--- hatari/d/lib/STRRCHR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRRCHR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRRCHR.C
Index: hatari/d/lib/STRREV.C
===================================================================
--- hatari/d/lib/STRREV.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRREV.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRREV.C
Index: hatari/d/lib/STRREVI.C
===================================================================
--- hatari/d/lib/STRREVI.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRREVI.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRREVI.C
Index: hatari/d/lib/STRRTRM.C
===================================================================
--- hatari/d/lib/STRRTRM.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRRTRM.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRRTRM.C
Index: hatari/d/lib/STRSPN.C
===================================================================
--- hatari/d/lib/STRSPN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRSPN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRSPN.C
Index: hatari/d/lib/STRTOK.C
===================================================================
--- hatari/d/lib/STRTOK.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRTOK.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRTOK.C
Index: hatari/d/lib/STRTOL.C
===================================================================
--- hatari/d/lib/STRTOL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/STRTOL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/STRTOL.C
Index: hatari/d/lib/TESTCIO.C
===================================================================
--- hatari/d/lib/TESTCIO.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/TESTCIO.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/TESTCIO.C
Index: hatari/d/lib/TOLOWER.C
===================================================================
--- hatari/d/lib/TOLOWER.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/TOLOWER.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/TOLOWER.C
Index: hatari/d/lib/TOUPPER.C
===================================================================
--- hatari/d/lib/TOUPPER.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/TOUPPER.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/TOUPPER.C
Index: hatari/d/lib/TRAPS.S
===================================================================
--- hatari/d/lib/TRAPS.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/TRAPS.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/TRAPS.S
Index: hatari/d/lib/TSPLOT4.S
===================================================================
--- hatari/d/lib/TSPLOT4.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/TSPLOT4.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/TSPLOT4.S
Index: hatari/d/lib/ULDIV.S
===================================================================
--- hatari/d/lib/ULDIV.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/ULDIV.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/CLIBRARY/ULDIV.S
Index: hatari/d/lib/UNGETC.C
===================================================================
--- hatari/d/lib/UNGETC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/UNGETC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/UNGETC.C
Index: hatari/d/lib/UNLINK.C
===================================================================
--- hatari/d/lib/UNLINK.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/UNLINK.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/UNLINK.C
Index: hatari/d/lib/VBANK.S
===================================================================
--- hatari/d/lib/VBANK.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VBANK.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VBANK.S
Index: hatari/d/lib/VBFILL4.C
===================================================================
--- hatari/d/lib/VBFILL4.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VBFILL4.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VBFILL4.C
Index: hatari/d/lib/VCLRAV.S
===================================================================
--- hatari/d/lib/VCLRAV.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VCLRAV.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VCLRAV.S
Index: hatari/d/lib/VCLRS.C
===================================================================
--- hatari/d/lib/VCLRS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VCLRS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VCLRS.C
Index: hatari/d/lib/VCPUTS.S
===================================================================
--- hatari/d/lib/VCPUTS.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VCPUTS.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VCPUTS.S
Index: hatari/d/lib/VCPUTSV.S
===================================================================
--- hatari/d/lib/VCPUTSV.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VCPUTSV.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VCPUTSV.S
Index: hatari/d/lib/VCTRL.C
===================================================================
--- hatari/d/lib/VCTRL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VCTRL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VCTRL.C
Index: hatari/d/lib/VHINIT.C
===================================================================
--- hatari/d/lib/VHINIT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VHINIT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VHINIT.C
Index: hatari/d/lib/VIINT.S
===================================================================
--- hatari/d/lib/VIINT.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VIINT.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VIINT.S
Index: hatari/d/lib/VMPUT.C
===================================================================
--- hatari/d/lib/VMPUT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VMPUT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VMPUT.C
Index: hatari/d/lib/VOBJFNS.C
===================================================================
--- hatari/d/lib/VOBJFNS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VOBJFNS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VOBJFNS.C
Index: hatari/d/lib/VPUTA.S
===================================================================
--- hatari/d/lib/VPUTA.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VPUTA.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VPUTA.S
Index: hatari/d/lib/VPUTC.S
===================================================================
--- hatari/d/lib/VPUTC.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VPUTC.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VPUTC.S
Index: hatari/d/lib/VPUTCV.S
===================================================================
--- hatari/d/lib/VPUTCV.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VPUTCV.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VPUTCV.S
Index: hatari/d/lib/VPUTP.S
===================================================================
--- hatari/d/lib/VPUTP.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VPUTP.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VPUTP.S
Index: hatari/d/lib/VPUTS.C
===================================================================
--- hatari/d/lib/VPUTS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VPUTS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VPUTS.C
Index: hatari/d/lib/VPUTSV.C
===================================================================
--- hatari/d/lib/VPUTSV.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VPUTSV.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VPUTSV.C
Index: hatari/d/lib/VSETAV.S
===================================================================
--- hatari/d/lib/VSETAV.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VSETAV.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VSETAV.S
Index: hatari/d/lib/VSETCV.S
===================================================================
--- hatari/d/lib/VSETCV.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VSETCV.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VSETCV.S
Index: hatari/d/lib/VSETPAL.C
===================================================================
--- hatari/d/lib/VSETPAL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VSETPAL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VSETPAL.C
Index: hatari/d/lib/VSINIT.C
===================================================================
--- hatari/d/lib/VSINIT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VSINIT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VSINIT.C
Index: hatari/d/lib/VSPLOT4.S
===================================================================
--- hatari/d/lib/VSPLOT4.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VSPLOT4.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VSPLOT4.S
Index: hatari/d/lib/VSPRAY4.C
===================================================================
--- hatari/d/lib/VSPRAY4.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VSPRAY4.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VSPRAY4.C
Index: hatari/d/lib/VTEXT.C
===================================================================
--- hatari/d/lib/VTEXT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VTEXT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VTEXT.C
Index: hatari/d/lib/VVPUTSV.S
===================================================================
--- hatari/d/lib/VVPUTSV.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VVPUTSV.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VVPUTSV.S
Index: hatari/d/lib/VWPUTM.C
===================================================================
--- hatari/d/lib/VWPUTM.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VWPUTM.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VWPUTM.C
Index: hatari/d/lib/VWPUTP.S
===================================================================
--- hatari/d/lib/VWPUTP.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VWPUTP.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VWPUTP.S
Index: hatari/d/lib/VWPUTS.S
===================================================================
--- hatari/d/lib/VWPUTS.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/VWPUTS.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/VWPUTS.S
Index: hatari/d/lib/WAITCR.C
===================================================================
--- hatari/d/lib/WAITCR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/WAITCR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/WAITCR.C
Index: hatari/d/lib/WRITE.C
===================================================================
--- hatari/d/lib/WRITE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/WRITE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/WRITE.C
Index: hatari/d/lib/WRITERN.C
===================================================================
--- hatari/d/lib/WRITERN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/lib/WRITERN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/IOLIB/WRITERN.C
Index: hatari/d/ram/ADDFPU.C
===================================================================
--- hatari/d/ram/ADDFPU.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ADDFPU.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ADDFPU.C
Index: hatari/d/ram/ADFIELD.C
===================================================================
--- hatari/d/ram/ADFIELD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ADFIELD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ADFIELD.C
Index: hatari/d/ram/ADSELBX.C
===================================================================
--- hatari/d/ram/ADSELBX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ADSELBX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ADSELBX.C
Index: hatari/d/ram/ASGDSP.C
===================================================================
--- hatari/d/ram/ASGDSP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ASGDSP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ASGDSP.C
Index: hatari/d/ram/ASGVCE.C
===================================================================
--- hatari/d/ram/ASGVCE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ASGVCE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ASGVCE.C
Index: hatari/d/ram/BARBADJ.C
===================================================================
--- hatari/d/ram/BARBADJ.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/BARBADJ.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/BARBADJ.C
Index: hatari/d/ram/CHGSEF.C
===================================================================
--- hatari/d/ram/CHGSEF.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/CHGSEF.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/CHGSEF.C
Index: hatari/d/ram/CHKSEC.C
===================================================================
--- hatari/d/ram/CHKSEC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/CHKSEC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/CHKSEC.C
Index: hatari/d/ram/CMINIT.C
===================================================================
--- hatari/d/ram/CMINIT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/CMINIT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/CMINIT.C
Index: hatari/d/ram/CTCPOS.C
===================================================================
--- hatari/d/ram/CTCPOS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/CTCPOS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/CTCPOS.C
Index: hatari/d/ram/CURSET.C
===================================================================
--- hatari/d/ram/CURSET.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/CURSET.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/CURSET.C
Index: hatari/d/ram/DBENTR.C
===================================================================
--- hatari/d/ram/DBENTR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/DBENTR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/DBENTR.C
Index: hatari/d/ram/DCOPY.C
===================================================================
--- hatari/d/ram/DCOPY.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/DCOPY.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/DCOPY.C
Index: hatari/d/ram/DEC2FR.C
===================================================================
--- hatari/d/ram/DEC2FR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/DEC2FR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/DEC2FR.C
Index: hatari/d/ram/DELNOTE.C
===================================================================
--- hatari/d/ram/DELNOTE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/DELNOTE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/DELNOTE.C
Index: hatari/d/ram/DELPNTS.C
===================================================================
--- hatari/d/ram/DELPNTS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/DELPNTS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/DELPNTS.C
Index: hatari/d/ram/DFORMAT.C
===================================================================
--- hatari/d/ram/DFORMAT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/DFORMAT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/DFORMAT.C
Index: hatari/d/ram/DOPATCH.C
===================================================================
--- hatari/d/ram/DOPATCH.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/DOPATCH.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/DOPATCH.C
Index: hatari/d/ram/ENTERIT.C
===================================================================
--- hatari/d/ram/ENTERIT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ENTERIT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ENTERIT.C
Index: hatari/d/ram/ETACCN.C
===================================================================
--- hatari/d/ram/ETACCN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETACCN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETACCN.C
Index: hatari/d/ram/ETADEP.C
===================================================================
--- hatari/d/ram/ETADEP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETADEP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETADEP.C
Index: hatari/d/ram/ETADYN.C
===================================================================
--- hatari/d/ram/ETADYN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETADYN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETADYN.C
Index: hatari/d/ram/ETAGCH.C
===================================================================
--- hatari/d/ram/ETAGCH.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETAGCH.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETAGCH.C
Index: hatari/d/ram/ETAGPT.C
===================================================================
--- hatari/d/ram/ETAGPT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETAGPT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETAGPT.C
Index: hatari/d/ram/ETAINS.C
===================================================================
--- hatari/d/ram/ETAINS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETAINS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETAINS.C
Index: hatari/d/ram/ETAINT.C
===================================================================
--- hatari/d/ram/ETAINT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETAINT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETAINT.C
Index: hatari/d/ram/ETAOPT.C
===================================================================
--- hatari/d/ram/ETAOPT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETAOPT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETAOPT.C
Index: hatari/d/ram/ETAPRG.C
===================================================================
--- hatari/d/ram/ETAPRG.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETAPRG.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETAPRG.C
Index: hatari/d/ram/ETARAT.C
===================================================================
--- hatari/d/ram/ETARAT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETARAT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETARAT.C
Index: hatari/d/ram/ETATAB.C
===================================================================
--- hatari/d/ram/ETATAB.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETATAB.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETATAB.C
Index: hatari/d/ram/ETATUN.C
===================================================================
--- hatari/d/ram/ETATUN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETATUN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETATUN.C
Index: hatari/d/ram/ETAVGR.C
===================================================================
--- hatari/d/ram/ETAVGR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETAVGR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETAVGR.C
Index: hatari/d/ram/ETDYN.C
===================================================================
--- hatari/d/ram/ETDYN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETDYN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETDYN.C
Index: hatari/d/ram/ETIACT.C
===================================================================
--- hatari/d/ram/ETIACT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETIACT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETIACT.C
Index: hatari/d/ram/ETICNF.C
===================================================================
--- hatari/d/ram/ETICNF.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETICNF.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETICNF.C
Index: hatari/d/ram/ETIDIN.C
===================================================================
--- hatari/d/ram/ETIDIN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETIDIN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETIDIN.C
Index: hatari/d/ram/ETIMLT.C
===================================================================
--- hatari/d/ram/ETIMLT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETIMLT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETIMLT.C
Index: hatari/d/ram/ETINST.C
===================================================================
--- hatari/d/ram/ETINST.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETINST.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETINST.C
Index: hatari/d/ram/ETIOAS.C
===================================================================
--- hatari/d/ram/ETIOAS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETIOAS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETIOAS.C
Index: hatari/d/ram/ETIOSC.C
===================================================================
--- hatari/d/ram/ETIOSC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETIOSC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETIOSC.C
Index: hatari/d/ram/ETIPNT.C
===================================================================
--- hatari/d/ram/ETIPNT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETIPNT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETIPNT.C
Index: hatari/d/ram/ETIRES.C
===================================================================
--- hatari/d/ram/ETIRES.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETIRES.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETIRES.C
Index: hatari/d/ram/ETITIM.C
===================================================================
--- hatari/d/ram/ETITIM.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETITIM.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETITIM.C
Index: hatari/d/ram/ETIVAL.C
===================================================================
--- hatari/d/ram/ETIVAL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETIVAL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETIVAL.C
Index: hatari/d/ram/ETIVCE.C
===================================================================
--- hatari/d/ram/ETIVCE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETIVCE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETIVCE.C
Index: hatari/d/ram/ETIWSN.C
===================================================================
--- hatari/d/ram/ETIWSN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETIWSN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETIWSN.C
Index: hatari/d/ram/ETLOC.C
===================================================================
--- hatari/d/ram/ETLOC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETLOC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETLOC.C
Index: hatari/d/ram/ETMCFN.C
===================================================================
--- hatari/d/ram/ETMCFN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETMCFN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETMCFN.C
Index: hatari/d/ram/ETREL.C
===================================================================
--- hatari/d/ram/ETREL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETREL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETREL.C
Index: hatari/d/ram/ETRES1.C
===================================================================
--- hatari/d/ram/ETRES1.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETRES1.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETRES1.C
Index: hatari/d/ram/ETSCOR.C
===================================================================
--- hatari/d/ram/ETSCOR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETSCOR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETSCOR.C
Index: hatari/d/ram/ETSNBT.C
===================================================================
--- hatari/d/ram/ETSNBT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETSNBT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETSNBT.C
Index: hatari/d/ram/ETSTRN.C
===================================================================
--- hatari/d/ram/ETSTRN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETSTRN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETSTRN.C
Index: hatari/d/ram/ETTPCH.C
===================================================================
--- hatari/d/ram/ETTPCH.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETTPCH.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETTPCH.C
Index: hatari/d/ram/ETTRNS.C
===================================================================
--- hatari/d/ram/ETTRNS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETTRNS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETTRNS.C
Index: hatari/d/ram/ETTTAB.C
===================================================================
--- hatari/d/ram/ETTTAB.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETTTAB.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETTTAB.C
Index: hatari/d/ram/ETTVAL.C
===================================================================
--- hatari/d/ram/ETTVAL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETTVAL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETTVAL.C
Index: hatari/d/ram/ETVEL.C
===================================================================
--- hatari/d/ram/ETVEL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETVEL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETVEL.C
Index: hatari/d/ram/ETWAVS.C
===================================================================
--- hatari/d/ram/ETWAVS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETWAVS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETWAVS.C
Index: hatari/d/ram/ETWHAR.C
===================================================================
--- hatari/d/ram/ETWHAR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETWHAR.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETWHAR.C
Index: hatari/d/ram/ETWHRV.C
===================================================================
--- hatari/d/ram/ETWHRV.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETWHRV.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETWHRV.C
Index: hatari/d/ram/ETWOFF.C
===================================================================
--- hatari/d/ram/ETWOFF.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETWOFF.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETWOFF.C
Index: hatari/d/ram/ETWPNT.C
===================================================================
--- hatari/d/ram/ETWPNT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETWPNT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETWPNT.C
Index: hatari/d/ram/ETWSLT.C
===================================================================
--- hatari/d/ram/ETWSLT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETWSLT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETWSLT.C
Index: hatari/d/ram/ETWVCE.C
===================================================================
--- hatari/d/ram/ETWVCE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ETWVCE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ETWVCE.C
Index: hatari/d/ram/EXECINS.S
===================================================================
--- hatari/d/ram/EXECINS.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/EXECINS.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/EXECINS.S
Index: hatari/d/ram/EXECKEY.S
===================================================================
--- hatari/d/ram/EXECKEY.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/EXECKEY.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/EXECKEY.S
Index: hatari/d/ram/FCNOTE.C
===================================================================
--- hatari/d/ram/FCNOTE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/FCNOTE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/FCNOTE.C
Index: hatari/d/ram/FPUINT.S
===================================================================
--- hatari/d/ram/FPUINT.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/FPUINT.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/FPUINT.S
Index: hatari/d/ram/FRFIND.C
===================================================================
--- hatari/d/ram/FRFIND.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/FRFIND.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/FRFIND.C
Index: hatari/d/ram/GCURPOS.C
===================================================================
--- hatari/d/ram/GCURPOS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/GCURPOS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/GCURPOS.C
Index: hatari/d/ram/IDFIELD.C
===================================================================
--- hatari/d/ram/IDFIELD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/IDFIELD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/IDFIELD.C
Index: hatari/d/ram/IDSELBX.C
===================================================================
--- hatari/d/ram/IDSELBX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/IDSELBX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/IDSELBX.C
Index: hatari/d/ram/IM700.C
===================================================================
--- hatari/d/ram/IM700.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/IM700.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/IM700.C
Index: hatari/d/ram/INFIELD.C
===================================================================
--- hatari/d/ram/INFIELD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/INFIELD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/INFIELD.C
Index: hatari/d/ram/INITI.C
===================================================================
--- hatari/d/ram/INITI.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/INITI.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/INITI.C
Index: hatari/d/ram/INSTDSP.C
===================================================================
--- hatari/d/ram/INSTDSP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/INSTDSP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/INSTDSP.C
Index: hatari/d/ram/ITCPOS.C
===================================================================
--- hatari/d/ram/ITCPOS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/ITCPOS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/ITCPOS.C
Index: hatari/d/ram/KBOBJ.C
===================================================================
--- hatari/d/ram/KBOBJ.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/KBOBJ.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/KBOBJ.C
Index: hatari/d/ram/LCDLBLS.C
===================================================================
--- hatari/d/ram/LCDLBLS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/LCDLBLS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/LCDLBLS.C
Index: hatari/d/ram/LDFIELD.C
===================================================================
--- hatari/d/ram/LDFIELD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/LDFIELD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/LDFIELD.C
Index: hatari/d/ram/LDSELBX.C
===================================================================
--- hatari/d/ram/LDSELBX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/LDSELBX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/LDSELBX.C
Index: hatari/d/ram/LIBDSP.C
===================================================================
--- hatari/d/ram/LIBDSP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/LIBDSP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/LIBDSP.C
Index: hatari/d/ram/LIBRW.C
===================================================================
--- hatari/d/ram/LIBRW.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/LIBRW.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/LIBRW.C
Index: hatari/d/ram/LOCALKB.C
===================================================================
--- hatari/d/ram/LOCALKB.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/LOCALKB.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/LOCALKB.C
Index: hatari/d/ram/M7MENU.C
===================================================================
--- hatari/d/ram/M7MENU.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/M7MENU.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/M7MENU.C
Index: hatari/d/ram/MIDAS.C
===================================================================
--- hatari/d/ram/MIDAS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/MIDAS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/MIDAS.C
Index: hatari/d/ram/MSL.C
===================================================================
--- hatari/d/ram/MSL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/MSL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/MSL.C
Index: hatari/d/ram/MSM.C
===================================================================
--- hatari/d/ram/MSM.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/MSM.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/MSM.C
Index: hatari/d/ram/NEDACC.C
===================================================================
--- hatari/d/ram/NEDACC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/NEDACC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/NEDACC.C
Index: hatari/d/ram/PIX2MID.C
===================================================================
--- hatari/d/ram/PIX2MID.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/PIX2MID.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/PIX2MID.C
Index: hatari/d/ram/PROCPFL.S
===================================================================
--- hatari/d/ram/PROCPFL.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/PROCPFL.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/PROCPFL.S
Index: hatari/d/ram/PTDISP.C
===================================================================
--- hatari/d/ram/PTDISP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/PTDISP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/PTDISP.C
Index: hatari/d/ram/PTDKEY.C
===================================================================
--- hatari/d/ram/PTDKEY.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/PTDKEY.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/PTDKEY.C
Index: hatari/d/ram/PTFIELD.C
===================================================================
--- hatari/d/ram/PTFIELD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/PTFIELD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/PTFIELD.C
Index: hatari/d/ram/PTREAD.C
===================================================================
--- hatari/d/ram/PTREAD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/PTREAD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/PTREAD.C
Index: hatari/d/ram/PTSELBX.C
===================================================================
--- hatari/d/ram/PTSELBX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/PTSELBX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/PTSELBX.C
Index: hatari/d/ram/PTWRITE.C
===================================================================
--- hatari/d/ram/PTWRITE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/PTWRITE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/PTWRITE.C
Index: hatari/d/ram/PUTEQ.C
===================================================================
--- hatari/d/ram/PUTEQ.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/PUTEQ.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/PUTEQ.C
Index: hatari/d/ram/RSCRIPT.C
===================================================================
--- hatari/d/ram/RSCRIPT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/RSCRIPT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/RSCRIPT.C
Index: hatari/d/ram/SCADV.C
===================================================================
--- hatari/d/ram/SCADV.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SCADV.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SCADV.C
Index: hatari/d/ram/SCFIELD.C
===================================================================
--- hatari/d/ram/SCFIELD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SCFIELD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SCFIELD.C
Index: hatari/d/ram/SCGOTO.C
===================================================================
--- hatari/d/ram/SCGOTO.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SCGOTO.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SCGOTO.C
Index: hatari/d/ram/SCINIT.C
===================================================================
--- hatari/d/ram/SCINIT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SCINIT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SCINIT.C
Index: hatari/d/ram/SCOPE.C
===================================================================
--- hatari/d/ram/SCOPE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SCOPE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SCOPE.C
Index: hatari/d/ram/SCORDSP.C
===================================================================
--- hatari/d/ram/SCORDSP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SCORDSP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SCORDSP.C
Index: hatari/d/ram/SCREAD.C
===================================================================
--- hatari/d/ram/SCREAD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SCREAD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SCREAD.C
Index: hatari/d/ram/SCSELBX.C
===================================================================
--- hatari/d/ram/SCSELBX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SCSELBX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SCSELBX.C
Index: hatari/d/ram/SCTRAK.C
===================================================================
--- hatari/d/ram/SCTRAK.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SCTRAK.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SCTRAK.C
Index: hatari/d/ram/SCWRITE.C
===================================================================
--- hatari/d/ram/SCWRITE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SCWRITE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SCWRITE.C
Index: hatari/d/ram/SECCPY.C
===================================================================
--- hatari/d/ram/SECCPY.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SECCPY.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SECCPY.C
Index: hatari/d/ram/SEDISP.S
===================================================================
--- hatari/d/ram/SEDISP.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SEDISP.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SEDISP.S
Index: hatari/d/ram/SEDUMP.C
===================================================================
--- hatari/d/ram/SEDUMP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SEDUMP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SEDUMP.C
Index: hatari/d/ram/SEEXEC.S
===================================================================
--- hatari/d/ram/SEEXEC.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SEEXEC.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SEEXEC.S
Index: hatari/d/ram/SELECT.C
===================================================================
--- hatari/d/ram/SELECT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SELECT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SELECT.C
Index: hatari/d/ram/SENDVAL.C
===================================================================
--- hatari/d/ram/SENDVAL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SENDVAL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SENDVAL.C
Index: hatari/d/ram/SERINTR.S
===================================================================
--- hatari/d/ram/SERINTR.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SERINTR.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SERINTR.S
Index: hatari/d/ram/SETGC.C
===================================================================
--- hatari/d/ram/SETGC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SETGC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SETGC.C
Index: hatari/d/ram/SETV2GI.C
===================================================================
--- hatari/d/ram/SETV2GI.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SETV2GI.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SETV2GI.C
Index: hatari/d/ram/SETWQ.C
===================================================================
--- hatari/d/ram/SETWQ.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SETWQ.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SETWQ.C
Index: hatari/d/ram/SHOWCFG.C
===================================================================
--- hatari/d/ram/SHOWCFG.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SHOWCFG.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SHOWCFG.C
Index: hatari/d/ram/SMSCRL.C
===================================================================
--- hatari/d/ram/SMSCRL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SMSCRL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SMSCRL.C
Index: hatari/d/ram/SQDISP.C
===================================================================
--- hatari/d/ram/SQDISP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SQDISP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SQDISP.C
Index: hatari/d/ram/SQDKEY.C
===================================================================
--- hatari/d/ram/SQDKEY.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SQDKEY.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SQDKEY.C
Index: hatari/d/ram/SQEXEC.C
===================================================================
--- hatari/d/ram/SQEXEC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SQEXEC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SQEXEC.C
Index: hatari/d/ram/SQFIELD.C
===================================================================
--- hatari/d/ram/SQFIELD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SQFIELD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SQFIELD.C
Index: hatari/d/ram/SQREAD.C
===================================================================
--- hatari/d/ram/SQREAD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SQREAD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SQREAD.C
Index: hatari/d/ram/SQSCAN.C
===================================================================
--- hatari/d/ram/SQSCAN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SQSCAN.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SQSCAN.C
Index: hatari/d/ram/SQSELBX.C
===================================================================
--- hatari/d/ram/SQSELBX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SQSELBX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SQSELBX.C
Index: hatari/d/ram/SQWRITE.C
===================================================================
--- hatari/d/ram/SQWRITE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SQWRITE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SQWRITE.C
Index: hatari/d/ram/SRESET.S
===================================================================
--- hatari/d/ram/SRESET.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SRESET.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SRESET.S
Index: hatari/d/ram/STCPOS.C
===================================================================
--- hatari/d/ram/STCPOS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/STCPOS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/STCPOS.C
Index: hatari/d/ram/STMPROC.C
===================================================================
--- hatari/d/ram/STMPROC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/STMPROC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/STMPROC.C
Index: hatari/d/ram/SWINIT.C
===================================================================
--- hatari/d/ram/SWINIT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/SWINIT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/SWINIT.C
Index: hatari/d/ram/TDFIELD.C
===================================================================
--- hatari/d/ram/TDFIELD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/TDFIELD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/TDFIELD.C
Index: hatari/d/ram/TDSELBX.C
===================================================================
--- hatari/d/ram/TDSELBX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/TDSELBX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/TDSELBX.C
Index: hatari/d/ram/TEMPO.C
===================================================================
--- hatari/d/ram/TEMPO.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/TEMPO.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/TEMPO.C
Index: hatari/d/ram/TIMEINT.S
===================================================================
--- hatari/d/ram/TIMEINT.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/TIMEINT.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/TIMEINT.S
Index: hatari/d/ram/TOFPU.S
===================================================================
--- hatari/d/ram/TOFPU.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/TOFPU.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/TOFPU.S
Index: hatari/d/ram/TTCPOS.C
===================================================================
--- hatari/d/ram/TTCPOS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/TTCPOS.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/TTCPOS.C
Index: hatari/d/ram/TUNDSP.C
===================================================================
--- hatari/d/ram/TUNDSP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/TUNDSP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/TUNDSP.C
Index: hatari/d/ram/UCSLICE.C
===================================================================
--- hatari/d/ram/UCSLICE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/UCSLICE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/UCSLICE.C
Index: hatari/d/ram/USLICE.C
===================================================================
--- hatari/d/ram/USLICE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/USLICE.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/USLICE.C
Index: hatari/d/ram/VTYPER.C
===================================================================
--- hatari/d/ram/VTYPER.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/VTYPER.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/VTYPER.C
Index: hatari/d/ram/WDFIELD.C
===================================================================
--- hatari/d/ram/WDFIELD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/WDFIELD.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/WDFIELD.C
Index: hatari/d/ram/WDSELBX.C
===================================================================
--- hatari/d/ram/WDSELBX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/WDSELBX.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/WDSELBX.C
Index: hatari/d/ram/WHEEL.C
===================================================================
--- hatari/d/ram/WHEEL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/WHEEL.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/WHEEL.C
Index: hatari/d/ram/WSCALC.C
===================================================================
--- hatari/d/ram/WSCALC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/WSCALC.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/WSCALC.C
Index: hatari/d/ram/WSDSP.C
===================================================================
--- hatari/d/ram/WSDSP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/ram/WSDSP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/RAM/WSDSP.C
Index: hatari/d/rom/BIOS.S
===================================================================
--- hatari/d/rom/BIOS.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/rom/BIOS.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/ROM/BIOS.S
Index: hatari/d/rom/BOOTER.C
===================================================================
--- hatari/d/rom/BOOTER.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/rom/BOOTER.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/ROM/BOOTER.C
Index: hatari/d/rom/CROOT.C
===================================================================
--- hatari/d/rom/CROOT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/rom/CROOT.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/ROM/CROOT.C
Index: hatari/d/rom/FSMAIN.S
===================================================================
--- hatari/d/rom/FSMAIN.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/rom/FSMAIN.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/ROM/FSMAIN.S
Index: hatari/d/rom/LOWRAM.S
===================================================================
--- hatari/d/rom/LOWRAM.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/rom/LOWRAM.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/ROM/LOWRAM.S
Index: hatari/d/rom/ROMP.C
===================================================================
--- hatari/d/rom/ROMP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/rom/ROMP.C	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/ROM/ROMP.C
Index: hatari/d/rom/TIMEINT.S
===================================================================
--- hatari/d/rom/TIMEINT.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/d/rom/TIMEINT.S	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+../../../orig/ROM/TIMEINT.OLD
Index: hatari/rem.py
===================================================================
--- hatari/rem.py	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ hatari/rem.py	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,324 @@
+#!/usr/bin/env python3
+
+import os
+import socket
+import time
+
+mod_prolog = [
+    "rom/croot.c",
+    "rom/fsmain.s"
+]
+
+mod_iolib = [
+    "lib/dofmt.c",
+    "lib/mdump.c",
+    "lib/pause.c",
+    "lib/printf.c",
+    "lib/rawio.c",
+    "lib/sprintf.c",
+    "lib/waitcr.c",
+    "lib/hwdefs.s",
+    "lib/rtraps.s",
+    "lib/setipl.s",
+    "lib/setsr.s",
+    "lib/traps.s"
+]
+
+mod_libcio = [
+    "lib/atoi.c",
+    "lib/atol.c",
+    "lib/blkrd.c",
+    "lib/blkwr.c",
+    "lib/close.c",
+    "lib/clusmap.c",
+    "lib/conin.c",
+    "lib/conwr.c",
+    "lib/dirfns.c",
+    "lib/fgets.c",
+    "lib/filesys.c",
+    "lib/filname.c",
+    "lib/flread.c",
+    "lib/fopen.c",
+    "lib/fprintf.c",
+    "lib/fputs.c",
+    "lib/fread.c",
+    "lib/fscanf.c",
+    "lib/fseek.c",
+    "lib/fsinit.c",
+    "lib/fsize.c",
+    "lib/fstubs.c",
+    "lib/ftell.c",
+    "lib/fwrite.c",
+    "lib/getbuff.c",
+    "lib/getc.c",
+    "lib/getl.c",
+    "lib/getw.c",
+    "lib/lseek.c",
+    "lib/open.c",
+    "lib/posit.c",
+    "lib/putc.c",
+    "lib/putl.c",
+    "lib/putw.c",
+    "lib/read.c",
+    "lib/readrn.c",
+    "lib/rename.c",
+    "lib/scan.c",
+    "lib/setbuf.c",
+    "lib/ungetc.c",
+    "lib/unlink.c",
+    "lib/write.c",
+    "lib/writern.c",
+    "lib/ptcl12.s"
+]
+
+mod_libsm = [
+    "lib/index.c",
+    "lib/memccpy.c",
+    "lib/memchr.c",
+    "lib/memcmp.c",
+    "lib/memcmpu.c",
+    "lib/memcpy.c",
+    "lib/memcpyw.c",
+    "lib/memset.c",
+    "lib/memsetw.c",
+    "lib/rindex.c",
+    "lib/str2lc.c",
+    "lib/str2uc.c",
+    "lib/strcat.c",
+    "lib/strccpy.c",
+    "lib/strchr.c",
+    "lib/strcmp.c",
+    "lib/strcpy.c",
+    "lib/strcspn.c",
+    "lib/strfill.c",
+    "lib/strlcmp.c",
+    "lib/strlen.c",
+    "lib/strltrm.c",
+    "lib/strncat.c",
+    "lib/strncmp.c",
+    "lib/strncpy.c",
+    "lib/strpbrk.c",
+    "lib/strrchr.c",
+    "lib/strrev.c",
+    "lib/strrevi.c",
+    "lib/strrtrm.c",
+    "lib/strspn.c",
+    "lib/strtok.c",
+    "lib/strtol.c"
+]
+
+mod_lib700 = [
+    "lib/bitrev.c",
+    "lib/ctype.c",
+    "lib/ispow2.c",
+    "lib/mangle.c",
+    "lib/micons.c",
+    "lib/tolower.c",
+    "lib/toupper.c",
+    "lib/aldiv.s",
+    "lib/almul.s",
+    "lib/alrem.s",
+    "lib/blkfill.s",
+    "lib/blkmove.s",
+    "lib/finalone.s",
+    "lib/jumpto.s",
+    "lib/ldiv.s",
+    "lib/lmul.s",
+    "lib/lrem.s",
+    "lib/rand24.s",
+    "lib/setjmp.s",
+    "lib/uldiv.s"
+]
+
+mod_vlib = [
+    "lib/cg2.c",
+    "lib/cg3.c",
+    "lib/glcinit.c",
+    "lib/lseg.c",
+    "lib/vbfill4.c",
+    "lib/vclrs.c",
+    "lib/vhinit.c",
+    "lib/vmput.c",
+    "lib/vobjfns.c",
+    "lib/vputs.c",
+    "lib/vputsv.c",
+    "lib/vsetpal.c",
+    "lib/vsinit.c",
+    "lib/vspray4.c",
+    "lib/vtext.c",
+    "lib/vwputm.c",
+    "lib/acctrl.s",
+    "lib/glcplot.s",
+    "lib/tsplot4.s",
+    "lib/vbank.s",
+    "lib/vclrav.s",
+    "lib/vcputs.s",
+    "lib/vcputsv.s",
+    "lib/viint.s",
+    "lib/vputa.s",
+    "lib/vputc.s",
+    "lib/vputcv.s",
+    "lib/vputp.s",
+    "lib/vsetav.s",
+    "lib/vsetcv.s",
+    "lib/vsplot4.s",
+    "lib/vvputsv.s",
+    "lib/vwputp.s",
+    "lib/vwputs.s"
+]
+
+mod_rom = [
+    "rom/booter.c",
+    "rom/romp.c",
+    "rom/bios.s",
+    "rom/timeint.s"
+]
+
+codes = {
+    "-":  12,
+    "=":  13,
+    "\b": 14,
+    "\t": 15,
+    "`":  41,
+    "[":  26,
+    "]":  27,
+    "\n": 28,
+    ";":  39,
+    "'":  40,
+    "\\": 43,
+    ",":  51,
+    ".":  52,
+    "/":  53,
+    " ":  57
+}
+
+codes_shifted = {
+    "!":   2,
+    "@":   3,
+    "#":   4,
+    "$":   5,
+    "%":   6,
+    "^":   7,
+    "&":   8,
+    "*":   9,
+    "(":  10,
+    ")":  11,
+    "_":  12,
+    "+":  13,
+    "~":  41,
+    "{":  26,
+    "}":  27,
+    ":":  39,
+    "\"": 40,
+    "|":  43,
+    "<":  51,
+    ">":  52,
+    "?":  53
+}
+
+sig_path = "hatari/d/signal"
+lis_path = "/tmp/buchla.sock"
+con = None
+
+def hatari_connect():
+    lis = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+
+    if os.path.exists(lis_path):
+        os.unlink(lis_path)
+
+    lis.bind(lis_path)
+    lis.listen(1)
+
+    global con
+    (con, _) = lis.accept()
+
+def hatari_send(command):
+    global con
+    con.sendall((command + "\n").encode("ascii"))
+
+def send_alnum(c):
+    hatari_send("hatari-event keypress {}".format(c))
+
+def send_code(code):
+    hatari_send("hatari-event keypress {}".format(code))
+
+def send_code_shifted(code):
+    hatari_send("hatari-event keydown 42")
+    send_code(code)
+    hatari_send("hatari-event keyup 42")
+
+def send_line(line):
+    line += "\n"
+
+    for c in line:
+        if c in codes:
+            send_code(codes[c])
+        elif c in codes_shifted:
+            send_code_shifted(codes_shifted[c])
+        else:
+            send_alnum(c)
+
+        time.sleep(0.1)
+
+def run_command(command):
+    if os.path.exists(sig_path):
+        os.unlink(sig_path)
+
+    print("Executing {}".format(command))
+    send_line(command + "; touch d:\\signal")
+
+    print("Waiting for completion")
+    while not os.path.exists(sig_path):
+        time.sleep(0.5)
+
+    os.unlink(sig_path)
+
+def assemble(dir, base):
+    print("Assembling {}.s in {}".format(base, dir))
+    run_command("cp d:\\{}\\{}.s code.s".format(dir, base))
+    run_command("as code")
+    run_command("cp code.o d:\\out\\{}.o".format(base))
+    run_command("rm code.o")
+    run_command("rm code.s")
+    send_line("")
+
+def compile(dir, base):
+    print("Compiling {}.c in {}".format(base, dir))
+    run_command("cp d:\\{}\\{}.c code.c".format(dir, base))
+    run_command("cc code")
+    run_command("as code")
+    run_command("cp code.s d:\\out\\{}.s".format(base))
+    run_command("cp code.o d:\\out\\{}.o".format(base))
+    run_command("rm code.o")
+    run_command("rm code.s")
+    run_command("rm code.c")
+    send_line("")
+
+print("Waiting for Hatari to connect to {}.".format(lis_path))
+hatari_connect()
+
+print("Hatari connected.")
+input("Please start C:\\BIN\\SH.TTP manually, then press enter.")
+
+send_line("PATH=\\bin")
+send_line("cd \\work")
+
+start_at = None
+
+for mod in [mod_prolog, mod_iolib, mod_libcio, mod_libsm, mod_lib700, mod_vlib, mod_rom]:
+    for path in mod:
+        if start_at != None:
+            if start_at != path:
+                continue
+            else:
+                start_at = None
+
+        (dir, file) = path.split("/")
+        (base, ext) = file.split(".")
+
+        if ext == "s":
+            assemble(dir, base)
+        elif ext == "c":
+            compile(dir, base)
+        else:
+            raise Exception("file {} with invalid extension {}".format(file, ext))
Index: include/ascii.h
===================================================================
--- include/ascii.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/ascii.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,47 @@
+/*
+   ==========================================================================
+	ascii.h -- Standard ASCII character definitions
+	Version 5 -- 1987-06-03 -- D.N. Lynx Crowe
+   ==========================================================================
+*/
+
+#define	A_NUL	0x00	/* ^@ */
+#define	A_SOH	0x01	/* ^A */
+#define	A_STX	0x02	/* ^B */
+#define	A_ETX	0x03	/* ^C */
+#define	A_EOT	0x04	/* ^D */
+#define	A_ENQ	0x05	/* ^E */
+#define	A_ACK	0x06	/* ^F */
+#define	A_BEL	0x07	/* ^G */
+#define	A_BS	0x08	/* ^H */
+#define	A_HT	0x09	/* ^I */
+#define	A_LF	0x0A	/* ^J */
+#define	A_VT	0x0B	/* ^K */
+#define	A_FF	0x0C	/* ^L */
+#define	A_CR	0x0D	/* ^M */
+#define	A_SO	0x0E	/* ^N */
+#define	A_SI	0x0F	/* ^O */
+
+#define	A_DLE	0x10	/* ^P */
+#define	A_DC1	0x11	/* ^Q */
+#define	A_DC2	0x12	/* ^R */
+#define	A_DC3	0x13	/* ^S */
+#define	A_DC4	0x14	/* ^T */
+#define	A_NAK	0x15	/* ^U */
+#define	A_SYN	0x16	/* ^V */
+#define	A_ETB	0x17	/* ^W */
+#define	A_CAN	0x18	/* ^X */
+#define	A_EM	0x19	/* ^Y */
+#define	A_SUB	0x1A	/* ^Z */
+#define	A_ESC	0x1B	/* ^[ */
+#define	A_FS	0x1C	/* ^\ */
+#define	A_GS	0x1D	/* ^] */
+#define	A_RS	0x1E	/* ^^ */
+#define	A_US	0x1F	/* ^_ */
+
+#define	A_DEL	0x7F	/* DEL */
+
+#define	A_XON	0x11	/* DC1 = old ASCII XON */
+#define	A_XOFF	0x13	/* DC3 = old ASCII XOFF */
+
+#define	CTL(x)	(x - '@')
Index: include/biosdefs.h
===================================================================
--- include/biosdefs.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/biosdefs.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,204 @@
+/*
+   ============================================================================
+	biosdefs.h -- Buchla 700 BIOS and XBIOS definitions
+	Version 22 -- 1988-04-11 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+extern	long	trap13();	/* BIOS linkage */
+extern	long	trap14();	/* XBIOS linkage */
+
+#define	BIOS	trap13
+#define	XBIOS	trap14
+
+/* BIOS functions */
+
+/* function 0 unused (getmpb) */
+
+#define	B_RDAV	1
+#define	B_GETC	2
+#define	B_PUTC	3
+#define	B_RDWR	4
+#define	B_SETV	5
+
+/* function 6 unused (tickcal) */
+
+#define	B_GBPB	7
+#define	B_THRE	8
+#define	B_MCHG	9
+#define	B_DMAP	10
+
+/* function 11 unused (shift) */
+
+/* XBIOS functions */
+
+#define	X_PIOREC	0
+#define	X_SETPRT	1
+#define	X_FLOPRD	2
+#define	X_FLOPWR	3
+#define	X_FORMAT	4
+#define	X_VERIFY	5
+#define	X_PRBOOT	6
+#define	X_RANDOM	7
+#define	X_ANALOG	8
+#define	X_CLRAFI	9
+#define	X_APICHK	10
+#define	X_MTDEFS	11
+
+/* device unit numbers */
+
+#define	PRT_DEV	0
+#define	AUX_DEV	1
+#define	CON_DEV	2
+#define	MC1_DEV	3
+#define	MC2_DEV	4
+
+/* 
+ */
+/*
+   ============================================================================
+	bpb -- BIOS parameter block
+   ============================================================================
+*/
+
+
+struct bpb {			/* BIOS parameter block returned by B_GBPB */
+
+	unsigned short	recsiz;		/* physical sector size in bytes */
+	unsigned short	clsiz;		/* cluster size in sectors */
+	unsigned short	clsizb;		/* cluster size in bytes */
+	unsigned short	rdlen;		/* root directory length in sectors */
+	unsigned short	fsiz;		/* FAT size in sectors */
+	unsigned short	fatrec;		/* sector number of 1st sector of 2nd FAT */
+	unsigned short	datrec;		/* sector number of 1st data sector */
+	unsigned short	numcl;		/* number of data clusters on disk */
+	unsigned short	bflags;		/* flags */
+	unsigned short	ntracks;	/* number of tracks */
+	unsigned short	nsides;		/* number of sides (heads) */
+	unsigned short	dspc;		/* sectors per cylinder */
+	unsigned short	dspt;		/* sectors per track */
+	unsigned short	hidden;		/* number of hidden files */
+	char	serno[3];		/* disk serial number */
+	char	nada;			/* --- filler - nothing here --- */
+};
+
+#define	BPBSIZE	32		/* length of a BPB */
+
+#define	B_FAT16	0x0001		/* flag for using 16 bit FAT entries */
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	dirent -- Directory entry
+   ============================================================================
+*/
+
+struct dirent {			/* Directory entry */
+
+	char	fname[8];		/* file name */
+	char	fext[3];		/* file extension */
+	char	atrib;			/* attribute byte */
+	char	unused[10];		/* unused space */
+	unsigned short	crtime;		/* 'LLHH' creation time */
+	unsigned short	crdate;		/* 'LLHH' creation date */
+	unsigned short	bclust;		/* 'LLHH' starting cluster number */
+	long	flen;			/* 'LLHH' file length */
+};
+
+#define	DENTSIZE	(sizeof (struct dirent))
+
+#define	F_RDONLY	0x01	/* Read only file */
+#define	F_HIDDEN	0x02	/* Hidden file */
+#define	F_SYSTEM	0x04	/* System file */
+#define	F_VOLUME	0x08	/* Volume label */
+#define	F_SUBDIR	0x10	/* Sub-directory */
+#define	F_ARCHIV	0x20	/* Archived */
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	fcb -- File Control Block
+   ============================================================================
+*/
+
+struct	fcb {			/* file control block */
+
+	struct	dirent	de;	/* directory entry image for file */
+	unsigned short	modefl;	/* fcb flags */
+	unsigned short	clsec;	/* current sector in cluster */
+	unsigned short	curcls;	/* current cluster */
+	unsigned short	offset;	/* current offset into sector */
+	long	curlsn;		/* current logical sector number in file */
+	long	curdsn;		/* current logical sector number on disk */
+	long	curlen;		/* current file length in bytes */
+	long	asects;		/* allocated file length in sectors */
+};
+
+#define	FC_EOF	0x8000		/* end of file */
+#define	FC_BAD	0x4000		/* bad FAT entry encountered */
+#define	FC_ERR	0x2000		/* error encountered */
+#define	FC_OPN	0x1000		/* file open */
+
+#define	FC_CR	0x0800		/* create mode */
+#define	FC_AP	0x0400		/* append mode */
+#define	FC_WR	0x0200		/* write mode */
+#define	FC_RD	0x0100		/* read mode */
+
+#define	FC_EX	0x0080		/* exclusive mode */
+#define	FC_TR	0x0040		/* truncate mode */
+#define	FC_NB	0x0020		/* non-blocking mode */
+#define	FC_BF	0x0010		/* binary file mode */
+
+#define	FC_RW	(FC_RD | FC_WR)	/* read-write mode */
+
+/* 
+ */
+
+/*
+   ============================================================================
+    BIOS and XBIOS function call formats
+    ------------------------------------
+
+	In the list below, .W and .L refer to the size of the parameter
+	passed to the BIOS/XBIOS routine.
+
+	The first parameter is always the function code, "code.W".
+
+   BIOS calls are:
+   ---------------
+
+	BIOS(B_RDAV, unit.W);
+	BIOS(B_GETC, unit.W);
+	BIOS(B_PUTC, unit.W, c.W);
+	BIOS(B_RDWR, rwflag.W, buf.L, count.W, recno.W, dev.W);
+	BIOS(B_SETV, vecnum.W, vecadr.L);
+	BIOS(B_GBPB, dev.W);
+	BIOS(B_THRE, unit.W);
+	BIOS(B_MCHG, unit.W);
+	BIOS(B_DMAP);
+
+   XBIOS calls are:
+   ----------------
+
+	XBIOS(X_PIOREC, unit.W)
+	XBIOS(X_SETPRT, unit.W, mode.W, baud.W, cfr0.W, cr1.W)
+	XBIOS(X_FLOPRD, buf.L, filler.L, dev.W, sector.W, track.W,
+		side.W, count.W)
+	XBIOS(X_FLOPWR, buf.L, filler.L, dev.W, sector.W, track.W,
+		side.W, count.W)
+	XBIOS(X_FORMAT, buf.L, filler.L, dev.W, spt.W, track.W, side.W,
+		intrlv.W, magic.L, virgin.W)
+	XBIOS(X_VERIFY, buf.L, filler.L, dev.W, sector.W, track.W,
+		side.W, count.W)
+	XBIOS(X_PRBOOT, buf.L, serial.L, type.W, execflag.W)
+	XBIOS(X_RANDOM)
+	XBIOS(X_ANALOG)
+	XBIOS(X_CLRAFI)
+   ============================================================================
+*/
Index: include/ctype.h
===================================================================
--- include/ctype.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/ctype.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,137 @@
+/*
+   ============================================================================
+	ctype.h -- extended character macros, ala' Unix(tm)
+	Version 8 -- 1987-06-16 -- D.N. Lynx Crowe
+
+	These macros are a superset of those provided for System 5 Unix(tm).
+
+	This set of macros will return status for characters 0x80..0xFF as
+	though they were in the range 0x00..0x7F for compatibility with
+	the equivalent Lattice C macros.  This means that isascii(c) should
+	be used if it is necessary to restrict the results to true ASCII.
+
+	If SYS5CODE is TRUE these macros will use the same table definitions
+	as System 5 Unix(tm).  In this case these behave well even when fed
+	an EOF.  The EOF character value, -1, is not defined as being in any
+	of the classes tested for.  If SYS5CODE is FALSE, the Alcyon table
+	will be used, and EOF will not work properly.
+
+	Define _CTYPE_C for compiling the ctype.c file, undefine otherwise.
+
+	The symbol _ii_ is defined to be the base of the table used.
+
+		isascii(c)  non-zero if c is ASCII
+
+		isprint(c)  non-zero if c is printable (including blank)
+		isgraph(c)  non-zero if c is graphic (excluding blank)
+		iscntrl(c)  non-zero if c is control character
+
+		isalpha(c)  non-zero if c is alpha
+		isupper(c)  non-zero if c is upper case
+		islower(c)  non-zero if c is lower case
+
+		isdigit(c)  non-zero if c is a digit (0 to 9)
+		isxdigit(c) non-zero if c is a hexadecimal digit (0 to 9, A to F, a to f)
+
+		isalnum(c)  non-zero if c is alpha or digit
+
+		isspace(c)  non-zero if c is white space
+		ispunct(c)  non-zero if c is punctuation
+
+		iscsym(c)   non-zero if valid character for C symbols
+		iscsymf(c)  non-zero if valid first character for C symbols
+
+		toascii(c)  returns c masked to 7 bits
+
+		_tolower(c) returns the lower case version of c
+		_toupper(c) returns the upper case version of c
+
+		tonumber(c) converts c from ASCII to integer
+   ============================================================================
+*/
+
+/* 
+
+*/
+
+#define	SYS5CODE	0	/* define non-zero for System 5 / Aztec C */
+
+#if	SYS5CODE
+
+#define	_ii_	_ctype+1
+
+/* System 5 Unix(tm) / Aztec C table definitions */
+
+#define _U	0x01	/* upper case */
+#define _L	0x02	/* lower case */
+#define _N	0x04	/* numeric 0..9 */
+#define _S	0x08	/* whitespace */
+#define	_P	0x10	/* punctuation */
+#define	_C	0x20	/* control 00..1F */
+#define _B	0x40	/* blank */
+#define _X	0x80	/* hex digit */
+
+#else
+
+#define	_ii_	__atab
+
+/* Digital Research / Alcyon C table definitions */
+
+#define	_C	0x01	/* control 00.1F */
+#define	_P	0x02	/* punctuation */
+#define	_N	0x04	/* numeric 0..9 */
+#define	_U	0x08	/* upper case */
+#define	_L	0x10	/* lower case */
+#define	_S	0x20	/* whitespace */
+#define	_B	0x40	/* blank */
+#define	_X	0x80	/* hex digit */
+
+#endif
+
+#ifndef	_CTYPE_C
+
+#if	SYS5CODE
+
+extern	char _ctype[];		/* character type table */
+
+#else	/* SYS5CODE */
+
+extern	char ___atab();		/* so the loader sees us ... */
+extern	char __atab[];		/* character type table */
+
+#endif	/* SYS5CODE */
+
+#endif	/* _CTYPE_C */
+
+/* 
+
+*/
+
+#define	isascii(c)	(!((c)&~0x7F))
+
+#define	isprint(c)	((_ii_)[c]&(_P|_U|_L|_N|_B))
+#define	isgraph(c)	((_ii_)[c]&(_P|_U|_L|_N))
+#define	iscntrl(c)	((_ii_)[c]&_C)
+
+#define	isalpha(c)	((_ii_)[c]&(_U|_L))
+#define	isupper(c)	((_ii_)[c]&_U)
+#define	islower(c)	((_ii_)[c]&_L)
+
+#define	isdigit(c)	((_ii_)[c]&_N)
+#define	isxdigit(c)	((_ii_)[c]&_X)
+
+#define	isalnum(c)	((_ii_)[c]&(_U|_L|_N))
+
+#define	isspace(c)	((_ii_)[c]&_S)
+#define	ispunct(c)	((_ii_)[c]&_P)
+
+#define	iscsym(c)	(isalnum(c)||(((c)&127)==0x5F))
+#define	iscsymf(c)	(isalpha(c)||(((c)&127)==0x5F))
+
+#define	toascii(c)	((c)&0x7F)
+
+#define _toupper(c)	((c)-'a'+'A')
+#define _tolower(c)	((c)-'A'+'a')
+
+#define	tonumber(c)	((((c)&0x7F)>'9')?((islower(c)?_toupper(c):c)-'A'+10):(c&0x0F))
+
Index: include/errdefs.h
===================================================================
--- include/errdefs.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/errdefs.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,24 @@
+/*
+   ============================================================================
+	errdefs.h -- Buchla 700 BIOS error codes
+	Version 1 -- 1987-02-04 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+#define	ERR01	-1L	/* All purpose general error code */
+#define	ERR02	-2L	/* Drive not ready */
+#define	ERR03	-3L	/* Unknown command */
+#define	ERR04	-4L	/* CRC error */
+#define	ERR05	-5L	/* Invalid request */
+#define	ERR06	-6L	/* Seek error */
+#define	ERR07	-7L	/* Unknown media */
+#define	ERR08	-8L	/* Sector not found */
+#define	ERR09	-9L	/* End of media or out of paper */
+#define	ERR10	-10L	/* Write fault */
+#define	ERR11	-11L	/* Read fault */
+#define	ERR12	-12L	/* General mishap */
+#define	ERR13	-13L	/* Write protected */
+#define	ERR14	-14L	/* Media change */
+#define	ERR15	-15L	/* Unknown device */
+#define	ERR16	-16L	/* Bad sectors */
+#define	ERR17	-17L	/* Insert disk */
Index: include/errno.h
===================================================================
--- include/errno.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/errno.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,55 @@
+
+/*
+   ============================================================================
+	errno.h - Standard C library error codes
+	Version 2 -- 1987-03-06 -- D.N. Lynx Crowe
+   ============================================================================
+ */
+
+extern	int	errno;
+
+#define EPERM	1
+#define ENOENT	2
+#define ESRCH	3
+#define EINTR	4
+#define EIO	5
+#define ENXIO	6
+#define E2BIG	7
+#define ENOEXEC	8
+#define EBADF	9
+#define ECHILD	10
+#define EAGAIN	11
+#define ENOMEM	12
+#define EACCES	13
+#define EFAULT	14
+#define ENOTBLK	15
+#define EBUSY	16
+#define EEXIST	17
+#define EXDEV	18
+#define ENODEV	19
+#define ENOTDIR	20
+#define EISDIR	21
+#define EINVAL	22
+#define ENFILE	23
+#define EMFILE	24
+#define ENOTTY	25
+#define ETXTBSY	26
+#define EFBIG	27
+#define ENOSPC	28
+#define ESPIPE	29
+#define EROFS	30
+#define EMLINK	31
+#define EPIPE	32
+
+/* math software */
+
+#define EDOM	33
+#define ERANGE	34
+
+/* hereafter is available for specials */
+
+#define ENODSPC	35
+#define ERENAME	36
+
+/* ***** end of errno.h ***** */
+
Index: include/fcntl.h
===================================================================
--- include/fcntl.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/fcntl.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,44 @@
+/*
+   =============================================================================
+	fcntl.h -- file control function header
+	Version 3 -- 1987-06-26 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+/*
+   =============================================================================
+	The following symbols are used with open(), creat() and fcntl().
+	The first 3 can only be set by open().
+   =============================================================================
+*/
+
+#ifndef	O_RDONLY	/* only define these once */
+
+#define	O_RDONLY	0x0000	/* Read-only value  */
+#define	O_WRONLY	0x0001	/* Write-only value */
+#define	O_RDWR		0x0002	/* Read-write value */
+
+#define O_NDELAY	0x0004	/* Non-blocking I/O flag */
+#define O_APPEND	0x0008	/* Append mode flag (write only at end) */
+
+#define O_CREAT		0x0100	/* File creation flag (uses 3rd argument) */
+#define O_TRUNC		0x0200	/* File truncation flag */
+#define O_EXCL		0x0400	/* Exclusive access flag */
+
+#define	O_RAW		0x8000	/* Raw (binary) I/O flag for getc and putc */
+
+#endif
+
+/*
+   =============================================================================
+	The following symbols define requests used with the fcntl() function.
+   =============================================================================
+*/
+
+#define	F_DUPFD	0	/* Duplicate file descriptor */
+
+#define	F_GETFD	1	/* Get file descriptor flags */
+#define	F_SETFD	2	/* Set file descriptor flags */
+
+#define	F_GETFL	3	/* Get file flags */
+#define	F_SETFL	4	/* Set file flags */
Index: include/fspars.h
===================================================================
--- include/fspars.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/fspars.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,28 @@
+/*
+   =============================================================================
+	fspars.h -- File system parameters
+	Version 4 -- 1987-12-15 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#ifndef	NSTREAMS		/* ony define these once */
+
+#define	TBUFFER		1	/* non-zero to enable track buffering */
+
+#define	NSTREAMS	11	/* maximum number of file streams */
+#define MAXCHAN		11	/* maximum number of I/O channel fd's */
+#define MAXDFILE	8	/* maximum number of open DISK files */
+
+#define	BUFSIZL	256				/* buffer length -- longs */
+#define BUFSIZ	(sizeof (long) * BUFSIZL)	/* buffer length -- chars */
+
+#define	BPSEC		512	/* bytes per disk sector */
+#define	FILESHFT	9	/* file shift */
+
+#define	MAXFAT		7	/* maximum number of fat sectors */
+#define	WDPSEC		256	/* words per sector */
+#define	MAXDIRNT	224	/* maximum number of directory entries */
+
+typedef	char	*io_arg;	/* must be big enough to contain a pointer */
+
+#endif
Index: include/glcdefs.h
===================================================================
--- include/glcdefs.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/glcdefs.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,37 @@
+/*
+   =============================================================================
+	glcdefs.h -- definitions for the Epson GLC
+	Version 4 -- 1988-08-03 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#define	G_INIT		(char)0x40
+#define	G_MWRITE	(char)0x42
+#define	G_MREAD		(char)0x43
+#define	G_SETSAD	(char)0x44
+#define	G_CRSWR		(char)0x46
+#define	G_CRSRD		(char)0x47
+#define	G_CRSMRT	(char)0x4C
+#define	G_CRSMLT	(char)0x4D
+#define	G_CRSMUP	(char)0x4E
+#define	G_CRSMDN	(char)0x4F
+#define	G_ERASE		(char)0x52
+#define	G_SLEEP		(char)0x53
+#define	G_DSPCTL	(char)0x58
+#define	G_HSCRL		(char)0x5A
+#define	G_OVRLAY	(char)0x5B
+#define	G_CGRAM		(char)0x5C
+#define	G_CRSFRM	(char)0x5D
+
+#define	LCD_WC		lcd_a1
+#define	LCD_RS		lcd_a0
+#define	LCD_WD		lcd_a0
+#define	LCD_RD		lcd_a1
+
+#define	G_PLANE1	(unsigned)0x0000
+#define	G_PLANE2	(unsigned)0x2000
+
+#define	G_OFF		0		/* off */
+#define	G_ON		1		/* on */
+#define	G_B2		2		/* blink - FR/32 */
+#define	G_B1		3		/* blink - FR/64 */
Index: include/graphdef.h
===================================================================
--- include/graphdef.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/graphdef.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,43 @@
+/*
+   ===========================================================================
+	graphdef.h -- graphics primitives package header
+	Version 6 -- 1987-05-27 -- D.N. Lynx Crowe
+	Setup for the Buchla 700 and the Matra-Harris 82716 VSDD
+	Copyright 1985,1976,1987 -- D.N. Lynx Crowe
+   ===========================================================================
+*/
+
+#define CLR 0
+#define SET 1
+
+#define XPIX	512
+#define YPIX	350
+
+#define XCTR	XPIX/2
+#define YCTR	YPIX/2
+
+#define XMAX	XPIX-1
+#define YMAX	YPIX-1
+
+#define	P_BLK	0		/* colors for external PROM color table */
+#define	P_DKGRY	1
+#define	P_DKBLU	2
+#define	P_LTBLU	3
+#define	P_DKGRN	4
+#define	P_LTGRN	5
+#define	P_DKCYN	6
+#define	P_LTCYN	7
+#define	P_RED	8
+#define	P_ORG	9
+#define	P_PUR	10
+#define	P_MGN	11
+#define	P_BRN	12
+#define	P_YEL	13
+#define	P_LTGRY	14
+#define	P_WHT	15
+
+#define	DEFCBGND	P_DKBLU
+#define	DEFCFGND	P_WHT
+
+#define	DEFPBGND	P_BLK
+#define	DEFPFGND	P_DKGRY
Index: include/hwdefs.h
===================================================================
--- include/hwdefs.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/hwdefs.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,32 @@
+/*
+   ============================================================================
+	hwdefs.h -- Buchla 700 I/O addresses defined in hwdefs.s
+	Version 12 -- 1988-08-15 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+/* hardware addresses */
+
+extern	char	io_time[], io_lcd, io_ser, io_midi;
+extern	char	io_disk, io_tone, io_leds, io_kbrd;
+extern	char	lcd_a0, lcd_a1;
+
+extern	unsigned	io_vreg[], io_vraw[], io_vram[], io_fpu[];
+
+
+/* video memory allocations */
+
+extern	unsigned	v_regs[], v_odtab[][4], v_actab[];
+extern	unsigned	v_ct0[], v_gt1[], v_score[], v_cgtab[];
+
+extern	unsigned	v_curs0[], v_curs1[], v_curs2[], v_curs3[];
+extern	unsigned	v_curs4[], v_curs5[], v_curs6[], v_curs7[];
+extern	unsigned	v_tcur[], v_kbobj[], v_lnobj[];
+extern	unsigned	v_win0[], v_cur[];
+
+
+/* stuff in the depths of the bios */
+
+extern	short	fc_sw;
+
+extern	long	fc_val;
Index: include/io.h
===================================================================
--- include/io.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/io.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,41 @@
+/*
+   ============================================================================
+	io.h -- Buchla 700 I/O library definitions
+	Version 12 -- 1987-09-25 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+#include "fspars.h"		/* file system parameters */
+
+struct channel {		/* channel table entry */
+
+	char	c_read;		/* read routine index */
+	char	c_write;	/* write routine index */
+	char	c_ioctl;	/* ioctl routine index */
+	char	c_seek;		/* seek routine index */
+	int	(*c_close)();	/* close function pointer */
+	io_arg	c_arg;		/* argument to channel driver */
+};
+
+struct device {			/* device control structure */
+
+	char	d_read;		/* read routine code */
+	char	d_write;	/* write routine code */
+	char	d_ioctl;	/* ioctl routine code */
+	char	d_seek;		/* seek routine code */
+	int	(*d_open)();	/* special open function */
+};
+
+struct devtabl {		/* device table entry */
+
+	char	*d_name;	/* device name */
+	struct	device	*d_dev;	/* pointer to device structure */
+	io_arg	d_arg;		/* argument to device driver */
+};
+
+#ifndef	_FS_DEF_
+
+extern	struct channel chantab[MAXCHAN];	/* defined in fsinit.c */
+extern	char	Wrkbuf[BPSEC];			/* defined in fsinit.c */
+
+#endif
Index: include/memory.h
===================================================================
--- include/memory.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/memory.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,9 @@
+/*
+   ============================================================================
+	memory.h -- header for memory functions
+	Version 3 -- 1987-04-06 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+extern	char	*memccpy(), *memchr(), *memcpy(), *memset();
+extern	int	memcmp(), *memsetw(), *memcpyw(), memcmpu();
Index: include/objdefs.h
===================================================================
--- include/objdefs.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/objdefs.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,40 @@
+/*
+   ============================================================================
+	objdefs.h -- Object file format for as68  (Atari 1040ST TOS objects)
+	Version 7 -- 1987-12-30 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+struct EXFILE {			/* executable file header */
+
+	unsigned	F_Magic;	/* File type magic */
+	long		F_Text;		/* SIze of text segment */
+	long		F_Data;		/* Size of data segment */
+	long		F_BSS;		/* Size of BSS segment */
+	long		F_Symtab;	/* Size of symbol table */
+	long		F_Res1;		/* Reserved area #1 */
+	long		F_Res2;		/* Reserved area #2 -- text origin */
+	unsigned	F_Res3;		/* Reserved area #3 -- flag word */
+
+					/* data origin - long */
+					/* bss origin - long */
+};
+
+#define	F_R_C	0x601A		/* Magic for contiguous file */
+#define	F_R_D	0x601B		/* Magic for discontiguous file */
+
+struct SYMBOL {			/* Symbol table entry -- 14 bytes */
+
+	char		symname[8];	/* Symbol name  (LJZF) */
+	unsigned	symtype;	/* Symbol type flags */
+	long		symvalue;	/* Symbol value */
+};
+
+#define	S_Def	0x8000		/* Defined */
+#define	S_Equ	0x4000		/* Equated */
+#define	S_Glb	0x2000		/* Global */
+#define	S_Reg	0x1000		/* Equated register */
+#define	S_Ext	0x0800		/* External reference */
+#define	S_Data	0x0400		/* Data based relocatable */
+#define	S_Text	0x0200		/* Text based relocatable */
+#define	S_BSS	0x0100		/* BSS based relocatable */
Index: include/portab.h
===================================================================
--- include/portab.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/portab.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,56 @@
+/*
+   =============================================================================
+	portab.h -- Pointless redefinitions of C syntax.
+	Version 1 -- 1985-01-01 -- Atari
+	Copyright 1985 Atari Corp.
+
+	WARNING: Use of this file may make your code incompatible with
+		 C compilers throughout the civilized world.
+   =============================================================================
+*/
+
+#define mc68k 0
+
+#define UCHARA 1				/* if char is unsigned     */
+
+/*
+ *	Standard type definitions
+ */
+
+#define	BYTE	char				/* Signed byte		   */
+#define BOOLEAN	int				/* 2 valued (true/false)   */
+#define	WORD	int  				/* Signed word (16 bits)   */
+#define	UWORD	unsigned int			/* unsigned word	   */
+
+#define	LONG	long				/* signed long (32 bits)   */
+#define	ULONG	long				/* Unsigned long	   */
+
+#define	REG	register			/* register variable	   */
+#define	LOCAL	auto				/* Local var on 68000	   */
+#define	EXTERN	extern				/* External variable	   */
+#define	MLOCAL	static				/* Local to module	   */
+#define	GLOBAL	/**/				/* Global variable	   */
+#define	VOID	/**/				/* Void function return	   */
+#define	DEFAULT	int				/* Default size		   */
+
+#ifdef UCHARA
+#define UBYTE	char				/* Unsigned byte 	   */
+#else
+#define	UBYTE	unsigned char			/* Unsigned byte	   */
+#endif
+
+/****************************************************************************/
+/*	Miscellaneous Definitions:					    */
+/****************************************************************************/
+
+#define	FAILURE	(-1)			/*	Function failure return val */
+#define SUCCESS	(0)			/*	Function success return val */
+#define	YES	1			/*	"TRUE"			    */
+#define	NO	0			/*	"FALSE"			    */
+#define	FOREVER	for(;;)			/*	Infinite loop declaration   */
+#define	NULL	0			/*	Null pointer value	    */
+#define NULLPTR (char *) 0		/*				    */
+#define	EOF	(-1)			/*	EOF Value		    */
+#define	TRUE	(1)			/*	Function TRUE  value	    */
+#define	FALSE	(0)			/*	Function FALSE value	    */
+
Index: include/rawio.h
===================================================================
--- include/rawio.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/rawio.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,12 @@
+/*
+   ============================================================================
+	rawio.h -- header for raw BIOS I/O
+	Version 2 -- 1987-02-20 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+int	getln(), getrln(), readln();
+
+/* The following should really be void ... */
+
+int	writeln();
Index: include/regs.h
===================================================================
--- include/regs.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/regs.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,20 @@
+/*
+   ============================================================================
+	regs.h -- register structure for Buchla 700 ROMP debug facility
+	Version 6 -- 1987-06-15 -- D.N. Lynx Crowe
+	(c) Copyright 1987 -- D.N. Lynx Crowe
+
+	Defines the registers saved on the stack when a breakpoint occurs.
+   ============================================================================
+*/
+
+struct regs {
+
+	long	d_reg[8];		/* Data registers d0..d7 */
+
+	char	*a_reg[8];		/* Address registers */
+
+	unsigned short	reg_fill,	/* Filler to keep long alignment */
+			reg_sr,		/* Status register */
+			*reg_pc;	/* Program counter */
+};
Index: include/setjmp.h
===================================================================
--- include/setjmp.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/setjmp.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,38 @@
+/*
+   =============================================================================
+	setjmp.h -- header for setjmp() and longjmp() functions
+	Version 1 -- 1987-06-11 -- D.N. Lynx Crowe
+
+	Registers a0 and d0 are assumed to be scratch registers,
+	and are not saved by these functions.
+
+	Register d0 is usually used as the return value register.
+	Exception:  Motorola C uses a0 for the return value if it's a pointer.
+
+	This is true of most C compilers for the 68000, including:
+	Digital Research / Alcyon, Lattice, Aztec / Manx, Greenhills, Motorola.
+   =============================================================================
+*/
+
+struct	JMP_BUF {	/* setjmp() / longjmp() environment structure */
+
+	long	jmpret;		/* return address */
+
+	long	jmp_d1;		/* data registers */
+	long	jmp_d2;
+	long	jmp_d3;
+	long	jmp_d4;
+	long	jmp_d5;
+	long	jmp_d6;
+	long	jmp_d7;
+
+	long	jmp_a1;		/* address registers */
+	long	jmp_a2;
+	long	jmp_a3;
+	long	jmp_a4;
+	long	jmp_a5;
+	long	jmp_a6;
+	long	jmp_a7;
+};
+
+typedef struct JMP_BUF jmp_buf;
Index: include/stddefs.h
===================================================================
--- include/stddefs.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/stddefs.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,100 @@
+/*
+   ============================================================================
+	stddefs.h -- Standard definitions for C programs
+	Version 12 -- 1987-12-15 -- D.N. Lynx Crowe
+
+	Must follow stdio.h if stdio.h is used as both define:
+
+		NULL, EOF.
+
+	Must follow define.h on the Atari if define.h is used as both define:
+
+		NULL, EOF, FOREVER, TRUE, FALSE, FAILURE, SUCCESS,
+		YES, NO, EOS, NIL.
+
+	Released to Public Domain - 1987-06 - D.N. Lynx Crowe
+   ============================================================================
+*/
+
+#ifndef	STD_DEFS		/* so we only define these once */
+
+#define	STD_DEFS	1
+
+/* relational operators */
+
+#define	EQ	==
+#define	NE	!=
+#define	GE	>=
+#define	LE	<=
+#define	GT	>
+#define	LT	<
+
+/* logical operators */
+
+#define	NOT	!
+#define	AND	&&
+#define	OR	||
+
+/* infinite loop constructs */
+
+#ifndef	FOREVER
+#define	FOREVER		for(;;)
+#endif
+
+#ifndef	REPEAT
+#define	REPEAT		for(;;)
+#endif
+
+/* 
+
+*/
+
+/* various terminators */
+
+#ifndef	EOF
+#define	EOF		(-1)
+#endif
+
+#ifndef	EOS
+#define	EOS		'\0'
+#endif
+
+#ifndef	NIL
+#define	NIL		0
+#endif
+
+/* manifest constants for function return and flag values */
+
+#ifndef	NULL
+#define	NULL		0
+#endif
+
+#ifndef	YES
+#define	YES		1
+#endif
+
+#ifndef	NO
+#define	NO		0
+#endif
+
+#ifndef	FALSE
+#define	FALSE		0
+#endif
+
+#ifndef	TRUE
+#define	TRUE		1
+#endif
+
+#ifndef	SUCCESS
+#define	SUCCESS		0
+#endif
+
+#ifndef	FAILURE
+#define	FAILURE		(-1)
+#endif
+
+/* BOOL type definition for flag variables */
+
+typedef	char	BOOL;
+
+#endif
Index: include/stdio.h
===================================================================
--- include/stdio.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/stdio.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,73 @@
+/*
+   =============================================================================
+	stdio.h -- Standard I/O Package header for the Buchla 700
+	Version 6 -- 1987-10-20 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "fspars.h"		/* file system parameters */
+
+#define NULL	0
+#define EOF	-1
+
+#define	fgetc	getc
+#define	fputc	putc
+
+#define	_BUSY	0x01
+#define	_ALLBUF	0x02
+#define	_DIRTY	0x04
+#define	_EOF	0x08
+#define	_IOERR	0x10
+
+typedef struct {
+
+	char	*_bp;		/* current position in buffer */
+	char	*_bend;		/* last character in buffer + 1 */
+	char	*_buff;		/* address of buffer */
+	char	_flags;		/* {_BUSY, _ALLBUF, _DIRTY, _EOF, _IOERR} */
+	char	_unit;		/* fd token returned by open */
+	char	_bytbuf;	/* single byte buffer for unbuffered streams */
+	char	_pad;		/* pad for alignment -- possibly use later */
+	int	_buflen;	/* length of buffer */
+
+} FILE;
+
+#ifndef	_FS_DEF_
+
+extern	FILE	Cbuffs[NSTREAMS];		/* table of FILE structures */
+extern	char	*Stdbufs;			/* free list of buffers */
+extern	long	Stdbuf[MAXDFILE][BUFSIZL];	/* buffers */
+
+#endif
+
+extern	long	ftell();
+extern	char	*gets(), *fgets();
+extern	FILE	*fopen(), *fopena(), *fopenb();
+
+#define	stdin	(&Cbuffs[0])
+#define	stdout	(&Cbuffs[1])
+#define	stderr	(&Cbuffs[2])
+
+#define	getchar()	getc(stdin)
+#define	putchar(c)	putc(c, stdout)
+#define	feof(fp)	(((fp)->_flags & _EOF) != 0)
+#define	ferror(fp)	(((fp)->_flags & _IOERR) != 0)
+#define	clearerr(fp)	((fp)->_flags &= ~(_IOERR | _EOF))
+#define	fileno(fp)	((fp)->_unit)
+
+#ifndef	O_RDONLY	/* only define these once */
+
+#define	O_RDONLY	0x0000	/* Read-only value  */
+#define	O_WRONLY	0x0001	/* Write-only value */
+#define	O_RDWR		0x0002	/* Read-write value */
+
+#define O_NDELAY	0x0004	/* Non-blocking I/O flag */
+#define O_APPEND	0x0008	/* Append mode flag (write only at end) */
+
+#define O_CREAT		0x0100	/* File creation flag (uses 3rd argument) */
+#define O_TRUNC		0x0200	/* File truncation flag */
+#define O_EXCL		0x0400	/* Exclusive access flag */
+
+#define	O_RAW		0x8000	/* Raw (binary) I/O flag for getc and putc */
+
+#endif
Index: include/strings.h
===================================================================
--- include/strings.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/strings.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,14 @@
+/*
+   ============================================================================
+	strings.h -- definitions for strnglib
+	Version 3 -- 1987-04-21 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+extern	char	*strccpy(), *strcpy(), *strncpy(), *strcat(), *strncat();
+extern	char	*strchr(), *strrchr(), *strpbrk(), *strtok();
+extern	char	*index(), *rindex(), *str2lc(), *str2uc();
+
+extern	int	strcmp(), strlcmp(), strncmp(), strlen(), strspn(), strcspn();
+
+extern	long	strtol();
Index: include/vsdd.h
===================================================================
--- include/vsdd.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/vsdd.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,71 @@
+/*
+   =============================================================================
+	vsdd.h -- header for Matra-Harris 82716 VSDD video display functions
+	Version 10 -- 1987-05-27 -- D.N. Lynx Crowe
+	(c) Copyright 1987 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#define	VSDD	(unsigned int *)0x200000
+
+#define	V_CHITE	12		/* Character height */
+
+/* object descriptor flags */
+
+#define	V_CBS	0x0800		/* 0 = Bit Map, 1 = Character */
+#define	V_RES0	0x0000		/* Resolution 0: char 16, bit - */
+#define	V_RES1	0x0200		/* Resolution 1: char  6, bit - */
+#define	V_RES2	0x0400		/* Resolution 2: char  8, bit 2 */
+#define	V_RES3	0x0600		/* Resolution 3: char 12, bit 4 */
+#define	V_CRS	0x0100		/* Conceal/Reveal Select */
+
+#define	V_PSE	0x0080		/* Proportional space enable */
+#define	V_FAD	0x0040		/* Full attributes select */
+#define	V_OBL	0x0020		/* Object blink */
+#define	V_BLA	0x0010		/* Object blank */
+
+#define	V_HCR	0x0008		/* High color resolution */
+#define	V_TDE	0x0004		/* Transparency detect enable */
+#define	V_DCS0	0x0000		/* Default color select 0 */
+#define	V_DCS1	0x0001		/* Default color select 1 */
+#define	V_DCS2	0x0002		/* Default color select 2 */
+#define	V_DCS3	0x0003		/* Default color select 3 */
+
+/* Preset flags for bitmap and character objects */
+
+#define	V_BTYPE	0
+#define	V_CTYPE	(V_CBS | V_RES2 | ((V_CHITE - 1) << 12))
+
+/* character attribute flags */
+
+#define	C_ALTCS	0x8000
+#define	C_TFGND	0x4000
+#define	C_TBGND	0x2000
+#define	C_WIDE	0x1000
+
+#define	C_MASK	0x0800
+#define	C_INVRT	0x0400
+#define	C_BLINK	0x0200
+#define	C_ULINE	0x0100
+
+/* 
+
+*/
+
+struct octent {			/* Object control table entry */
+
+	unsigned int	ysize,	/* Height of object in pixels */
+			xsize;	/* Width of object in pixels */
+
+	int		objx,	/* Object x location */
+			objy;	/* Object y location */
+
+	unsigned int	*obase;	/* Base of object data */
+
+	char		opri,	/* Current object priority */
+			obank;	/* Object bank 0..3 */
+
+	unsigned int	odtw0,	/* Object descriptor table word 0 */
+			odtw1;	/* Object descriptor table word 1 */
+};
+
Index: include/vsddsw.h
===================================================================
--- include/vsddsw.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/vsddsw.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,19 @@
+/*
+   =============================================================================
+	VSDDSW.H -- VSDD software support definitions
+	Version 6 -- 1987-05-27 -- D.N. Lynx Crowe
+	Copyright 1987 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+/* functions */
+
+extern	unsigned	vbank();
+extern	int	vputp(), vwputp();
+
+/* these should be voids ... */
+
+extern	int	vfwait(), vputs(), vputsa(), vputc(), VHinit();
+extern	int	objclr(), objon(), objoff();
+extern	int	vcputs(), vwputs(), vwputm(), vmput(), vmputa(), VSinit();
+extern	int	SelObj(), SetPri(), SetObj(), CpyObj();
Index: include/vsddvars.h
===================================================================
--- include/vsddvars.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ include/vsddvars.h	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,14 @@
+/*
+   =============================================================================
+	vsddvars.h -- variable definitions for the VSDD package
+	Version 1 -- 1987-04-15 -- D.N. Lynx Crowe
+	(c) Copyright 1987 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+extern	struct	octent	v_obtab[];	/* object control table */
+
+extern	struct	octent	*v_curob;	/* working object control pointer */
+extern	int	v_nobj;			/* working object number */
+extern	int	v_obpri;		/* working object priority */
+
Index: iolib/dofmt.c
===================================================================
--- iolib/dofmt.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ iolib/dofmt.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,349 @@
+/*
+   =============================================================================
+	dofmt.c -- integer and string formatted output function
+	Version 4 -- 1987-06-12 -- D.N. Lynx Crowe
+
+	Supports most of the BSD & SysV Unix(tm) [f|s]printf conversion codes -
+	No floating point support in this implementation.
+
+	Returns a long instead of the int returned by the Unix(tm) functions.
+
+	WARNING - "Crufty code":
+
+		This code contains hacks to work around a bug in
+		the Alcyon C compiler,  which,  among other things,
+		doesn't handle % properly for longs.  Conversions for
+		o and x are hacked to use shifts instead of modulus.
+
+		Alcyon 'cruft' is enabled by defining CRUFTY non-zero.
+   =============================================================================
+*/
+
+#define	CRUFTY	1
+
+#include "stddefs.h"
+#include "ctype.h"
+#include "varargs.h"
+
+#define	MAXDIGS	11
+#define	HIBITL	(1L << ( (8 * sizeof(long)) - 1))
+
+#define	LONGHMSK	0x0FFFFFFFL
+#define	LONGOMSK	0x1FFFFFFFL
+
+#define	tonum(x)	((x)-'0')
+#define	todigit(x)	((x)+'0')
+#define	max(a,b)	((a)>(b)?(a):(b))
+#define	min(a,b)	((a)<(b)?(a):(b))
+
+#if	CRUFTY
+extern	long	uldiv(), uldivr;
+#endif
+
+long
+dofmt_(putsub, format, args)
+register int (*putsub)();
+register char *format;
+va_list args;
+{
+	register int fcode;
+
+	long	k,
+		n,
+		lzero,
+		count;
+
+	int	hradix,
+		lowbit,
+		length,
+		fplus,
+		fminus,
+		fblank,
+		fsharp,
+		flzero,
+		width,
+		prec;
+
+	register char *bp, *p;
+
+	char	*prefix,
+		*tab,
+		buf[MAXDIGS];
+
+	long	val;
+
+/* 
+
+*/
+
+	count = 0;
+
+	for ( ; ; ) {
+
+		for (bp = format;
+		     (fcode = *format) NE '\0' AND fcode NE '%';
+		     format++)
+			;
+
+		if (n = (long)format - (long)bp) {
+
+			count += n;
+
+			while (n--)
+				(*putsub)(*bp++);
+		}
+
+		if (fcode EQ '\0')
+			return(count);
+
+		fplus = fminus = fblank = fsharp = flzero = 0;
+
+		for ( ; ; ) {
+
+			switch (fcode = *++format) {
+
+			case '+':
+				fplus++;
+				continue;
+
+			case '-':
+				fminus++;
+				continue;
+
+			case ' ':
+				fblank++;
+				continue;
+
+			case '#':
+				fsharp++;
+				continue;
+			}
+
+			break;
+		}
+
+/* 
+
+*/
+
+		if (fcode EQ '*') {
+
+			width = va_arg(args, int);
+
+			if (width < 0) {
+
+				width = -width;
+				fminus++;
+			}
+
+			format++;
+
+		} else {
+
+			if (fcode EQ '0')
+				flzero++;
+
+			for (width = 0; isdigit(fcode = *format); format++)
+				width = width * 10 + tonum(fcode);
+		}
+
+		if (*format NE '.')
+			prec = -1;
+		else if (*++format EQ '*') {
+
+			prec = va_arg(args, int);
+			format++;
+		} else
+			for (prec = 0; isdigit(fcode = *format); format++)
+				prec = prec * 10 + tonum(fcode);
+
+		length = 0;
+
+		if (*format EQ 'l') {
+
+			length++;
+			format++;
+		}
+
+		prefix = "";
+		lzero = 0;
+
+/* 
+
+*/
+		switch (fcode = *format++) {
+
+		case 'd':
+		case 'u':
+			hradix = 10/2;
+			goto fixed;
+
+		case 'o':
+			hradix = 8/2;
+			goto fixed;
+
+		case 'X':
+		case 'x':
+			hradix = 16/2;
+
+		fixed:
+
+			if (prec < 0)
+				if (flzero AND width > 0)
+					prec = width;
+				else
+					prec = 1;
+
+			if (length)
+				val = va_arg(args, long);
+			else if (fcode EQ 'd')
+				val = va_arg(args, int);
+			else
+				val = va_arg(args, unsigned);
+
+			if (fcode EQ 'd') {
+
+				if (val < 0) {
+
+					prefix = "-";
+
+					if (val NE HIBITL)
+						val = -val;
+
+				} else if (fplus)
+					prefix = "+";
+				else if (fblank)
+					prefix = " ";
+			}
+
+			tab = (fcode EQ 'X') ?
+				"0123456789ABCDEF" : "0123456789abcdef";
+
+			p = bp = buf + MAXDIGS;
+
+/* 
+
+*/
+			switch (hradix) {
+
+			case 4:
+
+				while (val NE 0) {
+
+					*--bp = tab[val & 0x07L];
+					val = (val >> 3) & LONGOMSK;
+				}
+
+				break;
+
+			case 5:
+
+				while (val NE 0) {
+
+#if	CRUFTY
+					/* uldiv does a long divide */
+					/* ... with remainder in uldivr */
+
+					val = uldiv(val, 10L);
+					*--bp = tab[uldivr];
+#else
+					/* on most compilers, this works */
+
+					lowbit = val & 1;
+					val = (val >> 1) & ~HIBITL;
+					*--bp = tab[val % hradix * 2 + lowbit];
+					val /= hradix;
+#endif
+				}
+
+				break;
+
+			case 8:
+
+				while (val NE 0) {
+
+					*--bp = tab[val & 0x0FL];
+					val = (val >> 4) & LONGHMSK;
+				}
+			}
+
+			lzero = (long)bp - (long)p + (long)prec;
+
+			if (fsharp AND bp NE p)
+				switch (fcode) {
+
+				case 'o':
+					if (lzero < 1)
+						lzero = 1;
+					break;
+
+				case 'x':
+				case 'X':
+					prefix = "0x";
+					break;
+				}
+
+			break;
+
+/* 
+
+*/
+		default:
+			buf[0] = fcode;
+			goto c_merge;
+
+		case 'c':
+			buf[0] = va_arg(args, int);
+
+		c_merge:
+
+			p = (bp = &buf[0]) + 1;
+			break;
+
+		case 's':
+			p = bp = va_arg(args, char *);
+
+			if (prec < 0)
+				p += strlen(bp);
+			else {
+				while (*p++ NE '\0' AND --prec GE 0)
+					;
+				--p;
+			}
+
+			break;
+
+		case '\0':
+			return(-1);
+
+		}
+
+/* 
+
+*/
+		if (lzero < 0)
+			lzero = 0;
+
+		k = (n = (long)p - (long)bp) + (long)(lzero +
+			(prefix[0] EQ '\0' ? 0 : (prefix[1] EQ '\0' ? 1 : 2)));
+
+		count += (width >k) ? width : k;
+
+		if (!fminus)
+			while (--width GE k)
+				(*putsub)(' ');
+
+		while (*prefix NE '\0')
+			(*putsub)(*prefix++);
+
+		while (--lzero GE 0)
+			(*putsub)('0');
+
+		if (n > 0)
+			while (n--)
+				(*putsub)(*bp++);
+
+		while (--width GE k)
+			(*putsub)(' ');
+	}
+}
Index: iolib/hwdefs.s
===================================================================
--- iolib/hwdefs.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ iolib/hwdefs.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,86 @@
+* ------------------------------------------------------------------------------
+* hwdefs.s --  External definitions of Buchla 700 I/O addresses
+* Version 14 -- 1988-08-15 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_io_time,_io_lcd,_io_ser,_io_midi
+		.xdef	_io_disk,_io_tone,_io_leds,_io_kbrd
+		.xdef	_io_vreg,_io_vraw,_io_vram,_io_fpu
+		.xdef	_lcd_a0,_lcd_a1
+*
+		.xdef	_v_regs,_v_odtab,_v_actab
+		.xdef	_v_ct0
+		.xdef	_v_gt1
+		.xdef	_v_score,_v_cgtab
+*
+		.xdef	_v_curs0,_v_curs1,_v_curs2,_v_curs3
+		.xdef	_v_curs4,_v_curs5,_v_curs6,_v_curs7
+		.xdef	_v_kbobj,_v_lnobj,_v_tcur
+		.xdef	_v_win0
+		.xdef	_v_cur
+*
+		.xdef	_fc_sw,_fc_val
+*
+* ------------------------------------------------------------------------------
+*
+* Hardware base addresses
+* -----------------------
+_io_fpu		.equ	$180000		* FPU base address
+*
+VB		.equ	$200000		* VSDD base address
+*
+_io_time	.equ	$3A0001		* Timer chip
+_io_lcd		.equ	$3A4001		* LCD controller
+_io_ser		.equ	$3A8001		* Serial ports  (RS232)
+_io_midi	.equ	$3AC001		* MIDI ports
+_io_disk	.equ	$3B0001		* Disk controller
+_io_tone	.equ	$3B4001		* Sound generator chip
+_io_leds	.equ	$3B8001		* LED driver
+_io_kbrd	.equ	$3BC001		* Keyboard / panel processor
+*
+_lcd_a0		.equ	_io_lcd		* LCD port a0
+_lcd_a1		.equ	_io_lcd+2	* LCD port a1
+*
+		.page
+*
+* Video definitions
+* -----------------
+_io_vreg	.equ	VB		* Relocated video registers after setup
+_io_vraw	.equ	VB+$400		* Raw video registers at RESET
+_io_vram	.equ	VB		* Video RAM base address
+*
+* Name			Offset		  Usage			       Bank
+* -------		---------	  -------------------------    ----
+_v_regs		.equ	VB		* Video registers	       0,1
+*
+_v_odtab	.equ	VB+128		* Object Descriptor Table	0
+_v_actab	.equ	VB+256		* Access Table			0
+_v_ct0		.equ	VB+1024		* Character Text-0		0
+_v_gt1		.equ	VB+1304		* Graphics Text-1		0
+_v_score	.equ	VB+8192		* Score object			0
+_v_cgtab	.equ	VB+122880	* Character Generator Table	0
+*
+_v_curs0	.equ	VB+1024		* Cursor object 0  (arrow ULE)	1
+_v_curs1	.equ	VB+1152		* Cursor object 1  (arrow ULO)	1
+_v_curs2	.equ	VB+1280		* Cursor object 2  (arrow URE)	1
+_v_curs3	.equ	VB+1408		* Cursor object 3  (arrow URO)	1
+_v_curs4	.equ	VB+1536		* Cursor object 4  (arrow LLE)	1
+_v_curs5	.equ	VB+1664		* Cursor object 5  (arrow LLO)	1
+_v_curs6	.equ	VB+1792		* Cursor object 6  (arrow LRE)	1
+_v_curs7	.equ	VB+1920		* Cursor object 7  (arrow LRO)	1
+_v_tcur		.equ	VB+2048		* Typewriter cursor		1
+_v_kbobj	.equ	VB+2880		* Keyboard object		1
+_v_lnobj	.equ	VB+4672		* Line object			1
+_v_cur		.equ	VB+6464		* Underline cursor		1
+_v_win0		.equ	VB+16384	* Window-0 object		1
+*
+* BIOS RAM definitions
+* --------------------
+* WARNING: the following addresses must match those of the corresponding
+* variables defined in bios.s or chaos is guaranteed.
+*
+_fc_sw		.equ	$420		* word - Frame counter switch
+_fc_val		.equ	$422		* long - Frame counter value
+*
+		.end
Index: iolib/mdump.c
===================================================================
--- iolib/mdump.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ iolib/mdump.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,134 @@
+/*
+   =============================================================================
+	mdump.c -- Hexadecimal memory dump
+	Version 5 -- 1987-10-29 -- D.N. Lynx Crowe
+
+	Displays the contents of memory in hexadecimal.
+	If a byte is printable, it is also printed.
+
+	The format of the output is :
+
+	   hex_add byte byte byte byte ... byte byte byte byte  string  
+
+	where:
+
+		hex_add   Start address for that line in hex. 
+		byte      Representation of a byte in hex. Two characters
+				for each byte.  PERLINE bytes per line.
+		string    If the character is printable, it is printed,
+				otherwise a '.' is printed.
+   =============================================================================
+*/
+
+#define	TESTER		0
+
+#include "stddefs.h"
+#include "stdio.h"
+#include "ctype.h"
+
+#define PERLINE 16
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	pipc() -- print if printable characters
+   =============================================================================
+*/
+
+static
+pipc(chars, length)
+char chars[];
+int length;
+{
+	int	i;
+
+	for (i = 0; i < length; i++)
+		if (isascii(0x00FF & chars[i]) AND (isprint(0x00FF & chars[i])))
+			printf("%c", chars[i]);
+		else
+			printf(".");
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	mdump() -- dump a memory area in hexadecimal
+   =============================================================================
+*/
+
+mdump(begin, end, start)
+char *begin, *end;
+long start;
+{
+	long	i, ii;
+	int	j, jj, k;
+	char	c, chars[PERLINE];
+
+	i = 0L;
+	ii = start;
+	j = 0;
+
+	if (begin GT end)
+		return;
+
+	while (begin LE end) {
+
+		c = *begin++;
+
+		if (! (i % PERLINE)) {
+
+			if (i) {
+
+				j=0;
+				printf("  ");
+				pipc(chars, PERLINE);
+			}
+                
+			printf("\n%08lX:", ii);
+		}
+
+		ii++;
+		i++;
+
+		printf(" %02.2X", (c & 0x00FF));
+		chars[j++] = c;
+	}
+
+	if (k = (i % PERLINE)) {
+
+		k = PERLINE - k;
+
+		for (jj = 0; jj < (3 * k); ++jj)
+			printf(" ");
+	}
+
+	printf("  ");
+	pipc(chars, PERLINE);
+	printf("\n");
+}
+
+/* 
+
+*/
+
+#if	TESTER
+
+char	area[128];
+
+main()
+{
+	register short i;
+
+	for (i = 0; i < 128; i++)
+		area[i] = i + 128;
+
+	mdump(area, (area + 127), area);
+}
+
+#endif
Index: iolib/pause.c
===================================================================
--- iolib/pause.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ iolib/pause.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,18 @@
+/*
+   =============================================================================
+	pause.c -- output a message and wait for a CR
+	Version 3 -- 1987-07-15 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "biosdefs.h"
+
+extern	int	waitcr(), writeln();
+
+pause(s)
+char *s;
+{
+	writeln(CON_DEV, s);
+	writeln(CON_DEV, "\r\n");
+	waitcr();
+}
Index: iolib/printf.c
===================================================================
--- iolib/printf.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ iolib/printf.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,60 @@
+/*
+   =============================================================================
+	printf.c -- printf function
+	Version 6 -- 1987-08-13 -- D.N. Lynx Crowe
+
+	RECOVERED From:  Version 5 -- 1987-06-16 -- D.N. Lynx Crowe
+
+	"Crufty code" Warning:
+		Since this isn't Unix(tm), we prepend a '\r' when we see a '\n'.
+		We also return a long, since this is a 32 bit address machine.
+		(Well, almost 32 bits.  Too big for an Alcyon 16 bit int anyway.)
+   =============================================================================
+*/
+
+#include "stddefs.h"
+#include "biosdefs.h"
+#include "varargs.h"
+
+extern	long	dofmt_();
+
+/*
+   =============================================================================
+	printf(fmt, args) -- output 'args' according to 'fmt' on CON_DEV
+   =============================================================================
+*/
+
+long
+printf(fmt, va_alist)
+char *fmt;
+va_dcl
+{
+	register long count;
+	int fpsub();
+	va_list aptr;
+
+	va_start(aptr);
+	count = dofmt_(fpsub, fmt, aptr);
+	va_end(aptr);
+	return(count);
+}
+
+/*
+   =============================================================================
+	fpsub(c) -- output 'c' to CON_DEV
+   =============================================================================
+*/
+
+static
+int
+fpsub(c)
+int c;
+{
+	/* KLUDGE:  since we aren't Unix(tm) we prepend a CR to LF's */
+
+	if (c EQ '\n')
+		BIOS(B_PUTC, CON_DEV, '\r');
+
+	BIOS(B_PUTC, CON_DEV, c);
+	return(c);
+}
Index: iolib/rawio.c
===================================================================
--- iolib/rawio.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ iolib/rawio.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,239 @@
+/*
+   ============================================================================
+	rawio.c -- Some raw serial I/O routines for ROMP, et al
+	Version 5 -- 1987-06-11 -- D.N. Lynx Crowe
+
+	Defines:	getln(), getrln(), readln(), writeln()
+
+	All of the following use raw BIOS calls to do their I/O.
+
+	int
+	getln(unit,nb,buf)
+	int unit;	logical unit number 1..4
+	int nb;		buffer limit
+	char *buf;	buffer pointer
+
+		Reads a line from unit into buf, with a limit of nb
+	bytes.  Does standard input editing  (BS. DEL, ^X).  Returns
+	on CR, LF, ^X, or buffer full.  Returns the byte that stopped
+	the input, or ERR01 for buffer full.  Echoes the characters as
+	it reads them, such that "What you see is what you get" on a crt.
+
+	int
+	getrln(unit, nb, buf)
+	int unit;	logical unit number 1..4
+	int nb;		buffer limit
+	char *buf;	buffer pointer
+
+		Reads a line from unit into buf, with a limit of nb bytes.
+	Allows input to be cancelled by ^X.  Returns	on CR, LF, ^X,
+	^Z, or buffer full.  Returns the byte that stopped the input,
+	or ERR01 for buffer full.
+
+
+
+	int
+	readln(unit,nc,ctl,nb,buf)
+	int unit;	logical unit number 1..4
+	int nc;		length of control string ctl
+	char *ctl;	control string pointer
+	int nb;		buffer limit
+	char *buf;	buffer pointer (at least nb+1 bytes)
+
+		Reads characters from unit into buf until: 1) nb bytes
+	have been transferred, or, 2) one of the characters in the string
+	at ctl has been read.  The terminating character will be in the
+	buffer, followed by a null byte  (even if the character from ctl
+	was a null byte).  Returns: 1) the terminating character as its value,
+	or 2) ERR01 if stopped by the count in nb, or 3) ERR15 for an
+	invalid unit.  Echoes characters as it reads them, unless the
+	character is one of those in ctl.
+
+	void
+	writeln(unit,buf)
+	int unit;	logical unit number 0..4
+	char *buf;	buffer pointer
+
+		Writes the zero terminated string from buf onto unit.
+
+   ============================================================================
+*/
+
+/* 
+ */
+
+#include "stddefs.h"
+#include "errdefs.h"
+#include "ascii.h"
+#include "biosdefs.h"
+
+
+int
+readln(unit,nc,ctl,nb,buf)
+int unit;	/* logical unit number 1..4 */
+int nc;		/* length of control string ctl */
+char *ctl;	/* control string pointer */
+int nb;		/* buffer limit */
+char *buf;	/* buffer pointer (at least nb+1 bytes) */
+{
+	register char *cp;
+	register int i, j;
+	register char *bp;
+	register char c;
+	
+
+	if (unit LT 1 OR unit GT 4)	/* verify unit number is in range */
+		return(ERR15);		/* return ERR15 if not */
+
+	bp = buf;	/* setup buffer pointer */
+
+	for (i = 0; i < nb; i++) {	/* main read loop */
+
+		c = BIOS(B_GETC, unit) & 0xFF;	/* get a byte from the unit */
+
+		*bp++ = c;	/* add it to the buffer */
+		*bp = '\0';	/* ... followed by a zero byte */
+
+		cp = ctl;	/* setup to scan ctl for the character */
+
+		for (j = 0; j < nc; j++)	/* scan each byte of ctl */
+			if (*ctl++ EQ c )	/* done if we find it */
+				return((int)c);
+
+		BIOS(B_PUTC, unit, c);		/* echo the character */
+	}
+
+	return(ERR01);	/* buffer full */
+}
+
+/* 
+ */
+
+int
+getln(unit,nb,buf)
+int unit;	/* logical unit number 1..4 */
+int nb;		/* buffer limit */
+char *buf;	/* buffer pointer */
+{
+	register char *bp;
+	register char c;
+	register int bc;
+
+	bc = 0;		/* number of characters currently in buffer */
+	bp = buf;	/* current buffer pointer */
+	*bp = '\0';	/* initial null into buffer */
+
+	while (bc LT nb) {
+
+		c = BIOS(B_GETC, unit) & 0xFF;
+
+		switch (c) {
+
+		case A_BS:
+		case A_DEL:
+
+			if (bc EQ 0) {
+
+				BIOS(B_PUTC, unit, A_BEL);
+				break;
+
+			} else {
+
+				bc--;
+				bp--;
+				*bp = '\0';
+				BIOS(B_PUTC, unit, A_BS);
+				BIOS(B_PUTC, unit, ' ');
+				BIOS(B_PUTC, unit, A_BS);
+				break;
+			}
+
+		case A_CR:
+		case A_LF:
+
+			*bp++ = c;		/* put character in buffer */
+			*bp = '\0';		/* terminate line with null */
+			return((int)c);		/* return -- CR or LF hit */
+
+/* 
+ */
+
+		case CTL('X'):
+
+			*buf = '\0';		/* clear the buffer */
+			return((int)c);		/* return -- line cancelled */
+
+		default:
+
+			*bp++ = c;		/* put character in buffer */
+			*bp = '\0';		/* terminate line with null */
+			BIOS(B_PUTC, unit, c);	/* echo the character */
+			bc++;			/* update character count */
+		}
+	}
+
+	return(ERR01);		/* buffer full error */
+}
+
+/* 
+ */
+
+int
+getrln(unit,nb,buf)
+int unit;	/* logical unit number 1..4 */
+int nb;		/* buffer limit */
+char *buf;	/* buffer pointer */
+{
+	register char *bp;
+	register char c;
+	register int bc;
+
+	bc = 0;		/* number of characters currently in buffer */
+	bp = buf;	/* current buffer pointer */
+	*bp = '\0';	/* initial null into buffer */
+
+	while (bc LT nb) {
+
+		c = BIOS(B_GETC, unit) & 0xFF;
+
+		switch (c) {
+
+		case A_CR:
+		case A_LF:
+		case CTL('Z'):
+
+			*bp++ = c;		/* put character in buffer */
+			*bp = '\0';		/* terminate line with null */
+			return((int)c);		/* return -- CR, LF, or ^Z hit */
+
+		case CTL('X'):
+
+			*buf = '\0';		/* clear the buffer */
+			return((int)c);		/* return -- line cancelled */
+
+		default:
+
+			*bp++ = c;		/* put character in buffer */
+			*bp = '\0';		/* terminate line with null */
+			bc++;			/* update character count */
+		}
+	}
+
+	return(ERR01);		/* buffer full error */
+}
+
+/* 
+ */
+
+writeln(unit,buf)
+int unit;	/* logical unit number 0..4 */
+char *buf;	/* buffer pointer */
+{
+	register char *bp;
+	register char c;
+
+	bp = buf;	/* setup buffer pointer */
+
+	while (c = *bp++)	/* send the string, a byte at a time */
+		BIOS(B_PUTC, unit, c);
+}
Index: iolib/rtraps.s
===================================================================
--- iolib/rtraps.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ iolib/rtraps.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,48 @@
+* ------------------------------------------------------------------------------
+* rtraps.s -- define ROMP debug trap
+* Version 7 -- 1988-01-12 -- Copyright 1987, 1988 by D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_trap15
+*
+		.xref	_rompbp
+*
+		.xref	tr1sav,tr13sav,tr14sav
+		.xref	tr1rmp,tr13rmp,tr14rmp
+*
+BUCHLA		.equ	1		* IPL value:  0 = NASA , 1 = Buchla
+*
+		.ifeq	BUCHLA
+IPLEVEL		.equ	$0400		* NASA IPL = 4    (enable 5 and above)
+		.endc
+*
+		.ifne	BUCHLA
+IPLEVEL		.equ	$0200		* Buchla IPL = 2  (enable 3 and above)
+		.endc
+*
+IPL7		.equ	$0700		* IPL 7
+*
+* _trap15 -- ROMP debug trap  (used to implement breakpoints)
+* -------    ------------------------------------------------
+_trap15:	ori.w	#IPL7,sr		* Disable interrupts
+		move.w	#0,-(a7)		* Keep stack long aligned
+		movem.l	d0-d7/a0-a7,-(a7)	* Save regs on stack
+		move.l	tr1sav,tr1rmp		* Save trap save areas
+		move.l	tr13sav,tr13rmp		* ...
+		move.l	tr14sav,tr14rmp		* ...
+		move.w	sr,d0			* Get status register
+		andi.w	#$F8FF,d0		* Enable serial I/O interrupts
+		ori.w	#IPLEVEL,d0		* ...
+		move.w	d0,sr			* ...
+		jsr	_rompbp			* Pass control to ROMP
+*
+		ori.w	#IPL7,sr		* Disable interrupts
+		move.l	tr14rmp,tr14sav		* Restore trap save areas
+		move.l	tr13rmp,tr13sav		* ...
+		move.l	tr1rmp,tr1sav		* ...
+		movem.l	(a7)+,d0-d7/a0-a7	* Restore regs
+		addq.l	#2,a7			* Discard alignment filler word
+		rte				* Back to what we interrupted
+*
+		.end
Index: iolib/setipl.s
===================================================================
--- iolib/setipl.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ iolib/setipl.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,44 @@
+*
+* setipl.s -- Set internal processor interrupt level
+* --------    --------------------------------------
+* Version 2 -- 1988-06-29 -- D.N. Lynx Crowe
+*
+*	short
+*	setipl(arg);
+*	short arg;
+*
+*	Sets processor interrupt level to arg.
+*	Returns old interrupt level, or -1 if arg < 0 or > 7
+*
+*	Assumes you are in supervisor mode.
+*	You get a Privelege Violation TRAP if you aren't.
+*
+		.text
+*
+		.xdef	_setipl
+*
+_setipl:	link	a6,#0			* Link up stack frames
+		move.w	8(a6),d0		* Get argument
+		tst.w	d0			* Check lower limit
+		bmi	setipler		* Jump if < 0  (error)
+*
+		cmpi.w	#7,d0			* Check upper limit
+		bgt	setipler		* Jump if > 7  (error)
+*
+		move.w	sr,d1			* Get current level
+		move.w	d1,d2			* ... save for later
+		lsl.w	#8,d0			* Shift argument into position
+		andi.w	#$F8FF,d1		* Mask out old level
+		or.w	d0,d1			* OR in new level
+		move.w	d2,d0			* Setup return of old level
+		lsr.w	#8,d0			* ...
+		andi.l	#$7,d0			* ...
+		move.w	d1,sr			* Set the new interrupt level
+		unlk	a6			* Unlink stack frames
+		rts				* Return to caller
+*
+setipler:	moveq.l	#-1,d0			* Setup to return error code
+		unlk	a6			* Unlink stack frames
+		rts				* Return to caller
+*
+		.end
Index: iolib/setsr.s
===================================================================
--- iolib/setsr.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ iolib/setsr.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,27 @@
+*
+* setsr.s -- Set processor status register
+* -------    -----------------------------
+* Version 1 -- 1988-06-29 -- D.N. Lynx Crowe
+*
+*	short
+*	setsr(arg);
+*	short arg;
+*
+*	Sets processor status register to 'arg'.
+*	Returns old status register value.
+*
+*	Assumes you are in supervisor mode.
+*	You get a Privelege Violation TRAP if you aren't.
+*
+*	Coded for speed -- this is as fast as you can get.
+*	No error checking is done -- assumes you know what you're doing.
+*
+		.text
+*
+		.xdef	_setsr
+*
+_setsr:		move.w	sr,d0			* Get current sr
+		move.w	4(sp),sr		* Set new sr
+		rts				* Return to caller
+*
+		.end
Index: iolib/sprintf.c
===================================================================
--- iolib/sprintf.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ iolib/sprintf.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,48 @@
+/*
+   =============================================================================
+	sprintf.c -- sprintf function
+	Version 2 -- 1987-06-11 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "varargs.h"
+
+extern long	dofmt_();
+
+static char	*buff;
+
+/*
+   =============================================================================
+	sprintf(str, fmt, args) -- format args into str according to fmt
+   =============================================================================
+*/
+
+long
+sprintf(str, fmt, va_alist)
+char *str, *fmt;
+va_dcl
+{
+	int spsub();
+
+	register long count;
+	va_list aptr;
+
+	va_start(aptr);
+	buff = str;
+	count = dofmt_(spsub, fmt, aptr);
+	*buff = '\0';
+	return(count);
+}
+
+/*
+   =============================================================================
+	spsub(c) - put c into the output string
+   =============================================================================
+*/
+
+static
+int
+spsub(c)
+{
+	return((*buff++ = c) & 0xFF);
+}
Index: iolib/traps.s
===================================================================
--- iolib/traps.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ iolib/traps.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,62 @@
+*
+* traps.s -- define trap linkages for C routines
+* -------    -----------------------------------
+* Version 8 -- 1987-06-08 -- D.N. Lynx Crowe
+*
+* Caution:  these are serially re-useable, but NOT reentrant, so
+* don't use them in interrupt processing code.
+*
+* An exception is made for ROMP in _trap15 for breakpoints so that the
+* debug code can be debugged.
+*
+		.text
+*
+		.xdef	_trap1
+		.xdef	_trap13,_trap14
+		.xdef	_xtrap15
+*
+		.xdef	tr1sav,tr13sav,tr14sav
+		.xdef	tr1rmp,tr13rmp,tr14rmp
+*
+* _trap1 -- provide access to BDOS functions
+* ------    --------------------------------
+_trap1:		move.l	(a7)+,tr1sav		* Save return address
+		trap	#1			* Do the trap
+		move.l	tr1sav,-(a7)		* Restore return address
+		rts				* Return to caller
+*
+* _trap13 -- provide access to BIOS functions
+* -------    --------------------------------
+_trap13:	move.l	(a7)+,tr13sav		* Save return address
+		trap	#13			* Do the trap
+		move.l	tr13sav,-(a7)		* Restore return address
+		rts				* Return to caller
+*
+* _trap14 -- provide access to extended BIOS functions
+* -------    -----------------------------------------
+_trap14:	move.l	(a7)+,tr14sav		* Save return address
+		trap	#14			* Do the trap
+		move.l	tr14sav,-(a7)		* Restore return address
+		rts				* Return to caller
+*
+* _xtrap15 -- Setup initial register trap for ROMP
+* --------    ------------------------------------
+_xtrap15:	trap	#15			* TRAP into ROMP
+		rts				* Return  (usually won't happen)
+*
+		.page
+*
+* RAM storage areas
+* -----------------
+		.bss
+		.even
+*
+tr1sav:		ds.l	1		* Return address for trap1
+tr13sav:	ds.l	1		* Return address for trap13
+tr14sav:	ds.l	1		* Return address for trap14
+*
+tr1rmp:		ds.l	1		* Save area for tr1sav for ROMP
+tr13rmp:	ds.l	1		* Save area for tr13sav for ROMP
+tr14rmp:	ds.l	1		* Save area for tr14sav for ROMP
+*
+		.end
Index: iolib/waitcr.c
===================================================================
--- iolib/waitcr.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ iolib/waitcr.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,37 @@
+/*
+   =============================================================================
+	waitcr.c -- wait for a CR from the console and allow for debugging
+	Version 3 -- 1987-07-15 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "biosdefs.h"
+#include "stddefs.h"
+
+extern	int	xtrap15();	/* the ROMP trap */
+
+/*
+   =============================================================================
+	waitcr() -- wait for a CR or a CTL-G.  CR returns control to the
+	caller, CTL-G invokes xtrap15(), which if it returns, returns to
+	the caller.  The xtrap15() escape is to allow a convenient debug
+	point whenever we wait on the console.  The character that caused
+	the return  (CR or CTL-G) is returned as the value of the function.
+   =============================================================================
+*/
+
+int
+waitcr()
+{
+	int	c;
+
+	BIOS(B_PUTC, CON_DEV, '\007');		/* wake up the operator */
+
+	/* await a CR, in which case we just exit */
+
+	while ('\r' NE (c = (0x007F & (int)BIOS(B_GETC, CON_DEV))))
+		if (c EQ '\007')	/* ... or a control-G */
+			xtrap15();	/* ... in which case we trap first */
+
+	return(c);	/* return the character that caused us to exit */
+}
Index: lib700/aldiv.s
===================================================================
--- lib700/aldiv.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/aldiv.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,26 @@
+*
+* aldiv.s -- indirect long divide
+* Version 1 -- 1989-01-24 -- D.N. Lynx Crowe
+*
+	.text
+*
+	.xdef	aldiv
+	.xdef	_aldiv
+*
+	.xref	_ldiv
+*
+aldiv:
+_aldiv:
+*
+	link	a6,#-2
+	move.l	12(a6),-(a7)
+	movea.l	8(a6),a0
+	move.l	(a0),-(a7)
+	jsr	_ldiv
+	cmpm.l	(a7)+,(a7)+
+	movea.l	8(a6),a1
+	move.l	d0,(a1)
+	unlk	a6
+	rts
+*
+	.end
Index: lib700/almul.s
===================================================================
--- lib700/almul.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/almul.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,21 @@
+*
+* almul.s -- indirect long multiply
+* Version 1 -- 1989-01-24 -- D.N. Lynx Crowe
+*
+		.text
+*
+		.xdef	almul
+*
+		.xref	lmul
+*
+almul:		move.l	a5,-(a7)
+		movea.l	8(a7),a5
+		move.l	12(a7),-(a7)
+		move.l	(a5),-(a7)
+		jsr	lmul
+		addq.w	#8,a7
+		move.l	d0,(a5)
+		movea.l	(a7)+,a5
+		rts
+*
+		.end
Index: lib700/alrem.s
===================================================================
--- lib700/alrem.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/alrem.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,28 @@
+*
+* alrem.s -- indirect long modulus
+* Version 1 -- 1989-01-24 -- D.N. Lynx Crowe
+*
+		.text
+*
+		.xdef	alrem
+		.xdef	_alrem
+*
+		.xref	_ldiv
+		.xref	_ldivr
+*
+alrem:
+_alrem:
+*
+		link	a6,#-2
+		move.l	12(a6),-(a7)
+		movea.l	8(a6),a0
+		move.l	(a0),-(a7)
+		jsr	_ldiv
+		cmpm.l	(a7)+,(a7)+
+		move.l	_ldivr,d0
+		movea.l	8(a6),a1
+		move.l	d0,(a1)
+		unlk	a6
+		rts
+*
+		.end
Index: lib700/bitrev.c
===================================================================
--- lib700/bitrev.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/bitrev.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,38 @@
+/*
+   =============================================================================
+	bitrev.c -- bit reverse function
+	Version 1 -- 1987-03-24 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+static int bitmask[] = {
+
+	0x0001, 0x0002, 0x0004, 0x0008,
+	0x0010, 0x0020, 0x0040, 0x0080,
+	0x0100, 0x0200, 0x0400, 0x0800,
+	0x1000, 0x2000, 0x4000, 0x8000
+};
+
+/*
+   =============================================================================
+	bitrev(bitsin, nbits) -- reverses the rightmost nbits of bitsin.
+
+	Any bits to the left of the reversed bits in the result will be zeros.
+   =============================================================================
+*/
+
+int
+bitrev(bitsin, nbits)
+int bitsin, nbits;
+{
+	int	m, n;
+
+	n = 0;
+
+	for (m = 0; m < nbits; m++)
+		if (bitsin & bitmask[m])
+			n |= bitmask[nbits-1-m];
+
+	return(n);
+}
+
Index: lib700/blkfill.s
===================================================================
--- lib700/blkfill.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/blkfill.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,36 @@
+* ------------------------------------------------------------------------------
+* blkfill.s -- block fill function
+* Version 1 -- 1987-08-28 -- D.N. Lynx Crowe
+*
+*	void
+*	blkfill(where, what, count)
+*	char *where;
+*	char what;
+*	short count;
+*
+*		Fills 'count' bytes at 'where' with 'what'.
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_blkfill
+*
+_blkfill:	link	a6,#0
+		movem.l	d5-d7/a5-a5,-(a7)
+		movea.l	8(a6),a5
+		move.b	13(a6),d7
+		move.w	14(a6),d6
+		bra	blkf2
+*
+blkf1:		move.b	d7,(a5)+
+*
+blkf2:		move.w	d6,d0
+		subq.w	#1,d6
+		tst.w	d0
+		bgt	blkf1
+*
+		tst	(a7)+
+		movem.l	(a7)+,d6-d7/a5-a5
+		unlk	a6
+		rts
+*
+		.end
Index: lib700/blkmove.s
===================================================================
--- lib700/blkmove.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/blkmove.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,57 @@
+* ------------------------------------------------------------------------------
+* blkmove.s -- block move function
+* Version 1 -- 1987-08-28 -- D.N. Lynx Crowe
+*
+*	void
+*	blkmove(to, from, n)
+*	char *to, *from;
+*	short n;
+*
+*		Copies 'n' bytes from address 'from' to address 'to'.
+*		Treats overlaps of from and to areas intelligently.
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_blkmove
+*
+_blkmove:	link	a6,#$FFFC
+		move.l	8(a6),d0
+		cmp.l	12(a6),d0
+		bcc	blkm3
+*
+		bra	blkm2
+*
+blkm1:		movea.l	8(a6),a0
+		movea.l	12(a6),a1
+		move.b	(a1),(a0)
+		addq.l	#1,8(a6)
+		addq.l	#1,12(a6)
+*
+blkm2:		move.w	16(a6),d0
+		subq.w	#1,16(a6)
+		tst.w	d0
+		bne	blkm1
+*
+		bra	blkm6
+*
+blkm3:		move.w	16(a6),d0
+		ext.l	d0
+		add.l	d0,8(a6)
+		add.l	d0,12(a6)
+		bra	blkm5
+*
+blkm4:		subq.l	#1,8(a6)
+		subq.l	#1,12(a6)
+		movea.l	8(a6),a0
+		movea.l	12(a6),a1
+		move.b	(a1),(a0)
+*
+blkm5:		move.w	16(a6),d0
+		subq.w	#1,16(a6)
+		tst.w	d0
+		bne	blkm4
+*
+blkm6:		unlk	a6
+		rts
+*
+		.end
Index: lib700/ctype.c
===================================================================
--- lib700/ctype.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/ctype.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,76 @@
+/*
+   ============================================================================
+	ctype.c -- extended character type table, ala' Unix(tm)
+	Version 8 -- 1987-06-16 -- D.N. Lynx Crowe
+
+	This character type table supports the extended ctype.h macros.
+	See the ctype.h header file for further notes.
+
+	WARNING:  SYS5CODE must be defined properly in ctype.h for the macros
+	to work with this table.
+   ============================================================================
+*/
+
+#define	_CTYPE_C
+
+#include "ctype.h"
+
+#define	_CS	_C|_S
+#define	_PS	_P|_S
+#define	_NX	_N|_X
+#define	_UX	_U|_X
+#define	_LX	_L|_X
+
+/* 
+
+*/
+
+#if	SYS5CODE
+char _ctype[] = {	/* this table handles EOF as a legal value */
+
+	/* -1   EOF */	 0,					/* -1 EOF */
+#else
+
+___atab() { return; }	/* dummy function to force the loader to see __atab */
+
+char __atab[] = {	/* EOF won't work properly with this table */
+#endif
+
+	/* Octal */						/* Hex */
+	/* 000..007 */	 _C, _C,  _C,  _C,  _C,  _C,  _C,  _C,	/* 00..07 */
+	/* 010..017 */	 _C, _CS, _CS, _CS, _CS, _CS, _C,  _C,	/* 08..0F */
+	/* 020..027 */	 _C, _C,  _C,  _C,  _C,  _C,  _C,  _C,	/* 10..17 */
+	/* 030..037 */	 _C, _C,  _C,  _C,  _C,  _C,  _C,  _C,	/* 18..1F */
+	/* 040..047 */	_PS, _P,  _P,  _P,  _P,  _P,  _P,  _P,	/* 20..27 */
+	/* 050..057 */	_P,  _P,  _P,  _P,  _P,  _P,  _P,  _P,	/* 28..2F */
+	/* 060..067 */	_NX, _NX, _NX, _NX, _NX, _NX, _NX, _NX,	/* 30..37 */
+	/* 070..077 */	_NX, _NX, _P,  _P,  _P,  _P,  _P,  _P,	/* 38..3F */ 
+
+	/* 100..107 */	_P,  _UX, _UX, _UX, _UX, _UX, _UX, _U,	/* 40..47 */
+	/* 110..117 */	_U,  _U,  _U,  _U,  _U,  _U,  _U,  _U,	/* 48..4F */
+	/* 120..127 */	_U,  _U,  _U,  _U,  _U,  _U,  _U,  _U,	/* 50..57 */
+	/* 130..137 */	_U,  _U,  _U,  _P,  _P,  _P,  _P,  _P,	/* 58..5F */
+	/* 140..147 */	_P,  _LX, _LX, _LX, _LX, _LX, _LX, _L,	/* 60..67 */
+	/* 150..157 */	_L,  _L,  _L,  _L,  _L,  _L,  _L,  _L,	/* 68..6F */
+	/* 160..167 */	_L,  _L,  _L,  _L,  _L,  _L,  _L,  _L,	/* 70..77 */
+	/* 170..177 */	_L,  _L,  _L,  _P,  _P,  _P,  _P,  _C,	/* 78..7F */
+
+	/* 200..207 */  _C,  _C,  _C,  _C,  _C,  _C,  _C,  _C,	/* 80..87 */
+	/* 210..217 */	_C,  _CS, _CS, _CS, _CS, _CS, _C,  _C,	/* 88..8F */
+	/* 220..227 */	_C,  _C,  _C,  _C,  _C,  _C,  _C,  _C,	/* 90..97 */
+	/* 230..237 */	_C,  _C,  _C,  _C,  _C,  _C,  _C,  _C,	/* 98..9F */
+	/* 240..247 */	_PS, _P,  _P,  _P,  _P,  _P,  _P,  _P,	/* A0..A7 */
+	/* 250..257 */	_P,  _P,  _P,  _P,  _P,  _P,  _P,  _P,	/* A8..AF */
+	/* 260..267 */	_NX, _NX, _NX, _NX, _NX, _NX, _NX, _NX,	/* B0..B7 */
+	/* 270..277 */	_NX, _NX, _P,  _P,  _P,  _P,  _P,  _P,	/* B8..BF */
+
+	/* 300..307 */	_P,  _UX, _UX, _UX, _UX, _UX, _UX, _U,	/* C0..C7 */
+	/* 310..317 */	_U,  _U,  _U,  _U,  _U,  _U,  _U,  _U,	/* C8..CF */
+	/* 320..327 */	_U,  _U,  _U,  _U,  _U,  _U,  _U,  _U,	/* D0..D7 */
+	/* 330..337 */	_U,  _U,  _U,  _P,  _P,  _P,  _P,  _P,	/* D8..DF */
+	/* 340..347 */	_P,  _LX, _LX, _LX, _LX, _LX, _LX, _L,	/* E0..E7 */
+	/* 350..357 */	_L,  _L,  _L,  _L,  _L,  _L,  _L,  _L,	/* E8..EF */
+	/* 360..367 */	_L,  _L,  _L,  _L,  _L,  _L,  _L,  _L,	/* F0..F7 */
+	/* 370..377 */	_L,  _L,  _L,  _P,  _P,  _P,  _P,  _C	/* F8..FF */
+};
+
Index: lib700/finalone.s
===================================================================
--- lib700/finalone.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/finalone.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,30 @@
+* ------------------------------------------------------------------------------
+* finalone.s -- the last stuff to get loaded
+* Version 4 -- 1987-06-30 -- D.N. Lynx Crowe
+*
+* This is so we can figure out where things got loaded.
+* ------------------------------------------------------------------------------
+*
+		.text
+*
+		.xdef	FinalOne
+		.xdef	The_Fini
+		.xdef	Text_End
+*
+*
+* This is the last piece of code in the 'text' segment.
+*
+FinalOne:	rts			* we just need the address here
+*
+Text_End:	rts			* we just need the address here
+*
+* ------------------------------------------------------------------------------
+*
+		.data
+		.even
+*
+The_Fini:	dc.w	$FFFF		* last thing in the 'data' segment
+*
+* ------------------------------------------------------------------------------
+*
+		.end
Index: lib700/ispow2.c
===================================================================
--- lib700/ispow2.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/ispow2.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,38 @@
+/*
+   =============================================================================
+	ispow2.c -- fast test to see if X is a power of 2
+	Version 2 -- 1989-01-24 -- D.N. Lynx Crowe
+
+	Returns:
+
+		TRUE if X is a power of 2,
+		FALSE otherwise.
+   =============================================================================
+*/
+
+#include "stddefs.h"
+
+short
+ispow2(x)
+register long x;
+{
+	register short i;
+	register long k;
+
+	k = 0x00000001L;		/* setup the bit mask in k */
+
+	for (i = 32; i--; ) {		/* check each bit in x ... */
+
+		if ((x & k) NE 0L) {	/* ... for the 1st 1 and ... */
+
+			if ((x & ~k) NE 0L)	/* ... if there are others ... */
+				return(FALSE);	/* ... it's not a power of 2 */
+			else			/* ... otherwise .. */
+				return(TRUE);	/* ... it is a power of 2 */
+		}
+
+		k = k << 1;		/* examine the next position */
+	}
+
+	return(FALSE);			/* no bits on isn't a power of 2 */
+}
Index: lib700/jumpto.s
===================================================================
--- lib700/jumpto.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/jumpto.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,63 @@
+* ------------------------------------------------------------------------------
+* jumpto.s -- miscellaneous ROMP support functions
+* Version 4 -- 1987-10-14 -- D.N. Lynx Crowe
+*
+*	WARNING:
+*	--------
+*		These functions, in general, assume supervisor mode and
+*		'sane' arguments, so no error checking is done.
+*
+*	halt()
+*
+*		Brings the processor to a grinding halt.  Requires external
+*		reset to restart things.  Use only for catastrophic hard halts.
+*
+*	jumpto(addr)
+*	long addr;
+*
+*		Jumps to 'addr'.  No error check is done on 'addr'.
+*
+*	rjumpto(addr)
+*	long addr;
+*
+*		Performs the 68000 'RESET' command, then jumps to 'addr'.
+*		No error check is made on 'addr'.
+*
+*	sjumpto(addr, stack)
+*	long addr, stack;
+*
+*		Sets a7 to 'stack', then jumps to 'addr'.
+*		No error check is done on 'addr'.
+*
+*	xreset()
+*
+*		Performs the 68000 'RESET' command.  This is very dangerous,
+*		and should be used with extreme care regarding such
+*		things as interrupts, device initialization, vectors,
+*		and sundry other reset-related things.
+*
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_halt,_jumpto,_rjumpto,_sjumpto,_xreset
+*
+		.page
+*
+_halt:		stop	#$2700			* stop dead, interrupts disabled
+		jmp	_halt			* stay stopped if stepped thru
+*
+_jumpto:	movea.l	4(a7),a0		* get jump address
+		jmp	(a0)			* go to the jump address
+*
+_rjumpto:	reset				* reset external devices
+		movea.l	4(a7),a0		* get jump address
+		jmp	(a0)			* go to the jump address
+*
+_sjumpto:	movea.l	4(a7),a0		* get jump address
+		movea.l	8(a7),a7		* set stack pointer
+		jmp	(a0)			* go to the jump address
+*
+_xreset:	reset				* reset external devices
+		rts				* return to caller
+*
+		.end
Index: lib700/ldiv.s
===================================================================
--- lib700/ldiv.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/ldiv.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,101 @@
+* ------------------------------------------------------------------------------
+* ldiv.s -- long division
+* Version 1 -- 1988-01-22
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_ldiv
+		.xdef	ldiv
+*
+		.xdef	_ldivr
+*
+ARG1		.equ	8
+ARG2		.equ	12
+*
+_ldiv:
+ldiv:		link	a6,#-2
+		movem.l	d2-d7,-(a7)
+		clr.w	d3
+		clr.l	d5
+		move.l	ARG1(a6),d7
+		move.l	ARG2(a6),d6
+		bne	ldiv1
+*
+		move.l	#$80000000,_ldivr
+		move.l	#$80000000,d0
+		divs	#0,d0
+		bra	ldiv11
+*
+ldiv1:		bge	ldiv2
+*
+		neg.l	d6
+		addq.w	#1,d3
+*
+ldiv2:		tst.l	d7
+		bge	ldiv3
+*
+		neg.l	d7
+		addq.w	#1,d3
+*
+ldiv3:		cmp.l	d7,d6
+		bgt	ldiv9
+*
+		bne	ldiv4
+*
+		moveq.l	#1,d5
+		clr.l	d7
+		bra	ldiv9
+*
+ldiv4:		cmp.l	#$10000,d7
+		bge	ldiv5
+*
+		divu	d6,d7
+		move.w	d7,d5
+		swap	d7
+		ext.l	d7
+		bra	ldiv9
+*
+ldiv5:		moveq.l	#1,d4
+*
+ldiv6:		cmp.l	d6,d7
+		bcs	ldiv7
+*
+		asl.l	#1,d6
+		asl.l	#1,d7
+		bra	ldiv6
+*
+ldiv7:		tst.l	d4
+		beq	ldiv9
+*
+		cmp.l	d6,d7
+		bcs	ldiv8
+*
+		or.l	d4,d5
+		sub.l	d6,d7
+*
+ldiv8:		lsr.l	#1,d4
+		lsr.l	#1,d6
+		bra	ldiv7
+*
+ldiv9:		cmp.w	#1,d3
+		bne	ldiv10
+*
+		neg.l	d7
+		move.l	d7,_ldivr
+		move.l	d5,d0
+		neg.l	d0
+		bra	ldiv11
+*
+ldiv10:		move.l	d7,_ldivr
+		move.l	d5,d0
+*
+ldiv11:		tst.l	(a7)+
+		movem.l	(a7)+,d3-d7
+		unlk	a6
+		rts
+*
+		.bss
+*
+_ldivr:		.ds.l	1
+*
+		.end
Index: lib700/lmul.s
===================================================================
--- lib700/lmul.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/lmul.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,47 @@
+* ------------------------------------------------------------------------------
+* lmul.s -- long multiply
+* Version 2 -- 1989-07-18
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	lmul
+*
+ARG1		.equ	8
+ARG2		.equ	12
+*
+TEMP		.equ	-4
+*
+lmul:		link	a6,#-4
+		clr.w	d2
+		tst.l	ARG1(a6)
+		bge	lmul1
+*
+		neg.l	ARG1(a6)
+		addq.w	#1,d2
+*
+lmul1:		tst.l	ARG2(a6)
+		bge	lmul2
+*
+		neg.l	ARG2(a6)
+		addq.w	#1,d2
+*
+lmul2:		move.w	ARG1+2(a6),d0
+		mulu	ARG2+2(a6),d0
+		move.l	d0,TEMP(a6)
+		move.w	ARG1(a6),d0
+		mulu	ARG2+2(a6),d0
+		move.w	ARG2(a6),d1
+		mulu	ARG1+2(a6),d1
+		add.w	d1,d0
+		add.w	TEMP(a6),d0
+		move.w	d0,TEMP(A6)
+		move.l	TEMP(a6),d0
+		btst	#0,d2
+		beq	lmul3
+*
+		neg.l	d0
+*
+lmul3:		unlk	a6
+		rts
+*
+		.end
Index: lib700/lrem.s
===================================================================
--- lib700/lrem.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/lrem.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,26 @@
+* ------------------------------------------------------------------------------
+* lrem.s -- long modulo
+* Version 1 -- 1988-01-22
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_lrem
+		.xdef	lrem
+*
+		.xref	ldiv
+		.xref	_ldivr
+*
+ARG1		.equ	8
+ARG2		.equ	12
+*
+_lrem:
+lrem:		link	a6,#-2
+		move.l	ARG2(a6),-(a7)
+		move.l	ARG1(a6),-(a7)
+		jsr	ldiv
+		cmpm.l	(a7)+,(a7)+
+		move.l	_ldivr,d0
+		unlk	a6
+		rts
+*
+		.end
Index: lib700/mangle.c
===================================================================
--- lib700/mangle.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/mangle.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,44 @@
+/*
+   =============================================================================
+	mangle.c -- mangle a bit stream
+	Version 2 -- 1987-08-28 -- D.N. Lynx Crowe
+	(c) Copyright 1987 - D.N. Lynx Crowe
+   =============================================================================
+*/
+
+/*
+   =============================================================================
+	mangle(bitmap, nb, ib) -- reorder the 'nb' least significant bits
+	in 'ib' according to 'bitmap'.  Assumes that 'bitmap' is at least 'nb'
+	words long, and that nb <= 32.  The 'bitmap' translation table contains
+	an output word for each bit in the input word, with each 'bitmap' entry
+	corresponding to the bit number matching its index.  For example,
+	'bitmap[0]' contains the word which will be 'OR'ed into the output if
+	the least significant bit of the input word is set, while 'bitmap[31]'
+	corresponds to the most significant bit of the input word.
+   =============================================================================
+*/
+
+long
+mangle(bitmap, nb, ib)
+register long *bitmap;		/* bit map table pointer */
+register short nb;		/* number of least significant input bits */
+register long ib;		/* input data (in nb least significant bits) */
+{
+	register long	bm;			/* scan mask */
+	register long	rv;			/* result value */
+	register short	bn;			/* bit number (bitmap index) */
+
+	bm = 0x00000001L;			/* setup scan mask */
+	rv = 0x00000000L;			/* clear the output word */
+
+	for (bn = 0; bn < nb; bn++) {		/* scan across nb bits */
+
+		if (ib & bm)			/* if the input bit is 1 */
+			rv |= bitmap[bn];	/* 'OR' the bitmap into rv */
+
+		bm <<= 1;			/* shift the scan mask left */
+	}
+
+	return(rv);				/* return rv as the result */
+}
Index: lib700/micons.c
===================================================================
--- lib700/micons.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/micons.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,102 @@
+/*
+   =============================================================================
+	micons.c -- motorola / intel format conversion functions
+	Version 3 -- 1987-06-11 -- D.N. Lynx Crowe
+
+	short
+	micons(wi)
+	short wi;
+
+		Convert between motorola and intel format for a short.
+
+	int
+	miconi(wi)
+	int wi;
+
+		Convert between motorola and intel format for an int.
+
+	long
+	miconl(wi)
+	long wi;
+
+		Convert between motorola and intel format for a long.
+   =============================================================================
+*/
+
+#define	TESTER	0	/* define non-zero for a test program */
+
+/* 
+ */
+
+/*
+   =============================================================================
+	micons(wi) -- Convert between motorola and intel format for a short.
+   =============================================================================
+*/
+
+short
+micons(wi)
+short wi;
+{
+	return((short)( ((wi << 8) & 0xFF00) | ((wi >> 8) & 0x00FF) ) );
+}
+
+/*
+   =============================================================================
+	miconi(wi) -- Convert between motorola and intel format for an int.
+   =============================================================================
+*/
+
+int
+miconi(wi)
+int wi;
+{
+	if (sizeof (int) == 4)
+		return( ((wi << 24) & 0xFF000000L) | ((wi << 8) & 0x00FF0000L) |
+			((wi >> 8) & 0x0000FF00L) | ((wi >> 24) & 0x000000FFL) );
+	else
+		return(((wi << 8) & 0xFF00) | ((wi >> 8) & 0x00FF));
+}
+
+/*
+   =============================================================================
+	miconl(wi) -- Convert between motorola and intel format for a long.
+   =============================================================================
+*/
+
+long
+miconl(wi)
+long wi;
+{
+	return( ((wi << 24) & 0xFF000000L) | ((wi << 8) & 0x00FF0000L) |
+		((wi >> 8) & 0x0000FF00L) | ((wi >> 24) & 0x000000FFL) );
+}
+
+/* 
+ */
+
+#if	TESTER
+
+#include "stdio.h"
+
+/*
+   =============================================================================
+	test program for micon functions
+   =============================================================================
+*/
+
+main()
+{
+	printf("micons(0x1234) returned 0x%04x\n", micons(0x1234));
+
+	if (sizeof (int) == 4)
+		printf("miconi(0x1234) returned 0x%04x\n", miconi(0x1234));
+	else
+		printf("miconi(0x12345678L) returned 0x%08lx\n",
+			miconi(0x12345678L));
+
+	printf("miconl(0x12345678L) returned 0x%08lx\n",
+		miconl(0x12345678L));
+}
+
+#endif
Index: lib700/rand24.s
===================================================================
--- lib700/rand24.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/rand24.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,118 @@
+* ------------------------------------------------------------------------------
+* rand24.s -- generate a 24 bit random number
+* Version 3 -- 1988-04-29 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+* Synopsis:
+*		long
+*		rand24()
+*
+* Based on:
+*		Knuth, Donald E.
+*		The Art of Computer Programming,
+*		Volume 2: Semi-Numerical Algorithms
+*
+* Computes:
+*		S = [S * C] + K
+*
+* Where:
+*		K = 1
+*		C = 3141592621
+*		S = the seed  (if zero, it gets set from the 200 Hz clock)
+*
+* Returns:
+*		S >> 8  (a 24 bit pseudo-random number)
+*
+* Note:  this function has an LSB with an exactly 50% distribution,  so using
+* individual bits is probably not a good idea.  Using more bits makes things
+* appear more random.
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_rand24
+*
+		.xdef	_rseed
+*
+* equates for things in the BIOS
+*
+RCLOCK		.equ	$49E			* LONG - 200 Hz clock
+*
+* equates for stack offsets
+*
+ARG1		.equ	8			* LONG / WORD - arg1 / MS bits
+ARG1L		.equ	10			* WORD - arg1 LS bits
+ARG2		.equ	12			* LONG / WORD - arg2 / MS bits
+ARG2L		.equ	14			* WORD - arg2 LS bits
+*
+PART		.equ	-4			* LONG - partial product
+*
+PI		.equ	$BB40E62D		* LONG - PI as a hex value
+*
+		.page
+*
+* mult32 -- 32 bit signed multiply
+* ------    ----------------------
+mult32:		link	a6,#-4			* link stack frames
+		clr.w	d2			* clear sign flags
+		tst.l	ARG1(a6)		* check sign of 1st argument
+		bge	mult32a			* ...
+*
+		neg.l	ARG1(a6)		* make 1st argument positive
+		addq.w	#1,d2			* log its sign as negative
+*
+mult32a:	tst.l	ARG2(a6)		* check sign of 2nd argument
+		bge	mult32b			* ...
+*
+		neg.l	ARG2(a6)		* make 2nd argument positive
+		addq.w	#1,d2			* log its sign as negative
+*
+mult32b:	move.w	ARG1L(a6),d0		* generate 1st partial product
+		mulu	ARG2L(a6),d0		* ...
+		move.l	d0,PART(a6)		* ...
+		move.w	ARG1(a6),d0		* generate 2nd partial product
+		mulu	ARG2L(a6),d0		* ...
+		move.w	ARG2(a6),d1		* generate 3rd partial product
+		mulu	ARG1L(a6),d1		* ...
+		add.w	d1,d0			* add partial products
+		add.w	PART(a6),d0		* ...
+		move.w	d0,PART(a6)		* ...
+		move.l	PART(a6),d0		* ...
+		btst	#0,d2			* adjust sign of result
+		beq	mult32c			* ...
+*
+		neg.l	d0			* ...
+*
+mult32c:	unlk	a6			* unlink stack frames
+		rts				* return
+*
+		.page
+*
+* _rand24 -- Generate a random number
+* -------    ------------------------
+_rand24:	link	a6,#0			* Link stack frames
+		tst.l	_rseed			* See if the seed is zero
+		bne	rand01			* Jump if not
+*
+		move.l	RCLOCK,d0		* Pick up the 200 Hz clock
+		moveq.l	#16,d1			* Shift it left
+		asl.l	d1,d0			* ...
+		or.l	RCLOCK,d0		* OR in current 200 Hz clock
+		move.l	d0,_rseed		* Use that as the seed
+*
+rand01:		move.l	#PI,-(a7)		* Put PI on the stack
+		move.l	_rseed,-(a7)		* ... and _rseed, too
+		bsr	mult32			* Multiply them
+		addq.l	#8,a7			* Cleanup stack
+		addq.l	#1,d0			* Add 1 to the result
+		move.l	d0,_rseed		* Save as new seed
+		asr.l	#8,d0			* Make it a 24 bit number
+		and.l	#$00FFFFFF,d0		* ...
+		unlk	a6			* Unlink stack frames
+		rts				* Return to caller
+*
+* ------------------------------------------------------------------------------
+		.bss
+* ------------------------------------------------------------------------------
+*
+_rseed:		.ds.l	1			* random number seed
+*
+		.end
Index: lib700/setjmp.s
===================================================================
--- lib700/setjmp.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/setjmp.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,26 @@
+* ------------------------------------------------------------------------------
+* setjmp.s -- Unix(tm) compatible setjmp(env) and longjmp(env,ret)
+* Version 3 -- 1987-06-16 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+*
+		.text
+*
+		.xdef	_setjmp,_longjmp
+*
+_setjmp:	movea.l	4(a7),a0		* Get env pointer
+		move.l	(a7),(a0)		* Put return address in env
+		movem.l	d1-d7/a1-a7,4(a0)	* Save registers in env
+		moveq.l	#0,d0			* Set return value to 0
+		rts				* Return to caller
+*
+_longjmp:	move.w	8(a7),d0		* Get ret value
+		bne	lj1			* Jump if non-zero
+*
+		moveq.l	#1,d0			* Force return value to 1
+*
+lj1:		movea.l	4(a7),a0		* Get env pointer
+		movem.l	4(a0),d1-d7/a1-a7	* Restore registers from env
+		move.l	(a0),(a7)		* Get return address from env
+		rts				* Return to caller
+*
+		.end
Index: lib700/tolower.c
===================================================================
--- lib700/tolower.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/tolower.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,36 @@
+/*
+   ============================================================================
+	tolower.c -- convert character to lower case ASCII
+	Version 1 -- 1987-09-11 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+#include "ctype.h"
+
+/*
+   ============================================================================
+	tolower(c) -- convert c to lower case ASCII
+   ============================================================================
+*/
+
+int
+tolower(c)
+int c;
+{
+	int	x;
+
+	if (isascii(c)) {
+
+		if (isupper(c))
+			x = _tolower(c);
+		else
+			x = c;
+
+	} else {
+
+		x = c;
+	}
+
+	return(x);
+}
+
Index: lib700/toupper.c
===================================================================
--- lib700/toupper.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/toupper.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,34 @@
+/*
+   ============================================================================
+	toupper.c -- convert character to upper case ASCII
+	Version 1 -- 1987-06-11 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+#include "ctype.h"
+
+/*
+   ============================================================================
+	toupper(c) -- convert c to upper case ASCII
+   ============================================================================
+*/
+
+int
+toupper(c)
+int c;
+{
+	int	x;
+
+	if (isascii(c)) {
+
+		if (islower(c))
+			x = _toupper(c);
+		else
+			x = c;
+	} else {
+
+		x = c;
+	}
+
+	return(x);
+}
Index: lib700/uldiv.s
===================================================================
--- lib700/uldiv.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ lib700/uldiv.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,96 @@
+* ------------------------------------------------------------------------------
+* uldiv.s -- unsigned long division, with remainder
+* Version 2 -- 1987-06-08 -- D.N. Lynx Crowe
+* Lifted from the Alcyon C library by disassembly so I could fix a bug -
+*	_uldivr must be in the bss segment so the code will work in PROM.
+*
+*	long
+*	uldiv(dividnd, divisor)
+*	long dividnd, divisor;
+*
+*	extern long uldivr;
+*
+*		Divides 'dividnd' by 'divisor', treating both as unsigned
+*		long integers.  Returns the quotient and leaves the
+*		remainder in 'uldivr'.  Produces a divide check on division
+*		by zero, with $80000000 returned for both quotient and
+*		remainder.
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_uldiv,_uldivr
+*
+DIVIDEND	.equ	8
+DIVISOR		.equ	12
+*
+_uldiv:		link	a6,#0			* Link stack frames
+		movem.l	d3-d7,-(a7)		* Save registers
+		move.l	DIVIDEND(a6),d7		* d7 = DIVIDEND
+		move.l	DIVISOR(a6),d6		* d6 = DIVISOR
+		tst.l	d6			* Divide by zero ?
+		bne	notdzero		* Jump if not
+*
+		move.l	#$80000000,_uldivr	* Force error result
+		move.l	#$80000000,d0		* ... by dividing
+		divu	#0,d0			* ... by zero
+		bra	ulexit			* ... then exit
+*
+notdzero:	cmp.l	d7,d6			* Divide underflow ?
+		bls	notunflo		* Jump if not
+*
+		move.l	d7,_uldivr		* Remainder = dividend
+		clr.l	d0			* Quotient = 0
+		bra	ulexit			* Exit
+*
+notunflo:	cmp.l	d6,d7			* Is dividend = divisor ?
+		bne	startdiv		* Go start dividing if not
+*
+		moveq.l	#1,d5			* Quotient = 1
+		clr.l	d7			* Remainder = 0
+		bra	setreslt		* Go set result
+*
+		.page
+*
+startdiv:	moveq.l	#1,d4			* Set result bit in d4
+*
+divloop1:	cmp.l	d6,d7			* Divisor aligned OK ?
+		bcs	divloop2		* Jump if so
+*
+		move.l	d6,d0			* Can we align things better ?
+		asl.l	#1,d0			* ...
+		cmp.l	d0,d6			* ...
+		bhi	divloop2		* Jump if not
+*
+		asl.l	#1,d6			* Shift the divisor
+		asl.l	#1,d4			* Shift the result bit
+		bra	divloop1		* Loop for next bit
+*
+divloop2:	clr.l	d5			* Clear quotient
+*
+divloop3:	tst.l	d4			* More bits to do ?
+		beq	setreslt		* Go set result if not
+*
+		cmp.l	d6,d7			* Can we subtract ?
+		bcs	divloop4		* Jump if not
+*
+		or.l	d4,d5			* Set a bit in the quotient
+		sub.l	d6,d7			* Subtract divisor from dividend
+*
+divloop4:	lsr.l	#1,d4			* Shift the result bit
+		lsr.l	#1,d6			* Shift the divisor
+		bra	divloop3		* Loop for next bit
+*
+setreslt:	move.l	d7,_uldivr		* Store remainder
+		move.l	d5,d0			* Put quotient in d0
+*
+ulexit:		tst.l	(a7)+			* Discard top of stack
+		movem.l	(a7)+,d4-d7		* Restore registers
+		unlk	a6			* Unlink stack frames
+		rts				* Return to caller
+*
+		.bss
+		.even
+*
+_uldivr:	ds.l	1
+*
+		.end
Index: libcio/atoi.c
===================================================================
--- libcio/atoi.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/atoi.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,36 @@
+/*
+   =============================================================================
+	atoi.c -- ascii to integer conversion
+	Version 4 -- 1987-07-09 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "stddefs.h"
+#include "ctype.h"
+
+int
+atoi(cp)
+register char *cp;
+{
+	register unsigned i;
+	register short sign;
+
+	sign = 0;
+
+	if ( *cp EQ '-' ) {
+
+		++cp;
+		sign = 1;
+
+	} else {
+
+		if (*cp EQ '+')
+			++cp;
+	}
+
+	for (i = 0; isdigit(*cp); )
+		i = i * 10 + (0x7F & *cp++) - '0';
+
+	return(sign ? -i : i);
+}
+
Index: libcio/atol.c
===================================================================
--- libcio/atol.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/atol.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,35 @@
+/*
+   =============================================================================
+	atol.c -- ascii to long conversion
+	Version 3 -- 1987-06-29 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "stddefs.h"
+#include "ctype.h"
+
+long
+atol(cp)
+register char *cp;
+{
+	register long n;
+	register short sign;
+
+	sign = 0;
+
+	if (*cp EQ '-') {
+
+		++cp;
+		sign = 1;
+
+	} else {
+
+		if (*cp EQ '+')
+		++cp;
+	}
+
+	for (n = 0; isdigit(*cp); )
+		n = n * 10 + *cp++ - '0';
+
+	return(sign ? -n : n);
+}
Index: libcio/blkrd.c
===================================================================
--- libcio/blkrd.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/blkrd.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,183 @@
+/*
+   =============================================================================
+	blkrd.c -- read a block of 0..32767 sectors
+	Version 10 -- 1988-01-08 -- D.N. Lynx Crowe
+
+	int
+	blkrd(fcp, buf, ns)
+	struct fcb *fcp;
+	char *buf;
+	int ns;
+
+		Reads 'ns' sectors from file 'fcp' into 'buf'.
+		Returns the number of unread sectors, or 0 if all were read.
+
+	long
+	_secrd(buf, rec)
+	register char *buf;
+	register short rec;
+
+		Reads a logical sector via the track buffer.
+		Functionally equivalent to the BIOS B_RDWR read function
+		with the addition of transparent write-thru track buffering.
+   =============================================================================
+*/
+
+#define	DEBUGIT		0
+
+#include "stddefs.h"
+#include "biosdefs.h"
+#include "errno.h"
+#include "errdefs.h"
+#include "fspars.h"
+
+/* 
+
+*/
+
+#if	DEBUGIT
+extern	short	fsdebug;		/* file system debug switch */
+#endif
+
+extern	int	_nsic();		/* next sector function */
+
+extern	long	_berrno;		/* last file system bios error number */
+
+extern	short	_thefat[];		/* current file allocation table */
+
+extern	struct	bpb	*_thebpb;	/* current bios parameter block */
+
+#if	TBUFFER
+
+/* WARNING:  this ONLY works for 512 byte sectors, 9 sectors per track */
+
+extern	short	_b_tbuf[9][256];	/* the track buffer */
+
+extern	short	_b_trak;		/* current track */
+extern	short	_b_side;		/* current side */
+extern	short	_b_sect;		/* current sector */
+extern	short	_b_tsec;		/* current base sector of current track */
+
+#endif
+
+/* 
+
+*/
+
+#if	TBUFFER
+
+/*
+   =============================================================================
+	_secrd(buf, rec) -- read a logical sector via the track buffer
+   =============================================================================
+*/
+
+long
+_secrd(buf, rec)
+register char *buf;
+register short rec;
+{
+	register short	track, side, sector;
+	long brc;
+
+	if (_thebpb->dspt NE 9)			/* make sure we can do this */
+		return(ERR07);
+
+	if (_thebpb->recsiz NE 512)
+		return(ERR07);
+
+	track = rec / _thebpb->dspc;		/* desired track */
+	_b_tsec = track * _thebpb->dspc;	/* base sector of track */
+	sector = rec - _b_tsec;			/* logical sector in cylinder */
+
+	if (sector GE _thebpb->dspt) {		/* adjust sector and side */
+
+		sector -= _thebpb->dspt;	/* sector now in track */
+		side = 1;
+		_b_tsec += _thebpb->dspt;
+
+	} else {
+
+		side = 0;
+	}
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("_secrd($%08.8LX, %d):  track=%d, side=%d, sector=%d, _b_tsec=%d\n",
+			buf, rec, track, side, sector, _b_tsec);
+#endif
+
+	if ((track NE _b_trak) OR (side NE _b_side)) {	/* track in buffer ? */
+
+		if (brc = BIOS(B_RDWR, 0, &_b_tbuf, _thebpb->dspt, _b_tsec, 0)) {
+
+			_b_trak = -1;
+			_b_side = -1;
+			return(brc);
+		}
+
+		_b_trak = track;
+		_b_side = side;
+	}
+
+	memcpy(buf, (char *)_b_tbuf[sector], 512);
+	return(0L);
+}
+
+#endif
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	blkrd(fcp, buf, ns) -- read 'ns' sectors from file 'fcp' into 'buf'.
+	Returns the number of unread sectors, or 0 if all were read.
+   =============================================================================
+*/
+
+int
+blkrd(fcp, buf, ns)
+register struct fcb *fcp;
+register char *buf;
+register int ns;
+{
+	register long	brc;		/* bios return code */
+	register int	rb;		/* _nsic return code */
+
+	if (ns < 0)		/* can't read a negative number of sectors */
+		return(ns);
+
+	while (ns--) {		/* read a sector at a time */
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("_blkrd():  ns=%d, buf=$%08.8lX, curlsn=%ld, curdsn=%ld, offset=%u\n",
+			ns, buf, fcp->curlsn, fcp->curdsn, fcp->offset);
+#endif
+
+#if	TBUFFER
+		if (brc = _secrd(buf, (short)fcp->curdsn)) {
+#else
+		if (brc = BIOS(B_RDWR, 0, buf, 1, (short)fcp->curdsn, 0)) {
+#endif
+
+			_berrno = brc;		/* log the error */
+			errno = EIO;
+			return(ns);		/* return unread sector count */
+		}
+
+		if (rb = _nsic(fcp, _thebpb, _thefat)) {  /* find next sector */
+
+			if (rb EQ -1)		/* see if we had an error */
+				errno = EIO;	/* set error number */
+
+			return(ns);	/* return unread sector count */
+		}
+
+		buf += _thebpb->recsiz;		/* advance buffer pointer */
+	}
+
+	return(0);	/* return -- all sectors read */
+}
Index: libcio/blkwr.c
===================================================================
--- libcio/blkwr.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/blkwr.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,281 @@
+/*
+   =============================================================================
+	blkwr.c -- write a block of 0..32767 sectors
+	Version 14 -- 1987-12-15 -- D.N. Lynx Crowe
+
+	int
+	blkwr(fcp, buf, ns)
+	struct fcb *fcp;
+	char *buf;
+	int ns;
+
+		Writes 'ns' sectors from file 'fcp' into 'buf'.
+		Returns the number of unwritten sectors,
+		or 0 if all were written.
+   =============================================================================
+*/
+
+#define	DEBUGIT		0
+
+#include "stddefs.h"
+#include "biosdefs.h"
+#include "errno.h"
+#include "errdefs.h"
+#include "fspars.h"
+
+extern	int	_nsic(), _alcnew(), _newcls();
+
+extern	long	_berrno;		/* last file system bios error number */
+
+extern	struct	bpb	*_thebpb;	/* current bios parameter block */
+
+extern	short	_thefat[];		/* current file allocation table */
+
+extern	short	_fatmod;		/* FAT modified flag */
+
+#if DEBUGIT
+extern	short	fsdebug;
+#endif
+
+#if	TBUFFER
+
+/* WARNING:  this ONLY works for 512 byte sectors, 9 sectors per track */
+
+extern	short	_b_tbuf[9][256];	/* the track buffer */
+
+extern	short	_b_trak;		/* current track */
+extern	short	_b_side;		/* current side */
+extern	short	_b_sect;		/* current sector */
+extern	short	_b_tsec;		/* base sector for current track */
+
+#endif
+
+/* 
+
+*/
+
+#if	TBUFFER
+
+/*
+   =============================================================================
+	_secwr(buf, rec) -- write a logical sector into the track buffer
+   =============================================================================
+*/
+
+long
+_secwr(buf, rec)
+register char *buf;
+register short rec;
+{
+	register short	track, side, sector;
+
+	if (_thebpb->dspt NE 9)			/* make sure we can do this */
+		return(ERR07);
+
+	if (_thebpb->recsiz NE 512)
+		return(ERR07);
+
+	track = rec / _thebpb->dspc;		/* desired track */
+	sector = rec - (track * _thebpb->dspc);	/* logical sector */
+
+	if (sector GE _thebpb->dspt) {		/* adjust sector and side */
+
+		sector -= _thebpb->dspt;
+		side = 1;
+
+	} else {
+
+		side = 0;
+	}
+
+#if	DEBUGIT
+	if (fsdebug) {
+
+		printf("_secwr($%08.8LX, %d):  track=%d, side=%d, sector=%d\n",
+			buf, rec, track, side, sector);
+		printf("_secwr():  _b_trak=%d, _b_side=%d, _b_sect=%d, _b_tsec=%d\n",
+			_b_trak, _b_side, _b_sect, _b_tsec);
+	}
+#endif
+
+	if ((track NE _b_trak) OR (side NE _b_side))	/* track in buffer ? */
+		return(0L);
+
+	memcpy((char *)_b_tbuf[sector], buf, 512);	/* update the buffer */
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("_secwr():  updated track buffer\n");
+#endif
+
+	return(0L);
+}
+
+#endif
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	blkwr(fcp, buf, ns) -- write 'ns' sectors from file 'fcp' into 'buf'.
+	Returns the number of unwritten sectors, or 0 if all were written.
+   =============================================================================
+*/
+
+int
+blkwr(fcp, buf, ns)
+struct fcb *fcp;
+char *buf;
+int ns;
+{
+	long	rc;
+	short	clustr;
+
+	while (ns > 0) {		/* write a sector at a time */
+
+		if (fcp->asects) {
+
+			if (fcp->curlsn LT fcp->asects) {
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("blkwr():  [1] ns=%d, curlsn=%ld, curdsn=%ld, curcls=%u, buf=$%08lX\n",
+			ns, fcp->curlsn, fcp->curdsn, fcp->curcls, buf);
+#endif
+
+				if (rc = BIOS(B_RDWR, 1, buf, 1, (short)fcp->curdsn, 0)) {
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("blkwr():  B_RDWR failed, rc=%ld\n", rc);
+#endif
+
+					_berrno = rc;	/* log the error */
+					errno = EIO;
+					return(ns);	/* return unwritten sector count */
+				}
+
+#if	TBUFFER
+				_secwr(buf, (short)fcp->curdsn);
+#endif
+
+				rc = _nsic(fcp, _thebpb, _thefat);
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("blkwr():  _nsic() rc=%ld\n", rc);
+#endif
+
+				if (--ns EQ 0)		/* done if no more to do */
+					return(0);
+
+				if (rc < 0) {		/* bad cluster ? */
+
+					errno = EIO;	/* set error number */
+					return(ns);	/* return unwritten sector count */
+				}
+
+				buf += _thebpb->recsiz;
+/* 
+
+*/
+			} else if (fcp->curlsn EQ fcp->asects) {
+
+				if (_alcnew(fcp)) {	/* allocate a cluster */
+
+					errno = EIO;	/* set error number */
+					return(ns);	/* return unwritten sector count */
+				}
+
+				fcp->modefl &= ~FC_EOF;	/* clear EOF flag */
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("blkwr():  [2] ns=%d, curlsn=%ld, curdsn=%ld, curcls=%u, buf=$%08lX\n",
+			ns, fcp->curlsn, fcp->curdsn, fcp->curcls, buf);
+#endif
+
+				if (rc = BIOS(B_RDWR, 1, buf, 1, (short)fcp->curdsn, 0)) {
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("blkwr():  B_RDWR failed, rc=%ld\n", rc);
+#endif
+
+					_berrno = rc;	/* log the error */
+					errno = EIO;
+					return(ns);	/* return unwritten sector count */
+				}
+
+#if	TBUFFER
+				_secwr(buf, (short)fcp->curdsn);
+#endif
+
+				++fcp->curlsn;
+				++fcp->clsec;
+				++fcp->curdsn;
+
+				if (--ns EQ 0)
+					return(0);
+
+				buf += _thebpb->recsiz;	/* advance buffer pointer */
+			}
+/* 
+
+*/
+		} else {
+
+			if (0 EQ (clustr = _newcls())) {
+
+				errno = EIO;
+				return(ns);
+			}
+
+			fcp->de.bclust = micons(clustr);
+			_ptcl12(_thefat, clustr, 0x0FF8);
+			_fatmod = TRUE;
+			fcp->curdsn = _cl2lsn(_thebpb, clustr);
+			fcp->curcls = clustr;
+			fcp->clsec = 0;
+			fcp->asects = _thebpb->clsiz;
+			fcp->modefl &= ~FC_EOF;
+
+			fcp->modefl &= ~FC_EOF;	/* clear EOF flag */
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("blkwr():  [3] ns=%d, curlsn=%ld, curdsn=%ld, curcls=%u, buf=$%08lX\n",
+			ns, fcp->curlsn, fcp->curdsn, fcp->curcls, buf);
+#endif
+
+			if (rc = BIOS(B_RDWR, 1, buf, 1, (short)fcp->curdsn, 0)) {
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("blkwr():  B_RDWR failed, rc=%ld\n", rc);
+#endif
+
+				_berrno = rc;	/* log the error */
+				errno = EIO;
+				return(ns);	/* return unwritten sector count */
+			}
+
+#if	TBUFFER
+			_secwr(buf, (short)fcp->curdsn);
+#endif
+
+			++fcp->curlsn;
+			++fcp->clsec;
+			++fcp->curdsn;
+
+			if (--ns EQ 0)
+				return(0);
+
+			buf += _thebpb->recsiz;	/* advance buffer pointer */
+		}
+	}
+
+	return(ns);	/* return (will be zero or negative) */
+}
Index: libcio/close.c
===================================================================
--- libcio/close.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/close.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,140 @@
+/*
+   =============================================================================
+	close.c -- close a file for the Buchla 700 C I/O Library
+	Version 9 -- 1987-11-13 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "biosdefs.h"
+#include "errno.h"
+#include "fcntl.h"
+#include "io.h"
+#include "stddefs.h"
+
+extern	int	_badfd(), ClsFile(), _clsvol();
+
+extern	int	_fatmod, _dirmod;
+extern	struct	bpb	*_thebpb;
+extern	struct	dirent	_thedir[];
+extern	unsigned	_thefat[];
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_clsfat() -- write out the modified FAT
+   =============================================================================
+*/
+
+_clsfat()
+{
+	/* write the primary FAT to disk */
+
+	BIOS(B_RDWR, 1, _thefat, _thebpb->fsiz,
+		_thebpb->fatrec, 0);
+
+	/* write the secondary FAT to disk */
+
+	BIOS(B_RDWR, 1, _thefat, _thebpb->fsiz,
+		(_thebpb->fatrec - _thebpb->fsiz), 0);
+
+	_fatmod = FALSE;	/* FAT on disk now matches memory */
+}
+
+/*
+   =============================================================================
+	_clsdir() -- write out the modified directory
+   =============================================================================
+*/
+
+_clsdir()
+{
+	/* write the directory to disk */
+
+	BIOS(B_RDWR, 1, _thedir, _thebpb->rdlen,
+		(_thebpb->fatrec + _thebpb->fsiz), 0);
+
+	_dirmod = FALSE;	/* directory on disk now matches memory */
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	close(fd) -- close file 'fd'
+   =============================================================================
+*/
+
+int
+close(fd)
+int fd;
+{
+	register struct channel *chp;
+	register int rc;
+
+	if ((fd < 0) OR (fd > MAXCHAN)) {
+
+		errno = EBADF;
+		return(FAILURE);
+	}
+
+	chp = &chantab[fd];			/* point at the channel */
+
+	rc  = (*chp->c_close)(chp->c_arg);	/* close the FCB */
+
+	chp->c_read  = 0;			/* release the channel */
+	chp->c_write = 0;
+	chp->c_ioctl = 0;
+	chp->c_seek  = 0;
+	chp->c_close = _badfd;
+
+	if (_fatmod)
+		_clsfat();			/* write modified FAT */
+
+	if (_dirmod)
+		_clsdir();			/* write modified directory */
+
+	return(rc);				/* return result of close */
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_filecl(fp) -- close file 'fp' at the BDOS level
+   =============================================================================
+*/
+
+int
+_filecl(fp)
+register struct fcb *fp;
+{
+	register int rc;
+
+	rc = ClsFile(fp);		/* close the FCB */
+	fp->modefl = 0;		/* mark the FILE closed */
+	return(rc);
+}
+
+/*
+   =============================================================================
+	_fd_cls() -- close all open files
+   =============================================================================
+*/
+
+_fd_cls()
+{
+	register int fd;
+
+	for (fd = 0; fd < MAXCHAN; ++fd)
+		if (chantab[fd].c_close NE _badfd)
+			close(fd);
+
+	_clsvol();			/* write modified directory adn FAT */
+}
Index: libcio/clusmap.c
===================================================================
--- libcio/clusmap.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/clusmap.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,413 @@
+/*
+   =============================================================================
+	clusmap.c -- various file structure utilities
+	Version 9 -- 1987-10-29 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "biosdefs.h"
+#include "errno.h"
+#include "io.h"
+#include "stdio.h"
+#include "stddefs.h"
+
+extern	int	micons(), _gtcl12();
+extern	long	miconl();
+
+extern	struct	bpb	*_thebpb;
+extern	short	_thefat[];
+
+extern	int	_filecl(), _noper();
+
+/* 
+
+*/
+
+static char	*mfname[] = {	/* FCB flag names */
+
+	"?D0",	/* D0  - 0001 */
+	"?D1",	/* D1  - 0002 */
+	"?D2",	/* D2  - 0004 */
+	"?D3",	/* D3  - 0008 */
+
+	"BF ",	/* D4  - 0010 */
+	"NB ",	/* D5  - 0020 */
+	"TR ",	/* D6  - 0040 */
+	"EX ",	/* D7  - 0080 */
+
+	"RD ",	/* D8  - 0100 */
+	"WR ",	/* D9  - 0200 */
+	"AP ",	/* D10 - 0400 */
+	"CR ",	/* D11 - 0800 */
+
+	"OPN",	/* D12 - 1000 */
+	"ERR",	/* D13 - 2000 */
+	"BAD",	/* D14 - 4000 */
+	"EOF"	/* D15 - 8000 */
+};
+
+/* 
+
+*/
+
+static	char	*dfname[] = {
+
+	"RDONLY",	/* D0 - 01 */
+	"HIDDEN",	/* D1 - 02 */
+	"SYSTEM",	/* D2 - 04 */
+	"VOLUME",	/* D3 - 08 */
+	"SUBDIR",	/* D4 - 10 */
+	"ARCHIV",	/* D5 - 20 */
+	"??D6??",	/* D6 - 40 */
+	"??D7??"	/* D7 - 80 */
+};
+
+static	char	*ffname[] = {
+
+	"BUSY  ",	/* D0 - 01 */
+	"ALLBUF", 	/* D1 - 02 */
+	"DIRTY ", 	/* D2 - 04 */
+	"EOF   ",	/* D3 - 08 */
+	"IOERR ",	/* D4 - 10 */
+	"??D5??",	/* D5 - 20 */
+	"??D6??",	/* D6 - 40 */
+	"??D7??"	/* D7 - 80 */
+};
+
+/* 
+
+*/
+
+static int
+waitcr()
+{
+	char	c;
+
+	BIOS(B_PUTC, CON_DEV, '\007');
+
+	while ('\r' NE (c = (0x7F & BIOS(B_GETC, CON_DEV))))
+		if (c EQ '\007')
+			xtrap15();
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	ClusMap(fcp) -- print a map of the clusters for the file associated with
+	the FCB pointed to by 'fcp'.  Nothing is printed if the file isn't open.
+	Returns 0 if a map was printed, -1 otherwise.
+   =============================================================================
+*/
+
+int
+ClusMap(fcp)
+struct fcb *fcp;
+{
+	int	clus, nc;
+	long	alsize, bused, bunused;
+
+	if (!(fcp->modefl & FC_OPN)) {
+
+		errno = EINVAL;
+		return(FAILURE);
+	}
+
+	nc = 0;
+	clus = micons(fcp->de.bclust);
+
+	if (clus) {
+
+		printf("Allocated cluster chain for [%-8.8s].[%-3.3s]:\n%6d",
+			fcp->de.fname, fcp->de.fext, clus);
+		nc = 1;	
+
+		while (clus < 0xFF0) {
+
+			clus = _gtcl12(_thefat, clus);
+
+			if (clus < 0xFF0) {
+
+				nc++;
+
+				if (0 EQ (nc-1) % 10)
+					printf("\n");
+
+				printf("%6d", clus);
+			}
+		}
+	}
+
+	alsize = nc * _thebpb->clsizb;
+	bused = fcp->curlen;
+	bunused = alsize - bused;
+
+	printf("\nFAT cluster count=%d, asects=%ld\n", nc, fcp->asects);
+	printf("%ld bytes allocated, %ld bytes used", alsize, bused);
+
+	if (alsize GE bused)
+		printf(", %ld bytes unused", bunused);
+
+	printf("\n");
+
+	if (bused GT alsize)
+		printf("ERROR:  directory file size exceeds FAT allocation\n");
+
+	if (fcp->asects NE nc)
+		printf("ERROR:  FAT cluster count (%d) NE FCB cluster count (%ld)\n",
+			nc, fcp->asects);
+	return(SUCCESS);
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	FCBmode(fcp) -- print FCB mode flags
+   =============================================================================
+*/
+
+struct fcb *
+FCBmode(fcp)
+register struct fcb *fcp;
+{
+	register unsigned short mf;
+	register short i;
+
+	printf("  flags:  ");
+	mf = 0x0001;
+
+	for (i = 0; i < 16; i++) {
+
+		if (fcp->modefl & mf)
+			printf("%s ", mfname[i]);
+
+		mf <<= 1;
+	}
+
+	printf("\n  atrib:  ");
+
+	mf = 0x01;
+
+	for (i = 0; i < 8; i++) {
+
+		if (fcp->de.atrib & mf)
+			printf("%s ", dfname[i]);
+
+		mf <<= 1;
+	}
+
+	printf("\n");
+	return(fcp);
+}
+
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	SnapFCB(fcp) -- print contents of an FCB pointed to by 'fcp'
+   =============================================================================
+*/
+
+struct fcb *
+SnapFCB(fcp)
+register struct fcb *fcp;
+{
+	printf("\nFCB at 0x%08lx:  [%-8.8s].[%-3.3s]\n",
+		fcp, fcp->de.fname, fcp->de.fext);
+	FCBmode(fcp);
+
+	printf("  atrib      0x%04x",	fcp->de.atrib);
+	printf("  modefl     0x%04x\n",	fcp->modefl);
+
+	printf("  crtime     0x%04x",	micons(fcp->de.crtime));
+	printf("  crdate     0x%04x\n",	micons(fcp->de.crdate));
+
+	printf("  asects   %8ld",	fcp->asects);
+	printf("  flen     %8ld",	miconl(fcp->de.flen));
+	printf("  curlen   %8ld\n",	fcp->curlen);
+
+	printf("  bclust   %8d",	micons(fcp->de.bclust));
+	printf("  curcls   %8d",	fcp->curcls);
+	printf("  clsec    %8d\n",	fcp->clsec);
+
+	printf("  curlsn   %8ld",	fcp->curlsn);
+	printf("  curdsn   %8ld",	fcp->curdsn);
+	printf("  offset   %8d\n",	fcp->offset);
+
+	printf("\n");
+	return(fcp);
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	MapFAT() -- print the first 'ncl' cluster entries from 'fat'
+   =============================================================================
+*/
+
+MapFAT(fat, ncl, stops)
+register char *fat;
+short ncl, stops;
+{
+	register int i;
+
+	printf("\nCluster dump of FAT at 0x%08.8lx  (%d entries):\n",
+		fat, ncl);
+	printf("   0: .... .... ");
+
+	for (i = 2; i < ncl; i++) {
+
+		if ((i % 10) EQ 0)
+			printf("\n%4.4d: ", i);
+
+		printf("%4.4d ", _gtcl12(fat, i));
+
+		/* stop every 10 lines if requested */
+
+		if (stops AND (((i / 10) % 10) EQ 0))
+			waitcr();
+	}
+
+	printf("\n");
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	FILEfl() -- print FILE flags
+   =============================================================================
+*/
+
+FILE *
+FILEfl(fp)
+FILE *fp;
+{
+	register unsigned short mf;
+	register short i;
+
+	printf("  _flags:  ");
+	mf = 0x0001;
+
+	for (i = 0; i < 8; i++) {
+
+		if (fp->_flags & mf)
+			printf("%s ", ffname[i]);
+
+		mf <<= 1;
+	}
+
+	printf("\n");
+	return(fp);
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	FILEpr(fp) -- print contents of a FILE structure pointed to by 'fp'
+   =============================================================================
+*/
+
+FILEpr(fp)
+FILE *fp;
+{
+	int	(*arg)(), ft;
+	char	*ds, *fsn, *fse;
+	struct	fcb	*fcp;
+
+	if (fp EQ (FILE *)0L) {
+
+		printf("FILEpr():  ERROR - argument was NULL\n");
+		return;
+	}
+
+
+	printf("\nFILE at $%08.8lX", fp);
+
+	arg = chantab[fp->_unit].c_close;
+	ft = 0;
+
+	if (arg EQ _noper) {
+
+		ds = (struct device *)chantab[fp->_unit].c_arg->d_name;
+		printf(" is a device:  [%s]\n", ds);
+
+	} else if (arg EQ _filecl) {
+
+		ft = 1;
+		fcp = (struct fcb *)chantab[fp->_unit].c_arg;
+		fsn = fcp->de.fname;
+		fse = fcp->de.fext;
+		printf(" is a disk file:  [%8.8s].[%3.3s],  fcb at $%08.8lX\n",
+			fsn, fse, fcp);
+
+	} else {
+
+		printf(" is of UNKNOWN type: c_close=$%08.8lX, c_arg=$%08.8lX\n",
+			arg, chantab[fp->_unit].c_arg);
+	}
+
+	printf("  _buff=$%08.8lX, _bp=$%08.8lX, _bend=$%08.8lX, _buflen=%u\n",
+		fp->_buff, fp->_bp, fp->_bend, fp->_buflen);
+	printf("  _flags=$%04.4X, _unit=%d, _bytbuf=$%02.2X\n",
+		fp->_flags, fp->_unit, fp->_bytbuf);
+
+	FILEfl(fp);
+
+	if (ft)
+		SnapFCB(fcp);
+	else
+		printf("\n");
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	fd2fcb() -- convert a unit number to a pointer to a fcb
+   =============================================================================
+*/
+
+struct fcb *
+fd2fcb(fd)
+short fd;
+{
+	if ((fd < 0) OR (fd > MAXCHAN))
+		return((struct fcb *)NULL);
+
+	return(chantab[fd].c_arg);
+}
+
+/*
+   =============================================================================
+	fp2fcb() -- convert a FILE pointer to a pointer to a fcb
+   =============================================================================
+*/
+
+struct fcb *
+fp2fcb(fp)
+FILE *fp;
+{
+	if (fp EQ (FILE *)NULL)
+		return((struct fcb *)NULL);
+
+	return(chantab[fp->_unit].c_arg);
+}
Index: libcio/conin.c
===================================================================
--- libcio/conin.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/conin.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,56 @@
+/*
+   =============================================================================
+	conin.c -- read from the console
+	Version 6 -- 1987-06-30 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#define	_FS_DEF_		/* to avoid unnecessary externals */
+
+#include "biosdefs.h"
+#include "io.h"
+#include "errno.h"
+#include "fcntl.h"
+#include "stddefs.h"
+
+extern	char	*memcpy();
+extern	int	readbuf(), writeln();
+
+char _ConBuf[258];	/* console input buffer */
+int _CBused;
+
+int
+_conin(x, buff, len)
+char *buff;
+{
+	int 	nbp;
+	register int l;
+
+	if (_ConBuf[1] EQ 0) {
+
+		_ConBuf[0] = 255;
+		_ConBuf[1] = _ConBuf[2] = 0;
+
+		readbuf(CON_DEV, _ConBuf);
+		writeln(CON_DEV, "\r\n");
+
+		if (_ConBuf[2] EQ 0x1a) {
+
+			_ConBuf[1] = 0;
+			return(0);
+		}
+
+		nbp = ++_ConBuf[1];
+		_ConBuf[nbp++ + 1] = '\r';
+		_ConBuf[nbp + 1] = '\n';
+		_CBused = 2;
+	}
+
+	if ((l = _ConBuf[1]) > len)
+		l = len;
+
+	memcpy(buff, (_ConBuf + _CBused), l);
+	_CBused += l;
+	_ConBuf[1] -= l;
+	return (l);
+}
Index: libcio/conwr.c
===================================================================
--- libcio/conwr.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/conwr.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,33 @@
+/*
+   ============================================================================
+	conwr.c -- write on the console
+	Version 4 -- 1987-06-29 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+#define	_FS_DEF_		/* to avoid unnecessary externals */
+
+#include "biosdefs.h"
+#include "io.h"
+#include "errno.h"
+#include "stddefs.h"
+
+/*
+   ============================================================================
+	_conwr(kind, buff, len) -- write 'len' bytes from 'buff' on the console
+	using op 'kind' as the BIOS argument.
+   ============================================================================
+*/
+int
+_conwr(kind, buff, len)
+int kind;
+register char *buff;
+int len;
+{
+	register int count;
+
+	for (count = 0; count < len; ++count)
+		BIOS(B_PUTC, kind, *buff++);
+
+	return(count);
+}
Index: libcio/dirfns.c
===================================================================
--- libcio/dirfns.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/dirfns.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,145 @@
+/*
+   =============================================================================
+	dirfns.c -- miscellaneous directory functions
+	Version 4 -- 1987-06-04 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "stddefs.h"
+#include "biosdefs.h"
+
+extern	int	sprintf();
+
+static char atrcons[] = "ADVSHR";
+
+/*
+   =============================================================================
+	atrstr(atr, s) -- convert attributes to character string
+   =============================================================================
+*/
+
+char *
+atrstr(atr, s)
+register short atr;
+register char s[];
+{
+	register short	i, j;
+
+	i = 0x20;
+
+	for (j = 0; j < 6; j++) {
+
+		if (atr & i)
+			s[j] = atrcons[j];
+		else
+			s[j] = '-';
+
+		i >>= 1;
+	}
+
+	s[j] = '\0';
+	return(s);
+}
+
+/* 
+ */
+
+static char *mnames[] = {
+
+	"???",
+	"Jan",
+	"Feb",
+	"Mar",
+	"Apr",
+	"May",
+	"Jun",
+	"Jul",
+	"Aug",
+	"Sep",
+	"Oct",
+	"Nov",
+	"Dec"
+	};
+
+/*
+   =============================================================================
+	mname - convert month number to month name
+   =============================================================================
+*/
+
+char *
+mname(n)
+short n;
+{
+	return((n < 1 || n > 12) ? mnames[0] : mnames[n]);
+}
+
+/* 
+ */
+
+/*
+   =============================================================================
+	dtunpk(din, tin, s, fmt) -- unpack the date and time from DOS format
+	into "yyyy-mm-dd hh:mm", "yyyy mmm dd hh:mm", or "mmm dd yyyy hh:mm"
+	format.
+   =============================================================================
+*/
+
+char *
+dtunpk(din, tin, s, fmt)
+short din, tin, fmt;
+char *s;
+{
+	register short	ftm, fdt;
+
+	ftm = ((tin << 8) & 0xFF00) | ((tin >> 8) & 0x00FF);
+	fdt = ((din << 8) & 0xFF00) | ((din >> 8) & 0x00FF);
+
+	switch (fmt) {
+
+	case 0:		/* yyyy-mm-dd hh:mm format */
+
+		sprintf(s, "%04d-%02d-%02d %02d:%02d",
+			1980 + ((fdt >> 9) & 0x7F),
+			(fdt >> 5) & 0xF,
+			fdt & 0x1F,
+			(ftm >> 11) & 0x1F,
+			(ftm >> 5) & 0x3F
+			);
+
+		s[16] = '\0';
+		break;
+
+	case 1:		/* yyyy mmm dd hh:mm format */
+	default:
+
+		sprintf(s, "%04d %s %-2d %02d:%02d",
+			1980 + ((fdt >> 9) & 0x7F),
+			mname((fdt >> 5) & 0xF),
+			fdt & 0x1F,
+			(ftm >> 11) & 0x1F,
+			(ftm >> 5) & 0x3F
+			);
+
+		s[17] = '\0';
+		break;
+
+/* 
+ */
+
+	case 2:		/* mmm dd yyyy hh:mm format */
+
+		sprintf(s, "%s %2d %04d %02d:%02d",
+			mname((fdt >> 5) & 0xF),
+			fdt & 0x1F,
+			1980 + ((fdt >> 9) & 0x7F),
+			(ftm >> 11) & 0x1F,
+			(ftm >> 5) & 0x3F
+			);
+
+		s[17] = '\0';
+		break;
+	}
+
+	return(s);
+}
Index: libcio/fgets.c
===================================================================
--- libcio/fgets.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/fgets.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,83 @@
+/*
+   =============================================================================
+	fgets.c -- get a string from an ASCII stream file
+	Version 2 -- 1987-07-09 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "stdio.h"
+#include "stddefs.h"
+
+#define	EATCHAR	'\n'	/* character to be "eaten" on input */
+
+int
+agetc(ptr)
+register FILE *ptr;
+{
+	register int c;
+
+top:
+	if ((c = getc(ptr)) NE EOF) {
+
+		switch (c &= 0x7F) {
+
+		case 0x1a:		/* {x}DOS EOF */
+			--ptr->_bp;
+			return(EOF);
+
+		case EATCHAR:		/* CR or LF */
+		case 0:			/* NUL */
+			goto top;
+		}
+	}
+
+	return(c);
+}
+
+char *
+gets(line)
+char *line;
+{
+	register char *cp;
+	register int i;
+
+	cp = line;
+
+	while ((i = getchar()) NE EOF AND i NE '\n')
+		*cp++ = i;
+
+	*cp = 0;	/* terminate the line */
+
+	if ((i EQ EOF) AND (cp EQ line))
+		return(NULL);
+
+	return(line);
+}
+
+char *
+fgets(s, n, fp)
+char *s;
+int n;
+FILE *fp;
+{
+	register c;
+	register char *cp;
+
+	cp = s;
+
+	while (--n > 0 AND (c = agetc(fp)) NE EOF) {
+
+		*cp++ = c;
+
+		if (c EQ '\n')
+			break;
+	}
+
+	*cp = 0;
+
+	if (c EQ EOF AND cp EQ s)
+		return(NULL);
+
+	return(s);
+}
+
Index: libcio/filesys.c
===================================================================
--- libcio/filesys.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/filesys.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1236 @@
+/*
+   =============================================================================
+	filesys.c -- file system support functions
+	Version 44 -- 1987-11-15 -- D.N. Lynx Crowe
+
+	These functions support a {MS,GEM}DOS|TOS-like file system.
+	Only 12 bit FAT entries are supported.
+	Subdirectories are not supported in this version.
+   =============================================================================
+*/
+
+#define	DEBUGIT		0
+
+#define	_FS_DEF_	/* to avoid unnecessary externals */
+
+#include "stddefs.h"
+#include "biosdefs.h"
+#include "errno.h"
+#include "memory.h"
+#include "io.h"
+#include "fcntl.h"
+
+#define	FAT_EOF		0x0FF8
+
+#define	IO_ERR		-1
+#define	IO_OK		0
+#define	IO_EOF		1
+
+#define	DE_NULL		((struct dirent *)0L)
+
+extern	unsigned micons();
+extern	long	miconl();
+extern	int	_ptcl12();
+extern	char	*FilName(), *FilExt();
+
+#if DEBUGIT
+short	fsdebug;
+extern	int	mdump();
+#endif
+
+struct	bpb	*_thebpb;		/* BIOS parameter block pointer */
+struct	dirent	_thedir[MAXDIRNT];	/* directory */
+struct	dirent	*_dptr;			/* internal directory pointer */
+
+unsigned _thefat[MAXFAT * WDPSEC];	/* file allocation table */
+
+int	_fatin;				/* FAT has been read */
+int	_dirin;				/* directory has been read */
+int	_bpbin;				/* BPB has been read */
+int	_fatmod;			/* FAT modified flag */
+int	_dirmod;			/* directory modified flag */
+
+long	_berrno;			/* BIOS error number */
+
+/* 
+
+*/
+
+
+/*
+   =============================================================================
+	_cl2lsn(bpp, clnum) -- return logical sector number for cluster 'clnum'
+	using BPB pointed to by 'bpp'
+   =============================================================================
+*/
+
+unsigned
+_cl2lsn(bpp, clnum)
+struct bpb *bpp;
+unsigned clnum;
+{
+	return(bpp->datrec + (bpp->clsiz * (clnum - 2)) );
+}
+
+/*
+   =============================================================================
+	_gtcl12(fat, cl) -- return 12 bit cluster entry 'cl' from FAT pointed
+	to by 'fat'
+   =============================================================================
+*/
+
+unsigned
+_gtcl12(fat, cl)
+register char *fat;
+unsigned cl;
+{
+	register unsigned cla, clt;
+
+	cla = cl + (cl >> 1);
+	clt = ((unsigned)0xFF00 & (fat[cla+1] << 8))
+		| ((unsigned)0x00FF & fat[cla]);
+
+	if (cl & 1)
+		clt >>= 4;
+
+	clt &= (unsigned)0x0FFF;
+	return(clt);
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_getfat(bufad, bpp, nfat) -- get FAT 'nfat' into buffer
+	pointed to by 'bufad' using BPB pointed to by 'bpp'
+   =============================================================================
+*/
+
+unsigned
+_getfat(bufad, bpp, nfat)
+unsigned *bufad, nfat;
+register struct bpb *bpp;
+{
+	unsigned fatsec;
+
+	fatsec = nfat ? bpp->fatrec : (bpp->fatrec - bpp->fsiz);
+	return(BIOS(B_RDWR, 0, (char *)bufad, bpp->fsiz, fatsec, 0));
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_rdfat(bufad, bpp) -- read FAT into buffer pointed to by 'bufad'
+	using BPB pointed to by 'bpp'
+   =============================================================================
+*/
+
+int
+_rdfat(bufad, bpp)
+unsigned *bufad;
+struct bpb *bpp;
+{
+	if (_getfat(bufad, bpp, 0)) {
+
+		if (_getfat(bufad, bpp, 1))
+			return(IO_ERR);		/* couldn't read either FAT */
+		else
+			return(1);		/* secondary FAT read OK */
+
+	} else
+		return(0);			/* main FAT read OK */
+}
+
+/*
+   =============================================================================
+	_rdroot(buf, bpp) -- read root directory into buffer
+	pointed to by 'buf' using BPB pointed to by 'bpp'
+   =============================================================================
+*/
+
+int
+_rdroot(buf, bpp)
+unsigned *buf;
+register struct bpb *bpp;
+{
+	return(BIOS(B_RDWR, 0, (char *)buf, bpp->rdlen,
+		(bpp->fatrec + bpp->fsiz), 0));
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_nsic(fcp, bpp, fp) -- get the next sector in the file controlled
+	by the FCB at 'fcp', using the BPB pointed to by 'bpp' and
+	the FAT pointed to by 'fp'.  Returns 0 if successful, or -1 on error,
+	or 1 on EOF;
+   =============================================================================
+*/
+
+int
+_nsic(fcp, bpp, fp)
+register struct fcb *fcp;
+struct bpb *bpp;
+char *fp;
+{
+	register unsigned tfe;
+
+	/* check the FCB flags */
+
+	if (!(fcp->modefl & FC_OPN)) {
+
+		errno = EINVAL;		/* not open */
+		return(IO_ERR);
+	}
+
+	if (fcp->modefl & FC_BAD) {
+
+		errno = EIO;		/* previous I/O error */
+		return(IO_ERR);
+	}
+
+	if (fcp->de.bclust EQ 0) {	/* no sectors allocated  (empty file) */
+
+		fcp->modefl |= FC_EOF;
+		return(IO_EOF);
+	}
+/* 
+
+*/
+	/* update clsec and curlsn and see if we need a new cluster */
+
+	++fcp->curlsn;
+
+	if (++fcp->clsec GE bpp->clsiz) {
+
+		/* new cluster needed -- follow the chain */
+
+		fcp->clsec = 0;
+		tfe = _gtcl12(fp, fcp->curcls);
+
+		if (tfe < 0x0FF0) {	/* see if we've got a good cluster */
+
+
+			fcp->curcls = tfe;	/* good cluster, update fcb */
+			fcp->curdsn = _cl2lsn(bpp, tfe);
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_nsic():  NXT curlsn=%ld, curcls=%u, curdsn=%ld\n",
+			fcp->curlsn, fcp->curcls, fcp->curdsn);
+#endif
+
+			return(IO_OK);
+		}
+
+		if (tfe < 0x0FF8) {	/* see if it's a bad cluster */
+
+			fcp-> modefl |= (FC_BAD | FC_EOF);	/* bad one */
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_nsic():  IO_ERR - curlsn=%ld, curcls=%u, curdsn=%ld\n",
+			fcp->curlsn, fcp->curcls, fcp->curdsn);
+#endif
+
+			return(IO_ERR);
+		}
+
+		fcp->modefl |= FC_EOF;	/* EOF hit -- set EOF in FCB */
+		return(IO_EOF);
+
+/* 
+
+*/
+
+	} else {
+
+		++fcp->curdsn;	/* advance to next sector in current cluster */
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_nsic():  CUR curlsn=%ld, curcls=%u, curdsn=%ld\n",
+			fcp->curlsn, fcp->curcls, fcp->curdsn);
+#endif
+
+		return(IO_OK);
+	}
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_dsrch(de) -- search for the directory entry pointed to by 'de'
+	in the current directory
+   =============================================================================
+*/
+
+struct dirent *
+_dsrch(de)
+register struct dirent *de;
+{
+	unsigned i, dl;
+	register struct dirent *dp;
+
+	dp = _thedir;
+	dl = _thebpb->rdlen * (_thebpb->recsiz / DENTSIZE);
+
+	for (i = 0; i < dl; i++) {		/* check each entry */
+
+		/* see if we've found it */
+
+		if (0 EQ memcmpu(de->fname, dp->fname, 11))
+			return(dp);
+
+		/* check for end of used entries */
+
+		if ('\0' EQ dp->fname[0])
+			return(DE_NULL);
+
+		dp++;	/* point at next entry to check */
+	}
+
+	return(DE_NULL);
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_dsnew() -- search for an available directory entry in the current
+	directory.
+   =============================================================================
+*/
+
+struct dirent *
+_dsnew()
+{
+	unsigned i, dl;
+	register struct dirent *dp;
+
+	dp = _thedir;
+	dl = _thebpb->rdlen * (_thebpb->recsiz / DENTSIZE);
+
+	for (i = 0; i < dl; i++) {		/* check each entry */
+
+		/* check for a deleted entry */
+
+		if (0x00E5 EQ (0x00FF & dp->fname[0]))
+			return(dp);
+
+		/* check for end of used entries */
+
+		if ('\0' EQ dp->fname[0])
+			return(dp);
+
+		dp++;	/* point at next entry to check */
+	}
+
+	return(DE_NULL);	/* couldn't find an available entry */
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_deadio(fcp, err) -- mark the FCB pointed to by 'fcp' as 'in error'
+   =============================================================================
+*/
+
+_deadio(fcp, err)
+register struct fcb *fcp;
+int err;
+{
+	fcp->clsec = 0;
+	fcp->curcls = 0;
+	fcp->curlsn = 0L;
+	fcp->curdsn = 0L;
+	fcp->curlen = 0L;
+	fcp->modefl &= ~FC_OPN;
+	fcp->modefl |= FC_ERR;
+	errno = err;
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_seek(fcp) -- seek to logical sector number in FCB pointed to by 'fcp'.
+	Returns:  -1 = error; 0 = not at EOF; 1 = soft EOF; 2 = hard EOF.
+   =============================================================================
+*/
+
+int
+_seek(fcp)
+register struct fcb *fcp;
+{
+	register unsigned acls, rcls, nc;
+	unsigned sic, spc;
+
+	if (!(fcp->modefl & FC_OPN)) {		/* file must be open */
+
+		errno = EINVAL;			/* invalid request */
+		return(-1);			/* return with an error */
+	}
+
+	if (fcp->curlsn GT fcp->asects) {	/* error if seek past EOF */
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("_seek():  ERROR - seek past EOF - curlsn=%ld, asects=%ld\n",
+			fcp->curlsn, fcp->asects);
+#endif
+
+		errno = EINVAL;			/* invalid request */
+		return(-1);			/* return with an error */
+	}
+		
+	spc = _thebpb->clsiz;			/* get sectors per cluster */
+	rcls = fcp->curlsn / spc;		/* calculate relative cluster */
+	sic = fcp->curlsn - (rcls * spc);	/* calculate sector in cluster */
+	acls = micons(fcp->de.bclust);		/* get first cluster */
+	fcp->modefl &= ~FC_EOF;			/* turn off the EOF flag */
+
+/* 
+
+*/
+
+#if DEBUGIT
+	if (fsdebug) {
+		printf("_seek():  ENTRY curlsn=%ld, acls=%u, sic=%d, curdsn=%ld, rcls=%u, asects=%ld\n",
+			fcp->curlsn, acls, sic, fcp->curdsn, rcls, fcp->asects);
+	}
+#endif
+
+	if (fcp->curlsn EQ fcp->asects) {	/* see if we seeked to EOF */
+
+		fcp->modefl |= FC_EOF;		/* flag the EOF condition */
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_seek():  EOF curlsn=%ld, acls=%u, sic=%d, curdsn=%ld\n",
+			fcp->curlsn, acls, sic, fcp->curdsn);
+#endif
+
+		if (acls EQ 0)			/* see if anything allocated */
+			return(2);		/* hard EOF if nothing there */
+
+		if (sic EQ 0)			/* see if first in cluster */
+			return(2);		/* hard EOF if so */
+	}
+
+/* 
+
+*/
+	for (nc = 0; nc < rcls; nc++) {		/* follow the FAT chain */
+
+		acls = _gtcl12(_thefat, acls);	/* next cluster pointer */
+
+		if (acls LT 0x0FF0)		/* OK if it's a good cluster */
+			continue;
+
+		fcp->modefl |= FC_ERR;		/* EOF or bad cluster hit */
+		errno = EINVAL;			/* mark it as an invalid seek */
+
+		if (acls LT 0x0FF8) {		/* bad cluster ? */
+
+			errno = EIO;		/* mark it as an I/O error */
+			fcp->modefl |= FC_BAD;	/* mark FCB:  bad cluster hit */
+		}
+
+		return(IO_ERR);			/* ERROR:  seek error */
+	}
+
+	fcp->curcls = acls;			/* current cluster */
+	fcp->clsec = sic;			/* sector in cluster */
+
+	fcp->curdsn = _cl2lsn(_thebpb, acls) + sic;	/* disk sector number */
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_seek():  OK curlsn=%ld, acls=%u, sic=%d, curdsn=%ld\n",
+			fcp->curlsn, acls, sic, fcp->curdsn);
+#endif
+
+	if (fcp->curlsn EQ fcp->asects)		/* see if we're at EOF */
+		return(1);			/* soft EOF */
+		
+	return(0);				/* not EOF */
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_ftrnc(dp) -- truncate file pointed to by directory entry 'dp'
+   =============================================================================
+*/
+
+int
+_ftrnc(dp)
+struct dirent *dp;
+{
+	register unsigned acls, ncls;
+
+#if	DEBUGIT
+	register int lim;
+
+	lim = _thebpb->numcl;
+#endif
+
+	acls = micons(dp->bclust);		/* get first cluster number */
+
+	/* zap entries until EOF or bad cluster */
+
+#if	DEBUGIT
+	while (lim-- AND (acls LT 0x0FF0)) {
+#else
+	while (acls LT 0x0FF0) {
+#endif
+
+		ncls = _gtcl12(_thefat, acls);	/* get next cluster number */
+		_ptcl12(_thefat, acls, 0);	/* zap the current one */
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("_ftrnc():  zapped %d\n", acls);
+#endif
+
+		acls = ncls;			/* point at the next one */
+	}
+
+/* 
+
+*/
+
+	dp->flen = 0L;				/* file length = 0 */
+	dp->bclust = 0;				/* no sectors allocated */
+	_fatmod = TRUE;				/* FAT got changed */
+	_dirmod = TRUE;				/* directory got changed */
+
+#if	DEBUGIT
+	if (lim LE 0) {
+
+		errno = EIO;
+		printf("_ftrnc():  ERROR - lim went to %d\n", lim);
+		mdump(_thefat, (char *)_thefat+255, _thefat);
+		xtrap15();
+		return(FAILURE);
+	}
+#endif
+
+	return(SUCCESS);
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_newcls() -- allocate a new cluster
+   =============================================================================
+*/
+
+int
+_newcls()
+{
+	register int tc, i;
+
+	tc = _thebpb->numcl;
+
+	for (i = 2; i < tc; i++)
+		if (0 EQ _gtcl12(_thefat, i))
+			return(i);
+
+	return(0);	/* ERROR:  no empty clusters left */
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_alcnew() -- allocate a new cluster to extend a file
+   =============================================================================
+*/
+
+int
+_alcnew(fcp)
+register struct fcb *fcp;
+{
+	register int ac, nc, pc;
+
+#if	DEBUGIT
+	register int lim;
+#endif
+
+	if (nc = _newcls()) {			/* get a new cluster */
+
+#if	DEBUGIT
+		lim = (fcp->asects / _thebpb->clsiz) + 1;  /* limit search */
+#endif
+
+		_ptcl12(_thefat, nc, FAT_EOF);	/* mark new cluster as EOF */
+		pc = micons(fcp->de.bclust);	/* get first cluster */
+
+#if	DEBUGIT
+	if (pc EQ 0) {
+
+		printf("_alcnew():  ERROR - pc EQ 0, bclust=$%04.4X, nc=%d\n",
+			fcp->de.bclust, nc);
+		xtrap15();
+	}
+#endif
+
+		/* find end of allocation chain */
+
+#if	DEBUGIT
+		while (lim-- AND ((ac = _gtcl12(_thefat, pc)) < 0x0FF0)) {
+#else
+		while ((ac = _gtcl12(_thefat, pc)) < 0x0FF0) {
+#endif
+
+			pc = ac;
+		}
+
+/* 
+
+*/
+
+#if	DEBUGIT
+		if (lim LE 0) {
+
+			printf("_alcnew():  ERROR - lim ran out, nc=%d\n", nc);
+			mdump(_thefat, (char *)_thefat+63, _thefat);
+			xtrap15();
+			return(FAILURE);
+		}
+#endif
+
+		_ptcl12(_thefat, pc, nc);	/* add cluster to chain */
+		fcp->asects += _thebpb->clsiz;	/* update allocated sector count */
+		fcp->curcls = nc;		/* current cluster = new cluster */
+		fcp->clsec = 0;			/* current sector in cluster = 0 */
+
+		fcp->curdsn = _cl2lsn(_thebpb, nc);	/* current disk sector */
+
+#if DEBUGIT
+		if (fsdebug) {
+
+			printf("alcnew():  allocated cluster %d (%04.4x), ",
+				nc, nc);
+			printf("previous = %d (%04.04x), asects =%ld\n",
+				pc, pc, fcp->asects);
+		}
+#endif
+
+		return(SUCCESS);		/* return:  file extended */
+
+	} else {
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_alcnew():  _newcls() FAILED\n");
+#endif
+
+		return(FAILURE);		/* return:  no clusters left */
+	}
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_fmake(fcp) -- make a new file from the FCB pointed to by 'fcp'
+   =============================================================================
+*/
+
+int
+_fmake(fcp)
+struct fcb *fcp;
+{
+	register struct dirent *dp;
+
+	if (DE_NULL EQ (dp = _dsnew()))		/* find a dirent */
+		return(FAILURE);
+
+	_dptr = dp;				/* set the directory pointer */
+	memset(dp, 0, DENTSIZE);		/* clear the dirent */
+	memcpy(dp->fname, fcp->de.fname, 12);	/* setup file name, attribute */
+	dp->atrib |= F_ARCHIV;			/* set the archive bit */
+	_dirmod = TRUE;				/* directory got changed */
+	return(SUCCESS);
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_opnvol() -- open a volume
+   =============================================================================
+*/
+
+int
+_opnvol()
+{
+	register long drc;
+
+	/* check for media change if we already have a BPB */
+
+	if (_bpbin) {
+
+		drc = BIOS(B_MCHG, 0);
+
+#if DEBUGIT
+	if (fsdebug) {
+
+		printf("_opnvol():  found _bpbin FALSE\n");
+		printf("_opnvol():  disk change test returned %ld\n", drc);
+	}
+#endif
+
+		if (drc)
+			_bpbin = FALSE;
+	} else {
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_opnvol():  found _bpbin FALSE\n");
+#endif
+
+	}
+
+	if (!_bpbin) {		/* access the BPB */
+
+		_fatin = FALSE;		/* invalidate the FAT and directory */
+		_dirin = FALSE;
+
+		if ((struct bpb *)0L EQ (_thebpb = BIOS(B_GBPB, 0))) {
+
+			errno = EIO;	/* couldn't read the BPB */
+			return(FAILURE);
+		}
+
+		_bpbin  = TRUE;
+	}
+
+	if (!_fatin) {		/* access the FAT */
+
+		_dirin = FALSE;
+
+		if (_rdfat(_thefat, _thebpb) < 0) {
+
+			errno = EIO;	/* couldn't read either FAT */
+			return(FAILURE);
+		}
+
+		_fatin  = TRUE;
+		_fatmod = FALSE;
+	}
+/* 
+
+*/
+	if (!_dirin) {		/* access the root directory */
+
+		if (_rdroot(_thedir, _thebpb)) {
+
+			errno = EIO;	/* couldn't read the directory */
+			return(FAILURE);
+		}
+
+		_dirin  = TRUE;
+		_dirmod = FALSE;
+	}
+
+	return(SUCCESS);
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_opfcb(fcp) -- open the FCB pointed to by 'fcp'.  Returns 0 if
+	opened successfully, -1 if an error occurred, with the error code
+	in errno.
+   =============================================================================
+*/
+
+int
+_opfcb(fcp)
+register struct fcb *fcp;
+{
+	int	rc;
+
+	/* check for an already open FCB */
+
+	if (fcp->modefl & FC_OPN) {
+
+		errno = EINVAL;
+		return(IO_ERR);
+	}
+
+	if (_opnvol()) {	/* open the volume */
+
+		_deadio(fcp, errno);
+		return(IO_ERR);
+	}
+
+	/* search the directory for the file */
+
+	if (DE_NULL EQ (_dptr = _dsrch(&fcp->de))) {
+
+		/* file doesn't exist -- see if we should create it */
+
+		if (!(fcp->modefl & FC_CR)) {
+		
+			_deadio(fcp, ENOENT);	/* file nonexistant, not creating one */
+			return(IO_ERR);
+		}
+
+		/* create the file */
+
+		if(rc = _fmake(fcp)) {
+
+			_deadio(fcp, EIO);	/* couldn't create the file */
+			return(IO_ERR);
+		}
+
+/* 
+
+*/
+
+	} else {
+
+		/* file exists -- check for writes to a read-only file */
+
+		if ( (fcp->de.atrib & F_RDONLY) AND
+		     (fcp->modefl & (FC_AP | FC_WR | FC_TR)) ) {
+
+				/* can't append, write or truncate RO files */
+
+				_deadio(fcp, EACCES);
+				return(IO_ERR);
+			}
+
+		/* check for append and not write */
+
+		if ((fcp->modefl & FC_AP) AND !(fcp->modefl & FC_WR)) {
+
+			/* can't append if not open to write */
+
+			_deadio(fcp, EACCES);
+			return(IO_ERR);
+		}
+
+		/* check for create and exclusive with extant file */
+
+		if ((fcp->modefl & FC_CR) AND (fcp->modefl & FC_EX)) {
+
+			/* file exists and open was create-exclusive */
+
+			_deadio(fcp, EEXIST);
+			return(IO_ERR);
+		}
+
+/* 
+
+*/
+
+		/* truncate the file if requested */
+
+		if (fcp->modefl & FC_TR) {
+
+			/* see if we can write */
+
+			if (fcp->modefl & FC_WR) {
+
+				/* truncate the file */
+
+				if (_ftrnc(_dptr)) {
+
+					_deadio(fcp, EIO);	/* truncation failed */
+					return(IO_ERR);
+				}
+
+			} else {
+
+				/* we can't write, so we can't truncate */
+
+				_deadio(fcp, EACCES);
+				return(IO_ERR);
+			}
+		}
+	}
+
+	/* setup the FCB fields */
+
+	memcpy(&fcp->de, _dptr, DENTSIZE);
+	fcp->clsec = 0;
+	fcp->curcls = micons(fcp->de.bclust);
+	fcp->offset = 0;
+	fcp->curlsn = 0L;
+	fcp->curdsn = fcp->de.bclust ? _cl2lsn(_thebpb, fcp->curcls) : 0;
+	fcp->curlen = miconl(fcp->de.flen);
+
+	fcp->asects = ((fcp->curlen / _thebpb->clsizb)
+		+ ((fcp->curlen & (_thebpb->clsizb - 1)) ? 1 : 0))
+		* _thebpb->clsiz;
+
+	fcp->modefl &= ~(FC_EOF | FC_BAD | FC_ERR);
+	fcp->modefl |= FC_OPN;
+
+#if DEBUGIT
+	if (fsdebug)
+		SnapFCB(fcp);
+#endif
+
+	return(IO_OK);
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_inifcb(fcp, name, ext, mode) -- initialize FCB pointed to by 'fcp'
+	for file named 'name'.'ext' in mode 'mode'.
+	Returns SUCCESS (0) if ok, FAILURE (-1) if not.
+   =============================================================================
+*/
+
+int
+_inifcb(fcp, name, ext, mode)
+register struct fcb *fcp;
+char *name, *ext;
+int mode;
+{
+	int	fl;
+	register int	i;
+	register char *s1, *s2, c;
+
+	/* clear the FCB */
+
+	memset((char *)fcp, 0, sizeof (struct fcb));
+
+	/* check for valid flags */
+
+	if (mode & ~(O_WRONLY|O_RDWR|O_NDELAY|O_APPEND|O_CREAT|O_TRUNC|O_EXCL|O_RAW))
+		return(FAILURE);
+
+/* 
+
+*/
+	/* check the file name for length */
+
+	fl = TRUE;
+	s1 = name;
+
+	for (i = 0; i < 9; i++)
+		if (*s1++ EQ '\0') {
+
+			fl = FALSE;
+			break;
+		}
+
+	if (fl)
+		return(FAILURE);
+
+	/* check the file name extension for length */
+
+	fl = TRUE;
+	s1 = ext;
+
+	for (i = 0; i <4; i++)
+		if (*s1++ EQ '\0') {
+
+			fl = FALSE;
+			break;
+		}
+
+	if (fl)
+		return(FAILURE);
+
+/* 
+
+*/
+	/* clear the file name and extension in the FCB to blanks */
+
+	memset(fcp->de.fname, ' ', 11);
+
+	/* move the file name into the FCB */
+
+	s1 = fcp->de.fname;
+	s2 = name;
+
+	for (i = 0; i < 8; i++) {
+
+		c = *s2++;
+
+		if ((c EQ '\0') OR (c EQ ' '))
+			break;
+
+		*s1++ = c;
+	}
+
+	/* move the file name extension into the FCB */
+
+	s1 = fcp->de.fext;
+	s2 = ext;
+
+	for (i = 0; i < 3; i++) {
+
+		c = *s2++;
+
+		if ((c EQ '\0') OR (c EQ ' '))
+			break;
+
+		*s1++ = c;
+	}
+
+/* 
+
+*/
+
+	/* set the flags in the FCB and exit */
+
+	if (mode & O_RDONLY)
+		fcp->modefl |= FC_RD;
+
+	if (mode & O_WRONLY)
+		fcp->modefl |= FC_WR;
+
+	if (mode & O_RDWR)
+		fcp->modefl |= FC_RW;
+
+	if (mode & O_NDELAY)
+		fcp->modefl |= FC_NB;
+
+	if (mode & O_APPEND)
+		fcp->modefl |= FC_AP;
+
+	if (mode & O_CREAT)
+		fcp->modefl |= FC_CR;
+
+	if (mode & O_TRUNC)
+		fcp->modefl |= FC_TR;
+
+	if (mode & O_EXCL)
+		fcp->modefl |= FC_EX;
+
+	if (mode & O_RAW)
+		fcp->modefl |= FC_BF;
+
+	return(SUCCESS);
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	ClsFile() -- Closes the file controlled by the FCB pointed to by 'fcp'
+	at the bios level.
+   =============================================================================
+*/
+
+int
+ClsFile(fcp)
+register struct fcb *fcp;
+{
+	register struct dirent *dp;
+
+#if DEBUGIT
+	if (fsdebug) {
+
+		printf("ClsFile($%08lX):  closing file\n", fcp);
+		SnapFCB(fcp);
+	}
+#endif
+
+	if (fcp->modefl & FC_OPN) {	/* is it open ? */
+
+		if (fcp->modefl & (FC_CR | FC_AP | FC_WR)) {	/* writing ? */
+
+			if (dp = _dsrch(&fcp->de)) {	/* locate the dirent */
+
+				/* update the directory entry if it changed */
+
+				if (memcmp(dp, &fcp->de, DENTSIZE)) {
+
+					memcpy(dp, &fcp->de, DENTSIZE);
+					_dirmod = TRUE;
+#if DEBUGIT
+	if (fsdebug) {
+
+		printf("ClsFile():  updated the directory.  FAT:\n");
+		mdump(_thefat, (char *)_thefat+127, _thefat);
+	}
+#endif
+
+				}
+
+/* 
+
+*/
+
+			} else {
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("ClsFile():  ERROR - can't find the directory entry\n");
+#endif
+
+				errno = EIO;	/* can't find the entry */
+				return(FAILURE);
+			}
+		}
+
+#if DEBUGIT
+	if (fsdebug)
+		SnapFCB(fcp);
+#endif
+
+		return(SUCCESS);
+
+	} else {		/* not open */
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("ClsFile():  ERROR - file not open\n");
+#endif
+
+		errno = EINVAL;
+		return(FAILURE);
+	}
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_clsvol() -- close the volume
+   =============================================================================
+*/
+
+_clsvol()
+{
+	if (_fatmod) {
+
+		_clsfat();
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("_clsvol():  modified FAT written\n");
+#endif
+	}
+
+	if (_dirmod) {
+
+		_clsdir();
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("_clsvol():  modified directory written\n");
+#endif
+	}
+
+	_bpbin = FALSE;
+	_fatin = FALSE;
+	_dirin = FALSE;
+}
+
+/*
+   =============================================================================
+	fcbinit() -- initialize an FCB
+   =============================================================================
+*/
+
+short
+fcbinit(name, fcp)
+register char *name;
+register struct fcb *fcp;
+{
+	char	tmpname[9], tmpext[4];
+
+	return(_inifcb(fcp, FilName(name, tmpname), FilExt(name, tmpext), 0));
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	DelFile() -- Deletes the file named by fcb pointed to by 'fcp'.
+   =============================================================================
+*/
+
+int
+DelFile(fcp)
+struct fcb *fcp;
+{
+#if	DEBUGIT
+	if (fsdebug)
+		printf("DelFile($%08.8lX):  deleting [%-.8s].[%-.3s]\n",
+			fcp, fcp->de.fname, fcp->de.fext);
+#endif
+
+	if(_opnvol())			/* open the volume */
+		return(FAILURE);
+
+	if (DE_NULL EQ (_dptr = _dsrch(&fcp->de))) {	/* find the file */
+
+		errno = ENOENT;		/* can't find the file */
+		return(FAILURE);
+	}
+
+	if (_dptr->atrib & F_RDONLY) {
+
+		errno = EACCES;		/* can't delete an R/O file */
+		return(FAILURE);
+	}
+
+	if (_ftrnc(_dptr))		/* truncate the file to free its space  */
+		return(FAILURE);
+
+	_dptr->fname[0] = 0xE5;		/* mark directory entry as free */
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("DelFile($%08.8lX):  file [%-.8s].[%-.3s] DELETED\n",
+			fcp, fcp->de.fname, fcp->de.fext);
+#endif
+
+	return(SUCCESS);
+}
Index: libcio/filname.c
===================================================================
--- libcio/filname.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/filname.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,147 @@
+/*
+   =============================================================================
+	filname.c -- file name and extension extractors
+	Version 3 -- 1987-07-09 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#define	TESTER	0		/* define non-zero for test routine */
+
+#include <stddefs.h>
+
+#define	MAX_NAME	8	/* maximum length of a file name */
+#define	MAX_EXT		3	/* maximum length of an extension */
+
+/*
+   =============================================================================
+	FilName(s, p) -- Return a pointer to a string containing the file name
+	found in the string at 's'.  Copy the file name into string 'p'.
+   =============================================================================
+*/
+
+char *
+FilName(s, p)
+register char *s, *p;
+{
+	register char	*tp;
+	register int i;
+
+	tp = p;
+
+	for (i = 0; i < MAX_NAME; i++) {	/* scan the name */
+
+		if (*s) {			/* ... until we hit a '\0' */
+
+			if (*s EQ '.')		/* ... or a '.' */
+				break;
+
+			*p++ = *s++;		/* ... copying as we go */
+
+		} else {			/* stop at '\0' */
+
+			*p = '\0';		/* terminate the string */
+			return(tp);		/* return a pointer to it */
+		}
+	}
+
+	*p = '\0';		/* copied MAX_NAME bytes - that's all folks */
+	return(tp);
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	FilExt(s, p) -- Returns a pointer to a copy of the extension of
+	the file name in 's'.  The file name is copied into string 'p' and
+	a pointer to 'p' is returned.
+   =============================================================================
+*/
+
+char *
+FilExt(s, p)
+register char *s, *p;
+{
+	register char c, *tp;
+	register int i;
+
+	tp = p;
+
+	while (c = *s) {		/* scan the string */
+
+		if (c EQ '.') {		/* ... until we hit the dot */
+
+			++s;		/* point past the dot */
+
+			for (i = 0; i < MAX_EXT; i++) {	/* scan the extension ... */
+
+				if (*s) {		/* ... until we hit a '\0' */
+
+					*p++ = *s++;	/* ... copying as we go */
+
+				} else {		/* stop at '\0' */
+
+					*p = '\0';	/* terminate the string */
+					return(tp);	/* return a pointer to it */
+				}
+			}
+
+			*p = '\0';	/* copied MAX_EXT bytes - that's all folks */
+			return(tp);	/* return a pointer to the result */
+				
+		} else {
+
+			++s;		/* advance the pointer */
+		}
+	}
+
+	*p = '\0';	/* terminate the string */
+	return(tp);	/* return a pointer to the result */
+}
+
+/* 
+
+*/
+
+#if	TESTER
+
+char	*fn[] = {		/* test cases */
+
+	"FILE.NAM",
+	"FILE",
+	"FILE.",
+	".NAM",
+	".",
+	"",
+	"fartoolonganame.longextension",
+	"fartoolonganame",
+	"fartoolonganame.",
+	".longextension"
+};
+
+#define	NCASES	((sizeof fn) / (sizeof (char *)))
+
+char	temp1[MAX_NAME+1], temp2[MAX_EXT+1];
+
+fnt(s)		/* test both functions and print the result */
+char *s;
+{
+	printf("[%s] gave [%s] [%s]\r\n",
+		s, FilName(s, temp1), FilExt(s, temp2));
+}
+
+main()
+{
+	int	i;
+
+	/* hand the functions each of the test cases */
+
+	for (i = 0; i < NCASES; i++)
+		fnt(fn[i]);
+
+	exit(0);
+}
+
+#endif
Index: libcio/flread.c
===================================================================
--- libcio/flread.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/flread.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,52 @@
+/*
+   ============================================================================
+	flread.c -- read a long buffer
+	Version 2 -- 1987-07-09 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+#include "stdio.h"
+#include "stddefs.h"
+
+#define	CHUNK	32256		/* largest practical sized chunk of data */
+
+/*
+   ============================================================================
+	flread(buff, len, fp) -- Reads 'len' bytes into 'buff' from file 'fp'.
+
+	Returns SUCCESS (0) if OK, EOF (-1) on end of file.
+   ============================================================================
+*/
+
+int
+flread(buff, len, fp)
+register char *buff;
+register long len;
+FILE *fp;
+{
+	register int	ilen;
+
+	while (len > 0L) {
+
+		if (len GE (long)CHUNK) {
+
+			if (1 NE fread(buff, CHUNK, 1, fp))
+				return(EOF);
+
+			buff += (long)CHUNK;
+			len -= (long)CHUNK;
+
+		} else {
+
+			ilen = len;
+
+			if (1 NE fread(buff, ilen, 1, fp))
+				return(EOF);
+
+			len = 0L;
+		}
+	}
+
+	return(SUCCESS);
+}
+
Index: libcio/fopen.c
===================================================================
--- libcio/fopen.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/fopen.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,94 @@
+/*
+   =============================================================================
+	fopen.c -- open a stream file for the Buchla 700 C I/O Library
+	Version 4 -- 1987-06-30 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "stdio.h"
+#include "fcntl.h"
+#include "errno.h"
+#include "stddefs.h"
+
+extern	long lseek();
+
+FILE *
+_opener(name, mode, aflag)
+char *name, *mode;
+int aflag;
+{
+	register FILE *fp;
+	register int plusopt;
+
+	fp = Cbuffs;
+
+	while ( fp->_flags ) {
+
+		if ( ++fp GE (Cbuffs + NSTREAMS))
+			return(NULL);
+	}
+
+	plusopt = mode[1] EQ '+';
+
+	switch (0x007F & *mode) {
+
+	case 'r':	/* read mode */
+		if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_RDONLY)|aflag)) EQ -1)
+			return(NULL);
+		break;
+
+	case 'w':	/* write mode */
+		if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_WRONLY)|aflag|O_CREAT|O_TRUNC)) EQ -1)
+			return(NULL);
+
+		break;
+	
+	case 'a':	/* append mode */
+		if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_WRONLY)|aflag|O_CREAT)) EQ -1)
+			return(NULL);
+
+		if (lseek(fp->_unit, 0L, 2) < 0) {
+
+			close(fp->_unit);
+			return(NULL);		/* couldn't append */
+		}
+
+		break;
+
+	default:
+		errno = EINVAL;
+		return(NULL);
+	}
+
+	fp->_flags  = _BUSY;
+	fp->_buflen = BUFSIZ;
+	fp->_buff   = 0; 
+	fp->_bend   = 0; /* nothing in buffer */
+	fp->_bp     = 0;
+	return(fp);
+}
+
+/* 
+
+*/
+
+FILE *
+fopen(name, mode)
+char *name, *mode;
+{
+	return(_opener(name, mode, 0));
+}
+
+FILE *
+fopena(name, mode)
+char *name, *mode;
+{
+	return(_opener(name, mode, 0));
+}
+
+FILE *
+fopenb(name, mode)
+char *name, *mode;
+{
+	return(_opener(name, mode, O_RAW));
+}
Index: libcio/fprintf.c
===================================================================
--- libcio/fprintf.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/fprintf.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,39 @@
+/*
+   =============================================================================
+	fprintf.c -- fprintf function
+	Version 2 -- 1987-06-26 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "stdio.h"
+#include "stddefs.h"
+#include "varargs.h"
+
+static FILE *Stream;
+
+extern	int	_dofmt();
+extern	int	aputc();
+
+int
+fprintf(stream, fmt, va_alist)
+FILE *stream;
+char *fmt;
+va_dcl
+{
+	register int count;
+	int fpsub();
+	va_list aptr;
+
+	Stream = stream;
+	va_start(aptr);
+	count = _dofmt(fpsub, fmt, aptr);
+	va_end(aptr);
+	return(count);
+}
+
+static
+int
+fpsub(c)
+{
+	return(aputc(c, Stream));
+}
Index: libcio/fputs.c
===================================================================
--- libcio/fputs.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/fputs.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,45 @@
+/*
+   =============================================================================
+	fputs.c -- output a string to a stream
+	Version 3 -- 1987-07-09 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "stdio.h"
+#include "stddefs.h"
+
+int
+puts(str)
+register char *str;
+{
+	while (*str)
+		if (putchar(*str++) EQ EOF)
+			return(EOF);
+
+	return(putchar('\n'));
+}
+
+int
+aputc(c,ptr)
+register int c;
+register FILE *ptr;
+{
+	c &= 127;
+
+	if (c EQ '\n')
+		if (putc('\r', ptr) EQ EOF)
+			return(EOF);
+
+	return(putc(c, ptr));
+}
+
+int
+fputs(s,fp)
+register char *s;
+FILE *fp;
+{
+	while ( *s )
+		if (aputc(*s++, fp) EQ EOF)
+			return(EOF);
+	return(0);
+}
Index: libcio/fread.c
===================================================================
--- libcio/fread.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/fread.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,40 @@
+/*
+   =============================================================================
+	fread.c -- read a stream file
+	Version 3 -- 1987-06-29 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "stdio.h"
+#include "stddefs.h"
+
+/*
+   =============================================================================
+	fread(buffer, size, number, stream) -- read 'number' items of size
+	'size' bytes from file 'stream' into 'buffer'.
+   =============================================================================
+*/
+
+int
+fread(buffer, size, number, stream)
+register char *buffer;
+unsigned size;
+int number;
+FILE *stream;
+{
+	int total;
+	register int c,i;
+
+	for (total = 0; total < number; ++total) {
+
+		for (i = size; i; --i) {
+
+			if ((c = getc(stream)) EQ EOF)
+				return(total);
+
+			*buffer++ = c;
+		}
+	}
+	return(total);
+}
+
Index: libcio/fscanf.c
===================================================================
--- libcio/fscanf.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/fscanf.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,49 @@
+/*
+   =============================================================================
+	fscanf.c -- scan a stream file for input for the portable C I/O Library
+	Version 4 -- 1989-01-16 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "stdio.h"
+#include "stddefs.h"
+
+static int scnlast;
+static FILE *scnfp;
+
+static
+int
+gchar(what)
+{
+	if (what EQ 0) {
+
+		if (feof(scnfp))
+			scnlast = EOF;
+		else
+			scnlast = agetc(scnfp);
+	} else
+		scnlast = ungetc(scnlast, scnfp);
+
+	return(scnlast);
+}
+
+int
+scanf(fmt, args)
+char *fmt;
+int *args;
+{
+	scnfp = stdin;
+	scnlast = 0;
+	return(scanfmt(gchar, fmt, &args));
+}
+
+int
+fscanf(fp, fmt, args)
+FILE *fp;
+char *fmt;
+int *args;
+{
+	scnfp = fp;
+	scnlast = 0;
+	return(scanfmt(gchar, fmt, &args));
+}
Index: libcio/fseek.c
===================================================================
--- libcio/fseek.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/fseek.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,51 @@
+/*
+   =============================================================================
+	fseek.c -- perform a seek on a stream file
+	Version 4 -- 1987-10-28 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "stdio.h"
+#include "biosdefs.h"
+#include "io.h"
+#include "stddefs.h"
+
+/*
+   =============================================================================
+	fseek(fp, pos, mode) -- position file 'fp' at 'pos' in mode 'mode'.
+   =============================================================================
+*/
+
+fseek(fp, pos, mode)
+register FILE *fp;
+long pos;
+int mode;
+{
+	register int i, lr;
+	long curpos, lseek();
+
+	if (fp->_flags & _DIRTY) {
+
+		if (flush_(fp, -1))
+			return(EOF);
+
+	} else {
+
+		if (mode EQ 1 AND fp->_bp)
+			pos -= (long)fp->_bend - (long)fp->_bp;
+	}
+
+	fp->_bp = fp->_bend = NULL;
+	fp->_flags &= ~_EOF;
+
+	lr = lseek(fp->_unit, pos, mode);
+
+	if (chantab[fp->_unit].c_arg->modefl & FC_EOF)
+		fp->_flags |= _EOF;
+
+	if (lr < 0)
+		return(EOF);
+
+	return(0);
+}
+
Index: libcio/fsinit.c
===================================================================
--- libcio/fsinit.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/fsinit.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,167 @@
+/*
+   ============================================================================
+	fsinit.c -- Initialize file system
+	Version 9 -- 1988-01-31 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+#define	_FS_DEF_	/* define so that stdio.h and io.h get things right */
+
+#include "biosdefs.h"
+#include "errno.h"
+#include "io.h"
+#include "stdio.h"
+#include "stddefs.h"
+
+extern	int	_bpbin, _dirin, _fatin, _dirmod, _fatmod;
+
+int	_badfd(), _noper();
+
+char	*Stdbufs;			/* buffer chain pointer */
+
+char	Wrkbuf[BPSEC];			/* sector work buffer */
+
+long	Stdbuf[MAXDFILE][BUFSIZL];	/* standard buffers */
+
+FILE Cbuffs[NSTREAMS];			/* stream file control table */
+
+struct fcb _fcbtab[MAXDFILE];		/* fcb table */
+
+struct channel  chantab[MAXCHAN];	/* channel table:  relates fd's to devices */
+
+#if	TBUFFER
+
+/* WARNING:  this ONLY works for 512 byte sectors, 9 sectors per track */
+
+short	_b_tbuf[9][256];	/* the track buffer */
+
+short	_b_trak;		/* current track */
+short	_b_side;		/* current side */
+short	_b_sect;		/* current sector */
+short	_b_tsec;		/* current base sector of current track */
+
+#endif
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	_badfd() -- set "bad fd" error
+   ============================================================================
+*/
+
+int
+_badfd()
+{
+	errno = EBADF;		/* set bad fd code */
+	return(FAILURE);	/* return with an error indication */
+}
+
+/*
+   ============================================================================
+	_noper() -- null return with no error condition
+   ============================================================================
+*/
+
+int
+_noper()
+{
+	return(SUCCESS);	/* return with a non-error indication */
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	InitCH() -- Initialize chantab structure entry
+   ============================================================================
+*/
+
+InitCH(cp, rdi, wri, ioi, ski, cfp, charg)
+register struct channel *cp;
+char rdi, wri, ioi, ski;
+int (*cfp)();
+io_arg charg;
+{
+	cp->c_read  = rdi;
+	cp->c_write = wri;
+	cp->c_ioctl = ioi;
+	cp->c_seek  = ski;
+	cp->c_close = cfp;
+	cp->c_arg   = charg;
+}
+
+/*
+   ============================================================================
+	Init_CB() -- Initialize Cbuff structure entry
+   ============================================================================
+*/
+
+Init_CB(fp, flags, unit, bufad, bufsize)
+register FILE *fp;
+char unit, flags;
+long *bufad;
+int bufsize;
+{
+	fp->_bp     = (char *)0L;
+	fp->_bend   = (char *)0L;
+	fp->_buff   = (char *)bufad;
+	fp->_flags  = flags;
+	fp->_unit   = unit;
+	fp->_bytbuf = 0;
+	fp->_buflen = bufsize;
+};
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	InitFS() -- Initialize file system
+   ============================================================================
+*/
+
+InitFS()
+{
+	register int i;
+
+	memset(_fcbtab, 0, sizeof _fcbtab);		/* clear fcb table */
+	memsetw(Stdbuf, 0, sizeof Stdbuf / 2);		/* clear buffers */
+
+	Init_CB(stdin,  _BUSY, 0, (char *)0L, BUFSIZ);	/* stdin */
+	Init_CB(stdout, _BUSY, 1, (char *)0L, 1);	/* stdout */ 
+	Init_CB(stderr, _BUSY, 2, (char *)0L, 1);	/* stderr */
+
+	for (i = 3; i < NSTREAMS; i++)
+		Init_CB(&Cbuffs[i], 0, 0, (char *)0L, 0);
+
+	Stdbuf[0][0] = 0L;		/* initialize the buffer list */
+
+	for (i = 1; i < MAXDFILE; i++)
+		Stdbuf[i][0] = (long)Stdbuf[i-1];
+
+	Stdbufs = Stdbuf[MAXDFILE-1];
+
+	InitCH(&chantab[0], 2, 0, 1, 0, _noper, (io_arg)CON_DEV );	/*  0 - stdin  */
+	InitCH(&chantab[1], 0, 2, 1, 0, _noper, (io_arg)CON_DEV );	/*  1 - stdout */
+	InitCH(&chantab[2], 0, 2, 1, 0, _noper, (io_arg)CON_DEV );	/*  2 - stderr */
+
+	for (i = 3; i < MAXCHAN; i++)	/*  3..MAXCHAN-1 - not preassigned */
+		InitCH(&chantab[i], 0, 0, 0, 0, _badfd, (io_arg)0L );
+
+	_bpbin  = FALSE;	/* BPB isn't in memory */
+	_dirin  = FALSE;	/* directory isn't in memory */
+	_fatin  = FALSE;	/* FAT isn't in memory */
+	_fatmod = FALSE;	/* FAT hasn't been changed */
+	_dirmod = FALSE;	/* directory hasn't been changed */
+
+#if	TBUFFER
+	_b_trak = -1;		/* no track in the buffer */
+	_b_side = -1;		/* ... */
+#endif
+}
Index: libcio/fsize.c
===================================================================
--- libcio/fsize.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/fsize.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,98 @@
+/*
+   =============================================================================
+	fsize.c -- file size and disk capacity functions
+	Version 1 -- 1987-10-29 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "stdio.h"
+#include "biosdefs.h"
+#include "io.h"
+#include "stddefs.h"
+
+extern	short	_gtcl12(), _opnvol(), _filecl();
+
+extern	unsigned _thefat[];
+
+extern	struct	bpb	*_thebpb;
+
+/*
+   =============================================================================
+	fsize() -- return the current size of an open stream file
+
+		how = 0: in bytes, 1: in allocated clusters
+   =============================================================================
+*/
+
+long
+fsize(fp, how)
+FILE *fp;
+short how;
+{
+	register struct channel *chp;
+	register struct fcb *fcp;
+
+	if (fp EQ (FILE *)0L)
+		return(-1L);
+
+	if (fp->_flags & _BUSY) {
+
+		chp = &chantab[fp->_unit];
+
+		if (chp->c_close NE _filecl)
+			return(-1L);
+
+		fcp = chp->c_arg;
+
+		if (fcp->modefl & FC_OPN) {
+
+			if (how)
+				return(fcp->asects);
+			else
+				return(fcp->curlen);
+
+		} else
+			return(-1L);
+
+	} else
+		return(-1L);
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	dspace() -- return disk capacity or usage
+
+		which = 0: capcity, 1: usage
+   =============================================================================
+*/
+
+short
+dspace(which)
+short which;
+{
+	register short maxcl, clcount, nc;
+
+	if (_opnvol())
+		return(-1L);
+
+	maxcl = _thebpb->numcl;
+
+	if (which) {
+
+		clcount = 0;
+
+		for (nc = 2; nc < maxcl; nc++)
+			if (0 EQ _gtcl12(_thefat, nc))
+				++clcount;
+
+		return(clcount);
+
+	} else {
+
+		return(maxcl);
+	}
+}
Index: libcio/fstubs.c
===================================================================
--- libcio/fstubs.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/fstubs.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,49 @@
+/*
+   =============================================================================
+	fstubs.c -- stubs for testing with
+	Version 13 -- 1987-11-13 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "biosdefs.h"
+#include "errno.h"
+#include "stdio.h"
+#include "io.h"
+#include "stddefs.h"
+
+/*
+   =============================================================================
+	readbuf() -- Reads an edited string from 'dev' into 'buf'
+	in {MS|GEM}DOS buffer format.
+
+	Buffer format:
+
+		buf[0] = buffer length, buf[1] = number of bytes read,
+		buf[2]..buf[buf[0]-1 = data area
+
+	Editing characters:
+
+		CR, LF	End the line
+		BS, DEL	Erase last character
+		^U,^X	Cancel (erase) entire line
+		^R	Retype line
+		^C	Terminate the process
+		^Z	End of file / end of line
+
+	Returns:
+	      Value     stddef	Meaning
+	      -----     ------- --------------------------------------------
+		1		Terminate process (^C entered)
+		0	SUCCESS	Line available in buffer  (CR or LF entered)
+	       -1	EOF	End of file (^Z entered)
+   =============================================================================
+*/
+
+int
+readbuf(dev, buf)
+int dev;
+char *buf;
+{
+	xtrap15();
+	return(1);
+}
Index: libcio/ftell.c
===================================================================
--- libcio/ftell.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/ftell.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,96 @@
+/*
+   =============================================================================
+	ftell.c -- return current file position
+	Version 7 -- 1987-10-28 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#define	DEBUGIT		0
+
+#include "biosdefs.h"
+#include "stdio.h"
+#include "io.h"
+#include "stddefs.h"
+
+#if	DEBUGIT
+extern	short	fsdebug;
+#endif
+
+extern	int	_filecl();
+
+/*
+   =============================================================================
+	ftell(fp) -- return the current position of file 'fp'.
+   =============================================================================
+*/
+
+long
+ftell(fp)
+register FILE *fp;
+{
+	register struct fcb *fcp;
+	register struct channel *chp;
+	register long dpos, pos, diff;
+
+	if (fp EQ (FILE *)0L) {		/* see if we point at a FILE */
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("ftell($%08.8lX):  ERROR - null FILE pointer\n", fp);
+#endif
+
+		return(0L);
+	}
+
+	if (!fp->_flags & _BUSY) {	/* see if it's open */
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("ftell($%08.8lX):  ERROR - FILE not open\n", fp);
+#endif
+
+		return(0L);
+	}
+
+	chp = &chantab[fp->_unit];	/* point at the channel */
+
+	if (chp->c_close NE _filecl) {	/* see if it's seekable */
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("ftell($%08.8lX):  ERROR - FILE device not seekable\n",
+			fp);
+#endif
+
+		return(0L);
+	}
+
+	fcp = chp->c_arg;		/* point at the FCB */
+
+	dpos = fcp->offset + (fcp->curlsn << FILESHFT);
+
+	if (fp->_flags & _DIRTY)	/* adjust for the buffering */
+		pos = dpos + (diff = ((long)fp->_bp - (long)fp->_buff));
+	else if (fp->_bp)
+		pos = dpos - (diff = ((long)fp->_bend - (long)fp->_bp));
+	else
+		pos = dpos;
+
+#if	DEBUGIT
+	if (fsdebug) {
+
+		printf("ftell($%08.8lX):  flags=$%04.4X, buff=$%08.8lX, bp=$%08.8lX, bend=$%08.8lX\n",
+			fp, fp->_flags, fp->_buff, fp->_bp, fp->_bend);
+	printf("ftell($%08.8lX):  fcp=$%08.8lX, pos=%ld, dpos=%ld, diff=%ld\n",
+			fp, fcp, pos, dpos, diff);
+		printf("ftell($%08.8lX):  curlsn=%ld, offset=%u\n",
+			fp, fcp->curlsn, fcp->offset);
+
+		if ((fp->_flags & _DIRTY) AND (fp->_bp EQ NULL))
+			printf("ftell($%08.8lX):  ERROR - file is DIRTY and bp is NULL\n",
+				fp);
+	}
+#endif
+
+	return(pos);
+}
Index: libcio/fwrite.c
===================================================================
--- libcio/fwrite.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/fwrite.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,43 @@
+/*
+   =============================================================================
+	fwrite.c -- write a stream file
+	Version 3 -- 1987-07-09 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "stdio.h"
+#include "stddefs.h"
+
+/*
+   =============================================================================
+	fwrite(buffer, size, number, stream) -- write 'number' items of sixe
+	'size' bytes from 'buffer' onto 'stream'.  Returns the number of items
+	written.  If 'number' or 'size' is negative, nothing is written, and
+	0 is returned.  EOF may cause the last item written to be imcomplete.
+	Check with feof() to detect an EOF condition.  Use ferror() to check
+	for error conditions.
+   =============================================================================
+*/
+
+int
+fwrite(buffer, size, number, stream)
+register char *buffer;
+register int size, number;
+register FILE *stream;
+{
+	register int i, j;
+
+	if (size < 0)		/* check size for validity */
+		return(0);
+
+	if (number < 0)		/* check number for validity */
+		return(0);
+
+	for (i = 0; i < number; ++i)
+		for (j = 0; j < size; ++j)
+			if (putc(*buffer++, stream) EQ EOF)
+				return(i);
+
+	return(number);
+}
+
Index: libcio/getbuff.c
===================================================================
--- libcio/getbuff.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/getbuff.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,37 @@
+/*
+   ============================================================================
+	getbuff.c -- Get a buffer for a file for the Buchla 700 C I/O Library
+	Version 4 -- 1987-06-24 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+#include "stdio.h"
+#include "stddefs.h"
+
+getbuff(ptr)
+register FILE *ptr;
+{
+	char *buffer;
+
+	if (ptr->_buflen EQ 1) {	/* see if we want the small buffer */
+
+		ptr->_buff = &ptr->_bytbuf;
+		return;
+	}
+
+	if (Stdbufs) {		/* see if we have any standard buffers left */
+
+		buffer = (char *)Stdbufs;
+		Stdbufs = *(long **)Stdbufs;
+
+	} else {		/* ... if not, use the small one */
+
+		ptr->_buff = &ptr->_bytbuf;
+		ptr->_buflen = 1;
+		return;
+	}
+
+	ptr->_flags |= _ALLBUF;		/* say we allocated a standard buffer */
+	ptr->_buff = buffer;
+	return;
+}
Index: libcio/getc.c
===================================================================
--- libcio/getc.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/getc.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,37 @@
+/*
+   ============================================================================
+	getc.c -- get a character from a stream file
+	Version 3 -- 1987-09-22 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+#include "stdio.h"
+#include "stddefs.h"
+
+int
+getc(ptr)
+register FILE *ptr;
+{
+	register int len;
+
+	if (ptr->_bp >= ptr->_bend) {		/* see if the buffer is empty */
+
+		if (ptr->_flags & _EOF)		/* check EOF status */
+			return(EOF);
+
+		ptr->_flags &= ~_DIRTY;		/* reset the dirty buffer bit */
+
+		if (ptr->_buff EQ NULL)		/* get a buffer if none exists */
+			getbuff(ptr);
+
+		if ((len = read(ptr->_unit, ptr->_buff, ptr->_buflen)) LE 0) {
+
+			ptr->_flags |= ((len EQ 0) ? _EOF : _IOERR);
+			return(EOF);
+		}
+
+		ptr->_bend = (ptr->_bp = ptr->_buff) + len;
+	}
+
+	return(*ptr->_bp++ & 0xFF);
+}
Index: libcio/getl.c
===================================================================
--- libcio/getl.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/getl.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,36 @@
+/*
+   =============================================================================
+	getl.c -- get a 68000 long word from a stream file
+	Version 2 -- 1987-10-15 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "stdio.h"
+
+extern	int	fgetc();
+
+/*
+   =============================================================================
+	getl(stream) -- get a long word from 'stream'
+
+	Reads a long from 'stream' in Motorola 68000 byte order.
+	No special alignment is assumed in the file.
+   =============================================================================
+*/
+
+long
+getl(stream)
+register FILE *stream;
+{
+	long temp;
+	register char *t;
+
+	t = &temp;
+
+	*t++ = fgetc(stream);
+	*t++ = fgetc(stream);
+	*t++ = fgetc(stream);
+	*t = fgetc(stream);
+
+	return(temp);
+}
Index: libcio/getw.c
===================================================================
--- libcio/getw.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/getw.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,34 @@
+/*
+   =============================================================================
+	getw.c -- get a 68000 word from a stream file
+	Version 2 -- 1987-10-15 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "stdio.h"
+
+extern	int	fgetc();
+
+/*
+   =============================================================================
+	getw(stream) -- get a word from 'stream'
+
+	Reads a word from 'stream' in Motorola 68000 byte order.
+	No special alignment is assumed in the file.
+   =============================================================================
+*/
+
+int
+getw(stream)
+register FILE *stream;
+{
+	int temp;
+	register char *t;
+
+	t = &temp;
+
+	*t++ = fgetc(stream);
+	*t = fgetc(stream);
+
+	return(temp);
+}
Index: libcio/lseek.c
===================================================================
--- libcio/lseek.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/lseek.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,123 @@
+/*
+   =============================================================================
+	lseek.c -- position a file to a specified byte location
+	Version 7 -- 1987-10-28 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#define	DEBUGIT		0
+
+#include "io.h"
+#include "biosdefs.h"
+#include "errno.h"
+#include "stddefs.h"
+
+extern	int	_seek();
+
+#if	DEBUGIT
+extern	short	fsdebug;
+#endif
+
+long
+lseek(fd, pos, how)
+int fd;
+register long pos;
+int how;
+{
+	register struct fcb *fp;
+
+	if ((fd < 0) OR (fd > MAXCHAN)) {
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("lseek(%d):  bad file index\n", fd);
+#endif
+
+		errno = EBADF;		/* file number bad */
+		return(-1L);
+	}
+
+	if (chantab[fd].c_seek EQ 0) {
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("lseek(%d):  device not seekable\n", fd);
+#endif
+
+		errno = EINVAL;		/* device can't seek */
+		return(-1L);
+	}
+
+	fp = chantab[fd].c_arg;		/* get fcb pointer from channel table */
+
+	switch (how) {			/* dispatch off of seek type */
+
+	case 2:				/* relative to end of file */
+		pos += fp->curlen;
+		break;
+
+	case 1:				/* relative to current position */
+		pos += fp->offset + (fp->curlsn << FILESHFT);
+
+	case 0:				/* relative to start of file */
+		break;
+
+	default:
+		errno = EINVAL;		/* invalid seek type */
+		return(-1L);
+	}
+/* 
+
+*/
+	if (pos < 0) {				/* trap seeks before BOF */
+
+		fp->offset = 0;
+		fp->curlsn = 0;
+		fp->modefl |= FC_ERR;
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("lseek(%d):  seek (%ld) is before BOF\n", fd, pos);
+#endif
+
+		errno = EINVAL;
+		return(-1L);
+
+	} else if (pos > fp->curlen) {		/* trap seeks past EOF */
+
+		fp->offset = fp->curlen & (BPSEC -1);
+		fp->curlsn = fp->curlen >> FILESHFT;
+		fp->modefl |= FC_ERR;
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("lseek(%d):  seek (%ld) is after EOF (%ld)\n",
+			fd, pos, fp->curlen);
+#endif
+
+		errno = EINVAL;
+		return(-1L);
+	}
+
+	fp->offset = pos & ((long)BPSEC - 1);	/* calculate sector offset */
+	fp->curlsn = pos >> FILESHFT;		/* calculate logical sector */
+
+	if (_seek(fp) < 0) {			/* position to the physical sector */
+
+		fp->modefl |= FC_ERR;		/* couldn't seek */
+		errno = EIO;
+		return(-1L);
+	}
+
+	if (pos EQ fp->curlen)
+		fp->modefl |= FC_EOF;
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("lseek():  pos=%d, curlsn=%ld, curdsn=%ld, offset=%u\n",
+			pos, fp->curlsn, fp->curdsn, fp->offset);
+#endif
+
+	return(pos);				/* return current position */
+}
+
Index: libcio/open.c
===================================================================
--- libcio/open.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/open.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,268 @@
+/*
+   =============================================================================
+	open.c -- open a file for the Buchla 700 C I/O library functions
+	Version 11 -- 1988-01-31 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "biosdefs.h"
+#include "errno.h"
+#include "fcntl.h"
+#include "io.h"
+#include "stddefs.h"
+
+extern	int	_badfd(), _noper();
+extern	int	_inifcb(), _opfcb();
+
+extern	char	*FilName(), *FilExt();
+
+int	_fileop(), _filecl();
+
+static struct device condev  = { 2, 2, 1, 0, _noper  };
+static struct device filedev = { 1, 1, 0, 1, _fileop };
+
+extern	struct fcb _fcbtab[];
+
+/*
+   =============================================================================
+	device table:  contains names and pointers to device control structures
+   =============================================================================
+*/
+
+static struct devtabl devtabl[] = {
+
+	{ "con:", &condev,  2 },	/* console device */
+	{ "CON:", &condev,  2 },
+
+	{      0, &filedev, 0 }		/* this MUST be the last entry */
+};
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	open(name, flag, mode) -- Opens file 'name' with flags 'flag'
+	and access mode 'mode'.  File will be ASCII unless opened with O_RAW.
+	Returns a file descriptor (small positive integer) if successful, or
+	FAILURE (-1) if an error occurred.
+   =============================================================================
+*/
+
+int
+open(name, flag, mode)
+char *name;
+int flag, mode;
+{
+	register struct devtabl	*dp;
+	register struct channel	*chp;
+	register struct device	*dev;
+	int	fd, mdmask;
+
+	/* search for a free channel */
+
+	for (chp = chantab, fd = 0 ; fd < MAXCHAN ; ++chp, ++fd)
+		if (chp->c_close EQ _badfd)
+			goto fndchan;
+
+	errno = EMFILE;		/* no channels available */
+	return(FAILURE);
+
+/* 
+
+*/
+
+fndchan:	/* found a channel to use */
+
+	for (dp = devtabl; dp->d_name; ++dp)	 /* search for the device */
+		if (strcmp(dp->d_name, name) EQ 0)
+			break;
+
+	dev = dp->d_dev;
+	mdmask = (flag & 3) + 1;
+
+	if (mdmask & 1) {	/* see if device is readable */
+
+		if ((chp->c_read = dev->d_read) EQ 0) {
+
+			errno = EACCES;		/* can't read */
+			return(FAILURE);
+		}
+	}
+
+	if (mdmask & 2) {	/* see if device is writeable */
+
+		if ((chp->c_write = dev->d_write) EQ 0) {
+
+			errno = EACCES;		/* can't write */
+			return(FAILURE);
+		}
+	}
+
+	/* setup the channel table entries */
+
+	chp->c_arg   = dp->d_arg;
+	chp->c_ioctl = dev->d_ioctl;
+	chp->c_seek  = dev->d_seek;
+	chp->c_close = _noper;
+
+	if ((*dev->d_open)(name, flag, mode, chp, dp) < 0) {	/* open */
+
+		chp->c_close = _badfd;	/* couldn't open for some reason */
+		return(FAILURE);
+	}
+
+	return(fd);
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	opena(name, flag, mode) -- Opens ASCII file 'name' with flags 'flag'
+	and access mode 'mode'.  Newline translation will be done.
+	Returns a file descriptor (small positive integer) if successful, or
+	FAILURE (-1) if an error occurred.
+   =============================================================================
+*/
+
+int
+opena(name, flag, mode)
+char *name;
+int flag, mode;
+{
+	return(open(name, flag, mode));
+}
+
+/*
+   =============================================================================
+	openb(name, flag, mode) -- Opens binary file 'name' with flags 'flag'
+	and access mode 'mode'.  No newline translation is done.
+	Returns a file descriptor (small positive integer) if successful, or
+	FAILURE (-1) if an error occurred.
+   =============================================================================
+*/
+
+int
+openb(name, flag, mode)
+char *name;
+int flag, mode;
+{
+	return(open(name, flag|O_RAW, mode));
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	creat(name, mode) -- Creates file 'name' with access mode 'mode'.
+	The created file is initially open for writing only.  The file
+	will be ASCII unless mode contains O_RAW.
+	Returns a file descriptor (small positive integer) if successful, or
+	FAILURE (-1) if an error occurred.
+   =============================================================================
+*/
+
+int
+creat(name, mode)
+char *name;
+int mode;
+{
+	return(open(name, O_WRONLY|O_TRUNC|O_CREAT, mode));
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	creata(name, mode) -- Creates ASCII file 'name' with access mode 'mode'.
+	The created file is initially open for writing only.
+	Files created with creata() do newline translations.
+	Returns a file descriptor (small positive integer) if successful, or
+	FAILURE (-1) if an error occurred.
+   =============================================================================
+*/
+
+int
+creata(name, mode)
+char *name;
+int mode;
+{
+	return(open(name, O_WRONLY|O_TRUNC|O_CREAT, mode));
+}
+
+/*
+   =============================================================================
+	creatb(name, mode) -- create binary file 'name' with access mode 'mode'.
+	The created file is initially open for writing only.
+	Files created with creatb don't do newline translations.
+	Returns a file descriptor (small positive integer) if successful, or
+	FAILURE (-1) if an error occurred.
+   =============================================================================
+*/
+
+int
+creatb(name, mode)
+char *name;
+int mode;
+{
+	return(creat(name, O_WRONLY|O_TRUNC|O_CREAT|O_RAW, mode));
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_fileop(name, flag, mode, chp, dp) -- Opens disk file 'name' with
+	flags 'flag' in mode 'mode' with channel pointer 'chp' and
+	device pointer 'dp'.  Returns SUCCESS (0) or FAILURE (-1).
+   =============================================================================
+*/
+
+int
+_fileop(name, flag, mode, chp, dp)
+char *name;
+int flag, mode;
+struct channel *chp;
+struct devtabl *dp;
+{
+	register struct fcb *fp;
+	char	tmpname[9], tmpext[4];
+
+	/* search for an available fcb entry */
+
+	for (fp = _fcbtab; fp < (_fcbtab + MAXDFILE); ++fp)
+		if (fp->modefl EQ 0)
+			goto havefcb;
+
+	errno = ENFILE;		/* no fcb space available for file */
+	return (FAILURE);
+
+havefcb:
+
+	/* setup the initial fcb */
+
+	if (_inifcb(fp, FilName(name, tmpname), FilExt(name, tmpext), flag)) {
+
+		errno = EINVAL;		/* bad file name or flags */
+		return(FAILURE);
+	}
+
+	if (_opfcb(fp))			/* open the file */
+		return(FAILURE);
+
+	chp->c_arg   = fp;		/* allocate the channel */
+	chp->c_close = _filecl;
+
+	return(SUCCESS);
+}
+
Index: libcio/posit.c
===================================================================
--- libcio/posit.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/posit.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,55 @@
+/*
+   =============================================================================
+	posit.c -- position a file to a specific relative sector
+	Version 4 -- 1987-06-29 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "biosdefs.h"
+#include "io.h"
+#include "errno.h"
+#include "stddefs.h"
+
+extern	int	_seek();
+
+/*
+   =============================================================================
+	posit(fd, pos) -- position file 'fd' at sector 'pos'.
+   =============================================================================
+*/
+
+int
+posit(fd, pos)
+int fd;
+unsigned pos;
+{
+	register struct fcb *fp;
+
+	if ((fd < 0) OR (fd > MAXCHAN)) {
+
+		errno = EBADF;
+		return(FAILURE);
+	}
+
+	fp = chantab[fd].c_arg;
+
+	if ((chantab[fd].c_seek EQ 0)
+	    OR ((pos << FILESHFT) > fp->curlen)) {
+
+		errno = EINVAL;
+		fp->modefl |= FC_ERR;
+		return(FAILURE);
+	}
+
+	fp->curlsn = pos;
+	fp->offset = 0;
+
+	if (_seek(fp) < 0) {
+
+		errno = EIO;
+		fp->modefl |= FC_ERR;
+		return(FAILURE);
+	}
+
+	return(SUCCESS);
+}
Index: libcio/ptcl12.s
===================================================================
--- libcio/ptcl12.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/ptcl12.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,49 @@
+* ------------------------------------------------------------------------------
+* ptcl12.s -- store a cluster entry into the FAT
+* Version 2 -- 1987-10-27 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+		.text
+		.xdef	__ptcl12
+*
+CL		.equ	12
+VAL		.equ	14
+CLA		.equ	d7
+CLP		.equ	d6
+CLT		.equ	d5
+FAT		.equ	a5
+*
+__ptcl12:	link	A6,#0
+		movem.l	CLT-CLA/FAT-FAT,-(sp)
+		move.l	8(A6),FAT
+		move.w	CL(A6),CLA
+		lsr.w	CLA
+		add.w	CL(A6),CLA
+		move.b	1(FAT,CLA.W),CLP
+		lsl.w	#8,CLP
+		move.b	0(FAT,CLA.W),CLP
+		btst	#0,CL+1(A6)
+		beq	L2
+*
+		move.w	CLP,CLT
+		and.w	#$000F,CLT
+		move.w	VAL(A6),D0
+		lsl.w	#4,D0
+		or.w	D0,CLT
+		bra	L3
+*
+L2:		move.w	CLP,CLT
+		and.w	#$F000,CLT
+		move.w	VAL(A6),D0
+		and.w	#$0FFF,D0
+		or.w	D0,CLT
+*
+L3:		move.b	CLT,0(FAT,CLA.W)
+		move.w	CLT,D0
+		lsr.w	#8,D0
+		move.b	D0,1(FAT,CLA.W)
+*
+L1:		movem.l	(sp)+,CLT-CLA/FAT-FAT
+		unlk	A6
+		rts
+*
+		.end
Index: libcio/putc.c
===================================================================
--- libcio/putc.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/putc.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,180 @@
+/*
+   ============================================================================
+	putc.c -- stream file output and close functions
+	Version 7 -- 1987-10-19 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+#include "stdio.h"
+#include "stddefs.h"
+
+extern	int	write(), getbuff(), close();
+
+extern int (*_clsall)();
+
+static int (*cls_rtn)();
+
+int	_ClFlag;
+
+int	fclose();
+
+/*
+   ============================================================================
+	closall() -- close all files at exit
+   ============================================================================
+*/
+
+static
+closall()
+{
+	register FILE *fp;
+
+	for (fp = Cbuffs; fp < (Cbuffs + NSTREAMS); )	/* close each file */
+		fclose(fp++);
+
+	(*cls_rtn)();		/* do final closeout */
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	flush_() -- do the dirty work of flushing a file
+   ============================================================================
+*/
+
+int
+flush_(ptr, data)
+register FILE *ptr;
+int data;
+{
+	register int size;
+
+	if (_ClFlag EQ 0) {
+
+		cls_rtn = _clsall;
+		_clsall = closall;
+		_ClFlag = 1;
+	}
+
+	if (ptr->_flags & _DIRTY) {	/* something in the buffer ? */
+
+		size = (int)((long)ptr->_bp - (long)ptr->_buff);
+
+		if (write(ptr->_unit, ptr->_buff, size) EQ -1) {
+
+ioerr:
+			ptr->_flags |= _IOERR;
+			return(EOF);
+		}
+	}
+
+	if (data EQ -1) {	/* just flushing, not adding data */
+
+		ptr->_flags &= ~_DIRTY;
+		ptr->_bend = ptr->_bp = NULL;
+		return(0);
+	}
+
+	if (ptr->_buff EQ NULL)		/* get a buffer if we don't have one */
+		getbuff(ptr);
+
+	if (ptr->_buflen EQ 1) {	/* unbuffered I/O */
+
+		if (write(ptr->_unit, &data, 1) EQ -1)
+			goto ioerr;
+
+		return(data);
+	}
+
+	ptr->_bp = ptr->_buff;
+	ptr->_bend = ptr->_buff + ptr->_buflen;
+	ptr->_flags |= _DIRTY;
+
+	return((*ptr->_bp++ = data) & 0x00FF);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	fflush() -- flush a stream file
+   ============================================================================
+*/
+
+int
+fflush(ptr)
+FILE *ptr;
+{
+	return(flush_(ptr, -1));
+}
+
+/*
+   ============================================================================
+	fclose() -- close a stream file
+   ============================================================================
+*/
+
+int
+fclose(ptr)
+register FILE *ptr;
+{
+	int err;
+
+	err = 0;
+
+	if (ptr->_flags) {
+
+		if (ptr->_flags & _DIRTY)	/* if modifed, flush buffer */
+			err = flush_(ptr, -1);
+
+		err |= close(ptr->_unit);
+
+		if (ptr->_flags & _ALLBUF) {	/* deallocate standard buffer */
+
+			*(long **)ptr->_buff = Stdbufs;
+			Stdbufs = (long *)ptr->_buff;
+		}
+	}
+
+	ptr->_flags = 0;
+	return(err);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	putc() -- write a character on a file
+   ============================================================================
+*/
+
+int
+putc(c, ptr)
+int c;
+register FILE *ptr;
+{
+	if (ptr->_bp GE ptr->_bend)
+		return(flush_(ptr, c & 0xFF));
+
+	return((*ptr->_bp++ = c) & 0xFF);
+}
+
+/*
+   ============================================================================
+	puterr() -- write a character to stderr
+   ============================================================================
+*/
+
+int
+puterr(c)
+{
+	return(putc(c, stderr));
+}
+
Index: libcio/putl.c
===================================================================
--- libcio/putl.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/putl.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,27 @@
+/*
+   ============================================================================
+	putl.c -- put a Motorola 68000 long word onto a stream file
+	Version 2 -- 1987-10-15 -- D.N. Lynx Crowe
+
+	WARNING:  This fails if the stream is ASCII.
+   ============================================================================
+*/
+
+#include "stdio.h"
+#include "stddefs.h"
+
+putl(w, stream)
+register long w;
+register FILE *stream;
+{
+	if (putc(((w >> 24) & 0xFF), stream) < 0 ) 
+		return;
+
+	if (putc(((w >> 16) & 0xFF), stream) < 0 ) 
+		return;
+
+	if (putc(((w >> 8) & 0xFF), stream) < 0 ) 
+		return;
+
+	putc((w & 0xFF), stream);
+}
Index: libcio/putw.c
===================================================================
--- libcio/putw.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/putw.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,21 @@
+/*
+   ============================================================================
+	putw.c -- put a word onto a stream file
+	Version 3 -- 1987-10-15 -- D.N. Lynx Crowe
+
+	WARNING:  This fails if the stream is ASCII.
+   ============================================================================
+*/
+
+#include "stdio.h"
+#include "stddefs.h"
+
+putw(w, stream)
+register unsigned w;
+FILE *stream;
+{
+	if (putc(((w >> 8) & 0xFF), stream) < 0 ) 
+		return;
+
+	putc((w & 0xFF), stream);
+}
Index: libcio/read.c
===================================================================
--- libcio/read.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/read.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,184 @@
+/*
+   =============================================================================
+	read.c -- file read functions for the C I/O Library
+	Version 9 -- 1987-10-28 -- D.N. Lynx Crowe
+
+	int
+	read(fd, buff, len)
+	char *buff;
+
+		Reads 'len' bytes from file 'fd' into 'buff'.
+		Returns FAILURE (-1) for errors, number of bytes read
+		if successful.
+
+	int
+	_getsec(fp, buf, len)
+	register struct fcb *fp;
+	char *buf;
+	unsigned len;
+
+		Gets 'len' bytes into 'buf' from file 'fp'.
+		Returns FAILURE (-1) for errors, SUCCESS (0) if successful.
+
+	int
+	_filerd(fp, buffer, len)
+	register struct fcb *fp;
+	char *buffer;
+	unsigned len;
+
+		Reads 'len' bytes into 'buffer' from 'fp'.
+		Returns FAILURE (-1) for errors, number of bytes read
+		if successful.
+
+   =============================================================================
+*/
+
+#define	DEBUGIT		0
+
+#include "biosdefs.h"
+#include "io.h"
+#include "errno.h"
+#include "fcntl.h"
+#include "stddefs.h"
+
+#if	DEBUGIT
+extern	short	fsdebug;
+#endif
+
+extern	int	_badfd(), _conin(), _seek();
+
+extern	char	*memcpy();
+
+int	_filerd();
+
+static int (*t_read[])() = {
+
+	_badfd,		/* 0 - invalid type */
+	_filerd,	/* 1 - disk file read */
+	_conin		/* 2 - console read */
+};
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	read(fd, buff, len) -- Reads 'len' bytes from file 'fd' into 'buff'.
+	Returns FAILURE (-1) for errors, number of bytes read if successful.
+   =============================================================================
+*/
+
+int
+read(fd, buff, len)
+int fd;
+char *buff;
+unsigned len;
+{
+	register struct channel *chp;
+
+	if (fd < 0 OR fd > MAXCHAN) {	/* check fd range */
+
+		errno = EBADF;	/* bad fd */
+		return(FAILURE);
+	}
+
+	chp = &chantab[fd];	/* point at the channel table */
+	return((*t_read[chp->c_read])(chp->c_arg, buff, len));	/* do the read */
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_getsec(fp, buf, len) -- Gets 'len' bytes into 'buf' from file 'fp'.
+	Returns FAILURE (-1) for errors, SUCCESS (0) if successful.
+   =============================================================================
+*/
+
+int
+_getsec(fp, buf, len)
+register struct fcb *fp;
+char *buf;
+unsigned len;
+{
+	if ((errno = ReadRN(fp, Wrkbuf)) NE 0)	/* get current sector */
+		return(FAILURE);
+
+	memcpy(buf, Wrkbuf + fp->offset, len);	/* move what we need */
+
+	if ((fp->offset = (fp->offset + len) & (BPSEC - 1)) EQ 0) {
+
+		++fp->curlsn;			/* advance the sector number */
+
+		if (_seek(fp) < 0)		/* seek to the next sector */
+			return(FAILURE);
+	}
+
+	return(SUCCESS);			/* return:  all bytes read */
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	_filerd(fp, buffer, len) -- Reads 'len' bytes into 'buffer' from 'fp'.
+	Returns FAILURE (-1) for errors, number of bytes read if successful.
+   =============================================================================
+*/
+
+int
+_filerd(fp, buffer, len)
+register struct fcb *fp;
+char *buffer;
+unsigned len;
+{
+	register unsigned l;
+	register unsigned j, k;
+	register long curpos, newpos;
+
+	l = 0;
+	curpos = fp->offset + (fp->curlsn << FILESHFT);
+	newpos = curpos + len;
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("_filerd():  len=%u, curpos=%ld, newpos=%ld, curlen=%ld\n",
+			len, curpos, newpos, fp->curlen);
+#endif
+
+	if (newpos GT fp->curlen) {
+
+		len = fp->curlen - curpos;
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("_filerd():  len adjusted to %u\n", len);
+#endif
+	}
+
+	if (fp->offset) {	/* see if we start in the middle of a sector */
+
+		if ((l = BPSEC - fp->offset) > len)	/* see what we need */
+			l = len;
+
+		if (_getsec(fp, buffer, l))	/* read what we can */
+			return(len);	/* return if ERROR */
+	}
+
+	if (k = (len - l) / BPSEC)		/* see what we still need */
+			if ((j = blkrd(fp, buffer + l, k)) NE 0)
+			return((k - j) * BPSEC + l);	/* return bytes read */
+
+	l += k * BPSEC;			/* adjust l by what we just read */
+
+	if (l < len)	/* see if we still need a partial sector */
+		if (_getsec(fp, buffer + l, len - l))	/* read partial sector */
+			return(l);		/* return if ERROR or EOF */
+
+	return(len);				/* return - got the whole thing */
+}
Index: libcio/readrn.c
===================================================================
--- libcio/readrn.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/readrn.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,84 @@
+/*
+   =============================================================================
+	readrn.c -- read a random sector from a file
+	Version 8 -- 1987-12-15 -- D.N. Lynx Crowe
+
+	int
+	ReadRN(fcp, buf)
+	struct fcb *fcp;
+	char *buf;
+
+		Reads a sector from file 'fcp' into 'buf'.  Seeks as needed.
+		Returns 0 if OK, -1 for errors, 1 for EOF (no data returned).
+   =============================================================================
+*/
+
+#define	DEBUGIT		0
+
+#include "stddefs.h"
+#include "biosdefs.h"
+#include "errno.h"
+#include "errdefs.h"
+#include "fspars.h"
+
+#if	DEBUGIT
+extern	short	fsdebug;
+#endif
+
+#if	TBUFFER
+extern	long	_secrd();
+#endif
+
+extern	long	_berrno;
+extern	int	_seek();
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	ReadRN(fcp, buf) -- Reads a sector from file 'fcp' into 'buf'.
+	Seeks as needed.  Returns SUCCESS (0) if OK,  FAILURE (-1) for errors.
+   =============================================================================
+*/
+
+int
+ReadRN(fcp, buf)
+struct fcb *fcp;
+char *buf;
+{
+	int	sv;		/* seek return code */
+	long	brc;		/* bios return code */
+
+	if (sv = _seek(fcp))		/* try to find the sector we want */
+		if (sv < 0) {
+
+			errno = EIO;		/* I/O error */
+			return(-1);		/* return:  ERROR */
+
+		} else {
+
+			errno = EINVAL;		/* invalid argument */
+			return(1);		/* return:  EOF */
+		}
+
+#if	DEBUGIT
+	if (fsdebug)
+		printf("ReadRN():  curlsn=%ld, curdsn=%ld, offset=%u\n",
+			fcp->curlsn, fcp->curdsn, fcp->offset);
+#endif
+
+#if	TBUFFER
+	if (brc = _secrd(buf, (short)fcp->curdsn)) {
+#else
+	if (brc = BIOS(B_RDWR, 0, buf, 1, (short)fcp->curdsn, 0)) {
+#endif
+
+		_berrno = brc;			/* log the error */
+		errno = EIO;			/* ... as an I/O error */
+		return(FAILURE);		/* return:  ERROR */
+	}
+
+	return(SUCCESS);		/* return:  SUCCESS */
+}
Index: libcio/rename.c
===================================================================
--- libcio/rename.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/rename.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,14 @@
+/*
+   =============================================================================
+	rename.c -- rename a file
+	Version 2 -- 1987-06-29 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+rename(old, new)
+char *old, *new;
+{
+	char buff[60];
+
+	return(-1);		/* return an error for now */
+}
Index: libcio/scan.c
===================================================================
--- libcio/scan.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/scan.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,399 @@
+/*
+   =============================================================================
+	scan.c -- input scan conversion for the portable C I/O Library
+	Version 3 -- 1989-01-16 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "stdio.h"
+#include "stddefs.h"
+#include "ctype.h"
+
+static int maxwide;
+static int (*gsub)();
+
+extern char *index();
+
+static char *scnstr;
+static char quit;
+
+/* 
+
+*/
+
+static
+long
+getnum(list, values, base)
+char *list;
+char *values;
+int base;
+{
+	register long val;
+	register char *cp;
+	int c;
+	int sign;
+
+	if (maxwide LE 0)
+		return(0L);
+
+	val = sign = 0;
+
+	if ((c = (*gsub)(0)) EQ '-') {
+
+		sign = 1;
+		--maxwide;
+
+	} else if (c EQ '+')
+		--maxwide;
+	else
+		(*gsub)(1);
+
+	while (maxwide--) {
+
+		if ((cp = index(list, (*gsub)(0))) EQ NULL) {
+
+			(*gsub)(1);
+			break;
+		}
+
+		val *= base;
+		val += values[(long)cp - (long)list];
+	}
+
+	if (sign)
+		val = -val;
+
+	return(val);
+}
+
+/* 
+
+*/
+
+static
+skipblk()
+{
+	while (isspace((*gsub)(0)))
+		;
+
+	if ((*gsub)(1) EQ EOF)
+		return(EOF);
+
+	return(0);
+}
+
+static
+sgetc(what)
+{
+	if (what EQ 0) {
+
+		if (*scnstr)
+			return(*scnstr++ & 0x00FF);
+
+		quit = TRUE;
+
+	} else {
+
+		if (!quit)
+			return(*--scnstr & 0x00FF);
+	}
+
+	return(EOF);
+}
+
+/* 
+
+*/
+
+scanfmt(getsub, fmt, args)
+int (*getsub)();
+register char *fmt;
+int **args;
+{
+
+#ifdef FLOAT
+	double getflt(), d;
+#endif
+
+	long lv;
+	int c, count, dontdo, lflag, base;
+	char *cp;
+	char tlist[130];
+
+	static char list[] = "ABCDEFabcdef9876543210";
+
+	static char vals[] = {
+
+		10,11,12,13,14,15,10,11,12,13,14,15,9,8,7,6,5,4,3,2,1,0
+	};
+
+/* 
+
+*/
+	count = 0;
+	gsub = getsub;
+
+	while (c = *fmt++) {
+
+		if (c EQ '%') {
+
+			lflag = dontdo = FALSE;
+			maxwide = 127;
+
+			if (*fmt EQ '*') {
+				++fmt;
+				dontdo = 1;
+			}
+
+			if (isdigit(*fmt)) {
+
+				maxwide = 0;
+
+				do {
+
+					maxwide = maxwide*10 + *fmt - '0';
+
+				} while (isdigit(*++fmt));
+			}
+
+			if (*fmt EQ 'l') {
+
+				lflag = TRUE;
+				++fmt;
+			}
+	
+/* 
+
+*/
+			switch (*fmt++) {
+
+			case '%':
+				c = '%';
+				goto matchit;
+
+			case 'h':	/* specify short (for compatibility) */
+				lflag = FALSE;
+				goto decimal;
+
+			case 'D':
+				lflag = TRUE;
+
+			case 'd':
+	decimal:
+				c = 12;
+				base = 10;
+				goto getval;
+
+			case 'X':
+				lflag = TRUE;
+
+			case 'x':
+				c = 0;
+				base = 16;
+				goto getval;
+
+			case 'O':
+				lflag = TRUE;
+
+			case 'o':
+				c = 14;
+				base = 8;
+	getval:
+				if (skipblk())
+					goto ateof;
+
+				lv = getnum(&list[c], &vals[c], base);
+
+				if (!dontdo) {
+
+					if (lflag)
+						*(long *)(*args++) = lv;
+					else
+						**args++ = lv;
+					++count;
+				}
+
+				break;
+/* 
+
+*/
+
+#ifdef FLOAT
+			case 'E':
+			case 'F':
+				lflag = TRUE;
+
+			case 'e':
+			case 'f':
+				if (skipblk())
+					goto ateof;
+
+				d = getflt(tlist);
+
+				if (!dontdo) {
+
+					if (lflag)
+						*(double *)(*args++) = d;
+					else
+						*(float *)(*args++) = d;
+					++count;
+				}
+
+				break;
+#endif
+
+/* 
+
+*/
+
+			case '[':
+				lflag = FALSE;
+
+				if (*fmt EQ '^' || *fmt EQ '~') {
+
+					++fmt;
+					lflag = TRUE;
+				}
+
+				for (cp = tlist ; (c = *fmt++) != ']' ; )
+					*cp++ = c;
+
+				*cp = 0;
+				goto string;
+
+			case 's':
+				lflag = TRUE;
+				tlist[0] = ' ';
+				tlist[1] = '\t';
+				tlist[2] = '\n';
+				tlist[3] = 0;
+		string:
+				if (skipblk())
+					goto ateof;
+
+				if (!dontdo)
+					cp = *args++;
+
+				while (maxwide--) {
+
+					if ((c = (*gsub)(0)) EQ EOF)
+						break;
+
+					if (lflag ?
+					     (index(tlist, c) NE 0) :
+					     (index(tlist, c) EQ 0)) {
+
+						(*gsub)(1);	/* unget last character */
+						break;
+					}
+
+					if (!dontdo)
+						*cp++ = c;
+				}
+
+				if (!dontdo) {
+
+					*cp = 0;
+					++count;
+				}
+
+				break;
+/* 
+
+*/
+			case 'c':
+				if ((c = (*gsub)(0)) EQ EOF)
+					goto ateof;
+
+				if (!dontdo) {
+
+					*(char *)(*args++) = c;
+					++count;
+				}
+
+				break;
+			}
+
+		} else if (isspace(c)) {
+
+			if (skipblk()) {
+ateof:
+				if (count EQ 0)
+					return(EOF);
+
+				return(count);
+			}
+
+		} else {
+
+matchit:
+			if (skipblk())
+				goto ateof;
+
+			if ((*gsub)(0) != c)
+				return(count);
+		}
+	}
+
+	return(count);
+}
+
+/* 
+
+*/
+
+#ifdef FLOAT
+
+double
+getflt(buffer)
+char *buffer;
+{
+	register int c;
+	char decpt, sign, exp;
+	register char *cp;
+	double atof();
+
+	cp = buffer;
+	sign = exp = decpt = 0;
+
+	while (maxwide--) {
+
+		c = (*gsub)(0);
+
+		if (!sign AND (c EQ '-' OR c EQ '+'))
+			sign = 1;
+		else if (!decpt AND c EQ '.')
+			decpt = 1;
+		else if (!exp AND (c EQ 'e' OR c EQ 'E')) {
+
+			sign = 0;
+			exp = decpt = 1;
+
+		} else if (!isdigit(c)) {
+
+			(*gsub)(1);
+			break;
+		}
+
+		*cp++ = c;
+	}
+
+	*cp = 0;
+	return(atof(buffer));
+}
+
+#endif
+
+/* 
+
+*/
+
+sscanf(string, fmt, args)
+char *string, *fmt;
+int *args;
+{
+	scnstr = string;
+	quit = FALSE;
+	return(scanfmt(sgetc, fmt, &args));
+}
+
Index: libcio/setbuf.c
===================================================================
--- libcio/setbuf.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/setbuf.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,27 @@
+/*
+   ============================================================================
+	setbuf.c -- set a stream buffer
+	Version 1 -- 1987-06-26 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+#include "stdio.h"
+
+setbuf(stream, buffer)
+register FILE *stream;
+char *buffer;
+{
+	if (stream->_buff)
+		return;
+
+	if (buffer) {
+
+		stream->_buff = buffer;
+		stream->_buflen = BUFSIZ;
+
+	} else {
+
+		stream->_buff = &stream->_bytbuf;
+		stream->_buflen = 1;
+	}
+}
Index: libcio/ungetc.c
===================================================================
--- libcio/ungetc.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/ungetc.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,22 @@
+/*
+   ============================================================================
+	ungetc.c -- 'unget' a character
+	Version 2 -- 1987-06-26 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+#include "stdio.h"
+#include "stddefs.h"
+
+int
+ungetc(c, ptr)
+register int c;
+register FILE *ptr;
+{
+	if ((c EQ EOF) OR (ptr->_bp LE ptr->_buff))
+		return(EOF);
+
+	*--ptr->_bp = c;
+
+	return(c);
+}
Index: libcio/unlink.c
===================================================================
--- libcio/unlink.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/unlink.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,46 @@
+/*
+   =============================================================================
+	unlink.c -- unlink (delete) a file
+	Version 6 -- 1987-11-15 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#define	DEBUGIT		0
+
+#include "biosdefs.h"
+#include "stddefs.h"
+
+#if	DEBUGIT
+extern	short	fsdebug;
+
+extern	int	waitcr();
+#endif
+
+extern	int	DelFile();
+
+/*
+   =============================================================================
+	unlink(name) -- delete file 'name'.
+   =============================================================================
+*/
+
+int
+unlink(name)
+char *name;
+{
+	struct fcb delfcb;
+
+	if (fcbinit(name, &delfcb))
+		return(FAILURE);
+
+#if	DEBUGIT
+	if (fsdebug) {
+
+		printf("unlink(%s):  deletion FCB created\n", name);
+		SnapFCB(&delfcb);
+		waitcr();
+	}
+#endif
+	return(DelFile(&delfcb));
+}
+
Index: libcio/write.c
===================================================================
--- libcio/write.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/write.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,267 @@
+/*
+   ============================================================================
+	write.c -- write() and friends
+	Version 17 -- 1987-10-27 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+#define	DEBUGIT		0
+
+#include "biosdefs.h"
+#include "io.h"
+#include "errno.h"
+#include "stddefs.h"
+
+int	_filewr();
+
+extern	int	_badfd(), _conwr(), blkwr();
+extern	int	ReadRN(), WriteRN();
+extern	int	_newcls(), micons(), _ptcl12();
+
+extern	long	miconl();
+
+extern	char	*memset();
+
+extern	short	_fatmod;
+
+extern	unsigned	_thefat[];
+
+extern	struct	bpb	*_thebpb;
+
+#if DEBUGIT
+extern	short	fsdebug;
+#endif
+
+static	int	(*wr_tab[])() = {	/* write routine dispatch table */
+
+	_badfd,		/* 0 - invalid entry */
+	_filewr,	/* 1 - disk file */
+	_conwr		/* 2 - console device */
+};
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	_putsec(fp, buf, len) -- write 'len' bytes from 'buf' on file 'fp'
+   ============================================================================
+*/
+
+int
+_putsec(fp, buf, len)
+register struct fcb *fp;
+char *buf;
+unsigned len;
+{
+#if DEBUGIT
+	if (fsdebug)
+		printf("_putsec($%08lX, $%08lx, %d):  initial curlsn=%ld\n",
+			fp, buf, len, fp->curlsn);
+#endif
+
+	if ((errno = ReadRN(fp, Wrkbuf)) EQ 1) {	/* try to read sector */
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_putsec():  ReadRN saw EOF at curlsn=%ld, asects=%ld\n",
+			fp->curlsn, fp->asects);
+#endif
+
+		errno = 0;			/* we're at EOF */
+		memset(Wrkbuf, 0x1A, BPSEC);	/* pad end of sector */
+
+	} else if (errno)
+			return(FAILURE);
+
+	memcpy(Wrkbuf + fp->offset, buf, len);	/* move in the new data */
+
+	if ((errno = WriteRN(fp, Wrkbuf)) NE 0) {	/* write the sector */
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_putsec():  WriteRN() FAILED (%d) - curlsn=%ld\n",
+			errno, fp->curlsn);
+#endif
+
+		return(FAILURE);
+	}
+
+	if ((fp->offset = (fp->offset + len) & (BPSEC - 1)) EQ 0) {
+
+		++fp->curlsn;		/* update file position */
+
+		if (_seek(fp) < 0) {
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_putsec():  _seek() failed - curlsn=%ld, asects=%ld\n",
+			fp->curlsn, fp->asects);
+#endif
+
+			return(FAILURE);
+		}
+	}
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_putsec():  final curlsn=%ld, offset=%d, len=%d\n",
+			fp->curlsn, fp->offset, len);
+#endif
+
+	return(SUCCESS);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	_filewr(fp, buffer, len) -- write 'len' bytes on file 'fp'
+	from 'buffer'.
+   ============================================================================
+*/
+
+int
+_filewr(fp, buffer, len)
+register struct fcb *fp;
+register char *buffer;
+register unsigned len;
+{
+	register unsigned j, k, l;
+	int clustr;
+	register long curpos;
+
+	curpos = fp->offset + (fp->curlsn << FILESHFT);	/* get position */
+
+	if (fp->de.bclust EQ 0) {	/* see if we need to allocate */
+
+#if DEBUGIT
+	if (fsdebug)
+		if (curpos)
+			printf("_filewr():  ERROR - bclust EQ 0 and curpos (%ld) NE 0\n",
+				curpos);
+#endif
+
+		if (0 EQ (clustr = _newcls())) {	/* allocate a cluster */
+
+			errno = EIO;
+			return(len);
+		}
+
+		fp->de.bclust = micons(clustr);		/* update FCB */
+		_ptcl12(_thefat, clustr, 0x0FF8);	/* update FAT */
+		_fatmod = TRUE;
+		fp->curdsn = _cl2lsn(_thebpb, clustr);	/* set curdsn */
+		fp->curcls = clustr;
+		fp->clsec = 0;
+		fp->asects = _thebpb->clsiz;
+#if DEBUGIT
+	if (fsdebug) {
+
+		printf("_filewr():  allocated initial cluster=%d, asects=%ld\n",
+			clustr, fp->asects);
+		SnapFCB(fp);
+	}
+#endif
+	}
+
+	l = 0;			/* zero the length-written counter */
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_filewr():  init pos=%ld, len=%u, curcls=%u, offset=%u\n",
+			curpos, len, fp->curcls, fp->offset);
+#endif
+
+	if (fp->offset) {	/* see if we have a partial sector to fill */
+
+		if ((l = (BPSEC - fp->offset)) > len)
+			l = len;
+
+		if (_putsec(fp, buffer, l))	/* fill up the sector */
+			return(-1);
+	}
+
+	if (k = (len - l) / BPSEC) {	/* write out any full sectors */
+
+		if ((j = blkwr(fp, buffer + l, k)) NE 0) {
+
+			l += (k - j) * BPSEC;	/* update amount written */
+
+			if ((curpos + l) > fp->curlen) 	/* udpate file length */
+				fp->de.flen = miconl(fp->curlen = curpos + l);
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_filewr():  ERROR - curlen=%ld, curlsn=%ld, curdsn=%ld\n",
+			fp->curlen, fp->curlsn, fp->curdsn);
+#endif
+
+			return(l);
+		}
+
+		l += k * BPSEC;		/* update amount written */
+	}
+/* 
+
+*/
+	if (l < len) {			/* write out partial sector at end */
+
+		if (_putsec(fp, buffer + l, len - l)) {
+
+			if ((curpos + l) > fp->curlen)	/* update file length */
+				fp->de.flen = miconl(fp->curlen = curpos + l);
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_filewr():  ERROR - curlen=%ld, curlsn=%ld, curdsn=%ld\n",
+			fp->curlen, fp->curlsn, fp->curdsn);
+#endif
+
+			return(l);
+		}
+	}
+
+	if ((curpos + len) > fp->curlen) 		/* update file length */
+		fp->de.flen = miconl(fp->curlen = curpos + len);
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_filewr():  final curlen=%ld, flen=$%08lX, curlsn=%ld, curdsn=%ld\n",
+			fp->curlen, fp->de.flen, fp->curlsn, fp->curdsn);
+#endif
+
+	return(len);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	write(fd, buff, len) -- write 'len' bytes from 'buff' on file 'fd'
+   ============================================================================
+*/
+
+int
+write(fd, buff, len)
+int fd;
+char *buff;
+unsigned len;
+{
+	register struct channel *chp;
+
+	if ((fd < 0) OR (fd > MAXCHAN)) {
+
+		errno = EBADF;
+		return(-1);
+	}
+
+	chp = &chantab[fd];
+
+	return((*wr_tab[chp->c_write])(chp->c_arg, buff, len));
+}
Index: libcio/writern.c
===================================================================
--- libcio/writern.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libcio/writern.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,267 @@
+/*
+   ============================================================================
+	write.c -- write() and friends
+	Version 17 -- 1987-10-27 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+#define	DEBUGIT		0
+
+#include "biosdefs.h"
+#include "io.h"
+#include "errno.h"
+#include "stddefs.h"
+
+int	_filewr();
+
+extern	int	_badfd(), _conwr(), blkwr();
+extern	int	ReadRN(), WriteRN();
+extern	int	_newcls(), micons(), _ptcl12();
+
+extern	long	miconl();
+
+extern	char	*memset();
+
+extern	short	_fatmod;
+
+extern	unsigned	_thefat[];
+
+extern	struct	bpb	*_thebpb;
+
+#if DEBUGIT
+extern	short	fsdebug;
+#endif
+
+static	int	(*wr_tab[])() = {	/* write routine dispatch table */
+
+	_badfd,		/* 0 - invalid entry */
+	_filewr,	/* 1 - disk file */
+	_conwr		/* 2 - console device */
+};
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	_putsec(fp, buf, len) -- write 'len' bytes from 'buf' on file 'fp'
+   ============================================================================
+*/
+
+int
+_putsec(fp, buf, len)
+register struct fcb *fp;
+char *buf;
+unsigned len;
+{
+#if DEBUGIT
+	if (fsdebug)
+		printf("_putsec($%08lX, $%08lx, %d):  initial curlsn=%ld\n",
+			fp, buf, len, fp->curlsn);
+#endif
+
+	if ((errno = ReadRN(fp, Wrkbuf)) EQ 1) {	/* try to read sector */
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_putsec():  ReadRN saw EOF at curlsn=%ld, asects=%ld\n",
+			fp->curlsn, fp->asects);
+#endif
+
+		errno = 0;			/* we're at EOF */
+		memset(Wrkbuf, 0x1A, BPSEC);	/* pad end of sector */
+
+	} else if (errno)
+			return(FAILURE);
+
+	memcpy(Wrkbuf + fp->offset, buf, len);	/* move in the new data */
+
+	if ((errno = WriteRN(fp, Wrkbuf)) NE 0) {	/* write the sector */
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_putsec():  WriteRN() FAILED (%d) - curlsn=%ld\n",
+			errno, fp->curlsn);
+#endif
+
+		return(FAILURE);
+	}
+
+	if ((fp->offset = (fp->offset + len) & (BPSEC - 1)) EQ 0) {
+
+		++fp->curlsn;		/* update file position */
+
+		if (_seek(fp) < 0) {
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_putsec():  _seek() failed - curlsn=%ld, asects=%ld\n",
+			fp->curlsn, fp->asects);
+#endif
+
+			return(FAILURE);
+		}
+	}
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_putsec():  final curlsn=%ld, offset=%d, len=%d\n",
+			fp->curlsn, fp->offset, len);
+#endif
+
+	return(SUCCESS);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	_filewr(fp, buffer, len) -- write 'len' bytes on file 'fp'
+	from 'buffer'.
+   ============================================================================
+*/
+
+int
+_filewr(fp, buffer, len)
+register struct fcb *fp;
+register char *buffer;
+register unsigned len;
+{
+	register unsigned j, k, l;
+	int clustr;
+	register long curpos;
+
+	curpos = fp->offset + (fp->curlsn << FILESHFT);	/* get position */
+
+	if (fp->de.bclust EQ 0) {	/* see if we need to allocate */
+
+#if DEBUGIT
+	if (fsdebug)
+		if (curpos)
+			printf("_filewr():  ERROR - bclust EQ 0 and curpos (%ld) NE 0\n",
+				curpos);
+#endif
+
+		if (0 EQ (clustr = _newcls())) {	/* allocate a cluster */
+
+			errno = EIO;
+			return(len);
+		}
+
+		fp->de.bclust = micons(clustr);		/* update FCB */
+		_ptcl12(_thefat, clustr, 0x0FF8);	/* update FAT */
+		_fatmod = TRUE;
+		fp->curdsn = _cl2lsn(_thebpb, clustr);	/* set curdsn */
+		fp->curcls = clustr;
+		fp->clsec = 0;
+		fp->asects = _thebpb->clsiz;
+#if DEBUGIT
+	if (fsdebug) {
+
+		printf("_filewr():  allocated initial cluster=%d, asects=%ld\n",
+			clustr, fp->asects);
+		SnapFCB(fp);
+	}
+#endif
+	}
+
+	l = 0;			/* zero the length-written counter */
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_filewr():  init pos=%ld, len=%u, curcls=%u, offset=%u\n",
+			curpos, len, fp->curcls, fp->offset);
+#endif
+
+	if (fp->offset) {	/* see if we have a partial sector to fill */
+
+		if ((l = (BPSEC - fp->offset)) > len)
+			l = len;
+
+		if (_putsec(fp, buffer, l))	/* fill up the sector */
+			return(-1);
+	}
+
+	if (k = (len - l) / BPSEC) {	/* write out any full sectors */
+
+		if ((j = blkwr(fp, buffer + l, k)) NE 0) {
+
+			l += (k - j) * BPSEC;	/* update amount written */
+
+			if ((curpos + l) > fp->curlen) 	/* udpate file length */
+				fp->de.flen = miconl(fp->curlen = curpos + l);
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_filewr():  ERROR - curlen=%ld, curlsn=%ld, curdsn=%ld\n",
+			fp->curlen, fp->curlsn, fp->curdsn);
+#endif
+
+			return(l);
+		}
+
+		l += k * BPSEC;		/* update amount written */
+	}
+/* 
+
+*/
+	if (l < len) {			/* write out partial sector at end */
+
+		if (_putsec(fp, buffer + l, len - l)) {
+
+			if ((curpos + l) > fp->curlen)	/* update file length */
+				fp->de.flen = miconl(fp->curlen = curpos + l);
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_filewr():  ERROR - curlen=%ld, curlsn=%ld, curdsn=%ld\n",
+			fp->curlen, fp->curlsn, fp->curdsn);
+#endif
+
+			return(l);
+		}
+	}
+
+	if ((curpos + len) > fp->curlen) 		/* update file length */
+		fp->de.flen = miconl(fp->curlen = curpos + len);
+
+#if DEBUGIT
+	if (fsdebug)
+		printf("_filewr():  final curlen=%ld, flen=$%08lX, curlsn=%ld, curdsn=%ld\n",
+			fp->curlen, fp->de.flen, fp->curlsn, fp->curdsn);
+#endif
+
+	return(len);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	write(fd, buff, len) -- write 'len' bytes from 'buff' on file 'fd'
+   ============================================================================
+*/
+
+int
+write(fd, buff, len)
+int fd;
+char *buff;
+unsigned len;
+{
+	register struct channel *chp;
+
+	if ((fd < 0) OR (fd > MAXCHAN)) {
+
+		errno = EBADF;
+		return(-1);
+	}
+
+	chp = &chantab[fd];
+
+	return((*wr_tab[chp->c_write])(chp->c_arg, buff, len));
+}
Index: libsm/index.c
===================================================================
--- libsm/index.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/index.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,23 @@
+/*
+   ============================================================================
+	index.c -- BSD style index function
+	Version 1 -- 1987-02-11 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+char *
+index(str, c)
+register char *str;
+register char c;
+{
+	while (*str) {
+
+		if (*str == c)
+			return(str);
+
+		++str;
+	}
+
+	return((char *)0);
+}
+
Index: libsm/memccpy.c
===================================================================
--- libsm/memccpy.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/memccpy.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,23 @@
+/*
+   =============================================================================
+	memccpy.c -- copy bytes until character seen
+	Version 1 -- 1987-06-12
+
+	Copy s2 to s1, stopping if character c is copied.
+	Copy no more than n bytes.
+	Return a pointer to the byte after character c in the copy,
+	or NULL if c is not found in the first n bytes.
+   =============================================================================
+*/
+
+char *
+memccpy(s1, s2, c, n)
+register char *s1, *s2;
+register char c;
+register int n;
+{
+        while (--n >= 0)
+                if ((*s1++ = *s2++) == c)
+                        return(s1);
+        return((char *)0);
+}
Index: libsm/memchr.c
===================================================================
--- libsm/memchr.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/memchr.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,20 @@
+/*
+   =============================================================================
+	memchr.c -- search a string for a character
+	Version 1 -- 1987-06-12
+
+	Return the ptr in sp at which the character c appears;
+	NULL if not found in n chars; don't stop at \0.
+   =============================================================================
+*/
+
+char *
+memchr(sp, c, n)
+register char *sp, c;
+register int n;
+{
+        while (--n >= 0)
+                if (*sp++ == c)
+                        return(--sp);
+        return((char *)0);
+}
Index: libsm/memcmp.c
===================================================================
--- libsm/memcmp.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/memcmp.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,22 @@
+/*
+   =============================================================================
+	memcmp.c -- compare memory areas
+	Version 2 -- 1987-06-15
+
+	Compare n bytes:  s1>s2: >0  s1==s2: 0  s1<s2: <0
+   =============================================================================
+*/
+
+int
+memcmp(s1, s2, n)
+register char *s1, *s2;
+register int n;
+{
+	register int	diff;
+
+        if (s1 != s2)
+                while (--n >= 0)
+                        if (diff = *s1++ - *s2++)
+                                return(diff);
+        return(0);
+}
Index: libsm/memcmpu.c
===================================================================
--- libsm/memcmpu.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/memcmpu.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,38 @@
+/*
+   ============================================================================
+	memcmpu -- compare two memory areas while ignoring case
+	Version 4 -- 1987-06-15 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+#include "ctype.h"
+
+int
+memcmpu(s1, s2, n)
+register char *s1, *s2;
+int n;
+{
+	register char c1, c2;
+
+	while (n) {
+
+		c1 = *s1++;
+		c2 = *s2++;
+
+		if (isascii(c1) && islower(c1))
+			c1 = _toupper(c1);
+
+		if (isascii(c2) && islower(c2))
+			c2 = _toupper(c2);
+
+		if (c1 < c2)
+			return(-1);
+
+		if (c1 > c2)
+			return(1);
+
+		n--;
+	}
+
+	return(0);
+}
Index: libsm/memcpy.c
===================================================================
--- libsm/memcpy.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/memcpy.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,21 @@
+/*
+   =============================================================================
+	memcpy.c -- copy memory
+	Version 1 -- 1987-06-12
+
+	Copy s2 to s1, always copy n bytes.
+	Return s1.
+   =============================================================================
+ */
+
+char *
+memcpy(s1, s2, n)
+register char *s1, *s2;
+register int n;
+{
+        register char *os1 = s1;
+
+        while (--n >= 0)
+                *s1++ = *s2++;
+        return (os1);
+}
Index: libsm/memcpyw.c
===================================================================
--- libsm/memcpyw.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/memcpyw.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,21 @@
+/*
+   =============================================================================
+	memcpyw.c -- copy words
+	Version 2 -- 1987-06-15 -- D.N. Lynx Crowe
+
+	Copy s2 to s1, always copy n words.
+	Return pointer to s1.
+   =============================================================================
+*/
+
+short *
+memcpyw(s1, s2, n)
+register short *s1, *s2;
+register int n;
+{
+        register short *os1 = s1;
+
+        while (--n >= 0)
+                *s1++ = *s2++;
+        return (os1);
+}
Index: libsm/memset.c
===================================================================
--- libsm/memset.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/memset.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,22 @@
+/*
+   =============================================================================
+	memset.c -- fill memory
+	Version 1 -- 1987-06-12
+
+	Set an array of n chars starting at sp to the character c.
+	Return sp.
+   =============================================================================
+*/
+
+char *
+memset(sp, c, n)
+register char *sp, c;
+register int n;
+{
+        register char *sp0 = sp;
+
+        while (--n >= 0)
+                *sp++ = c;
+		
+        return(sp0);
+}
Index: libsm/memsetw.c
===================================================================
--- libsm/memsetw.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/memsetw.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,21 @@
+/*
+   =============================================================================
+	memset.c -- fill memory with short words
+	Version 1 -- 1987-03-18 -- D.N. Lynx Crowe
+
+	Set an array of n shorts starting at sp to the short w.
+	Return pointer to sp.
+   =============================================================================
+*/
+
+short *
+memsetw(sp, w, n)
+register short *sp, w, n;
+{
+        register short *sp0 = sp;
+
+        while (--n >= 0)
+                *sp++ = w;
+
+        return(sp0);
+}
Index: libsm/rindex.c
===================================================================
--- libsm/rindex.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/rindex.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,23 @@
+/*
+   ============================================================================
+	rindex.c -- BSD style rindex function
+	Version 2 -- 1987-06-12 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+char *
+rindex(str, c)
+register char *str;
+char c;
+{
+	register char *cp;
+
+	for (cp = str ;*cp++ ; )
+		;
+
+	while (cp > str)
+		if (*--cp == c)
+			return(cp);
+
+	return((char *)0);
+}
Index: libsm/str2lc.c
===================================================================
--- libsm/str2lc.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/str2lc.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,19 @@
+/*
+   ============================================================================
+	str2lc(s) -- convert string s to lower case ASCII
+	Version 2 -- 1987-06-12 -- Copyright 1987 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+char *
+str2lc(s)
+register char *s;
+{
+	register char c;
+	register char *r = s;
+
+	while (c = *s)
+		*s++ = tolower(c);
+
+	return(r);
+}
Index: libsm/str2uc.c
===================================================================
--- libsm/str2uc.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/str2uc.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,19 @@
+/*
+   ============================================================================
+	str2uc(s) -- converts string s to upper case ASCII
+	Version 2 -- 1987-06-12 -- (c) Copyright 1987 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+char *
+str2uc(s)
+register char *s;
+{
+	register char c;
+	register char *r = s;
+
+	while (c = *s)
+		*s++ = toupper(c);
+
+	return(r);
+}
Index: libsm/strcat.c
===================================================================
--- libsm/strcat.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strcat.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,28 @@
+/*
+   =============================================================================
+	strcat.c -- concatenate strings
+	Version 1 -- 1987-06-12
+
+	Concatenate s2 onto the end of s1.  S1's space must be large enough.
+	Return s1.
+   =============================================================================
+*/
+
+char *
+strcat(s1, s2)
+register char *s1, *s2;
+{
+        register char *os1;
+
+        os1 = s1;
+
+        while(*s1++)
+                ;
+
+        --s1;
+
+        while(*s1++ = *s2++)
+                ;
+
+        return(os1);
+}
Index: libsm/strccpy.c
===================================================================
--- libsm/strccpy.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strccpy.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,31 @@
+/*
+   =============================================================================
+	strccpy.c -- copy string up to specified character
+	Version 1 -- 1987-04-03 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+/*
+   =============================================================================
+	strccpy(s1, s2, c) -- copy string up to specified character
+
+	Copy string s2 to s1 up to but not including the first occurrence of c.
+	s1 must be large enough to contain the copied bytes.
+	No checking is done. Character c is not copied.  Returns s1.
+   =============================================================================
+ */
+
+char *
+strccpy(s1, s2, c)
+register char *s1, *s2, c;
+{
+        register char *os1;
+	register char x;
+
+        os1 = s1;
+
+        while(c != (x = *s1++))
+		*s2++ = x;
+
+        return(os1);
+}
Index: libsm/strchr.c
===================================================================
--- libsm/strchr.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strchr.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,22 @@
+/*
+   =============================================================================
+	strchr.c -- find a character in a string
+
+	Return the ptr in sp at which the character c appears;
+	NULL if not found
+   =============================================================================
+*/
+
+#define NULL    0
+
+char *
+strchr(sp, c)
+register char *sp, c;
+{
+	do {
+		if(*sp == c)
+			return(sp);
+	} while(*sp++);
+
+	return((char *)NULL);
+}
Index: libsm/strcmp.c
===================================================================
--- libsm/strcmp.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strcmp.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,22 @@
+/*
+   =============================================================================
+	strcmp.c -- compare strings
+	Version 2 -- 1987-06-15
+
+	Compare strings:  s1>s2: >0  s1==s2: 0  s1<s2: <0
+   =============================================================================
+*/
+
+int
+strcmp(s1, s2)
+register char *s1, *s2;
+{
+	if(s1 == s2)
+		return(0);
+
+	while(*s1 == *s2++)
+		if(*s1++ == '\0')
+			 return(0);
+
+	return((int)*s1 - (int)*--s2);
+}
Index: libsm/strcpy.c
===================================================================
--- libsm/strcpy.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strcpy.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,23 @@
+/*
+   =============================================================================
+	strcpy.c -- copy string
+	Version 1 -- 1987-06-12
+
+	Copy string s2 to s1.  s1 must be large enough.
+	return s1
+   =============================================================================
+*/
+
+char *
+strcpy(s1, s2)
+register char *s1, *s2;
+{
+	register char *os1;
+
+	os1 = s1;
+
+	while(*s1++ = *s2++)
+		;
+
+	return(os1);
+}
Index: libsm/strcspn.c
===================================================================
--- libsm/strcspn.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strcspn.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,29 @@
+/*
+   ============================================================================
+	strcspn.c -- character scan function ala' Unix(tm)
+	Version 1 -- 1987-02-11 -- D.N. Lynx Crowe
+
+	Return the number of characters in the maximum leading segment
+	of string which consists solely of characters NOT from charset.
+   ============================================================================
+*/
+
+int
+strcspn(string, charset)
+char    *string;
+register char   *charset;
+{
+        register char *p, *q;
+	register int n = 0;
+
+        for(q = string; *q != '\0'; ++q , ++n) {
+
+                for(p = charset; *p != '\0' && *p != *q; ++p)
+                        ;
+
+                if(*p != '\0')
+                        break;
+        }
+
+        return(n);
+}
Index: libsm/strfill.c
===================================================================
--- libsm/strfill.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strfill.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,32 @@
+/*
+   =============================================================================
+	strfill() -- fill a string with a constant byte and zero terminate it
+	Version 1 -- 1988-08-19 -- D.N. Lynx Crowe
+
+	Where:
+		s = string pointer
+		c = constant byte
+		n = string length (not including the trailing zero)
+
+	Returns a pointer to the string.
+   =============================================================================
+*/
+
+char *
+strfill(s, c, n)
+register char *s;
+register char c;
+register unsigned n;
+{
+	register unsigned i;
+	char *p;
+
+	p = s;
+
+	for (i = n; i--; )
+		*s++ = c;
+
+	*s = '\0';
+	return(p);
+}
+
Index: libsm/strlcmp.c
===================================================================
--- libsm/strlcmp.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strlcmp.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,34 @@
+/*
+   ============================================================================
+	strlcmp(s,l) -- compare string s to list l
+	Version 1 -- 1987-03-03 -- D.N. Lynx Crowe
+
+	Compares string s to each entry in the list l of strings
+	until a match is found or until list l is exhausted.
+	List l consists of a zero-entry terminated array of
+	pointers to zero terminated strings.
+	String s must be zero terminated.
+
+	Returns 0 if no match was found, or the 1-origin index
+	of the string in the list l.
+   ============================================================================
+*/
+
+int
+strlcmp(s,l)
+char *s, *l[];
+{
+	int	rc;
+
+	rc = 0;
+
+	while (l[rc]) {
+
+		if (0 == strcmp(s, l[rc]))
+			return(++rc);
+
+		rc++;
+	}
+
+	return(0);
+}
Index: libsm/strlen.c
===================================================================
--- libsm/strlen.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strlen.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,21 @@
+/*
+   =============================================================================
+	strlen.c -- string length function ala' Unix(tm)
+	Version 1 -- 1987-02-11 -- D.N. Lynx Crowe
+
+	Returns the number of non-NULL bytes in string argument.
+   =============================================================================
+*/
+
+
+int
+strlen(s)
+register char *s;
+{
+        register int n = 0;
+
+        while (*s++ != '\0')
+               ++n;
+
+        return (n);
+}
Index: libsm/strltrm.c
===================================================================
--- libsm/strltrm.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strltrm.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,34 @@
+/*
+   =============================================================================
+	strltrm() -- trim leading blanks from a string, in-place
+	Version 1 -- 1988-08-19 -- D.N. Lynx Crowe
+
+	Returns a pointer to the string.
+   =============================================================================
+*/
+
+#include "stddefs.h"
+
+char *
+strltrm(s)
+register char *s;
+{
+	register char c;
+	register char *lp, *rp;
+
+	if (*s NE ' ')
+		return(s);
+
+	lp = s;
+	rp = s;
+
+	while (*rp EQ ' ')
+		++rp;
+
+	while (c = *rp++)
+		*lp++ = c;
+
+	*lp = '\0';
+
+	return(s);
+}
Index: libsm/strncat.c
===================================================================
--- libsm/strncat.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strncat.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,34 @@
+/*
+   =============================================================================
+	strncat.c -- concatenate strings
+	Version 1 -- 1987-06-12
+
+	Concatenate s2 on the end of s1.  S1's space must be large enough.
+	At most n characters are moved.
+	Return s1.
+   =============================================================================
+*/
+
+char *
+strncat(s1, s2, n)
+register char *s1, *s2;
+register int n;
+{
+	register char *os1;
+
+	os1 = s1;
+
+	while(*s1++)
+		;
+
+	--s1;
+
+	while(*s1++ = *s2++)
+		if(--n < 0) {
+
+			*--s1 = '\0';
+			break;
+		}
+
+	return(os1);
+}
Index: libsm/strncmp.c
===================================================================
--- libsm/strncmp.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strncmp.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,24 @@
+/*
+   =============================================================================
+	strncmp.c -- compare strings
+	Version 2 -- 1987-06-15
+
+	Compare strings (at most n bytes)
+	Returns: s1>s2; >0  s1==s2; 0  s1<s2; <0
+   =============================================================================
+*/
+
+int
+strncmp(s1, s2, n)
+register char *s1, *s2;
+register int n;
+{
+	if (s1 == s2)
+		return(0);
+
+	while ((--n >= 0) && (*s1 == *s2++))
+		if(*s1++ == '\0')
+			return(0);
+
+	return((n < 0) ? 0 : (int)(*s1 - *--s2));
+}
Index: libsm/strncpy.c
===================================================================
--- libsm/strncpy.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strncpy.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,24 @@
+/*
+   =============================================================================
+	strncpy.c -- copy string of n bytes
+	Version 1 -- 1987-06-12
+
+	Copy s2 to s1, truncating or null-padding to always copy n bytes
+	return s1
+   =============================================================================
+*/
+
+char *
+strncpy(s1, s2, n)
+register char *s1, *s2;
+register int n;
+{
+	register char *os1 = s1;
+
+	while (--n >= 0)
+		if ((*s1++ = *s2++) == '\0')
+			while (--n >= 0)
+				*s1++ = '\0';
+
+	return (os1);
+}
Index: libsm/strpbrk.c
===================================================================
--- libsm/strpbrk.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strpbrk.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,30 @@
+/*
+   =============================================================================
+	strpbrk.c -- find a 'break' character in a string
+	Version 1 -- 1987-06-12
+
+	Return ptr to first occurance of any character from `brkset'
+	in the character string `string'; NULL if none exists.
+   =============================================================================
+*/
+
+char *
+strpbrk(string, brkset)
+register char *string, *brkset;
+{
+	register char *p;
+
+	do {
+
+	for (p = brkset; *p != '\0' && *p != *string; ++p)
+		;
+
+	if (*p != '\0')
+		return(string);
+	}
+
+	while(*string++)
+		;
+
+	return((char *)0);
+}
Index: libsm/strrchr.c
===================================================================
--- libsm/strrchr.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strrchr.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,29 @@
+/*
+   =============================================================================
+	strrchr.c -- find last occurrence of a character in a string
+	Version 1 -- 1987-06-12
+
+	Return the ptr in sp at which the character c last
+	appears; NULL if not found.
+   =============================================================================
+*/
+
+#define	NULL	(char *)0
+
+char *
+strrchr(sp, c)
+register char *sp, c;
+{
+	register char *r;
+
+	r = NULL;
+
+	do {
+
+	if (*sp == c)
+		r = sp;
+
+	} while(*sp++);
+
+	return(r);
+}
Index: libsm/strrev.c
===================================================================
--- libsm/strrev.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strrev.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,40 @@
+/*
+   =============================================================================
+	strrev.c -- reverse a string
+	Version 1 -- 1988-02-03 -- D.N. Lynx Crowe
+
+	char *
+	strrev(s1, s2)
+	char *s1;
+	char *s2;
+
+		Copies string 's2' into 's1'.  's1' must be large enough
+		to hold 's2'.  Returns 's1'.
+   =============================================================================
+*/
+
+char *
+strrev(s1, s2)
+char *s1;
+register char *s2;
+{
+	register char *s3;
+	register long i;
+
+	i = 0L;				/* initialize string length */
+	s3 = s1;			/* initialize target left end pointer */
+
+	while (*s2) {			/* find right end of source string */
+
+		++s2;
+		++i;
+	}
+
+	--s2;				/* adjust source right end pointer */
+
+	while (i--)			/* copy string in reverse */
+		*s3++ = *s2--;
+
+	*s3 = '\0';			/* terminate the string */
+	return(s1);			/* return address of reversed string */
+}
Index: libsm/strrevi.c
===================================================================
--- libsm/strrevi.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strrevi.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,43 @@
+/*
+   =============================================================================
+	strrevi.c -- reverse a string in place
+	Version 1 -- 1988-02-03 -- D.N. Lynx Crowe
+
+	char *
+	strrevi(s)
+	char *s;
+
+		Reverses string 's1' in place.  Returns 's1'.
+   =============================================================================
+*/
+
+char *
+strrevi(s)
+char *s;
+{
+	register char *p1, *p2;
+	register long i;
+	register char c;
+
+	p1 = s;			/* initialize left end pointer */
+	p2 = s;			/* initialize right end pointer */
+	i = 0L;			/* initialize character count */
+
+	while (*p2) {		/* find the right end of the string */
+
+		++i;
+		++p2;
+	}
+
+	--p2;			/* adjust right end pointer */
+	i >>= 1;		/* calculate swap count */
+
+	while (i--) {		/* for each pair of characters ... */
+
+		c = *p2;	/* ... swap right and left characters */
+		*p2-- = *p1;
+		*p1++ = c;
+	}
+
+	return(s);		/* return pointer to reversed string */
+}
Index: libsm/strrtrm.c
===================================================================
--- libsm/strrtrm.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strrtrm.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,33 @@
+/*
+   =============================================================================
+	strrtrm() -- trim trailing blanks from a string, in-place
+	Version 1 -- 1988-08-19 -- D.N. Lynx Crowe
+
+	Returns a pointer to the string.
+   =============================================================================
+*/
+
+#include "stddefs.h"
+
+char *
+strrtrm(s)
+char *s;
+{
+	register char *lp, *rp;
+
+	lp = s;
+	rp = s;
+
+	while (*rp)
+		++rp;
+
+	while ((long)(--rp) GE (long)lp) {
+
+		if (*rp EQ ' ')
+			*rp = '\0';
+		else
+			break;
+	}
+
+	return(lp);
+}
Index: libsm/strspn.c
===================================================================
--- libsm/strspn.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strspn.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,31 @@
+/*
+   ============================================================================
+	strspn.c -- string scan function ala' Unix(tm)
+	Version 2 -- 1987-06-12 -- D.N. Lynx Crowe
+
+	Return the number of characters in the maximum leading segment
+	of 'string' which consists solely of characters from 'charset'.
+   ============================================================================
+*/
+
+int
+strspn(string, charset)
+char *string;
+register char *charset;
+{
+	register char *p, *q;
+	register int n = 0;
+
+	for (q = string; *q != '\0'; ++q) {
+
+		for (p = charset; *p != '\0' && *p != *q; ++p)
+			;
+
+		if(*p == '\0')
+			break;
+
+		n++;
+	}
+
+	return(n);
+}
Index: libsm/strtok.c
===================================================================
--- libsm/strtok.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strtok.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,45 @@
+/*
+   =============================================================================
+	strtok.c -- tokenize a string
+	Version 1 -- 1987-06-12
+
+	Uses strpbrk and strspn to break 'string' into tokens on
+	sequentially subsequent calls.  Returns NULL when no
+	non-separator characters remain.
+	'subsequent' calls are calls with first argument == NULL.
+   =============================================================================
+*/
+
+#define	NULL	(char *)0
+
+extern int strspn();
+extern char *strpbrk();
+
+char *
+strtok(string, sepset)
+char *string, *sepset;
+{
+	register char *p, *q, *r;
+	static char *savept;
+
+	/* first or subsequent call ? */
+
+        p = (string == NULL) ? savept : string;
+
+	if (p == 0)              /* return if no tokens remain */
+		return(NULL);
+
+	q = p + strspn(p, sepset);      /* skip leading separators */
+
+	if (*q == '\0')          /* return if no tokens remain */
+		return(NULL);
+
+	if ((r = strpbrk(q, sepset)) == NULL)    /* move past token */
+		savept = 0;     /* indicate this is last token */
+	else {
+		*r = '\0';
+		savept = ++r;
+	}
+
+	return(q);
+}
Index: libsm/strtol.c
===================================================================
--- libsm/strtol.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ libsm/strtol.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,72 @@
+/*
+   =============================================================================
+	strtol.c -- convert a string of ASCII digits to a long
+	Version 1 -- 1987-06-12
+   =============================================================================
+*/
+
+#include "ctype.h"
+
+#define DIGIT(x) (isdigit(x) ? (x)-'0' : islower(x) ? (x)+10-'a' : (x)+10-'A')
+
+#define MBASE   ('z' - 'a' + 1 + 10)
+
+long
+strtol(str, ptr, base)
+register char *str;
+char **ptr;
+register int base;
+{
+	register long val;
+	register int c;
+	int xx, neg = 0;
+
+	if (ptr != (char **)0)
+		*ptr = str; /* in case no number is formed */
+
+	if (base < 0 || base > MBASE)
+		return (0); /* base is invalid -- should be a fatal error */
+
+	if (!isalnum(c = *str)) {
+
+		while (isspace(c))
+			c = *++str;
+
+		switch (c) {
+
+		case '-':
+			neg++;
+
+		case '+': /* fall-through */
+			c = *++str;
+		}
+	}
+
+	if (base == 0)
+		if (c != '0')
+			base = 10;
+		else if (str[1] == 'x' || str[1] == 'X')
+			base = 16;
+		else
+			base = 8;
+	/*
+		for any base > 10, the digits incrementally following
+		9 are assumed to be "abc...z" or "ABC...Z"
+	*/
+
+	if (!isalnum(c) || (xx = DIGIT(c)) >= base)
+		return (0); /* no number formed */
+
+	if (base == 16 && c == '0' && isxdigit(str[2]) &&
+	   (str[1] == 'x' || str[1] == 'X'))
+		c = *(str += 2); /* skip over leading "0x" or "0X" */
+
+	for (val = -DIGIT(c); isalnum(c = *++str) && (xx = DIGIT(c)) < base; )
+		 /* accumulate neg avoids surprises near MAXLONG */
+		val = base * val - xx;
+
+	if (ptr != (char **)0)
+		*ptr = str;
+
+	return (neg ? val : -val);
+}
Index: prolog/croot.c
===================================================================
--- prolog/croot.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ prolog/croot.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,164 @@
+/*
+   ============================================================================
+	croot.c -- Root for Buchla 700 C programs
+	Version 8 -- 1987-06-29 -- D.N. Lynx Crowe
+
+	This version can be setup for I/O redirection or not, depending on the
+	value of REDIRECT.  If redirection is supported, so are command line
+	arguments, which must be passed to Croot() at 'cp' by the startup code.
+
+	Normally, this won't be selected, as this is a dedicated application
+	that doesn't expect command line arguments or I/O redirection.
+   ============================================================================
+*/
+
+#define	ROOTMSG	"{Buchla 700 Croot - Version 8 - 1987-06-29}"
+
+#define	_FS_DEF_		/* to avoid unnecessary externals */
+
+#include "biosdefs.h"
+#include "errno.h"
+#include "fcntl.h"
+#include "io.h"
+#include "stddefs.h"
+
+#define	REDIRECT	0	/* non-zero for command line stuff */
+
+#define	MAXARGS		30	/* maximum number of command line arguments */
+
+extern	int	open(), creat();
+
+extern	int	InitFS();
+extern	int	_fd_cls();
+extern	int	xtrap15();
+
+int (*_clsall)();
+
+/* 
+
+*/
+
+static	int	Argc;
+static	char	*Argv[MAXARGS];
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	exit(code) -- return control to the BIOS
+   ============================================================================
+*/
+
+exit(code)
+{
+	(*_clsall)();		/* close all open files */
+	xtrap15(code);		/* return to the BIOS */
+}
+
+
+#if	REDIRECT
+
+/*
+   ============================================================================
+	_eredir(name) -- output I/O redirection error message to stderr
+   ============================================================================
+*/
+
+static
+_eredir(name)
+char *name;
+{
+	char buff[200];
+
+	strcpy(buff, "Can't open file for redirection: ");
+	strcat(buff, name);
+	strcat(buff, "\n");
+	write(2, buff, strlen(buff));
+	exit(EINVAL);
+}
+
+#endif
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	Croot(cp) -- C root module for the Buchla 700
+   ============================================================================
+*/
+
+Croot(cp)
+register char *cp;
+{
+	register	char	*fname;
+	register	int	k;
+
+	Argv[0] = ROOTMSG;
+	Argc = 1;
+
+	_clsall = _fd_cls;
+	InitFS();
+
+#if	REDIRECT
+
+	while (Argc < MAXARGS) {	/* handle command line arguments */
+
+		while (*cp EQ ' ' OR *cp EQ '\t')	/* skip whitespace */
+			++cp;
+
+		if (*cp EQ 0)			/* check for end of line */
+			break;
+
+		if (*cp EQ '>') {		/* > - redirect output */
+
+			k = 1;	/* stdout */
+			goto redir;
+
+		} else if (*cp EQ '<') {	/* < - redirect input */
+
+			k = 0;	/* stdin */
+redir:
+			while (*++cp EQ ' ' OR *cp EQ '\t')	/* skip whitespace */
+				;
+
+			fname = cp;	/* pointer to start of name */
+
+			while (*++cp)	/* skip to whitespace */
+				if (*cp EQ ' ' OR *cp EQ '\t') {
+
+					*cp++ = 0;
+					break;
+				}
+
+			close(k);	/* close old assignment */
+
+			if (k)
+				k = creat(fname, 0666);		/* stdout */
+			else
+				k = open(fname, O_RDONLY);	/* stdin */
+
+			if (k EQ -1)
+				_eredir(fname);
+
+		} else {	/* collect a command line argument */
+
+			Argv[Argc++] = cp;
+
+			while (*++cp)	/* find end of argument */
+				if (*cp EQ ' ' OR *cp EQ '\t') {
+
+					*cp++ = 0;
+					break;
+				}
+		}
+	}
+
+#endif
+
+	main(Argc,Argv);	/* call application */
+	exit(0);		/* exit in case the application didn't */
+}
Index: prolog/fsmain.s
===================================================================
--- prolog/fsmain.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ prolog/fsmain.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,125 @@
+* ------------------------------------------------------------------------------
+* fsmain.s -- startup code for the Buchla 700 standalone C runtime library
+* Version 3 -- 1987-06-29 -- D.N. Lynx Crowe
+*
+*	This code clears 'bss' space, sets up some global variables,
+*	and calls Croot(), which sets up the file system and calls main().
+*
+*	This routine should be entered with the address of the basepage
+*	as its parameter.
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	start_
+*
+		.xref	_Croot
+*
+		.xdef	_panic
+		.xdef	_brk
+*
+		.xdef	__heap
+		.xdef	__break
+		.xdef	__pmesg
+*
+		.xdef	_errno
+*
+p_bbase		.equ	$18		* bss base
+p_blen		.equ	$1C		* bss length
+*
+		.page
+*
+* start_ -- Initial entry point -- Must be first object file in link statement
+* ------    ------------------------------------------------------------------
+*
+* WARNING:  Hazardous assumptions
+*
+* We assume that: 
+*
+* 	the system has set the stack pointer for us.
+* 	the system passed us a pointer to a valid basepage.
+* 	the stack is above the heap.
+*	BSS is located in RAM.
+*
+* If any of these assumptions is in error, we're in for serious trouble.
+*
+start_:		clr.l	a6		* Clear frame pointer
+		movea.l	4(a7),a1	* Set pointer to base page
+		movea.l	p_bbase(a1),a0	* Setup to clear bss space
+*
+start1:		clr.w	(a0)+		* Clear a word
+		cmpa.l	a0,a7		* See if we're done
+		bne	start1		* Loop if not done yet
+*
+		move.l	p_bbase(a1),d0	* Calculate break address
+		add.l	p_blen(a1),d0	* ...
+		move.l	d0,__break	* Set initial break
+		move.l	d0,__heap	* Set heap start
+*
+		move.l	#0,-(a7)	* Pass NULL to Croot  (no command line)
+		jsr	_Croot		* call Croot() routine
+		addq.l	#4,a7		* ...
+*
+		move.l	#pmsg1,-(a7)	* panic(pmsg1);
+		jsr	_panic		* ...
+		addq.l	#4,a7		* ...
+*
+hstop:		stop	#$2000		* "Die, sucker!"
+		bra	hstop
+*
+		.page
+*
+* _panic -- hard halt for fatal errors
+* ------    --------------------------
+_panic:		movea.l	4(a7),a0	* Save panic message address
+		move.l	a0,__pmesg	* ...
+*
+		trap	#15		* Invoke ROMP  (we hope ...)
+*
+pstop:		stop	#$2700		* HARD HALT
+		bra	pstop
+*
+		.page
+*
+* _brk -- set break value
+* ----    ---------------
+* WARNING:  This only works if the stack is above the heap.
+*
+_brk:		cmpa.l	__break,a7	* compare current break with stack
+		bcs	pstop		* actual stack overflow!
+*
+		movea.l	4(sp),a0	* get new break
+		move.l	a0,d0		* compare with current stack,
+		adda.l	#$100,a0	* ... including 256-byte slop factor
+		cmpa.l	a0,a7		* if (sp < a0+256)
+		bcs	badbrk		* 	bad break;
+*
+		move.l	d0,__break	* OK break: save the break
+		clr.l	d0		* Set OK return
+		rts			* return
+*
+badbrk:		moveq.l	#-1,d0		* Load return reg
+		rts			* Return
+*
+		.page
+*
+*************************************************************************
+* 		Data Area						*
+*************************************************************************
+*
+		.data
+*
+pmsg1:		dc.b	'  returned from Croot() ',0
+*
+*************************************************************************
+* 		BSS Area						*
+*************************************************************************
+*
+		.bss
+		.even
+*
+__pmesg:	ds.l	1	* panic() message string address
+__heap:		ds.l	1	* Heap start  (initial break)
+__break:	ds.l	1	* Current break location
+_errno:		ds.w	1	* System error number
+*
+	.end
Index: rom/bios.s
===================================================================
--- rom/bios.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ rom/bios.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,3836 @@
+********************************************************************************
+*									       *
+* bios.s -- BIOS for the Buchla 700 and NASA 3D Helmet Display		       *
+* ------    --------------------------------------------------		       *
+*									       *
+* See VM1,VM2 and VDATE for version and date				       *
+* Written by D.N. Lynx Crowe						       *
+*									       *
+* Very loosely based on ideas from:					       *
+*									       *
+*	"Atari ST Internals", by Abacus Software,			       *
+*	"A Hitchhiker's Guide to the BIOS", by Atari,			       *
+* 	"DOS Technical Reference", by IBM,				       *
+*	"DOS/360", by IBM,
+*	"CP/M" , by Digital Research, and, of course,			       *
+*	"Unix (tm)", by AT&T, et al.					       *
+*									       *
+* After all,  Why re-invent the wheel?					       *
+*									       *
+* Some of the functions are the same as Ataris, but quite a few are different, *
+* and our I/O configuration is much different, so BEWARE!  Make no	       *
+* assumptions, and read the documentation and comments very carefully.	       *
+*									       *
+* Especially watch out for the extended BIOS functions.  Most of them	       *
+* are nothing at all like the Atari / GEMDOS extended bios functions,	       *
+* and even the ones that are similar have different numbers.		       *
+********************************************************************************
+*
+		.text
+*
+* Version and date
+* ----------------
+VM1		.equ	18		* First part of version number
+VM2		.equ	0		* Second part of version number
+VDATE		.equ	$19880620	* Version date
+*
+BUCHLA		.equ	1		* Non-Zero for Buchla 700, 0 for NASA
+NASASIO		.equ	0		* Non-zero for NASA, 0 for Buchla addr.
+*
+FL_SKR		.equ	$00		* Seek rate  (WD1772, 6Ms/step)
+*************************************************************************
+*
+		.page
+*
+		.xref	start_		* Where ROMP starts
+		.xref	_errno		* Start of ROMP bss space
+*
+		.xdef	basepage	* Pseudo base page for romp
+		.xdef	_rsflag		* Register save area overflow flag
+*
+		.ifne	BUCHLA
+*
+		.xdef	_hdvini		* Disk init
+*
+		.endc
+*
+		.xdef	_wzcrsh		* ROMP crash flag
+		.xdef	_crshvc		* Crash vector
+		.xdef	_crshsr		* Crash SR
+		.xdef	_crshpc		* Crash PC
+		.xdef	_crshsp		* Crash SP
+		.xdef	_crshus		* Crash USP
+		.xdef	_crshrg		* Crash SP registers
+		.xdef	_crshst		* Crash top of stack
+*
+		.page
+*
+		.ifne	BUCHLA
+*
+		.xdef	_hz_1k
+		.xdef	_hz_200
+		.xdef	frclock
+		.xdef	t1count
+		.xdef	t2count
+		.xdef	t3count
+*
+		.xdef	nflops
+		.xdef	disknum
+		.xdef	booted
+		.xdef	seekrate
+		.xdef	flock
+		.xdef	fverify
+*
+		.xdef	retrycnt
+		.xdef	wpstatus
+		.xdef	wplatch
+		.xdef	bootdev
+*
+		.xdef	cdev
+		.xdef	ctrack
+		.xdef	csect
+		.xdef	cside
+		.xdef	ccount
+*
+		.xdef	cdma
+		.xdef	edma
+		.xdef	tmpdma
+		.xdef	rseed
+*
+		.xdef	savptr
+*
+		.xdef	flpsrsv
+		.xdef	flpregs
+*
+		.xdef	dsb0
+		.xdef	dsb1
+*
+		.xdef	dskmode
+		.xdef	dskerrs
+		.xdef	drvbpbs
+*
+		.endc
+*
+		.xdef	biostop
+*
+		.page
+*
+* Some critical equates:
+* ----------------------
+* Interrupt masks
+* ---------------
+IPL3		.equ	$0300		* IPL 3 value for sr
+IPL4		.equ	$0400		* IPL 4 value for sr
+IPL7		.equ	$0700		* IPL 7 value for sr	(4 for debug)
+*
+		.ifne	BUCHLA
+*
+INITIPL		.equ	IPL3+$2000	* Initial Internal Priority Level
+*
+		.endc
+*
+		.ifeq	BUCHLA
+*
+INITIPL		.equ	IPL4+$2000	* Initial Internal Priority Level
+*
+		.endc
+*
+* Memory allocation
+* -----------------
+		.ifeq	BUCHLA
+*
+TPA		.equ	$008000		* Put TPA 32K up from the bottom
+*
+		.endc
+*
+		.ifne	BUCHLA
+*
+TPA		.equ	$010000		* Put TPA 64K up from the bottom
+*
+		.endc
+*
+SSTACK		.equ	TPA		* Put system stack just below TPA
+*
+p_bbase		.equ	$0018		* Basepage offset to bss base
+p_blen		.equ	$001C		* Basepage offset to bss length
+*
+* It's magic ...
+* --------------
+FMAGIC		.equ	$87654321	* Magic for formatting
+RETRYIT		.equ	$10000		* Magic for re-try from criter
+RSMAGIC		.equ	$78563412	* Magic for register save area OK
+*
+* Miscellaneous constants
+* -----------------------
+FCMAX		.equ	$00FFFFFF	* Maximum frame counter value (24 bits)
+*
+		.page
+*
+* CFR0 Baud Rates:
+* ----------------
+BR_300		.equ	$04
+BR_600		.equ	$05
+BR_1200		.equ	$06
+BR_1800		.equ	$07
+BR_2400		.equ	$08
+BR_3600		.equ	$09
+BR_4800		.equ	$0A
+BR_7200		.equ	$0B
+BR_9600		.equ	$0C
+BR_19K2		.equ	$0D
+BR_EXT		.equ	$0F
+*
+* CFR0 Stop bits (includes TBR select bit):
+* -----------------------------------------
+NSB_1		.equ	$40
+NSB_2		.equ	$60
+*
+* CFR1 Number of Data Bits (includes MSB):
+* ----------------------------------------
+NDB_5		.equ	$80
+NDB_6		.equ	$A0
+NDB_7		.equ	$C0
+NDB_8		.equ	$E0
+*
+* CFR1 Parity Selection:
+* ----------------------
+P_ODD		.equ	$04
+P_EVEN		.equ	$0C
+P_MARK		.equ	$14
+P_SPACE		.equ	$1C
+*
+P_NONE		.equ	$00
+*
+* Line Discipline:
+* ----------------
+L_NUL		.equ	$00		* No protocol
+L_XON		.equ	$01		* XON/XOFF
+L_RTS		.equ	$02		* RTS/CTS
+*
+		.page
+*
+* I/O Buffer Sizes:
+* -----------------
+SR1IBS		.equ	256
+SR1OBS		.equ	256
+SR2IBS		.equ	256
+SR2OBS		.equ	256
+*
+		.ifne	BUCHLA
+*
+MC1IBS		.equ	512
+MC1OBS		.equ	256
+MC2IBS		.equ	512
+MC2OBS		.equ	256
+*
+		.endc
+*
+* Line Disciplines:
+* -----------------
+SR1DISC		.equ	L_XON
+SR2DISC		.equ	L_XON
+*
+		.ifne	BUCHLA
+*
+MC1DISC		.equ	L_NUL
+MC2DISC		.equ	L_NUL
+*
+		.endc
+*
+* CFR Setings:
+* ------------
+SR1CFR0		.equ	BR_9600+NSB_1
+SR1CFR1		.equ	NDB_8+P_NONE
+SR2CFR0		.equ	BR_9600+NSB_1
+SR2CFR1		.equ	NDB_8+P_NONE
+*
+		.ifne	BUCHLA
+*
+MC1CFR0		.equ	BR_EXT+NSB_1
+MC1CFR1		.equ	NDB_8+P_NONE
+MC2CFR0		.equ	BR_EXT+NSB_1
+MC2CFR1		.equ	NDB_8+P_NONE
+*
+		.endc
+*
+		.page
+*
+* I/O Addresses:
+* --------------
+VSDDINIT	.equ	$200400		* VSDD initial register base address
+VSDDDATA	.equ	$200000		* VSDD data segment base address
+*
+		.ifeq	BUCHLA
+*
+		.ifeq	NASASIO
+*
+SR1ACIA		.equ	$3A8001		* Serial-1 ACIA base address	(BUCHLA)
+SR2ACIA		.equ	$3A8009		* Serial-2 ACIA base address
+*
+		.endc
+*
+		.ifne	NASASIO
+*
+SR1ACIA		.equ	$398001		* Serial-1 ACIA base address	(NASA)
+SR2ACIA		.equ	$398009		* Serial-2 ACIA base address
+*
+		.endc
+*
+		.endc
+*
+		.ifne	BUCHLA
+*
+FPUBASE		.equ	$180000		* FPU base address
+TIMER		.equ	$3A0001		* Timer base address
+LCD		.equ	$3A4001		* LCD driver base address
+SR1ACIA		.equ	$3A8001		* Serial-1 ACIA base address	(BUCHLA)
+SR2ACIA		.equ	$3A8009		* Serial-2 ACIA base address
+MC1ACIA		.equ	$3AC001		* MIDI-1 ACIA base address
+MC2ACIA		.equ	$3AC009		* MIDI-2 ACIA base address
+FLOPPY		.equ	$3B0001		* Floppy controller base address
+PSG		.equ	$3B4001		* Sound chip base address
+LEDS		.equ	$3B8001		* LED driver base address
+ANALOG		.equ	$3BC001		* Analog processor base address
+*
+* FPU address offsets and misc. values
+*
+FPU_CTL		.equ	$4000		* FPU control
+*
+FPU_IN		.equ	$4000		* FPU input address
+FPU_CLR		.equ	$6000		* FPU interrupt reset address
+*
+FPU_RST		.equ	$0015		* FPU reset value
+*
+* PSG address offsets
+*
+PSG_RD		.equ	PSG		* Read PSG data
+PSG_WL		.equ	PSG		* Write PSG address latch
+PSG_WD		.equ	PSG+2		* Write PSG data
+*
+		.endc
+*
+* VSDD data structure offsets
+*
+VSDD_REG	.equ	VSDDDATA	* Registers
+VSDD_AT		.equ	VSDDDATA+$0100	* Access Table
+*
+		.ifne	BUCHLA
+*
+* Timer registers
+*
+TIME_CRX	.equ	TIMER		* Control register 1 or 3
+TIME_CR2	.equ	TIMER+2		* Control register 2
+TIME_T1H	.equ	TIMER+4		* Timer 1 high byte
+TIME_T1L	.equ	TIMER+6		* Timer 1 low byte
+TIME_T2H	.equ	TIMER+8		* Tiemr 2 high byte
+TIME_T2L	.equ	TIMER+10	* Timer 2 low byte
+TIME_T3H	.equ	TIMER+12	* Timer 3 high byte
+TIME_T3L	.equ	TIMER+14	* Timer 3 low byte
+*
+		.endc
+*
+* ACIA Register offsets:
+* ----------------------
+ACIA_IER	.equ	0		* ACIA IER offset
+ACIA_ISR	.equ	0		* ACIA ISR offset
+ACIA_CSR	.equ	2		* ACIA CSR offset
+ACIA_CFR	.equ	2		* ACIA CFR offset
+ACIA_TBR	.equ	4		* ACIA TBR offset
+ACIA_TDR	.equ	6		* ACIA TDR offset
+ACIA_RDR	.equ	6		* ACIA RDR offset
+*
+		.page
+*
+		.ifne	BUCHLA
+*
+* Floppy register offsets:
+* ------------------------
+DSKCMD		.equ	0		* Command / status
+DSKTRK		.equ	2		* Track
+DSKSEC		.equ	4		* Sector
+DSKDAT		.equ	6		* Data
+*
+* Miscellaneous equates:
+* ----------------------
+FL_NC		.equ	$02		* Non-compensated R/W/F bit
+*
+APISIZE		.equ	256		* Analog processor buffer size
+*
+* Floppy commands:
+* ----------------
+FL_RS		.equ	$80		* Read sector
+FL_RM		.equ	$90		* Read multiple
+FL_WS		.equ	$A0		* Write sector
+FL_WT		.equ	$F0		* Write track  (format)
+FL_FR		.equ	$D0		* Force reset
+FL_SK		.equ	$10		* Seek
+FL_SV		.equ	$14		* Seek w/verify
+*
+		.endc
+*
+		.page
+*
+* iorec structure definitions:
+* ----------------------------
+IORECLN		.equ	40		* Length of an iorec structure
+*
+ibuf		.equ	0		* Input buffer base address
+ibufsize	.equ	4		* Input buffer size  (bytes)
+ibufhd		.equ	6		* Input buffer head index
+ibuftl		.equ	8		* Input buffer tail index
+ibuflow		.equ	10		* Input buffer low water mark
+ibufhi		.equ	12		* Input buffer high water mark
+obuf		.equ	14		* Output buffer base address
+obufsize	.equ	18		* Output buffer size  (bytes)
+obufhd		.equ	20		* Output buffer head index
+obuftl		.equ	22		* Output buffer tail index
+obuflow		.equ	24		* Output buffer low water mark
+obufhi		.equ	26		* Output buffer high water mark
+cfr0		.equ	28		* ACIA CFR, MS bit = 0
+cfr1		.equ	29		* ACIA CFR, MS bit = 1
+flagxon		.equ	30		* XON flag  (non-zero = XOFF sent)
+flagxoff	.equ	31		* XOFF flag  (non-zero = active)
+linedisc	.equ	32		* Line discipline flags
+erbyte		.equ	33		* Last error byte
+isr		.equ	34		* ACIA ISR on interrupt
+csr		.equ	35		* ACIA CSR on interrupt
+errct		.equ	36		* Error count  (FRM/OVR/BRK)
+ibfct		.equ	38		* Input buffer full count
+*
+		.page
+*
+* Error codes:
+* ------------
+ERR01		.equ	-1		* All purpose error
+ERR02		.equ	-2		* Drive not ready
+ERR03		.equ	-3		* Unknown command
+ERR04		.equ	-4		* CRC Error
+ERR05		.equ	-5		* Invalid request
+ERR06		.equ	-6		* Seek error
+ERR07		.equ	-7		* Unknown media
+ERR08		.equ	-8		* Sector not found
+ERR09		.equ	-9		* End of media  (out of paper)
+ERR10		.equ	-10		* Write fault
+ERR11		.equ	-11		* Read fault
+ERR12		.equ	-12		* General mishap
+ERR13		.equ	-13		* Write protected
+ERR14		.equ	-14		* Media changed
+ERR15		.equ	-15		* Unknown device
+ERR16		.equ	-16		* Bad sectors
+ERR17		.equ	-17		* Insert disk
+*
+		.page
+*
+* In the Beginning...
+* -------------------
+*
+* Low PROM -- Contains the initial sp (unused), and the initial pc,
+* as well as some version and creation date stuff and a copyright message,
+* just to be thorough about it.
+*
+begin:		bra.s	biosinit		* Jump to bios init
+*
+vermsg:		dc.b	VM1,VM2			* Version number
+*
+		dc.l	biosinit		* Reset address (bios init)
+*
+created:	dc.l	VDATE			* Creation date
+*
+copyrite:	dc.b	'{Copyright 1988 by '	* Copyright message
+		dc.b	'D.N. Lynx Crowe}',0
+*
+		dc.l	0			* Some padding
+*
+		.page
+		.even
+*
+* biosinit -- Setup the defaults for the BIOS
+* --------    -------------------------------
+biosinit:	move.w	#$2700,sr		* Set sup mode, no interrupts
+		move.l	#SSTACK,a7		* Setup supervisor stack pointer
+*
+		lea	badtrap,a1		* Set default trap vector
+		adda.l	#$02000000,a1		* ... with trap # in 31..24
+		lea	8,a0			* ... for traps 2..255
+		move.l	#253,d1
+*
+binit1:		move.l	a1,(a0)+		* Store trap vector
+		adda.l	#$01000000,a1		* Increment trap #
+		dbf	d1,binit1		* Loop until done
+*
+		lea	biosram,a0		* Clear BIOS ram ...
+		lea	SSTACK-2,a1		* ... from biosram to SSTACK-1
+*
+binit2:		move.w	#0,(a0)+		* Zero a word
+		cmpa.l	a0,a1			* Last one ?
+		bne	binit2			* Loop if not
+*
+		move.l	#rsarea,savptr		* Setup pointer to register area
+		move.l	#RSMAGIC,_rsflag	* Set magic in _rsflag
+*
+		move.l	#nullrts,timevec	* Set timer interrupt vector
+		move.l	#nullrts,critvec	* Set critical error vector
+		move.l	#nullrts,termvec	* Set process terminate vector
+		move.l	#nullrts,resvec3	* Set software vector 3
+		move.l	#nullrts,resvec4	* Set software vector 4
+		move.l	#nullrts,resvec5	* Set software vector 5
+		move.l	#nullrts,resvec6	* Set software vector 6
+		move.l	#nullrts,resvec7	* Set software vector 7
+*
+		move.l	#hardhlt,$0008		* Set bus error vector
+		move.l	#nullrte,$0014		* Set divide error vector
+		move.l	#nullrte,$0018		* Set CHK vector
+		move.l	#nullrte,$001C		* Set TRAPV vector
+		move.l	#nullrte,$0024		* Set trace vector
+*
+		move.l	#nullrte,$0030		* Set reserved vector 12
+		move.l	#nullrte,$0034		* Set reserved vector 13
+		move.l	#nullrte,$0038		* Set reserved vector 14
+*
+		move.l	#nullrte,$003C		* Set uninitialized int. vector
+*
+		move.l	#nullrte,$0040		* Set reserved vector 16
+		move.l	#nullrte,$0044		* Set reserved vector 17
+		move.l	#nullrte,$0048		* Set reserved vector 18
+		move.l	#nullrte,$004C		* Set reserved vector 19
+		move.l	#nullrte,$0050		* Set reserved vector 20
+		move.l	#nullrte,$0054		* Set reserved vector 21
+		move.l	#nullrte,$0058		* Set reserved vector 22
+		move.l	#nullrte,$005C		* Set reserved vector 23
+*
+		move.l	#nullrte,$0060		* Set spurious int. vector
+*
+		move.l	#serintr,$0074		* Set ACIA interrupt vector
+		move.l	#nullrte,$0078		* Set level 6 vector
+		move.l	#nullrte,$007C		* Set level 7 vector
+*
+		move.l	#trap13,$00B4		* Set trap13 vector
+		move.l	#trap14,$00B8		* Set trap14 vector
+*
+		.page
+*
+		.ifne	BUCHLA
+*
+		move.l	#nullfpu,$0068		* Set FPU interrupt vector
+		move.l	#api_int,$006C		* Set analog trap vector
+		move.l	#timeint,$0070		* Set timer trap vector
+*
+		move.l	#_hdvini,hdv_init	* Set disk init vector
+		move.l	#getbpb,hdv_bpb		* Set get BPB vector
+		move.l	#rwabs,hdv_rw		* Set disk I/O vector
+		move.l	#bootload,hdv_boot	* Setup boot load vector
+		move.l	#mediach,hdv_mchg	* Setup media change vector
+*
+		move.w	#$FFFF,fverify		* Set read after write flag
+		move.w	#FL_SKR,seekrate	* Set default seek rate
+		move.w	#$FFFF,booted		* Say we're not booted yet
+		move.l	#buffer,dskbufp		* Setup default disk buffer
+*
+		.page
+*
+		move.b	#7,PSG_WL		* Select PSG R7
+		move.b	#$80,PSG_WD		* Write $80  (port B = output)
+		move.b	#15,PSG_WL		* Select PSG R15
+		move.b	#$00,PSG_WD		* Write $00  (sync enable)
+*
+		move.b	#$00,TIME_T1H		* Setup timer 1  (PLL)
+		move.b	#$1F,TIME_T1L		* ... for divide by 64
+		move.b	#$0C,TIME_T2H		* Setup timer 2  (FC)
+		move.b	#$7F,TIME_T2L		* ... for divide by 3200
+		move.b	#$03,TIME_T3H		* Setup timer 3  (RTC)
+		move.b	#$20,TIME_T3L		* ... for 1Ms interval
+		move.b	#$42,TIME_CRX		* Setup CR3
+		move.b	#$41,TIME_CR2		* Setup CR2
+		move.b	#$81,TIME_CRX		* Setup CR1
+		move.b	#$80,TIME_CRX		* Start the timers
+*
+		.endc
+*
+		lea	sr1iorec,a0		* Serial-1 iorec address to a0
+		lea	SR1ACIA,a1		* Serial-1 ACIA address to a1
+		lea	sr1dflt,a2		* Serial-1 dflt table addr to a2
+		bsr.w	aciainit		* Go initialize the port
+*
+		lea	sr2iorec,a0		* Serial-2 iorec address to a0
+		lea	SR2ACIA,a1		* Serial-2 ACIA address to a1
+		lea	sr2dflt,a2		* Serial-2 dflt table addr to a2
+		bsr.w	aciainit		* Go initialize the port
+*
+		.ifne	BUCHLA
+*
+		lea	mc1iorec,a0		* MIDI-1 iorec address to a0
+		lea	MC1ACIA,a1		* MIDI-1 ACIA address to a1
+		lea	mc1dflt,a2		* MIDI-1 dflt table addr to a2
+		bsr.w	aciainit		* Go initialize the port
+*
+		lea	mc2iorec,a0		* MIDI-2 iorec address to a0
+		lea	MC2ACIA,a1		* MIDI-2 ACIA address to a1
+		lea	mc2dflt,a2		* MIDI-2 dflt table addr to a2
+		bsr.w	aciainit		* Go initialize the port
+*
+		.page
+*
+		lea	VSDDINIT,a1		* Setup to load VSDD regs
+		lea	vsddtab,a0		* ... from vsddtab
+		move.w	#15,d0			* ... all 16 registers
+*
+vsddinit:	move.w	(a0)+,(a1)+		* Load the VSDD registers
+		btst.l	#0,d0
+		btst.l	#0,d0
+		btst.l	#0,d0
+		dbf	d0,vsddinit
+*
+		move.w	vsddit02,VSDDINIT	* Enable the video
+*
+		move.l	#api_fum,api_fi		* Clear analog processor fifo
+		move.l	#api_fum,api_fo		* ...
+*
+		move.w	#23,d0			* Setup to clear key LEDs
+		move.b	#$80,d1			* ...
+*
+ledclear:	move.b	d1,LEDS			* Clear a LED
+		addq.b	#1,d1			* Increment LED number
+		dbra	d0,ledclear		* Loop until all are done
+*
+		move.w	#7,d0			* Setup to clear pot LEDs
+		move.b	#$18,d1			* ...
+*
+ledclr2:	move.b	d1,LEDS			* Clear a LED
+		addq.b	#1,d1			* Increment LED number
+		dbra	d0,ledclr2		* Loop until all are done
+*
+		clr.w	fc_sw			* Stop the frame clock
+		clr.l	fc_val			* ... and reset it
+*
+		.page
+*
+		lea	FPUBASE+FPU_CTL,a0	* Point at FPU master level
+		move.w	#$0000,$08(a0)		* Set CV1 to 0
+		addq.w	#1,d0			* Delay
+		addq.w	#1,d0			* ...
+		move.w	#$0000,$0A(a0)		* Set SF1 to 0
+		addq.w	#1,d0			* Delay
+		addq.w	#1,d0			* ...
+		move.w	#$0000,$0C(a0)		* Set CV2 to 0
+		addq.w	#1,d0			* Delay
+		addq.w	#1,d0			* ...
+		move.w	#$0000,$0E(a0)		* Set SF2 to 0
+		addq.w	#1,d0			* Delay
+		addq.w	#1,d0			* ...
+		move.w	#$0000,$10(a0)		* Set CV3 to 0
+		addq.w	#1,d0			* Delay
+		addq.w	#1,d0			* ...
+		move.w	#$0000,$12(a0)		* Set SF3 to 0
+		addq.w	#1,d0			* Delay
+		addq.w	#1,d0			* ...
+		move.w	#$8300,$02(a0)		* Set new value '10' to -10.00
+		addq.w	#1,d0			* Delay
+		addq.w	#1,d0			* ...
+		move.w	#$8300,$1C(a0)		* Set new value '01' to -10.00
+		addq.w	#1,d0			* Delay
+		addq.w	#1,d0			* ...
+		move.w	#$0001,$16(a0)		* Set exponent for shortest time
+		addq.w	#1,d0			* Delay
+		addq.w	#1,d0			* ...
+		move.w	#$FFF0,$14(a0)		* Set mantissa for shortest time
+		addq.w	#1,d0			* Delay
+		addq.w	#1,d0			* ...
+		move.w	#$0005,$00(a0)		* Send control word to FPU
+*
+		.endc
+*
+		.page
+*
+		move.w	#INITIPL,sr		* Enable interrupts
+		lea	basepage,a1		* Pass start_ a pseudo base page
+		move.l	#_errno,p_bbase(a1)	* ...
+		clr.l	p_blen(a1)		* ...
+		move.l	a1,-(a7)		* ...
+		jsr	start_			* Go start ROMP  (we assume ...)
+*
+		jmp	biosinit		* Just in case we return ...
+*
+		.page
+*
+		.ifne	BUCHLA
+*
+* nullfpu -- Null FPU trap handler
+* -------    ---------------------
+nullfpu:	movem.l	d0-d0/a0-a0,-(a7)	* Save registers
+		movea.l	#FPUBASE,a0		* Setup FPU base address in a0
+		move.w	FPU_IN(a0),d0		* Read FPU interrupt port
+		andi.l	#$000000FF,d0		* Mask for voice & parameter
+		lsl.l	#5,d0			* Shift for word offset
+		addi.l	#FPU_CTL,d0		* Add FPU control offset
+		move.w	#FPU_RST,0(a0,d0.L)	* Reset the function
+		clr.w	FPU_CLR(a0)		* Clear the interrupt
+		movem.l	(a7)+,d0-d0/a0-a0	* Restore registers
+		rte				* Return to interrupted code
+*
+		.endc
+*
+		.page
+*
+* hardhlt -- Bus error trap handler
+* -------    ----------------------
+hardhlt:	stop	#$2700			* stop dead -- system is AFU
+		bra	hardhlt			* ...
+*
+* badtrap -- Bad trap handler
+* -------    ----------------
+badtrap:	move.w	(a7)+,_crshsr		* Get crash SR
+		move.l	(a7)+,_crshpc		* Get crash PC
+		move.l	a7,_crshsp		* Get crash SP
+		bsr	badtr1			* Get TRAP PC with vector number
+		nop
+*
+badtr1:		move.l	(a7)+,_crshvc		* Save for analysis of vector #
+		movem.l	d0-d7/a0-a7,_crshrg	* Save crash registers
+		move.l	usp,a0			* Preserve crash USP
+		move.l	a0,_crshus		* ...
+		move.l	a7,d0			* Get SP
+		andi.l	#$FFFFFFFE,d0		* ... make sure it's even
+		movea.l	d0,a1			* ...
+		move.w	#15,d0			* Save top 16 words
+		lea	_crshst,a0		* ... of crash stack in _crshst
+*
+badtr2:		move.w	(a1)+,(a0)+		* Save a stack value
+		dbf	d0,badtr2		* Loop until all are saved
+*
+		clr.l	d0			* Get TRAP number
+		move.b	_crshvc,d0		* ... as LS byte of d0
+		move.l	_crshpc,a0		* Save crash PC in a0
+		move.w	#$FFFF,_wzcrsh		* Indicate we crashed
+		move.l	#rsarea,savptr		* Restore system save pointer
+		move.l	#SSTACK,a7		* Reset the stack pointer
+		move.l	#RSMAGIC,_rsflag	* ... and the stack sentinel
+		trap	#15			* TRAP to ROMP
+*
+		jmp	biosinit		* Recover with a cold start
+*
+		.page
+*
+		.ifne	BUCHLA
+*
+* timeint -- Timer interrupt handler
+* -------    -----------------------
+timeint:	movem.l	d0-d7/a0-a6,-(a7)	* Save registers
+		move.b	TIME_CR2,d0		* Get timer interrupt status
+		btst.l	#2,d0			* Check timer 3 status
+		beq	tmi02			* Jump if not active
+*
+		move.b	TIME_T3H,d1		* Read timer 1 count
+		lsl.l	#8,d1			* ...
+		move.b	TIME_T3L,d1		* ...
+		move.w	d1,t3count		* ... and save it
+*
+		addq.l	#1,_hz_1k		* Update 1ms clock  (1 KHz)
+*
+		move.w	tdiv1,d1		* Update divider
+		addq.w	#1,d1			* ...
+		move.w	d1,tdiv1		* ...
+*
+		cmpi.w	#5,d1			* Do we need to update _hz_200 ?
+		blt	tmi02			* Jump if not
+*
+		addq.l	#1,_hz_200		* Update 5ms clock   (200 Hz)
+*
+		move.w	tdiv2,d1		* Update divider
+		addq.w	#1,d1			* ...
+		move.w	d1,tdiv2		* ...
+*
+		cmpi.w	#4,d1			* Do we need to update frclock ?
+		blt	tmi01			* Jump if not
+*
+		addq.l	#1,frclock		* Update 20 Ms clock  (50 Hz)
+		tst.w	flock			* See if floppy is active
+		bne	tmi00			* Don't call flopvbl if so
+*
+		bsr	flopvbl			* Check on the floppy
+*
+tmi00:		move.w	#0,tdiv2		* Reset tdiv2
+*
+tmi01:		move.w	#0,tdiv1		* Reset tdiv1
+*
+		.page
+*
+tmi02:		btst.l	#0,d0			* Check timer 1 int
+		beq	tmi03			* Jump if not set
+*
+		move.b	TIME_T1H,d1		* Read timer 1 to clear int.
+		lsl.l	#8,d1			* ...
+		move.b	TIME_T1L,d1		* ...
+		move.w	d1,t1count		* ... and save the count
+*
+tmi03:		btst.l	#1,d0			* Check for timer 2 int.
+		beq	tmi04			* Jump if not set
+*
+		move.b	TIME_T2H,d1		* Read timer 2 to clear int.
+		lsl.l	#8,d1			* ...
+		move.b	TIME_T2L,d1		* ...
+		move.w	d1,t2count		* ... and save the count
+*
+		tst.w	fc_sw			* Should we update the frame ?
+		beq	tmi04			* Jump if not
+*
+		bmi	tmi05			* Jump if we count down
+*
+		move.l	fc_val,d0		* Get the frame count
+		cmp.l	#FCMAX,d0		* See it we've topped out
+		bge	tmi06			* Jump if limit was hit
+*
+		addq.l	#1,d0			* Count up 1 frame
+		move.l	d0,fc_val		* Store updated frame count
+		bra	tmi04			* Done
+*
+tmi06:		move.l	#FCMAX,fc_val		* Force hard limit, just in case
+		bra	tmi04			* Done
+*
+tmi05:		move.l	fc_val,d0		* Get the frame count
+		beq	tmi04			* Done if already zero
+*
+		subq.l	#1,d0			* Count down 1 frame
+		move.l	d0,fc_val		* Store udpated frame count
+*
+		movea.l	timevec,a0		* Do RTC vector
+		move.w	#1,-(a7)		* ... pass 1 msec on stack
+		jsr	(a0)			* ...
+		addq.l	#4,a7			* ...
+*
+tmi04:		movem.l	(a7)+,d0-d7/a0-a6		* Restore registers
+		rte				* Return to interrupted code
+*
+		.endc
+*
+		.page
+*
+* trap14 -- Extended BIOS entry point
+* ------    -------------------------
+trap14:		lea	t14tab,a0		* Setup trap 14 table address
+		bra	trapent			* Go process trap
+*
+* trap13 -- Main BIOS entry point
+* ------    ---------------------
+trap13:		lea	t13tab,a0		* Setup trap 13 table address
+*
+trapent:	move.l	savptr,a1		* Get save area pointer
+		move.w	(a7)+,d0		* Status register to D0
+		move.w	d0,-(a1)		* Save in save area
+		move.l	(a7)+,-(a1)		* Stash PC in save area
+		movem.l	d3-d7/a3-a7,-(a1)	* Save parameter register
+		move.l	a1,savptr		* Update save pointer
+		btst	#13,d0			* Were we in sup. mode ?
+		bne	trwzsup			* Jump if so
+*
+		move.l	usp,a7			* Move user sp to stack ptr.
+*
+trwzsup:	move.w	(a7)+,d0		* Get function number from stack
+		cmp.w	(a0)+,d0		* Check against limit
+		bge	trpexit			* Jump if it's invalid
+*
+		lsl.w	#2,d0			* Multiply by 4 for use as index
+		move.l	0(a0,d0),d0		* Get routine address
+		move.l	d0,a0			* ... into a0
+		bpl	trpnind			* Jump if it's indirect
+*
+		move.l	(a0),a0			* Use indirect value
+*
+trpnind:	sub.l	a5,a5			* Clear a5
+		jsr	(a0)			* Execute the routine
+*
+trpexit:	move.l	savptr,a1		* Get SAVPTR into a1
+		movem.l	(a1)+,d3-d7/a3-a7	* Restore registers
+		move.l	(a1)+,-(a7)		* Push return onto stack
+		move.w	(a1)+,-(a7)		* Push status onto stack
+		move.l	a1,savptr		* Update SAVPTR
+*
+* nullrte -- null rte
+* -------    --------
+nullrte:	rte				* Return to interrupted code
+*
+* nullrts -- null return
+* -------    -----------
+nullrts:	rts				* Just return to the caller
+*
+		.page
+*
+* bconstat -- Get character device input status
+* --------    ---------------------------------
+bconstat:	lea	cdt01,a0		* Point at status table
+		bra	condisp			* Jump to dispatcher
+*
+* bconin -- Get input from character device
+* ------    -------------------------------
+bconin:		lea	cdt02,a0		* Point at input table
+		bra	condisp			* Jump to dispatcher
+*
+* bconout -- Output to character device
+* -------    --------------------------
+bconout:	lea	cdt03,a0		* Point at output table
+		bra	condisp			* Jump to dispatcher
+*
+* bcostat -- Get character device output status
+* -------    ----------------------------------
+bcostat:	lea	cdt04,a0		* Point at status table
+*
+* condisp -- Character device function dispatcher
+* -------    ------------------------------------
+condisp:	move.w	4(a7),d0		* Get device number
+		lsl.w	#2,d0			* ... times 4 for pointer
+		move.l	0(a0,d0),a0		* Get routine address
+		jmp	(a0)			* Jump to it
+*
+		.page
+*
+* sr1ist -- Check CON (Serial-1) input buffer status
+* ------    ----------------------------------------
+sr1ist:		lea	sr1iorec,a0		* Address of iorec to a0
+		lea	SR1ACIA,a1		* Address of ACIA to a1
+		bra	chkist			* Go check buffer status
+*
+* sr2ist -- Check AUX (Serial-2) input buffer status
+* ------    ----------------------------------------
+sr2ist:		lea	sr2iorec,a0		* Address of iorec to a0
+		lea	SR2ACIA,a1		* Address of ACIA to a1
+*
+		.ifne	BUCHLA
+*
+		bra	chkist			* Go check buffer status
+*
+* mc1ist -- Check MC1 (MIDI-1) input buffer status
+* ------    --------------------------------------
+mc1ist:		lea	mc1iorec,a0		* Address of iorec to a0
+		lea	MC1ACIA,a1		* Address of ACIA to a1
+		bra	chkist			* Go check buffer status
+*
+* mc2ist -- Check MC2 (MIDI-2) input buffer status
+* ------    --------------------------------------
+mc2ist:		lea	mc2iorec,a0		* Address of iorec to a0
+		lea	MC2ACIA,a1		* Address of ACIA to a1
+*
+		.endc
+*
+* chkist -- Check input buffer status
+* ------    -------------------------
+chkist:		moveq.l	#-1,d0			* Default to "Input available"
+		lea	ibufhd(a0),a2		* Head index to a2
+		lea	ibuftl(a0),a3		* Tail index to a3
+		cmpm.w	(a3)+,(a2)+		* Buffer clear ?
+		bne	chkist1			* Jump if not
+*
+		moveq.l	#0,d0			* Set to "Buffer empty"
+*
+chkist1:	rts				* Return to caller
+*
+		.page
+*
+* sr1ost -- Check CON (Serial-1) output buffer status
+* ------    -----------------------------------------
+sr1ost:		lea	sr1iorec,a0		* Address of iorec to a0
+		bra	chkost			* Go check buffer status
+*
+* sr2ost -- Check AUX (Serial-2) output buffer status
+* ------    -----------------------------------------
+sr2ost:		lea	sr2iorec,a0		* Address of iorec to a0
+*
+		.ifne	BUCHLA
+*
+		bra	chkost			* Go check buffer status
+*
+* mc1ost -- Check MC1 (MIDI-1) output buffer status
+* ------    ---------------------------------------
+mc1ost:		lea	mc1iorec,a0		* Address of iorec to a0
+		bra	chkost			* Go check buffer status
+*
+* mc2ost -- Check MC2 (MIDI-2) output buffer status
+* ------    ---------------------------------------
+mc2ost:		lea	mc2iorec,a0		* Address of iorec to a0
+*
+		.endc
+*
+* chkost -- Check output buffer status
+* ------    --------------------------
+chkost:		moveq.l	#-1,d0			* Default to "Output OK"
+		move.w	obuftl(a0),d2		* Tail index to d2
+		bsr	wrapout			* Test for pointer wraparound
+		cmp.w	obufhd(a0),d2		* Compare with head index
+		bne	chkost1			* Jump if not equal
+*
+		moveq.l	#0,d0			* Set to "Buffer full"
+*
+chkost1:	rts				* Return to caller
+*
+		.page
+*
+* wrapin -- Check input pointer for wraparound
+* ------    ----------------------------------
+wrapin:		add.w	#1,d1			* Head index +1
+		cmp.w	ibufsize(a0),d1		* = buffer size ?
+		bcs	wrapin1			* Jump if not
+*
+		moveq.l	#0,d1			* Wraparound
+*
+wrapin1:	rts				* Return to caller
+*
+* wrapout -- Check output pointer for wraparound
+* -------    -----------------------------------
+wrapout:	addq.w	#1,d2			* Tail index +1
+		cmp.w	obufsize(a0),d2		* = buffer size ?
+		bcs	wrapout1		* Jump if not
+*
+		moveq.l	#0,d2			* Wrap around if so
+*
+wrapout1:	rts				* Return to caller
+*
+		.page
+*
+* sr1inp -- Get input from Serial-1  (wait on busy)
+* ------    ---------------------------------------
+sr1inp:		lea	sr1iorec,a0		* Serial-1 iorec address
+		lea	SR1ACIA,a1		* Serial-1 ACIA base
+		bra	serinp			* Go get a byte
+*
+* sr2inp -- Get input from Serial-2  (wait on busy)
+* ------    ---------------------------------------
+sr2inp:		lea	sr2iorec,a0		* Serial-2 iorec address
+		lea	SR2ACIA,a1		* Serial-2 ACIA base
+*
+* serinp -- Get a byte from a serial port  (with handshaking)
+* ------    -------------------------------------------------
+serinp:		bsr	chkist			* Check input status
+		tst.w	d0			* Character ready ?
+		beq	serinp			* Loop until one is ...
+*
+		bsr	getser			* Get a byte from the buffer
+		and.w	#$FFFF,d0		* Isolate LS bits 7..0
+		rts				* Return to caller
+*
+		.page
+*
+		.ifne	BUCHLA
+*
+* mc1inp -- Get input from MIDI-1  (wait on busy)
+* ------    -------------------------------------
+mc1inp:		lea	mc1iorec,a0		* MIDI-1 iorec address
+		lea	MC1ACIA,a1		* MIDI-1 ACIA base
+		bra	midinp			* Go get a byte
+*
+* mc2inp -- Get input from MIDI-2  (wait on busy)
+* ------    -------------------------------------
+mc2inp:		lea	mc2iorec,a0		* MIDI-2 iorec address
+		lea	MC2ACIA,a1		* MIDI-2 ACIA base
+*
+* midinp -- Get input from a MIDI port  (no handshaking)
+* ------    --------------------------------------------
+midinp:		bsr	chkist			* Check input status
+		tst.w	d0			* Character ready ?
+		beq	midinp			* Loop until one is ...
+*
+		move.w	sr,-(a7)		* Save status register
+		ori.w	#IPL7,sr		* Set IPL = 7  (disable ints)
+		move.w	ibufhd(a0),d1		* Head index to d1
+		cmp.w	ibuftl(a0),d1		* Compare to tail index
+		beq	midin_1			* Jump if (somehow) empty
+*
+		addq.w	#1,d1			* Increment head index
+		cmp.w	ibufsize(a0),d1		* Did pointer wrap around ?
+		bcs	midin_2			* Jump if not
+*
+		moveq.l	#0,d1			* Wraparound
+*
+midin_2:	move.l	ibuf(a0),a2		* Get buffer base address in a2
+		moveq.l	#0,d0			* Clear MS bits of d0
+		move.b	0(a2,d1),d0		* Get character from buffer
+		move.w	d1,ibufhd(a0)		* Update buffer head index
+*
+midin_1:	move.w	(a7)+,sr		* Restore status
+		rts				* Return to caller
+*
+		.endc
+*
+		.page
+*
+* getser -- Get a byte from a serial port buffer  (with handshaking)
+* ------    --------------------------------------------------------
+getser:		move.w	sr,-(a7)		* Save status register
+		ori.w	#IPL7,sr		* Set IPL = 7  (disable ints)
+		move.w	ibufhd(a0),d1		* Get input buffer head index
+		cmp.w	ibuftl(a0),d1		* Compare tail index
+		beq	rs_mt			* Jump if buffer empty
+*
+		bsr	wrapin			* Adjust pointer for wraparound
+		move.l	ibuf(a0),a2		* Get buffer address
+		moveq.l	#0,d0			* Clear out MS bits of d0
+		move.b	0(a2,d1),d0		* Get character from buffer
+		move.w	d1,ibufhd(a0)		* Update head index
+		move.w	(a7)+,sr		* Restore status
+		andi	#$FFFE,sr		* Clear carry = OK
+		bra	rs_xnf			* Go do XON/XOFF check
+*
+rs_mt:		move.w	(a7)+,sr		* Restore status
+		ori	#$0001,sr		* Set carry = no character there
+*
+rs_xnf:		btst	#0,linedisc(a0)		* Check for XON/XOFF mode
+		beq	rs_exit			* Jump if not enabled
+*
+		tst.b	flagxon(a0)		* XON active ?
+		beq	rs_exit			* Jump if not
+*
+		bsr	rsilen			* Get length of buffer used
+		cmp.w	ibuflow(a0),d2		* At low water mark ?
+		bne	rs_exit			* Jump if not
+*
+		move.b	#$11,d1			* Send an XON
+		bsr	serput			* ...
+		clr.b	flagxon(a0)		* Clear XON flag
+*
+rs_exit:	rts				* Return to caller
+*
+		.page
+*
+* sr1out -- Output to serial-1
+* ------    ------------------
+sr1out:		lea	sr1iorec,a0		* Serial-1 iorec address to a0
+		lea	SR1ACIA,a1		* Serial-1 ACIA address to a1
+		move.w	6(a7),d1		* Get data byte from stack
+		bsr	serput			* Attempt to output
+		bcs	sr1out			* Try until it works ...
+*
+		rts				* Return to caller
+*
+* sr2out -- Output to Serial-2
+* ------    ------------------
+sr2out:		lea	sr2iorec,a0		* Serial-2 iorec address to a0
+		lea	SR2ACIA,a1		* Serial-2 ACIA address to a1
+		move.w	6(a7),d1		* Get data byte from stack
+		bsr	serput			* Attempt to output
+		bcs	sr2out			* Try until it works ...
+*
+		rts				* Return to caller
+*
+		.ifne	BUCHLA
+*
+* mc1out -- Output to MIDI-1
+* ------    ----------------
+mc1out:		lea	mc1iorec,a0		* MIDI-1 iorec address to a0
+		lea	MC1ACIA,a1		* MIDI-1 ACIA address to a1
+		move.w	6(a7),d1		* Get data byte from stack
+		bsr	midput			* Attempt to output
+		bcs	mc1out			* Try until it works ...
+*
+		rts				* Return to caller
+*
+* mc2out -- Output to MIDI-2
+* ------    ----------------
+mc2out:		lea	mc2iorec,a0		* MIDI-2 iorec address to a0
+		lea	MC2ACIA,a1		* MIDI-2 ACIA address to a1
+		move.w	6(a7),d1		* Get data byte from stack
+		bsr	midput			* Attempt to output
+		bcs	mc2out			* Try until it works ...
+*
+		rts				* Return to caller
+*
+		.endc
+*
+		.page
+*
+* serput -- Output a character to a serial port
+* ------    -----------------------------------
+serput:		move.w	sr,-(a7)		* Save status register
+		ori.w	#IPL7,sr		* Set IPL = 7  (disable ints)
+		move.b	ACIA_ISR(a1),isr(a0)	* Get ACIA isr
+		move.b	ACIA_CSR(a1),csr(a0)	* Get ACIA csr
+		btst	#0,linedisc(a0)		* XON/XOFF mode ?
+		beq	serpt_1			* Jump if not
+*
+		tst.b	flagxoff(a0)		* XON active ?
+		bne	serpt_2			* Jump if so
+*
+serpt_1:	btst.b	#6,isr(a0)		* Is ACIA still sending ?
+		beq	serpt_2			* Jump if so
+*
+		move.w	obufhd(a0),d2		* Head index to d2
+		cmp.w	obuftl(a0),d2		* Compare to tail index
+		bne	serpt_2			* Jump if buffer not empty
+*
+		move.b	d1,ACIA_TDR(a1)		* Give byte to ACIA to send
+		bra	serpt_3			* Go deal with RTS/CTS if needed
+*
+serpt_2:	move.w	obuftl(a0),d2		* Tail index to d2
+		bsr	wrapout			* Adjust for wraparound
+		cmp.w	obufhd(a0),d2		* Compare to head index
+		beq	serpt_4			* Jump if buffer full
+*
+		move.l	obuf(a0),a2		* Get buffer base address in a2
+		move.b	d1,0(a2,d2)		* Put character in buffer
+		move.w	d2,obuftl(a0)		* Update buffer tail index
+*
+serpt_3:	bsr	serchk			* Check status on our way out
+		bsr	rtschk			* Handle RTS protocol
+		move.w	(a7)+,sr		* Restore status register
+		andi	#$FFFE,sr		* Clear carry flag = OK
+		rts				* Return to caller
+*
+serpt_4:	bsr	serchk			* Check status on our way out
+		bsr	rtschk			* Handle RTS protocol
+		move.w	(a7)+,sr		* Restore status register
+		ori	#$0001,sr		* Set carry flag = buffer full
+		rts				* Return to caller
+*
+		.page
+*
+		.ifne	BUCHLA
+*
+* midput -- Output to MIDI
+* ------    --------------
+midput:		move.w	sr,-(a7)		* Save status register
+		ori.w	#IPL7,sr		* Set IPL = 7  (diable ints)
+		move.b	ACIA_ISR(a1),isr(a0)	* Get ACIA isr
+		move.b	ACIA_CSR(a1),csr(a0)	* Get ACIA csr
+		btst.b	#6,isr(a0)		* Is ACIA still sending ?
+		beq	midpt_2			* Jump if so
+*
+		move.w	obufhd(a0),d2		* Head index to d2
+		cmp.w	obuftl(a0),d2		* Compare to tail index
+		bne	midpt_2			* Jump if buffer not empty
+*
+		move.b	d1,ACIA_TDR(a1)		* Give byte to ACIA to send
+		bra	midpt_3			* Go set final status and exit
+*
+midpt_2:	move.w	obuftl(a0),d2		* Tail index to d2
+		bsr	wrapout			* Adjust for wraparound
+		cmp.w	obufhd(a0),d2		* Compare to head index
+		beq	midpt_4			* Jump if buffer full
+*
+		move.l	obuf(a0),a2		* Get buffer base address in a2
+		move.b	d1,0(a2,d2)		* Put character in buffer
+		move.w	d2,obuftl(a0)		* Update buffer tail index
+*
+midpt_3:	bsr	midchk			* Check status on our way out
+		move.w	(a7)+,sr		* Restore status register
+		andi	#$FFFE,sr		* Clear carry flag = OK
+		rts				* Return to caller
+*
+midpt_4:	bsr	midchk			* Check status on our way out
+		move.w	(a7)+,sr		* Restore status register
+		ori	#$0001,sr		* Set carry flag = buffer full
+		rts				* Return to caller
+*
+		.endc
+*
+		.page
+*
+* rtschk -- Check RTS mode and turn on RTS if it's enabled
+* ------    ----------------------------------------------
+rtschk:		btst	#1,linedisc(a0)		* RTS/CTS mode set ?
+		beq	rts_1			* Jump if not
+*
+		bsr	rtson			* Turn on RTS
+*
+rts_1:		rts				* Return to caller
+*
+* rsilen -- Get length of portion of input buffer that's been used so far
+* ------    -------------------------------------------------------------
+rsilen:		move.w	ibuftl(a0),d2		* Tail index to d2
+		move.w	ibufhd(a0),d3		* Head index to d3
+		cmp.w	d3,d2			* Head > Tail ?
+		bhi	rsi_1			* Jump if not
+*
+		add.w	ibufsize(a0),d2		* Add buffer size to tail index
+*
+rsi_1:		sub.w	d3,d2			* Length = (adjusted)Tail - Head
+		rts				* Return to caller
+*
+* rtson -- Turn on RTS line
+* -----    ----------------
+rtson:		move.b	cfr1(a0),d0		* Pick up CFR1 image
+		bclr	#0,d0			* Turn on RTS line  (active low)
+		bset	#7,d0			* Make sure MS bit is set
+		move.b	d0,cfr1(a0)		* Update CFR1 image
+		move.b	d0,ACIA_CFR(a1)		* Send CFR to hardware
+		rts				* Return to caller
+*
+* rtsoff -- Turn off RTS line
+* ------    -----------------
+rtsoff:		move.b	cfr1(a0),d0		* Pick up CFR1 image
+		bset	#0,d0			* Turn off RTS line  (active low)
+		bset	#7,d0			* Make sure MS bit is set
+		move.b	d0,cfr1(a0)		* Update CFR1 image
+		move.b	d0,ACIA_CFR(a1)		* Send CFR to hardware
+		rts
+*
+		.page
+*
+* serintr -- Serial (Serial-1, Serial-2, MIDI-1, MIDI-2) interrupt handler
+* -------    -------------------------------------------------------------
+serintr:	movem.l	d0-d3/a0-a2,-(a7)	* Save registers
+		lea	sr1iorec,a0		* Point at Serial-1 iorec
+		lea	SR1ACIA,a1		* Point at Serial-1 ACIA
+		bsr	serint			* Go process (possible) int.
+*
+		lea	sr2iorec,a0		* Point at Serial-2 iorec
+		lea	SR2ACIA,a1		* Point at Serial-2 ACIA
+		bsr	serint			* Go process (possible) int.
+*
+		.ifne	BUCHLA
+*
+		lea	mc1iorec,a0		* Point at MIDI-1 iorec
+		lea	MC1ACIA,a1		* Point at MIDI-1 ACIA
+		bsr	midint			* Go process (possible) int.
+*
+		lea	mc2iorec,a0		* Point at MIDI-2 iorec
+		lea	MC2ACIA,a1		* Point at MIDI-2 ACIA
+		bsr	midint			* Go process (possible) int.
+*
+		.endc
+*
+		movem.l	(a7)+,d0-d3/a0-a2	* Restore registers
+		rte				* Return from exception
+*
+		.page
+*
+* serint -- Process an interrupt from Serial-1 or Serial-2
+* ------    ----------------------------------------------
+serint:		move.b	ACIA_ISR(a1),isr(a0)	* Get and save ISR
+		move.b	ACIA_CSR(a1),csr(a0)	* Get and save CSR
+*
+		btst.b	#7,isr(a0)		* Was int for this device ?
+		beq	serintx			* Jump if not
+*
+serchk:		btst.b	#1,isr(a0)		* FRM/OVR/BRK error ?
+		bne	sererr			* Jump if so
+*
+		btst.b	#0,isr(a0)		* Receiver interrupt ?
+		bne	serrx			* Jump if so
+*
+sertxq:		btst.b	#6,isr(a0)		* Transmitter interrupt ?
+		bne	sertx			* Jump if so
+*
+serctq:		btst.b	#5,isr(a0)		* CTS interrupt ?
+		bne	sercts			* Jump if so
+*
+serintx:	rts				* Return to caller
+*
+sererr:		addq.w	#1,errct(a0)		* Update error count
+		move.b	ACIA_RDR(a1),erbyte(a0)	* Get error byte
+		rts
+*
+* Handle CTS interupt
+*
+sercts:		btst.b	#1,linedisc(a0)		* RTS/CTS mode ?
+		beq	serintx			* Ignore if not
+*
+		btst.b	#5,csr(a0)		* CTS set ?
+		beq	serintx			* Ignore if not
+*
+sercts1:	btst.b	#6,isr(a0)		* TDRE set ?
+		beq	sercts1			* Loop until it is  (!)
+*
+		move.w	obufhd(a0),d2		* Head index to d2
+		cmp.w	obuftl(a0),d2		* Compare to tail index
+		beq	serintx			* Done if buffer empty
+*
+		bsr.w	wrapout			* Adjust pointer for wraparound
+		move.l	obuf(a0),a2		* Get buffer base in a2
+		move.b	0(a2,d2),ACIA_TDR(a1)	* Send byte on its way
+		move.w	d2,obufhd(a0)		* Save updated head index
+		rts
+*
+		.page
+*
+* Handle receiver interrupt
+*
+serrx:		btst.b	#1,linedisc(a0)		* RTS/CTS mode set ?
+		beq	serrx1			* Jump if not
+*
+		bsr.w	rtsoff			* Turn off RTS
+*
+serrx1:		move.b	ACIA_RDR(a1),d0		* Read data from ACIA
+		btst.b	#1,linedisc(a0)		* RTS/CTS mode set ?
+		bne	serrx3			* Jump if so
+*
+		btst.b	#0,linedisc(a0)		* XON/XOFF mode set ?
+		beq	serrx3			* Jump if not
+*
+		cmpi.b	#$11,d0			* Is this an XON ?
+		bne	serrx2			* Jump if not
+*
+		move.b	#$00,flagxoff(a0)	* Clear flagxoff
+		bra	sertxq			* Done
+*
+serrx2:		cmpi.b	#$13,d0			* Is this an XOFF ?
+		bne	serrx3			* Jump if not
+*
+		move.b	#$FF,flagxoff(a0)	* Set flagxoff
+		bra	sertxq			* Done
+*
+serrx3:		move.w	ibuftl(a0),d1		* Get tail index in d1
+		bsr.w	wrapin			* Adjust for wraparound
+		cmp.w	ibufhd(a0),d1		* Head = tail ?
+		beq	seribf			* If so, we drop the character
+*
+		move.l	ibuf(a0),a2		* Get buffer address
+		move.b	d0,0(a2,d1)		* Stash byte in buffer
+		move.w	d1,ibuftl(a0)		* Save updated tail index
+		bsr	rsilen			* Get length of buffer used
+		cmp.w	ibufhi(a0),d2		* Hit high water mark ?
+		bne	serrx4			* Jump if not
+*
+		btst.b	#1,linedisc(a0)		* RTS/CTS mode set ?
+		bne	sertxq			* Done if so
+*
+		btst.b	#0,linedisc(a0)		* XON/XOFF mode set ?
+		beq	serrx4			* Jump if not
+*
+		tst.b	flagxon(a0)		* XOFF already sent ?
+		bne	serrx4			* Jump if so
+*
+		move.b	#$FF,flagxon(a0)	* Set the flag
+		move.b	#$13,d1			* Send an XOFF
+		bsr.w	serput			* ...
+*
+		.page
+*
+serrx4:		btst	#1,linedisc(a0)		* RTS/CTS mode set ?
+		beq	sertxq			* Done if not
+*
+		bsr	rtson			* Turn on RTS
+		bra	sertxq
+*
+* Handle transmitter interrupt
+*
+sertx:		btst.b	#1,linedisc(a0)		* RTS/CTS mode set ?
+		bne	sertx2			* If so, go check CTS
+*
+		btst.b	#0,linedisc(a0)		* XON/XOFF mode set ?
+		beq	sertx1			* Jump if not
+*
+		tst.b	flagxoff(a0)		* Check flagxoff
+		bne	serctq			* Done if set
+*
+sertx1:		move.w	obufhd(a0),d2		* Head index to d2
+		cmp.w	obuftl(a0),d2		* Compare to tail index
+		beq	serctq			* Done if buffer empty
+*
+		bsr	wrapout			* Adjust pointer for wraparound
+		move.l	obuf(a0),a2		* Get buffer base address
+		move.b	0(a2,d2),ACIA_TDR(a1)	* Send byte on its way
+		move.w	d2,obufhd(a0)		* Save updated head index
+		bra	serctq			* Done
+*
+sertx2:		btst.b	#5,csr(a0)		* CTS set in csr ?
+		beq	serctq			* If not, go check for CTS int
+*
+		bra	sertx1			* CTS was set, go transmit
+*
+seribf:		move.b	d0,erbyte(a0)		* Log dropped character
+		addq.w	#1,ibfct(a0)		* ...
+		bra	sertxq			* Go check Tx interrupt
+*
+		.page
+*
+		.ifne	BUCHLA
+*
+* midint -- Process an interrupt from MIDI-1 or MIDI-2
+* ------    ------------------------------------------
+midint:		move.b	ACIA_ISR(a1),isr(a0)	* Get and save ISR
+		move.b	ACIA_CSR(a1),csr(a0)	* Get and save CSR
+*
+		btst.b	#7,isr(a0)		* Was int for this device ?
+		beq	midintx			* Jump if not
+*
+midchk:		btst.b	#1,isr(a0)		* FRM/OVR/BRK error ?
+		bne	miderr			* Jump if so
+*
+		btst.b	#0,isr(a0)		* Receiver interrupt ?
+		bne	midrx			* Jump if so
+*
+midtxq:		btst.b	#6,isr(a0)		* Transmitter interrupt ?
+		bne	midtx			* Jump if so
+*
+midintx:	rts				* Return to caller
+*
+miderr:		addq.w	#1,errct(a0)		* Update error count
+		move.b	ACIA_RDR(a1),erbyte(a0)	* Get error byte
+		rts
+*
+* Handle receiver interrupt
+*
+midrx:		move.b	ACIA_RDR(a1),d0		* Read data from ACIA
+		move.w	ibuftl(a0),d1		* Get tail index in d1
+		bsr.w	wrapin			* Adjust for wraparound
+		cmp.w	ibufhd(a0),d1		* Head = tail ?
+		beq	midibf			* If so, we drop the character
+*
+		move.l	ibuf(a0),a2		* Get buffer address
+		move.b	d0,0(a2,d1)		* Stash byte in buffer
+		move.w	d1,ibuftl(a0)		* Save updated tail index
+		bra	midtxq			* Done  (go check tx int)
+*
+		.page
+*
+* Handle transmitter interrupt
+*
+midtx:		move.w	obufhd(a0),d2		* Head index to d2
+		cmp.w	obuftl(a0),d2		* Compare to tail index
+		beq	midintx			* Done if buffer empty
+*
+		bsr	wrapout			* Adjust pointer for wraparound
+		move.l	obuf(a0),a2		* Get buffer base address
+		move.b	0(a2,d2),ACIA_TDR(a1)	* Send byte on its way
+		move.w	d2,obufhd(a0)		* Save updated head index
+		bra	midintx			* Done
+*
+midibf:		move.b	d0,erbyte(a0)		* Log dropped character
+		addq.w	#1,ibfct(a0)		* ...
+		bra	midtxq			* Go check Tx interrupt
+*
+		.endc
+*
+		.page
+*
+* setexec -- Set an exception vector
+* -------    -----------------------
+setexec:	move.w	4(a7),d0		* Get vector number
+		lsl.w	#2,d0			* .. times 4
+		sub.l	a0,a0			* Clear a0
+		lea	0(a0,d0),a0		* Get address of old vector
+		move.l	(a0),d0			* Move old vector to d0
+		move.l	6(a7),d1		* Pick up new vector
+		bmi	setexec1		* Don't set if = -1
+*
+		move.l	d1,(a0)			* Set new vector
+*
+setexec1:	rts				* Return to caller
+*
+* piorec -- Get pointer to iorec structure
+* ------    ------------------------------
+piorec:		moveq.l	#0,d1			* Clear out d1
+		move.w	4(a7),d1		* Get device number
+		move.w	sr,-(a7)		* Save status register
+		ori.w	#IPL7,sr		* Set IPL = 7  (no ints)
+		lea	iortab,a2		* Get base address of table
+		asl.l	#2,d1			* Device # times 4 for index
+		move.l	0(a2,d1),d0		* Get iorec address from table
+		move.w	(a7)+,sr		* Restore status register
+		rts				* Return to caller
+*
+		.page
+*
+* setport -- Set ACIA parameters  (unit, mode, baud, CFR0, CFR1)
+* -------    ---------------------------------------------------
+setport:	moveq.l	#0,d1			* Clear out d1
+		move.w	4(a7),d1		* Get device number
+		asl.l	#3,d1			* Times 8 for index
+		ori.w	#IPL7,sr		* Set IPL = 7  (no ints)
+		lea	aciatab,a2		* Get base of table
+		move.l	0(a2,d1),d0		* Get iorec address
+		move.l	4(a2,d1),d2		* Get ACIA address
+		movea.l	d0,a0			* Setup a0 = iorec address
+		movea.l	d2,a1			* Setup a1 = ACIA address
+		tst.w	6(a7)			* Change mode ?
+		bmi	setpt1			* Jump if not
+*
+		move.b	7(a7),linedisc(a0)	* Set line discipline  (mode)
+*
+setpt1:		tst.w	8(a7)			* Change baud rate ?
+		bmi	setpt2			* Jump if not
+*
+		moveq.l	#0,d1			* Clear out d1
+		move.w	8(a7),d1		* Get baud rate index
+		lea	brtable,a2		* Get base of baud rate table
+		move.b	0(a2,d1),d2		* Get baud rate code from table
+		move.b	cfr0(a0),d0		* Get current CFR0
+		andi.w	#$0070,d0		* Mask off old baud rate code
+		or.w	d2,d0			* OR in new baud rate code
+		move.b	d0,cfr0(a0)		* Update CFR0 in table
+		move.b	d0,ACIA_CFR(a1)		* Update hardware
+*
+setpt2:		tst.w	10(a7)			* Change CFR0 ?
+		bmi	setpt3			* Jump if not
+*
+		move.b	11(a7),cfr0(a0)		* Update CFR0 in table
+		move.b	cfr0(a0),ACIA_CFR(a1)	* Update CFR0 in hardware
+*
+setpt3:		tst.w	12(a7)			* Change CFR1 ?
+		bmi	setpt4			* Jump if not
+*
+		bset.b	#7,13(a7)		* Force D7 = 1 in argument
+		move.b	13(a7),cfr1(a0)		* Update CFR1 in table
+		move.b	cfr1(a0),ACIA_CFR(a1)	* Update CFR1 in hardware
+*
+setpt4:		rts				* Return to caller
+*
+		.page
+*
+* aciainit -- Initialize an ACIA port
+* --------    -----------------------
+aciainit:	move.w	#IORECLN,d0		* Setup byte count for move
+		move.l	a0,-(a7)		* Save iorec base
+*
+aciai_1:	move.b	(a2)+,(a0)+		* Move the default to the iorec
+		dbf	d0,aciai_1		* ...
+*
+		move.l	(a7)+,a0		* Restore iorec base
+		move.b	cfr0(a0),ACIA_CFR(a1)	* Setup CFR0
+		move.b	cfr1(a0),ACIA_CFR(a1)	* Setup CFR1
+		move.b	ACIA_RDR(a1),d0		* Clear RDR
+		move.b	#$7F,ACIA_IER(a1)	* Disable all interrupts
+		btst.b	#1,linedisc(a0)		* Are we in RTS/CTS mode ?
+		bne	aciai_2			* Jump if so
+*
+		move.b	#$C3,ACIA_IER(a1)	* Enable TDRE, RDRF
+		bra	aciai_3			* Go return
+*
+aciai_2:	move.b	#$E3,ACIA_IER(a1)	* Enable interrupts we want
+*
+aciai_3:	rts				* Return to caller
+*
+		.page
+*
+		.ifne	BUCHLA
+*
+* fastcopy -- Copy disk sector quickly
+* --------    ------------------------
+fastcopy:	move.l	4(a7),a0		* Get source pointer
+		move.l	8(a7),a1		* Get destination pointer
+		move.w	$3F,d0			* 512 bytes  (63+1)*8
+*
+fastcpy1:	move.b	(a0)+,(a1)+		* Move 8 bytes
+		move.b	(a0)+,(a1)+		* ...
+		move.b	(a0)+,(a1)+		* ...
+		move.b	(a0)+,(a1)+		* ...
+		move.b	(a0)+,(a1)+		* ...
+		move.b	(a0)+,(a1)+		* ...
+		move.b	(a0)+,(a1)+		* ...
+		move.b	(a0)+,(a1)+		* ...
+		dbra	d0,fastcpy1		* Loop until all bytes are moved
+*
+		rts				* Return to caller
+*
+		.page
+*
+* _hdvini -- Drive initialization
+* -------    --------------------
+_hdvini:	link	a6,#-18			* Reserve space on stack
+		movem.l	d3-d7/a3-a5,-(a7)	* Preserve registers
+		move.l	#300,maxactim		* maxactim = 300 * 20ms
+		clr.w	d0			* Put zeros in ...
+		move.w	d0,nflops		* ... nflops
+		move.w	d0,dskmode		* ... dskmode
+		move.w	d0,-2(a6)		* Start with drive A
+		bra	hdvilp			* ...
+*
+hdvilp1:	movea.l	#dskmode,a0		* Get dskmode address in a0
+		movea.w	-2(a6),a1		* Drive number in a1
+		adda.l	a1,a0			* Point at dskmode for drive
+		clr.b	(a0)			* Clear flag in dskmode
+		clr.w	-(a7)			* Push arguments onto stack
+		clr.w	-(a7)			* ...
+		clr.w	-(a7)			* ...
+		move.w	-2(a6),-(a7)		* Push drive number onto stack
+		clr.l	-(a7)			* ... filler
+		clr.l	-(a7)			* ... filler
+		jsr	flopini			* Initialize drive
+		adda.l	#16,a7			* Cleanup stack
+		move.w	d0,-(a7)		* Save error code on stack
+		movea.w	-2(a6),a0		* Get drive number
+		adda.l	a0,a0			* ... times 2
+		adda.l	#dskerrs,a0		* Add base of dskerrs
+		move.w	(a7)+,(a0)		* Move error code off of stack
+		bne	hdvind			* Jump if drive not present
+*
+		addq.w	#1,nflops		* Update number of drives
+		or.l	#3,drvbits		* Setup drive bits
+*
+hdvind:		addq.w	#1,-2(a6)		* Increment drive number
+*
+hdvilp:		cmp.w	#2,-2(a6)		* See if it's 2 yet
+		blt	hdvilp1			* Loop until it is
+*
+		movem.l	(a7)+,d3-d7/a3-a5	* Restore registers
+		unlk	a6			* Release temporary stack space
+		rts				* Return to caller
+*
+* drvmap -- get drive map
+* ------    -------------
+drvmap:		move.l	drvbits,d0		* Get drive bits
+		rts				* Return to caller
+*
+		.page
+*
+* getbpb -- get BIOS parameter block
+* ------    ------------------------
+getbpb:		link	a6,#-12			* Reserve space for temporaries
+		movem.l	d5-d7/a4-a5,-(a7)	* Save registers on stack
+		cmp.w	#2,8(a6)		* Check drive number
+		blt	gbpb1			* Jump if OK
+*
+		clr.l	d0			* Set drive number to 0
+		bra	gbpber			* Go flag error
+*
+gbpb1:		move.w	8(a6),d0		* Get drive number
+		asl.w	#5,d0			* ... times 32
+		ext.l	d0			* ... extend sign
+		move.l	d0,a5			* Move to a5
+		add.l	#drvbpbs,a5		* Add base of drive bpb are
+		move.l	a5,a4			* Save in a4
+*
+gbpbrds:	move.w	#1,(a7)			* floprd count = 1,
+		clr.w	-(a7)			* ... side = 0,
+		clr.w	-(a7)			* ... track = 0,
+		move.w	#1,-(a7)		* ... sector = 1,
+		move.w	8(a6),-(a7)		* ... drive #,
+		clr.l	-(a7)			* ... filler
+		move.l	#buffer,-(a7)		* ... buffer address,
+		jsr	floprd			* Go read the sector
+		add.l	#16,a7			* Cleanup stack
+		move.l	d0,-12(a6)		* Save error code
+		tst.l	-12(a6)			* ... and test it
+		bge	gbpb2			* Jump if OK
+*
+		move.w	8(a6),(a7)		* Put drive number on stack
+		move.l	-12(a6),d0		* Get error code
+		move.w	d0,-(a7)		* ... and put it on the stack
+		jsr	criter			* Go do critical error routine
+		addq.l	#2,a7			* Cleanup stack
+		move.l	d0,-12(a6)		* Save error code
+*
+gbpb2:		move.l	-12(a6),d0		* Get error code
+		cmp.l	#RETRYIT,d0		* Magic number for retry ?
+		beq	gbpbrds			* Re-read if so
+*
+		tst.l	-12(a6)			* Test error code
+		bge	gbpb3			* Jump if OK
+*
+		clr.l	d0			* Set code in d0
+		bra	gbpber			* Go set error code
+*
+		.page
+*
+gbpb3:		move.l	#buffer+11,(a7)		* Bytes per sector
+		bsr	itom			* Convert 8086 to 68K format
+		move.w	d0,d7			* Save bytes per sector
+		beq	gbpb4			* Jump if zero
+*
+		move.b	buffer+13,d6		* Sectors per cluster
+		ext.w	d6			* ... sign extended
+		and.w	#$FF,d6			* ... and trimmed
+		bne	gbpb5			* Jump if non-zero
+*
+gbpb4:		clr.l	d0			* Set error code
+		bra	gbpber			* ...
+*
+gbpb5:		move.w	d7,(a4)			* Set recsize
+		move.w	d6,2(a4)		* Set clsiz
+		move.l	#buffer+22,(a7)		* Convert sectors per fat
+		bsr	itom			* ...
+		move.w	d0,8(a4)		* Set fsiz
+		move.w	8(a4),d0		* Get fsiz
+		addq.w	#1,d0			* ... plus 1
+		move.w	d0,10(a4)		* Set fatrec
+		move.w	(a4),d0			* Get recsize
+		muls.w	2(a4),d0		* ... times clsiz
+		move.w	d0,4(a4)		* Set clsizb
+		move.l	#buffer+17,(a7)		* Convert number of dir ents
+		bsr	itom			* ...
+		asl.w	#5,d0			* ... times 32
+		ext.l	d0			* ... sign extended
+		divs.w	(a4),d0			* ... / recsize
+		move.w	d0,6(a4)		* Set rdlen
+		move.w	10(a4),d0		* Get fatrec
+		add.w	6(a4),d0		* ... + rdlen
+		add.w	8(a4),d0		* ... + fsiz
+		move.w	d0,12(a4)		* Set datrec
+		move.l	#buffer+19,(a7)		* Get number of sectors
+		bsr	itom			* ... convert
+		sub.w	12(a4),d0		* ... - datrec
+		ext.l	d0			* ... sign extended
+		divs.w	2(a4),d0		* ... / clsiz
+		move.w	d0,14(a4)		* Set numcl
+*
+		.page
+*
+		move.l	#buffer+26,(a7)		* Convert number of heads
+		bsr	itom			* ...
+		move.w	d0,20(a5)		* Set dnsides
+		move.l	#buffer+24,(a7)		* Convert sectors per track
+		bsr	itom			* ...
+		move.w	d0,24(a5)		* Set dspt
+		move.w	20(a5),d0		* Get dnsides
+		muls.w	24(a5),d0		* ... * dspt
+		move.w	d0,22(a5)		* Set dspc
+		move.l	#buffer+28,(a7)		* Convert number of hidden sects
+		bsr	itom			* ...
+		move.w	d0,26(a5)		* Set dhidden
+		move.l	#buffer+19,(a7)		* Convert sectors on disk
+		bsr	itom			* ...
+		ext.l	d0			* ... sign extended
+		divs.w	22(a5),d0		* ... / dspc
+		move.w	d0,18(a5)		* Set dntracks
+		clr.w	d7			* Counter = 0
+		bra	gbpblpt			* Jump to end of loop
+*
+gbpb6:		move.l	a5,a0			* Get buffer pointer
+		move.w	d7,a1			* Loop count to a1
+		add.l	a1,a0			* ... + bpb address
+		move.w	d7,a1			* Loop count to a1
+		add.l	#buffer,a1		* ... + buffer address
+		move.b	8(a1),28(a0)		* Copy a s/n byte
+		addq.w	#1,d7			* Update loop count
+*
+gbpblpt:	cmp.w	#3,d7			* Moved 3 bytes ?
+		blt	gbpb6			* Loop if not
+*
+		.page
+*
+		move.l	#cdev,a0		* Address of cdev table
+		move.w	8(a6),a1		* ... plus drive number
+		add.l	a1,a0			* ... to a0
+		move.l	#wpstatus,a1		* Address of wpstatus table
+		move.w	8(a6),a2		* ... plus drive number
+		add.l	a2,a1			* ... to a1
+		move.b	(a1),(a0)		* Move wpstatus to cdev
+		beq	gbpb7
+*
+		moveq.l	#1,d0			* Set status = "Uncertain"
+		bra	gbpb8
+*
+gbpb7:		clr.w	d0			* Set status = "Unchanged"
+*
+gbpb8:		move.l	#dskmode,a1		* Update dskmode table
+		move.w	8(a6),a2		* ...
+		add.l	a2,a1			* ...
+		move.b	d0,(a1)			* ...
+		move.l	a5,d0			* Setup to return bpb pointer
+*
+gbpber:		tst.l	(a7)+			* Pop garbage off top of stack
+		movem.l	(a7)+,d6-d7/a4-a5	* Restore registers
+		unlk	a6
+		rts
+*
+		.page
+*
+* mediach -- check for media change
+* -------    ----------------------
+mediach:	link	a6,#0			* Create scratch on stack
+		movem.l	d6-d7/a5,-(a7)		* Save registers on stack
+		cmp.w	#2,8(a6)		* Check drive number
+		blt	media1			* Jump if OK
+*
+		moveq.l	#ERR15,d0		* Error -- "unknown device"
+		bra	media2			* ...
+*
+media1:		move.w	8(a6),d7		* Get drive number in d7
+		movea.w	d7,a5			* Point into dskmode table
+		add.l	#dskmode,a5		* ...
+		cmp.b	#2,(a5)			* Definitely changed ?
+		bne	media3			* Jump if not
+*
+		moveq.l	#2,d0			* Setup to return "Changed"
+		bra	media2			* Done -- go return to caller
+*
+media3:		move.l	#wplatch,a0		* Check wplatch for drive
+		tst.b	0(a0,d7)		* ...
+		beq	media4			* Jump if not set
+*
+		move.b	#1,(a5)			* Set dskmode to "Uncertain"
+*
+media4:		move.l	_hz_200,d0		* Get time in d0
+		movea.w	d7,a1			* Calculate acctim table address
+		add.l	a1,a1			* ... = drive # * 4
+		add.l	a1,a1			* ...
+		add.l	#acctim,a1		* ... + acctim base address
+		move.l	(a1),d1			* Get acctim for drive
+		sub.l	d1,d0			* Subtract from current time
+		cmp.l	maxactim,d0		* Timed out ?
+		bge	media5			* Jump if so
+*
+		clr.w	d0			* Setup to return "Unchanged"
+		bra	media2
+*
+media5:		move.b	(a5),d0			* Return status from dskmode
+		ext.w	d0
+*
+media2:		tst.l	(a7)+			* Pop extra stack word
+		movem.l	(a7)+,d7/a5		* Restore registers
+		unlk	a6
+		rts				* Return to caller
+*
+		.page
+*
+* rwabs -- read / write sector(s)
+* -----    ----------------------
+rwabs:		link	a6,#-4			* Reserve stack for temps
+		movem.l	d4-d7/a5,-(a7)		* Save registers on stack
+		cmp.w	#2,18(a6)		* Drive number
+		blt	rwabs1
+*
+		moveq.l	#ERR15,d0		* ERROR -- "unknown device"
+		bra	rwabser
+*
+rwabs1:		move.w	18(a6),d6		* Save drive number
+		cmp.w	#2,8(a6)		* Check rwflag
+		bge	rwabs7
+*
+		move.w	d6,d0
+		asl.w	#5,d0
+		ext.l	d0
+		move.l	d0,a5
+		add.l	#drvbpbs,a5
+		move.w	d6,(a7)
+		bsr	mediach			* Test for media change
+		move.w	d0,d7			* Save status
+		cmp.w	#2,d7			* Disk changed ?
+		bne	rwabs2			* Jump if not
+*
+		moveq.l	#ERR14,d0		* ERROR -- "media changed"
+		bra	rwabser			* ...
+*
+rwabs2:		cmp.w	#1,d7			* Disk possibly changed ?
+		bne	rwabs7
+*
+rwabs3:		move.w	#1,(a7)			* floprd count = 1,
+		clr.w	-(a7)			* ... side = 0,
+		clr.w	-(a7)			* ... track = 0,
+		move.w	#1,-(a7)		* ... sector = 1,
+		move.w	d6,-(a7)		* ... drive number,
+		clr.l	-(a7)			* ... filler,
+		move.l	#buffer,-(a7)		* ... buffer address,
+		jsr	floprd			* Read boot sector
+		add.l	#16,a7			* Cleanup stack
+		move.l	d0,-4(a6)		* Save error number
+		tst.l	-4(a6)			* ... and test it
+		bge	rwabs11			* Jump if OK
+*
+		.page
+*
+		move.w	d6,(a7)
+		move.l	-4(a6),d0
+		move.w	d0,-(a7)
+		jsr	criter			* Call critical error code
+		addq.l	#2,a7			* Cleanup stack
+		move.l	d0,-4(a6)
+*
+rwabs11:	move.l	-4(a6),d0
+		cmp.l	#RETRYIT,d0
+		beq	rwabs3			* Read again
+*
+		tst.l	-4(a6)			* Test error number
+		bge	rwabs4			* OK ?
+*
+		move.l	-4(a6),d0
+		bra	rwabser			* ERROR
+*
+rwabs4:		clr.w	d7			* Clear media change status
+		bra	rwabs10
+*
+rwabs6:		move.l	#buffer,a0		* Address of sector buffer to a0
+		move.b	8(a0,d7),d0		* Serial number
+		ext.w	d0
+		move.b	28(a5,d7),d1		* Compare to old one
+		ext.w	d1
+		cmp.w	d1,d0
+		beq	rwabs5			* Jump if they're the same
+*
+		moveq.l	#ERR14,d0		* ERROR -- "media changed"
+		bra	rwabser
+*
+rwabs5:		addq.w	#1,d7			* Next byte of serial number
+*
+rwabs10:	cmp.w	#3,d7			* All 3 bytes checked ?
+		blt	rwabs6			* Loop if not
+*
+		.page
+*
+		move.w	d6,a0			* Point at wplatch for drive
+		add.l	#wplatch,a0		* ...
+		move.w	d6,a1			* Point at wpstatus for drive
+		add.l	#wpstatus,a1		* ...
+		move.b	(a1),(a0)		* Move wpstatus to wplatch
+		bne	rwabs9			* Jump if set
+*
+		move.w	d6,a0			* Set dskmode to "Unchanged"
+		add.l	#dskmode,a0		* ...
+		clr.b	(a0)			* ...
+*
+rwabs7:		tst.w	nflops			* Test nflops
+		bne	rwabs8
+*
+		moveq.l	#ERR02,d0		* ERROR -- "drive not ready"
+		bra	rwabser
+*
+rwabs8:		cmp.w	#1,8(a6)		* Check rwflag
+		ble	rwabs9
+*
+		subq.w	#2,8(a6)		* Adjust to 0|1
+*
+rwabs9:		move.w	14(a6),(a7)		* Setup count,
+		move.w	d6,-(a7)		* ... drive,
+		move.w	16(a6),-(a7)		* ... recno,
+		move.l	10(a6),-(a7)		* ... buffer,
+		move.w	8(a6),-(a7)		* ... rwflag
+		bsr	floprw			* Call floprw
+*
+		add.l	#10,a7			* Cleanup stack
+*
+rwabser:	tst.l	(a7)+			* Pop stack scratch
+		movem.l	(a7)+,d5-d7/a5		* Restore registers
+		unlk	a6			* Release temporaries
+		rts				* Return to caller
+*
+		.page
+*
+* floprw -- Floppy read / write driver
+* ------    --------------------------
+floprw:		link	a6,#-6			* Reserve space for temps
+		movem.l	d2-d7/a5,-(a7)		* Save registers
+		move.w	16(a6),d0		* Drive number to d0
+		asl.w	#5,d0			* Shift ( *32 )
+		ext.l	d0			* Sign extend it, too
+		move.l	d0,a5			* Result in a5
+		add.l	#drvbpbs,a5		* Add base of BPB table
+		btst	#0,13(a6)		* Buffer address even ?
+		bne	floprw01		* Jump if not
+*
+		clr.w	d0			* Clear odd flag
+		bra	floprw02		* Go save the flag
+*
+floprw01:	moveq.l	#1,d0			* Set odd flag
+*
+floprw02:	move.w	d0,-2(a6)		* Save it
+		tst.w	22(a5)			* dspc set ?
+		bne	floprw20		* Jump if so
+*
+		moveq.l	#9,d0			* Assume 9
+		move.w	d0,22(a5)		* ... and make it the default
+		move.w	d0,24(a5)		* ... for dspt and dspc
+*
+floprw20:	bra	floprw18
+*
+floprw03:	tst.w	-2(a6)			* Is odd flag set ?
+		beq	floprw04		* Jump if not
+*
+		move.l	#buffer,d0		* Point to sector buffer
+		bra	floprw05
+*
+floprw04:	move.l	10(a6),d0		* Get buffer address
+*
+floprw05:	move.l	d0,-6(a6)		* ... and save
+		move.w	14(a6),d6		* Get recno  (lsn)
+		ext.l	d6			* Extend it to long
+		divs.w	22(a5),d6		* Divide by dspc for track #
+		move.w	14(a6),d4		* Get recno
+		ext.l	d4			* Extend to long
+		divs.w	22(a5),d4		* Divide by dspc
+		swap	d4			* Use remainder as sector number
+		cmp.w	24(a5),d4		* Compare with dspt
+		bge	floprw06		* Greater than or equal ?
+*
+		clr.l	d5			* Use side 0
+		bra	floprw07
+*
+floprw06:	moveq.l	#1,d5			* Use side 1
+		sub.w	24(a5),d4		* Subtract dspt from sector #
+*
+		.page
+*
+floprw07:	tst.w	-2(a6)			* Is odd flag set ?
+		beq	floprw08		* Jump if not
+*
+		moveq.l	#1,d3			* Set counter to 1
+		bra	floprw10
+*
+floprw08:	move.w	24(a5),d0		* Get dspt
+		sub.w	d4,d0			* Subtract sector number
+		cmp.w	18(a6),d0		* Compare with number of sectors
+		bge	floprw09		* Jump if greater than or eq to
+*
+		move.w	24(a5),d3		* Get dspt
+		sub.w	d4,d3			* Subtract sector number
+		bra	floprw10
+*
+floprw09:	move.w	18(a6),d3		* Count = number of sectors
+*
+floprw10:	addq.w	#1,d4			* Adjust sector number (1 org)
+*
+floprw11:	tst.w	8(a6)			* Test r/w flag
+		beq	floprw14		* Jump if it's a read
+*
+		move.l	-6(a6),d0		* Get buffer pointer
+		cmp.l	10(a6),d0		* See if it's = buffer addr
+		beq	floprw12		* Jump if so
+*
+		move.l	-6(a6),(a7)		* Get source address
+		move.l	10(a6),-(a7)		* Destination address
+		jsr	fastcopy		* Copy the sector
+		addq.l	#4,a7			* Cleanup stack
+*
+floprw12:	move.w	d3,(a7)			* Number of sectors
+		move.w	d5,-(a7)		* Side number
+		move.w	d6,-(a7)		* Track number
+		move.w	d4,-(a7)		* Sector number
+		move.w	16(a6),-(a7)		* Drive number
+		clr.l	-(a7)			* Filler
+		move.l	-6(a6),-(a7)		* Buffer address
+		jsr	flopwr			* Write sector
+		add.l	#16,a7			* Cleaup stack
+		move.l	d0,d7			* Save error code in d7
+		tst.l	d7			* Errors ?
+		bne	floprw13		* Jump if so
+*
+		.page
+*
+		tst.w	fverify			* Verify after write ?
+		beq	floprw13		* Jump if not
+*
+		move.w	d3,(a7)			* Number of sectors
+		move.w	d5,-(a7)		* Side number
+		move.w	d6,-(a7)		* Track number
+		move.w	d4,-(a7)		* Sector number
+		move.w	16(a6),-(a7)		* Drive number
+		clr.l	-(a7)			* Filler
+		move.l	#buffer,-(a7)		* Buffer address
+		jsr	flopver			* Verify sector(s)
+		add.l	#16,a7			* Cleanup stack
+		move.l	d0,d7			* Save error code in d7
+		tst.l	d7			* Errors ?
+		bne	floprw13		* Jump if so
+*
+		move.l	#buffer,(a7)		* Address of sector buffer
+		bsr	itom			* Convert first word of buffer
+		tst.w	d0			* Bad sectors ?
+		beq	floprw13		* Jump if not
+*
+		moveq.l	#ERR16,d7		* ERROR -- "Bad sectors"
+*
+floprw13:	bra	floprw15
+*
+		.page
+*
+floprw14:	move.w	d3,(a7)			* Number of sectors
+		move.w	d5,-(a7)		* Side number
+		move.w	d6,-(a7)		* Track number
+		move.w	d4,-(a7)		* Sector number
+		move.w	16(a6),-(a7)		* Drive number
+		clr.l	-(a7)			* Filler
+		move.l	-6(a6),-(a7)		* Sector buffer
+		jsr	floprd			* Read floppy sector(s)
+		add.l	#16,a7			* Cleanup stack
+		move.l	d0,d7			* Save error code in d7
+		move.l	-6(a6),d0		* User buffer address
+		cmp.l	10(a6),d0		* Is it the desired buffer ?
+		beq	floprw15		* Jump if so
+*
+		move.l	10(a6),(a7)		* Push source address
+		move.l	-6(a6),-(a7)		* Push destination address
+		jsr	fastcopy		* Copy the sector
+		addq.l	#4,a7			* Cleanup stack
+*
+floprw15:	tst.l	d7			* Error code set ?
+		bge	floprw16		* Jump if not
+*
+		move.w	16(a6),(a7)		* Push drive number
+		move.l	d7,d0			* Error code
+		move.w	d0,-(a7)		* ... onto stack
+		jsr	criter			* Call critical error handler
+		addq.l	#2,a7			* Cleanup stack
+		move.l	d0,d7			* Get error code
+*
+floprw16:	cmp.l	#RETRYIT,d7		* Re-try ?
+		beq	floprw11		* Jump if so
+*
+		tst.l	d7			* Check error code
+		bge	floprw17		* Jump if no error
+*
+		move.l	d7,d0			* Error code is the result
+		bra	floprw19
+*
+		.page
+*
+floprw17:	move.w	d3,d0			* Sector counter to d0
+		ext.l	d0			* Sign extend
+		moveq.l	#9,d1			* Times 512
+		asl.l	d1,d0			* ...
+		add.l	d0,10(a6)		* Update buffer address
+		add.w	d3,14(a6)		* Update sector number
+		sub.w	d3,18(a6)		* Update sector count
+*
+floprw18:	tst.w	18(a6)			* More sectors ?
+		bne	floprw03		* Jump if so
+*
+		clr.l	d0			* Set "no error" as result
+*
+floprw19:	tst.l	(a7)+			* Test top of stack
+		movem.l	(a7)+,d3-d7/a5		* Restore registers
+		unlk	a6			* Release stack space
+		rts				* Return to caller
+*
+		.page
+*
+* itom -- Convert 8086 integer format to 680000 integer format
+* ----    ----------------------------------------------------
+itom:		link	a6,#-4			* Reserve stack for temps
+		move.l	8(a6),a0		* Address of the number to a0
+		move.b	1(a0),d0		* Get high byte
+		ext.w	d0			* Make it a word
+		and.w	#$FF,d0			* Isolate bits 0..7
+		asl.w	#8,d0			* Shift in bits 8..15
+		move.l	8(a6),a1		* Address of the number to a1
+		move.b	(a1),d1			* Get low byte
+		ext.w	d1			* Extend to word
+		and.w	#$FF,d1			* Isolate bits 0..7
+		or.w	d1,d0			* Combine with bits 8..15
+		unlk	a6			* Release stack space
+		rts				* Return to caller
+*
+		.page
+*
+* flopini -- Initialize floppy drive
+* -------    -----------------------
+flopini:	lea	dsb0,a1			* Point to dsb for drive A
+		tst.w	12(a7)			* Drive A wanted ?
+		beq	flopin01		* Jump if so
+*
+		lea	dsb1,a1			* Drive B dsb address to a1
+*
+flopin01:	move.w	seekrate,2(a1)		* Get seek rate
+		moveq.l	#ERR01,d0		* Set default error number
+		clr.w	0(a1)			* Set track number to 0
+		bsr	floplock		* Setup floppy parameters
+		bsr	select			* Select drive and side
+		move.w	#$FF00,0(a1)
+		bsr	restore			* Restore the drive
+		moveq.l	#6,d7
+		bsr	hseek1
+		bne	flopin02
+*
+		bsr	restore			* Restore the drive
+		beq	flopok			* Jump if no error
+*
+flopin02:	bra	flopfail		* Jump to error handler
+*
+		.page
+*
+* floprd -- Read floppy
+* ------    -----------
+floprd:		bsr	change			* Disk changed ?
+		moveq.l	#ERR11,d0		* Set to "read error"
+		bsr	floplock		* Set parameters
+*
+floprd01:	bsr	select			* Select drive and side
+		bsr	go2track		* Position on track
+		bne	floprd02		* Try again on error
+*
+		move.w	#ERR01,deferr		* Set default error
+		move.l	edma(a5),a0		* Get final DMA address
+		move.l	cdma(a5),a2		* Get first DMA address
+		move.l	#$40000,d7		* Set timeout counter
+		move.b	#FL_RM,DSKCMD(a6)	* Start readng the disk
+*
+floprd03:	btst	#0,DSKCMD(a6)		* Disk busy yet ?
+		bne	floprd05		* Jump if so
+*
+		subq.l	#1,d7			* Decrement timeout counter
+		beq	floprd04		* Jump if timed out
+*
+		bra	floprd03		* Go try for busy again
+*
+floprd05:	move.l	#$40000,d7		* Reset timeout counter
+		bra	floprd09		* Go join main read loop
+*
+floprd07:	subq.l	#1,d7			* Decrement timeout counter
+		beq	floprd04		* Jump if timed out
+*
+		btst	#0,DSKCMD(a6)		* Done yet ?
+		beq	floprd08		* Jump if so
+*
+floprd09:	btst	#1,DSKCMD(a6)		* DRQ set ?
+		beq	floprd07		* Jump if not
+*
+		move.b	DSKDAT(a6),(a2)+	* Read the byte into the buffer
+		cmp.l	a0,a2			* Done reading ?
+		bne	floprd07		* Jump if not
+*
+		.page
+*
+floprd08:	move.b	DSKCMD(a6),d0		* Read final status into d0
+		and.b	#$1C,d0			* Mask for error bits
+		beq	flopok			* Jump if no errors
+*
+		bsr	errbits			* Determine error code
+*
+floprd02:	cmp.w	#1,retrycnt(a5)		* Re-try ?
+		bne	floprd06		* Jump if not
+*
+		bsr	reseek			* Home and repeat the seek
+*
+floprd06:	subq.w	#1,retrycnt(a5)		* Update re-try count
+		bpl	floprd01		* Re-try if count still >0
+*
+		bra	flopfail		* Failure
+*
+floprd04:	move.w	#ERR02,curerr(a5)	* Set error code "not ready"
+		bsr	rs1772			* Reset the WD1772
+		bra	floprd02		* See if it can be retried
+*
+		.page
+*
+* errbits -- Develop error code for floppy I/O error
+* -------    ---------------------------------------
+errbits:	moveq.l	#ERR13,d1		* Write protect ?
+		btst	#6,d0			* ...
+		bne	errbits1		* Jump if so
+*
+		moveq.l	#ERR08,d1		* Record not found ?
+		btst	#4,d0			* ...
+		bne	errbits1		* Jump if so
+*
+		moveq.l	#ERR04,d1		* CRC error ?
+		btst	#3,d0			* ...
+		bne	errbits1		* Jump if so
+*
+		moveq.l	#ERR12,d1		* Lost data ?
+		btst	#2,d0			* ...
+		bne	errbits1		* Jump if so
+*
+		move.w	deferr(a5),d1		* Use default error
+*
+errbits1:	move.w	d1,curerr(a5)		* ... as curerr
+		rts				* Return to caller
+*
+		.page
+*
+* flopwr -- Floppy write
+* ------    ------------
+flopwr:		bsr	change			* Check for disk change
+		moveq.l	#ERR10,d0		* Set write error
+		bsr	floplock		* Set parameters
+		move.w	csect(a5),d0		* Get sector number in d0
+		subq.w	#1,d0			* ... -1
+		or.w	ctrack(a5),d0		* OR with track number
+		or.w	cside(a5),d0		* OR with side number
+		bne	flopwr01		* Jump if not boot sector
+*
+		moveq.l	#2,d0			* Media change
+		bsr	setdmode		* Set to "unsure"
+*
+flopwr01:	bsr	select			* Select drive and side
+		bsr	go2track		* Seek
+		bne	flopwr06		* Re-try on error
+*
+flopwr02:	move.w	#ERR01,curerr(a5)	* Set for default error
+		move.l	cdma(a5),a2		* Get I/O address
+		move.l	#$40000,d7		* Set timeout counter
+		move.w	ctrack(a5),d0		* Get track number
+		cmpi.w	#40,d0			* See if we need precomp
+		bcs	flopwr10		* Jump if not
+*
+		move.b	#FL_WS,DSKCMD(a6)	* Write with precomp
+		bra	flopwr08		* Go join main write loop
+*
+flopwr10:	move.b	#FL_WS+FL_NC,DSKCMD(a6)	* Write  (no precomp)
+*
+		.page
+*
+flopwr08:	btst	#0,DSKCMD(a6)		* Busy yet ?
+		bne	flopwr09		* Jump if so
+*
+		subq.l	#1,d7			* Decrement tiemout count
+		bne	flopwr08		* Jump if not timed out
+*
+flopwr13:	bsr	rs1772			* Reset WD1772
+		bra	flopwr05		* See if we can retry
+*
+flopwr11:	btst	#0,DSKCMD(a6)		* Done ?
+		beq	flopwr04		* Jump if so
+*
+flopwr09:	btst	#1,DSKCMD(a6)		* DRQ set ?
+		bne	flopwr12		* Jump if so
+*
+		subq.l	#1,d7			* Decrement timeout counter
+		beq	flopwr13		* Jump if timed out
+*
+		bra	flopwr11		* Jump if not
+*
+flopwr12:	move.b	(a2)+,DSKDAT(a6)	* Write byte to floppy
+		bra	flopwr11		* Go get the next one
+*
+		.page
+*
+flopwr04:	move.b	DSKCMD(a6),d0		* Get floppy status
+		bsr	errbits			* Set error code
+		btst	#6,d0			* Write protect error ?
+		bne	flopfail		* Fail if so
+*
+		and.b	#$5C,d0			* Mask error bits
+		bne	flopwr05		* Jump if an error occurred
+*
+		addq.w	#1,csect(a5)		* Update sector number
+		add.l	#512,cdma(a5)		* Update DMA address
+		subq.w	#1,ccount(a5)		* Decrement sector count
+		beq	flopok			* Jump if zero -- done
+*
+		bsr	select1			* Set sector and DMA pointer
+		bra	flopwr02		* Write next sector
+*
+flopwr05:	cmp.w	#1,retrycnt(a5)		* Second re-try ?
+		bne	flopwr07		* Jump if not
+*
+flopwr06:	bsr	reseek			* Restore and re-seek
+*
+flopwr07:	subq.w	#1,retrycnt(a5)		* Update re-try count
+		bpl	flopwr01		* Re-try if still >0
+*
+		bra	flopfail		* ... else fail
+*
+		.page
+*
+* flopfmt -- Format a track on the floppy
+* -------    ----------------------------
+flopfmt:	cmp.l	#FMAGIC,22(a7)		* Is the magic right ?
+		bne	flopfail		* Fail immediately if not
+*
+		bsr	change			* Check for disk change
+		moveq.l	#ERR01,d0		* Set default error number
+		bsr	floplock		* Set parameters
+		bsr	select			* Select drive and side
+		move.w	14(a7),spt(a5)		* Set sectors per track,
+		move.w	20(a7),interlv(a5)	* ... interleave,
+		move.w	26(a7),virgin(a5)	* ... initial data,
+		moveq.l	#2,d0			* Disk changed
+		bsr	setdmode		* ...
+		bsr	hseek			* Seek
+		bne	flopfail		* Fail if seek error occurs
+*
+		move.w	ctrack(a5),0(a1)	* Current track to DSB
+		move.w	#ERR01,curerr(a5)	* Default to curerr
+		bsr	fmtrack			* Format the track
+		bne	flopfail		* Fail if error occurs
+*
+		move.w	spt(a5),ccount(a5)	* Use spt as ccount
+		move.w	#1,csect(a5)		* Start with sector 1
+		bsr	verify1			* Verify the sector
+		move.l	cdma(a5),a2		* Get bad sector list
+		tst.w	(a2)			* Any bad ones ?
+		beq	flopok			* Jump if not
+*
+		move.w	#ERR16,curerr(a5)	* ERROR -- "bad sectors"
+		bra	flopfail
+*
+		.page
+*
+* fmtrack -- Do the dirty work of formatting a track
+* -------    ---------------------------------------
+fmtrack:	move.w	#ERR10,deferr(a5)	* Set default error number
+		move.w	#1,d3			* Start with sector 1
+		move.l	cdma(a5),a2		* Get track buffer address
+		move.w	#60-1,d1		* Set count = 60
+		move.b	#$4E,d0			* Write $4E as initial gap
+		bsr	wmult			* ...
+*
+fmtrak01:	move.w	d3,d4			* Save sector number in d4
+*
+fmtrak02:	move.w	#12-1,d1		* Set count = 12
+		clr.b	d0			* Write $00 as sync
+		bsr	wmult			* ...
+		move.w	#3-1,d1			* Set count = 3
+		move.b	#$F5,d0			* Write $F5's
+		bsr	wmult			* ...
+		move.b	#$FE,(a2)+		* Write $FE (address mark)
+		move.b	ctrack+1,(a2)+		* Write track #
+		move.b	cside+1,(a2)+		* Write side #
+		move.b	d4,(a2)+		* Write sector #
+		move.b	#2,(a2)+		* Write sector size code
+		move.b	#$F7,(a2)+		* Write checksum code
+		move.w	#22-1,d1		* Set count = 22
+		move.b	#$4E,d0			* Write gap
+		bsr	wmult			* ...
+		move.w	#12-1,d1		* Set count = 12
+		clr.b	d0			* Write $00 as sync
+		bsr	wmult			* ...
+		move.w	#3-1,d1			* Set count = 3
+		move.b	#$F5,d0			* Write $F5's
+		bsr	wmult			* ...
+		move.b	#$FB,(a2)+		* Write DAM
+		move.w	#256-1,d1		* Set count = 256 words
+*
+		.page
+*
+fmtrak03:	move.b	virgin(a5),(a2)+	* Write virgin data in buffer
+		move.b	virgin+1(a5),(a2)+	* ...
+		dbf	d1,fmtrak03		* ...
+*
+		move.b	#$F7,(a2)+		* Write CRC code
+		move.w	#40-1,d1		* Set count = 40
+		move.b	#$4E,d0			* Write gap
+		bsr	wmult			* ...
+		add.w	interlv(a5),d4		* Add interleave to sector #
+		cmp.w	spt(a5),d4		* Check against spt
+		ble	fmtrak02		* Jump if not >
+*
+		addq.w	#1,d3			* Starting sector +1
+		cmp.w	interlv(a5),d3
+		ble	fmtrak01
+*
+		move.w	#1401-1,d1		* Set count = 1401
+		move.b	#$4E,d0			* Write final gap
+		bsr	wmult			* ...
+		move.l	cdma(a5),a2		* Get buffer address
+		move.l	#$40000,d7		* Set timeout count
+		move.w	ctrack(a5),d0		* Get track number
+		cmpi.w	#40,d0			* Do we need precomp ?
+		bcs	fmtrak08		* Jump if not
+*
+		move.b	#FL_WT,DSKCMD(a6)	* Start format with precomp
+		bra	fmtrak07		* Go join main format loop
+*
+fmtrak08:	move.b	#FL_WT+FL_NC,DSKCMD(a6)	* Start format without precomp
+*
+		.page
+*
+fmtrak07:	btst	#0,DSKCMD(a6)		* Busy yet ?
+		bne	fmtrak09		* Jump if so
+*
+fmtrak04:	subq.l	#1,d7			* Decrement timeout counter
+		bne	fmtrak07		* Jump if not timed out
+*
+fmtrak05:	bsr	rs1772			* Reset WD1772
+		moveq.l	#1,d7			* Set error flag
+		rts				* Return to caller
+*
+fmtrak11:	btst	#0,DSKCMD(a6)		* Done ?
+		beq	fmtrak06		* Jump if so
+*
+fmtrak09:	btst	#1,DSKCMD(a6)		* DRQ set ?
+		bne	fmtrak10		* Jump if so
+*
+		subq.l	#1,d7			* Decrement timeout coutner
+		beq	fmtrak05		* Jump if timed out
+*
+		bra	fmtrak11		* Go check again
+*
+fmtrak10:	move.b	(a2)+,DSKDAT(a6)	* Write a byte of format
+		bra	fmtrak11		* Go wait for DRQ
+*
+fmtrak06:	move.b	DSKCMD(a6),d0		* Get final status
+		bsr	errbits			* Set possible error code
+		andi.b	#$44,d0			* Check error bits
+		rts				* Return to caller with status
+*
+* wmult -- write multiple bytes into the track buffer
+* -----    ------------------------------------------
+wmult:		move.b	d0,(a2)+		* Move a byte into the buffer
+		dbf	d1,wmult		* Loop until we're done
+*
+		rts				* Return to caller
+*
+		.page
+*
+* flopver -- verify sector(s) on a floppy
+* -------    ----------------------------
+flopver:	bsr	change			* Check for disk change
+		moveq.l	#ERR11,d0		* Set default to "read error"
+		bsr	floplock		* Set parameters
+		bsr	select			* Select drive and side
+		bsr	go2track		* Seek
+		bne	flopfail		* Jump if seek error
+*
+		bsr	verify1			* Verify the data
+		bra	flopok			* Done
+*
+* verify1 -- Verify the data for a sector
+* -------    ----------------------------
+verify1:	move.w	#ERR11,deferr(a5)	* Set default = "read error"
+		move.l	cdma(a5),a2		* Pointer for bad sector list
+		add.l	#512,cdma(a5)		* Update by length of a sector
+*
+verify01:	move.w	#2,retrycnt(a5)		* Set retrycnt for 2 attempts
+		move.w	csect(a5),d7		* Get sector nubmer
+		move.b	d7,DSKSEC(a6)		* Send to WD1772
+*
+verify02:	moveq.l	#0,d6			* Clear bad compare flag
+		move.l	cdma(a5),a0		* Get compare address
+		move.l	#$40000,d7		* Set timeout counter
+		move.b	#FL_RS,DSKCMD(a6)	* Start the read
+*
+verify08:	btst	#0,DSKCMD(a6)		* Busy yet ?
+		bne	verify09		* Jump if so
+*
+		subq.l	#1,d7			* Decrement timeout counter
+		beq	verify13		* Jump if timed out
+*
+		bra	verify08		* Wait for busy some more
+*
+verify09:	move.l	#$40000,d7		* Reset timeout counter
+		bra	verify11		* Go join main compare loop
+*
+verify10:	subq.l	#1,d7			* Decrement timeout counter
+		beq	verify13		* Jump if timed out
+*
+		btst	#0,DSKCMD(a6)		* Done yet ?
+		beq	verify12		* Jump if so
+*
+		.page
+*
+verify11:	btst	#1,DSKCMD(a6)		* DRQ set ?
+		beq	verify10		* Jump if not
+*
+		move.b	DSKDAT(a6),d0		* Read data
+		bra	verify10		* Continue reading
+*
+verify12:	move.b	DSKCMD(a6),d0		* Get final status
+		bsr	errbits			* Determine error code
+		and.b	#$1C,d0			* Mask RNF, CRC, LOST
+		bne	verify06		* Jump to re-try if any set
+*
+verify05:	addq.w	#1,csect(a5)		* Update sector number
+		subq.w	#1,ccount(a5)		* Update sector count
+		bne	verify01		* Jump if more to do
+*
+		sub.l	#512,cdma(a5)		* Reset DMA pointer
+		clr.w	(a2)			* Set NIL in bad sector list
+		rts				* Return to caller
+*
+verify06:	cmp.w	#1,retrycnt(a5)		* Is it the 2nd attempt ?
+		bne	verify07		* Jump if not
+*
+		bsr	reseek			* Restore and re-seek
+*
+verify07:	subq.w	#1,retrycnt(a5)		* Decrement retry count
+		bpl	verify02		* Re-try if still positive
+*
+		move.w	csect(a5),(a2)+		* Add to bad sector list
+		bra	verify05		* Go do next sector
+*
+verify13:	move.w	#ERR02,curerr(a5)	* Set timeout error code
+		bsr	rs1772			* Reset WD1772
+		bra	verify06		* See if we can retry it
+*
+		.page
+*
+* flopvbl -- Floppy VBL timer interrupt handling
+* -------    -----------------------------------
+flopvbl:	movem.l	d0-d1/a0-a1/a5-a6,-(a7)	* Save registers
+		sub.l	a5,a5			* Clear a5 for use as RAM base
+		lea	FLOPPY,a6		* Base of floppy regs
+		st	motoron(a5)		* Set motoron flag
+		move.l	frclock(a5),d0		* Get interrupt count
+		move.b	d0,d1			* ...
+		and.b	#7,d1			* ... MOD 8
+		bne	flopvb02		* Jump if not 8th int
+*
+		move.w	sr,-(a7)		* Save interrupt level
+		ori.w	#IPL7,sr		* Mask off interrupts
+		clr.w	deslflag(a5)		* Clear deselect flag
+		move.b	mc1iorec+cfr1,d0	* Get port status
+		ori.b	#1,d0			* Set drive select bit
+		move.b	d0,MC1ACIA+ACIA_CFR	* Send drive select to port
+		move.b	d0,mc1iorec+cfr1	* Store updated port status
+		move.w	(a7)+,sr		* Restore interrupt level
+		lea	wpstatus(a5),a0		* Point at wpstatus for drive
+		lea	dsb0(a5),a1		* Point at dsb0
+		move.b	DSKCMD(a6),d0		* Read WD1772 status
+		btst	#6,d0			* Test write protect bit
+		sne	(a0)			* ... and save
+*
+		.page
+*
+flopvb02:	move.w	wpstatus(a5),d0		* Get wpstatus of drive A
+		or.w	d0,wplatch(a5)		* OR into wplatch
+		tst.w	deslflag(a5)		* Floppies already deselected ?
+		bne	flopvb03		* Jump if so
+*
+		move.b	DSKCMD(a6),d0		* Read WD1772 status
+		btst	#7,d0			* Motor-on bit set ?
+		bne	flopvb04		* Don't de-select if it is
+*
+		move.w	sr,-(a7)		* Save sr
+		ori.w	#IPL7,sr		* Disable interrupts
+		move.b	mc1iorec+cfr1,d0	* Get cfr1 image
+		bclr	#0,d0			* Clear d0  (drive select)
+		move.b	d0,mc1iorec+cfr1	* Save new value
+		move.b	d0,MC1ACIA+ACIA_CFR	* Send to hardware
+		move.w	(a7)+,sr		* Restore sr  (enable ints)
+		move.w	#1,deslflag(a5)		* Set the deselect flag
+*
+flopvb03:	clr.w	motoron(a5)		* Clear motoron flag
+*
+flopvb04:	movem.l	(a7)+,d0-d1/a0-a1/a5-a6	* Restore registers
+		rts				* Return to caller
+*
+		.page
+*
+* floplock -- Setup floppy parameters
+* --------    -----------------------
+floplock:	movem.l	d3-d7/a3-a6,flpregs	* Save registers
+		move.w	sr,flpsrsv		* Save sr
+		ori.w	#IPL7,sr		* Disable ints
+		sub.l	a5,a5			* Clear a5
+		lea	FLOPPY,a6		* Base of floppy registers
+		st	motoron(a5)		* Set motoron flag
+		move.w	d0,deferr(a5)		* Set default error code
+		move.w	d0,curerr(a5)		* ... current error code
+		move.w	#1,flock(a5)		* Disable flopvbl routine
+		move.l	8(a7),cdma(a5)		* Set cdma
+		move.w	16(a7),cdev(a5)		* ... cdev
+		move.w	18(a7),csect(a5)	* ... csect
+		move.w	20(a7),ctrack(a5)	* ... ctrack
+		move.w	22(a7),cside(a5)	* ... cside
+		move.w	24(a7),ccount(a5)	* ... ccount
+		move.w	#2,retrycnt(a5)		* ... retrycnt
+		lea	dsb0(a5),a1		* Address of dsb0
+		tst.w	cdev(a5)		* Drive A ?
+		beq	floplk01		* Jump if so
+*
+		lea	dsb1(a5),a1		* Drive B, use dsb1
+*
+floplk01:	moveq.l	#0,d7			* Clear out d7
+		move.w	ccount(a5),d7		* Get ccount
+		lsl.w	#8,d7			* ... * sector length  (512)
+		lsl.w	#1,d7			* ...
+		move.l	cdma(a5),a0		* Get DMA start address
+		add.l	d7,a0			* Add length of sectors
+		move.l	a0,edma(a5)		* Set edma  (end DMA address)
+		tst.w	0(a1)			* Check current track
+		bpl	floplk03		* Jump if >= 0
+*
+		bsr	select			* Select the drive
+		clr.w	0(a1)			* Set current track to 0
+		bsr	restore			* Restore drive to track 0
+		beq	floplk03		* Jump if OK
+*
+		moveq.l	#10,d7			* Seek out to track 10
+		bsr	hseek1			* ...
+		bne	floplk02		* Jump if an error occurred
+*
+		bsr	restore			* Try the restore again
+		beq	floplk03		* Jump if OK
+*
+floplk02:	move.w	#$FF00,0(a1)		* Recalibrate error
+*
+floplk03:	rts				* Return to caller
+*
+		.page
+*
+* flopfail -- Floppy I/O failure exit
+* --------    -----------------------
+flopfail:	moveq.l	#1,d0			* Set media change to "unsure"
+		bsr	setdmode		* ...
+		move.w	curerr(a5),d0		* Get curerr
+		ext.l	d0			* ...
+		bra	flopok1			* Go set end status
+*
+* flopok -- Floppy I/O success exit
+* ------    -----------------------
+flopok:		clr.l	d0			* Set error code = 0  (no error)
+*
+flopok1:	move.l	d0,-(a7)		* Push code onto stack
+		move.w	0(a1),d7		* Get track number
+		move.b	d7,DSKDAT(a6)		* Send to WD1772
+		move.w	#FL_SK,d6		* Seek command to d6
+		bsr	flopcmds		* Send command
+		move.w	cdev(a5),d0		* Get drive number
+		lsl.w	#2,d0			* Use as index
+		lea	acctim(a5),a0		* ... into acctim
+		move.l	_hz_200(a5),0(a0,d0)	* Set last access time
+		cmp.w	#1,nflops(a5)
+		bne	flopok01
+*
+		move.l	_hz_200(a5),4(a0)	* Time for other drive
+*
+flopok01:	move.w	flpsrsv,sr		* Restore sr  (enable ints)
+		move.l	(a7)+,d0		* Restore error number to d0
+		movem.l	flpregs,d3-d7/a3-a6	* Restore registers
+		clr.w	flock			* Release flopvbl routine
+		rts				* Return to caller
+*
+		.page
+*
+* hseek -- seek to track in ctrack
+* -----    -----------------------
+hseek:		move.w	ctrack,d7		* Get ctrack
+*
+* hseek1 -- seek to track in d7
+* ------    -------------------
+hseek1:		move.w	#ERR10,curerr		* Set curerr = "seek error"
+		move.b	d7,DSKDAT(a6)		* Send track number to WD1772
+		move.w	#FL_SK,d6		* Seek command
+		bra	flopcmds		* Go send command to WD1772
+*
+* reseek -- Restore, then re-seek
+* ------    ---------------------
+reseek:		move.w	#ERR10,curerr		* Set curerr = "seek error"
+		bsr	restore			* Restore
+		bne	reseek01		* Jump if error occurred
+*
+		clr.w	0(a1)			* Clear current track to 0
+		move.b	#0,DSKTRK(a6)		* Send track to WD1772
+		move.b	#5,DSKDAT(a6)		* Setup to seek to track 5
+		move.w	#FL_SK,d6		* Seek command
+		bsr	flopcmds		* Seek
+		bne	reseek01		* Jump if error
+*
+		move.w	#5,0(a1)		* Update current track = 5
+*
+* go2track -- seek with verify
+* --------    ----------------
+go2track:	move.w	#ERR10,curerr(a5)	* Set curerr = "seek error"
+		move.w	ctrack(a5),d7		* Put track # in d7
+		move.b	d7,DSKDAT(a6)		* Send track to WD1772
+		moveq.l	#FL_SV,d6		* Seek/verify command
+		bsr	flopcmds		* Send command to floppy
+		bne	reseek01		* Jump if error occurred
+*
+		move.w	ctrack(a5),0(a1)	* Update track number in dsb
+		and.b	#$18,d7			* Test for RNF, CRC, LOST
+*
+reseek01:	rts				* Return to caller
+*
+		.page
+*
+* restore -- Restore to track 0
+* -------    ------------------
+restore:	clr.w	d6			* Restore command
+		bsr	flopcmds		* Send to WD1772
+		bne	restor01		* Jump if an error occurred
+*
+		btst	#2,d7			* Check track 0 bit
+		eori	#0004,sr		* Invert Z flag in 680000 sr
+		bne	restor01		* Jump if not track 0
+*
+		clr.w	0(a1)			* Set track = 0 in dsb
+*
+restor01:	rts				* Return to caller
+*
+* flopcmds -- Send command to WD1772 floppy controller
+* --------    ----------------------------------------
+flopcmds:	move.w	2(a1),d0		* Get seek rate from dsb
+		and.b	#$3,d0			* ...
+		or.b	d0,d6			* OR into command word
+		move.l	#$40000,d7		* Set timeout counter
+		btst	#7,DSKCMD(a6)		* Motor on ?
+		bne	flopcm01		* Jump if so
+*
+		move.l	#$60000,d7		* Set longer timeout count
+*
+flopcm01:	move.b	d6,DSKCMD(a6)		* Write command from d6
+*
+		move.l	#$1000,d0		* Set initial busy timeout in d0
+*
+flopcm04:	btst	#0,DSKCMD(a6)		* Controller busy yet ?
+		bne	flopcm02		* Jump if so
+*
+		subq.l	#1,d0			* Decrement timeout counter
+		beq	flopcm03		* Jump if timed out
+*
+		bra	flopcm04		* Wait for busy some more
+*
+flopcm02:	subq.l	#1,d7			* Decrement timeout counter
+		beq	flopcm03		* Jump if timed out
+*
+		btst	#0,DSKCMD(a6)		* WD1772 done ?
+		bne	flopcm02		* Jump if not
+*
+		clr.l	d7			* Clear out upper bits of d7
+		move.b	DSKCMD(a6),d7		* Read status into LS byte of d7
+		clr.l	d6			* Clear error flag in d6
+		rts				* Return to caller
+*
+flopcm03:	bsr	rs1772			* Reset WD1772  (end transfer)
+		moveq.l	#1,d6			* Set error flag in d6
+		rts				* Return to caller
+*
+		.page
+*
+* rs1772 -- Reset WD1772 floppy controller
+* ------    ------------------------------
+rs1772:		move.b	#FL_FR,DSKCMD(a6)	* Send reset to WD1772
+		move.w	#15,d7			* Set delay count
+*
+rs1772a:	dbf	d7,rs1772a		* Delay a while
+		rts				* Return to caller
+*
+* select -- Select drive and side
+* ------    ----------------------
+select:		move.w	sr,-(a7)		* Save sr on stack
+		ori.w	#IPL7,sr		* Disable interrupts
+		clr.w	deslflag(a5)		* Clear deselect flag
+		move.b	mc1iorec+cfr1,d0	* Get current MC1 cfr1 image
+		ori.b	#1,d0			* Select drive  (we only have 1)
+		move.b	d0,mc1iorec+cfr1	* Store updated image
+		move.b	d0,MC1ACIA+ACIA_CFR	* Send it to the MC1 ACIA
+		move.w	cside(a5),d0		* Get side number  (LS bit)
+		and.w	#1,d0			* Mask off garbage bits
+		andi.b	#$FE,mc2iorec+cfr1	* Mask off D0 in MC2 cfr1 image
+		or.b	mc2iorec+cfr1,d0	* OR side with mc2iorec cfr1
+		move.b	d0,mc2iorec+cfr1	* Store updated cfr1 image
+		move.b	d0,MC2ACIA+ACIA_CFR	* Send it to the MC2 ACIA
+		move.w	(a7)+,sr		* Restore interrupts
+		move.w	0(a1),d7		* Get track from dsb
+		move.b	d7,DSKTRK(a6)		* Send it to the WD1772
+		clr.b	tmpdma(a5)		* Clear bits 31..24 of tmpdma
+*
+select1:	move.w	csect(a5),d7		* Get sector number
+		move.b	d7,DSKSEC(a6)		* Send it to the WD1772
+		move.l	cdma(a5),a0		* Setup transfer address in a0
+		rts				* Return to caller
+*
+		.page
+*
+* change -- Check for disk change status
+* ------    ----------------------------
+change:		cmp.w	#1,nflops		* Check # of floppies
+		bne	change02
+*
+		move.w	16(a7),d0		* Drive number to d0
+		cmp.w	disknum,d0
+		beq	change01		* Jump if =
+*
+		move.w	d0,-(a7)		* Stack drive number
+		move.w	#ERR17,-(a7)		* Stack error code
+		bsr	criter			* Do critical error routine
+		addq.w	#4,a7			* Cleanup stack
+		move.w	#$FFFF,wplatch		* Status for drives = "unsure"
+		move.w	16(a7),disknum		* Save disk number
+*
+change01:	clr.w	16(a7)			* Clear disk number
+*
+change02:	rts				* Return to caller
+*
+* setdmode -- Set drive change mode
+* --------    ---------------------
+setdmode:	lea	dskmode,a0		* Point at disk mode table
+		move.b	d0,-(a7)		* Save mode on stack
+		move.w	cdev(a5),d0		* Get drive number
+		move.b	(a7)+,0(a0,d0)		* Set drive mode / cleanup stack
+		rts				* Return to caller
+*
+		.page
+*
+* bootload -- Load boot sector
+* --------    ----------------
+bootload:	link	a6,#0			* Link stack frames
+		movem.l	d6-d7,-(a7)		* Save registers
+		jsr	_hdvini			* Init drive
+		tst.w	nflops			* See if any connected
+		beq	bootld01		* Jump if drive there
+*
+		moveq.l	#1,d0			* "couldn't load"
+		bra	bootld02
+*
+bootld01:	moveq.l	#2,d0			* "no drive connected"
+*
+bootld02:	move.w	d0,d7			* Save possible error in d7
+		tst.w	nflops
+		beq	bootld04
+*
+		cmp.w	#2,bootdev
+		bge	bootld04
+*
+		move.w	#1,(a7)			* Sector count = 1,
+		clr.w	-(a7)			* ... side = 0,
+		clr.w	-(a7)			* ... track = 0,
+		move.w	#1,-(a7)		* ... sector = 1,
+		move.w	bootdev,-(a7)		* ... drive = bootdev,
+		clr.l	-(a7)			* ... filler,
+		move.l	#buffer,-(a7)		* ... buffer address
+		jsr	floprd			* Read the sector
+		add.l	#16,a7			* Cleanup stack
+		tst.l	d0			* Error ?
+		bne	bootld03		* Jump if not
+*
+		clr.w	d7
+		bra	bootld04
+*
+bootld03:	tst.b	wpstatus
+		bne	bootld04
+*
+		moveq.l	#3,d0			* "unreadable"
+		bra	bootld07
+*
+bootld04:	tst.w	d7
+		beq	bootld05
+*
+		move.w	d7,d0			* Get old error code
+		bra	bootld07
+*
+		.page
+*
+bootld05:	move.w	#256,(a7)		* Set count for 256 words
+		move.l	#buffer,-(a7)		* Point at buffer
+		bsr	chksum			* Calculate checksum
+		addq.l	#4,a7			* Cleanup stack
+		cmp.w	#$1234,d0		* Boot sector checksum ?
+		bne	bootld06		* Jump if not
+*
+		clr.w	d0			* Set flag for OK
+		move.w	bootdev,booted		* Save last boot device
+		bra	bootld07
+*
+bootld06:	moveq.l	#4,d0			* "not valid boot sector"
+*
+bootld07:	tst.l	(a7)+
+		movem.l	(a7)+,d7		* Restore registers
+		unlk	a6
+		rts				* Return to caller
+*
+		.page
+*
+* chksum -- caluculate checksum
+* ------    -------------------
+chksum:		link	a6,#0
+		movem.l	d6-d7,-(a7)		* Preserve registers
+		clr.w	d7			* Clear sum
+		bra	chksum02		* Jump into loop
+*
+chksum01:	move.l	8(a6),a0		* Get buffer address
+		move.w	(a0),d0			* Get word
+		add.w	d0,d7			* Add to checksum in d7
+		addq.l	#2,8(a6)		* Update buffer address
+*
+chksum02:	move.w	12(a6),d0		* Get word count
+		subq.w	#1,12(a6)		* Decrement it
+		tst.w	d0			* Done ?
+		bne	chksum01		* Loop if not
+*
+		move.w	d7,d0			* Put result in d0
+		tst.l	(a7)+
+		movem.l	(a7)+,d7		* Restore registers
+		unlk	a6
+		rts				* Return to caller
+*
+		.page
+*
+* mult32 -- 32 bit signed multiply
+* ------    ----------------------
+mult32:		link	a6,#-4
+		clr.w	d2
+		tst.l	8(a6)
+		bge	mult32a
+*
+		neg.l	8(a6)
+		addq.w	#1,d2
+*
+mult32a:	tst.l	12(a6)
+		bge	mult32b
+*
+		neg.l	12(a6)
+		addq.w	#1,d2
+*
+mult32b:	move.w	10(a6),d0
+		mulu	14(a6),d0
+		move.l	d0,-4(a6)
+		move.w	8(a6),d0
+		mulu	14(a6),d0
+		move.w	12(a6),d1
+		mulu	10(a6),d1
+		add.w	d1,d0
+		add.w	-4(a6),d0
+		move.w	d0,-4(a6)
+		move.l	-4(a6),d0
+		btst	#0,d2
+		beq	mult32c
+*
+		neg.l	d0
+*
+mult32c:	unlk	a6
+		rts
+*
+		.page
+*
+* rand -- Generate a random number
+* ----    ------------------------
+rand:		link	a6,#-4			* Reserve stack for temps
+		tst.l	rseed			* See if the seed is zero
+		bne	rand01			* Jump if not
+*
+		move.l	_hz_200,d0		* Pick up the 200 Hz clock
+		moveq.l	#16,d1			* Shift it left
+		asl.l	d1,d0			* ...
+		or.l	_hz_200,d0		* OR in current 200 Hz clock
+		move.l	d0,rseed		* Use that as the seed
+*
+rand01:		move.l	#$BB40E62D,-(a7)	* Put PI on the stack
+		move.l	rseed,-(a7)		* ... and rseed, too
+		bsr	mult32			* Multiply them
+		addq.l	#8,a7			* Cleanup stack
+		addq.l	#1,d0			* Add 1 to the result
+		move.l	d0,rseed		* Save as new seed
+		move.l	rseed,d0
+		asr.l	#8,d0			* Make it a 24 bit number
+		and.l	#$FFFFFF,d0		* ...
+		unlk	a6			* Release stack
+		rts				* Return to caller
+*
+		.page
+*
+* protobt -- Generate a prototype boot sector
+* -------    --------------------------------
+protobt:	link	a6,#-6
+		movem.l	d5-d7/a5,-(a7)		* Save registers
+		tst.w	18(a6)			* Test execflg
+		bge	protbt03		* Jump if set
+*
+		move.w	#256,(a7)		* Count = 256 words
+		move.l	8(a6),-(a7)		* Address of buffer
+		bsr	chksum			* Calculate checksum
+		addq.l	#4,a7			* Cleanup stack
+		cmp.w	#$1234,d0		* Boot checksum ?
+		beq	protbt01		* Jump if so
+*
+		clr.w	d0			* Not executable
+		bra	protbt02
+*
+protbt01:	moveq.l	#1,d0			* Executable
+*
+protbt02:	move.w	d0,18(a6)		* Set execflg
+*
+protbt03:	tst.l	12(a6)			* Serial number ?
+		blt	protbt07		* Jump if not to be changed
+*
+		move.l	12(a6),d0		* Get it into d0
+		cmp.l	#$FFFFFF,d0		* > $FFFFFF
+		ble	protbt04		* Jump if not
+*
+		bsr	rand			* Generate a random number
+		move.l	d0,12(a6)		* Save as s/n
+*
+protbt04:	clr.w	d7			* Clear counter
+		bra	protbt06		* Enter move loop
+*
+		.page
+*
+protbt05:	move.l	12(a6),d0		* Get s/n
+		and.l	#$FF,d0			* Isolate low 8 bits
+		move.w	d7,a1			* Point to next byte
+		add.l	8(a6),a1		* ...
+		move.b	d0,8(a1)		* Write byte in buffer
+		move.l	12(a6),d0		* Get s/n
+		asr.l	#8,d0			* Shift right 8 bits
+		move.l	d0,12(a6)		* Save shifted value
+		addq.w	#1,d7			* Update counter
+*
+protbt06:	cmp.w	#3,d7			* See if we're done
+		blt	protbt05		* Loop if not
+*
+protbt07:	tst.w	16(a6)			* Diskette size ?
+		blt	protbt10		* Jump if not to be changed
+*
+		move.w	16(a6),d6		* Get diskette size
+		muls.w	#19,d6			* ... times 19 as pointer
+		clr.w	d7			* Clear counter
+		bra	protbt09		* Go move in BPB
+*
+protbt08:	move.w	d7,a0			* Get counter
+		add.l	8(a6),a0		* Add base of buffer
+		move.w	d6,a1			* Get BPB pointer
+		add.l	#pbpbtab,a1		* Add base of prototype BPB's
+		move.b	(a1),11(a0)		* Copy BPB data
+		addq.w	#1,d6			* Update pointer
+		addq.w	#1,d7			* Update counter
+*
+protbt09:	cmp.w	#19,d7			* Done ?
+		blt	protbt08		* Loop if not
+*
+protbt10:	clr.w	-6(a6)
+		move.l	8(a6),-4(a6)
+		bra	protbt12
+*
+		.page
+*
+protbt11:	move.l	-4(a6),a0		* Get buffer pointer
+		move.w	(a0),d0			* Get word from buffer
+		add.w	d0,-6(a6)		* Sum for checksum
+		addq.l	#2,-4(a6)		* Point at next word
+*
+protbt12:	move.l	8(a6),d0		* Get buffer address
+		add.l	#$1FE,d0		* Plus sector length
+		cmp.l	-4(a6),d0		* Done ?
+		bhi	protbt11		* Loop if not
+*
+		move.w	#$1234,d0		* Checksum for boot sector
+		sub.w	-6(a6),d0		* Subtract checksum for buffer
+		move.l	-4(a6),a1
+		move.w	d0,(a1)			* Store checksum in buffer
+		tst.w	18(a6)			* Check execflg
+		bne	protbt13		* Boot sector to be executable ?
+*
+		move.l	-4(a6),a0		* Mung checksum so it's not
+		addq.w	#1,(a0)
+*
+protbt13:	tst.l	(a7)+
+		movem.l	(a7)+,d6-d7/a5		* Restore registers
+		unlk	a6			* Release stack
+		rts				* Return to caller
+*
+		.endc
+*
+* criter -- Critical error handler
+* ------    ----------------------
+criter:		move.l	critvec,-(a7)		* Put error vector on stack
+		moveq.l	#-1,d0			* Set default error return
+		rts				* "Return" to handler
+*
+		.page
+*
+		.ifne	BUCHLA
+*
+* api_int -- Analog processor interrupt handler
+* -------    ----------------------------------
+api_int:	movem.l	d0-d1/a0-a1,-(a7)	* Save registers
+		clr.l	d0			* Read input port
+		move.b	ANALOG,d0		* ... into d0[7..0]
+		move.b	d0,api_inp		* ... and api_inp
+		btst	#7,d0			* Check for signal number flag
+		bne	api_s0a			* Jump if signal number read
+*
+		lea	api_tv,a0		* Get api_tv base in a0
+		clr.w	d1			* Get api_sv in d1
+		move.b	api_sv,d1		* ...
+		cmpi.b	#6,d1			* Check range
+		bgt	api_sve			* Jump if out of range
+*
+		lsl.w	#2,d1			* Develop jump address
+		move.l	0(a0,d1.W),a1		* ... from api_tv in a1
+		jmp	(a1)			* Jump to state handler
+*
+api_s0:		btst	#7,d0			* Check for signal number flag
+		beq	api_ret			* Jump if not signal number
+*
+api_s0a:	clr.b	api_val			* Clear value byte
+		andi.b	#$7F,d0			* Mask off signal number flag
+		cmpi.b	#82,d0			* See if it's in range
+		bgt	api_err			* Jump if out of range (GT 82)
+*
+		move.b	d0,api_sig		* Store signal number
+		beq	api_pub			* Jump if it was "all off"
+*
+		lea	api_tab,a0		* Get sv table base
+		move.b	0(a0,d0.W),api_sv	* Set sv for next time
+*
+api_ret:	movem.l	(a7)+,d0-d1/a0-a1	* Restore registers
+		rte				* Return to interrupted code
+*
+api_err:	move.b	d0,api_bug		* Catch the bug
+		clr.b	api_sv			* Force state zero
+		bra	api_ret			* Go back to interrupted code
+*
+api_sve:	move.b	d1,api_svb		* Catch the bug
+		clr.b	api_sv			* Force state zero
+		bra	api_ret			* Go back to interrupted code
+*
+		.page
+api_s1:		btst	#0,d0			* See if it takes a value
+		beq	api_s1a			* Jump if not
+*
+		move.b	#2,api_sv		* Set sv for state 2
+		bra	api_ret			* Go return from interrupt
+*
+api_s1a:	clr.b	api_val			* Clear value byte
+		bra	api_pub			* Go output to fifo
+*
+api_s2:		ori.b	#$80,d0			* Set status = 1
+		move.b	d0,api_val		* Set value byte
+		bra	api_pub			* Go output to fifo
+*
+api_s3:		ror.b	#1,d0			* Set status in value byte
+		andi.b	#$80,d0			* ...
+		move.b	d0,api_val		* ...
+		move.b	#4,api_sv		* Set sv for state 4
+		bra	api_ret			* Go return from interrupt
+*
+api_s4:		or.b	d0,api_val		* Set value byte
+		bra	api_pub			* Go output to fifo
+*
+api_s5:		ror.b	#1,d0			* Set status in value byte
+		andi.b	#$80,d0			* ...
+*
+api_s6:		move.b	d0,api_val		* Set value byte
+*
+api_pub:	movea.l	api_fi,a0		* Get fifo input pointer in a0
+		move.w	api_sig,(a0)+		* Store new input
+		cmpa.l	#api_fe,a0		* Wrap around ?
+		blt	api_pb1			* Jump if not
+*
+		movea.l	#api_fum,a0		* Wrap input pointer to start
+*
+api_pb1:	move.l	a0,api_fi		* Update input pointer
+		cmpa.l	api_fo,a0		* Buffer full ?
+		bne	api_pb3			* Jump if not
+*
+		movea.l	api_fo,a1		* Get fifo output pointer in a1
+		adda.l	#2,a1			* Increment it
+		cmpa.l	#api_fe,a1		* Wrap around ?
+		blt	api_pb2			* Jump if not
+*
+		movea.l	#api_fum,a1		* Wrap output pointer to start
+*
+api_pb2:	move.l	a1,api_fo		* Set new output pointer
+*
+api_pb3:	clr.b	api_sv			* Set state to 0
+		bra	api_ret			* Return from interrupt
+*
+		.page
+*
+* api_get -- Get analog input
+* -------    ----------------
+api_get:	move.w	sr,-(a7)		* Save status register
+		ori.w	#IPL3,sr		* Disable ANALOG I/O interrupts
+		movea.l	api_fo,a0		* Get fifo output pointer
+		cmpa.l	api_fi,a0		* See if fifo is empty
+		bne	api_g1			* Jump if not
+*
+		moveq.l	#-1,d0			* Set empty-fifo value
+		move.w	(a7)+,sr		* Restore interrupt mask
+		rts				* Return to caller
+*
+api_g1:		clr.l	d0			* Get fifo value
+		move.w	(a0)+,d0		* ...
+		cmpa.l	#api_fe,a0		* See if pointer wrapped
+		blt	api_g2			* Jump if not
+*
+		movea.l	#api_fum,a0		* Wrap the pointer around
+*
+api_g2:		move.l	a0,api_fo		* Update pointer
+		move.w	(a7)+,sr		* Restore interrupt mask
+		rts				* Return to caller
+*
+* api_zap -- clear analog I/O FIFO
+* -------    ---------------------
+api_zap:	move.w	sr,-(a7)		* Save status register
+		ori.w	#IPL3,sr		* Disable ANALOG I/O interrupts
+		move.l	#api_fum,api_fi		* Clear analog processor fifo
+		move.l	#api_fum,api_fo		* ...
+		move.w	(a7)+,sr		* Restore interrupt mask
+		rts
+*
+		.endc
+*
+		.page
+*************************************************************************
+*									*
+*			Constant definitions				*
+*			--------------------				*
+*************************************************************************
+*
+		.even
+*
+		.ifne	BUCHLA
+*
+* Buchla 700 tables:
+*
+* t13tab -- Trap-13 pointer table -- Primary BIOS functions
+* ------    -----------------------------------------------
+t13tab:		dc.w	12			* Number of Trap-13 routines
+*
+		dc.l	nullrts			* 0 - (getmpb)
+		dc.l	bconstat		* 1 - bconstat
+		dc.l	bconin			* 2 - bconin
+		dc.l	bconout			* 3 - bconout
+		dc.l	rwabs			* 4 - rwabs
+		dc.l	setexec			* 5 - setexec
+		dc.l	nullrts			* 6 - (tickcal)
+		dc.l	getbpb			* 7 - getbpb
+		dc.l	bcostat			* 8 - bcostat
+		dc.l	mediach			* 9 - mediach
+		dc.l	drvmap			* 10 - drvmap
+		dc.l	nullrts			* 11 - (shift)
+*
+		.page
+*
+* t14tab -- Trap-14 pointer table -- Extended BIOS functions (Buchla 700 only)
+* ------    ------------------------------------------------------------------
+t14tab:		dc.w	10			* Number of trap14 routines
+*
+		dc.l	piorec			* 0 - Get iorec address
+		dc.l	setport			* 1 - Set ACIA parameters
+		dc.l	floprd			* 2 - Read floppy
+		dc.l	flopwr			* 3 - Write floppy
+		dc.l	flopfmt			* 4 - Format floppy
+		dc.l	flopver			* 5 - Verify floppy
+		dc.l	protobt			* 6 - Create prototype boot sec.
+		dc.l	rand			* 7 - Generate random number
+		dc.l	api_get			* 8 - Get analog input
+		dc.l	api_zap			* 9 - Clear analog FIFO
+*
+		.endc
+*
+		.even
+*
+		.ifeq	BUCHLA
+*
+* NASA 3D Helmet tables:
+*
+* t13tab -- Trap-13 pointer table -- Primary BIOS functions
+* ------    -----------------------------------------------
+t13tab:		dc.w	12			* Number of Trap-13 routines
+*
+		dc.l	nullrts			* 0 - (getmpb)
+		dc.l	bconstat		* 1 - bconstat
+		dc.l	bconin			* 2 - bconin
+		dc.l	bconout			* 3 - bconout
+		dc.l	nullrts			* 4 - (rwabs)
+		dc.l	setexec			* 5 - setexec
+		dc.l	nullrts			* 6 - (tickcal)
+		dc.l	nullrts			* 7 - (getbpb)
+		dc.l	bcostat			* 8 - bcostat
+		dc.l	nullrts			* 9 - (mediach)
+		dc.l	nullrts			* 10 - (drvmap)
+		dc.l	nullrts			* 11 - (shift)
+*
+		.page
+*
+* t14tab -- Trap-14 pointer table -- Extended BIOS functions (Buchla 700 only)
+* ------    ------------------------------------------------------------------
+t14tab:		dc.w	10			* Number of trap14 routines
+*
+		dc.l	piorec			* 0 - Get iorec address
+		dc.l	setport			* 1 - Set ACIA parameters
+		dc.l	nullrts			* 2 - (Read floppy)
+		dc.l	nullrts			* 3 - (Write floppy)
+		dc.l	nullrts			* 4 - (Format floppy)
+		dc.l	nullrts			* 5 - (Verify floppy)
+		dc.l	nullrts			* 6 - (Create prototype boot sec.)
+		dc.l	nullrts			* 7 - (Generate random number)
+		dc.l	nullrts			* 8 - (Get analog input)
+		dc.l	nullrts			* 9 - (Clear analog FIFO)
+*
+		.endc
+*
+		.page
+*
+* cdt01 -- Character device dispatch table #1 -- input status
+* -----    --------------------------------------------------
+cdt01:		dc.l	sr1ist			* 0 - PRT -- Printer
+		dc.l	sr2ist			* 1 - AUX -- Serial-2
+		dc.l	sr2ist			* 2 - CON -- Console
+*
+		.ifne	BUCHLA
+*
+		dc.l	mc1ist			* 3 - MC1 -- MIDI-1
+		dc.l	mc2ist			* 4 - MC2 -- MIDI-2
+*
+		.endc
+*
+* cdt02 -- Character device dispatch table #2 -- input
+* -----    -------------------------------------------
+cdt02:		dc.l	sr1inp			* 0 - PRT -- Printer
+		dc.l	sr2inp			* 1 - AUX -- Serial-2
+		dc.l	sr2inp			* 2 - CON -- Console
+*
+		.ifne	BUCHLA
+*
+		dc.l	mc1inp			* 3 - MC1 -- MIDI-1
+		dc.l	mc2inp			* 4 - MC2 -- MIDI-2
+*
+		.endc
+*
+* cdt03 -- Character device dispatch table #3 -- output
+* -----    --------------------------------------------
+cdt03:		dc.l	sr1out			* 0 - PRT -- Printer
+		dc.l	sr2out			* 1 - AUX -- Serial-2
+		dc.l	sr2out			* 2 - CON -- Console
+		.ifne	BUCHLA
+*
+		dc.l	mc1out			* 3 - MC1 -- MIDI-1
+		dc.l	mc2out			* 4 - MC2 -- MIDI-2
+*
+		.endc
+*
+* cdt04 -- Character device dispatch table #4 -- output status
+* -----    ---------------------------------------------------
+cdt04:		dc.l	sr1ost			* 0 - PRT -- Printer
+		dc.l	sr2ost			* 1 - AUX -- Serial-2
+		dc.l	sr2ost			* 2 - CON -- Console
+		.ifne	BUCHLA
+*
+		dc.l	mc1ost			* 3 - MC1 -- MIDI-1
+		dc.l	mc2ost			* 4 - MC2 -- MIDI-2
+*
+		.endc
+*
+		.page
+*
+* iorec defaults:
+* ---------------
+* Serial-1:
+* ---------
+sr1dflt:	dc.l	sr1ibuf
+		dc.w	SR1IBS
+		dc.w	0,0
+		dc.w	SR1IBS/4
+		dc.w	SR1IBS-(SR1IBS/4)
+		dc.l	sr1obuf
+		dc.w	SR1OBS
+		dc.w	0,0
+		dc.w	SR1OBS/4
+		dc.w	SR1OBS-(SR1OBS/4)
+		dc.b	SR1CFR0,SR1CFR1
+		dc.b	0,0
+		dc.b	SR1DISC,0
+		dc.b	0,0
+		dc.w	0,0
+*
+* Serial-2:
+* ---------
+sr2dflt:	dc.l	sr2ibuf
+		dc.w	SR2IBS
+		dc.w	0,0
+		dc.w	SR2IBS/4
+		dc.w	SR2IBS-(SR2IBS/4)
+		dc.l	sr2obuf
+		dc.w	SR2OBS
+		dc.w	0,0
+		dc.w	SR2OBS/4
+		dc.w	SR2OBS-(SR2OBS/4)
+		dc.b	SR2CFR0,SR2CFR1
+		dc.b	0,0
+		dc.b	SR2DISC,0
+		dc.b	0,0
+		dc.w	0,0
+*
+		.page
+*
+		.ifne	BUCHLA
+*
+* MIDI-1:
+* -------
+mc1dflt:	dc.l	mc1ibuf
+		dc.w	MC1IBS
+		dc.w	0,0
+		dc.w	MC1IBS/4
+		dc.w	MC1IBS-(MC1IBS/4)
+		dc.l	mc1obuf
+		dc.w	MC1OBS
+		dc.w	0,0
+		dc.w	MC1OBS/4
+		dc.w	MC1OBS-(MC1OBS/4)
+		dc.b	MC1CFR0,MC1CFR1
+		dc.b	0,0
+		dc.b	MC1DISC,0
+		dc.b	0,0
+		dc.w	0,0
+*
+* MIDI-2:
+* -------
+mc2dflt:	dc.l	mc2ibuf
+		dc.w	MC2IBS
+		dc.w	0,0
+		dc.w	MC2IBS/4
+		dc.w	MC2IBS-(MC2IBS/4)
+		dc.l	mc2obuf
+		dc.w	MC2OBS
+		dc.w	0,0
+		dc.w	MC2OBS/4
+		dc.w	MC2OBS-(MC2OBS/4)
+		dc.b	MC2CFR0,MC2CFR1
+		dc.b	0,0
+		dc.b	MC2DISC,0
+		dc.b	0,0
+		dc.w	0,0
+*
+		.endc
+*
+		.page
+*
+* brtable -- Baud rate setup table
+* -------    ---------------------
+brtable:	dc.b	BR_19K2		* 0 - 19200 baud
+		dc.b	BR_9600		* 1 -  9600 baud
+		dc.b	BR_4800		* 2 -  4800 baud
+		dc.b	BR_3600		* 3 -  3600 baud
+		dc.b	BR_2400		* 4 -  2400 baud
+		dc.b	BR_7200		* 5 -  7200 baud  (2000 on Atari)
+		dc.b	BR_1800		* 6 -  1800 baud
+		dc.b	BR_1200		* 7 -  1200 baud
+		dc.b	BR_600		* 8 -   600 baud
+		dc.b	BR_300		* 9 -   300 baud
+*
+* iortab -- iorec pointer table
+* ------    -------------------
+iortab:		dc.l	sr1iorec	* 0 - PRT Serial-1 Printer
+		dc.l	sr2iorec	* 1 - AUX Serial-2 Host
+		dc.l	sr2iorec	* 2 - CON Serial-2 Console
+*
+		.ifne	BUCHLA
+*
+		dc.l	mc1iorec	* 3 - MC1 MIDI-1   MIDI port #1
+		dc.l	mc2iorec	* 4 - MC2 MIDI-2   MIDI port #2
+*
+		.endc
+*
+* aciatab -- iorec and ACIA pointer table
+* -------    ----------------------------
+aciatab:	dc.l	sr1iorec,SR1ACIA	* 0 - PRT Serial-1
+		dc.l	sr2iorec,SR2ACIA	* 1 - AUX Serial-2
+		dc.l	sr2iorec,SR2ACIA	* 2 - CON Serial-2
+*
+		.ifne	BUCHLA
+*
+		dc.l	mc1iorec,MC1ACIA	* 3 - MC1 MIDI-1
+		dc.l	mc2iorec,MC2ACIA	* 4 - MC2 MIDI-2
+*
+		.endc
+*
+		.page
+*
+		.ifne	BUCHLA
+*
+* pbpbtab -- Prototype BPB data table  (BPS..NHID)  19 bytes per entry
+* -------    ---------------------------------------------------------
+*
+* 0 -- 40 tracks, single sided (180K)
+*
+pbpbtab:	dc.b	$00,$02,$01,$01,$00,$02,$40,$00
+		dc.b	$68,$01,$FC,$02,$00,$09,$00,$01
+		dc.b	$00,$00,$00
+*
+* 1 -- 40 tracks, double sided (360K)
+*
+		dc.b	$00,$02,$02,$01,$00,$02,$70,$00
+		dc.b	$D0,$02,$FD,$02,$00,$09,$00,$02
+		dc.b	$00,$00,$00
+*
+* 2 -- 80 tracks, single sided (360K)
+*
+		dc.b	$00,$02,$02,$01,$00,$02,$70,$00
+		dc.b	$D0,$02,$F8,$05,$00,$09,$00,$01
+		dc.b	$00,$00,$00
+*
+* 3 -- 80 tracks, double sided (720K)
+*
+		dc.b	$00,$02,$02,$01,$00,$02,$70,$00
+		dc.b	$A0,$05,$F9,$05,$00,$09,$00,$02
+		dc.b	$00,$00,$00
+*
+* VSDD initialization table
+*
+		.even
+*
+vsddtab:	dc.w	$8252		* R0	Mode word 0
+		dc.w	$E474		* R1	Mode word 1
+		dc.w	$0006		* R2	Register window base
+		dc.w	$0100		* R3	Data window base
+		dc.w	$0000		* R4	Data length mask
+		dc.w	$0000		* R5	Data segment base
+		dc.w	$0001		* R6	Priority access count
+		dc.w	$0040		* R7	ODT base
+		dc.w	$0080		* R8	AT base
+		dc.w	$0010		* R9	CLT base
+		dc.w	$0011		* R10	CG bases
+		dc.w	$0000		* R11	AT counter  (R/O)
+*
+		dc.w	$0C08		* R12	HC0 =  3, VC0 =   8
+		dc.w	$140A		* R13	HC1 =  5, VC1 =  10
+		dc.w	$9568		* R14	HC2 = 37, VC2 = 360
+		dc.w	$A16A		* R15	HC3 = 40, VC3 = 362
+*
+vsddit01:	dc.w	$8253		* R0 with UCF = 1, DEN = 0
+vsddit02:	dc.w	$825B		* R0 with UCF = 1, DEN = 1
+*
+		.page
+*
+* analog processor input state table
+*
+api_tab:	dc.b	0,1,1,1,1,1,1,1,1,1	* 0..9
+		dc.b	1,1,1,1,1,1,1,1,1,1	* 10..19
+		dc.b	1,1,1,1,1		* 20..24
+		dc.b	3,3,3,3,3		* 25..29
+		dc.b	3,3,3,3,3,3,3,3,3	* 30..38
+		dc.b	5			* 39
+		dc.b	5,5,5,5,5,5,5,5,5,5	* 40..49
+		dc.b	5,5,5			* 50..52
+		dc.b	3,3,3,3,3,3,3		* 53..59
+		dc.b	5,5,5,5,5,5,5,5,5,5	* 60..69
+		dc.b	5,5,5			* 70..72
+		dc.b	6,6,6,6,6,6,6		* 73..79
+		dc.b	6,6,6			* 80..82
+*
+		.even
+*
+* analog processor state transfer vector
+*
+api_tv:		dc.l	api_s0,api_s1,api_s2,api_s3
+		dc.l	api_s4,api_s5,api_s6
+*
+		.endc
+*
+		.page
+*************************************************************************
+* 									*
+* 			RAM storage definitions				*
+*			-----------------------				*
+*************************************************************************
+*
+		.bss
+		.even
+*
+* RAM data area
+* -------------
+* WARNING:
+* --------
+* The variables from timevec through rsarea are permanently assigned so
+* that we can link to certain bios variables without having to link to the
+* bios object file itself.  Some of these get defined in hwdefs.s and in
+* hwdefs.s so beware of changing them.
+*
+timevec:	ds.l	1		* System timer trap vector
+critvec:	ds.l	1		* Critical error handler vector
+termvec:	ds.l	1		* Process terminate hook vector
+resvec3:	ds.l	1		* Reserved vector 3
+resvec4:	ds.l	1		* Reserved vector 4
+resvec5:	ds.l	1		* Reserved vector 5
+resvec6:	ds.l	1		* Reserved vector 6
+resvec7:	ds.l	1		* Reserved vector 7
+*
+fc_sw:		ds.w	1		* Frame clock switch (<0=dn, 0=off, >0=up)
+fc_val:		ds.l	1		* Frame clock value  (0..FCMAX)
+*
+_wzcrsh:	ds.w	1		* Crash area: flag for ROMP
+_crshsr:	ds.w	1		* Crash area: SR
+_crshpc:	ds.l	1		* Crash area: PC
+_crshsp:	ds.l	1		* Crash area: SP
+_crshus:	ds.l	1		* Crash area: USP
+_crshvc:	ds.l	1		* Crash area: vector # in MS byte
+_crshrg:	ds.l	16		* Crash area: registers
+_crshst:	ds.w	16		* Crash area: top 16 words of stack
+*
+* The area from biosram to SSTACK-1 is cleared on reset.
+* ------------------------------------------------------
+biosram		.equ	*		* Start of BIOS RAM variables
+*
+		.ifne	BUCHLA
+*
+_hz_1k:		ds.l	1		* 1000 Hz clock
+_hz_200:	ds.l	1		* 200 Hz clock
+frclock:	ds.l	1		* 50 Hz clock
+t1count:	ds.w	1		* Timer 1 count
+t2count:	ds.w	1		* Timer 2 count
+t3count:	ds.w	1		* Timer 3 count
+*
+seekrate:	ds.w	1		* Seek rate
+cdev:		ds.w	1		* Current drive
+ctrack:		ds.w	1		* Current track
+csect:		ds.w	1		* Current sector
+cside:		ds.w	1		* Current side
+ccount:		ds.w	1		* Current sector count
+spt:		ds.w	1		* Sectors per track
+interlv:	ds.w	1		* Sector interleave count
+virgin:		ds.w	1		* Initial formatting data
+deferr:		ds.w	1		* Default error number
+curerr:		ds.w	1		* Current error number
+*
+cdma:		ds.l	1		* Current DMA address
+edma:		ds.l	1		* Ending DMA address
+tmpdma:		ds.l	1		* Temporary DMA address
+*
+		.endc
+*
+rseed:		ds.l	1		* Random number seed
+*
+savptr:		ds.l	1		* Pointer to register save area
+*
+_rsflag:	ds.l	1		* Register save area overflow flag
+		ds.l	18*32		* Register save area  (32 levels)
+rsarea:		ds.l	1		* Dummy long word at top of save area
+*
+* ***** end of the permanently assigned bios variables *****
+*
+		.page
+*
+		.ifne	BUCHLA
+*
+acctim:		ds.l	2		* Accumulated disk time table
+maxactim:	ds.l	1		* Maximum acctim value
+hdv_init:	ds.l	1		* Disk init vector
+hdv_bpb:	ds.l	1		* Disk get bpb vector
+hdv_rw:		ds.l	1		* Disk r/w vector
+hdv_boot:	ds.l	1		* Disk boot vector
+hdv_mchg:	ds.l	1		* Disk media change vector
+drvbits:	ds.l	1		* Drive map bits
+dskbufp:	ds.l	1		* Disk buffer pointer
+		.page
+nflops:		ds.w	1		* Number of drives
+disknum:	ds.w	1		* Current disk number
+booted:		ds.w	1		* Most recent boot device or -1
+flock:		ds.w	1		* Floppy semaphore
+fverify:	ds.w	1		* Floppy verify flag
+*
+tdiv1:		ds.w	1		* Timer divider 1  (divides _hz_1k)
+tdiv2:		ds.w	1		* Timer divider 2  (divides _hz_200)
+*
+retrycnt:	ds.w	1		* Re-try count
+wpstatus:	ds.w	1		* Write protect status table
+wplatch:	ds.w	1		* Write protect latch table
+bootdev:	ds.w	1		* Boot device number
+*
+motoron:	ds.w	1		* Motor-on flag
+deslflag:	ds.w	1		* Drive deselect flag
+*
+		.endc
+*
+flpsrsv:	ds.w	1		* Status register save area
+flpregs:	ds.l	16		* Register save area
+*
+		.ifne	BUCHLA
+*
+dsb0:		ds.l	1		* Drive A DSB
+dsb1:		ds.l	1		* Drive B DSB
+*
+dskmode:	ds.b	2		* Disk change mode table
+dskerrs:	ds.w	2		* Disk error code table
+drvbpbs:	ds.w	16*2		* Disk BPB save area
+*
+		.endc
+*
+		.page
+*
+sr1iorec:	ds.b	IORECLN		* Serial-1 iorec structure
+sr2iorec:	ds.b	IORECLN		* Serial-2 iorec structure
+*
+		.ifne	BUCHLA
+*
+mc1iorec:	ds.b	IORECLN		* MIDI-1 iorec structure
+mc2iorec:	ds.b	IORECLN		* MIDI-2 iorec structure
+*
+		.endc
+*
+sr1ibuf:	ds.b	SR1IBS		* Serial-1 input buffer
+sr1obuf:	ds.b	SR1OBS		* Serial-1 output buffer
+sr2ibuf:	ds.b	SR2IBS		* Serial-2 input buffer
+sr2obuf:	ds.b	SR2OBS		* Serial-2 output buffer
+*
+		.ifne	BUCHLA
+*
+mc1ibuf:	ds.b	MC1IBS		* MIDI-1 input buffer
+mc1obuf:	ds.b	MC1OBS		* MIDI-1 output buffer
+mc2ibuf:	ds.b	MC2IBS		* MIDI-2 input buffer
+mc2obuf:	ds.b	MC2OBS		* MIDI-2 output buffer
+*
+api_inp:	ds.b	1		* Analog processor input byte
+api_bug:	ds.b	1		* Analog processor signal # "bug trap"
+api_sv:		ds.b	1		* Analog processor state
+api_svb:	ds.b	1		* Analog processor state "bug trap"
+*
+		.even
+*
+api_sig:	ds.b	1		* Analog signal number
+api_val:	ds.b	1		* Analog value
+*
+api_fi:		ds.l	1		* Analog processor FIFO input pointer
+api_fo:		ds.l	1		* Analog processor FIFO output pointer
+api_fum:	ds.w	APISIZE		* Analog processor FIFO
+api_fe		.equ	*		* End of analog processor FIFO
+*
+		.endc
+*
+		.even
+*
+basepage:	ds.l	64		* Pseudo base page
+*
+buffer:		ds.b	1024		* Default disk buffer
+*
+biostop		.equ	*		* End of BIOS RAM
+*
+		.end
Index: rom/booter.c
===================================================================
--- rom/booter.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ rom/booter.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,187 @@
+/*
+   ============================================================================
+	booter.c -- load an absolute format Alcyon object file
+	Version 18 -- 1987-11-06 -- D.N. Lynx Crowe
+   ============================================================================
+*/
+
+#define	PRINTIT	1	/* define non-zero to get printf output from booter */
+
+#include "stdio.h"
+#include "io.h"
+#include "stddefs.h"
+#include "portab.h"
+#include "objdefs.h"
+#include "biosdefs.h"
+
+extern	FILE	*fopenb();
+extern	int	fclose(), fread(), flread();
+extern	long	getl();
+
+#if	PRINTIT
+extern	struct fcb *SnapFCB();
+extern	int	ClusMap();
+#endif
+
+static FILE	*B_file;		/* boot file pointer */
+
+struct	EXFILE B_fhdr;	/* executable file header */
+
+long	B_txt_o,	/* test origin from file header */
+	B_dat_o,	/* data origin from file header */
+	B_bss_o,	/* bss origin from file header */
+	B_txt_l,	/* text length from file header */
+	B_dat_l,	/* data length from file header */
+	B_bss_l,	/* bss length from file header */
+	B_lod_l,	/* total data length loaded */
+	B_end,		/* end address */
+	B_chk;		/* checksum */
+
+char	*B_buf_a;	/* boot load address */
+
+short	B_log_s;	/* boot log switch */
+short	B_dbg_s;	/* boot debug switch */
+
+/* 
+ */
+
+/*
+   ============================================================================
+	booter(fn, textadr) -- load file named by string 'fn' at 'textadr'.
+	If 'textadr' is 0, the text origin from the file will be used.
+	Returns 0 if load was OK, non-zero error code otherwise.
+   ============================================================================
+*/
+
+short
+booter(fn, textadr)
+char *fn;
+long textadr;
+{
+	register long i, bgnbss, endbss;
+	register char *cp;
+#if	PRINTIT
+	register struct fcb *fcp;
+#endif
+
+	/* initialize the origins and lengths to 0 */
+
+	B_txt_o = 0L;
+	B_dat_o = 0L;
+	B_bss_o = 0L;
+	B_txt_l = 0L;
+	B_dat_l = 0L;
+	B_bss_l = 0L;
+	B_lod_l = 0L;
+
+	/* open the file */
+
+	if (NULL EQ (B_file = fopenb(fn, "r"))) {
+
+#if	PRINTIT
+		if (B_log_s)
+			printf("booter:  Unable to open \042%s\042\n", fn);
+#endif
+		return(1);
+	}
+
+#if	PRINTIT
+	if (B_dbg_s) {		/* if we're debugging, print the FCB stuff */
+
+		fcp = (struct fcb *)(chantab[B_file->_unit].c_arg);
+
+		SnapFCB(fcp);
+		ClusMap(fcp);
+		waitcr();
+	}
+#endif
+
+	/* read in the file header */
+
+	if (1 NE fread(&B_fhdr, sizeof B_fhdr, 1, B_file)) {
+
+#if	PRINTIT
+		if (B_log_s)
+			printf("booter:  Unable to read header for \042%s\042\n", fn);
+#endif
+		fclose(B_file);
+		return(2);
+	}
+
+	/* check the magic */
+
+	if ((B_fhdr.F_Magic NE F_R_C) AND (B_fhdr.F_Magic NE F_R_D)) {
+
+#if	PRINTIT
+		if (B_log_s)
+			printf("booter:  Bad magic [0x%04x] in file \042%s\042",
+				B_fhdr.F_Magic, fn);
+#endif
+		fclose(B_file);
+		return(3);
+	}
+
+/* 
+
+*/
+
+	/* if it's a discontinuous file, read the origins */
+
+	if (B_fhdr.F_Magic EQ F_R_D) {
+
+		B_dat_o = getl(B_file);
+		B_bss_o  = getl(B_file);
+	}
+
+	B_txt_o = B_fhdr.F_Res2;
+
+	B_buf_a = textadr ? textadr : B_txt_o;
+	B_lod_l = B_fhdr.F_Text + B_fhdr.F_Data;
+
+	if (0 NE flread(B_buf_a, B_lod_l, B_file)) {
+	
+#if	PRINTIT
+		if (B_log_s)
+			printf("booter:  Unable to read \042%s\042\n", fn);
+#endif
+		fclose(B_file);
+		return(4);
+	}
+
+	B_end = B_buf_a + B_lod_l - 1L;
+
+	B_txt_l = B_fhdr.F_Text;
+	B_dat_l = B_fhdr.F_Data;
+	B_bss_l = B_fhdr.F_BSS;
+
+	cp    = B_buf_a;	/* calculate checksum */
+	B_chk = 0L;
+
+	for (i = 0; i < B_lod_l; i++)
+		B_chk += *cp++ & 0x000000FFL;
+
+	if (B_bss_o)
+		bgnbss = B_bss_o;
+	else
+		bgnbss = B_end + 1L;
+
+		endbss = bgnbss + B_bss_l - 1L;
+
+#if	PRINTIT
+	if (B_log_s) {
+
+		printf("File \042%s\042 loaded from $%08lX to $%08lX\r\n",
+			fn, B_buf_a, B_end);
+		printf("   BSS $%08lX to $%08lX\r\n", bgnbss, endbss);
+		printf("Checksum   = $%08lX, Load length = %ld ($%08lX)\r\n",
+			B_chk, B_lod_l, B_lod_l);
+		printf("   B_txt_o = $%08lX, B_dat_o = $%08lX, B_bss_o = $%08lX\r\n",
+			B_txt_o, B_dat_o, B_bss_o);
+		printf("   B_txt_l = $%08lX, B_dat_l = $%08lX, B_bss_l = $%08lX\r\n",
+			B_txt_l, B_dat_l, B_bss_l);
+	}
+#endif
+
+	fclose(B_file);
+	return(0);
+}
Index: rom/romp.c
===================================================================
--- rom/romp.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ rom/romp.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,4142 @@
+/*
+   ============================================================================
+	romp.c -- ROMP debug monitor
+	(c) Copyright 1987,1988 -- D.N. Lynx Crowe
+
+	See ROMPVER, below, for version number and date.
+
+	CAUTION:  This code is designed to live in PROM, so initialized
+	variables are PERMANENTLY initialized, since the compiler assigns
+	initialized variables to the data segment, which ends up in PROM.
+
+	Un-initialized variables go into the bss segment, which ends up in RAM.
+
+	Set ON_B700 non-zero to get a Buchla 700 PROM,
+	or zero to get a NASA 3D Helmet Display PROM.
+   ============================================================================
+*/
+
+#define	ROMPVER	"22.00 -- 1988-06-20"
+
+#define	TINYMSG	0	/* 1 for short messages, 0 for normal ones */
+
+#define	ON_B700	1	/* 1 for Buchla 700, 0 for NASA */
+#define	ONEMEG	1	/* 1 if 1024K, 0 if 512K RAM space (Buchla 700) */
+
+#include "ascii.h"
+#include "biosdefs.h"
+#include "ctype.h"
+#include "errdefs.h"
+#include "hwdefs.h"
+#include "memory.h"
+#include "rawio.h"
+#include "regs.h"
+#include "setjmp.h"
+#include "stddefs.h"
+#include "strings.h"
+#include "vsdd.h"
+
+#if	ON_B700
+#include "graphdef.h"
+#include "vsddsw.h"
+#include "vsddvars.h"
+#endif
+
+typedef	unsigned short	UWORD16;	/* unsigned 16 bit word */
+
+/* 
+
+*/
+
+#if	ON_B700
+#define	USER_RAM	0x00010000L	/* Start of user RAM  (TPA) */
+#if	ONEMEG
+#define	RAM_TOP		0x000FFFFEL	/* Default top word of memory */
+#define	ISTACK		0x000FFFFEL	/* Default initial stack */
+#else
+#define	RAM_TOP		0x0007FFFEL	/* Default top word of memory */
+#define	ISTACK		0x0007FFFEL	/* Default initial stack */
+#endif
+#define	KB_EI		2		/* Enable level for panel */
+#define	DEFIPL		2		/* Default internal processor level */
+#define	INITSR		0x2200		/* Default initial status register */
+#define	BOOTFILE	"midas.abs"	/* Boot file name */
+#define	BOOTKEY		39		/* Boot panel key */
+#define	ROMPKEY		40		/* ROMP panel key */
+#define	FIFOLIM		60000		/* FIFO clear limit */
+#define	I_TABX		53		/* Tablet X */
+#define	I_TABY		54		/* Tablet Y */
+#define	I_CURX		55		/* Cursor X */
+#define	I_CURY		56		/* Cursor Y */
+#define	I_LONGL		57		/* LongPot Left */
+#define	I_LONGR		58		/* LongPot Right */
+#define	I_SCROLL	59		/* Scroll */
+#define	I_TEMPO		73		/* Tempo Multiplier */
+#define	I_TIME		74		/* Time Scaling */
+#define	I_TUNE		75		/* Fine Tuning */
+#define	I_LEVEL		76		/* Amplitude */
+#define	BARBASE		5120L		/* Base of bars in VSDD RAM */
+#define	SWBASE		38400L		/* Base of switches in VSDD RAM */
+#define	MARGIN		4		/* Offset from left edge of screen */
+#else
+#define	DEFIPL		3
+#define	USER_RAM	0x00008000L
+#define	RAM_TOP		0x0001FFFEL
+#define	ISTACK		0x0001FFFEL
+#define	INITSR		0x2300
+#endif
+
+#define	ROMADDR		0x00100000L
+
+#define	MAXFNLN		13		/* xxxxxxxx.xxx + CR */
+#define	MAXARGLN	80		/* maximum argument length */
+#define	MAXCMDLN	128		/* maximum command line length */
+#define	MAXHS		80		/* maximum help string length */
+#define	MAXID		90		/* maximum ID string length */
+
+#define	PDATELN		14
+#define	PRM_DATE	0x0100008L
+#define	PRM_VERS	0x0100002L
+
+#define	BPINST	0x4E4F		/* breakpoint instruction */
+
+#define	CRLF	"\r\n"
+
+#define	TACK	"K\r"		/* good response from load command */
+#define	NACK	"?\r"		/* bad response from load command */
+
+#define	SREC9	"04000000FB"	/* tail of a type 9 Motorola S-Record */
+
+#define	MON_C	1		/* monitor character code */
+#define	MON_S	2		/* monitor short code */
+#define	MON_L	4		/* monitor long code */
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	external functions and forward references
+   ============================================================================
+*/
+
+extern	UWORD16	setipl();
+
+extern	int	rjumpto(), halt(), getln(), sjumpto();
+extern	int	trap15(), xtrap15();
+
+#if	ON_B700
+extern	int	hdvini();
+extern	int	booter();
+extern	int	vsndpal();
+#endif
+
+/* external variables */
+
+extern	short	wzcrsh, *crshpc, *crshsp, *crshus, crshst[16];
+
+#if	ON_B700
+extern	int	B_log_s;
+extern	int	B_dbg_s;
+extern	char	*B_buf_a;
+extern	int	_bpbin;
+extern	short	dfltpal[16][3];
+#endif
+
+extern	UWORD16	crshsr;
+extern	long	crshrg[16];
+extern	char	crshvc[4];
+
+/* forward references */
+
+int	cp_dump(), cp_fill(), cp_copy(), cp_null(), cp_ilev(), cp_ldmp();
+int	cp_go(), cp_read(), cp_mset(), cp_rset(), cp_wset(), cp_mtst();
+int	cp_wdmp(), cp_wfil(), cp_vrst(), cp_monc(), cp_mons(), cp_monl();
+int	cp_chek();
+
+#if	ON_B700
+int	cx_dini();
+int	cx_mlod();
+int	cp_boot(), cx_boot();
+int	cx_adsp();
+#endif
+
+int	cx_dump(), cx_fill(), cx_copy(), cx_rset();
+int	cx_load(), cx_go(), cx_read(), cx_help();
+int	cx_exit(), cx_writ(), cx_regs(), cx_mset();
+int	cx_bpb(), cx_wset(), cx_wdmp(), cx_wfil(), cx_rest();
+int	cx_vrst(), cx_vreg(), cx_mon(), cx_next(), cx_ilev();
+int	do_srec(), cx_crsh(), cx_mtst(), cx_zap(), cx_ldmp();
+int	cx_omap(), cx_chek();
+
+char	hs_mtst[];
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	error message string definitions
+   ============================================================================
+*/
+
+#define	EMSG1	"\r\n** Command error **\r\n"
+#define	EMSG2	"\r\n** Invalid parameter **\r\n"
+#define	EMSG3	"\r\n** Unrecognized command **\r\n"
+
+#define	EMSG5	"\r\n** Command not repeatable **\r\n"
+#define EMSG6	"\r\n** Invalid line terminator **\r\n"
+#define EMSG7	"\r\n** do_cmd() switch failed **\r\n"
+
+#define	CANNED	"\r\n----- Cancelled -----\r\n"
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	initialized variables  (These end up in the data segment in PROM)
+   ============================================================================
+*/
+
+struct cmdent {			/* command table entry */
+
+	char	*cname;		/* command name pointer */
+	int	(*cp)();	/* command parser function pointer */
+	int	(*cx)();	/* command execution function pointer */
+	char	*hstr;		/* help string pointer */
+};
+
+struct cmdent cmtab[] = {
+
+#if	ON_B700
+	{"adisp",	cp_null,	cx_adsp,	""},
+	{"boot",	cp_boot,	cx_boot,	""},
+	{"bpb",		cp_null,	cx_bpb,		""},
+#endif
+
+	{"check",	cp_chek,	cx_chek,	"start,end"},
+	{"copy",	cp_copy,	cx_copy,	"from,to,len"},
+
+#if	ON_B700
+	{"crash",	cp_null,	cx_crsh,	""},
+	{"dinit",	cp_null,	cx_dini,	""},
+#endif
+
+	{"dump",	cp_dump,	cx_dump,	"from[,[to=from][,width=16]]"},
+	{"exit",	cp_null,	cx_exit,	""},
+	{"fill",	cp_fill,	cx_fill,	"loc,count,byte"},
+	{"go",		cp_go,		cx_go,		"[addr][,[brk1][,brk2]]"},
+	{"help",	cp_null,	cx_help,	""},
+	{"ipl",		cp_ilev,	cx_ilev,	"level"},
+	{"ldump",	cp_ldmp,	cx_ldmp,	"from[,[to=from][,width=4]]"},
+	{"load",	cp_null,	cx_load,	""},	
+
+#if	ON_B700
+	{"midas",	cp_null,	cx_mlod,	""},
+#endif
+
+	{"monc",	cp_monc,	cx_mon,		"addr"},
+	{"mons",	cp_mons,	cx_mon,		"addr"},
+	{"monl",	cp_monl,	cx_mon,		"addr"},
+	{"mset",	cp_mset,	cx_mset,	"addr,b1[,...,bn]"},
+	{"mtest",	cp_mtst,	cx_mtst,	hs_mtst},
+	{"next",	cp_null,	cx_next,	""},
+	{"obmap",	cp_null,	cx_omap,	""},
+
+#if	ON_B700
+	{"read",	cp_read,	cx_read,	"sector,buffer,count"},
+#endif
+
+	{"regs",	cp_null,	cx_regs,	""},
+	{"reset",	cp_null,	cx_rest,	""},
+	{"rset",	cp_rset,	cx_rset,	"register,value"},
+	{"vregs",	cp_null,	cx_vreg,	""},
+	{"vrset",	cp_vrst,	cx_vrst,	"register,value"},
+	{"wdump",	cp_wdmp,	cx_wdmp,	"from[,[to=from][,width=8]]"},
+	{"wfill",	cp_wfil,	cx_wfil,	"loc,count,word"},
+
+#if	ON_B700
+	{"write",	cp_read,	cx_writ,	"sector,buffer,count"},
+#endif
+
+	{"wset",	cp_wset,	cx_wset,	"addr,w1[,...,wn]"},
+	{"zap",		cp_null,	cx_zap,		""}
+};
+
+#define	NCMDS	((sizeof cmtab) / (sizeof cmtab[0]))
+
+/* 
+
+*/
+
+char	ahex[] = "0123456789abcdefABCDEF";
+
+char	*rlist[] = {		/* register name list */
+
+	"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
+	"a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7",
+	"sr", "pc", "sp",
+	(char *)0
+};
+
+char	*vrlist[] = {		/* video register name list */
+
+	"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+	"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+	"h0", "h1", "h2", "h3", "v0", "v1", "v2", "v3",
+	(char *)0
+};
+
+#if	ON_B700
+int	sigadr[] = {		/* display offsets for signals */
+
+	 0,  0,  0,  0,  0,   1,  1,  1,  1,  1,		/* keys	     */
+	 2,  2,  2,  2,  2,   3,  3,  3,  3,  3,
+	 4,  4,  4,  4,
+	 7,  7,  7,  7,  7,   8,  8,  8,  8,  8,		/* sliders   */
+	 9,  9,  9,  9,
+	12, 12, 12, 12, 12,  13, 13, 13, 13, 13,		/* switches  */
+	14, 14, 14, 14,
+	17, 17,							/* tablet    */
+	20, 20,							/* cursor    */
+	23, 23,							/* longpot   */
+	26,							/* scrollpot */
+	29, 29, 29, 29, 29,  30, 30, 30, 30, 30,		/* digits    */
+	32, 32, 32,						/* x, e, m   */
+	35, 35, 35, 35,						/* pots      */
+	37, 37,							/* pedals    */
+	39, 39, 39, 39						/* analog in */
+};
+#endif
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	un-initialized variables  (These end up in the bss segment in RAM)
+   ============================================================================
+*/
+
+char	argsep;		/* argument separator */
+
+char	*aptr,		/* argument pointer */
+	*monptr,	/* monitored variable pointer */
+	*d_cur,		/* dump current from */
+	*d_next,	/* dump next from */
+	*d_last,	/* dump next to */
+	*p_end,		/* end parameter */
+	*p_from,	/* from parameter */
+	*p_goto,	/* goto parameter */
+	*p_to,		/* to parameter */
+	*sptr;		/* string scan pointer */
+
+short	argln,		/* argument length */
+	b0flag,		/* breakpoint 0 flag */
+	b1flag,		/* breakpoint 1 flag */
+	cmdunit,	/* command unit */
+	dflag,		/* dump limit flag */
+	exflag,		/* exit do_cmd flag */
+	first1,		/* first time flag */
+	goflag,		/* pc set flag */
+	ilast,		/* index of last command */
+	inext,		/* command index for "next" command */
+	iplev,		/* ROMP IPL level */
+	monsw,		/* monitor switch */
+	redo,		/* re-doable command flag */
+	rnum,		/* register number */
+	vrnum;		/* video register number */
+
+/* 
+
+*/
+
+#if	ON_B700
+short	asig,		/* signal number */
+	aval,		/* signal value */
+	astat,		/* signal status */
+	aflag,		/* signal activity flag */
+	baseled,	/* base LED for scan */
+	ledcntr;	/* LED scan counter */
+
+short	sigtab[128][2];	/* signal table */
+
+long	afi,		/* analog FIFO input */
+	ftimer;		/* analog FIFO clear timer */
+
+unsigned	baron,		/* bar 'on' color */
+		baroff,		/* bar 'off' color */
+		swon,		/* switch 'on' color */
+		swoff,		/* switch 'off' color */
+		*obj0;		/* object pointer */
+#endif
+
+UWORD16	*tba0,		/* breakpoint 0 temporary */
+	*tba1;		/* breakpoint 1 temporary */
+
+UWORD16	p_bv0,		/* breakpoint 0 value */
+	p_bv1;		/* breakpoint 1 value */
+
+UWORD16	*p_ba0,		/* breakpoint 0 address */
+	*p_ba1;		/* breakpoint 1 address */
+
+jmp_buf	restart;	/* jmp environment */
+
+long	p_len,		/* length parameter */
+	p_value,	/* value parameter */
+	p_width;	/* width parameter */
+
+struct	regs	*regptr;	/* register save area pointer */
+
+char	argstr[MAXARGLN+1],	/* argument string */
+	cmdline[MAXCMDLN+1],	/* command line */
+	bfname[MAXFNLN+1],	/* boot file name */
+	hs_mtst[MAXHS+1],	/* mtest help string */
+	idbuf[MAXID+1],		/* ID string */
+	promdate[PDATELN+1];	/* PROM date area */
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_exit -- restart ROMP
+   ============================================================================
+*/
+
+int
+cx_exit()
+{
+	longjmp(&restart, 1);		/* restart ROMP */
+}
+
+/*
+   ============================================================================
+	cx_rest -- execute the reset command
+   ============================================================================
+*/
+
+int
+cx_rest()
+{
+	rjumpto(ROMADDR);
+}
+
+/*
+   ============================================================================
+	cx_mlod() -- execute the midas command
+   ============================================================================
+*/
+
+int
+cx_mlod()
+{
+	register short i;
+
+	B_log_s = TRUE;
+	B_dbg_s = FALSE;
+	redo = FALSE;
+
+	hdvini();
+	_bpbin = FALSE;
+
+	if (booter("midas.abs", 0L)) {
+
+		return(FALSE);
+
+	} else {
+
+		for (i = 0; i < 8; i++)		/* clear d0..d7 */
+			regptr->d_reg[i] = 0L;
+
+		for (i = 0; i < 7; i++)		/* clear a0..a6 */
+			regptr->a_reg[i] = (char *)0L;
+
+		regptr->a_reg[7] = ISTACK;	/* setup initial stack */
+
+		regptr->reg_sr = INITSR;	/* setup sr */
+		regptr->reg_pc = B_buf_a;	/* setup pc */
+
+		return(TRUE);
+	}
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cp_boot() -- parse boot command
+   ============================================================================
+*/
+
+int
+cp_boot()
+{
+	register int i;
+	register char endc;
+
+	redo = FALSE;
+
+	for (;;) {
+
+		writeln(cmdunit, "File name: ");
+		endc = getln(cmdunit, MAXFNLN+1, bfname);
+		writeln(cmdunit, CRLF);
+
+		if (endc EQ A_CR)
+			break;
+
+		if (endc EQ CTL('X')) {
+
+			writeln(cmdunit, CANNED);
+			return(FALSE);
+		}
+
+		if (endc EQ ERR01)
+			writeln(cmdunit, EMSG2);
+	}
+
+	for (i = 0; i < MAXFNLN+1; i++)
+		if (bfname[i] EQ A_CR)
+			bfname[i] = '\0';
+	
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_boot() -- execute boot command
+   ============================================================================
+*/
+
+int
+cx_boot()
+{
+	register short i;
+
+	B_log_s = TRUE;
+	B_dbg_s = FALSE;
+
+	hdvini();
+	_bpbin = FALSE;
+
+	if (booter(bfname, 0L)) {
+
+		return(FALSE);
+
+	} else {
+
+		for (i = 0; i < 8; i++)		/* clear d0..d7 */
+			regptr->d_reg[i] = 0L;
+
+		for (i = 0; i < 7; i++)		/* clear a0..a6 */
+			regptr->a_reg[i] = (char *)0L;
+
+		regptr->a_reg[7] = ISTACK;	/* setup initial stack */
+
+		regptr->reg_sr = INITSR;	/* setup sr */
+		regptr->reg_pc = B_buf_a;	/* setup pc */
+
+		return(TRUE);
+	}
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	dobar(nb, bv) -- draw bar 'nb' with value 'bv'
+   =============================================================================
+*/
+
+dobar(nb, bv)
+register int nb, bv;
+{
+	register unsigned *bp;
+	register int i;
+
+	if ((nb LT 1) OR (nb GT 82))
+		return;
+
+	--nb;
+	bp = obj0 + BARBASE + (long)(sigadr[nb] + MARGIN + nb);
+
+	for (i = 127; i GE 0; --i) {
+
+		if (i GT bv) {
+
+			*bp = baroff;
+			bp += 128L;
+			*bp = baroff;
+
+		} else {
+
+			*bp = baron;
+			bp += 128L;
+			*bp = baron;
+		}
+
+		bp += 128L;
+	}
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	dosw(nb, sv) -- display value 'sv' of switch 'nb'
+   =============================================================================
+*/
+
+dosw(nb, sv)
+register int nb, sv;
+{
+	register unsigned *bp;
+	register int i, j;
+
+	if ((nb LT 1) OR (nb GT 82))
+		return;
+
+	--nb;
+	bp = obj0 + SWBASE + (long)(sigadr[nb] + MARGIN + nb);
+
+	if (sv)
+		j = swon;
+	else
+		j = swoff;
+
+	for (i = 0; i < 8; i++) {
+
+		*bp = j;
+		bp += 128L;
+	}
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	exp_c() -- expand a 4 bit color into a 16 bit word
+   =============================================================================
+*/
+
+unsigned
+exp_c(c)
+unsigned c;
+{
+	c &= 0x000F;
+	c |= c << 4;
+	c |= c << 8;
+
+	return(c);
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	cx_adsp() -- display values of analog processor variables as a bar graph
+   =============================================================================
+*/
+
+cx_adsp()
+{
+	register int xasig, xastat, xaval;
+	register long xafi;
+	register long lc;
+	register unsigned *bp;
+	int	i, j, k;
+	int	oldi;
+
+	memsetw(sigtab, 0, sizeof sigtab / 2);
+
+	VHinit();
+	VSinit();
+	vsndpal(dfltpal);
+
+	obj0 = 0x200400L;
+
+	SetObj(0, 0, 0, obj0, 512, 350, 0, 0, (V_RES3 | V_TDE), -1);
+
+	bp = obj0;
+	
+	for (lc = 0; lc < 44800; lc++)
+		*bp++ = 0x0000;
+
+	baron  = 0x0FFF & exp_c(P_WHT);
+	baroff = 0x0FFF & exp_c(P_DKGRY);
+	swon   = 0x0FFF & exp_c(P_YEL);
+	swoff  = 0x0FFF & exp_c(P_DKGRY);
+
+	SetPri(0, 7);
+
+	for (i = 1; i < 83; i++) {
+
+		dobar(i, 0);
+		dosw(i, 0);
+	}
+
+	oldi = setipl(2);
+
+/* 
+
+*/
+
+	while (0L EQ BIOS(B_RDAV, CON_DEV)) {
+
+		if (-1L NE (xafi = XBIOS(X_ANALOG))) {
+
+			xasig  = 0x007F & (xafi >> 8);
+			xastat = 0x0001 & (xafi >> 7);
+			xaval  = 0x007F & xafi;
+
+			if (xasig) {
+
+				sigtab[xasig][0] = xaval;
+				sigtab[xasig][1] = xastat;
+
+				if (xasig LT 83) {
+
+					dobar(xasig, xaval);
+					dosw(xasig, xastat);
+				}
+
+			} else {
+
+				for (i = 0; i < 83; i++)
+					sigtab[i][1] = 0;
+			}
+		}
+	}
+
+/* 
+
+*/
+
+	BIOS(B_GETC, CON_DEV);
+
+	for (j = 1; j < 83; j++) {
+
+		dobar(j, sigtab[j][0]);
+		dosw(j, sigtab[j][1]);
+	}
+
+	k = 0;
+
+	printf("\n");
+	printf("       x0     x1     x2     x3     x4     x5     x6     x7     x8     x9\r\n");
+	printf("     -----  -----  -----  -----  -----  -----  -----  -----  -----  -----\r\n");
+		        
+	for (i = 0; i < 9; i++ ) {
+
+		printf("%01dx   ", k/10);
+
+		for (j = 0; j < 10; j++) {
+
+			if (k)
+				printf("%1d:%3d  ", sigtab[k][1], sigtab[k][0]);
+			else
+				printf("       ");
+
+			if (++k EQ 83)
+				goto outofit;
+		}
+
+		printf("\n");
+	}
+
+outofit:
+
+	printf("\nTempo     = %3d,  Time      = %3d,  Tuning = %3d,  Level = %3d\n",
+		sigtab[I_TEMPO][0], sigtab[I_TIME][0],
+		sigtab[I_TUNE][0], sigtab[I_LEVEL][0]);
+
+	printf("LongPot L = %3d,  LongPot R = %3d,  Scroll = %3d\n",
+		sigtab[I_LONGL][0], sigtab[I_LONGR][0],
+		sigtab[I_SCROLL][0]);
+
+	printf("Tablet X  = %3d,  Tablet Y  = %3d\n",
+		sigtab[I_TABX][0], sigtab[I_TABY][0]);
+
+	printf("Cursor X  = %3d,  Cursor Y  = %3d\n",
+		sigtab[I_CURX][0], sigtab[I_CURY][0]);
+
+	setipl(oldi);
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	waitcr() -- wait for a CR from CON_DEV
+		Returns:	0 = continue
+				1 = ^G hit - abort
+   =============================================================================
+*/
+
+int
+waitcr()
+{
+	char	c;
+
+	BIOS(B_PUTC, CON_DEV, '\007');
+
+	while ('\r' NE (c = (0x7F & BIOS(B_GETC, CON_DEV)))) {
+
+		if (c EQ '\007')
+			return(1);
+	}
+
+	return(0);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	xdtoi -- convert hex ASCII to an int digit
+   ============================================================================
+*/
+
+int
+xdtoi(c)
+register int c;
+{
+	register int i;
+	register char *ap = &ahex[0];
+
+	for (i = 0; i < 22; i++)
+		if (c EQ *ap++)
+			if (i >15)
+				return(i - 6);
+			else
+				return(i);
+
+	return(-1);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	getcmd -- parse command from input line
+   ============================================================================
+*/
+
+int
+getcmd()
+{
+	register int c;
+
+	sptr = cmdline;
+	argln = 0;
+	aptr = argstr;
+	memset(argstr, 0, MAXARGLN+1);
+
+	do {
+
+		switch (c = 0x00FF & *sptr) {
+
+		case '\0':
+		case A_CR:
+		case A_LF:
+
+			argsep = c;
+			return(argln);
+
+		case ' ':
+
+			++sptr;
+
+			while (*sptr EQ ' ')
+				++sptr;
+
+			if (*sptr EQ A_CR OR *sptr EQ A_LF OR *sptr EQ '\0')
+				c = 0x00FF & *sptr;
+
+			argsep = c;
+			return(argln);
+
+/* 
+
+*/
+
+		default:
+
+			if (isupper(c))
+				c = _tolower(c);
+
+			*aptr++ = c;
+			++sptr;
+			++argln;
+		}
+
+	} while (*sptr);
+
+	argsep = 0;
+	return(argln);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	getarg -- parse out an argument to analyze
+   ============================================================================
+*/
+
+int
+getarg()
+{
+	register int c;
+
+	argln = 0;
+	aptr = argstr;
+	memset(argstr, 0, MAXARGLN+1);
+
+	do {
+
+		switch (c = 0x00FF & *sptr) {
+
+		case '\0':
+		case A_CR:
+		case A_LF:
+
+			argsep = c;
+			return(argln);
+
+		case ' ':
+
+			++sptr;
+
+			while (*sptr EQ ' ')
+				++sptr;
+
+			if (*sptr EQ A_CR OR *sptr EQ A_LF OR *sptr EQ '\0')
+				c = 0x00FF & *sptr;
+
+			argsep = c;
+			return(argln);
+
+		case ',':
+
+			++sptr;
+			argsep = c;
+			return(argln);
+
+/* 
+
+*/
+
+		default:
+
+			*aptr++ = c;
+			++sptr;
+			++argln;
+		}
+
+	} while (*sptr);
+
+	argsep = 0;
+	return(argln);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	getlong -- get a long integer (either hex or decimal)
+   ============================================================================
+*/
+
+int
+getlong(var)
+long *var;
+{
+	register long	temp = 0L;
+	register int 	csw = FALSE,
+			c;
+
+	if (*aptr EQ '$') {
+
+		++aptr;
+
+		while (isxdigit(c = *aptr++)) {
+
+			temp = (temp << 4) + xdtoi(c);
+			csw = TRUE;
+		}
+
+	} else {
+
+		while (isdigit(c = *aptr++)) {
+
+			temp = (temp * 10) + (c - '0');
+			csw = TRUE;
+		}
+	}
+
+	if (csw)
+		*var = temp;
+
+	return(c);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	setvar -- parse an expression and set a long variable
+   ============================================================================
+*/
+
+int
+setvar(var, deflt)
+long *var, deflt;
+{
+	int rc;
+	long temp;
+
+	*var = deflt;
+	aptr = argstr;
+
+	rc = getlong(var);
+
+	if (rc) {
+
+		do {
+
+			switch (rc) {
+
+			case '+':
+
+				temp = 0L;
+				rc = getlong(&temp);
+				*var = *var + temp;
+				continue;
+
+			case '-':
+
+				temp = 0L;
+				rc = getlong(&temp);
+				*var = *var - temp;
+				continue;
+
+			default:
+
+				*var = deflt;
+				return(FALSE);
+			}
+
+		} while (rc);
+
+		return(TRUE);
+	}
+
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	putn -- output a decimal number
+   ============================================================================
+*/
+
+putn(num, cw, unit)
+long num;
+int cw, unit;
+{
+	register int	d;
+
+	if (!cw)
+		return;
+
+	putn(num/10, cw-1, unit);
+
+	d =  num % 10;
+
+	BIOS(B_PUTC, unit, (d + '0'));	
+
+	return;
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	puthn -- output a hex number
+   ============================================================================
+*/
+
+puthn(num, cw, unit)
+long num;
+int cw, unit;
+{
+	register int	d;
+
+	if (!cw)
+		return;
+
+	puthn(num >> 4, cw-1, unit);
+
+	d = 0x0F & num;
+
+	if (d > 9)
+		BIOS(B_PUTC, unit, (d - 10 + 'A'));
+	else
+		BIOS(B_PUTC, unit, (d + '0'));	
+
+	return;
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	ddump -- do the hex portion of a dump
+   ============================================================================
+*/
+
+int
+ddump(loc, lastloc, nwide, unit)
+register char *loc, *lastloc;
+register int nwide, unit;
+{
+	while (nwide--) {
+
+		puthn((long)(0xFF & *loc), 2, unit);
+		BIOS(B_PUTC, unit, ' ');
+
+		if (BIOS(B_RDAV, unit)) {
+
+			BIOS(B_GETC, unit);
+			return(TRUE);
+		}
+
+		if (loc EQ lastloc) {
+
+			dflag = TRUE;
+			return(FALSE);
+		}
+
+		++loc;
+	}
+
+
+	return(FALSE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	padr -- print dump address
+   ============================================================================
+*/
+
+padr(adr, unit)
+long adr;
+int unit;
+{
+	puthn(adr, 8, unit);
+	BIOS(B_PUTC, unit, ' ');
+	BIOS(B_PUTC, unit, '-');
+	BIOS(B_PUTC, unit, ' ');
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	dtext -- do the text portion of a dump
+   ============================================================================
+*/
+
+int
+dtext(loc, lastloc, nwide, unit)
+register char *loc, *lastloc;
+register int nwide, unit;
+{
+	register int c;
+
+	BIOS(B_PUTC, unit, ' ');
+	BIOS(B_PUTC, unit, '|');
+
+	while (nwide--) {
+
+		c = 0xFF & *loc;
+
+		if (isascii(c) AND isprint(c))
+			BIOS(B_PUTC, unit, c);
+		else
+			BIOS(B_PUTC, unit, '.');
+
+		if (BIOS(B_RDAV, unit)) {
+
+			BIOS(B_GETC, unit);
+			BIOS(B_PUTC, unit, '|');
+			return(TRUE);
+		}
+
+		if (loc EQ lastloc) {
+
+			BIOS(B_PUTC, unit, '|');
+			return(FALSE);
+		}
+
+		++loc;
+	}
+
+	BIOS(B_PUTC, unit, '|');
+	return(FALSE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cp_mset -- parse parameters for mset command
+   ============================================================================
+*/
+
+int
+cp_mset()
+{
+	redo = FALSE;
+
+	if (0 EQ getarg())
+		return(FALSE);
+
+	if (argsep NE ',')
+		return(FALSE);
+
+	if (setvar(&p_from, p_from) EQ FALSE)
+		return(FALSE);
+
+	return(TRUE);
+}
+
+/*
+   ============================================================================
+	cx_mset -- execute the mset command
+   ============================================================================
+*/
+
+int
+cx_mset()
+{
+	while (TRUE) {
+
+		if (getarg())
+			if (setvar(&p_value, p_value) EQ FALSE)
+				return(FALSE);
+
+		if (p_value & ~0xFFL)
+			return(FALSE);
+
+		*p_from++ = 0xFF & p_value;
+
+		if (argsep EQ A_CR)
+			return(TRUE);
+	}
+}
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cp_wset -- parse parameters for wset command
+   ============================================================================
+*/
+
+int
+cp_wset()
+{
+	redo = FALSE;
+
+	if (0 EQ getarg())
+		return(FALSE);
+
+	if (argsep NE ',')
+		return(FALSE);
+
+	if (setvar(&p_from, p_from) EQ FALSE)
+		return(FALSE);
+
+	if ((long)p_from & 1L)
+		return(FALSE);
+
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_wset -- execute the wset command
+   ============================================================================
+*/
+
+int
+cx_wset()
+{
+	UWORD16	*p_uint;
+
+	p_uint = (UWORD16 *)p_from;
+
+	while (TRUE) {
+
+		if (getarg())
+			if (setvar(&p_value, p_value) EQ FALSE)
+				return(FALSE);
+
+		if (p_value & ~0xFFFFL)
+			return(FALSE);
+
+		*p_uint++ = 0xFFFF & p_value;
+
+		if (argsep EQ A_CR)
+			return(TRUE);
+	}
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cp_mtst -- parse mtest command arguments
+   ============================================================================
+*/
+
+int
+cp_mtst()
+{
+	inext = ilast;
+
+	if (argsep EQ A_CR OR argsep EQ '\0') {
+
+		p_from = (char *)0x00000008L;
+		p_to   = (char *)USER_RAM - 2L;
+		return(TRUE);
+	}
+
+	if (getarg())
+		if (setvar(&p_from, USER_RAM) EQ FALSE)
+			return(FALSE);
+
+	if (argsep NE ',')
+		return(FALSE);
+
+	if (getarg())
+		if (setvar(&p_to, RAM_TOP) EQ FALSE)
+			return(FALSE);
+
+	if ((long)p_from & 1L)
+		return(FALSE);
+
+	if ((long)p_to & 1L)
+		return(FALSE);
+
+	if (p_from GT p_to)
+		return(FALSE);
+
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_mtst -- execute the mtest command
+   ============================================================================
+*/
+
+int
+cx_mtst()
+{
+	register short	mask, was, *loc, *eloc, *oldloc;
+
+	mask = 0x0001;
+	loc = (short *)p_from;
+	eloc = (short *)p_to;
+	oldloc = loc;
+
+	if (p_from LT (char *)USER_RAM)
+		setipl(7);
+
+	do {
+
+		while (mask) {
+
+			*loc = mask;
+
+			if (mask NE (was = *loc))
+				if (p_from LT (char *)USER_RAM)
+					halt();
+				else
+					printf("%08lX was %04X, expected %04X\r\n",
+						loc, was, mask);
+
+			*loc = ~mask;
+
+			if (~mask NE (was = *loc))
+				if (p_from LT (char *)USER_RAM)
+					halt();
+				else
+					printf("%08lX was %04X, expected %04X\r\n",
+						loc, was, ~mask);
+
+			mask <<= 1;
+		}
+
+		mask = 0x0001;
+		loc++;
+
+	} while (loc LE eloc);
+
+	if (oldloc LT (short *)USER_RAM)
+		rjumpto((long)ROMADDR);
+
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cp_go -- parse parameters for go command
+   ============================================================================
+*/
+
+int
+cp_go()
+{
+	redo = FALSE;
+	b0flag = FALSE;
+	b1flag = FALSE;
+	goflag = FALSE;
+
+	if (getarg()) {
+
+		if (setvar(&p_goto, p_goto) EQ FALSE)
+			return(FALSE);
+
+		if (1L & (long)p_goto)
+			return(FALSE);
+
+		goflag = TRUE;
+
+	}
+
+	if (getarg()) {
+
+		if (setvar(&tba0, 0L) EQ FALSE)
+			return(FALSE);
+
+		if (1L & (long)tba0)
+			return(FALSE);
+
+		b0flag = TRUE;
+	}
+
+	if (getarg()) {
+
+		if (setvar(&tba1, 0L) EQ FALSE)
+			return(FALSE);
+
+		if (1L & (long)tba1)
+			return(FALSE);
+
+		b1flag = TRUE;
+	}
+
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+#if	ON_B700
+
+/*
+   ============================================================================
+	cx_dini() -- execute the dinit command
+   ============================================================================
+*/
+
+int
+cx_dini()
+{
+	redo = TRUE;
+	hdvini();
+	return(TRUE);
+}
+
+#endif
+
+/*
+   ============================================================================
+	cx_zap -- execute the zap command
+   ============================================================================
+*/
+
+int
+cx_zap()
+{
+	register short *p, *q;
+
+	p = (short *)USER_RAM;
+	q = (short *)RAM_TOP;
+
+	setipl(7);
+
+	while (p LE q)
+		*p++ = 0;
+
+	rjumpto(ROMADDR);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_omap() -- execute the omap command
+   ============================================================================
+*/
+
+int
+cx_omap()
+{
+	register short i, width, xloc;
+
+	printf("Pr B/C Locn      Wd Xloc Flags\r\n");
+
+	for (i = 0; i < 16; i++) {
+
+		xloc = v_odtab[i][1] & 0x03FF;
+
+		if (xloc & 0x0200)		/* sign extend xloc */
+			xloc |= 0xFC00;
+
+		width = (v_odtab[i][1] >> 10) & 0x003F;
+
+		printf("%2d %s ",
+			i, ((v_odtab[i][0] & V_CBS) ? "Chr" : "Bit"));
+
+		printf("$%08lX %2d %4d ",
+			((long)v_odtab[i][2] << 1), width, xloc);
+
+		printf("$%04X\r\n", v_odtab[i][0]);
+	}
+
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_help -- execute the help command
+   ============================================================================
+*/
+
+int
+cx_help()
+{
+	int	i, j;
+
+	j = 0;
+
+	writeln(cmdunit, CRLF);
+
+	for (i = 0; i < NCMDS; i++) {
+
+		if (j++ EQ 22) {
+
+			j = 0;
+
+			if (waitcr())
+				return(TRUE);
+		}
+
+		writeln(cmdunit, "     ");
+		writeln(cmdunit, cmtab[i].cname);
+		writeln(cmdunit, "  ");
+		writeln(cmdunit, cmtab[i].hstr);
+		writeln(cmdunit, CRLF);
+	}
+
+	writeln(cmdunit, CRLF);
+	return(TRUE);
+}
+
+/* 
+
+* /
+
+/*
+   ============================================================================
+	cx_bpb -- execute bpb command
+   ============================================================================
+*/
+
+int
+cx_bpb()
+{
+	register struct bpb *bpp;
+
+	if (0L EQ (bpp = (struct bpb *)BIOS(B_GBPB, 0) ) ) {
+
+		writeln(cmdunit, "\r\n\nERROR -- Unable to read BPB\r\n\n");
+		return(FALSE);
+
+	} else {
+
+		writeln(cmdunit, "\r\n\nBPB values:\r\n");
+		writeln(cmdunit, "\r\n   recsiz   ");
+		putn((long)bpp->recsiz, 5, cmdunit);
+		writeln(cmdunit, "\r\n   clsiz     ");
+		putn((long)bpp->clsiz, 4, cmdunit);
+		writeln(cmdunit, "\r\n   clsizb   ");
+		putn((long)bpp->clsizb, 5, cmdunit);
+		writeln(cmdunit, "\r\n   rdlen     ");
+		putn((long)bpp->rdlen, 4, cmdunit);
+		writeln(cmdunit, "\r\n   fsiz      ");
+		putn((long)bpp->fsiz, 4, cmdunit);
+		writeln(cmdunit, "\r\n   fatrec   ");
+		putn((long)bpp->fatrec, 5, cmdunit);
+		writeln(cmdunit, "\r\n   datrec   ");
+		putn((long)bpp->datrec, 5, cmdunit);
+		writeln(cmdunit, "\r\n   numcl    ");
+		putn((long)bpp->numcl, 5, cmdunit);
+		writeln(cmdunit, "\r\n   bflags    ");
+		puthn((long)bpp->bflags, 4, cmdunit);
+		writeln(cmdunit, "\r\n   ntracks   ");
+		putn((long)bpp->ntracks, 4, cmdunit);
+		writeln(cmdunit, "\r\n   nsides    ");
+		putn((long)bpp->nsides, 4, cmdunit);
+		writeln(cmdunit, "\r\n   sec/cyl  ");
+		putn((long)bpp->dspc, 5, cmdunit);
+		writeln(cmdunit, "\r\n   sec/trk  ");
+		putn((long)bpp->dspt, 5, cmdunit);
+		writeln(cmdunit, "\r\n   hidden    ");
+		putn((long)bpp->hidden, 4, cmdunit);
+		writeln(cmdunit, "\r\n\n");
+		return(TRUE);
+	}
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_go -- execute the go command
+   ============================================================================
+*/
+
+int
+cx_go()
+{
+	redo = FALSE;
+	exflag = TRUE;
+	wzcrsh = FALSE;
+
+	if (goflag)
+		regptr->reg_pc = p_goto;
+
+	if (b0flag ) {
+
+		if (p_ba0) {
+
+			if (*p_ba0 NE (UWORD16)BPINST) {
+
+				writeln(cmdunit, "\r\n\n** Breakpoint 0 at ");
+				puthn((long)p_ba0, 8, cmdunit);
+				writeln(cmdunit, " was ");
+				puthn(0xFFFFL & (long)(*p_ba0), 4, cmdunit);
+				writeln(cmdunit, " instead of ");
+				puthn(0xFFFFL & (long)BPINST, 4, cmdunit);
+				writeln(cmdunit, " **\r\n\n");
+			}
+
+			*p_ba0 = p_bv0;
+		}
+
+		p_ba0 = tba0;
+		p_bv0 = *p_ba0;
+		*p_ba0 = (UWORD16)BPINST;
+	}
+
+/* 
+
+*/
+
+	if (b1flag ) {
+
+		if (p_ba1) {
+
+			if (*p_ba1 NE (UWORD16)BPINST) {
+
+				writeln(cmdunit, "\r\n\n** Breakpoint 1 at ");
+				puthn((long)p_ba1, 8, cmdunit);
+				writeln(cmdunit, " was ");
+				puthn(0xFFFFL & (long)(*p_ba1), 4, cmdunit);
+				writeln(cmdunit, " instead of ");
+				puthn(0xFFFFL & (long)BPINST, 4, cmdunit);
+				writeln(cmdunit, " **\r\n\n");
+			}
+
+			*p_ba1 = p_bv1;
+		}
+
+		p_ba1 = tba1;
+		p_bv1 = *p_ba1;
+		*p_ba1 = (UWORD16)BPINST;
+	}
+
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cp_dump -- parse dump parameters
+   ============================================================================
+*/
+
+int
+cp_dump()
+{
+	inext = ilast;
+
+	if (getarg())
+		if (setvar(&p_from, p_from) EQ FALSE) {
+
+			redo = FALSE;
+			return(FALSE);
+		}
+
+	if (argsep EQ A_CR OR argsep EQ '\0') {
+
+		p_to = p_from;
+		p_width = 16L;
+		redo = TRUE;
+		return(TRUE);
+	}
+
+	if (getarg())
+		if (setvar(&p_to, p_to) EQ FALSE) {
+
+			redo = FALSE;
+			return(FALSE);
+	}
+
+	if (argsep EQ A_CR OR argsep EQ '\0') {
+
+		p_width = 16L;
+		redo = TRUE;
+		return(TRUE);
+	}
+
+	if (getarg())
+		if (setvar(&p_width, p_width) EQ FALSE) {
+
+			redo = FALSE;
+			return(FALSE);
+	}
+
+	if ((p_width LE 0L) OR (p_width GT 16L)) {
+
+		p_width = 16L;
+		redo = FALSE;
+		return(FALSE);
+	}
+
+	redo = TRUE;
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cp_fill -- parse parameters for fill command
+   ============================================================================
+*/
+
+int
+cp_fill()
+{
+	redo = FALSE;
+
+	if (getarg())
+		if (setvar(&p_from, p_from) EQ FALSE)
+			return(FALSE);
+
+	if (getarg())
+		if (setvar(&p_len, p_len) EQ FALSE)
+			return(FALSE);
+
+	if (getarg())
+		if (setvar(&p_value, p_value) EQ FALSE)
+			return(FALSE);
+
+	if (p_value & ~0xFFL)
+		return(FALSE);
+
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cp_wfil -- parse parameters for wfill command
+   ============================================================================
+*/
+
+int
+cp_wfil()
+{
+	redo = FALSE;
+
+	if (getarg())
+		if (setvar(&p_from, p_from) EQ FALSE)
+			return(FALSE);
+
+	if (getarg())
+		if (setvar(&p_len, p_len) EQ FALSE)
+			return(FALSE);
+
+	if (getarg())
+		if (setvar(&p_value, p_value) EQ FALSE)
+			return(FALSE);
+
+	if ((long)p_from & 1L)
+		return(FALSE);
+
+	if (p_value & ~0xFFFFL)
+		return(FALSE);
+
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cp_copy -- parse parameters for copy command
+   ============================================================================
+*/
+
+int
+cp_copy()
+{
+	redo = FALSE;
+
+	if (getarg())
+		if (setvar(&p_from, p_from) EQ FALSE)
+			return(FALSE);
+
+	if (getarg())
+		if (setvar(&p_to, p_to) EQ FALSE)
+			return(FALSE);
+
+	if (getarg())
+		if (setvar(&p_len, p_len) EQ FALSE)
+			return(FALSE);
+
+	return(TRUE);
+}
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cp_chek -- parse parameters for chek command
+   ============================================================================
+*/
+
+int
+cp_chek()
+{
+	redo = FALSE;
+
+	if (getarg())
+		if (setvar(&p_from, p_from) EQ FALSE)
+			return(FALSE);
+
+	if (getarg())
+		if (setvar(&p_to, p_to) EQ FALSE)
+			return(FALSE);
+
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cp_read -- parse parameters for read command
+   ============================================================================
+*/
+
+int
+cp_read()
+{
+	redo = FALSE;
+
+	if (getarg())
+		if (setvar(&p_from, p_from) EQ FALSE)
+			return(FALSE);
+
+	if (getarg())
+		if (setvar(&p_to, p_to) EQ FALSE)
+			return(FALSE);
+
+	if (getarg())
+		if (setvar(&p_len, p_len) EQ FALSE)
+			return(FALSE);
+
+	if ((~0x7FFFL) & p_len)
+		return(FALSE);
+
+	if ((~0xFFFFL) & (long)p_from)
+		return(FALSE);
+
+	return(TRUE);
+}
+
+/*
+   ============================================================================
+	cp_null -- parse null parameter line
+   ============================================================================
+*/
+
+int
+cp_null()
+{
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cp_rset -- parse rset command parameters
+   ============================================================================
+*/
+
+int
+cp_rset()
+{
+	int	rc;
+
+	rc = 0;
+	redo = FALSE;
+
+	if (0 EQ getarg())
+		return(FALSE);
+
+	str2lc(argstr);
+
+	if (0 EQ (rc = strlcmp(argstr, rlist)))
+		return(FALSE);
+
+	if (0 EQ getarg())
+		return(FALSE);
+
+	if (FALSE EQ setvar(&p_value, 0L))
+		return(FALSE);
+
+	rnum = rc;
+	return(TRUE);
+}
+
+/* 
+
+*/
+/*
+   ============================================================================
+	cx_chek -- process chek command
+   ============================================================================
+*/
+
+int
+cx_chek()
+{
+	register long csum;
+	register char *cp;
+
+	redo = FALSE;
+	csum = 0L;
+
+	for (cp = p_from; cp LE p_to; cp++)
+		csum += 0x000000FFL & *cp;
+
+	printf("Checksum = 0x%08lX\r\n", csum);
+
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_rset -- process rset command
+   ============================================================================
+*/
+
+int
+cx_rset()
+{
+	redo = FALSE;
+
+	if (rnum < 1)
+		return(FALSE);
+
+	if (rnum < 9) {		/* d0..d7 -- data register */
+
+		regptr->d_reg[rnum-1] = p_value;
+		return(TRUE);
+	}
+
+	if (rnum < 17) {	/* a0..a7 -- address register */
+
+		regptr->a_reg[rnum-9] = (char *)p_value;
+		return(TRUE);
+	}
+
+/* 
+
+*/
+
+	if (rnum EQ 17) {	/* sr -- status register */
+
+		if ((~0xFFFFL) & p_value)
+			return(FALSE);
+
+		regptr->reg_sr = (UWORD16)p_value;
+		return(TRUE);
+	}
+
+	if (rnum EQ 18) {	/* pc -- program counter */
+
+		if (1L & p_value)
+			return(FALSE);
+
+		regptr->reg_pc = (char *)p_value;
+		return(TRUE);
+	}
+
+	if (rnum EQ 19) {	/* sp -- stack pointer */
+
+		if (1L & p_value)
+			return(FALSE);
+
+		regptr->a_reg[7] = (char *)p_value;
+		return(TRUE);
+	}
+
+	return(FALSE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cp_vrst -- parse vrset command parameters
+   ============================================================================
+*/
+
+int
+cp_vrst()
+{
+	int	rc;
+
+	rc = 0;
+	redo = FALSE;
+
+	if (0 EQ getarg())
+		return(FALSE);
+
+	str2lc(argstr);
+
+	if (0 EQ (rc = strlcmp(argstr, vrlist)))
+		return(FALSE);
+
+	if (0 EQ getarg())
+		return(FALSE);
+
+	if (FALSE EQ setvar(&p_value, 0L))
+		return(FALSE);
+
+	if (vrnum < 17) {	/* complete register */
+
+		vrnum = rc;
+		return(TRUE);
+	}
+
+	if (vrnum < 21) {	/* horizontal register */
+
+		if (p_value & ~0x003F)
+			return(FALSE);
+
+		vrnum = rc;
+		return(TRUE);
+	}
+
+	if (vrnum < 25) {	/* vertical register */
+
+		if (p_value & ~0x03FF)
+			return(FALSE);
+
+		vrnum = rc;
+		return(TRUE);
+	}
+
+	return(FALSE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_vrst -- process vrset command
+   ============================================================================
+*/
+
+int
+cx_vrst()
+{
+	redo = FALSE;
+
+	if (vrnum < 1)
+		return(FALSE);
+
+	if (vrnum < 17) {	/* 1..16 -- r0..r15 -- complete register */
+
+		v_regs[vrnum-1] = p_value;
+		return(TRUE);
+	}
+
+	if (vrnum < 21) {	/* 17..20 -- h0..h3 -- horizontal register */
+
+		v_regs[vrnum-5] = (v_regs[vrnum-5] & 0x03FF) |
+			((p_value << 10) & 0xFC00);
+		return(TRUE);
+	}
+
+	if (vrnum < 25) {	/* 21..24 -- v0..v3 -- vertical register */
+
+		v_regs[vrnum-9] = (v_regs[vrnum-9] & 0xFC00) | p_value;
+		return(TRUE);
+	}
+
+	return(FALSE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_vreg -- process vregs command
+   ============================================================================
+*/
+
+int
+cx_vreg()
+{
+	register int	i, j, k, l;
+	register unsigned *rp;
+
+	rp = &v_regs[0];
+	l = 0;
+
+	for (i = 0; i  < 2; i++) {
+
+		for (j = 0; j < 2; j++) {
+
+			for (k = 0; k < 4; k++) {
+
+				writeln(cmdunit, "  ");
+				putn((long)l++, 2, cmdunit);
+				writeln(cmdunit, ":");
+				puthn((long)*rp++, 4, cmdunit);
+			}
+
+			writeln(cmdunit, "  ");
+		}
+
+		writeln(cmdunit, "\r\n");
+	}
+
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	do_srec -- load a Motorola S record
+   ============================================================================
+*/
+
+int
+do_srec(line)
+register char *line;
+{
+	register char *ldadr;
+	register int c, csum, i, len;
+	register unsigned val;
+
+	if ('S' NE (c = *line++))
+		return(-1);		/* error 1 = missing initial S */
+
+	switch (c = *line++) {
+
+	case '2':
+
+		csum = 0;
+
+		if (isxdigit(c = *line++))
+			len = xdtoi(c);
+		else
+			return(-2);	/* error 2 = bad length byte */
+
+		if (isxdigit(c = *line++))
+			len = (len << 4) + xdtoi(c);
+		else
+			return(-2);
+
+		csum += (len & 0xFF);
+		ldadr = (char *)0;
+		len -= 4;
+
+		for (i = 0; i < 3; i++) {
+
+			if (isxdigit(c = *line++))
+				val = xdtoi(c);
+			else
+				return(-3);	/* error 3 = bad address byte */
+
+			if (isxdigit(c = *line++))
+				val = (val << 4) + xdtoi(c);
+			else
+				return(-3);
+
+			ldadr = (char *)(((long)ldadr << 8) + (long)val);
+			csum += (val & 0xFF);
+		}
+
+		for (i = 0; i < len; i++) {
+
+			if (isxdigit(c = *line++))
+				val = xdtoi(c);
+			else
+				return(-4);	/* error 4 = bad data byte */
+
+			if (isxdigit(c = *line++))
+				val = (val << 4) + xdtoi(c);
+			else
+				return(-4);
+
+			csum += (val & 0xFF);
+			*ldadr = val & 0xFF;
+
+			if ((*ldadr & 0xFF) NE (val & 0xFF))
+				return(-5);	/* error 5 = store failed */
+
+			ldadr++;
+		}
+
+		csum = 0xFF & ~csum;
+
+		if (isxdigit(c = *line++))
+			val = xdtoi(c);
+		else
+			return(-6);		/* error 6 = bad checksum byte */
+
+		if (isxdigit(c = *line++))
+			val = (val << 4) + xdtoi(c);
+		else
+			return(-6);
+
+		if (csum NE (val & 0xFF))
+			return(-7);		/* error 7 = bad checksum */
+
+		return(1);
+
+	case '9':
+
+		if (memcmpu(line, SREC9, 10) EQ 0)
+			return(0);
+		else
+			return(-8);		/* error 8 = bad end record */
+
+	default:
+
+		return(-9);			/* error 9 = unknown s type */
+	}
+
+	return(-10);			/* error 10 = switch failed */
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_load -- process load command
+   ============================================================================
+*/
+
+int
+cx_load()
+{
+	register int rc;
+
+	do {
+
+		rc = getrln(cmdunit, MAXCMDLN, cmdline);
+
+		switch (rc) {
+
+		case A_CR:
+
+			rc = do_srec(cmdline);
+
+			if (rc LT 0) {
+
+				rc =  -rc;
+				writeln(cmdunit, NACK);
+				writeln(cmdunit, "** Load error ");
+				putn((long)rc, 3, cmdunit);
+				writeln(cmdunit, " **\r\n\n");
+				return(FALSE);
+
+			} else {
+
+				writeln(cmdunit, TACK);
+			}
+
+			continue;
+
+		case CTL('X'):
+
+			rc = 1;
+			writeln(cmdunit, TACK);
+			continue;
+
+/* 
+
+*/
+
+		default:
+
+			writeln(cmdunit, NACK);
+			writeln(cmdunit, "** Load aborted on ");
+			puthn(rc, 2, cmdunit);
+			writeln(cmdunit, " **\r\n\n");
+			return(FALSE);
+		}
+
+	} while (rc);
+
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_fill -- execute the fill command
+   ============================================================================
+*/
+
+int
+cx_fill()
+{
+	register char *cp = p_from;
+	register long count;
+
+	redo = FALSE;
+
+	for (count = p_len; count > 0L; count--) {
+
+		*cp = (char)(0xFFL & p_value);
+
+		if (*cp NE (char)(0xFFL & p_value)) {
+
+			writeln(cmdunit, "\r\n** FILL failed at ");
+			puthn((long)cp, 8, cmdunit);
+			writeln(cmdunit, " **\r\n");
+			return(FALSE);
+		}
+
+		++cp;
+	}
+
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_wfill -- execute the wfill command
+   ============================================================================
+*/
+
+int
+cx_wfil()
+{
+	register UWORD16 *cp = (UWORD16 *)p_from;
+	register long count;
+
+	redo = FALSE;
+
+	for (count = p_len; count > 0L; count--)
+		*cp++ = (UWORD16)(0xFFFFL & p_value);
+
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_copy -- execute the copy command
+   ============================================================================
+*/
+
+int
+cx_copy()
+{
+	register char	*from = p_from,
+			*to = p_to;
+	register long	count = p_len;
+
+	redo = FALSE;
+
+	if (to GT from) {
+
+		from = from + count;
+		to = to + count;
+
+		while (count--) {
+
+			--from;
+			--to;
+			*to = *from;
+
+			if (*from NE *to) {
+
+				writeln(cmdunit, "\r\n** COPY failed from ");
+				puthn((long)from, 8, cmdunit);
+				writeln(cmdunit, " to ");
+				puthn((long)to, 8, cmdunit);
+				writeln(cmdunit, " with (from) = ");
+				puthn((long)(*from), 2, cmdunit);
+				writeln(cmdunit, " and (to) = ");
+				puthn((long)(*to), 2, cmdunit);
+				writeln(cmdunit, " **\r\n");
+				return(FALSE);
+			}
+		}
+
+/* 
+
+*/
+
+	} else {
+
+		while (count--) {
+
+			*to = *from;
+
+			if (*from NE *to) {
+
+				writeln(cmdunit, "\r\n** COPY failed from ");
+				puthn((long)from, 8, cmdunit);
+				writeln(cmdunit, " to ");
+				puthn((long)to, 8, cmdunit);
+				writeln(cmdunit, " with (from) = ");
+				puthn((long)(*from), 2, cmdunit);
+				writeln(cmdunit, " and (to) = ");
+				puthn((long)(*to), 2, cmdunit);
+				writeln(cmdunit, " **\r\n");
+				return(FALSE);
+			}
+
+			++from;
+			++to;
+		}
+	}
+
+	return(TRUE);
+}
+			
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_dump -- execute the dump command
+   ============================================================================
+*/
+
+int
+cx_dump()
+{
+	register int	nw, rc;
+
+	redo= TRUE;
+	d_cur = p_from;
+	d_next = p_to + 1;
+	d_last = ((long)p_to - (long)p_from) + d_next;
+	nw = p_width;
+	rc = TRUE;
+
+	do {
+
+		writeln(cmdunit, CRLF);
+		padr(p_from, cmdunit);
+
+		dflag = FALSE;
+
+		if (ddump(p_from, p_to, nw, cmdunit))
+			rc = FALSE;
+
+		if (rc)
+			if (dtext(p_from, p_to, nw, cmdunit))
+				rc = FALSE;
+
+		p_from = p_from + p_width;
+
+		if (dflag)
+			rc = FALSE;
+
+	} while (rc);
+
+	p_from = d_cur;
+
+	writeln(cmdunit, CRLF);
+	writeln(cmdunit, CRLF);
+
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	wdump -- dump words in hex  (no ASCII)
+   ============================================================================
+*/
+
+int
+wdump(loc, lastloc, nwide, unit)
+register UWORD16 *loc, *lastloc;
+int nwide, unit;
+{
+	while (nwide--) {
+
+		puthn((long)(0xFFFFL & *loc), 4, unit);
+		BIOS(B_PUTC,unit, ' ');
+
+		if (BIOS(B_RDAV, unit))
+			return(TRUE);
+
+		if (loc EQ lastloc) {
+
+			dflag = TRUE;
+			return(FALSE);
+		}
+
+		++loc;
+	}
+
+	return(FALSE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	ldump -- dump longs in hex  (no ASCII)
+   ============================================================================
+*/
+
+int
+ldump(loc, lastloc, nwide, unit)
+register long *loc, *lastloc;
+int nwide, unit;
+{
+	while (nwide--) {
+
+		puthn(*loc, 8, unit);
+		BIOS(B_PUTC,unit, ' ');
+
+		if (BIOS(B_RDAV, unit))
+			return(TRUE);
+
+		if (loc EQ lastloc) {
+
+			dflag = TRUE;
+			return(FALSE);
+		}
+
+		++loc;
+	}
+
+	return(FALSE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cp_wdmp -- process parameters for wdump command
+   ============================================================================
+*/
+
+int
+cp_wdmp()
+{
+	inext = ilast;
+
+	if (getarg())
+		if (setvar(&p_from, p_from) EQ FALSE) {
+
+			redo = FALSE;
+			return(FALSE);
+		}
+
+	if ((long)p_from & 1L) {
+
+		redo = FALSE;
+		return(FALSE);
+	}
+
+	if (argsep EQ A_CR OR argsep EQ '\0') {
+
+		p_to = p_from;
+		p_width = 8;
+		redo = TRUE;
+		return(TRUE);
+	}
+
+	if (getarg())
+		if (setvar(&p_to, p_to) EQ FALSE) {
+
+			redo = FALSE;
+			return(FALSE);
+		}
+
+	if ((long)p_to & 1L) {
+
+		redo = FALSE;
+		return(FALSE);
+	}
+
+	if (argsep EQ A_CR OR argsep EQ '\0') {
+
+		p_width = 8;
+		redo = TRUE;
+		return(TRUE);
+	}
+
+	if (getarg())
+		if (setvar(&p_width, p_width) EQ FALSE) {
+
+			redo = FALSE;
+			return(FALSE);
+		}
+
+	redo = TRUE;
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cp_ldmp -- process parameters for ldump command
+   ============================================================================
+*/
+
+int
+cp_ldmp()
+{
+	inext = ilast;
+
+	if (getarg())
+		if (setvar(&p_from, p_from) EQ FALSE) {
+
+			redo = FALSE;
+			return(FALSE);
+		}
+
+	if ((long)p_from & 1L) {
+
+		redo = FALSE;
+		return(FALSE);
+	}
+
+	if (argsep EQ A_CR OR argsep EQ '\0') {
+
+		p_to = p_from;
+		p_width = 4;
+		redo = TRUE;
+		return(TRUE);
+	}
+
+	if (getarg())
+		if (setvar(&p_to, p_to) EQ FALSE) {
+
+			redo = FALSE;
+			return(FALSE);
+		}
+
+	if ((long)p_to & 1L) {
+
+		redo = FALSE;
+		return(FALSE);
+	}
+
+	if (argsep EQ A_CR OR argsep EQ '\0') {
+
+		p_width = 4;
+		redo = TRUE;
+		return(TRUE);
+	}
+
+	if (getarg())
+		if (setvar(&p_width, p_width) EQ FALSE) {
+
+			redo = FALSE;
+			return(FALSE);
+		}
+
+	redo = TRUE;
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cp_ilev -- parse the ipl command
+   ============================================================================
+*/
+
+int
+cp_ilev()
+{
+	long	iplevl;
+
+	if (argsep EQ A_CR OR argsep EQ '\0')
+		return(TRUE);
+
+	if (getarg())
+		if (setvar(&iplevl, iplevl) EQ FALSE)
+			return(FALSE);
+
+	if (iplevl GT 7)
+		return(FALSE);
+
+	iplev = iplevl;
+
+	return(TRUE);
+}
+
+/*
+   ============================================================================
+	cx_ilev -- execute ipl command
+   ============================================================================
+*/
+
+int
+cx_ilev()
+{
+	if (-1 EQ setipl(iplev)) {
+
+		printf("ERROR -- Could not set IPL to %d\r\n", iplev);
+		return(FALSE);
+	} else
+		printf("ROMP IPL now set to %d\r\n", iplev);
+
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cp_monc() -- parse the monc command
+   ============================================================================
+*/
+
+int
+cp_monc()
+{
+	if (getarg())
+		if (setvar(&monptr, monptr) EQ FALSE)
+			return(FALSE);
+
+	monsw = MON_C;
+	redo = TRUE;
+	return(TRUE);
+}
+
+/*
+   ============================================================================
+	cp_mons() -- parse the mons command
+   ============================================================================
+*/
+
+int
+cp_mons()
+{
+	if (getarg())
+		if (setvar(&monptr, monptr) EQ FALSE)
+			return(FALSE);
+
+	monsw = MON_S;
+	redo = TRUE;
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cp_monl() -- parse the monl command
+   ============================================================================
+*/
+
+int
+cp_monl()
+{
+	if (getarg())
+		if (setvar(&monptr, monptr) EQ FALSE)
+			return(FALSE);
+
+	monsw = MON_L;
+	redo = TRUE;
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_mon() -- process the mon commands
+   ============================================================================
+*/
+
+int
+cx_mon()
+{
+	register char vc, vcc;
+	register short vs, vss, *vsp;
+	register long vl, vll, *vlp;
+
+	switch (monsw) {
+
+	case MON_C:
+
+		vc = *monptr & 0x0FF;
+		puthn((long)vc, 2, cmdunit);
+		writeln(cmdunit, "\r\n");
+
+		while (!(0xFFFFL & BIOS(B_RDAV, CON_DEV))) {
+
+			vcc = *monptr & 0x0FF;
+
+			if (vc NE vcc) {
+
+				vc = vcc;
+				puthn((long)vc, 2, cmdunit);
+				writeln(cmdunit, "\r\n");
+			}
+		}
+
+		BIOS(B_GETC, CON_DEV);
+		return(TRUE);
+
+	case MON_S:
+
+		vsp = (short *)monptr;
+		vs = *vsp;
+		puthn((long)vs, 4, cmdunit);
+		writeln(cmdunit, "\r\n");
+
+		while (!(0xFFFFL & BIOS(B_RDAV, CON_DEV))) {
+
+			vss = *vsp;
+
+			if (vs NE vss) {
+
+				vs = vss;
+				puthn((long)vs, 4, cmdunit);
+				writeln(cmdunit, "\r\n");
+			}
+		}
+
+		BIOS(B_GETC, CON_DEV);
+		return(TRUE);
+
+/* 
+
+*/
+	case MON_L:
+
+		vlp = (long *)monptr;
+		vl = *vlp;
+		puthn(vl, 8, cmdunit);
+		writeln(cmdunit, "\r\n");
+
+		while (!(0xFFFFL & BIOS(B_RDAV, CON_DEV))) {
+
+			vll = *vlp;
+
+			if (vl NE vll) {
+
+				vl = vll;
+				puthn(vl, 8, cmdunit);
+				writeln(cmdunit, "\r\n");
+			}
+		}
+
+		BIOS(B_GETC, CON_DEV);
+		return(TRUE);
+
+	default:
+		return(FALSE);
+	}
+}
+		
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_wdmp -- process wdump command
+   ============================================================================
+*/
+
+int
+cx_wdmp()
+{
+	int	nw, rc;
+
+	d_cur = p_from;
+	d_next = p_to + 2;
+	d_last = ((long)p_to - (long)p_from) + d_next;
+	nw = p_width;
+	rc = TRUE;
+
+	do {
+
+		writeln(cmdunit, CRLF);
+		padr(p_from, cmdunit);
+		dflag = FALSE;
+
+		if (wdump(p_from, p_to, nw, cmdunit))
+			rc = FALSE;
+
+		p_from = p_from + (p_width << 1);
+
+		if (dflag)
+			rc = FALSE;
+
+	} while (rc);
+
+	p_from = d_cur;
+
+	writeln(cmdunit, CRLF);
+	writeln(cmdunit, CRLF);
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_ldmp -- process ldump command
+   ============================================================================
+*/
+
+int
+cx_ldmp()
+{
+	int	nw, rc;
+
+	d_cur = p_from;
+	d_next = p_to + 4;
+	d_last = ((long)p_to - (long)p_from) + d_next;
+	nw = p_width;
+	rc = TRUE;
+
+	do {
+
+		writeln(cmdunit, CRLF);
+		padr(p_from, cmdunit);
+		dflag = FALSE;
+
+		if (ldump(p_from, p_to, nw, cmdunit))
+			rc = FALSE;
+
+		p_from = p_from + (p_width << 2);
+
+		if (dflag)
+			rc = FALSE;
+
+	} while (rc);
+
+	p_from = d_cur;
+
+	writeln(cmdunit, CRLF);
+	writeln(cmdunit, CRLF);
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	do_cmd -- process a command line
+   ============================================================================
+*/
+
+do_cmd()
+{
+	int	rc, i;
+
+	/* prompt for a command line */
+
+#if	TINYMSG
+	writeln(cmdunit, "R: ");
+#else
+	writeln(cmdunit, "ROMP: ");
+#endif
+
+	/*  get a command line */
+
+	rc = getln(cmdunit, MAXCMDLN, cmdline);
+
+/* 
+
+*/
+
+	/* dispatch based on rc */
+
+	switch (rc) {
+
+	case A_CR:
+
+		writeln(cmdunit, CRLF);
+
+		if (getcmd()) {
+
+			for (i = 0; i < NCMDS; i++) {
+
+				if (0 EQ strcmp(argstr, cmtab[i].cname)) {
+
+					ilast = i;
+
+					if ((*cmtab[i].cp)()) {
+
+						if (FALSE EQ (*cmtab[i].cx)())
+							writeln(cmdunit, EMSG1);
+
+					} else {
+
+						writeln(cmdunit, EMSG2);
+					}
+
+					return;
+				}
+			}
+
+			writeln(cmdunit, EMSG3);
+			return;
+
+		} else {
+
+/* 
+
+*/
+
+			if (redo) {
+
+				if (FALSE EQ (*cmtab[ilast].cx)())
+					writeln(cmdunit, EMSG1);
+
+			} else {
+
+				writeln(cmdunit, EMSG5);
+			}
+
+			return;
+		}
+
+	case CTL('X'):
+
+		writeln(cmdunit, CANNED);
+		return;
+
+	default:
+
+		writeln(cmdunit, EMSG6);
+		return;
+	}
+
+	writeln(cmdunit, EMSG7);
+	return;
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_next -- process the next command
+   ============================================================================
+*/
+
+int
+cx_next()
+{
+	p_to = d_last;	
+	p_from = d_next;
+	return((*cmtab[inext].cx)());
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_read() -- process the read command
+   ============================================================================
+*/
+
+int
+cx_read()
+{
+	long	rc;
+	int	ns, recno;
+
+	ns = p_len & 0x7FFFL;
+	recno = (long)p_from & 0xFFFFL;
+
+	rc = BIOS(B_RDWR, 2, p_to, ns, recno, 0);
+
+	if (rc & 0xFFFFL) {
+
+		writeln(cmdunit, "\r\nERROR reading disk:  ");
+		puthn(rc, 8, cmdunit);
+		writeln(cmdunit, "\r\n\n");
+		return(FALSE);
+
+	} else {
+
+		return(TRUE);
+	}
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_writ() -- process the write command
+   ============================================================================
+*/
+
+int
+cx_writ()
+{
+	long	rc;
+	int	ns, recno;
+
+	ns = p_len & 0x7FFFL;
+	recno = (long)p_from & 0xFFFFL;
+
+	rc = BIOS(B_RDWR, 3, p_to, ns, recno, 0);
+
+	if (rc & 0xFFFFL) {
+
+		writeln(cmdunit, "\r\nERROR writing disk:  ");
+		puthn(rc, 8, cmdunit);
+		writeln(cmdunit, "\r\n\n");
+		return(FALSE);
+
+	} else {
+
+		return(TRUE);
+	}
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	showrs() -- show registers
+   ============================================================================
+*/
+
+showrs(rp)
+struct regs *rp;
+{
+	int	i;
+	UWORD16	srtemp;
+
+	writeln(cmdunit, "       ");
+
+	for (i = 0; i < 8; i++) {
+
+		BIOS(B_PUTC, cmdunit, ' ');
+		BIOS(B_PUTC, cmdunit, '0'+i);
+		writeln(cmdunit, "_______");
+	}
+
+	writeln(cmdunit, "\r\nd0..d7 ");
+
+	for (i = 0; i < 8; i++) {
+
+		BIOS(B_PUTC, cmdunit, ' ');
+		puthn(rp->d_reg[i], 8, cmdunit);
+	}
+
+	writeln(cmdunit, "\r\na0..a7 ");
+
+	for (i = 0; i < 8; i++) {
+
+		BIOS(B_PUTC, cmdunit, ' ');
+		puthn(rp->a_reg[i], 8, cmdunit);
+	}
+
+	writeln(cmdunit, "\r\nPC =  ");
+	puthn((long)rp->reg_pc, 8, cmdunit);
+
+	srtemp = rp->reg_sr;
+	writeln(cmdunit, ",    SR = ");
+	puthn( (long)srtemp & 0xFFFFL, 4, cmdunit);
+
+/* 
+
+*/
+
+	writeln(cmdunit, "  (IPL = ");
+	puthn( (long)(srtemp >> 8) & 0x7L, 1, cmdunit);
+	writeln(cmdunit, ", ");
+
+	if (srtemp & 0x8000)
+		BIOS(B_PUTC, cmdunit, 'T');
+	else
+		BIOS(B_PUTC, cmdunit, '-');
+
+	if (srtemp & 0x2000)
+		BIOS(B_PUTC, cmdunit, 'S');
+	else
+		BIOS(B_PUTC, cmdunit, '-');
+
+	BIOS(B_PUTC, cmdunit, ' ');
+
+	if (srtemp & 0x10)
+		BIOS(B_PUTC, cmdunit, 'X');
+	else
+		BIOS(B_PUTC, cmdunit, '-');
+
+	if (srtemp & 0x8)
+		BIOS(B_PUTC, cmdunit, 'N');
+	else
+		BIOS(B_PUTC, cmdunit, '-');
+
+	if (srtemp & 0x4)
+		BIOS(B_PUTC, cmdunit, 'Z');
+	else
+		BIOS(B_PUTC, cmdunit, '-');
+
+	if (srtemp & 0x2)
+		BIOS(B_PUTC, cmdunit, 'V');
+	else
+		BIOS(B_PUTC, cmdunit, '-');
+
+	if (srtemp & 0x1)
+		BIOS(B_PUTC, cmdunit, 'C');
+	else
+		BIOS(B_PUTC, cmdunit, '-');
+
+	writeln(cmdunit, " )\r\n");
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	showcr() -- show crash registers
+   ============================================================================
+*/
+
+showcr()
+{
+	register int	i;
+	register char	*cause;
+	register UWORD16	srtemp;
+
+	writeln(cmdunit, "BIOS Crash Area Dump\r\n");
+	writeln(cmdunit, "       ");
+
+	for (i = 0; i < 8; i++) {
+
+		BIOS(B_PUTC, cmdunit, ' ');
+		BIOS(B_PUTC, cmdunit, '0'+i);
+		writeln(cmdunit, "_______");
+	}
+
+	writeln(cmdunit, "\r\nd0..d7 ");
+
+	for (i = 0; i < 8; i++) {
+
+		BIOS(B_PUTC, cmdunit, ' ');
+		puthn(crshrg[i], 8, cmdunit);
+	}
+
+	writeln(cmdunit, "\r\na0..a7 ");
+
+	for (i = 8; i < 16; i++) {
+
+		BIOS(B_PUTC, cmdunit, ' ');
+		puthn(crshrg[i], 8, cmdunit);
+	}
+
+	writeln(cmdunit, "\r\n\nPC =  ");
+	puthn((long)crshpc, 8, cmdunit);
+
+	srtemp = crshsr;
+	writeln(cmdunit, ",    SR = ");
+	puthn((long)srtemp & 0xFFFFL, 4, cmdunit);
+
+/* 
+
+*/
+
+	writeln(cmdunit, "  (IPL = ");
+	puthn((long)(srtemp >> 8) & 0x7L, 1, cmdunit);
+	writeln(cmdunit, ", ");
+
+	if (srtemp & 0x8000)
+		BIOS(B_PUTC, cmdunit, 'T');
+	else
+		BIOS(B_PUTC, cmdunit, '-');
+
+	if (srtemp & 0x2000)
+		BIOS(B_PUTC, cmdunit, 'S');
+	else
+		BIOS(B_PUTC, cmdunit, '-');
+
+	BIOS(B_PUTC, cmdunit, ' ');
+
+	if (srtemp & 0x10)
+		BIOS(B_PUTC, cmdunit, 'X');
+	else
+		BIOS(B_PUTC, cmdunit, '-');
+
+	if (srtemp & 0x8)
+		BIOS(B_PUTC, cmdunit, 'N');
+	else
+		BIOS(B_PUTC, cmdunit, '-');
+
+	if (srtemp & 0x4)
+		BIOS(B_PUTC, cmdunit, 'Z');
+	else
+		BIOS(B_PUTC, cmdunit, '-');
+
+	if (srtemp & 0x2)
+		BIOS(B_PUTC, cmdunit, 'V');
+	else
+		BIOS(B_PUTC, cmdunit, '-');
+
+	if (srtemp & 0x1)
+		BIOS(B_PUTC, cmdunit, 'C');
+	else
+		BIOS(B_PUTC, cmdunit, '-');
+
+	writeln(cmdunit, " )\r\n");
+
+/* 
+
+*/
+	writeln(cmdunit, "TRAP vector number = ");
+	putn((long)crshvc[0], 2, cmdunit);
+
+	cause = "  (no handler for interrupt)";
+
+	switch (crshvc[0] & 0xFF) {
+
+	case 2:		/* 2:  bus error */
+
+		cause = "  (Bus error)";
+		break;
+
+	case 3:		/* 3:  address error */
+
+		cause = "  (Address error)";
+		break;
+
+	case 4:		/* 4:  illegal instruction */
+
+		cause = "  (Illegal instruction)";
+		break;
+
+	case 5:		/* 5:  zero divide */
+
+		cause = "  (Zero divide)";
+		break;
+
+	case 6:		/* 6:  CHK instruction */
+
+		cause = "  (CHK instruction)";
+		break;
+
+	case 7:		/* 7:  TRAPV instruction */
+
+		cause = "  (TRAPV instruction)";
+		break;
+
+	case 8:		/* 8:  privilege violation */
+
+		cause = "  (Privilege violation)";
+		break;
+
+	case 9:		/* 9:  trace */
+
+		cause = "  (Trace -- not implemented)";
+		break;
+
+	case 10:	/* 10:  line 1010 emulator */
+
+		cause = "  (Line 1010 Emulator -- not implemented)";
+		break;
+
+	case 11:	/* 11:  line 1111 emulator */
+
+		cause = "  (Line 1111 Emulator -- not implemented";
+		break;
+
+	case 15:	/* 15:  uninitialized interrupt vector */
+
+		cause = "  (Uninitialized interrupt)";
+		break;
+
+	case 24:	/* 24:  spurious interrupt */
+
+		cause = "  (Spurious interrupt)";
+		break;
+
+	case 25:	/* 25:  Autovector Level 1*/
+
+		cause = "  (Level 1 Interrupt -- unimplmented)";
+		break;
+
+	case 26:	/* 26:  Autovector Level 2 */
+
+		cause = "  (Level 2 Interrupt -- unimplmented)";
+		break;
+
+	case 27:	/* 27:  Autovector Level 3 */
+
+		cause = "  (Level 3 Interrupt -- unimplmented)";
+		break;
+
+	case 28:	/* 28:  Autovector Level 4 */
+
+		cause = "  (Level 4 Interrupt -- unimplmented)";
+		break;
+
+	case 29:	/* 29:  Autovector Level 5 */
+
+		cause = "  (Level 5 Interrupt -- unimplmented)";
+		break;
+
+	case 30:	/* 30:  Autovector Level 6 */
+
+		cause = "  (Level 6 Interrupt -- unimplmented)";
+		break;
+
+	case 31:	/* 31:  Autovector Level 7 */
+
+		cause = "  (Level 7 Interrupt -- unimplmented)";
+		break;
+
+	}
+
+	writeln(cmdunit, cause);
+	writeln(cmdunit, "\r\n");
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_crsh -- process the crash command
+   ============================================================================
+*/
+
+int
+cx_crsh()
+{
+	if (!wzcrsh)
+		printf("** Crash switch NOT set **\r\n");
+
+	redo = FALSE;
+	showcr();
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	bphit -- clear breakpoints, see if any were hit
+   ============================================================================
+*/
+
+int
+bphit()
+{
+	int	rc;
+
+	rc = FALSE;
+
+	if ((char *)p_ba0 EQ regptr->reg_pc) {
+
+		if (*p_ba0 EQ BPINST) {
+
+			*p_ba0 = p_bv0;
+			p_ba0 = 0L;
+			p_bv0 = BPINST;
+			rc = TRUE;
+
+		} else {
+
+			writeln(cmdunit, "** Breakpoint word at ");
+			puthn(p_ba0, 8 , cmdunit);
+			writeln(cmdunit, " was ");
+			puthn(0xFFFFL & (long)(*p_ba0), 4, cmdunit);
+			writeln(cmdunit, " instead of ");
+			puthn((long)BPINST, 4, cmdunit);
+			writeln(cmdunit, " **\r\n\n");
+			rc = TRUE;
+		}
+	}
+
+/* 
+
+*/
+
+	if ((char *)p_ba1 EQ regptr->reg_pc) {
+
+		if (*p_ba1 EQ BPINST) {
+
+			*p_ba1 = p_bv1;
+			p_ba1 = 0L;
+			p_bv1 = BPINST;
+			rc = TRUE;
+
+		} else {
+
+			writeln(cmdunit, "** Breakpoint word at ");
+			puthn((long)p_ba0, 8 , cmdunit);
+			writeln(cmdunit, " was ");
+			puthn(0xFFFFL & (long)(*p_ba1), 4, cmdunit);
+			writeln(cmdunit, " instead of ");
+			puthn((long)BPINST, 4, cmdunit);
+			writeln(cmdunit, " **\r\n\n");
+			rc = TRUE;
+		}
+	}
+/* 
+
+*/
+	if (p_ba0) {
+
+		if (*p_ba0 EQ BPINST) {
+
+			*p_ba0 = p_bv0;
+			p_ba0 = 0L;
+			p_bv0 = BPINST;
+			rc = TRUE;
+
+		} else {
+
+			writeln(cmdunit, "** Breakpoint word at ");
+			puthn(p_ba0, 8 , cmdunit);
+			writeln(cmdunit, " was ");
+			puthn(0xFFFFL & (long)(*p_ba0), 4, cmdunit);
+			writeln(cmdunit, " instead of ");
+			puthn((long)BPINST, 4, cmdunit);
+			writeln(cmdunit, " **\r\n\n");
+			rc = TRUE;
+		}
+	}
+
+/* 
+
+*/
+
+	if (p_ba1) {
+
+		if (*p_ba1 EQ BPINST) {
+
+			*p_ba1 = p_bv1;
+			p_ba1 = 0L;
+			p_bv1 = BPINST;
+			rc = TRUE;
+
+		} else {
+
+			writeln(cmdunit, "** Breakpoint word at ");
+			puthn((long)p_ba0, 8 , cmdunit);
+			writeln(cmdunit, " was ");
+			puthn(0xFFFFL & (long)(*p_ba1), 4, cmdunit);
+			writeln(cmdunit, " instead of ");
+			puthn((long)BPINST, 4, cmdunit);
+			writeln(cmdunit, " **\r\n\n");
+			rc = TRUE;
+		}
+	}
+
+	if (rc)
+		return(rc);
+
+	writeln(cmdunit, "\r\n** Program invoked ROMP trap **\r\n");
+	return(FALSE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	cx_regs() -- process the regs command
+   ============================================================================
+*/
+
+int
+cx_regs()
+{
+	showrs(regptr);
+	return(TRUE);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	rompbp() -- process a breakpoint for ROMP
+   ============================================================================
+*/
+
+rompbp(d0,d1,d2,d3,d4,d5,d6,d7, a0,a1,a2,a3,a4,a5,a6,a7, sr0,sr, pc)
+long	d0,d1,d2,d3,d4,d5,d6,d7;
+char	*a0,*a1,*a2,*a3,*a4,*a5,*a6,*a7, *pc;
+UWORD16	sr0,sr;
+{
+	register int i;
+
+	regptr = (struct regs *)&d0;	/* make registers accessable */
+	pc -= 2L;			/* adjust pc */
+
+	if (-1 EQ setipl(iplev))		/* enable interrupts */
+		writeln(cmdunit, "\r\n\n***** setipl() failed *****\r\n\n");
+
+	if (first1) {			/* initial entry from xtrap15() */
+
+		for (i = 0; i < 8; i++)		/* clear d0..d7 */
+			regptr->d_reg[i] = 0L;
+
+		for (i = 0; i < 7; i++)		/* clear a0..a6 */
+			regptr->a_reg[i] = (char *)0L;
+
+		regptr->a_reg[7] = ISTACK;	/* setup initial stack */
+
+		sr = INITSR;		/* setup sr */
+		pc += 2L;		/* adjust pc past TRAP 15 */
+
+	} else {			/* breakpoint */
+
+		writeln(cmdunit, "\r\n\n** ROMP Breakpoint TRAP **\r\n");
+
+		showrs(regptr);		/* show registers */
+
+		if (bphit() EQ FALSE)	/* fixup breakpoints */
+			pc += 2L;	/* and maybe the pc */
+
+	}
+
+	first1 = FALSE;			/* not first time any more */
+	exflag = FALSE;			/* clear exit flag */
+
+	do {
+
+		do_cmd();		/* process commands ... */
+
+	} while (!exflag);		/* ... until exit flag is set */
+
+	return;				/* return to xtrap15 */
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	progid() -- identify the program
+   ============================================================================
+*/
+
+progid()
+{
+	register char *pcptr;
+
+#if	TINYMSG
+
+#if	ON_B700
+	writeln(cmdunit, "\r\n\nB\r\n");
+#else
+	writeln(cmdunit, "\r\n\nN\r\n");
+#endif
+
+#else
+
+#if	ON_B700
+	writeln(cmdunit, "\r\n\nBuchla 700 BIOS / Debug PROM\r\n");
+#else
+	writeln(cmdunit, "\r\n\nNASA 3D Helmet Display BIOS / Debug PROM\r\n");
+#endif
+
+	writeln(cmdunit, "  ROMP Version ");
+	writeln(cmdunit, ROMPVER);
+
+	writeln(cmdunit, "\r\n  BIOS Version ");
+	pcptr = (char *)PRM_VERS;
+	putn((long)*pcptr++, 2, cmdunit);
+	BIOS(B_PUTC, cmdunit, '.');
+	putn((long)*pcptr++, 2, cmdunit);
+	writeln(cmdunit, promdate);
+
+#endif
+}
+
+/* 
+
+*/
+
+#if	ON_B700
+
+
+/*
+   ============================================================================
+	pclr() -- clear the panel FIFO
+   ============================================================================
+*/
+
+short
+pclr()
+{
+	register short i;
+
+	ftimer = FIFOLIM;
+
+	while (-1L NE (afi = XBIOS(X_ANALOG))) {	/* check panel inputs */
+
+		asig  = 0x007F & (afi >> 8);	/* signal number */
+
+		if (0 EQ asig) {
+
+			/* all keys up */
+
+			for (i = 0; i < 128; i++) {
+
+				sigtab[i][0] = 0;
+				sigtab[i][1] = 0;
+			}
+
+			break;
+		}
+
+		if (ftimer-- < 0)
+			return(FAILURE);
+	}
+
+	return(SUCCESS);
+}
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	pscan() -- scan the panel and maybe even load a program from diskette
+   ============================================================================
+*/
+
+short
+pscan()
+{
+	register short i, c;
+
+	if (0 EQ ledcntr--) {
+
+		if ((baseled + 3) > 23)			/* turn on a LED */
+			io_leds = baseled - 21;
+		else
+			io_leds = baseled + 3;
+
+		io_leds = 0x80 + baseled;		/* turn off a LED */
+
+		if (++baseled > 23)			/* update LED number */
+			baseled = 0;
+
+		ledcntr = 200;
+	}
+
+	aflag = FALSE;
+
+	if (-1L NE (afi = XBIOS(X_ANALOG))) {	/* check panel inputs */
+
+		asig  = 0x007F & (afi >> 8);	/* signal number */
+		astat = 0x0001 & (afi >> 7);	/* status */
+		aval  = 0x007F & afi;		/* value */
+
+		if (asig) {	/* active signal */
+
+			aflag = TRUE;
+
+			sigtab[asig][0] = aval;
+			sigtab[asig][1] = astat;
+
+		} else {	/* all keys up */
+
+			aflag = FALSE;
+
+			for (i = 0; i < 128; i++)
+				sigtab[i][1] = 0;
+		}
+	}
+/* 
+
+*/
+	if (aflag) {	/* anything changed ? */
+
+		if (astat AND (asig EQ BOOTKEY)) {		/* BOOT key */
+
+			for (i = 0; i < 24; i++)	/* turn off LEDs */
+				io_leds = 0x80 + i;
+
+			io_leds = 0x1F;			/* turn off LCD lamp */
+
+			/* load and run BOOTFILE */
+
+			B_log_s = FALSE;
+			B_dbg_s = FALSE;
+
+			hdvini();
+			_bpbin = FALSE;
+
+			if (booter(BOOTFILE, 0L))
+				return(FALSE);
+			else
+				sjumpto(B_buf_a, ISTACK);
+
+		} else if (astat AND (asig EQ ROMPKEY)) {	/* ROMP key */
+
+			for (i = 0; i < 24; i++)	/* turn off LEDs */
+				io_leds = 0x80 + i;
+
+			return(TRUE);
+		}
+	}
+
+/* 
+
+*/
+
+	if (BIOS(B_RDAV, CON_DEV)) {
+
+		c = 0x007F & BIOS(B_GETC, CON_DEV);
+
+		if ((c EQ 'r') OR (c EQ 'R'))
+			return(TRUE);
+	}
+
+	return(FALSE);
+}
+#endif
+
+/* 
+
+*/
+
+/*
+   ============================================================================
+	romp main routine
+   ============================================================================
+*/
+
+main()
+{
+	register short i;
+	register char *pdptr, *pcptr;
+
+	/* unpack PROM date */
+
+	pcptr = (char *)PRM_DATE;	/* prom date: yyyymmdd */
+	pdptr = promdate;		/*  -- yyyy-mm-dd */
+	*pdptr++ = ' ';
+	*pdptr++ = '-';
+	*pdptr++ = '-';
+	*pdptr++ = ' ';
+	*pdptr++ = ((*pcptr >> 4) & 0x0F) + '0';
+	*pdptr++ = (*pcptr++ & 0x0F) + '0';
+	*pdptr++ = ((*pcptr >> 4) & 0x0F) + '0';
+	*pdptr++ = (*pcptr++ & 0x0F) + '0';
+	*pdptr++ = '-';
+	*pdptr++ = ((*pcptr >> 4) & 0x0F) + '0';
+	*pdptr++ = (*pcptr++ & 0x0F) + '0';
+	*pdptr++ = '-';
+	*pdptr++ = ((*pcptr >> 4) & 0x0F) + '0';
+	*pdptr++ = (*pcptr++ & 0x0F) + '0';
+	*pdptr++ = '\0';
+
+	/* initialize variables */
+
+	sprintf(hs_mtst, "[[start=$%lX],[end=$%lx]]  (or $8..$%lX)",
+		USER_RAM, RAM_TOP, (USER_RAM - 2L));
+
+	cmdunit = CON_DEV;
+
+	ilast = 0;
+	inext = 0;
+	iplev = DEFIPL;
+
+	dflag  = FALSE;
+	exflag = FALSE;
+	redo   = FALSE;
+	goflag = FALSE;
+	b0flag = FALSE;
+	b1flag = FALSE;
+
+	p_goto  = (char *)ROMADDR;
+	p_len   = 0L;
+	p_width = 16L;
+	p_value = 0L;
+
+	p_ba0 = 0L;
+	p_bv0 = BPINST;
+
+	p_ba1 = 0L;
+	p_bv1 = BPINST;
+
+	tba0 = 0L;
+	tba1 = 0L;
+
+	inext = 0;
+
+	tsetup();			/* patch the timer interrupt code */
+
+#if	ON_B700
+	baseled = 21;				/* setup LED scan */
+	ledcntr = 0;				/* ... */
+	io_leds = 0x9F;				/* turn on LCD lamp */
+	GLCinit();				/* reset LCD display */
+
+	GLCtext(0,  1, "Load  GoTo");
+	GLCtext(1,  1, "Disk  ROMP");
+
+	GLCtext(3, 15, "Buchla 700 -- BIOS/ROMP Firmware by D.N. Lynx Crowe");
+
+	sprintf(idbuf, "BIOS Version %02d.%02d%s",
+		*(char *)PRM_VERS, *(char *)(PRM_VERS+1), promdate);
+	GLCtext(5, 30, idbuf);
+
+	sprintf(idbuf, "ROMP Version %s", ROMPVER);
+	GLCtext(6, 30, idbuf);
+	GLCcrc(0, 0);
+
+	(char *)BIOS(B_SETV, 47, trap15);	/* set ROMP trap vec */
+
+	for (i = 0; i < 128; i++) {
+
+		sigtab[i][0] = 0;
+		sigtab[i][1] = 0;
+	}
+
+	XBIOS(X_CLRAFI);			/* clear the panel FIFO */
+	setipl(KB_EI);				/* enable interrupts */
+	pclr();					/* empty the panel FIFO */
+	XBIOS(X_CLRAFI);			/* clear the panel FIFO */
+
+	while (FALSE EQ pscan()) ;		/* do the panel scan */
+#endif
+
+/* 
+
+*/
+	if (setjmp(&restart))	/* setup restart point */
+		writeln(cmdunit, "\r\n***** ROMP Re-starting *****\r\n\n");
+
+	tsetup();	/* patch the timer interrupt code */
+	progid();	/* identify the program */
+
+	(char *)BIOS(B_SETV, 47, trap15);	/* set ROMP trap vec */
+	writeln(cmdunit, "\r\n\n");
+
+	/* process commands */
+
+	first1 = TRUE;			/* set break init flag */
+
+	while (TRUE) {
+
+		xtrap15();		/* trap into ROMP bp processor */
+		writeln(cmdunit, "\r\n** xtrap15() returned to ROMP **\r\n\n");
+	}
+}
Index: rom/timeint.s
===================================================================
--- rom/timeint.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ rom/timeint.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,328 @@
+* ------------------------------------------------------------------------------
+* timeint.s -- timer interrupt handler
+* Version 9 -- 1988-06-20 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+*
+* This code replaces the interrupt handler in bios.s, which is known to
+* have a bug in it, and adds support for the VSDD and an array of programable
+* timers with 1 Ms resolution.
+*
+* WARNING:  There are equates to addresses in the bios EPROM which may change
+* when the bios is reassembled.  If the bios is reassembled be sure to update
+* the equates flagged by "<<<=====".
+*
+* The addresses currently in the equates are for EPROMs dated 1988-04-18 or
+* 1988-06-20 ONLY.
+*
+* ------------------------------------------------------------------------------
+* Hardware timer usage:
+* ---------------------
+*	Timer 1		PLL divider for score clock -- fixed at 64
+*	Timer 2		PLL divider for score clock -- nominally 3200
+*	Timer 3		1 Ms Real Time Clock
+*
+* ------------------------------------------------------------------------------
+*
+		.text
+*
+		.xdef	_tsetup		* tsetup() -- timer setup function
+		.xdef	timeint		* timer interrupt handler
+*
+		.xdef	_timers		* timer array -- short timers[NTIMERS]
+		.xdef	_vi_clk		* VSDD scroll delay timer
+		.xdef	_vi_tag		* VSDD VI tag
+		.xdef	line		* Line we entered on
+*
+		.xref	lclsadr		* score object base address
+		.xref	lclscrl		* score object scroll offset
+		.xref	_v_odtab	* VSDD object descriptor table
+		.xref	_v_regs		* VSDD registers
+*
+		.page
+* ==============================================================================
+*
+* Equates to variables in bios.s:
+* -------------------------------
+* These variables are permanently assigned.
+*
+TIMEVEC		.equ	$00000400	* LONG - System timer trap vector
+*
+FC_SW		.equ	$00000420	* WORD - Frame clock switch
+FC_VAL		.equ	$00000422	* LONG - Frame clock value
+*
+HZ_1K		.equ	$0000049A	* LONG - 1000 Hz clock
+HZ_200		.equ	$0000049E	* LONG - 200 Hz clock
+FRCLOCK		.equ	$000004A2	* LONG - 50 Hz clock
+*
+T3COUNT		.equ	$000004AA	* WORD - Timer 3 count
+*
+* ------------------------------------------------------------------------------
+*
+* WARNING:  The address of "FLOCK" depends on the version of the bios EPROM.
+* The address below is for EPROMs dated 1988-04-18 ONLY.
+*
+FLOCK		.equ	$00000E0C	* WORD - Floppy semaphore	<<<=====
+*
+* ==============================================================================
+*
+* Equates to routines in bios.s:
+* ------------------------------
+*
+* WARNING:  The address of "FLOPVBL" depends on the version of the bios EPROM.
+* The address below is for EPROMs dated 1988-04-18 ONLY.
+*
+FLOPVBL		.equ	$001015EE	* floppy VI handler address	<<<=====
+*
+* ==============================================================================
+*
+		.page
+*
+* Hardware address equates:
+* -------------------------
+TI_VEC		.equ	$00000070	* Timer interrupt autovector
+*
+TIMER		.equ	$003A0001	* Timer base address
+*
+* ------------------------------------------------------------------------------
+*
+* Timer register equates:
+* -----------------------
+TIME_CRX	.equ	TIMER		* Control register 1 or 3
+TIME_CR2	.equ	TIMER+2		* Control register 2
+TIME_T1H	.equ	TIMER+4		* Timer 1 high byte
+TIME_T1L	.equ	TIMER+6		* Timer 1 low byte
+TIME_T2H	.equ	TIMER+8		* Timer 2 high byte
+TIME_T2L	.equ	TIMER+10	* Timer 2 low byte
+TIME_T3H	.equ	TIMER+12	* Timer 3 high byte
+TIME_T3L	.equ	TIMER+14	* Timer 3 low byte
+*
+* VSDD register offsets:
+* ----------------------
+VSDD_R5		.equ	10		* VSDD bank control register
+VSDD_R11	.equ	22		* VSDD access table register
+*
+* ==============================================================================
+*
+* Miscellaneous equates:
+* ----------------------
+IPL7		.equ	$0700		* IPL mask for interrupt disable
+*
+FCMAX		.equ	$00FFFFFF	* Maximum frame counter value
+FCMIN		.equ	$00000000	* Minimum frame counter value
+*
+NTIMERS		.equ	8		* Number of timers in the timer array
+*
+* ==============================================================================
+*
+		.page
+* ==============================================================================
+* _tsetup -- tsetup() -- timer setup function
+* ==============================================================================
+*
+_tsetup:	move.w	sr,-(a7)		* Save old interrupt mask
+		ori.w	#IPL7,sr		* Disable interrupts
+*
+		clr.w	FC_SW			* Stop the frame clock
+		clr.l	FC_VAL			* ... and reset it
+		clr.w	_vi_tag			* Clear VSDD VI tag
+		clr.w	_vi_clk			* Clear VSDD delay timer
+		clr.w	lclsadr			* Clear score scroll address
+		clr.w	lclscrl			* Clear score scroll offset
+*
+		lea	_timers,a0		* Point at timer array
+		move.w	#NTIMERS-1,d0		* Setup to clear timer array
+*
+tclr:		clr.w	(a0)+			* Clear a timer array entry
+		dbra	d0,tclr			* Loop until done
+*
+		move.l	#nullrts,TIMEVEC	* Set timer interrupt vector
+		move.l	#timeint,TI_VEC		* Set timer trap vector
+*
+		move.b	#$00,TIME_T1H		* Setup timer 1  (PLL)
+		move.b	#$1F,TIME_T1L		* ... for divide by 64
+		move.b	#$0C,TIME_T2H		* Setup timer 2  (FC)
+		move.b	#$7F,TIME_T2L		* ... for divide by 3200
+		move.b	#$03,TIME_T3H		* Setup timer 3  (RTC)
+		move.b	#$20,TIME_T3L		* ... for 1Ms interval
+		move.b	#$42,TIME_CRX		* Setup CR3
+		move.b	#$41,TIME_CR2		* Setup CR2
+		move.b	#$81,TIME_CRX		* Setup CR1
+		move.b	#$80,TIME_CRX		* Start the timers
+*
+		move.w	(a7)+,sr		* Restore interrupts
+*
+nullrts:	rts				* Return to caller
+*
+		.page
+* ==============================================================================
+* timeint -- timer interrupt handler
+* ==============================================================================
+*
+timeint:	movem.l	d0-d7/a0-a6,-(a7)	* Save registers
+		move.b	TIME_CR2,d0		* Get timer interrupt status
+* ------------------------------------------------------------------------------
+* process 1 MS timer
+* ------------------------------------------------------------------------------
+		btst.l	#2,d0			* Check timer 3 status
+		beq	tmi02			* Jump if not active
+*
+		move.b	TIME_T3H,d1		* Read timer 3 count
+		lsl.w	#8,d1			* ...
+		move.b	TIME_T3L,d1		* ...
+		move.w	d1,T3COUNT		* ... and save it
+*
+		addq.l	#1,HZ_1K		* Update 1ms clock  (1 KHz)
+*
+		move.l	d0,-(a7)		* Preserve D0
+* ------------------------------------------------------------------------------
+* process VSDD timer
+* ------------------------------------------------------------------------------
+		tst.w	_vi_tag			* Does the VSDD need service ?
+		beq	updtime			* Jump if not
+*
+		move.w	_vi_clk,d0		* Get VSDD scroll delay timer
+		subq.w	#1,d0			* Decrement timer
+		move.w	d0,_vi_clk		* Update timer
+		bne	updtime			* Jump if it's not zero yet
+*
+		move.w	lclsadr,_v_odtab+12	* Update scroll address
+		move.w	lclscrl,_v_odtab+10	* Update scroll offset
+		clr.w	_vi_tag			* Reset the tag
+*
+		.page
+*
+* ------------------------------------------------------------------------------
+* process programable timers
+* ------------------------------------------------------------------------------
+*
+updtime:	move.w	#NTIMERS-1,d0		* Setup timer array counter
+		lea	_timers,a0		* Point at timer array
+*
+tdcr:		move.w	(a0),d1			* Get timer array entry
+		beq	tdcr1			* Jump if already 0
+*
+		subq.w	#1,d1			* Decrement timer
+*
+tdcr1:		move.w	d1,(a0)+		* Store updated timer value
+		dbra	d0,tdcr			* Loop until done
+*
+* ------------------------------------------------------------------------------
+* process timer hook vector
+* ------------------------------------------------------------------------------
+		movea.l	TIMEVEC,a0		* Get RTC vector
+		move.w	#1,-(a7)		* Pass 1 msec on stack
+		jsr	(a0)			* Process RTC vector
+		addq.l	#2,a7			* Clean up stack
+*
+		move.l	(a7)+,d0		* Restore D0
+*
+		.page
+* ------------------------------------------------------------------------------
+* process 5 Ms clock
+* ------------------------------------------------------------------------------
+		move.w	tdiv1,d1		* Update divider
+		addq.w	#1,d1			* ...
+		move.w	d1,tdiv1		* ...
+*
+		cmpi.w	#5,d1			* Do we need to update HZ_200 ?
+		blt	tmi02			* Jump if not
+*
+		addq.l	#1,HZ_200		* Update 5ms clock   (200 Hz)
+* ------------------------------------------------------------------------------
+* process 20 Ms floppy clock
+* ------------------------------------------------------------------------------
+		move.w	tdiv2,d1		* Update divider
+		addq.w	#1,d1			* ...
+		move.w	d1,tdiv2		* ...
+*
+		cmpi.w	#4,d1			* Do we need to update FRCLOCK ?
+		blt	tmi01			* Jump if not
+*
+		addq.l	#1,FRCLOCK		* Update 20 Ms clock  (50 Hz)
+		tst.w	FLOCK			* See if floppy is active
+		bne	tmi00			* Don't call FLOPVBL if so
+*
+		jsr	FLOPVBL			* Check on the floppy
+*
+tmi00:		move.w	#0,tdiv2		* Reset tdiv2
+*
+tmi01:		move.w	#0,tdiv1		* Reset tdiv1
+*
+		.page
+* ------------------------------------------------------------------------------
+* process PLL timers
+* ------------------------------------------------------------------------------
+*
+tmi02:		btst.l	#0,d0			* Check timer 1 int
+		beq	tmi03			* Jump if not set
+*
+		move.b	TIME_T1H,d1		* Read timer 1 to clear int.
+		move.b	TIME_T1L,d1		* ...
+*
+tmi03:		btst.l	#1,d0			* Check for timer 2 int.
+		beq	tmi04			* Jump if not set
+*
+		move.b	TIME_T2H,d1		* Read timer 2 to clear int.
+		move.b	TIME_T2L,d1		* ...
+*
+		.page
+* ------------------------------------------------------------------------------
+* update score frame counter
+* ------------------------------------------------------------------------------
+		tst.w	FC_SW			* Should we update the frame ?
+		beq	tmi04			* Jump if not
+*
+		bmi	tmi05			* Jump if we count down
+*
+		move.l	FC_VAL,d0		* Get the frame count
+		cmp.l	#FCMAX,d0		* See it we've topped out
+		bge	tmi06			* Jump if limit was hit
+*
+		addq.l	#1,d0			* Count up 1 frame
+		move.l	d0,FC_VAL		* Store updated frame count
+		bra	tmi04			* Done
+*
+tmi07:		move.l	#FCMIN,FC_VAL		* Force hard limit, just in case
+		bra	tmi04			* Done
+*
+tmi06:		move.l	#FCMAX,FC_VAL		* Force hard limit, just in case
+		bra	tmi04			* Done
+*
+tmi05:		move.l	FC_VAL,d0		* Get the frame count
+		ble	tmi07			* Done if already counted down
+*
+		subq.l	#1,d0			* Count down 1 frame
+		move.l	d0,FC_VAL		* Store udpated frame count
+		bra	tmi04			* Done
+*
+		nop				* Filler to force equal paths
+*
+tmi04:		movem.l	(a7)+,d0-d7/a0-a6	* Restore registers
+		rte				* Return to interrupted code
+*
+		.page
+* ==============================================================================
+		.bss
+* ==============================================================================
+*
+* A note on tdiv1 and tdiv2:
+* --------------------------
+*
+* tdiv1 and tdiv2 are actually defined in the bios,  but since they could move
+* we define them here and ignore the ones in the bios.
+*
+tdiv1:		ds.w	1		* Timer divider 1  (divides HZ_1K)
+tdiv2:		ds.w	1		* Timer divider 2  (divides HZ_200)
+*
+* ------------------------------------------------------------------------------
+*
+_timers:	ds.w	NTIMERS		* Timer array -- short timers[16];
+*
+_vi_clk:	ds.w	1		* VSDD scroll delay timer
+_vi_tag:	ds.w	1		* VSDD VI 'needs service' tag
+*
+bank:		ds.w	1		* VSDD bank we enterd with
+line:		ds.w	1		* Line we came in on (for analysis)
+* ==============================================================================
+*
+		.end
Index: setup
===================================================================
--- setup	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ setup	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,1 @@
+export PATH="/opt/hatari/bin:/opt/cross-m68k/bin:${PATH}"
Index: vlib/acctrl.s
===================================================================
--- vlib/acctrl.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/acctrl.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,127 @@
+* ------------------------------------------------------------------------------
+* acctrl.s -- VSDD access table control functions
+* Version 6 -- 1987-04-13 -- D.N. Lynx Crowe
+* (c) Copyright 1987 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+*
+*	objclr(obj)
+*	unsigned int obj;
+*
+*		Clear bits in access table for object 'obj'.
+*		Disables object 'obj'.
+*
+*	objoff(obj, line, num)
+*	unsigned int obj, line, num;
+*
+*		Disable object obj at line thru line+num.
+*
+*	objon(obj, line, num)
+*	unsigned int obj, line, num;
+*
+*		Enable object obj at line thru line+num.
+*
+*
+*	Assumes VSDD is looking at bank 0.
+*	Assumes a screen height of 350 lines.
+*	No error checks are done, so beware.
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_objclr,_objoff,_objon
+*
+		.xref	_v_actab
+*
+SCSIZE		.equ	350		* Screen height
+*
+OBJ		.equ	8		* Object number argument offset
+LINE		.equ	10		* Beginning line argument offset
+NUM		.equ	12		* Object height argument offset
+* ------------------------------------------------------------------------------
+		.page
+* ------------------------------------------------------------------------------
+*
+*	objclr(obj)
+*	unsigned int obj;
+*
+*		Disables object obj in access table by turning on
+*		its bit in all words of the access table.
+* ------------------------------------------------------------------------------
+_objclr:	link	a6,#0		* Link stack frames
+		move.w	OBJ(a6),d1	* Get object bit number in d1
+		lea	_v_actab,a0	* Get base of object table in a0
+		move.w	#SCSIZE-1,d2	* Put line count in d2
+*
+objclr1:	move.w	(a0),d0		* Get access table word
+		bset.l	d1,d0		* Set the bit
+		move.w	d0,(a0)+	* Update word in access table
+		dbf	d2,objclr1	* Loop until done
+*
+		unlk	a6		* Unlink stack frame
+		rts			* Return to caller
+*
+		.page
+* ------------------------------------------------------------------------------
+*	objoff(obj, line, num)
+*	unsigned int obj, line, num;
+*
+*		Turn on access table bits for object 'obj' at
+*		lines 'line' through 'line'+'num'.  Disables the object.
+*		Assumes object bits were set at those locations.
+* ------------------------------------------------------------------------------
+_objoff:	link	a6,#0		* Link stack frames
+		move.w	OBJ(a6),d1	* Get object bit number into d1
+		move.w	LINE(a6),d2	* Get top line number
+		add.w	d2,d2		* Convert to word offset
+		lea	_v_actab,a0	* Get base address of access table
+		move.w	0(a0,d2),d0	* Get top line access word
+		bset.l	d1,d0		* Set object bit
+		move.w	d0,0(a0,d2)	* Update word in access table
+		tst.w	NUM(a6)		* Number of lines = 0 ?
+		beq	objoff1		* Done if so
+*
+		move.w	NUM(a6),d2	* Get object depth
+		add.w	LINE(a6),d2	* Add to top line number
+		cmpi.w	#SCSIZE,d2	* Bottom line >= screen height ?
+		bge	objoff1		* Done if so
+*
+		add.w	d2,d2		* Convert to word offset
+		move.w	0(a0,d2),d0	* Get bottom line access word
+		bset.l	d1,d0		* Set object bit
+		move.w	d0,0(a0,d2)	* Update word in access table
+*
+objoff1:	unlk	a6		* Unlink stack frame
+		rts			* Return to caller
+*
+		.page
+* ------------------------------------------------------------------------------
+*	objon(obj, line, num)
+*	unsigned int obj, line, num;
+*
+*		Turn off access table bits for object 'obj'
+*		at 'line' thru 'line'+'num'.  Enables the object.
+* ------------------------------------------------------------------------------
+_objon:		link	a6,#0		* Link stack frames
+		move.w	OBJ(a6),d1	* Get object bit number into d1
+		move.w	LINE(a6),d2	* Get top line number
+		add.w	d2,d2		* Convert to word offset
+		lea	_v_actab,a0	* Get base address of access table
+		move.w	0(a0,d2),d0	* Get top line access word
+		bclr.l	d1,d0		* Clear object bit
+		move.w	d0,0(a0,d2)	* Update word in access table
+		tst.w	NUM(a6)		* Number of lines = 0 ?
+		beq	objon1		* Done if so
+*
+		move.w	NUM(a6),d2	* Get object depth
+		add.w	LINE(a6),d2	* Add top line number
+		cmpi.w	#SCSIZE,d2	* Bottom line >= screen height ?
+		bge	objon1		* Done if so
+*
+		add.w	d2,d2		* Convert to word offset
+		move.w	0(a0,d2),d0	* Get bottom line access word
+		bclr.l	d1,d0		* Clear object bit
+		move.w	d0,0(a0,d2)	* Update word in access table
+*
+objon1:		unlk	a6		* Unlink stack frame
+		rts			* Return to caller
+*
+		.end
Index: vlib/cg2.c
===================================================================
--- vlib/cg2.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/cg2.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,426 @@
+/* Character generator table -- 12V by 8H */
+
+int	cg_rows = 12;
+
+int	cgtable[12][256] = {
+
+	{	/* Scan line 0 */
+	 0x0000, 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 
+	 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x0088, 0x006E, 0x000E, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0x0000, 0x0000, 0x0000, 
+	 0x0020, 0x0004, 0x0000, 0x0000, 0x0004, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0004, 0x0040, 0x0000, 0x0002, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0080, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0078, 0x0000, 0x001E, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x003C, 
+	 0x0000, 0x0000, 0x001C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0002, 0x0040, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0006, 0x0000, 0x0030, 0x0010, 0x000C, 0x0000, 0x0000, 
+	 0x0050, 0x003A, 0x00A9, 0x008B, 0x0000, 0x0000, 0x00E2, 0x00EE, 
+	 0x00DC, 0x005D, 0x0049, 0x0097, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x00EE, 0x00AE, 0x00EE, 0x0000, 0x0040, 0x00EA, 0x00EE, 
+	 0x0000, 0x00E2, 0x00AE, 0x00E4, 0x0000, 0x0094, 0x00E0, 0x004E, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0004, 0x0004, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0024, 0x0000, 0x0024, 0x0000, 0x0024, 0x0000, 0x0024, 0x0024, 
+	 0x0000, 0x0000, 0x0024, 0x0024, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 1 */
+	 0x0000, 0x0000, 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 
+	 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x0088, 0x00AA, 0x0002, 
+	 0x0018, 0x007E, 0x007E, 0x003C, 0x0060, 0x003C, 0x003C, 0x000C, 
+	 0x003C, 0x001C, 0x0000, 0x0000, 0x0073, 0x0066, 0x00FB, 0x0000, 
+	 0x0000, 0x0010, 0x0000, 0x0000, 0x007C, 0x0040, 0x00BC, 0x0000, 
+	 0x0010, 0x0008, 0x0010, 0x0000, 0x0008, 0x0000, 0x0018, 0x0000, 
+	 0x0018, 0x007C, 0x007E, 0x003C, 0x0020, 0x003C, 0x003C, 0x0004, 
+	 0x003C, 0x001C, 0x0000, 0x0008, 0x0020, 0x0000, 0x0004, 0x0008, 
+	 0x0078, 0x0042, 0x003E, 0x003C, 0x003E, 0x007E, 0x0004, 0x003C, 
+	 0x0042, 0x007C, 0x001C, 0x0082, 0x007E, 0x0082, 0x0042, 0x003C, 
+	 0x0002, 0x005C, 0x0042, 0x003C, 0x0038, 0x003C, 0x0010, 0x0044, 
+	 0x00C6, 0x0038, 0x007E, 0x0008, 0x0000, 0x0010, 0x0000, 0x00FE, 
+	 0x0000, 0x00BC, 0x001A, 0x0038, 0x0058, 0x0038, 0x0008, 0x0042, 
+	 0x0042, 0x0038, 0x0022, 0x0042, 0x0038, 0x0092, 0x0042, 0x0018, 
+	 0x0002, 0x0040, 0x0002, 0x0038, 0x0030, 0x0058, 0x0010, 0x006C, 
+	 0x0082, 0x0008, 0x007C, 0x0008, 0x0010, 0x0010, 0x0000, 0x003C, 
+	 0x0050, 0x0022, 0x00A9, 0x008A, 0x0000, 0x0000, 0x00A2, 0x0028, 
+	 0x0044, 0x0045, 0x0049, 0x0095, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x00A8, 0x00AA, 0x0022, 0x0000, 0x00A0, 0x002A, 0x002A, 
+	 0x0000, 0x00A2, 0x00A2, 0x0024, 0x0000, 0x0094, 0x00A2, 0x004A, 
+	 0x00E0, 0x00E0, 0x00C0, 0x00C0, 0x00DF, 0x0000, 0x00DF, 0x0000, 
+	 0x0024, 0x000C, 0x0010, 0x0010, 0x0022, 0x00EE, 0x00FA, 0x0000, 
+	 0x0024, 0x0000, 0x0024, 0x0000, 0x0024, 0x0000, 0x0024, 0x0024, 
+	 0x0000, 0x0000, 0x0024, 0x0024, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x000C, 0x000E, 0x001E, 0x000C, 0x0008, 0x000C, 0x000C, 0x0002, 
+	 0x000C, 0x000C, 0x0032, 0x0077, 0x00F7, 0x0000, 0x0000, 0x0000, 
+	 0x0030, 0x0070, 0x0078, 0x0030, 0x0076, 0x007B, 0x0033, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 2 */
+	 0x0000, 0x0000, 0x0000, 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 
+	 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x00A8, 0x00AA, 0x0006, 
+	 0x003C, 0x007E, 0x007E, 0x007E, 0x0060, 0x007E, 0x007E, 0x000C, 
+	 0x007E, 0x003C, 0x0000, 0x0000, 0x00FB, 0x0066, 0x00FB, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0028, 0x0092, 0x00A2, 0x0042, 0x0000, 
+	 0x0010, 0x0008, 0x0092, 0x0010, 0x0018, 0x0000, 0x0018, 0x0002, 
+	 0x0024, 0x0010, 0x0042, 0x0042, 0x0020, 0x0042, 0x0042, 0x0004, 
+	 0x0042, 0x0020, 0x0018, 0x0018, 0x0010, 0x0000, 0x0008, 0x0000, 
+	 0x0004, 0x0042, 0x0044, 0x0042, 0x0044, 0x0044, 0x0004, 0x0042, 
+	 0x0042, 0x0010, 0x0022, 0x0042, 0x0042, 0x0082, 0x0062, 0x0042, 
+	 0x0002, 0x0022, 0x0022, 0x0042, 0x0010, 0x0042, 0x0010, 0x00C6, 
+	 0x0044, 0x0010, 0x0042, 0x0008, 0x0080, 0x0010, 0x0000, 0x0000, 
+	 0x0000, 0x0042, 0x0026, 0x0044, 0x0064, 0x0044, 0x0008, 0x0058, 
+	 0x0042, 0x0010, 0x0022, 0x0022, 0x0010, 0x0092, 0x0042, 0x0024, 
+	 0x001A, 0x0058, 0x0002, 0x0044, 0x0048, 0x0064, 0x0028, 0x0092, 
+	 0x0044, 0x0010, 0x0004, 0x0008, 0x0010, 0x0010, 0x0000, 0x0042, 
+	 0x0050, 0x003B, 0x0099, 0x00AA, 0x0000, 0x0000, 0x00AE, 0x006E, 
+	 0x0044, 0x00C5, 0x0049, 0x00D5, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x00AE, 0x006A, 0x0062, 0x0000, 0x00A0, 0x002E, 0x006A, 
+	 0x0000, 0x00AE, 0x00E2, 0x0064, 0x0000, 0x00D4, 0x00A4, 0x004A, 
+	 0x0040, 0x0040, 0x00C0, 0x00C0, 0x00C4, 0x0000, 0x00DF, 0x0000, 
+	 0x0026, 0x0014, 0x0038, 0x0010, 0x0052, 0x0044, 0x000A, 0x0000, 
+	 0x0024, 0x0000, 0x0066, 0x0000, 0x0026, 0x0000, 0x0064, 0x0066, 
+	 0x0000, 0x0000, 0x0064, 0x0026, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0012, 0x0004, 0x0002, 0x0012, 0x0008, 0x0012, 0x0012, 0x0002, 
+	 0x0012, 0x0010, 0x004A, 0x0022, 0x0012, 0x0000, 0x0000, 0x0000, 
+	 0x0048, 0x0020, 0x0008, 0x0048, 0x0026, 0x000B, 0x004B, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 3 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x007E, 0x007E, 0x007E, 0x007E, 
+	 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x00D8, 0x00AA, 0x0002, 
+	 0x007E, 0x0018, 0x0066, 0x0066, 0x0060, 0x0066, 0x0066, 0x0018, 
+	 0x0066, 0x0070, 0x0000, 0x0018, 0x00DB, 0x0066, 0x001B, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0028, 0x0090, 0x0044, 0x00A2, 0x0000, 
+	 0x0008, 0x0010, 0x0054, 0x0010, 0x0018, 0x0000, 0x0000, 0x0004, 
+	 0x0042, 0x0010, 0x0002, 0x0040, 0x0020, 0x0040, 0x0042, 0x0008, 
+	 0x0042, 0x0040, 0x0018, 0x0018, 0x0008, 0x0000, 0x0010, 0x0008, 
+	 0x0032, 0x0042, 0x0044, 0x0002, 0x0044, 0x0004, 0x0004, 0x0042, 
+	 0x0042, 0x0010, 0x0022, 0x0022, 0x0002, 0x0082, 0x0062, 0x0042, 
+	 0x0002, 0x0052, 0x0012, 0x0040, 0x0010, 0x0042, 0x0028, 0x00AA, 
+	 0x0028, 0x0010, 0x0004, 0x0008, 0x0040, 0x0010, 0x0000, 0x0000, 
+	 0x0000, 0x0042, 0x0042, 0x0002, 0x0042, 0x0002, 0x0008, 0x0064, 
+	 0x0042, 0x0010, 0x0020, 0x0016, 0x0010, 0x0092, 0x0042, 0x0042, 
+	 0x0026, 0x0064, 0x0002, 0x0040, 0x0008, 0x0042, 0x0028, 0x0092, 
+	 0x0028, 0x0028, 0x0008, 0x0008, 0x0010, 0x0010, 0x0000, 0x0099, 
+	 0x00D0, 0x000A, 0x00A9, 0x00DA, 0x0000, 0x0000, 0x00AA, 0x0022, 
+	 0x0044, 0x0045, 0x0049, 0x00B5, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x00A2, 0x00AA, 0x0022, 0x0000, 0x00A0, 0x002A, 0x002A, 
+	 0x0000, 0x00AA, 0x00A2, 0x0024, 0x0000, 0x00B4, 0x00A8, 0x004A, 
+	 0x0044, 0x0040, 0x00CC, 0x00C0, 0x0004, 0x0000, 0x000C, 0x0000, 
+	 0x003C, 0x0024, 0x007C, 0x0010, 0x008A, 0x0044, 0x000A, 0x0000, 
+	 0x0024, 0x0000, 0x00C3, 0x0000, 0x0023, 0x0000, 0x00C4, 0x00C3, 
+	 0x0000, 0x0000, 0x00C4, 0x0023, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0012, 0x0004, 0x0002, 0x0010, 0x0008, 0x0010, 0x0012, 0x0004, 
+	 0x0012, 0x0010, 0x004A, 0x0022, 0x0022, 0x0000, 0x0000, 0x0000, 
+	 0x0048, 0x0020, 0x0008, 0x0040, 0x0020, 0x0008, 0x0040, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 4 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x007E, 0x007E, 0x007E, 
+	 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x0088, 0x006E, 0x000E, 
+	 0x0066, 0x0018, 0x0006, 0x0060, 0x00FE, 0x0060, 0x0066, 0x0018, 
+	 0x0066, 0x0060, 0x0000, 0x0018, 0x00DB, 0x0066, 0x0033, 0x0000, 
+	 0x0000, 0x0010, 0x0000, 0x00FE, 0x0090, 0x0008, 0x0014, 0x0000, 
+	 0x0008, 0x0010, 0x0038, 0x0010, 0x0000, 0x0000, 0x0000, 0x0008, 
+	 0x0042, 0x0010, 0x0004, 0x0040, 0x0020, 0x0040, 0x0042, 0x0008, 
+	 0x0042, 0x0040, 0x0000, 0x0000, 0x0004, 0x003C, 0x0020, 0x0008, 
+	 0x004A, 0x007E, 0x0044, 0x0002, 0x0044, 0x0004, 0x0004, 0x0042, 
+	 0x0042, 0x0010, 0x0020, 0x0012, 0x0002, 0x0092, 0x0052, 0x0042, 
+	 0x0002, 0x0042, 0x000A, 0x0040, 0x0010, 0x0042, 0x0028, 0x00AA, 
+	 0x0028, 0x0010, 0x0004, 0x0008, 0x0020, 0x0010, 0x0000, 0x0000, 
+	 0x0000, 0x004C, 0x0042, 0x0002, 0x0042, 0x003E, 0x0008, 0x0042, 
+	 0x0042, 0x0010, 0x0020, 0x000A, 0x0010, 0x0092, 0x0042, 0x0042, 
+	 0x0042, 0x0042, 0x0002, 0x0038, 0x0008, 0x0042, 0x0044, 0x0092, 
+	 0x0010, 0x0024, 0x0010, 0x0008, 0x0010, 0x0010, 0x0060, 0x00A5, 
+	 0x0050, 0x00BA, 0x00BB, 0x008A, 0x0000, 0x0000, 0x00EE, 0x00EE, 
+	 0x00C4, 0x009D, 0x005C, 0x0097, 0x0072, 0x0077, 0x0097, 0x0008, 
+	 0x0000, 0x00EE, 0x00EA, 0x00EE, 0x0000, 0x00A0, 0x0024, 0x00EA, 
+	 0x0000, 0x00EE, 0x0042, 0x00EE, 0x0000, 0x0094, 0x00E0, 0x00EA, 
+	 0x0044, 0x0040, 0x00DE, 0x00DF, 0x0004, 0x0000, 0x000C, 0x0000, 
+	 0x0064, 0x0044, 0x0092, 0x0010, 0x008A, 0x0044, 0x0012, 0x0000, 
+	 0x0024, 0x00FF, 0x0081, 0x0000, 0x0021, 0x00FF, 0x0084, 0x0081, 
+	 0x0007, 0x00E0, 0x008C, 0x0031, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0012, 0x0004, 0x0004, 0x0010, 0x001F, 0x0010, 0x0012, 0x0004, 
+	 0x0012, 0x001C, 0x004A, 0x0022, 0x0042, 0x0000, 0x0000, 0x0000, 
+	 0x0048, 0x0020, 0x0010, 0x0040, 0x0020, 0x0010, 0x0040, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 5 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x007E, 0x007E, 
+	 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x0000, 0x0000, 0x0000, 
+	 0x0066, 0x0018, 0x000C, 0x0038, 0x00FE, 0x007E, 0x007E, 0x0030, 
+	 0x003C, 0x007C, 0x007C, 0x007E, 0x00DB, 0x0066, 0x0063, 0x0000, 
+	 0x0000, 0x0010, 0x0000, 0x0028, 0x007C, 0x0010, 0x0008, 0x0000, 
+	 0x0008, 0x0010, 0x00FE, 0x00FE, 0x0000, 0x007C, 0x0000, 0x0010, 
+	 0x0042, 0x0010, 0x0008, 0x0040, 0x00FE, 0x0040, 0x0046, 0x0010, 
+	 0x0042, 0x007C, 0x0000, 0x0000, 0x0002, 0x0000, 0x0040, 0x0010, 
+	 0x009A, 0x0042, 0x0044, 0x0002, 0x0044, 0x0004, 0x0004, 0x0072, 
+	 0x0042, 0x0010, 0x0020, 0x000A, 0x0002, 0x0092, 0x0052, 0x0042, 
+	 0x003E, 0x0042, 0x003E, 0x0040, 0x0010, 0x0042, 0x0044, 0x0092, 
+	 0x0010, 0x0010, 0x0008, 0x0008, 0x0010, 0x0010, 0x0000, 0x0000, 
+	 0x0000, 0x0070, 0x0042, 0x0002, 0x0042, 0x0042, 0x003C, 0x0042, 
+	 0x0042, 0x0010, 0x0020, 0x0012, 0x0010, 0x0092, 0x0042, 0x0042, 
+	 0x0042, 0x0042, 0x0006, 0x0004, 0x0008, 0x0042, 0x0044, 0x0092, 
+	 0x0028, 0x0044, 0x0020, 0x0004, 0x0000, 0x0020, 0x0092, 0x0085, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0015, 0x0051, 0x0091, 0x0008, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x005F, 0x005F, 0x00DE, 0x00DF, 0x0004, 0x0000, 0x000C, 0x0000, 
+	 0x0024, 0x004C, 0x0010, 0x0010, 0x008A, 0x0044, 0x0022, 0x0000, 
+	 0x0024, 0x0000, 0x0000, 0x0000, 0x0020, 0x0000, 0x0004, 0x0000, 
+	 0x000C, 0x0030, 0x0018, 0x0018, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0012, 0x0004, 0x0008, 0x000C, 0x0009, 0x000E, 0x000E, 0x0008, 
+	 0x000C, 0x0012, 0x004A, 0x0022, 0x0082, 0x0000, 0x0000, 0x0000, 
+	 0x0048, 0x0020, 0x0020, 0x0030, 0x0020, 0x0020, 0x0038, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 6 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x007E, 
+	 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x00A8, 0x003B, 0x0000, 
+	 0x0066, 0x0018, 0x0018, 0x0038, 0x0066, 0x003E, 0x003E, 0x0030, 
+	 0x003C, 0x007E, 0x007C, 0x007E, 0x00DB, 0x0066, 0x00C3, 0x0000, 
+	 0x0000, 0x0010, 0x0000, 0x0028, 0x0012, 0x0020, 0x0014, 0x0000, 
+	 0x0008, 0x0010, 0x0038, 0x0010, 0x0000, 0x0000, 0x0000, 0x0020, 
+	 0x0042, 0x0010, 0x0010, 0x0038, 0x0022, 0x003E, 0x003A, 0x0010, 
+	 0x003C, 0x0042, 0x0018, 0x0018, 0x0004, 0x003C, 0x0020, 0x0020, 
+	 0x00AA, 0x0042, 0x003C, 0x0002, 0x0044, 0x001C, 0x001C, 0x0002, 
+	 0x007E, 0x0010, 0x0020, 0x0006, 0x0002, 0x00AA, 0x004A, 0x0042, 
+	 0x0042, 0x0042, 0x0042, 0x003C, 0x0010, 0x0042, 0x0044, 0x0092, 
+	 0x0010, 0x0028, 0x0010, 0x0008, 0x0008, 0x0010, 0x0082, 0x0000, 
+	 0x0000, 0x0042, 0x0026, 0x0044, 0x0064, 0x0044, 0x0008, 0x0024, 
+	 0x0026, 0x0010, 0x0020, 0x0022, 0x0010, 0x0092, 0x0026, 0x0024, 
+	 0x0026, 0x0064, 0x004A, 0x0044, 0x0008, 0x0042, 0x0082, 0x0082, 
+	 0x0044, 0x0042, 0x0040, 0x0008, 0x0010, 0x0010, 0x000C, 0x0085, 
+	 0x00AF, 0x00EE, 0x0002, 0x0000, 0x0052, 0x0095, 0x000E, 0x0000, 
+	 0x0023, 0x00A9, 0x00A2, 0x000E, 0x0035, 0x0051, 0x0091, 0x0014, 
+	 0x0095, 0x00EA, 0x00EE, 0x0001, 0x0075, 0x0077, 0x0027, 0x0009, 
+	 0x0025, 0x00B9, 0x0002, 0x0000, 0x0071, 0x00E9, 0x000A, 0x0000, 
+	 0x0044, 0x0040, 0x00CC, 0x00C0, 0x0004, 0x0000, 0x000C, 0x0000, 
+	 0x0026, 0x0034, 0x0010, 0x0010, 0x008A, 0x0044, 0x0042, 0x0000, 
+	 0x0024, 0x0000, 0x0000, 0x00FF, 0x0020, 0x0000, 0x0004, 0x0000, 
+	 0x0018, 0x0018, 0x0030, 0x000C, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0012, 0x0004, 0x0010, 0x0010, 0x000A, 0x0002, 0x0002, 0x0008, 
+	 0x0012, 0x0012, 0x004A, 0x0022, 0x0082, 0x0000, 0x0000, 0x0000, 
+	 0x0048, 0x0020, 0x0040, 0x0040, 0x0020, 0x0040, 0x0008, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 7 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x00A8, 0x0008, 0x0000, 
+	 0x0066, 0x001E, 0x0030, 0x0060, 0x006C, 0x0006, 0x0006, 0x0060, 
+	 0x0066, 0x0066, 0x0000, 0x0018, 0x00DB, 0x0066, 0x00C3, 0x0000, 
+	 0x0000, 0x0010, 0x0000, 0x00FE, 0x0012, 0x0044, 0x0022, 0x0000, 
+	 0x0008, 0x0010, 0x0054, 0x0010, 0x0000, 0x0000, 0x0000, 0x0040, 
+	 0x0042, 0x0010, 0x0020, 0x0040, 0x0024, 0x0002, 0x0002, 0x0020, 
+	 0x0042, 0x0042, 0x0018, 0x0018, 0x0008, 0x0000, 0x0010, 0x0040, 
+	 0x00AA, 0x0042, 0x0044, 0x0002, 0x0044, 0x0004, 0x0004, 0x0002, 
+	 0x0042, 0x0010, 0x0020, 0x000A, 0x0002, 0x00AA, 0x004A, 0x0042, 
+	 0x0042, 0x0042, 0x0042, 0x0002, 0x0010, 0x0042, 0x0044, 0x0082, 
+	 0x0028, 0x0044, 0x0020, 0x0008, 0x0004, 0x0010, 0x0044, 0x0000, 
+	 0x0000, 0x003C, 0x001A, 0x0038, 0x0058, 0x0038, 0x0008, 0x0018, 
+	 0x001A, 0x0018, 0x0030, 0x0042, 0x0010, 0x006E, 0x001A, 0x0018, 
+	 0x001A, 0x0058, 0x0032, 0x0038, 0x003E, 0x0042, 0x0082, 0x0082, 
+	 0x0082, 0x0042, 0x007C, 0x0008, 0x0010, 0x0010, 0x0000, 0x00A5, 
+	 0x00A9, 0x00AA, 0x0022, 0x0000, 0x0052, 0x0095, 0x0008, 0x0000, 
+	 0x0025, 0x00A9, 0x00A2, 0x0022, 0x0015, 0x0051, 0x0091, 0x0014, 
+	 0x0095, 0x002A, 0x002A, 0x0001, 0x0015, 0x0054, 0x0021, 0x0029, 
+	 0x0025, 0x0089, 0x0002, 0x0000, 0x0051, 0x0029, 0x000A, 0x0000, 
+	 0x0044, 0x0040, 0x00C0, 0x00C0, 0x0004, 0x0000, 0x000F, 0x0000, 
+	 0x003C, 0x0004, 0x0010, 0x0092, 0x008A, 0x0044, 0x0082, 0x0000, 
+	 0x0024, 0x00FF, 0x0081, 0x0000, 0x0021, 0x0081, 0x0084, 0x00FF, 
+	 0x0031, 0x008C, 0x00E0, 0x0007, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0012, 0x0006, 0x0012, 0x0012, 0x000C, 0x0002, 0x0002, 0x0010, 
+	 0x0012, 0x0012, 0x004B, 0x0033, 0x0093, 0x0000, 0x0000, 0x0000, 
+	 0x0048, 0x0030, 0x0048, 0x0048, 0x0030, 0x0048, 0x0008, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 8 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x007E, 0x007E, 0x007E, 0x007E, 0x0098, 0x0009, 0x0000, 
+	 0x007E, 0x001C, 0x0066, 0x0066, 0x0078, 0x0006, 0x000E, 0x0066, 
+	 0x0066, 0x0066, 0x0000, 0x0018, 0x00DB, 0x0077, 0x00DB, 0x0000, 
+	 0x0000, 0x0010, 0x0000, 0x0028, 0x0092, 0x008A, 0x0022, 0x0004, 
+	 0x0008, 0x0010, 0x0092, 0x0010, 0x0000, 0x0000, 0x0000, 0x0080, 
+	 0x0042, 0x0014, 0x0040, 0x0040, 0x0028, 0x0002, 0x0002, 0x0020, 
+	 0x0042, 0x0042, 0x0000, 0x0000, 0x0010, 0x0000, 0x0008, 0x0042, 
+	 0x0092, 0x0024, 0x0044, 0x0002, 0x0044, 0x0004, 0x0004, 0x0002, 
+	 0x0042, 0x0010, 0x0020, 0x0012, 0x0002, 0x00C6, 0x0046, 0x0042, 
+	 0x0042, 0x0042, 0x0042, 0x0002, 0x0010, 0x0042, 0x0082, 0x0082, 
+	 0x0028, 0x0044, 0x0020, 0x0008, 0x0002, 0x0010, 0x0028, 0x0000, 
+	 0x0020, 0x0000, 0x0002, 0x0000, 0x0040, 0x0000, 0x0048, 0x0000, 
+	 0x0002, 0x0000, 0x0000, 0x0002, 0x0010, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0008, 0x0010, 0x0010, 0x0000, 0x0099, 
+	 0x006D, 0x00AA, 0x004E, 0x0000, 0x0032, 0x00D7, 0x00EE, 0x0000, 
+	 0x0055, 0x00ED, 0x00AA, 0x0042, 0x0075, 0x0071, 0x00D7, 0x0015, 
+	 0x00D7, 0x002E, 0x00AA, 0x0001, 0x0033, 0x0057, 0x0021, 0x004D, 
+	 0x0035, 0x0099, 0x0039, 0x0000, 0x0057, 0x002D, 0x000E, 0x0000, 
+	 0x0040, 0x0040, 0x00E0, 0x00E0, 0x0005, 0x0000, 0x000E, 0x0000, 
+	 0x0064, 0x0004, 0x0010, 0x007C, 0x008A, 0x0044, 0x0082, 0x0000, 
+	 0x0024, 0x0000, 0x00C3, 0x0000, 0x0023, 0x00C3, 0x00C4, 0x0000, 
+	 0x0023, 0x00C4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x000C, 0x0004, 0x000C, 0x000C, 0x0008, 0x000E, 0x000C, 0x001F, 
+	 0x000C, 0x000C, 0x0032, 0x0022, 0x0062, 0x0000, 0x0000, 0x0000, 
+	 0x0030, 0x0020, 0x0030, 0x0030, 0x0020, 0x0030, 0x0038, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 9 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x007E, 0x007E, 0x007E, 0x00A8, 0x0008, 0x0000, 
+	 0x003C, 0x0018, 0x007E, 0x007E, 0x0070, 0x003E, 0x003C, 0x007E, 
+	 0x007E, 0x007E, 0x0000, 0x0000, 0x00FB, 0x0077, 0x00FB, 0x0000, 
+	 0x0000, 0x0010, 0x0028, 0x0028, 0x007C, 0x0004, 0x001C, 0x0008, 
+	 0x0010, 0x0008, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0024, 0x0018, 0x0042, 0x0042, 0x0030, 0x0002, 0x0004, 0x0042, 
+	 0x0042, 0x0042, 0x0000, 0x0000, 0x0020, 0x0000, 0x0004, 0x0042, 
+	 0x0044, 0x0024, 0x0044, 0x0042, 0x0044, 0x0044, 0x0044, 0x0042, 
+	 0x0042, 0x0010, 0x0020, 0x0022, 0x0002, 0x00C6, 0x0046, 0x0042, 
+	 0x0042, 0x0042, 0x0042, 0x0042, 0x0092, 0x0042, 0x0082, 0x0082, 
+	 0x0044, 0x0082, 0x0042, 0x0008, 0x0000, 0x0010, 0x0010, 0x0000, 
+	 0x0010, 0x0000, 0x0002, 0x0000, 0x0040, 0x0000, 0x0030, 0x0000, 
+	 0x0002, 0x0010, 0x0020, 0x0002, 0x0010, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0008, 0x0010, 0x0010, 0x0000, 0x0042, 
+	 0x00A1, 0x00AA, 0x008A, 0x0000, 0x0052, 0x00B5, 0x0002, 0x0000, 
+	 0x0055, 0x00AB, 0x00B6, 0x0082, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x00B5, 0x002A, 0x002A, 0x0000, 0x0015, 0x0051, 0x0021, 0x008B, 
+	 0x002D, 0x0089, 0x0002, 0x0000, 0x0055, 0x002B, 0x000A, 0x0000, 
+	 0x0060, 0x0060, 0x00E0, 0x00E0, 0x0006, 0x0000, 0x000C, 0x0000, 
+	 0x0024, 0x0004, 0x0010, 0x0038, 0x0053, 0x0066, 0x008B, 0x0000, 
+	 0x0024, 0x0000, 0x0066, 0x0000, 0x0026, 0x0066, 0x0064, 0x0000, 
+	 0x0026, 0x0064, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 10 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x007E, 0x007E, 0x00B8, 0x003B, 0x0000, 
+	 0x0018, 0x0010, 0x003C, 0x003C, 0x0060, 0x003E, 0x0038, 0x007E, 
+	 0x003C, 0x003C, 0x0000, 0x0000, 0x0073, 0x0066, 0x0073, 0x0000, 
+	 0x0000, 0x0010, 0x0028, 0x0000, 0x0010, 0x0000, 0x0000, 0x0018, 
+	 0x0010, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0018, 0x0010, 0x003C, 0x003C, 0x0020, 0x003E, 0x0038, 0x007E, 
+	 0x003C, 0x003C, 0x0000, 0x0000, 0x0040, 0x0000, 0x0002, 0x003C, 
+	 0x0038, 0x0018, 0x003E, 0x003C, 0x003E, 0x007E, 0x007E, 0x003C, 
+	 0x0042, 0x007C, 0x0070, 0x0042, 0x0002, 0x0082, 0x0042, 0x003C, 
+	 0x003E, 0x003C, 0x003E, 0x003C, 0x00FE, 0x0042, 0x0082, 0x0082, 
+	 0x00C6, 0x0082, 0x007E, 0x0008, 0x0000, 0x0010, 0x0000, 0x0000, 
+	 0x0018, 0x0000, 0x0002, 0x0000, 0x0040, 0x0000, 0x0000, 0x0000, 
+	 0x0002, 0x0000, 0x0000, 0x0002, 0x0018, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0030, 0x0010, 0x000C, 0x0000, 0x003C, 
+	 0x00EF, 0x00AE, 0x000E, 0x0000, 0x0077, 0x0092, 0x000E, 0x0000, 
+	 0x0053, 0x0049, 0x00A2, 0x000E, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0092, 0x0024, 0x00EE, 0x0001, 0x0077, 0x0077, 0x0071, 0x0009, 
+	 0x00A5, 0x00BB, 0x0003, 0x0000, 0x0057, 0x00E9, 0x000A, 0x0000, 
+	 0x0040, 0x0040, 0x00C0, 0x00C0, 0x0004, 0x0000, 0x0008, 0x0000, 
+	 0x0020, 0x0004, 0x0010, 0x0010, 0x0022, 0x0044, 0x0072, 0x0000, 
+	 0x0024, 0x0000, 0x0024, 0x0000, 0x0024, 0x0024, 0x0024, 0x0000, 
+	 0x0024, 0x0024, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 11 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x007E, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0028, 0x0000, 0x0000, 0x0000, 0x0000, 0x0018, 
+	 0x0020, 0x0004, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0078, 0x0000, 0x001E, 0x0000, 0x0000, 
+	 0x0018, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0024, 0x0000, 0x0024, 0x0000, 0x0024, 0x0024, 0x0024, 0x0000, 
+	 0x0024, 0x0024, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	}
+};
Index: vlib/cg3.c
===================================================================
--- vlib/cg3.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/cg3.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,498 @@
+/* VSDD character generator table cg3 */
+/* 14V by 8H */
+/* Generated:  1989-11-16  15:40:14 */
+
+/* int	cg_rows = 14; */
+
+int	cg3[14][256] = {
+
+	{	/* Scan line 0 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0024, 0x0000, 0x0024, 0x0000, 0x0024, 0x0000, 0x0024, 0x0024, 
+	 0x0000, 0x0000, 0x0024, 0x0024, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 1 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0024, 0x0000, 0x0024, 0x0000, 0x0024, 0x0000, 0x0024, 0x0024, 
+	 0x0000, 0x0000, 0x0024, 0x0024, 0x0040, 0x0000, 0x0000, 0x0008, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 2 */
+	 0x0000, 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 
+	 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x0088, 0x006E, 0x000E, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0x0000, 0x0000, 0x0000, 
+	 0x0020, 0x0004, 0x0000, 0x0000, 0x0004, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0004, 0x0040, 0x0000, 0x0002, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0080, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0078, 0x0000, 0x001E, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x003C, 
+	 0x0000, 0x0000, 0x001C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0002, 0x0040, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0006, 0x0000, 0x0030, 0x0010, 0x000C, 0x0000, 0x0000, 
+	 0x0050, 0x003A, 0x00A9, 0x008B, 0x0000, 0x0000, 0x00E2, 0x00EE, 
+	 0x00DC, 0x005D, 0x0049, 0x0097, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x00EE, 0x00AE, 0x00EE, 0x0000, 0x0040, 0x00EA, 0x00EE, 
+	 0x0000, 0x00E2, 0x00AE, 0x00E4, 0x0000, 0x0094, 0x00E0, 0x004E, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0004, 0x0004, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0024, 0x0000, 0x0024, 0x0000, 0x0024, 0x0000, 0x0024, 0x0024, 
+	 0x0000, 0x0000, 0x0024, 0x0024, 0x0060, 0x0000, 0x0078, 0x001C, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 3 */
+	 0x0000, 0x0000, 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 
+	 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x0088, 0x00AA, 0x0002, 
+	 0x0018, 0x007E, 0x007E, 0x003C, 0x0060, 0x003C, 0x003C, 0x000C, 
+	 0x003C, 0x001C, 0x0000, 0x0000, 0x0073, 0x0066, 0x00FB, 0x0000, 
+	 0x0000, 0x0010, 0x0000, 0x0000, 0x007C, 0x0040, 0x00BC, 0x0000, 
+	 0x0010, 0x0008, 0x0010, 0x0000, 0x0008, 0x0000, 0x0018, 0x0000, 
+	 0x0018, 0x007C, 0x007E, 0x003C, 0x0020, 0x003C, 0x003C, 0x0004, 
+	 0x003C, 0x001C, 0x0000, 0x0008, 0x0020, 0x0000, 0x0004, 0x0008, 
+	 0x0078, 0x0042, 0x003E, 0x003C, 0x003E, 0x007E, 0x0004, 0x003C, 
+	 0x0042, 0x007C, 0x001C, 0x0082, 0x007E, 0x0082, 0x0042, 0x003C, 
+	 0x0002, 0x005C, 0x0042, 0x003C, 0x0038, 0x003C, 0x0010, 0x0044, 
+	 0x00C6, 0x0038, 0x007E, 0x0008, 0x0000, 0x0010, 0x0000, 0x00FE, 
+	 0x0000, 0x00BC, 0x001A, 0x0038, 0x0058, 0x0038, 0x0008, 0x0042, 
+	 0x0042, 0x0038, 0x0022, 0x0042, 0x0038, 0x0092, 0x0042, 0x0018, 
+	 0x0002, 0x0040, 0x0002, 0x0038, 0x0030, 0x0058, 0x0010, 0x006C, 
+	 0x0082, 0x0008, 0x007C, 0x0008, 0x0010, 0x0010, 0x0000, 0x003C, 
+	 0x0050, 0x0022, 0x00A9, 0x008A, 0x0000, 0x0000, 0x00A2, 0x0028, 
+	 0x0044, 0x0045, 0x0049, 0x0095, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x00A8, 0x00AA, 0x0022, 0x0000, 0x00A0, 0x002A, 0x002A, 
+	 0x0000, 0x00A2, 0x00A2, 0x0024, 0x0000, 0x0094, 0x00A2, 0x004A, 
+	 0x00E0, 0x00E0, 0x00C0, 0x00C0, 0x00DF, 0x0000, 0x00DF, 0x0000, 
+	 0x0024, 0x000C, 0x0010, 0x0010, 0x0022, 0x00EE, 0x00FA, 0x0000, 
+	 0x0024, 0x0000, 0x0024, 0x0000, 0x0024, 0x0000, 0x0024, 0x0024, 
+	 0x0000, 0x0000, 0x0024, 0x0024, 0x0070, 0x0040, 0x0084, 0x003E, 
+	 0x000C, 0x000E, 0x001E, 0x000C, 0x0008, 0x000C, 0x000C, 0x0002, 
+	 0x000C, 0x000C, 0x0032, 0x0077, 0x00F7, 0x0000, 0x0000, 0x0000, 
+	 0x0030, 0x0070, 0x0078, 0x0030, 0x0076, 0x007B, 0x0033, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 4 */
+	 0x0000, 0x0000, 0x0000, 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 
+	 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x00A8, 0x00AA, 0x0006, 
+	 0x003C, 0x007E, 0x007E, 0x007E, 0x0060, 0x007E, 0x007E, 0x000C, 
+	 0x007E, 0x003C, 0x0000, 0x0000, 0x00FB, 0x0066, 0x00FB, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0028, 0x0092, 0x00A2, 0x0042, 0x0000, 
+	 0x0010, 0x0008, 0x0092, 0x0010, 0x0018, 0x0000, 0x0018, 0x0002, 
+	 0x0024, 0x0010, 0x0042, 0x0042, 0x0020, 0x0042, 0x0042, 0x0004, 
+	 0x0042, 0x0020, 0x0018, 0x0018, 0x0010, 0x0000, 0x0008, 0x0000, 
+	 0x0004, 0x0042, 0x0044, 0x0042, 0x0044, 0x0044, 0x0004, 0x0042, 
+	 0x0042, 0x0010, 0x0022, 0x0042, 0x0042, 0x0082, 0x0062, 0x0042, 
+	 0x0002, 0x0022, 0x0022, 0x0042, 0x0010, 0x0042, 0x0010, 0x00C6, 
+	 0x0044, 0x0010, 0x0042, 0x0008, 0x0080, 0x0010, 0x0000, 0x0000, 
+	 0x0000, 0x0042, 0x0026, 0x0044, 0x0064, 0x0044, 0x0008, 0x0058, 
+	 0x0042, 0x0010, 0x0022, 0x0022, 0x0010, 0x0092, 0x0042, 0x0024, 
+	 0x001A, 0x0058, 0x0002, 0x0044, 0x0048, 0x0064, 0x0028, 0x0092, 
+	 0x0044, 0x0010, 0x0004, 0x0008, 0x0010, 0x0010, 0x0000, 0x0042, 
+	 0x0050, 0x003B, 0x0099, 0x00AA, 0x0000, 0x0000, 0x00AE, 0x006E, 
+	 0x0044, 0x00C5, 0x0049, 0x00D5, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x00AE, 0x006A, 0x0062, 0x0000, 0x00A0, 0x002E, 0x006A, 
+	 0x0000, 0x00AE, 0x00E2, 0x0064, 0x0000, 0x00D4, 0x00A4, 0x004A, 
+	 0x0040, 0x0040, 0x00C0, 0x00C0, 0x00C4, 0x0000, 0x00DF, 0x0000, 
+	 0x0026, 0x0014, 0x0038, 0x0010, 0x0052, 0x0044, 0x000A, 0x0000, 
+	 0x0024, 0x0000, 0x0066, 0x0000, 0x0026, 0x0000, 0x0064, 0x0066, 
+	 0x0000, 0x0000, 0x0064, 0x0026, 0x0078, 0x0048, 0x00B0, 0x007F, 
+	 0x0012, 0x0004, 0x0002, 0x0012, 0x0008, 0x0012, 0x0012, 0x0002, 
+	 0x0012, 0x0010, 0x004A, 0x0022, 0x0012, 0x0000, 0x0000, 0x0000, 
+	 0x0048, 0x0020, 0x0008, 0x0048, 0x0026, 0x000B, 0x004B, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 5 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x007E, 0x007E, 0x007E, 0x007E, 
+	 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x00D8, 0x00AA, 0x0002, 
+	 0x007E, 0x0018, 0x0066, 0x0066, 0x0060, 0x0066, 0x0066, 0x0018, 
+	 0x0066, 0x0070, 0x0000, 0x0018, 0x00DB, 0x0066, 0x001B, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0028, 0x0090, 0x0044, 0x00A2, 0x0000, 
+	 0x0008, 0x0010, 0x0054, 0x0010, 0x0018, 0x0000, 0x0000, 0x0004, 
+	 0x0042, 0x0010, 0x0002, 0x0040, 0x0020, 0x0040, 0x0042, 0x0008, 
+	 0x0042, 0x0040, 0x0018, 0x0018, 0x0008, 0x0000, 0x0010, 0x0008, 
+	 0x0032, 0x0042, 0x0044, 0x0002, 0x0044, 0x0004, 0x0004, 0x0042, 
+	 0x0042, 0x0010, 0x0022, 0x0022, 0x0002, 0x0082, 0x0062, 0x0042, 
+	 0x0002, 0x0052, 0x0012, 0x0040, 0x0010, 0x0042, 0x0028, 0x00AA, 
+	 0x0028, 0x0010, 0x0004, 0x0008, 0x0040, 0x0010, 0x0000, 0x0000, 
+	 0x0000, 0x0042, 0x0042, 0x0002, 0x0042, 0x0002, 0x0008, 0x0064, 
+	 0x0042, 0x0010, 0x0020, 0x0016, 0x0010, 0x0092, 0x0042, 0x0042, 
+	 0x0026, 0x0064, 0x0002, 0x0040, 0x0008, 0x0042, 0x0028, 0x0092, 
+	 0x0028, 0x0028, 0x0008, 0x0008, 0x0010, 0x0010, 0x0000, 0x0099, 
+	 0x00D0, 0x000A, 0x00A9, 0x00DA, 0x0000, 0x0000, 0x00AA, 0x0022, 
+	 0x0044, 0x0045, 0x0049, 0x00B5, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x00A2, 0x00AA, 0x0022, 0x0000, 0x00A0, 0x002A, 0x002A, 
+	 0x0000, 0x00AA, 0x00A2, 0x0024, 0x0000, 0x00B4, 0x00A8, 0x004A, 
+	 0x0044, 0x0040, 0x00CC, 0x00C0, 0x0004, 0x0000, 0x000C, 0x0000, 
+	 0x003C, 0x0024, 0x007C, 0x0010, 0x008A, 0x0044, 0x000A, 0x0000, 
+	 0x0024, 0x0000, 0x00C3, 0x0000, 0x0023, 0x0000, 0x00C4, 0x00C3, 
+	 0x0000, 0x0000, 0x00C4, 0x0023, 0x007C, 0x0094, 0x00C8, 0x0008, 
+	 0x0012, 0x0004, 0x0002, 0x0010, 0x0008, 0x0010, 0x0012, 0x0004, 
+	 0x0012, 0x0010, 0x004A, 0x0022, 0x0022, 0x0000, 0x0000, 0x0000, 
+	 0x0048, 0x0020, 0x0008, 0x0040, 0x0020, 0x0008, 0x0040, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 6 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x007E, 0x007E, 0x007E, 
+	 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x0088, 0x006E, 0x000E, 
+	 0x0066, 0x0018, 0x0006, 0x0060, 0x00FE, 0x0060, 0x0066, 0x0018, 
+	 0x0066, 0x0060, 0x0000, 0x0018, 0x00DB, 0x0066, 0x0033, 0x0000, 
+	 0x0000, 0x0010, 0x0000, 0x00FE, 0x0090, 0x0008, 0x0014, 0x0000, 
+	 0x0008, 0x0010, 0x0038, 0x0010, 0x0000, 0x0000, 0x0000, 0x0008, 
+	 0x0042, 0x0010, 0x0004, 0x0040, 0x0020, 0x0040, 0x0042, 0x0008, 
+	 0x0042, 0x0040, 0x0000, 0x0000, 0x0004, 0x003C, 0x0020, 0x0008, 
+	 0x004A, 0x007E, 0x0044, 0x0002, 0x0044, 0x0004, 0x0004, 0x0042, 
+	 0x0042, 0x0010, 0x0020, 0x0012, 0x0002, 0x0092, 0x0052, 0x0042, 
+	 0x0002, 0x0042, 0x000A, 0x0040, 0x0010, 0x0042, 0x0028, 0x00AA, 
+	 0x0028, 0x0010, 0x0004, 0x0008, 0x0020, 0x0010, 0x0000, 0x0000, 
+	 0x0000, 0x004C, 0x0042, 0x0002, 0x0042, 0x003E, 0x0008, 0x0042, 
+	 0x0042, 0x0010, 0x0020, 0x000A, 0x0010, 0x0092, 0x0042, 0x0042, 
+	 0x0042, 0x0042, 0x0002, 0x0038, 0x0008, 0x0042, 0x0044, 0x0092, 
+	 0x0010, 0x0024, 0x0010, 0x0008, 0x0010, 0x0010, 0x0060, 0x00A5, 
+	 0x0050, 0x00BA, 0x00BB, 0x008A, 0x0000, 0x0000, 0x00EE, 0x00EE, 
+	 0x00C4, 0x009D, 0x005C, 0x0097, 0x0072, 0x0077, 0x0097, 0x0008, 
+	 0x0000, 0x00EE, 0x00EA, 0x00EE, 0x0000, 0x00A0, 0x0024, 0x00EA, 
+	 0x0000, 0x00EE, 0x0042, 0x00EE, 0x0000, 0x0094, 0x00E0, 0x00EA, 
+	 0x0044, 0x0040, 0x00DE, 0x00DF, 0x0004, 0x0000, 0x000C, 0x0000, 
+	 0x0064, 0x0044, 0x0092, 0x0010, 0x008A, 0x0044, 0x0012, 0x0000, 
+	 0x0024, 0x00FF, 0x0081, 0x0000, 0x0021, 0x00FF, 0x0084, 0x0081, 
+	 0x0007, 0x00E0, 0x008C, 0x0031, 0x007E, 0x0094, 0x0084, 0x0008, 
+	 0x0012, 0x0004, 0x0004, 0x0010, 0x001F, 0x0010, 0x0012, 0x0004, 
+	 0x0012, 0x001C, 0x004A, 0x0022, 0x0042, 0x0000, 0x0000, 0x0000, 
+	 0x0048, 0x0020, 0x0010, 0x0040, 0x0020, 0x0010, 0x0040, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 7 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x007E, 0x007E, 
+	 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x0000, 0x0000, 0x0000, 
+	 0x0066, 0x0018, 0x000C, 0x0038, 0x00FE, 0x007E, 0x007E, 0x0030, 
+	 0x003C, 0x007C, 0x007C, 0x007E, 0x00DB, 0x0066, 0x0063, 0x0000, 
+	 0x0000, 0x0010, 0x0000, 0x0028, 0x007C, 0x0010, 0x0008, 0x0000, 
+	 0x0008, 0x0010, 0x00FE, 0x00FE, 0x0000, 0x007C, 0x0000, 0x0010, 
+	 0x0042, 0x0010, 0x0008, 0x0040, 0x00FE, 0x0040, 0x0046, 0x0010, 
+	 0x0042, 0x007C, 0x0000, 0x0000, 0x0002, 0x0000, 0x0040, 0x0010, 
+	 0x009A, 0x0042, 0x0044, 0x0002, 0x0044, 0x0004, 0x0004, 0x0072, 
+	 0x0042, 0x0010, 0x0020, 0x000A, 0x0002, 0x0092, 0x0052, 0x0042, 
+	 0x003E, 0x0042, 0x003E, 0x0040, 0x0010, 0x0042, 0x0044, 0x0092, 
+	 0x0010, 0x0010, 0x0008, 0x0008, 0x0010, 0x0010, 0x0000, 0x0000, 
+	 0x0000, 0x0070, 0x0042, 0x0002, 0x0042, 0x0042, 0x003C, 0x0042, 
+	 0x0042, 0x0010, 0x0020, 0x0012, 0x0010, 0x0092, 0x0042, 0x0042, 
+	 0x0042, 0x0042, 0x0006, 0x0004, 0x0008, 0x0042, 0x0044, 0x0092, 
+	 0x0028, 0x0044, 0x0020, 0x0004, 0x0000, 0x0020, 0x0092, 0x0085, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0015, 0x0051, 0x0091, 0x0008, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x005F, 0x005F, 0x00DE, 0x00DF, 0x0004, 0x0000, 0x000C, 0x0000, 
+	 0x0024, 0x004C, 0x0010, 0x0010, 0x008A, 0x0044, 0x0022, 0x0000, 
+	 0x0024, 0x0000, 0x0000, 0x0000, 0x0020, 0x0000, 0x0004, 0x0000, 
+	 0x000C, 0x0030, 0x0018, 0x0018, 0x007F, 0x0022, 0x0085, 0x0008, 
+	 0x0012, 0x0004, 0x0008, 0x000C, 0x0009, 0x000E, 0x000E, 0x0008, 
+	 0x000C, 0x0012, 0x004A, 0x0022, 0x0082, 0x0000, 0x0000, 0x0000, 
+	 0x0048, 0x0020, 0x0020, 0x0030, 0x0020, 0x0020, 0x0038, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 8 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x007E, 
+	 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x00A8, 0x003B, 0x0000, 
+	 0x0066, 0x0018, 0x0018, 0x0038, 0x0066, 0x003E, 0x003E, 0x0030, 
+	 0x003C, 0x007E, 0x007C, 0x007E, 0x00DB, 0x0066, 0x00C3, 0x0000, 
+	 0x0000, 0x0010, 0x0000, 0x0028, 0x0012, 0x0020, 0x0014, 0x0000, 
+	 0x0008, 0x0010, 0x0038, 0x0010, 0x0000, 0x0000, 0x0000, 0x0020, 
+	 0x0042, 0x0010, 0x0010, 0x0038, 0x0022, 0x003E, 0x003A, 0x0010, 
+	 0x003C, 0x0042, 0x0018, 0x0018, 0x0004, 0x003C, 0x0020, 0x0020, 
+	 0x00AA, 0x0042, 0x003C, 0x0002, 0x0044, 0x001C, 0x001C, 0x0002, 
+	 0x007E, 0x0010, 0x0020, 0x0006, 0x0002, 0x00AA, 0x004A, 0x0042, 
+	 0x0042, 0x0042, 0x0042, 0x003C, 0x0010, 0x0042, 0x0044, 0x0092, 
+	 0x0010, 0x0028, 0x0010, 0x0008, 0x0008, 0x0010, 0x0082, 0x0000, 
+	 0x0000, 0x0042, 0x0026, 0x0044, 0x0064, 0x0044, 0x0008, 0x0024, 
+	 0x0026, 0x0010, 0x0020, 0x0022, 0x0010, 0x0092, 0x0026, 0x0024, 
+	 0x0026, 0x0064, 0x004A, 0x0044, 0x0008, 0x0042, 0x0082, 0x0082, 
+	 0x0044, 0x0042, 0x0040, 0x0008, 0x0010, 0x0010, 0x000C, 0x0085, 
+	 0x00AF, 0x00EE, 0x0002, 0x0000, 0x0052, 0x0095, 0x000E, 0x0000, 
+	 0x0023, 0x00A9, 0x00A2, 0x000E, 0x0035, 0x0051, 0x0091, 0x0014, 
+	 0x0095, 0x00EA, 0x00EE, 0x0001, 0x0075, 0x0077, 0x0027, 0x0009, 
+	 0x0025, 0x00B9, 0x0002, 0x0000, 0x0071, 0x00E9, 0x000A, 0x0000, 
+	 0x0044, 0x0040, 0x00CC, 0x00C0, 0x0004, 0x0000, 0x000C, 0x0000, 
+	 0x0026, 0x0034, 0x0010, 0x0010, 0x008A, 0x0044, 0x0042, 0x0000, 
+	 0x0024, 0x0000, 0x0000, 0x00FF, 0x0020, 0x0000, 0x0004, 0x0000, 
+	 0x0018, 0x0018, 0x0030, 0x000C, 0x007E, 0x0022, 0x0049, 0x0008, 
+	 0x0012, 0x0004, 0x0010, 0x0010, 0x000A, 0x0002, 0x0002, 0x0008, 
+	 0x0012, 0x0012, 0x004A, 0x0022, 0x0082, 0x0000, 0x0000, 0x0000, 
+	 0x0048, 0x0020, 0x0040, 0x0040, 0x0020, 0x0040, 0x0008, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 9 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x007E, 0x007E, 0x007E, 0x007E, 0x007E, 0x00A8, 0x0008, 0x0000, 
+	 0x0066, 0x001E, 0x0030, 0x0060, 0x006C, 0x0006, 0x0006, 0x0060, 
+	 0x0066, 0x0066, 0x0000, 0x0018, 0x00DB, 0x0066, 0x00C3, 0x0000, 
+	 0x0000, 0x0010, 0x0000, 0x00FE, 0x0012, 0x0044, 0x0022, 0x0000, 
+	 0x0008, 0x0010, 0x0054, 0x0010, 0x0000, 0x0000, 0x0000, 0x0040, 
+	 0x0042, 0x0010, 0x0020, 0x0040, 0x0024, 0x0002, 0x0002, 0x0020, 
+	 0x0042, 0x0042, 0x0018, 0x0018, 0x0008, 0x0000, 0x0010, 0x0040, 
+	 0x00AA, 0x0042, 0x0044, 0x0002, 0x0044, 0x0004, 0x0004, 0x0002, 
+	 0x0042, 0x0010, 0x0020, 0x000A, 0x0002, 0x00AA, 0x004A, 0x0042, 
+	 0x0042, 0x0042, 0x0042, 0x0002, 0x0010, 0x0042, 0x0044, 0x0082, 
+	 0x0028, 0x0044, 0x0020, 0x0008, 0x0004, 0x0010, 0x0044, 0x0000, 
+	 0x0000, 0x003C, 0x001A, 0x0038, 0x0058, 0x0038, 0x0008, 0x0018, 
+	 0x001A, 0x0018, 0x0030, 0x0042, 0x0010, 0x006E, 0x001A, 0x0018, 
+	 0x001A, 0x0058, 0x0032, 0x0038, 0x003E, 0x0042, 0x0082, 0x0082, 
+	 0x0082, 0x0042, 0x007C, 0x0008, 0x0010, 0x0010, 0x0000, 0x00A5, 
+	 0x00A9, 0x00AA, 0x0022, 0x0000, 0x0052, 0x0095, 0x0008, 0x0000, 
+	 0x0025, 0x00A9, 0x00A2, 0x0022, 0x0015, 0x0051, 0x0091, 0x0014, 
+	 0x0095, 0x002A, 0x002A, 0x0001, 0x0015, 0x0054, 0x0021, 0x0029, 
+	 0x0025, 0x0089, 0x0002, 0x0000, 0x0051, 0x0029, 0x000A, 0x0000, 
+	 0x0044, 0x0040, 0x00C0, 0x00C0, 0x0004, 0x0000, 0x000F, 0x0000, 
+	 0x003C, 0x0004, 0x0010, 0x0092, 0x008A, 0x0044, 0x0082, 0x0000, 
+	 0x0024, 0x00FF, 0x0081, 0x0000, 0x0021, 0x0081, 0x0084, 0x00FF, 
+	 0x0031, 0x008C, 0x00E0, 0x0007, 0x007C, 0x0041, 0x0032, 0x0008, 
+	 0x0012, 0x0006, 0x0012, 0x0012, 0x000C, 0x0002, 0x0002, 0x0010, 
+	 0x0012, 0x0012, 0x004B, 0x0033, 0x0093, 0x0000, 0x0000, 0x0000, 
+	 0x0048, 0x0030, 0x0048, 0x0048, 0x0030, 0x0048, 0x0008, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 10 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x007E, 0x007E, 0x007E, 0x007E, 0x0098, 0x0009, 0x0000, 
+	 0x007E, 0x001C, 0x0066, 0x0066, 0x0078, 0x0006, 0x000E, 0x0066, 
+	 0x0066, 0x0066, 0x0000, 0x0018, 0x00DB, 0x0077, 0x00DB, 0x0000, 
+	 0x0000, 0x0010, 0x0000, 0x0028, 0x0092, 0x008A, 0x0022, 0x0004, 
+	 0x0008, 0x0010, 0x0092, 0x0010, 0x0000, 0x0000, 0x0000, 0x0080, 
+	 0x0042, 0x0014, 0x0040, 0x0040, 0x0028, 0x0002, 0x0002, 0x0020, 
+	 0x0042, 0x0042, 0x0000, 0x0000, 0x0010, 0x0000, 0x0008, 0x0042, 
+	 0x0092, 0x0024, 0x0044, 0x0002, 0x0044, 0x0004, 0x0004, 0x0002, 
+	 0x0042, 0x0010, 0x0020, 0x0012, 0x0002, 0x00C6, 0x0046, 0x0042, 
+	 0x0042, 0x0042, 0x0042, 0x0002, 0x0010, 0x0042, 0x0082, 0x0082, 
+	 0x0028, 0x0044, 0x0020, 0x0008, 0x0002, 0x0010, 0x0028, 0x0000, 
+	 0x0020, 0x0000, 0x0002, 0x0000, 0x0040, 0x0000, 0x0048, 0x0000, 
+	 0x0002, 0x0000, 0x0000, 0x0002, 0x0010, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0008, 0x0010, 0x0010, 0x0000, 0x0099, 
+	 0x006D, 0x00AA, 0x004E, 0x0000, 0x0032, 0x00D7, 0x00EE, 0x0000, 
+	 0x0055, 0x00ED, 0x00AA, 0x0042, 0x0075, 0x0071, 0x00D7, 0x0015, 
+	 0x00D7, 0x002E, 0x00AA, 0x0001, 0x0033, 0x0057, 0x0021, 0x004D, 
+	 0x0035, 0x0099, 0x0039, 0x0000, 0x0057, 0x002D, 0x000E, 0x0000, 
+	 0x0040, 0x0040, 0x00E0, 0x00E0, 0x0005, 0x0000, 0x000E, 0x0000, 
+	 0x0064, 0x0004, 0x0010, 0x007C, 0x008A, 0x0044, 0x0082, 0x0000, 
+	 0x0024, 0x0000, 0x00C3, 0x0000, 0x0023, 0x00C3, 0x00C4, 0x0000, 
+	 0x0023, 0x00C4, 0x0000, 0x0000, 0x0078, 0x0041, 0x0002, 0x007F, 
+	 0x000C, 0x0004, 0x000C, 0x000C, 0x0008, 0x000E, 0x000C, 0x001F, 
+	 0x000C, 0x000C, 0x0032, 0x0022, 0x0062, 0x0000, 0x0000, 0x0000, 
+	 0x0030, 0x0020, 0x0030, 0x0030, 0x0020, 0x0030, 0x0038, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 11 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x007E, 0x007E, 0x007E, 0x00A8, 0x0008, 0x0000, 
+	 0x003C, 0x0018, 0x007E, 0x007E, 0x0070, 0x003E, 0x003C, 0x007E, 
+	 0x007E, 0x007E, 0x0000, 0x0000, 0x00FB, 0x0077, 0x00FB, 0x0000, 
+	 0x0000, 0x0010, 0x0028, 0x0028, 0x007C, 0x0004, 0x001C, 0x0008, 
+	 0x0010, 0x0008, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0024, 0x0018, 0x0042, 0x0042, 0x0030, 0x0002, 0x0004, 0x0042, 
+	 0x0042, 0x0042, 0x0000, 0x0000, 0x0020, 0x0000, 0x0004, 0x0042, 
+	 0x0044, 0x0024, 0x0044, 0x0042, 0x0044, 0x0044, 0x0044, 0x0042, 
+	 0x0042, 0x0010, 0x0020, 0x0022, 0x0002, 0x00C6, 0x0046, 0x0042, 
+	 0x0042, 0x0042, 0x0042, 0x0042, 0x0092, 0x0042, 0x0082, 0x0082, 
+	 0x0044, 0x0082, 0x0042, 0x0008, 0x0000, 0x0010, 0x0010, 0x0000, 
+	 0x0010, 0x0000, 0x0002, 0x0000, 0x0040, 0x0000, 0x0030, 0x0000, 
+	 0x0002, 0x0010, 0x0020, 0x0002, 0x0010, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0008, 0x0010, 0x0010, 0x0000, 0x0042, 
+	 0x00A1, 0x00AA, 0x008A, 0x0000, 0x0052, 0x00B5, 0x0002, 0x0000, 
+	 0x0055, 0x00AB, 0x00B6, 0x0082, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x00B5, 0x002A, 0x002A, 0x0000, 0x0015, 0x0051, 0x0021, 0x008B, 
+	 0x002D, 0x0089, 0x0002, 0x0000, 0x0055, 0x002B, 0x000A, 0x0000, 
+	 0x0060, 0x0060, 0x00E0, 0x00E0, 0x0006, 0x0000, 0x000C, 0x0000, 
+	 0x0024, 0x0004, 0x0010, 0x0038, 0x0053, 0x0066, 0x008B, 0x0000, 
+	 0x0024, 0x0000, 0x0066, 0x0000, 0x0026, 0x0066, 0x0064, 0x0000, 
+	 0x0026, 0x0064, 0x0000, 0x0000, 0x0070, 0x0000, 0x0000, 0x003E, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 12 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x007E, 0x007E, 0x00B8, 0x003B, 0x0000, 
+	 0x0018, 0x0010, 0x003C, 0x003C, 0x0060, 0x003E, 0x0038, 0x007E, 
+	 0x003C, 0x003C, 0x0000, 0x0000, 0x0073, 0x0066, 0x0073, 0x0000, 
+	 0x0000, 0x0010, 0x0028, 0x0000, 0x0010, 0x0000, 0x0000, 0x0018, 
+	 0x0010, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0018, 0x0010, 0x003C, 0x003C, 0x0020, 0x003E, 0x0038, 0x007E, 
+	 0x003C, 0x003C, 0x0000, 0x0000, 0x0040, 0x0000, 0x0002, 0x003C, 
+	 0x0038, 0x0018, 0x003E, 0x003C, 0x003E, 0x007E, 0x007E, 0x003C, 
+	 0x0042, 0x007C, 0x0070, 0x0042, 0x0002, 0x0082, 0x0042, 0x003C, 
+	 0x003E, 0x003C, 0x003E, 0x003C, 0x00FE, 0x0042, 0x0082, 0x0082, 
+	 0x00C6, 0x0082, 0x007E, 0x0008, 0x0000, 0x0010, 0x0000, 0x0000, 
+	 0x0018, 0x0000, 0x0002, 0x0000, 0x0040, 0x0000, 0x0000, 0x0000, 
+	 0x0002, 0x0000, 0x0000, 0x0002, 0x0018, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0030, 0x0010, 0x000C, 0x0000, 0x003C, 
+	 0x00EF, 0x00AE, 0x000E, 0x0000, 0x0077, 0x0092, 0x000E, 0x0000, 
+	 0x0053, 0x0049, 0x00A2, 0x000E, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0092, 0x0024, 0x00EE, 0x0001, 0x0077, 0x0077, 0x0071, 0x0009, 
+	 0x00A5, 0x00BB, 0x0003, 0x0000, 0x0057, 0x00E9, 0x000A, 0x0000, 
+	 0x0040, 0x0040, 0x00C0, 0x00C0, 0x0004, 0x0000, 0x0008, 0x0000, 
+	 0x0020, 0x0004, 0x0010, 0x0010, 0x0022, 0x0044, 0x0072, 0x0000, 
+	 0x0024, 0x0000, 0x0024, 0x0000, 0x0024, 0x0024, 0x0024, 0x0000, 
+	 0x0024, 0x0024, 0x0000, 0x0000, 0x0060, 0x0000, 0x0000, 0x001C, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	},
+
+	{	/* Scan line 13 */
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x007E, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0028, 0x0000, 0x0000, 0x0000, 0x0000, 0x0018, 
+	 0x0020, 0x0004, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0078, 0x0000, 0x001E, 0x0000, 0x0000, 
+	 0x0018, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0024, 0x0000, 0x0024, 0x0000, 0x0024, 0x0024, 0x0024, 0x0000, 
+	 0x0024, 0x0024, 0x0000, 0x0000, 0x0040, 0x0000, 0x0000, 0x0008, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
+	 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	}
+};
Index: vlib/glcinit.c
===================================================================
--- vlib/glcinit.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/glcinit.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,338 @@
+/*
+   =============================================================================
+	glcinit.c -- LCD drivers for the Epson GLC controller chip
+	Version 5 -- 1988-08-03 -- D.N. Lynx Crowe
+	(c) Copyright 1987, 1988 -- D.N. Lynx Crowe
+
+	GLCinit()
+
+		Initializes the GLC.
+
+	unsigned
+	GLCcrc(row, col)
+	unsigned row, col;
+
+		Positions the GLC cursor at ('row', 'col') preparatory
+		to writing text.  Returns the calculated cursor address.
+
+	unsigned
+	GLCcxy(x, y)
+	unsigned x, y;
+
+		Positions the GLC cursor at ('x', 'y') preparatory to
+		writing graphics.  Returns a bit mask for the pixel.
+		Leaves the cursor address in lcdcurs.
+		Limits:  0 LE x LE 511,  0 LE y LE 63.
+
+	GLCwrts(s)
+	char *s;
+
+		Writes the character string pointed to by 's' at the
+		current cursor position on the LCD display.
+		Cursor must start and end on the same line.
+		No error checks are done.
+
+	GLCtext(row, col, s)
+	unsigned row, col;
+	char *s;
+
+		Sets the GLC cursor to ('row', 'col'), then writes the
+		character string pointed to by 's'.
+		Cursor must start and end on the same line.
+		No error checks are done.
+
+
+	GLCdisp(dsp, crs, blk1, blk2, blk3)
+	short dsp, crs, blk1, blk2, blk3;
+
+		Sets the overall display, cursor and block status values.
+
+	GLCcurs(crs)
+	short crs;
+
+		Turns the cursor on or off.
+   =============================================================================
+*/
+
+/* 
+
+*/
+
+#include "stddefs.h"
+#include "hwdefs.h"
+#include "glcdefs.h"
+
+unsigned	lcdbase;	/* LCD graphics base address */
+unsigned	lcdbit;		/* LCD graphics pixel bit mask */
+unsigned	lcdcol;		/* LCD text column */
+unsigned	lcdctl1;	/* LCD display control -- command */
+unsigned	lcdctl2;	/* LCD display control -- data */
+unsigned	lcdcurs;	/* LCD graphics pixel byte address */
+unsigned	lcdrow;		/* LCD text row */
+unsigned	lcdx;		/* LCD graphics x */
+unsigned	lcdy;		/* LCD graphics y */
+
+/* GLC initialization values */
+
+char glc_is1[] = { 0x12, 0x05, 0x07, 0x54, 0x58, 0x3F, 0x55, 0x00 };
+char glc_is2[] = { 0x00, 0x00, 0x3F, 0x00, 0x20, 0x3F, 0x00, 0x00 };
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	GLCdisp(dsp, crs, blk1, blk2, blk3) -- set GLC display status
+	Sets the overall display, cursor and block status values.
+   =============================================================================
+*/
+
+GLCdisp(dsp, crs, blk1, blk2, blk3)
+short dsp, crs, blk1, blk2, blk3;
+{
+	register short val;
+
+	val = ((blk3 & 3) << 6) | ((blk2 & 3) << 4) | ((blk1 & 3) << 2) |
+		(crs & 3);
+
+	lcdctl1 = G_DSPCTL | (dsp & 1);
+	lcdctl2 = val;
+
+	LCD_WC = lcdctl1;
+	LCD_WD = lcdctl2;
+
+}
+
+/*
+   =============================================================================
+	GLCcurs() -- turns the cursor on or off
+   =============================================================================
+*/
+
+GLCcurs(crs)
+short crs;
+{
+	lcdctl2 = (crs & 3) | (lcdctl2 & ~3);
+
+	LCD_WC = lcdctl1;
+	LCD_WD = lcdctl2;
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	GLCinit() -- initialize GLC
+	Initializes the GLC.
+   =============================================================================
+*/
+
+GLCinit()
+{
+	register int	i;
+	register long ic;
+	register char *gp;
+
+	lcdbase = G_PLANE2;	/* set defaults for graphics variables */
+	lcdx = 0;
+	lcdy = 0;
+	lcdbit = 0x01;
+
+	lcdrow = 0;		/* set default for text variables */
+	lcdcol = 0;
+
+	lcdctl1 = G_DSPCTL;
+	lcdctl2 = 0;
+
+	LCD_WC = G_INIT;	/* initialize the GLC */
+	gp = &glc_is1[0];
+
+	for (i = 0; i < 8; i++)
+		LCD_WD= *gp++;
+
+	LCD_WC = G_SETSAD;	/* setup scroll registers */
+	gp = &glc_is2[0];
+
+	for (i = 0; i < 8; i++)
+		LCD_WD = *gp++;
+
+	LCD_WC = G_HSCRL;	/* clear the horizontal scroll counter */
+	LCD_WD = 0;
+
+	LCD_WC = G_OVRLAY;	/* setup the display mode */
+	LCD_WD = 0x08;
+
+	GLCdisp(G_OFF, G_B2, G_ON, G_ON, G_OFF);
+
+/* 
+
+*/
+	LCD_WC = G_CRSWR;	/* set cursor at (0,0) in G_PLANE1 */
+	LCD_WD = G_PLANE1 & 0xFF;
+	LCD_WD = (G_PLANE1 >> 8) & 0xFF;
+
+	LCD_WC = G_CRSMRT;	/* set cursor motion forward */
+
+	LCD_WC = G_MWRITE;	/* write zeros to GLC RAM */
+
+	for (ic = 0; ic < 65536L; ic++)
+		LCD_WD = 0;
+
+	LCD_WC = G_CRSWR;	/* set cursor to (0,0) in G_PLANE1 */
+	LCD_WD = G_PLANE1 & 0xFF;
+	LCD_WD = (G_PLANE1 >> 8) & 0xFF;
+
+	LCD_WC = G_CRSFRM;	/* setup a blinking underline cursor */
+	LCD_WD = 0x04;
+	LCD_WD = 0x06;
+
+	/* enable display */
+
+	GLCdisp(G_ON, G_B2, G_ON, G_ON, G_OFF);
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	GLCcrc(row, col) -- position GLC text cursor
+	Positions the GLC cursor at ('row', 'col') preparatory
+	to writing text.  Returns calculated cursor address.
+   =============================================================================
+*/
+
+unsigned
+GLCcrc(row, col)
+unsigned row, col;
+{
+	unsigned curad;
+
+	curad = col + (row * 85);	/* calculate cursor location */
+
+	LCD_WC = G_CRSWR;		/* send cursor address to GLC */
+	LCD_WD = curad & 0xFF;
+	LCD_WD = (curad >> 8) & 0xFF;
+
+	lcdrow = row;			/* set text cursor variables */
+	lcdcol = col;
+
+	return(curad);			/* return calculated cursor address */
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	GLCcxy(x, y) -- position GLC graphics cursor
+	Positions the GLC cursor at ('x', 'y') preparatory to
+	writing graphics.  Returns a bit mask for the pixel.
+	Leaves cursor address in lcdcurs.
+	Limits:  0 LE x LE 511,  0 LE y LE 63.
+   =============================================================================
+*/
+
+unsigned
+GLCcxy(x, y)
+register unsigned x, y;
+{
+	register unsigned curad, xby6;
+
+	/* calculate cursor address */
+
+	xby6 = x % 6;
+	curad = lcdbase + (85 * (63 - y)) + (x / 6) + (xby6 >> 3);
+	lcdcurs = curad;
+
+	/* send cursor address to GLC */
+
+	LCD_WC = G_CRSWR;
+	LCD_WD = curad & 0xFF;
+	LCD_WD = (curad >> 8) & 0xFF;
+
+	/* set graphics variables */
+
+	lcdx = x;
+	lcdy = y;
+
+	/* calculate bit mask */
+
+	lcdbit = 0x01 << (xby6 & 0x07);
+
+	return(lcdbit);
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	GLCwrts(s) -- write text string to GLC
+	Writes the character string pointed to by 's' at the
+	current cursor position on the LCD display.
+	Cursor must start and end on the same line.
+	No error checks are done.
+   =============================================================================
+*/
+
+GLCwrts(s)
+register char *s;
+{
+	LCD_WC = G_CRSMRT;	/* set cursor motion =  right */
+
+	LCD_WC = G_MWRITE;	/* set to write data */
+
+	while (*s) {		/* write string to GLC */
+
+		LCD_WD = *s++;
+		lcdcol++;	/* keep column variable up to date */
+	}
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	GLCtext(row, col, s) -- position GLC cursor and write text
+	Sets the GLC cursor to ('row', 'col'), then writes the
+	character string pointed to by 's'.
+	Cursor must start and end on the same line.
+	No error checks are done.
+   =============================================================================
+*/
+
+GLCtext(row, col, s)
+register unsigned row, col;
+register char *s;
+{
+	register unsigned curad;
+
+	curad = col + (row * 85);	/* calculate cursor address */
+
+	LCD_WC = G_CRSWR;		/* send cursor address to GLC */
+	LCD_WD = curad & 0xFF;
+	LCD_WD = (curad >> 8) & 0xFF;
+
+	lcdrow = row;			/* set GLC text cursor variables */
+	lcdcol = col;
+
+	LCD_WC = G_CRSMRT;		/* set cursor motion = right */
+
+	LCD_WC = G_MWRITE;		/* set to write data */
+
+	while (*s) {			/* write string to GLC */
+
+		LCD_WD = *s++;
+		lcdcol++;		/* keep cursor column up to date */
+	}
+}
+
Index: vlib/glcplot.s
===================================================================
--- vlib/glcplot.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/glcplot.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,68 @@
+* ------------------------------------------------------------------------------
+* glcplot.s -- plot a pixel on the LCD display
+* Version 2 -- 1987-04-23 -- D.N. Lynx Crowe
+* (c) Copyright 1987 -- D.N. Lynx Crowe
+*
+*	GLCplot(x, y, val)
+*	unsigned x, y, val);
+*
+*		Plot a pixel at ('x', 'y') using lcdbase as the plane address
+*		in GLC RAM.  If 'val' is zero, the pixel is cleared,
+*		otherwise the pixel is cleared.  No error checking is done.
+*		Limits:  0 LE x LE 511,  0 LE y LE 63.
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_GLCplot
+		.xref	_lcd_a0,_lcd_a1,_lcdbase
+*
+XLOC		.equ	8			* 'x' parameter offset
+YLOC		.equ	10			* 'y' parameter offset
+VAL		.equ	12			* 'val' parameter offset
+*
+G_CRSWR		.equ	$46			* GLC set cursor command
+G_MWRITE	.equ	$42			* GLC write command
+G_MREAD		.equ	$43			* GLC read command
+*
+		.page
+*
+_GLCplot:	link	a6,#0			* Link stack frames
+		moveq	#63,d0			* d0 = (63-y) * 85
+		sub.w	YLOC(a6),d0		* ...
+		mulu	#85,d0			* ...
+		clr.l	d1			* d1 = x/6
+		move.w	XLOC(a6),d1		* ...
+		divu	#6,d1			* ...
+		add.w	d1,d0			* d0 = (63-y)*85 + (x/6)
+		swap	d1			* d2 = 7 - (x%6) % 8
+		moveq	#7,d2			* ...
+		sub.w	d1,d2			* ...
+		andi.w	#7,d2			* ...
+		lsr.w	#3,d1			* d1 = (x%6) / 8
+		add.w	d1,d0			* d0 = cursor address
+		add.w	_lcdbase,d0		* ...
+		move.w	d0,d1			* d1 = cursor address, too
+		move.b	#G_CRSWR,_lcd_a1	* Send cursor address to GLC
+		move.b	d0,_lcd_a0		* ...
+		lsr.w	#8,d0			* ...
+		move.b	d0,_lcd_a0		* ...
+		move.b	#G_MREAD,_lcd_a1	* Read old pixel byte
+		move.b	_lcd_a1,d0		* ... into d0
+		tst.w	VAL(a6)			* Check val for zero
+		beq	glcplt1			* Jump if val EQ 0
+*
+		bset	d2,d0			* Set the pixel to 1
+		bra	glcplt2			* Go write pixel to GLC
+*
+glcplt1:	bclr	d2,d0			* Clear the pixel to 0
+*
+glcplt2:	move.b	#G_CRSWR,_lcd_a1	* Send cursor address to GLC
+		move.b	d1,_lcd_a0		* ...
+		lsr.w	#8,d1			* ...
+		move.b	d1,_lcd_a0		* ...
+		move.b	#G_MWRITE,_lcd_a1	* Setup GLC to write pixel
+		move.b	d0,_lcd_a0		* Write pixel
+		unlk	a6			* Unlink stack frames
+		rts				* Return to caller
+*
+		.end
Index: vlib/lseg.c
===================================================================
--- vlib/lseg.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/lseg.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,93 @@
+/*
+   ===========================================================================
+	LSEG.C -- Generalized line drawing function  (Integer DDA algorithm)
+	Version 6 -- 1987-08-04 -- D.N. Lynx Crowe
+	Copyright 1985, 1986, 1987 -- D.N. Lynx Crowe
+   ===========================================================================
+*/
+
+short	(*point)();
+
+#define	ABS(x)	((x) < 0 ? (-(x)) : (x))
+#define	SIGN(x)	((x) < 0 ? (-1) : ((x) ? 1 : 0))
+
+#define	LE	<=
+
+/*
+   =============================================================================
+	lseg(x1, y1, x2, y2, t) -- draw a line from ('x1', 'y1') to ('x2', 'y2')
+	in drawing mode 't'.
+
+	All coordinates are short integers in whatever plotting units the
+	'point' function expects.  No clipping or scaling is done, as this is
+	the lowest level 'line' primitive in the drawing code, and coordinates
+	are expected to have already been checked and found to be on screen. 
+
+	The 'point' variable must be initialized to point at the
+	pixel plotting function before this function is called.  The pixel
+	plotting function is passed 3 arguments:  the x coordinate, the y
+	coordinate, and the plotting mode.  It is declared here as type 'short',
+	but any value it returns will be ignored.
+
+	The register variable assignments were chosen based on the Alcyon C
+	compiler for the Atari 1040ST and reflect the capabilities of that
+	compiler.  Other compilers may require different optimizations based
+	on their use of register variables.
+   =============================================================================
+*/
+
+/* 
+
+*/
+
+lseg(x1, y1, x2, y2, t)
+short x1, y1, x2, y2, t;
+{
+	register short dx, dy, ptx, pty, p;
+	short i, px, py;
+
+	p = x2 - (ptx = x1);
+	dx = SIGN(p);
+	py = ABS(p);
+
+	p = y2 - (pty = y1);
+	dy = SIGN(p);
+	px = ABS(p);
+
+	(*point)(ptx, pty, t);
+
+	if (py > px) {
+
+		p = py >> 1;
+
+		for (i = 1; i < py; i++) {
+
+			ptx += dx;
+
+			if ( (p -= px) < 0) {
+
+				pty += dy;
+				p += py;
+			}
+
+			(*point)(ptx, pty, t);
+		}
+
+	} else {
+
+		p = px >> 1;
+
+		for (i = 1; i LE px; i++) {
+
+			pty += dy;
+
+			if ( (p -= py) < 0) {
+
+				ptx += dx;
+				p += px;
+			}
+
+			(*point)(ptx, pty, t);
+		}
+	}
+}
Index: vlib/tsplot4.s
===================================================================
--- vlib/tsplot4.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/tsplot4.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,154 @@
+* ------------------------------------------------------------------------------
+* tsplot4.s -- output characters to a 4-bit / pixel graphics window
+*    with variable vertical pitch
+* Version 1 -- 1987-08-04 -- D.N. Lynx Crowe
+* (c) Copyright 1987 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+*
+*	tsplot4(obase, nw, fg, row, col, str. pitch)
+*	int *obase, nw, fg, row, col, pitch;
+*	char *str;
+*
+*		Outputs characters from the string at 'str' to an 'nw'
+*		character wide 4-bit per pixel graphics window at 'obase'
+*		at ('row','col'), using 'fg' as the foreground color.
+*		Uses cgtable[][256] as the VSDD formatted character
+*		generator table.  Assumes 12 bit high characters in the
+*		cgtable.  Uses 'pitch' as the vertical spacing between
+*		character rows.  No error checks are done.
+*		The string must fit the output area (no overlaps, single line).
+*
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_tsplot4
+*
+		.xref	_cgtable
+*
+* Argument offsets from a6:
+*
+OBASE		.equ	8		* LONG - Output area base address
+NW		.equ	12		* WORD - Character width of output area
+FG		.equ	14		* WORD - Foreground color
+ROW		.equ	16		* WORD - Row
+COL		.equ	18		* WORD - Column
+STR		.equ	20		* LONG - String base address
+PITCH		.equ	24		* WORD - Vertical spacing between rows
+*
+* Program constant definitions:
+*
+HPIX		.equ	8		* Character width in pixels
+VPIX		.equ	12		* Character height in pixels
+HCW		.equ	4		* Horizontal character width (bytes)
+PSHIFT		.equ	12		* Pixel shift into MS bits
+HSHIFT		.equ	4		* Pixel right shift
+*
+		.page
+*
+* Register usage:
+*
+*	d0	output word and scratch
+*	d1	CG word and scratch
+*	d2	pixel counter
+*
+*	d3	foreground color (in the 4 ms bits)
+*	d4	background color (in the 4 ms bits)
+*	d5	width of the area in bytes
+*	d6	scan line counter
+*
+*	a0	CG table pointer
+*	a1	output area scan line pointer
+*	a2	input string character pointer
+*
+*	a3	output area character base pointer
+*
+*	a6	frame pointer
+*	a7	stack pointer
+*
+		.page
+*
+_tsplot4:	link	a6,#0		* Link stack frames
+		movem.l	d3-d6/a3,-(a7)	* Save registers we use
+		move.w	#PSHIFT,d1	* Set shift constant
+		move.w	FG(a6),d3	* Setup foreground color
+		lsl.w	d1,d3		* ... in ms 4 bits of d3.W
+		move.w	NW(a6),d5	* Get line width in d5.W
+		lsl.w	#2,d5		* Multiply width by 4 for offset
+		move.w	ROW(a6),d0	* Calculate output address
+		move.w	PITCH(a6),d1	* ... PITCH
+		mulu	d1,d0		* ... * ROW
+		add.w	#VPIX-1,d0	* ... + VPIX-1
+		mulu	d5,d0		* ... * NW
+		clr.l	d1		* ...
+		move.w	COL(a6),d1	* ... + 
+		lsl.w	#2,d1		* ... COL * 4
+		add.l	d1,d0		* ...
+		add.l	OBASE(a6),d0	* ... + OBASE
+		movea.l	d0,a3		* Leave output address in a3
+		movea.l	STR(a6),a2	* Put string address in a2
+*
+cgl0:		clr.l	d0		* Clear out upper bits of d0
+		move.b	(a2)+,d0	* Get next character
+		beq	cgl5		* Done if character EQ 0
+*
+		movea.l	a3,a1		* Establish output pointer in a1
+		adda.l	#HCW,a3		* Update output pointer for next char.
+		lea	_cgtable,a0	* Establish CG pointer in a0
+		lsl.w	#1,d0		* ... 2 * character
+		adda.w	d0,a0		* ... + _cgtable address
+		move.w	#VPIX-1,d6	* Set scan line counter in d6
+*
+		.page
+cgl1:		move.w	(a0),d1		* Get character generator word in d1
+		move.w	#(HPIX/2)-1,d2	* Set pixel counter in d2
+		clr.l	d4		* Get old output word as background
+		move.w	(a1),d4		* ...
+		swap	d4		* ...
+*
+cgl2:		lsr.w	#HSHIFT,d0	* Shift output word right 1 pixel
+		lsr.l	#HSHIFT,d4	* Shift background word 1 pixel
+		andi.l	#$FFFFF000,d4	* Mask for upper 4 bits of d4.W
+		btst.l	#0,d1		* Check CG word ls bit
+		beq	cgl3		* Set background color if bit EQ 0
+*
+		or.w	d3,d0		* OR foreground color into output word
+		bra	cgl4		* Go update CG word
+*
+cgl3:		or.w	d4,d0		* OR background color into output word
+*
+cgl4:		lsr.w	#1,d1		* Shift CG word right 1 pixel
+		dbf	d2,cgl2		* Loop for first 4 pixels
+*
+		move.w	d0,(a1)+	* Store first output word in scan line
+		move.w	#(HPIX/2)-1,d2	* Set pixel counter in d2
+		clr.l	d4		* Get old output word as background
+		move.w	(a1),d4		* ...
+		swap	d4		* ...
+*
+cgl2a:		lsr.w	#HSHIFT,d0	* Shift output word right 1 pixel
+		lsr.l	#HSHIFT,d4	* Shift background word 1 pixel
+		andi.l	#$FFFFF000,d4	* Mask for upper bits of d4.W
+		btst.l	#0,d1		* Check CG word ls bit
+		beq	cgl3a		* Set background color if bit EQ 0
+*
+		or.w	d3,d0		* OR foreground color into output word
+		bra	cgl4a		* Go update CG word
+*
+cgl3a:		or.w	d4,d0		* OR background color into output word
+*
+cgl4a:		lsr.w	#1,d1		* Shift CG word right 1 pixel
+		dbf	d2,cgl2a	* Loop for last 4 pixels
+*
+		move.w	d0,(a1)		* Store second output word in scan line
+		suba.w	d5,a1		* Update output pointer
+		suba.w	#2,a1		* ...
+		adda.l	#512,a0		* Update CG pointer for next scan line
+		dbf	d6,cgl1		* Loop for all scan lines
+*
+		bra	cgl0		* Loop for next character
+*
+cgl5:		movem.l	(a7)+,d3-d6/a3	* Restore registers
+		unlk	a6		* Unlink stack frames
+		rts			* Return to caller
+*
+		.end
Index: vlib/vbank.s
===================================================================
--- vlib/vbank.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vbank.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,112 @@
+* ------------------------------------------------------------------------------
+* vbank.s -- VSDD bank switching control functions
+* Version 3 -- 1989-12-19 -- D.N. Lynx Crowe
+*
+*	unsigned
+*	vbank(b)
+*	unsigned b;
+*
+*		Set VSDD Data Segment bank to b.
+*		Return old bank select value.
+*
+*
+*	vfwait()
+*
+*		Wait for a FRAMESTOP update to transpire.
+* ------------------------------------------------------------------------------
+		.xdef	_vbank
+		.xdef	_vfwait
+*
+		.xref	_v_regs
+*
+		.text
+*
+B		.equ	8
+*
+OLDB		.equ	d6
+NEWB		.equ	d7
+*
+VSDD_R5		.equ	10
+VSDD_R11	.equ	22
+*
+VT_BASE		.equ	128		* word offset of VSDD Access Table
+*
+VT_1		.equ	VT_BASE+300	* high time
+VT_2		.equ	VT_BASE+2	* low time
+*
+		.page
+* ------------------------------------------------------------------------------
+*	vbank(b) -- change VSDD Data Segment bank to b.  Return old bank.
+*	Assumes a 128K byte window, sets S15..S11 to zero.
+* ------------------------------------------------------------------------------
+*
+
+_vbank:		link	a6,#0			* link stack frames
+		movem.l	d5-d7,-(sp)		* preserve registers
+		move.w	_v_regs+VSDD_R5,OLDB	* get v_regs[5]
+		lsr.w	#6,OLDB			* extract BS bits
+		move.w	OLDB,d0			* ...
+		andi.w	#2,d0			* ...
+		move.w	OLDB,d1			* ...
+		lsr.w	#2,d1			* ...
+		andi.w	#1,d1			* ...
+		or.w	d1,d0			* ...
+		move.w	d0,OLDB			* ...
+		cmp.w	B(a6),OLDB		* see if they're what we want
+		bne	L2			* jump if not
+*
+		move.w	B(a6),d0		* setup to return b
+		bra	L1
+*
+L2:		move.w	B(a6),NEWB		* get bank bits from b
+		lsl.w	#6,NEWB			* shift bits from b into BS bits
+		move.w	NEWB,d0			* ...
+		andi.w	#128,d0			* ...
+		lsl.w	#2,NEWB			* ...
+		andi.w	#256,NEWB		* ...
+		or.w	NEWB,d0			* ...
+		move.w	d0,_v_regs+VSDD_R5	* set v_regs[5] with new BS bits
+*
+vw1b:		cmp.w	#VT_1,_v_regs+VSDD_R11	* wait for FRAMESTOP
+		bcc	vw1b			* ...
+*
+vw2b:		cmp.w	#VT_1,_v_regs+VSDD_R11	* ...
+		bcs	vw2b			* ...
+*
+vw3b:		cmp.w	#VT_1,_v_regs+VSDD_R11	* ...
+		bcc	vw3b			* ...
+*
+vw4b:		cmp.w	#VT_2,_v_regs+VSDD_R11	* ...
+		bcs	vw4b			* ...
+*
+		move.w	OLDB,d0			* setup to return OLDB
+*
+L1:		tst.l	(sp)+			* fixup stack
+		movem.l	(sp)+,OLDB-NEWB		* restore registers
+		unlk	a6			* unlink stack frames
+		rts				* return to caller
+*
+		.page
+*
+* ------------------------------------------------------------------------------
+*	vfwait() -- Wait for a FRAMESTOP update to transpire.
+* ------------------------------------------------------------------------------
+*
+_vfwait:	link	a6,#0			* link stack frames
+*
+vw1a:		cmp.w	#VT_1,_v_regs+VSDD_R11	* wait for FRAMESTOP
+		bcc	vw1a			* ...
+*
+vw2a:		cmp.w	#VT_1,_v_regs+VSDD_R11	* ...
+		bcs	vw2a			* ...
+*
+vw3a:		cmp.w	#VT_1,_v_regs+VSDD_R11	* ...
+		bcc	vw3a			* ...
+*
+vw4a:		cmp.w	#VT_2,_v_regs+VSDD_R11	* ...
+		bcs	vw4a			* ...
+*
+		unlk	a6			* unlink stack frames
+		rts				* return to caller
+*
+		.end
Index: vlib/vbfill4.c
===================================================================
--- vlib/vbfill4.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vbfill4.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,266 @@
+/*
+   =============================================================================
+	vbfill4.c -- video block fill blitter for 4 bit per pixel objects
+	Version 3 -- 1987-08-04 -- D.N. Lynx Crowe
+
+	Fills an area with a color.  Coded for speed, not space.
+   =============================================================================
+*/
+
+static short	fm[] = {	/* fill masks */
+
+	0x000F,
+	0x00FF,
+	0x0FFF,
+	0xFFFF,
+
+	0x00F0,
+	0x0FF0,
+	0xFFF0,
+
+	0x0F00,
+	0xFF00,
+
+	0xF000
+};
+
+/* 
+
+*/
+
+vbfill4(obj, obwidth, xmin, ymin, xmax, ymax, color)
+unsigned *obj;
+short obwidth, xmin, ymin, xmax, ymax;
+register unsigned color;
+{
+	short mw, nl, width;
+
+	register unsigned *fwp, *wp;
+
+	register unsigned lmask, rmask;
+	register short i, j;
+
+	fwp = obj + (long)(xmin >> 2) + ((long)ymin * obwidth);
+	width = xmax - xmin + 1;
+	nl = ymax - ymin + 1;
+	lmask = rmask = 0;
+
+/* 
+
+*/
+	switch (xmin & 3) {
+
+	case 0:
+
+		if (width > 4) {
+
+			width -= 5;
+			lmask = fm[3];
+			mw = width >> 2;
+
+			if (mw) {
+
+				rmask = fm[width & 3];
+
+				for (i = 0; i < nl; i++) {
+
+					wp = fwp;
+					fwp += obwidth;
+					*wp++ = (*wp & ~lmask) | (color & lmask);
+
+					for (j = 0; j < mw; j++)
+						*wp++ = color;
+
+					*wp = (*wp & ~rmask) | (color & rmask);
+				}
+
+			} else {
+
+				rmask = fm[width & 3];
+
+				for (i = 0; i < nl; i++) {
+
+					wp = fwp;
+					fwp += obwidth;
+					*wp++ = (*wp & ~lmask) | (color & lmask);
+					*wp = (*wp & ~rmask) | (color & rmask);
+				}
+			}
+
+		} else {
+
+			lmask = fm[width - 1];
+
+			for (i = 0; i < nl; i++)  {
+
+				wp = fwp;
+				fwp += obwidth;
+				*wp = (*wp & ~lmask) | (color & lmask);
+			}
+		}
+
+		return;
+
+/* 
+
+*/
+	case 1:
+
+		if (width > 3) {
+
+			width -= 4;
+			lmask = fm[6];
+			mw = width >> 2;
+
+			if (mw) {
+
+				rmask = fm[width & 3];
+
+				for (i = 0; i < nl; i++) {
+
+					wp = fwp;
+					fwp += obwidth;
+					*wp++ = (*wp & ~lmask) | (color & lmask);
+
+					for (j = 0; j < mw; j++)
+						*wp++ = color;
+
+					*wp = (*wp & ~rmask) | (color & rmask);
+				}
+
+			} else {
+
+				rmask = fm[width & 3];
+
+				for (i = 0; i < nl; i++) {
+
+					wp = fwp;
+					fwp += obwidth;
+					*wp++ = (*wp & ~lmask) | (color & lmask);
+					*wp = (*wp & ~rmask) | (color & rmask);
+				}
+			}
+
+		} else {
+
+			lmask = fm[width + 3];
+
+			for (i = 0; i < nl; i++) {
+
+				wp = fwp;
+				fwp += obwidth;
+				*wp = (*wp & ~lmask) | (color & lmask);
+			}
+		}
+
+		return;
+
+/* 
+
+*/
+	case 2:
+
+		if (width > 2) {
+
+			width -= 3;
+			lmask = fm[8];
+			mw = width >> 2;
+
+			if (mw) {
+
+				rmask = fm[width & 3];
+
+				for (i = 0; i < nl; i++) {
+
+					wp = fwp;
+					fwp += obwidth;
+					*wp++ = (*wp & ~lmask) | (color & lmask);
+
+					for (j = 0; j < mw; j++)
+						*wp++ = color;
+
+					*wp = (*wp & ~rmask) | (color & rmask);
+				}
+
+			} else {
+
+				rmask = fm[width & 3];
+
+				for (i = 0; i < nl; i++) {
+
+					wp = fwp;
+					fwp += obwidth;
+					*wp++ = (*wp & ~lmask) | (color & lmask);
+					*wp = (*wp & ~rmask) | (color & rmask);
+				}
+			}
+
+		} else {
+
+			lmask = fm[width + 6];
+
+			for (i = 0; i < nl; i++) {
+
+				wp = fwp;
+				fwp += obwidth;
+				*wp = (*wp & ~lmask) | (color & lmask);
+			}
+		}
+
+		return;
+
+/* 
+
+*/
+	case 3:
+
+		if (width > 1) {
+
+			width -= 2;
+			lmask = fm[9];
+			mw = width >> 2;
+
+			if (mw) {
+
+				rmask = fm[width & 3];
+
+				for (i = 0; i < nl; i++) {
+
+					wp = fwp;
+					fwp += obwidth;
+					*wp++ = (*wp & ~lmask) | (color & lmask);
+
+					for (j = 0; j < mw; j++)
+						*wp++ = color;
+
+					*wp = (*wp &~rmask) | (color & rmask);
+				}
+
+			} else {
+
+				rmask = fm[width & 3];
+
+				for (i = 0; i < nl; i++) {
+
+					wp = fwp;
+					fwp += obwidth;
+					*wp++ = (*wp & ~lmask) | (color & lmask);
+					*wp = (*wp & ~rmask) | (color & rmask);
+				}
+			}
+
+		} else {
+
+			lmask = fm[9];
+
+			for (i = 0; i < nl; i++) {
+
+				wp = fwp;
+				fwp += obwidth;
+				*wp = (*wp & ~lmask) | (color & lmask);
+			}
+		}
+
+		return;
+	}
+}
Index: vlib/vclrav.s
===================================================================
--- vlib/vclrav.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vclrav.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,51 @@
+* ------------------------------------------------------------------------------
+* vclrav.s -- clear a character's attributes in video RAM
+* Version 1 -- 1988-10-11 -- D.N. Lynx Crowe
+* (c) Copyright 1988 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+*
+*	vclrav(adr, row, col, atr, len)
+*	unsigned int *adr, row, col, atr, len;
+*
+*		Clears attribute 'atr' at ('row', 'col') in the
+*		full attribute text object at 'adr'
+*		using a line length of 'len'.
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_vclrav
+*
+P_ADR		.equ	8
+P_ROW		.equ	12
+P_COL		.equ	14
+P_ATR		.equ	16
+P_LEN		.equ	18
+*
+_vclrav:	link	a6,#0		* Link stack frame pointer
+		move.w	P_ROW(a6),d0	* Get row
+		mulu	P_LEN(a6),d0	* Multiply by len
+		clr.l	d1		* Clear out d1
+		move.w	P_COL(a6),d1	* Get col
+		add.l	d1,d0		* Add col into d0 to get char. #
+		move.l	d0,d1		* Develop cw = (cn/2)*6 in d1
+		andi.l	#$FFFFFFFE,d1	* ...
+		move.l	d1,d2		* ...
+		add.l	d1,d1		* ...
+		add.l	d2,d1		* ...
+		add.l	P_ADR(a6),d1	* Add sbase to cw
+		movea.l	d1,a0		* a0 points at the word with the char.
+		btst.l	#0,d0		* Odd char. location ?
+		bne	vclrav1		* Jump if so
+*
+		addq.l	#2,a0		* Point at the attribute word
+		bra	vclravx		* Go set attribute
+*
+vclrav1:	addq.l	#4,a0		* Point at the attribute word
+*
+vclravx:	move.w	P_ATR(a6),d0	* Get attribute mask
+		not.w	d0		* Complement the mask
+		and.w	d0,(a0)		* Clear attributes in video RAM
+		unlk	a6		* Unlink the stack frame
+		rts			* Return to caller
+*
+		.end
Index: vlib/vclrs.c
===================================================================
--- vlib/vclrs.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vclrs.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,34 @@
+/*
+   =============================================================================
+	vclrs.c -- clear a VSDD text line to a specified value
+	Version 2 -- 1987-04-15 -- D.N. Lynx Crowe
+	(c) Copyright 1987 -- D.N. Lynx Crowe
+
+	vclrs(obase, row, col, nc, ch, atr)
+	unsigned int obase[];
+	int row, col, nc, ch, atr;
+
+		Clear 'nc' characters in the text object 'obase' to 'ch',
+		using atrributes 'atr', starting at ('row','col');
+
+		No error checking is done, so beware.
+   =============================================================================
+*/
+
+extern	int	vputc();
+
+/*
+   =============================================================================
+	vclrs(obase, row, col, nc, ch, atr) -- clear a line on the VSDD
+   =============================================================================
+*/
+
+vclrs(obase, row, col, nc, ch, atr)
+register unsigned int obase[];
+int row, col;
+register int nc;
+int ch, atr;
+{
+	while (nc--)
+		vputc(obase, row, col++, ch, atr);
+}
Index: vlib/vcputs.s
===================================================================
--- vlib/vcputs.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vcputs.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,140 @@
+* ------------------------------------------------------------------------------
+* vcputs.s -- output a character string to a 4-bit per pixel graphics window
+* Version 3 -- 1987-07-31 -- D.N. Lynx Crowe
+* (c) Copyright 1987 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+*
+*	vcputs(obase, nw, fg, bg, row, col, str)
+*	int *obase, nw, fg, bg, row, col;
+*	char *str;
+*
+*		Outputs characters from the string at 'str' to an 'nw'
+*		character wide 4-bit per pixel graphics window at 'obase'
+*		at ('row','col'), using 'fg' as the foreground color, and
+*		'bg' as the background color.  Uses cgtable[][256] as the
+*		VSDD formatted character generator table.
+*		No error checks are done.
+*
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_vcputs
+*
+		.xref	_cgtable
+*
+* Argument offsets from a6:
+*
+OBASE		.equ	8		* Output area base address
+NW		.equ	12		* Character width of output area
+FG		.equ	14		* Foreground color
+BG		.equ	16		* Background color
+ROW		.equ	18		* Row
+COL		.equ	20		* Column
+STR		.equ	22		* String base address
+*
+* Program constant definitions:
+*
+HPIX		.equ	8		* Character width in pixels
+VPIX		.equ	12		* Character height in pixels
+HCW		.equ	4		* Horizontal character width (bytes)
+PSHIFT		.equ	12		* Pixel shift into MS bits
+HSHIFT		.equ	4		* Pixel right shift
+*
+		.page
+*
+* Register usage:
+*
+*	d0	output word and scratch
+*	d1	CG word and scratch
+*	d2	pixel counter
+*
+*	d3	foreground color (in the 4 ms bits)
+*	d4	background color (in the 4 ms bits)
+*	d5	width of the area in bytes
+*	d6	scan line counter
+*
+*	a0	CG table pointer
+*	a1	output area scan line pointer
+*	a2	input string character pointer
+*
+*	a3	output area character base pointer
+*
+		.page
+*
+_vcputs:	link	a6,#0		* Link stack frames
+		movem.l	d3-d6/a3,-(a7)	* Save registers we use
+		move.w	#PSHIFT,d1	* Set shift constant
+		move.w	FG(a6),d3	* Setup foreground color
+		lsl.w	d1,d3		* ... in ms 4 bits of d3.W
+		move.w	BG(a6),d4	* Setup background color
+		lsl.w	d1,d4		* ... in ms 4 bits of d4.W
+		move.w	NW(a6),d5	* Get line width in d5.W
+		lsl.w	#2,d5		* Multiply width by 4 for offset
+		move.w	ROW(a6),d0	* Calculate output address
+		move.w	#VPIX,d1	* ... VPIX
+		mulu	d1,d0		* ... * ROW
+		add.w	#VPIX-1,d0	* ... + VPIX-1
+		mulu	d5,d0		* ... * NW
+		clr.l	d1		* ...
+		move.w	COL(a6),d1	* ... + 
+		lsl.w	#2,d1		* ... COL * 4
+		add.l	d1,d0		* ...
+		add.l	OBASE(a6),d0	* ... + OBASE
+		movea.l	d0,a3		* Leave output address in a3
+		movea.l	STR(a6),a2	* Put string address in a2
+*
+cgl0:		clr.l	d0		* Clear out upper bits of d0
+		move.b	(a2)+,d0	* Get next character
+		beq	cgl5		* Done if character EQ 0
+*
+		movea.l	a3,a1		* Establish output pointer in a1
+		adda.l	#HCW,a3		* Update output pointer for next char.
+		lea	_cgtable,a0	* Establish CG pointer in a0
+		lsl.w	#1,d0		* ... 2 * character
+		adda.w	d0,a0		* ... + _cgtable address
+		move.w	#VPIX-1,d6	* Set scan line counter in d6
+*
+		.page
+cgl1:		move.w	(a0),d1		* Get character generator word in d1
+		move.w	#(HPIX/2)-1,d2	* Set pixel counter in d2
+*
+cgl2:		lsr.w	#HSHIFT,d0	* Shift output word right 1 pixel
+		btst.l	#0,d1		* Check CG word ls bit
+		beq	cgl3		* Set background color if bit EQ 0
+*
+		or.w	d3,d0		* OR foreground color into output word
+		bra	cgl4		* Go update CG word
+*
+cgl3:		or.w	d4,d0		* OR background color into output word
+*
+cgl4:		lsr.w	#1,d1		* Shift CG word right 1 pixel
+		dbf	d2,cgl2		* Loop for first 4 pixels
+*
+		move.w	d0,(a1)+	* Store first output word in scan line
+		move.w	#(HPIX/2)-1,d2	* Set pixel counter in d2
+*
+cgl2a:		lsr.w	#HSHIFT,d0	* Shift output word right 1 pixel
+		btst.l	#0,d1		* Check CG word ls bit
+		beq	cgl3a		* Set background color if bit EQ 0
+*
+		or.w	d3,d0		* OR foreground color into output word
+		bra	cgl4a		* Go update CG word
+*
+cgl3a:		or.w	d4,d0		* OR background color into output word
+*
+cgl4a:		lsr.w	#1,d1		* Shift CG word right 1 pixel
+		dbf	d2,cgl2a	* Loop for last 4 pixels
+*
+		move.w	d0,(a1)		* Store second output word in scan line
+		suba.w	d5,a1		* Update output pointer
+		suba.w	#2,a1		* ...
+		adda.l	#512,a0		* Update CG pointer for next scan line
+		dbf	d6,cgl1		* Loop for all scan lines
+*
+		bra	cgl0		* Loop for next character
+*
+cgl5:		movem.l	(a7)+,d3-d6/a3	* Restore registers
+		unlk	a6		* Unlink stack frames
+		rts			* Return to caller
+*
+		.end
Index: vlib/vcputsv.s
===================================================================
--- vlib/vcputsv.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vcputsv.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,147 @@
+* ------------------------------------------------------------------------------
+* vcputsv.s -- output characters to a 4-bit / pixel graphics window
+* with variable vertical pitch
+* Version 2 -- 1987-08-03 -- D.N. Lynx Crowe
+* (c) Copyright 1987 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+*
+*	vcputsv(obase, nw, fg, bg, row, col, str. pitch)
+*	int *obase, nw, fg, bg, row, col, pitch;
+*	char *str;
+*
+*		Outputs characters from the string at 'str' to an 'nw'
+*		character wide 4-bit per pixel graphics window at 'obase'
+*		at ('row','col'), using 'fg' as the foreground color, and
+*		'bg' as the background color.  Uses cgtable[][256] as the
+*		VSDD formatted character generator table.  Assumes 12 bit
+*		high characters in the cgtable.  Uses 'pitch' as the vertical
+*		spacing between character rows.  No error checks are done.
+*		The string must fit the output area (no overlaps, single line).
+*
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_vcputsv
+*
+		.xref	_cgtable
+*
+* Argument offsets from a6:
+*
+OBASE		.equ	8		* LONG - Output area base address
+NW		.equ	12		* WORD - Character width of output area
+FG		.equ	14		* WORD - Foreground color
+BG		.equ	16		* WORD - Background color
+ROW		.equ	18		* WORD - Row
+COL		.equ	20		* WORD - Column
+STR		.equ	22		* LONG - String base address
+PITCH		.equ	26		* WORD - Vertical spacing between rows
+*
+* Program constant definitions:
+*
+HPIX		.equ	8		* Character width in pixels
+VPIX		.equ	12		* Character height in pixels
+HCW		.equ	4		* Horizontal character width (bytes)
+PSHIFT		.equ	12		* Pixel shift into MS bits
+HSHIFT		.equ	4		* Pixel right shift
+*
+		.page
+*
+* Register usage:
+*
+*	d0	output word and scratch
+*	d1	CG word and scratch
+*	d2	pixel counter
+*
+*	d3	foreground color (in the 4 ms bits)
+*	d4	background color (in the 4 ms bits)
+*	d5	width of the area in bytes
+*	d6	scan line counter
+*
+*	a0	CG table pointer
+*	a1	output area scan line pointer
+*	a2	input string character pointer
+*
+*	a3	output area character base pointer
+*
+*	a6	frame pointer
+*	a7	stack pointer
+*
+		.page
+*
+_vcputsv:	link	a6,#0		* Link stack frames
+		movem.l	d3-d6/a3,-(a7)	* Save registers we use
+		move.w	#PSHIFT,d1	* Set shift constant
+		move.w	FG(a6),d3	* Setup foreground color
+		lsl.w	d1,d3		* ... in ms 4 bits of d3.W
+		move.w	BG(a6),d4	* Setup background color
+		lsl.w	d1,d4		* ... in ms 4 bits of d4.W
+		move.w	NW(a6),d5	* Get line width in d5.W
+		lsl.w	#2,d5		* Multiply width by 4 for offset
+		move.w	ROW(a6),d0	* Calculate output address
+		move.w	PITCH(a6),d1	* ... PITCH
+		mulu	d1,d0		* ... * ROW
+		add.w	#VPIX-1,d0	* ... + VPIX-1
+		mulu	d5,d0		* ... * NW
+		clr.l	d1		* ...
+		move.w	COL(a6),d1	* ... + 
+		lsl.w	#2,d1		* ... COL * 4
+		add.l	d1,d0		* ...
+		add.l	OBASE(a6),d0	* ... + OBASE
+		movea.l	d0,a3		* Leave output address in a3
+		movea.l	STR(a6),a2	* Put string address in a2
+*
+cgl0:		clr.l	d0		* Clear out upper bits of d0
+		move.b	(a2)+,d0	* Get next character
+		beq	cgl5		* Done if character EQ 0
+*
+		movea.l	a3,a1		* Establish output pointer in a1
+		adda.l	#HCW,a3		* Update output pointer for next char.
+		lea	_cgtable,a0	* Establish CG pointer in a0
+		lsl.w	#1,d0		* ... 2 * character
+		adda.w	d0,a0		* ... + _cgtable address
+		move.w	#VPIX-1,d6	* Set scan line counter in d6
+*
+		.page
+cgl1:		move.w	(a0),d1		* Get character generator word in d1
+		move.w	#(HPIX/2)-1,d2	* Set pixel counter in d2
+*
+cgl2:		lsr.w	#HSHIFT,d0	* Shift output word right 1 pixel
+		btst.l	#0,d1		* Check CG word ls bit
+		beq	cgl3		* Set background color if bit EQ 0
+*
+		or.w	d3,d0		* OR foreground color into output word
+		bra	cgl4		* Go update CG word
+*
+cgl3:		or.w	d4,d0		* OR background color into output word
+*
+cgl4:		lsr.w	#1,d1		* Shift CG word right 1 pixel
+		dbf	d2,cgl2		* Loop for first 4 pixels
+*
+		move.w	d0,(a1)+	* Store first output word in scan line
+		move.w	#(HPIX/2)-1,d2	* Set pixel counter in d2
+*
+cgl2a:		lsr.w	#HSHIFT,d0	* Shift output word right 1 pixel
+		btst.l	#0,d1		* Check CG word ls bit
+		beq	cgl3a		* Set background color if bit EQ 0
+*
+		or.w	d3,d0		* OR foreground color into output word
+		bra	cgl4a		* Go update CG word
+*
+cgl3a:		or.w	d4,d0		* OR background color into output word
+*
+cgl4a:		lsr.w	#1,d1		* Shift CG word right 1 pixel
+		dbf	d2,cgl2a	* Loop for last 4 pixels
+*
+		move.w	d0,(a1)		* Store second output word in scan line
+		suba.w	d5,a1		* Update output pointer
+		suba.w	#2,a1		* ...
+		adda.l	#512,a0		* Update CG pointer for next scan line
+		dbf	d6,cgl1		* Loop for all scan lines
+*
+		bra	cgl0		* Loop for next character
+*
+cgl5:		movem.l	(a7)+,d3-d6/a3	* Restore registers
+		unlk	a6		* Unlink stack frames
+		rts			* Return to caller
+*
+		.end
Index: vlib/vhinit.c
===================================================================
--- vlib/vhinit.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vhinit.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,99 @@
+/*
+   =============================================================================
+	vhinit.c -- initialize VSDD hardware
+	Version 17 -- 1988-03-20 -- D.N. Lynx Crowe
+	(c) Copyright 1987, 1988 -- D.N. Lynx Crowe
+
+	VHinit()
+
+		Setup VSDD registers, clear access table, clear object table,
+		load character generator, set color lookup table defaults.
+		Defines major video system variables, since the linker isn't
+		smart enough to let me put them in a separate file.
+   =============================================================================
+*/
+
+#define	FASTCHIP	1	/* non-zero if it's the fast VSDD chip */
+
+#include "hwdefs.h"
+#include "vsdd.h"
+#include "memory.h"
+
+#define	VREG(h,v)	((h<<10)|v)
+
+extern	int	cgtable[];
+extern	int	cg_rows;
+
+struct octent	v_obtab[16];	/* object control table */
+
+struct octent	*v_curob;	/* current v_obtab pointer */
+
+int	v_nobj;			/* current object number */
+int	v_obpri;		/* current object priority */
+
+/* 
+ */
+
+/* initialized variables */
+
+int	vr_data[] = {
+
+	0x825B,		/* R0  -- Mode word 0 */
+	0xC474,		/* R1  -- Mode word 1 */
+	0x0006,		/* R2  -- Register window base, Control flags */
+	0x0100,		/* R3  -- Data window base, X limit	(0x200000) */
+	0x0000,		/* R4  -- Data length mask		(128K) */
+	0x0000,		/* R5  -- Data segment base		(0x000000) */
+	0x0001,		/* R6  -- Priority access count		(1) */
+	0x0040,		/* R7  -- Object Descriptor Table base	(0x200080) */
+	0x0080,		/* R8  -- Access Table base		(0x200100) */
+	0x0010,		/* R9  -- Color Lookup Table base	(0x200020) */
+	0x00FF,		/* R10 -- Character Generator bases	(0x21E000) */
+	0x0000,		/* R11 -- Access Table address counter */
+
+#if	FASTCHIP
+	VREG( 3,   8),	/* R12 -- HC0 (HSYNC width)	VC0 (VSYNC width) */
+	VREG( 5,  10),	/* R13 -- HC1 (AHZ start)	VC1 (AVZ start) */
+	VREG(37, 360),	/* R14 -- HC2 (AHZ stop)	VC2 (AVZ stop) */
+	VREG(40, 362)	/* R15 -- HC3 (HOR sweep)	VC3 (VRT sweep) */
+#else
+	VREG( 3,   8),	/* R12 -- HC0 (HSYNC width)	VC0 (VSYNC width) */
+	VREG( 6,  10),	/* R13 -- HC1 (AHZ start)	VC1 (AVZ start) */
+	VREG(38, 360),	/* R14 -- HC2 (AHZ stop)	VC2 (AVZ stop) */
+	VREG(43, 361)	/* R15 -- HC3 (HOR sweep)	VC3 (VRT sweep) */
+#endif
+};
+
+/* 
+ */
+
+/*
+   =============================================================================
+	VHinit() -- initialize the VSDD
+   =============================================================================
+*/
+
+VHinit()
+{
+
+	/* select VSDD RAM bank 0 so we can access the control tables */
+
+	vbank(0);
+
+	/* set the video register values */
+
+	memcpyw(v_regs, vr_data, 16);
+
+	/* clear the access table to turn off all objects */
+
+	memsetw(v_actab, 0xFFFF, 350);
+
+	/* clear the object table */
+
+	memsetw(v_odtab, 0, 64);
+
+	/* move the character generator table to VSDD RAM */
+
+	memsetw(v_cgtab, 0, 4096);
+	memcpyw(v_cgtab, cgtable, 256 * cg_rows);
+}
Index: vlib/viint.s
===================================================================
--- vlib/viint.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/viint.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,232 @@
+* ------------------------------------------------------------------------------
+* viint.s -- VSDD Vertical Interval interrupt handler for the Buchla 700
+* Version 17 -- 1989-12-19 -- D.N. Lynx Crowe
+*
+*	VIint
+*
+*		VSDD Vertical Interval interrupt handler.  Enables display of
+*		any object whose bit is set in vi_ctl.  Bit 0 = object 0, etc.
+*
+*		SetPri() uses BIOS(B_SETV, 25, VIint) to set the interrupt
+*		vector and lets VIint() enable the object.  If vi_dis
+*		is set, SetPri() won't enable the interrupt or set the vector
+*		so that several objects can be started up at once.
+*
+*		This routine also sets the base address and scroll offset
+*		for the score display object if vi_sadr is non-zero,
+*		after a delay for VSDD FRAMESTOP synchronization.
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_VIint			* Vertical Interval int. handler
+*
+		.xdef	_vi_sadr		* score object base address
+		.xdef	_vi_scrl		* score object scroll offset
+		.xdef	lclsadr			* local scroll address
+		.xdef	lclscrl			* local scroll offset
+		.xdef	vdelay			* VSDD scroll delay
+*
+		.xdef	VIct1			* VSDD interrupt R11 
+		.xdef	VIct2			* VSDD interrupt R11 
+		.xdef	VIct3			* VSDD interrupt R11 
+		.xdef	VIct4			* VSDD interrupt R11 
+*
+		.xref	_v_regs			* VSDD registers
+		.xref	_v_odtab		* VSDD object descriptor table
+*
+		.xref	_vi_clk			* scroll delay timer
+		.xref	_vi_ctl			* unblank control word
+		.xref	_vi_tag			* VSDD 'needs service' tag
+*
+		.page
+*
+* Miscellaneous equates:
+* ----------------------
+*
+DELAY		.equ	17			* FRAMESTOP sync delay in Ms
+STACKSR		.equ	32			* offset to sr on stack
+V_BLA		.equ	4			* V_BLA (blank) bit number
+VSDD_R5		.equ	10			* VSDD R5 byte offset in _v_regs
+VSDD_R11	.equ	22			* VSDD R11 byte offset in _v_regs
+*
+VT_BASE		.equ	128			* word offset of VSDD Access Table
+*
+VT_1		.equ	VT_BASE+300		* high time
+VT_2		.equ	VT_BASE+2		* low time
+* ------------------------------------------------------------------------------
+*
+* Stack picture after movem.l at entry:
+* -------------------------------------
+*
+*	LONG	PC	+34
+*	WORD	SR	+32	STACKSR
+*	LONG	A6	+28
+*	LONG	A2	+24
+*	LONG	A1	+20
+*	LONG	A0	+16
+*	LONG	D3	+12
+*	LONG	D2	+8
+*	LONG	D1	+4
+*	LONG	D0	+0
+*
+* ------------------------------------------------------------------------------
+*
+		.page
+*
+* _VIint -- Vertical interval interrupt handler
+* ------    -----------------------------------
+_VIint:		movem.l	d0-d3/a0-a2/a6,-(a7)	* save registers
+		addi.w	#$0100,STACKSR(a7)	* raise IPL in sr on the stack
+*
+		move.w	_v_regs+VSDD_R11,VIct1	* save the VSDD R11 value
+*
+		tst.w	_vi_sadr		* see if we should scroll
+		beq	viunbl			* jump if not
+*
+* ------------------------------------------------------------------------------
+* setup delayed scroll parameters
+* ------------------------------------------------------------------------------
+		move.w	_v_regs+VSDD_R5,d0	* get VSDD R5
+		move.w	d0,d1			* save it for later
+		andi.w	#$0180,d0		* see if we're already in bank 0
+		beq	dlyscrl			* jump if so
+*
+		clr.w	_v_regs+VSDD_R5		* set bank 0
+*
+		move.w	_v_regs+VSDD_R11,VIct2	* save the VSDD R11 value
+*
+vw1a:		cmp.w	#VT_1,_v_regs+VSDD_R11	* wait for FRAMESTOP
+		bcc	vw1a			* ...
+*
+vw2a:		cmp.w	#VT_1,_v_regs+VSDD_R11	* ...
+		bcs	vw2a			* ...
+*
+vw3a:		cmp.w	#VT_1,_v_regs+VSDD_R11	* ...
+		bcc	vw3a			* ...
+*
+vw4a:		cmp.w	#VT_2,_v_regs+VSDD_R11	* ...
+		bcs	vw4a			* ...
+*
+dlyscrl:	tst.w	_vi_tag			* wait for previous scroll
+		bne	dlyscrl			* ...
+*
+		move.w	_vi_sadr,lclsadr	* save address for timeint
+		move.w	_vi_scrl,lclscrl	* save offset for timeint
+		clr.w	_vi_sadr		* reset for next time
+		clr.w	_vi_scrl		* ...
+		move.w	vdelay,_vi_clk		* set the scroll delay timer
+		st	_vi_tag			* set the 'need service' tag
+* ------------------------------------------------------------------------------
+* check for unblank requests
+* ------------------------------------------------------------------------------
+		move.w	_vi_ctl,d2		* get the unblank control word
+		beq	viexit			* exit if nothing to unblank
+*
+		bra	unblnk			* go unblank some objects
+*
+viunbl:		move.w	_vi_ctl,d2		* get the unblank control word
+		beq	vidone			* exit if nothing to unblank
+*
+		move.w	_v_regs+VSDD_R5,d0	* get VSDD R5
+		move.w	d0,d1			* save it for later
+		andi.w	#$0180,d0		* see if we're already in bank 0
+		beq	unblnk			* jump if so
+*
+		clr.w	_v_regs+VSDD_R5		* set bank 0
+*
+		move.w	_v_regs+VSDD_R11,VIct3	* save the VSDD R11 value
+*
+vw1b:		cmp.w	#VT_1,_v_regs+VSDD_R11	* wait for FRAMESTOP
+		bcc	vw1b			* ...
+*
+vw2b:		cmp.w	#VT_1,_v_regs+VSDD_R11	* ...
+		bcs	vw2b			* ...
+*
+vw3b:		cmp.w	#VT_1,_v_regs+VSDD_R11	* ...
+		bcc	vw3b			* ...
+*
+vw4b:		cmp.w	#VT_2,_v_regs+VSDD_R11	* ...
+		bcs	vw4b			* ...
+*
+		.page
+*
+* ------------------------------------------------------------------------------
+* unblank objects indicated by contents of d2  (loaded earlier from _vi_ctl)
+* ------------------------------------------------------------------------------
+*
+unblnk:		clr.w	d3			* clear the counter
+		clr.w	_vi_ctl			* clear the unblank control word
+		lea	_v_odtab,a1		* point at first object
+*
+vicheck:	btst	d3,d2			* check the object bit
+		beq	vinext			* go check next one if not set
+*
+		move.w	(a1),d0			* get v_odtab[obj][0]
+		bclr	#V_BLA,d0		* clear the blanking bit
+		move.w	d0,(a1)			* set v_odtab[obj][0]
+*
+vinext:		cmpi.w	#15,d3			* see if we're done
+		beq	viexit			* jump if so
+*
+		addq.l	#8,a1			* point at next object
+		addq.w	#1,d3			* increment object counter
+		bra	vicheck			* go check next object
+*
+* ------------------------------------------------------------------------------
+* switch back to the bank the interrupted code was using if we changed it
+* ------------------------------------------------------------------------------
+*
+viexit:		move.w	d1,d0			* see if we were in bank 0
+		andi.w	#$0180,d0		* ...
+		beq	vidone			* jump if so
+*
+viwait:		tst.w	_vi_tag			* wait for timer to run out
+		bne	viwait			* ... so timeint sees bank 0
+*
+		move.w	d1,_v_regs+VSDD_R5	* restore v_regs[5] to old bank
+*
+		move.w	_v_regs+VSDD_R11,VIct4	* save the VSDD R11 value
+*
+vw1c:		cmp.w	#VT_1,_v_regs+VSDD_R11	* wait for FRAMESTOP
+		bcc	vw1c			* ...
+*
+vw2c:		cmp.w	#VT_1,_v_regs+VSDD_R11	* ...
+		bcs	vw2c			* ...
+*
+vw3c:		cmp.w	#VT_1,_v_regs+VSDD_R11	* ...
+		bcc	vw3c			* ...
+*
+vw4c:		cmp.w	#VT_2,_v_regs+VSDD_R11	* ...
+		bcs	vw4c			* ...
+*
+* ------------------------------------------------------------------------------
+* restore registers and return to interrupted code
+* ------------------------------------------------------------------------------
+*
+vidone:		movem.l	(a7)+,d0-d3/a0-a2/a6	* restore registers
+		rte				* return from interrupt
+*
+		.page
+*
+* ------------------------------------------------------------------------------
+		.data
+* ------------------------------------------------------------------------------
+*
+vdelay:		.dc.w	DELAY			* VSDD scroll delay
+*
+* ------------------------------------------------------------------------------
+		.bss
+* ------------------------------------------------------------------------------
+*
+_vi_sadr:	.ds.w	1			* score object base address
+_vi_scrl:	.ds.w	1			* score object scroll offset
+*
+lclsadr:	.ds.w	1			* local copy of vi_sadr
+lclscrl:	.ds.w	1			* local copy of vi_scrl
+*
+VIct1:		.ds.w	1			* VSDD R11 value at interrupt
+VIct2:		.ds.w	1			* VSDD R11 value at interrupt
+VIct3:		.ds.w	1			* VSDD R11 value at interrupt
+VIct4:		.ds.w	1			* VSDD R11 value at interrupt
+*
+		.end
Index: vlib/vmput.c
===================================================================
--- vlib/vmput.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vmput.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,82 @@
+/*
+   =============================================================================
+	vmput.c -- video menu put functions
+	Version 3 -- 1987-03-30 -- D.N. Lynx Crowe
+	(c) Copyright 1987 -- D.N. Lynx Crowe
+
+	vmput(sbase, row, col, ms, ma)
+	uint *sbase, rwo, col, ma;
+	char *ms[];
+
+		Copies lines from ms, with attribute ma, to sbase at (row,col).
+
+	vmputa(sbase, row, col, ms, ma)
+	uint *sbase, row, col, *ma;
+	char *ms[];
+
+		Copies lines from ms, with attributes from ma, to sbase at (row,col).
+   =============================================================================
+*/
+
+typedef	unsigned int	uint;
+
+extern	int	vputc();
+
+/*
+   =============================================================================
+	vmput(sbase, row, col, ms, ma) -- put a menu item in a screen image.
+	Copies lines from ms, with attribute ma, to sbase at (row,col).
+   =============================================================================
+*/
+
+vmput(sbase, row, col, ms, ma)
+uint *sbase, row, col, ma;
+char *ms[];
+{
+	register uint c, tc, tr;
+	char *cp;
+
+	tr = row;
+
+	while (cp = *ms++) {
+
+		tc = col;
+
+		while (c = *cp++)
+			vputc(sbase, tr, tc++, c, ma);
+
+		tr++;
+	}
+}
+
+/* 
+ */
+
+/*
+   =============================================================================
+	vmputa(sbase, row, col, ms, ma) -- put a menu item in a screen image.
+	Copies lines from ms, with attributes from ma, to sbase at (row,col).
+   =============================================================================
+*/
+
+vmputa(sbase, row, col, ms, ma)
+uint *sbase, row, col, *ma[];
+char *ms[];
+{
+	register uint c, tc, tr;
+	uint *tm;
+	char *cp;
+
+	tr = row;
+
+	while (cp = *ms++) {
+
+		tc = col;
+		tm = *ma++;
+
+		while (c = *cp++)
+			vputc(sbase, tr, tc++, c, *tm++);
+
+		tr++;
+	}
+}
Index: vlib/vobjfns.c
===================================================================
--- vlib/vobjfns.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vobjfns.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,273 @@
+/*
+   =============================================================================
+	vobjfns.c -- VSDD object functions
+	Version 23 -- 1988-01-29 -- D.N. Lynx Crowe
+	(c) Copyright 1987,1988 -- D.N. Lynx Crowe
+
+	SelObj(obj)
+	int obj;
+
+		Select 'obj' as the current working object.
+
+	SetPri(obj, pri)
+	int obj, pri;
+
+		Display object 'obj' with priority 'pri'.
+
+	SetObj(obj, type, bank, base, xpix, ypix, x0, y0, flags, pri)
+	int obj, type, bank, xpix, ypix, x0, y0, flags, pri;
+	unsigned int *base;
+
+		Setup object 'obj' of type 'type' at 'base' in bank 'bank'
+		with height 'ypix' and width 'xpix' at initial location
+		'x0','y0', with flags 'flags'.  Assumes HRS EQ 1.
+		If 'pri' >= 0, display the object at priority level 'pri'.
+		Define a bitmap object if 'type' EQ 0, or a character object
+		if 'type' NE 0.
+
+	CpyObj(from, to, w, h, sw)
+	unsigned int *from, *to;
+	int w, h, sw;
+
+		Copy a 'w'-word by 'h'-line object from 'from' to 'to' with
+		a destination width of 'sw' words.
+*/
+
+/* 
+
+*/
+
+/*
+	VIint() is located in viint.s but is mentioned here for completeness
+
+	VIint()
+
+		Vertical Interrupt handler.  Enables display of any object
+		whose bit is set in vi_ctl.  Bit 0 = object 0, etc.
+
+		SetPri() uses BIOS(B_SETV, 25, VIint) to set the interrupt
+		vector and lets VIint() enable the object.  If vi_dis
+		is set, SetPri() won't enable the interrupt or set the vector
+		so that several objects can be started up at once.
+   =============================================================================
+*/
+
+#include "biosdefs.h"
+#include "graphdef.h"
+#include "hwdefs.h"
+#include "stddefs.h"
+#include "vsdd.h"
+#include "vsddvars.h"
+
+extern	int	vbank(), objon(), VIint();
+
+short		wsize;		/* object width calculated by SetObj() */
+short		vi_dis;		/* disable use of VIint */
+
+unsigned	vi_ctl;		/* object unblank control bits */
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	SelObj(obj) -- Select 'obj' as the current working object.
+   =============================================================================
+*/
+
+SelObj(obj)
+int obj;
+{
+	register struct octent *op;
+	register unsigned newbank;
+
+	op = &v_obtab[obj];
+
+	newbank = ((op->obank & 0x0001) << 8) | ((op->obank & 0x0002) << 6);
+
+	v_nobj = obj;
+	v_curob = op;
+	v_obpri = op->opri;
+
+	if ((v_regs[5] & 0x0180) NE newbank)
+		vbank(op->obank & 3);
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	SetPri(obj, pri) -- Display object 'obj' with priority 'pri'.
+	
+		Blanks the object first, then sets the access table
+		and unblanks the object via VIint().
+   =============================================================================
+*/
+
+SetPri(obj, pri)
+register int obj;
+register int pri;
+{
+	register struct octent *op;
+
+	if (v_regs[5] & 0x0180)		/* point at the control bank */
+		vbank(0);
+
+	op = &v_obtab[obj];		/* point at the object table */
+	op->opri = pri;			/* set the priority */
+
+	v_odtab[pri][0] = op->odtw0 | V_BLA;	/* start object as blanked */
+	v_odtab[pri][1] = op->odtw1;
+	v_odtab[pri][2] = ((char *)(op->obase) >> 1) & 0xFFFF;
+
+	objon(pri, op->objy, op->ysize);	/* enable access table bits */
+
+	if (vi_dis)				/* don't unblank if vi_dis set */
+		return;
+
+	setipl(7);				/* disable interrupts */
+
+	vi_ctl |= (1 << pri);			/* set unblank bit */
+
+	if (*((long *)0x000064) NE &VIint)	/* make sure VI vector is set */
+		BIOS(B_SETV, 25, VIint);
+
+	setipl(0);				/* enable VI interrupt */
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	SetObj(obj, type, bank, base, xpix, ypix, x0, y0, flags, pri)
+	Setup an object, and optionally display it.  Assumes HRS EQ 1.
+   =============================================================================
+*/
+
+SetObj(obj, type, bank, base, xpix, ypix, x0, y0, flags, pri)
+int obj, type, bank, xpix, ypix, x0, y0, flags, pri;
+unsigned int *base;
+{
+	register struct octent *op;
+
+	if (v_regs[5] & 0x0180)		/* point at the control bank */
+		vbank(0);
+
+	op = &v_obtab[obj];
+
+	v_curob = op;
+	v_nobj = obj;
+	v_obpri = pri;
+
+	op->ysize = ypix;
+	op->xsize = xpix;
+	op->objx = x0;
+	op->objy = y0;
+	op->obase = base;
+	op->opri = pri;
+	op->obank = bank & 3;
+
+/* 
+
+*/
+	if (type) {	/* character objects */
+
+		op->odtw0 = (flags & 0xF9FF) | V_CTYPE;
+
+		switch (V_RES3 & op->odtw0) {
+
+		case V_RES0:
+
+			wsize = xpix / 128;
+			break;
+
+		case V_RES1:
+
+			wsize = xpix / 48;
+			break;
+
+		case V_RES2:
+
+			wsize = xpix / 64;
+			break;
+
+		case V_RES3:
+
+			wsize = xpix / 96;
+			break;
+		}
+
+		if (V_FAD & op->odtw0)
+			wsize = wsize + (wsize << 1);
+
+/* 
+
+*/
+	} else {	/* bitmap objects */
+
+		op->odtw0 = (flags & 0x0E37) | (V_BTYPE | ((bank & 3) << 6));
+
+		switch (V_RES3 & op->odtw0) {
+
+		case V_RES0:
+		case V_RES1:
+
+			wsize = 0;
+			break;
+
+		case V_RES2:
+
+			wsize = xpix / 32;
+			break;
+
+		case V_RES3:
+
+			wsize = xpix / 16;
+			break;
+		}
+	}
+
+	op->odtw1 = ((x0 >> 1) & 0x03FF) | (0xFC00 & (wsize << 10));
+
+	if (pri < 0)
+		return;
+
+	SetPri(obj, pri);
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	CpyObj(from, to, w, h, sw)
+
+	Copy a 'w'-word by 'h'-line object from 'from' to 'to' with
+	a destination width of 'sw' words.  Assumes we're pointing at
+	the correct bank.
+   =============================================================================
+*/
+
+CpyObj(from, to, w, h, sw)
+register unsigned *from, *to;
+register unsigned w, h, sw;
+{
+	register unsigned *tp;
+	register unsigned i, j;
+
+	for (i = h; i--; ) {
+
+		tp = to;
+
+		for (j = w; j--; )
+			*tp++ = *from++;
+
+		to += sw;
+	}
+}
Index: vlib/vputa.s
===================================================================
--- vlib/vputa.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vputa.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,48 @@
+* ------------------------------------------------------------------------------
+* vputa.s -- store character attributes in video RAM
+* Version 1 -- 1988-03-14 -- D.N. Lynx Crowe
+* (c) Copyright 1988 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+*
+*	vputa(sbase, row, col, attrib)
+*	unsigned int *sbase, row, col, attrib;
+*
+*		Stores attribute value 'attrib' for the character
+*		located at ('row','col') in VSDD RAM starting at 'sbase'.
+*		Assumes a 64 character line and full character attributes.
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_vputa
+*
+SBASE		.equ	8		* LONG - 'sbase'
+ROW		.equ	12		* WORD - 'row'
+COL		.equ	14		* WORD - 'col'
+ATTR		.equ	16		* WORD - 'attrib'
+*
+_vputa:		link	a6,#0		* Link stack frame pointer
+		clr.l	d0		* Clear out d0
+		move.w	ROW(a6),d0	* Get row
+		lsl.l	#6,d0		* Multiply by 64  (shift left 6)
+		move.w	COL(a6),d1	* Get col
+		andi.l	#$0000003F,d1	* Mask down to 6 bits
+		or.l	d1,d0		* OR into d0 to get char. #
+		move.w	d0,d1		* Develop cw = (cn/2)*6 in d1
+		andi.l	#$FFFFFFFE,d1	* ...
+		move.l	d1,d2		* ...
+		add.l	d1,d1		* ...
+		add.l	d2,d1		* ...
+		add.l	SBASE(a6),d1	* Add sbase to cw
+		movea.l	d1,a0		* a0 points at the word with the char.
+		btst.l	#0,d0		* Odd char. location ?
+		bne	vputa1		* Jump if so
+*
+		move.w	ATTR(a6),2(a0)	* Store new attribute word in video RAM
+*
+vputax:		unlk	a6		* Unlink the stack frame
+		rts			* Done -- return to caller
+*
+vputa1:		move.w	ATTR(a6),4(a0)	* Store new attribute word in video RAM
+		bra	vputax		* Done -- go return to caller
+*
+		.end
Index: vlib/vputc.s
===================================================================
--- vlib/vputc.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vputc.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,56 @@
+* ------------------------------------------------------------------------------
+* vputc.s -- store a character and attributes in video RAM
+* Version 3 -- 1987-03-30 -- D.N. Lynx Crowe
+* (c) Copyright 1987 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+*
+*	vputc(sbase, row, col, c, attrib)
+*	unsigned int *sbase, row, col, c, attrib;
+*
+*		Stores character c at (row,col) in sbase with
+*		attribute value attrib.
+* ------------------------------------------------------------------------------
+*
+		.text
+*
+		.xdef	_vputc
+*
+_vputc:		link	a6,#0		* Link stack frame pointer
+		clr.l	d0		* Clear out d0
+		move.w	12(a6),d0	* Get row
+		lsl.l	#6,d0		* Multiply by 64  (shift left 6)
+		move.w	14(a6),d1	* Get col
+		andi.l	#$0000003F,d1	* Mask down to 6 bits
+		or.l	d1,d0		* OR into d0 to get char. #
+		move.w	d0,d1		* Develop cw = (cn/2)*6 in d1
+		andi.l	#$FFFFFFFE,d1	* ...
+		move.l	d1,d2		* ...
+		lsl.l	#1,d1		* ...
+		add.l	d2,d1		* ...
+		add.l	8(a6),d1	* Add sbase to cw
+		movea.l	d1,a0		* a0 points at the word with the char.
+		btst.l	#0,d0		* Odd char. location ?
+		bne	vputc1		* Jump if so
+*
+		move.w	16(a6),d0	* Get ch
+		andi.w	#$00FF,d0	* Mask off garbage bits
+		move.w	(a0),d1		* Get word from video RAM
+		andi.w	#$FF00,d1	* Mask off old even character
+		or.w	d0,d1		* OR in the new character
+		move.w	d1,(a0)+	* Store the updated word in video RAM
+		move.w	18(a6),(a0)	* Store new attribute word in video RAM
+*
+vputcx:		unlk	a6		* Unlink the stack frame
+		rts			* Return to caller
+*
+vputc1:		move.w	16(a6),d0	* Get ch
+		lsl.w	#8,d0		* Shift to high (odd) byte
+		move.w	(a0),d1		* Get word from video RAM
+		andi.w	#$00FF,d1	* Mask off old odd character
+		or.w	d0,d1		* OR in the new character
+		move.w	d1,(a0)+	* Store the updated word in video RAM
+		addq.l	#2,a0		* Point at the attribute word
+		move.w	18(a6),(a0)	* Store new attributes in video RAM
+		bra	vputcx		* Done -- go return to caller
+*
+		.end
Index: vlib/vputcv.s
===================================================================
--- vlib/vputcv.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vputcv.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,64 @@
+* ------------------------------------------------------------------------------
+* vputcv.s -- store a character and attributes in video RAM
+* Version 1 -- 1988-10-05 -- D.N. Lynx Crowe
+* (c) Copyright 1988 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+*
+*	vputcv(adr, row, col, chr, atr, cols)
+*	unsigned int *adr, row, col, chr, atr, cols;
+*
+*		Stores character 'chr' at ('row', 'col') in the
+*		full attribute text object at 'adr' with
+*		attribute value 'atr' using a line length of 'len'.
+* ------------------------------------------------------------------------------
+*
+		.text
+*
+		.xdef	_vputcv
+*
+P_ADR		.equ	8
+P_ROW		.equ	12
+P_COL		.equ	14
+P_CHR		.equ	16
+P_ATR		.equ	18
+P_LEN		.equ	20
+*
+		.page
+*
+_vputcv:	link	a6,#0		* Link stack frame pointer
+		move.w	P_ROW(a6),d0	* Get row
+		mulu	P_LEN(a6),d0	* Multiply by len
+		clr.l	d1		* Clear out d1
+		move.w	P_COL(a6),d1	* Get col
+		add.l	d1,d0		* Add col into d0 to get char. #
+		move.l	d0,d1		* Develop cw = (cn/2)*6 in d1
+		andi.l	#$FFFFFFFE,d1	* ...
+		move.l	d1,d2		* ...
+		add.l	d1,d1		* ...
+		add.l	d2,d1		* ...
+		add.l	P_ADR(a6),d1	* Add sbase to cw
+		movea.l	d1,a0		* a0 points at the word with the char.
+		btst.l	#0,d0		* Odd char. location ?
+		bne	vputcv1		* Jump if so
+*
+		move.w	P_CHR(a6),d0	* Get chr
+		andi.w	#$00FF,d0	* Mask off garbage bits
+		move.w	(a0),d1		* Get word from video RAM
+		andi.w	#$FF00,d1	* Mask off old even character
+		or.w	d0,d1		* OR in the new character
+		move.w	d1,(a0)+	* Store the updated word in video RAM
+		bra	vputcvx		* Done -- go return to caller
+*
+vputcv1:	move.w	P_CHR(a6),d0	* Get chr
+		lsl.w	#8,d0		* Shift to high (odd) byte
+		move.w	(a0),d1		* Get word from video RAM
+		andi.w	#$00FF,d1	* Mask off old odd character
+		or.w	d0,d1		* OR in the new character
+		move.w	d1,(a0)+	* Store the updated word in video RAM
+		addq.l	#2,a0		* Point at the attribute word
+*
+vputcvx:	move.w	P_ATR(a6),(a0)	* Store new attributes in video RAM
+		unlk	a6		* Unlink the stack frame
+		rts			* Return to caller
+*
+		.end
Index: vlib/vputp.s
===================================================================
--- vlib/vputp.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vputp.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,109 @@
+* ------------------------------------------------------------------------------
+* vputp.s -- put a pixel into a 4-bit per pixel bitmap object
+* Version 4 -- 1987-08-04 -- D.N. Lynx Crowe
+* (c) Copyright 1987 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+*	int
+*	vputp(octad, xloc, yloc, val)
+*	struct octent *octad;
+*	int xloc, yloc;
+*
+*		Puts the pixel value 'val' at ('xloc','yloc') in the
+*		4-bit per pixel bitmap object described by 'octad'.
+*
+*	-----
+*	struct octent {
+*
+*		uint	ysize,
+*			xsize;
+*
+*		int	objx,
+*			objy;
+*
+*		uint	*obase;
+*
+*		char	opri,
+*			obank;
+*
+*		uint	odtw0,
+*			odtw1;
+*	};
+*
+		.text
+*
+		.xdef	_vputp
+*
+OCTAD		.equ	8
+XLOC		.equ	12
+YLOC		.equ	14
+VAL		.equ	16
+*
+YSIZE		.equ	0
+XSIZE		.equ	2
+OBJX		.equ	4
+OBJY		.equ	6
+OBASE		.equ	8
+OPRI		.equ	12
+OBANK		.equ	13
+ODTW0		.equ	14
+ODTW1		.equ	16
+*
+		.page
+*
+_vputp:		link	a6,#0			* Link stack frames
+		movea.l	OCTAD(a6),a1		* Get OCTAD base into a1
+		move.w	XLOC(a6),d0		* Get XLOC into d0
+		cmp.w	XSIZE(a1),d0		* Check XLOC range
+		bge	vputerr			* ERROR if too large
+*
+		tst.w	d0			* Check XLOC sign
+		bmi	vputerr			* ERROR if negative
+*
+		move.w	YLOC(a6),d1		* Get YLOC into d1 to test
+		cmp.w	YSIZE(a1),d1		* Check YLOC range
+		bge	vputerr			* ERROR if too large
+*
+		tst.w	d1			* Check YLOC sign
+		bmi	vputerr			* ERROR if negative
+*
+		lsr.w	#2,d0			* Divide XLOC by 4
+		move.w	XSIZE(a1),d1		* Get width into d1
+		lsr.w	#2,d1			* Divide width by 4
+		mulu	YLOC(a6),d1		* Multiply width/4 by YLOC
+		ext.l	d0			* Extend XLOC/4 to a long
+		add.l	d0,d1			* ... and add it to d1
+		lsl.l	#1,d1			* Make d1 a word offset
+		add.l	OBASE(a1),d1		* Add OBASE to d1
+		movea.l	d1,a0			* Make a0 point at bitmap data
+		move.w	XLOC(a6),d0		* Get XLOC
+		andi.l	#$03,d0			* Mask to low 2 bits
+		add.l	d0,d0			* Multiply by 2 for word index
+		move.l	d0,d1			* Save index in d1
+		add.l	#MTAB,d0		* Add mask table base
+		movea.l	d0,a2			* a2 points at mask
+		add.l	#STAB,d1		* Add shift table base to index
+		move.l	d1,a1			* a1 points at shift count
+		move.w	(a1),d0			* Get shift count in d0
+		move.w	VAL(a6),d1		* Get new pixel in d1
+		andi.w	#$0F,d1			* Mask down to 4 bits
+		lsl.w	d0,d1			* Shift into position for OR
+		move.w	(a0),d0			* Get old bitmap word in d0
+		and.w	(a2),d0			* Mask out old pixel
+		or.w	d1,d0			* OR in new pixel
+		move.w	d0,(a0)			* Store updated word in bitmap
+		clr.l	d0			* Set return value = 0 = OK
+*
+vputexit:	unlk	a6			* Unlink stack frame
+		rts				* Return to caller
+*
+vputerr:	moveq.l	#-1,d0			* Set return value = -1 = ERROR
+		bra	vputexit		* Go unlink stack and return
+*
+		.page
+*
+		.data
+*
+MTAB:		dc.w	$FFF0,$FF0F,$F0FF,$0FFF	* Mask table
+STAB:		dc.w	0,4,8,12		* Shift table
+*
+		.end
Index: vlib/vputs.c
===================================================================
--- vlib/vputs.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vputs.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,79 @@
+/*
+   =============================================================================
+	vputs.c -- video display string put functions
+	Version 2 -- 1987-03-30 -- D.N. Lynx Crowe
+	(c) Copyright 1987 -- D.N. Lynx Crowe
+
+	These functions drive the video character write function vputc()
+	which puts characters into a 82716 video RAM character object.
+
+	Full attribute format is assumed.
+   =============================================================================
+*/
+
+#include <stddefs.h>
+
+typedef	unsigned int	uint;
+
+extern int	vputc();
+
+/*
+   =============================================================================
+	vputs(sbase, row, col, str, attrib)
+
+	Write string str to video RAM object pointed to by sbase
+	at (row,col) with attrib used for all characters.
+   =============================================================================
+*/
+
+vputs(sbase, row, col, str, attrib)
+uint *sbase, row, col, attrib;
+char *str;
+{
+	uint	c;
+
+	while (c = *str++) {
+
+		vputc(sbase, row, col, c, attrib);
+
+		if (++col GE 64) {
+
+			col = 0;
+
+			if (++row GE 25)
+				row = 0;
+		}
+	}
+}
+
+/* 
+ */
+
+/*
+   =============================================================================
+	vputsa(sbase, row, col, str, attrib)
+
+	Write string str in video RAM pointed to by sbase starting
+	at (row, col) using attributes from the words pointed to by attrib.
+   =============================================================================
+*/
+
+vputsa(sbase, row, col, str, attrib)
+uint *sbase, row, col, *attrib;
+char *str;
+{
+	uint	c;
+
+	while (c = *str++) {
+
+		vputc(sbase, row, col, c, *attrib++);
+
+		if (++col GE 64) {
+
+			col = 0;
+
+			if (++row GE 25)
+				row = 0;
+		}
+	}
+}
Index: vlib/vputsv.c
===================================================================
--- vlib/vputsv.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vputsv.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,82 @@
+/*
+   =============================================================================
+	vputsv.c -- video display string put functions
+	Version 1 -- 1988-10-06 -- D.N. Lynx Crowe
+	(c) Copyright 1988 -- D.N. Lynx Crowe
+
+	These functions drive the video character write function vputc()
+	which puts characters into a 82716 video RAM character object.
+
+	Full attribute format is assumed.
+   =============================================================================
+*/
+
+#include "stddefs.h"
+
+typedef	unsigned int	uint;
+
+extern int	vputcv();
+
+/*
+   =============================================================================
+	vputsv(sbase, row, col, str, attrib, len)
+
+	Write string str to video RAM object pointed to by sbase
+	at (row,col) with attrib used for all characters. Line length is len.
+   =============================================================================
+*/
+
+vputsv(sbase, row, col, str, attrib, len)
+uint *sbase, row, col;
+char *str;
+uint attrib, len;
+{
+	uint	c;
+
+	while (c = *str++) {
+
+		vputcv(sbase, row, col, c, attrib, len);
+
+		if (++col GE 64) {
+
+			col = 0;
+
+			if (++row GE 25)
+				row = 0;
+		}
+	}
+}
+
+/* 
+ */
+
+/*
+   =============================================================================
+	vputsav(sbase, row, col, str, attrib, len)
+
+	Write string str in video RAM pointed to by sbase starting
+	at (row, col) using attributes from the words pointed to by attrib.
+	Line length is len.
+   =============================================================================
+*/
+
+vputsav(sbase, row, col, str, attrib, len)
+uint *sbase, row, col;
+char *str;
+uint *attrib, len;
+{
+	uint	c;
+
+	while (c = *str++) {
+
+		vputcv(sbase, row, col, c, *attrib++, len);
+
+		if (++col GE 64) {
+
+			col = 0;
+
+			if (++row GE 25)
+				row = 0;
+		}
+	}
+}
Index: vlib/vsetav.s
===================================================================
--- vlib/vsetav.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vsetav.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,50 @@
+* ------------------------------------------------------------------------------
+* vsetav.s -- set a character's attributes in video RAM
+* Version 1 -- 1988-10-11 -- D.N. Lynx Crowe
+* (c) Copyright 1988 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+*
+*	vsetav(adr, row, col, atr, len)
+*	unsigned int *adr, row, col, atr, len;
+*
+*		Sets attribute 'atr' at ('row', 'col') in the
+*		full attribute text object at 'adr'
+*		using a line length of 'len'.
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_vsetav
+*
+P_ADR		.equ	8
+P_ROW		.equ	12
+P_COL		.equ	14
+P_ATR		.equ	16
+P_LEN		.equ	18
+*
+_vsetav:	link	a6,#0		* Link stack frame pointer
+		move.w	P_ROW(a6),d0	* Get row
+		mulu	P_LEN(a6),d0	* Multiply by len
+		clr.l	d1		* Clear out d1
+		move.w	P_COL(a6),d1	* Get col
+		add.l	d1,d0		* Add col into d0 to get char. #
+		move.l	d0,d1		* Develop cw = (cn/2)*6 in d1
+		andi.l	#$FFFFFFFE,d1	* ...
+		move.l	d1,d2		* ...
+		add.l	d1,d1		* ...
+		add.l	d2,d1		* ...
+		add.l	P_ADR(a6),d1	* Add sbase to cw
+		movea.l	d1,a0		* a0 points at the word with the char.
+		btst.l	#0,d0		* Odd char. location ?
+		bne	vsetav1		* Jump if so
+*
+		addq.l	#2,a0		* Point at the attribute word
+		bra	vsetavx		* Go set attribute
+*
+vsetav1:	addq.l	#4,a0		* Point at the attribute word
+*
+vsetavx:	move.w	P_ATR(a6),d0	* Get new attributes
+		or.w	d0,(a0)		* Set new attributes in video RAM
+		unlk	a6		* Unlink the stack frame
+		rts			* Return to caller
+*
+		.end
Index: vlib/vsetcv.s
===================================================================
--- vlib/vsetcv.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vsetcv.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,52 @@
+* ------------------------------------------------------------------------------
+* vsetcv.s -- set a character's colors in video RAM
+* Version 1 -- 1988-10-11 -- D.N. Lynx Crowe
+* (c) Copyright 1988 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+*
+*	vsetcv(adr, row, col, cfb, len)
+*	unsigned int *adr, row, col, cfb, len;
+*
+*		Sets colors 'cfb' at ('row', 'col') in the
+*		full attribute text object at 'adr'
+*		using a line length of 'len'.
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_vsetcv
+*
+P_ADR		.equ	8
+P_ROW		.equ	12
+P_COL		.equ	14
+P_CFB		.equ	16
+P_LEN		.equ	18
+*
+_vsetcv:	link	a6,#0		* Link stack frame pointer
+		move.w	P_ROW(a6),d0	* Get row
+		mulu	P_LEN(a6),d0	* Multiply by len
+		clr.l	d1		* Clear out d1
+		move.w	P_COL(a6),d1	* Get col
+		add.l	d1,d0		* Add col into d0 to get char. #
+		move.l	d0,d1		* Develop cw = (cn/2)*6 in d1
+		andi.l	#$FFFFFFFE,d1	* ...
+		move.l	d1,d2		* ...
+		add.l	d1,d1		* ...
+		add.l	d2,d1		* ...
+		add.l	P_ADR(a6),d1	* Add sbase to cw
+		movea.l	d1,a0		* a0 points at the word with the char.
+		btst.l	#0,d0		* Odd char. location ?
+		bne	vsetcv1		* Jump if so
+*
+		addq.l	#2,a0		* Point at the attribute word
+		bra	vsetcvx		* Go set attribute
+*
+vsetcv1:	addq.l	#4,a0		* Point at the attribute word
+*
+vsetcvx:	move.w	(a0),d0		* Get old attributes
+		andi.w	#$FF00,d0	* Remove old colors
+		or.w	P_CFB(a6),d0	* Get new colors
+		move.w	d0,(a0)		* Set new attributes in video RAM
+		unlk	a6		* Unlink the stack frame
+		rts			* Return to caller
+*
+		.end
Index: vlib/vsetpal.c
===================================================================
--- vlib/vsetpal.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vsetpal.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,89 @@
+/*
+   =============================================================================
+	vsetpal.c -- Buchla 700 color palette setup
+	Version 2 -- 1987-11-20 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#define	PALETTE		((unsigned *)0x280000L)
+
+short	dfltpal[16][3] = {
+
+/*	 R  G  B	  color */
+
+	{0, 0, 0},	/*  0: Black */
+	{0, 1, 0},	/*  1: Dark Gray */
+	{0, 0, 2},	/*  2: Dark Blue */
+	{0, 0, 3},	/*  3: Light Blue */
+	{0, 2, 0},	/*  4: Dark Green */
+	{0, 3, 0},	/*  5: Light Green */
+	{0, 2, 2},	/*  6: Dark Cyan */
+	{0, 3, 3},	/*  7: Light Cyan */
+	{3, 0, 0},	/*  8: Red */
+	{3, 1, 0},	/*  9: Orange */
+	{3, 0, 3},	/* 10: Purple */
+	{3, 1, 2},	/* 11: Magenta */
+	{3, 2, 0},	/* 12: Brown */
+	{2, 3, 0},	/* 13: Yellow */
+	{2, 2, 2},	/* 14: Light Gray */
+	{3, 3, 3},	/* 15: White */
+};
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	vsetpal() -- set a palette RAM entry to a specific color
+
+	slot	0..15	color entry number
+	red	0..3	red value
+	grn	0..3	green value
+	blu	0..3	blue value
+   =============================================================================
+*/
+
+vsetpal(slot, red, grn, blu)
+register unsigned slot, red, grn, blu;
+{
+	register unsigned palval;
+	unsigned *pal;
+
+	pal = PALETTE;
+
+	palval = (slot << 6) |
+		 ((red & 1) << 5) | ((red & 2) << 1) |
+		 ((grn & 1) << 4) | (grn & 2) |
+		 ((blu & 1) << 3) | ((blu & 2) >> 1);
+
+	*pal = palval ^ 0x003F;
+}
+
+/* 
+
+*/
+
+/*
+   =============================================================================
+	vsndpal() -- send a palette table to the video palette RAM
+
+	pp	pointer to a short [16][3] array,
+
+		where:
+			pp[n][0]	= blue value
+			pp[n][1]	= green value
+			pp[n][2]	= red value
+
+				n	= slot number (0..15)
+   =============================================================================
+*/
+
+vsndpal(pp)
+short pp[16][3];
+{
+	register short i;
+
+	for (i = 0; i < 16; i++)
+		vsetpal(i, pp[i][0], pp[i][1], pp[i][2]);
+}
Index: vlib/vsinit.c
===================================================================
--- vlib/vsinit.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vsinit.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,27 @@
+/*
+   =============================================================================
+	vsinit.c -- intialize VSDD software support variables
+	Version 5 -- 1988-08-15 -- D.N. Lynx Crowe
+	(c) Copyright 1987,1988 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "hwdefs.h"
+#include "graphdef.h"
+#include "vsdd.h"
+#include "vsddvars.h"
+#include "memory.h"
+
+/*
+   =============================================================================
+	VSinit() -- initialize VSDD software support variables
+   =============================================================================
+*/
+
+VSinit()
+{
+	v_nobj = 0;
+	v_obpri = 0;
+	memsetw(v_obtab, 0, (sizeof v_obtab)/2);
+	v_curob = &v_obtab[0];
+}
Index: vlib/vsplot4.s
===================================================================
--- vlib/vsplot4.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vsplot4.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,157 @@
+* ------------------------------------------------------------------------------
+* vsplot4.s -- output characters to a 4-bit / pixel graphics window
+*    with variable vertical pitch, etc.
+* Version 1 -- 1988-10-07 -- D.N. Lynx Crowe
+* (c) Copyright 1988 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+*
+*	vsplot4(obase, nw, fg, row, col, str, pitch, ht, cgtab)
+*	uint *obase, nw, fg, row, col, pitch, ht, cgtab[][256];
+*	char *str;
+*
+*		Outputs characters from the string at 'str' to an 'nw'
+*		character wide 4-bit per pixel graphics window at 'obase'
+*		at ('row','col'), using 'fg' as the foreground color.
+*		Uses cgtab[][256] as the VSDD formatted character
+*		generator table.  Assumes 'ht' bit high characters in the
+*		cgtable.  Uses 'pitch' as the vertical spacing between
+*		character rows.  No error checks are done.
+*		The string must fit the output area (no overlaps, single line).
+*		This function leaves the zero pixels alone and just sets the
+*		one pixels to the foreground color, allowing overlapping
+*		character cells.
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_vsplot4
+*
+* Argument offsets from a6:
+*
+OBASE		.equ	8		* LONG - Output area base address
+NW		.equ	12		* WORD - Character width of output area
+FG		.equ	14		* WORD - Foreground color
+ROW		.equ	16		* WORD - Row
+COL		.equ	18		* WORD - Column
+STR		.equ	20		* LONG - String base address
+PITCH		.equ	24		* WORD - Vertical spacing between rows
+HT		.equ	26		* WORD - Character height
+CGTAB		.equ	28		* LONG - Character generator pionter
+*
+* Program constant definitions:
+*
+HPIX		.equ	8		* Character width in pixels
+HCW		.equ	4		* Horizontal character width (bytes)
+PSHIFT		.equ	12		* Pixel shift into MS bits
+HSHIFT		.equ	4		* Pixel right shift
+*
+		.page
+*
+* Register usage:
+*
+*	d0	output word and scratch
+*	d1	CG word and scratch
+*	d2	pixel counter
+*
+*	d3	foreground color (in the 4 ms bits)
+*	d4	background color (in the 4 ms bits)
+*	d5	width of the area in bytes
+*	d6	scan line counter
+*
+*	a0	CG table pointer
+*	a1	output area scan line pointer
+*	a2	input string character pointer
+*
+*	a3	output area character base pointer
+*
+*	a6	frame pointer
+*	a7	stack pointer
+*
+		.page
+*
+_vsplot4:	link	a6,#0		* Link stack frames
+		movem.l	d3-d6/a3,-(a7)	* Save registers we use
+		move.w	#PSHIFT,d1	* Set shift constant
+		move.w	FG(a6),d3	* Setup foreground color
+		lsl.w	d1,d3		* ... in ms 4 bits of d3.W
+		move.w	NW(a6),d5	* Get line width in d5.W
+		lsl.w	#2,d5		* Multiply width by 4 for offset
+		move.w	ROW(a6),d0	* Calculate output address
+		move.w	PITCH(a6),d1	* ... PITCH
+		mulu	d1,d0		* ... * ROW
+		add.w	HT(a6),d0	* ... + HT-1
+		subq.w	#1,d0		* ...
+		mulu	d5,d0		* ... * NW
+		clr.l	d1		* ...
+		move.w	COL(a6),d1	* ... + 
+		lsl.w	#2,d1		* ... COL * 4
+		add.l	d1,d0		* ...
+		add.l	OBASE(a6),d0	* ... + OBASE
+		movea.l	d0,a3		* Leave output address in a3
+		movea.l	STR(a6),a2	* Put string address in a2
+*
+cgl0:		clr.l	d0		* Clear out upper bits of d0
+		move.b	(a2)+,d0	* Get next character
+		beq	cgl5		* Done if character EQ 0
+*
+		movea.l	a3,a1		* Establish output pointer in a1
+		adda.l	#HCW,a3		* Update output pointer for next char.
+		movea.l	CGTAB(a6),a0	* Establish CG pointer in a0
+		lsl.w	#1,d0		* ... 2 * character
+		adda.w	d0,a0		* ... + cgtab address
+		move.w	HT(a6),d6	* Set scan line counter in d6
+		subq.w	#1,d6		* ...
+*
+		.page
+cgl1:		move.w	(a0),d1		* Get character generator word in d1
+		move.w	#(HPIX/2)-1,d2	* Set pixel counter in d2
+		clr.l	d4		* Get old output word as background
+		move.w	(a1),d4		* ...
+		swap	d4		* ...
+*
+cgl2:		lsr.w	#HSHIFT,d0	* Shift output word right 1 pixel
+		lsr.l	#HSHIFT,d4	* Shift background word 1 pixel
+		andi.l	#$FFFFF000,d4	* Mask for upper 4 bits of d4.W
+		btst.l	#0,d1		* Check CG word ls bit
+		beq	cgl3		* Set background color if bit EQ 0
+*
+		or.w	d3,d0		* OR foreground color into output word
+		bra	cgl4		* Go update CG word
+*
+cgl3:		or.w	d4,d0		* OR background color into output word
+*
+cgl4:		lsr.w	#1,d1		* Shift CG word right 1 pixel
+		dbf	d2,cgl2		* Loop for first 4 pixels
+*
+		move.w	d0,(a1)+	* Store first output word in scan line
+		move.w	#(HPIX/2)-1,d2	* Set pixel counter in d2
+		clr.l	d4		* Get old output word as background
+		move.w	(a1),d4		* ...
+		swap	d4		* ...
+*
+cgl2a:		lsr.w	#HSHIFT,d0	* Shift output word right 1 pixel
+		lsr.l	#HSHIFT,d4	* Shift background word 1 pixel
+		andi.l	#$FFFFF000,d4	* Mask for upper bits of d4.W
+		btst.l	#0,d1		* Check CG word ls bit
+		beq	cgl3a		* Set background color if bit EQ 0
+*
+		or.w	d3,d0		* OR foreground color into output word
+		bra	cgl4a		* Go update CG word
+*
+cgl3a:		or.w	d4,d0		* OR background color into output word
+*
+cgl4a:		lsr.w	#1,d1		* Shift CG word right 1 pixel
+		dbf	d2,cgl2a	* Loop for last 4 pixels
+*
+		move.w	d0,(a1)		* Store second output word in scan line
+		suba.w	d5,a1		* Update output pointer
+		suba.w	#2,a1		* ...
+		adda.l	#512,a0		* Update CG pointer for next scan line
+		dbf	d6,cgl1		* Loop for all scan lines
+*
+		bra	cgl0		* Loop for next character
+*
+cgl5:		movem.l	(a7)+,d3-d6/a3	* Restore registers
+		unlk	a6		* Unlink stack frames
+		rts			* Return to caller
+*
+		.end
Index: vlib/vspray4.c
===================================================================
--- vlib/vspray4.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vspray4.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,66 @@
+/*
+   =============================================================================
+	vspray4.c -- spray a pattern onto a graphics screen using tsplot4()
+	Version 5 -- 1987-10-09 -- D.N. Lynx Crowe
+   =============================================================================
+*/
+
+#include "stddefs.h"
+#include "vsddsw.h"
+
+static 	char cl[81];
+
+/*
+   =============================================================================
+	vspray4(vobj, vwid, fg, ml, vb, pitch) -- spray a pattern on the screen
+
+	Uses 'vobj' of width 'vwid' as the screen, 'fg' as the color, 'vb' as
+	the bank, 'pitch' as the vertical pitch, and 'ml' as the pattern.
+
+	If 'vb' EQ -1,  the bank is not set.  The color in 'fg' will be taken
+	from the lower 4 bits.
+
+	The list 'ml' points at pairs of counts and characters.  The last count
+	is -1,  and the list terminates with a null pointer.
+   =============================================================================
+*/
+
+/* 
+
+*/
+
+vspray4(vobj, vwid, fg, ml, vb, pitch)
+unsigned *vobj;
+short vwid, fg, vb, pitch;
+char *ml[];
+{
+	register char *cp, *lp, c;
+	register short j, k, row;
+
+	row = 0;
+
+	fg &= 0x000F;
+	fg |= fg << 4;
+	fg |= fg << 8;
+
+	if (-1 NE vb)
+		vbank(vb);
+
+	while (NULL NE (cp = *ml++)) {
+
+		lp = cl;
+
+		while (-1 NE (j = *cp++)) {
+
+			j &= 0x00FF;
+			c = *cp++;
+
+			for (k = 0; k < j; k++)
+				*lp++ = c;
+		}
+
+		*lp = '\0';
+
+		tsplot4(vobj, vwid, fg, row++, 0, cl, pitch);
+	}
+}
Index: vlib/vtext.c
===================================================================
--- vlib/vtext.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vtext.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,27 @@
+/*
+   =============================================================================
+	vtext.c -- output a text string to the VSDD in 1 byte / character mode
+	Version 3 -- 1987-06-02 -- D.N. Lynx Crowe
+
+	Assumes VSDD is pointing at bank 0.
+   =============================================================================
+*/
+
+static int	msk[] = { 0xFF00, 0x00FF };
+
+vtext(obj, nc, row, col, ip)
+register unsigned *obj, nc, row, col;
+register char *ip;
+{
+	register unsigned *op;
+
+	while (*ip) {
+
+		op = obj + ((nc >> 1) * row) + (col >> 1);
+
+		*op = (*op & (unsigned)msk[col & 1]) |
+		      ((*ip++ & 0x00FF) << ((col & 1) ? 8 : 0));
+
+		col++;
+	}
+}
Index: vlib/vvputsv.s
===================================================================
--- vlib/vvputsv.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vvputsv.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,148 @@
+* ------------------------------------------------------------------------------
+* vvputsv.s -- output characters to a 4-bit / pixel graphics window
+* with variable vertical pitch
+* Version 1 -- 1988-10-07 -- D.N. Lynx Crowe
+* (c) Copyright 1988 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+*
+*	vvputsv(obase, nw, fg, bg, row, col, str, pitch, ht, cgtab)
+*	uint *obase, nw, fg, bg, row, col, pitch, ht, cgtab[][256];
+*	char *str;
+*
+*		Outputs characters from the string at 'str' to an 'nw'
+*		character wide 4-bit per pixel graphics window at 'obase'
+*		at ('row','col'), using 'fg' as the foreground color, and
+*		'bg' as the background color.  Uses cgtab[][256] as the
+*		VSDD formatted character generator table.  Assumes 'ht' line
+*		high characters in the cg table.  Uses 'pitch' as the vertical
+*		spacing between character rows.  No error checks are done.
+*		The string must fit the output area (no overlaps, single line).
+*
+* ------------------------------------------------------------------------------
+		.text
+*
+		.xdef	_vvputsv
+*
+* Argument offsets from a6:
+*
+OBASE		.equ	8		* LONG - Output area base address
+NW		.equ	12		* WORD - Character width of output area
+FG		.equ	14		* WORD - Foreground color
+BG		.equ	16		* WORD - Background color
+ROW		.equ	18		* WORD - Row
+COL		.equ	20		* WORD - Column
+STR		.equ	22		* LONG - String base address
+PITCH		.equ	26		* WORD - Vertical spacing between rows
+HT		.equ	28		* WORD - Character height  (LE PITCH)
+CGTAB		.equ	30		* LONG - Character generator table
+*
+* Program constant definitions:
+*
+HPIX		.equ	8		* Character width in pixels
+HCW		.equ	4		* Horizontal character width (bytes)
+PSHIFT		.equ	12		* Pixel shift into MS bits
+HSHIFT		.equ	4		* Pixel right shift
+*
+		.page
+*
+* Register usage:
+*
+*	d0	output word and scratch
+*	d1	CG word and scratch
+*	d2	pixel counter
+*
+*	d3	foreground color (in the 4 ms bits)
+*	d4	background color (in the 4 ms bits)
+*	d5	width of the area in bytes
+*	d6	scan line counter
+*
+*	a0	CG table pointer
+*	a1	output area scan line pointer
+*	a2	input string character pointer
+*
+*	a3	output area character base pointer
+*
+*	a6	frame pointer
+*	a7	stack pointer
+*
+		.page
+*
+_vvputsv:	link	a6,#0		* Link stack frames
+		movem.l	d3-d6/a3,-(a7)	* Save registers we use
+		move.w	#PSHIFT,d1	* Set shift constant
+		move.w	FG(a6),d3	* Setup foreground color
+		lsl.w	d1,d3		* ... in ms 4 bits of d3.W
+		move.w	BG(a6),d4	* Setup background color
+		lsl.w	d1,d4		* ... in ms 4 bits of d4.W
+		move.w	NW(a6),d5	* Get line width in d5.W
+		lsl.w	#2,d5		* Multiply width by 4 for offset
+		move.w	ROW(a6),d0	* Calculate output address
+		move.w	PITCH(a6),d1	* ... PITCH
+		mulu	d1,d0		* ... * ROW
+		add.w	#HT(a6),d0	* ... + HT-1
+		subq.w	#1,d0		* ...
+		mulu	d5,d0		* ... * NW
+		clr.l	d1		* ...
+		move.w	COL(a6),d1	* ... + 
+		lsl.w	#2,d1		* ... COL * 4
+		add.l	d1,d0		* ...
+		add.l	OBASE(a6),d0	* ... + OBASE
+		movea.l	d0,a3		* Leave output address in a3
+		movea.l	STR(a6),a2	* Put string address in a2
+*
+cgl0:		clr.l	d0		* Clear out upper bits of d0
+		move.b	(a2)+,d0	* Get next character
+		beq	cgl5		* Done if character EQ 0
+*
+		movea.l	a3,a1		* Establish output pointer in a1
+		adda.l	#HCW,a3		* Update output pointer for next char.
+		movea.l	CGTAB(a6),a0	* Establish CG pointer in a0
+		lsl.w	#1,d0		* ... 2 * character
+		adda.w	d0,a0		* ... + cg table address
+		move.w	HT(a6),d6	* Set scan line counter in d6
+		subq.w	#1,d6		* ... to HT-1
+*
+		.page
+cgl1:		move.w	(a0),d1		* Get character generator word in d1
+		move.w	#(HPIX/2)-1,d2	* Set pixel counter in d2
+*
+cgl2:		lsr.w	#HSHIFT,d0	* Shift output word right 1 pixel
+		btst.l	#0,d1		* Check CG word ls bit
+		beq	cgl3		* Set background color if bit EQ 0
+*
+		or.w	d3,d0		* OR foreground color into output word
+		bra	cgl4		* Go update CG word
+*
+cgl3:		or.w	d4,d0		* OR background color into output word
+*
+cgl4:		lsr.w	#1,d1		* Shift CG word right 1 pixel
+		dbf	d2,cgl2		* Loop for first 4 pixels
+*
+		move.w	d0,(a1)+	* Store first output word in scan line
+		move.w	#(HPIX/2)-1,d2	* Set pixel counter in d2
+*
+cgl2a:		lsr.w	#HSHIFT,d0	* Shift output word right 1 pixel
+		btst.l	#0,d1		* Check CG word ls bit
+		beq	cgl3a		* Set background color if bit EQ 0
+*
+		or.w	d3,d0		* OR foreground color into output word
+		bra	cgl4a		* Go update CG word
+*
+cgl3a:		or.w	d4,d0		* OR background color into output word
+*
+cgl4a:		lsr.w	#1,d1		* Shift CG word right 1 pixel
+		dbf	d2,cgl2a	* Loop for last 4 pixels
+*
+		move.w	d0,(a1)		* Store second output word in scan line
+		suba.w	d5,a1		* Update output pointer
+		suba.w	#2,a1		* ...
+		adda.l	#512,a0		* Update CG pointer for next scan line
+		dbf	d6,cgl1		* Loop for all scan lines
+*
+		bra	cgl0		* Loop for next character
+*
+cgl5:		movem.l	(a7)+,d3-d6/a3	* Restore registers
+		unlk	a6		* Unlink stack frames
+		rts			* Return to caller
+*
+		.end
Index: vlib/vwputm.c
===================================================================
--- vlib/vwputm.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vwputm.c	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,38 @@
+/*
+   =============================================================================
+	vwputm.c -- put a menu in a 2-bit per pixel graphics window
+	Version 1 -- 1987-04-13 -- D.N. Lynx Crowe
+
+	vwputm(obase, nw, fg, bg, row, col, ml)
+	unsigned int *obase;
+	int nw, fg, bg;
+	char *ml[];
+
+		Writes the menu described by the list 'ml' in the
+		'nw' character wide bitmap 'obase', using 'fg' for
+		the foreground color and 'bg' for the background.
+		The menu is at ('row','col') in the bitmap.
+   =============================================================================
+*/
+
+#include <vsdd.h>
+
+extern	int	vwputs();
+
+/*
+   =============================================================================
+	vwputm(obase, nw, fg, bg, row, col, ml) -- output a menu in a bitmap
+   =============================================================================
+*/
+
+vwputm(obase, nw, fg, bg, row, col, ml)
+unsigned int *obase;
+int nw, fg, bg, row, col;
+register char *ml[];
+{
+	while (*ml) {
+
+		vwputs(obase, nw, fg, bg, row++, col, *ml++);
+	}
+}
+	
Index: vlib/vwputp.s
===================================================================
--- vlib/vwputp.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vwputp.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,108 @@
+* ------------------------------------------------------------------------------
+* vwputp.s -- put a pixel into a 2-bit per pixel bitmap object
+* Version 2 -- 1987-04-14 -- D.N. Lynx Crowe
+* (c) Copyright 1987 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+*	int
+*	vwputp(octad, xloc, yloc, val)
+*	struct octent *octad;
+*	int xloc, yloc;
+*
+*		Writes the pixel value 'val' into the 2-bit per pixel
+*		bitmap object described by 'octad' at ('xloc','yloc').
+*
+*	-----
+*
+*	struct octent {
+*
+*		uint	ysize,
+*			xsize;
+*
+*		int	objx,
+*			objy;
+*
+*		uint	*obase;
+*
+*		char	opri,
+*			oflags;
+*
+*		uint	odtw0,
+*			odtw1;
+*	};
+*
+*	Upper left corner of screen is (0,0) origin.
+*
+		.text
+*
+		.xdef	_vputp
+*
+OCTAD		.equ	8
+XLOC		.equ	12
+YLOC		.equ	14
+VAL		.equ	16
+*
+YSIZE		.equ	0
+XSIZE		.equ	2
+OBJX		.equ	4
+OBJY		.equ	6
+OBASE		.equ	8
+OPRI		.equ	12
+OFLAGS		.equ	13
+ODTW0		.equ	14
+ODTW1		.equ	16
+*
+		.page
+*
+_vwputp:	link	a6,#0			* Link stack frames
+		movea.l	OCTAD(a6),a1		* Get OCTAD base into a1
+		move.w	XLOC(a6),d0		* Get XLOC into d0
+		cmp.w	XSIZE(a1),d0		* Check XLOC range
+		bge	vputerr			* ERROR if too large
+*
+		tst.w	d0			* Check XLOC sign
+		bmi	vputerr			* ERROR if negative
+*
+		move.w	YLOC(a6),d1		* Get YLOC into d1 to test
+		cmp.w	YSIZE(a1),d1		* Check YLOC range
+		bge	vputerr			* ERROR if too large
+*
+		tst.w	d1			* Check YLOC sign
+		bmi	vputerr			* ERROR if negative
+*
+		lsr.w	#3,d0			* Divide XLOC by 8
+		move.w	XSIZE(a1),d1		* Get width into d1
+		lsr.w	#3,d1			* Divide width by 8
+		mulu	YLOC(a6),d1		* Multiply width/8 by YLOC
+		ext.l	d0			* Extend XLOC/8 to a long
+		add.l	d0,d1			* ... and add it to d1
+		add.l	OBASE(a1),d1		* Add OBASE to d1
+		movea.l	d1,a0			* Make a0 point at bitmap data
+		move.w	XLOC(a6),d0		* Get XLOC
+		andi.l	#$07,d0			* Mask to low 3 bits
+		add.l	d0,d0			* Multiply by 2 for word index
+		move.l	d0,d1			* Save index in d1
+		add.l	#MTAB,d0		* Add mask table base
+		movea.l	d0,a2			* a2 points at mask
+		add.l	#STAB,d1		* Add shift table base to index
+		move.l	d1,a1			* a1 points at shift count
+		move.w	(a1),d0			* Get shift count in d0
+		move.w	VAL(a6),d1		* Get new pixel in d1
+		andi.w	#$03,d1			* Mask down to 2 bits
+		lsl.w	d0,d1			* Shift into position for OR
+		move.w	(a0),d0			* Get old bitmap word in d0
+		and.w	(a2),d0			* Mask out old pixel
+		or.w	d1,d0			* OR in new pixel
+		move.w	d0,(a0)			* Store updated word in bitmap
+		clr.l	d0			* Set return value = 0 = OK
+*
+vputexit:	unlk	a6			* Unlink stack frame
+		rts				* Return to caller
+*
+vputerr:	moveq.l	#-1,d0			* Set return value = -1 = ERROR
+		bra	vputexit		* Go unlink stack and return
+*
+MTAB:		dc.w	$FFFC,$FFF3,$FFCF,$FF3F	* Mask table
+		dc.w	$FCFF,$F3FF,$CFFF,$3FFF
+STAB:		dc.w	0,2,4,6,8,10,12,14	* Shift table
+*
+		.end
Index: vlib/vwputs.s
===================================================================
--- vlib/vwputs.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
+++ vlib/vwputs.s	(revision 109c83b4de0a1be1740921110e1aab18add40866)
@@ -0,0 +1,118 @@
+* ------------------------------------------------------------------------------
+* vwputs.s -- output a character string to a 2-bit per pixel graphics window
+* Version 9 -- 1987-07-28 -- D.N. Lynx Crowe
+* (c) Copyright 1987 -- D.N. Lynx Crowe
+* ------------------------------------------------------------------------------
+*
+*	vwputs(obase, nw, fg, bg, row, col, str)
+*	int *obase, nw, fg, bg, row, col;
+*	char *str;
+*
+*		Outputs characters from the string at 'str' to an 'nw'
+*		character wide 2-bit per pixel graphics window at 'obase'
+*		at ('row','col'), using 'fg' as the foreground color, and
+*		'bg' as the background color.  Uses cgtable[][256] as the
+*		VSDD formatted character generator table.
+*		No error checks are done.
+* ------------------------------------------------------------------------------
+*
+		.text
+		.xdef	_vwputs
+*
+		.xref	_cgtable
+*
+* Argument offsets from a6:
+*
+OBASE		.equ	8		* L:  Output area base address
+NW		.equ	12		* W:  Character width of output area
+FG		.equ	14		* W:  Foreground color
+BG		.equ	16		* W:  Background color
+ROW		.equ	18		* W:  Row
+COL		.equ	20		* W:  Column
+STR		.equ	22		* L:  String base address
+*
+* Miscellaneous constants:
+*
+HPIX		.equ	8		* Horizontal pixels in the character
+*
+NVPIX		.equ	12		* Vertical pixels in the character
+VPITCH		.equ	12		* Vertical pitch between characters
+*
+* Register usage:
+*
+*	d0	output word and scratch
+*	d1	CG word and scratch
+*	d2	pixel counter
+*	d3	foreground color (in the 2 ms bits)
+*	d4	background color (in the 2 ms bits)
+*	d5	width of the area in bytes
+*	d6	scan line counter
+*
+*	a0	CG table pointer
+*	a1	output area scan line pointer
+*	a2	input character pointer
+*	a3	output area character pointer
+*
+		.page
+*
+_vwputs:	link	a6,#0		* Link stack frames
+		movem.l	d3-d6/a3,-(a7)	* Save registers we use
+		move.w	#14,d1		* Set shift constant
+		move.w	FG(a6),d3	* Setup foreground color
+		lsl.w	d1,d3		* ... in ms 2 bits of d3
+		move.w	BG(a6),d4	* Setup background color
+		lsl.w	d1,d4		* ... in ms 2 bits of d4
+		move.w	NW(a6),d5	* Get width in characters in d5
+		lsl.w	#1,d5		* ... make it words
+		move.w	ROW(a6),d0	* Calculate output address
+		move.w	#VPITCH,d1	* ...
+		mulu	d1,d0		* ... ROW * VPITCH
+		add.w	#NVPIX-1,d0	* ... + NVPIX-1
+		mulu	d5,d0		* ... * NW
+		clr.l	d1		* ...
+		move.w	COL(a6),d1	* ... + (COL * 2)
+		lsl.l	#1,d1		* ...
+		add.l	d1,d0		* ...
+		add.l	OBASE(a6),d0	* ... + OBASE
+		movea.l	d0,a3		* Leave output address in a3
+		movea.l	STR(a6),a2	* Put string address in a2
+*
+		.page
+cgl0:		clr.l	d0		* Clear out upper bits of d0
+		move.b	(a2)+,d0	* Get next character
+		beq	cgl5		* Done if character EQ 0
+*
+		movea.l	a3,a1		* Establish output pointer in a1
+		adda.l	#2,a3		* Update output pointer for next char.
+		lea	_cgtable,a0	* Establish CG pointer in a0
+		lsl.w	#1,d0		* ... 2 * character
+		adda.w	d0,a0		* ... + _cgtable address
+		move.w	#NVPIX-1,d6	* Set scan line counter in d6
+*
+cgl1:		move.w	#HPIX-1,d2	* Set pixel counter in d2
+		move.w	(a0),d1		* Get character generator word in d1
+*
+cgl2:		lsr.w	#2,d0		* Shift output word right 1 pixel
+		btst.l	#0,d1		* Check CG word ls bit
+		beq	cgl3		* Set background color if bit EQ 0
+*
+		or.w	d3,d0		* OR foreground color into output word
+		bra	cgl4		* Go update CG word
+*
+cgl3:		or.w	d4,d0		* OR background color into  output word
+*
+cgl4:		lsr.w	#1,d1		* Shift CG word right 1 pixel
+		dbf	d2,cgl2		* Loop for all 8 pixels
+*
+		move.w	d0,(a1)		* Store output word in output bitmap
+		suba.w	d5,a1		* Update output pointer
+		adda.l	#512,a0		* Update CG pointer for next scan line
+		dbf	d6,cgl1		* Loop for all scan lines
+*
+		bra	cgl0		* Loop for next character
+*
+cgl5:		movem.l	(a7)+,d3-d6/a3	* Restore registers
+		unlk	a6		* Unlink stack frames
+		rts			* Return to caller
+*
+		.end
