#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 6)."
# Contents:  MANIFEST adagio.c adagio.h adaspace.c atxt.asm atxt.h
#   cext.h cintr.h cmdline.h cmt.lib.uu cmt.lnk cmtc.bat cmtl.bat
#   cmtprog.h dos.mac excldesc.c makefile maxspace.h midicode.h mm.c
#   moxc.h moxcasci.c moxcbend.c moxcctrl.c moxckydn.c moxckyup.c
#   moxcpddn.c moxcpdup.c moxcprgm.c moxcprog.h moxctouc.c mpu.h
#   musiprog.h noteoff.c pekpok.asm phase1.h phase2.h pitch.h readme
#   recmain.c record.h recspace.c timdif.h trans2.h traspace.c
#   userio.c userio.h
# Wrapped by lee@uhccux on Wed Mar 29 09:58:07 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'MANIFEST'\"
else
echo shar: Extracting \"'MANIFEST'\" \(0 characters\)
sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
END_OF_FILE
if test 0 -ne `wc -c <'MANIFEST'`; then
    echo shar: \"'MANIFEST'\" unpacked with wrong size!
fi
# end of 'MANIFEST'
fi
if test -f 'adagio.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'adagio.c'\"
else
echo shar: Extracting \"'adagio.c'\" \(4104 characters\)
sed "s/^X//" >'adagio.c' <<'END_OF_FILE'
X/*   Adagio compiler -- scan command line, call phase1, phase2 */
X
X/*****************************************************************************
X*	    Change Log
X*  Date	    | Change
X*-----------+-----------------------------------------------------------------
X* 12-Mar-86 | Created
X* 28-May-86 | Added calls to cmdline.c for command line parsing
X*****************************************************************************/
X
X#include "cext.h"
X#include "stdio.h"
X#include "adagio.h"
X#include "phase1.h"
X#include "phase2.h"
X#include "atxt.h"
X#include "userio.h"
X#include "cmdline.h"
X
Xchar score_na[name_length];  /* this will be available to phase1 and 2 */
X
X/****************************************************************************
X* Variables set by command line switches
X****************************************************************************/
Xextern int IsAT;
Xboolean no_mpu = false;		/* true if simulated */
X
X/****************************************************************************
X* Data for command line parsing
X****************************************************************************/
X#define nswitches 15
Xprivate char *switches[nswitches] = 
X    { "-debug", "-d", "-help", "-miditrace", "-m", "-trace", "-t", "-at",
X      "-metronome", "-met", "-simulated", "-s", "-xt", "-print", "-block" };
X
X#define noptions 3
Xprivate char *options[noptions] = { "-c", "-control", "-tune" };
X
X#define nmsw 2
Xprivate char *msw[nmsw] = { "-met", "-metronome" };
X
X#define nssw 2
Xprivate char *ssw[nssw] = { "-simulated", "-s" };
X
X/****************************************************************************
X*	Routines local to this module
X****************************************************************************/
Xprivate void cmdline_help();
X
X/****************************************************************************
X*				 cmdline_help
X* Effect: 
X*	Prints out command line help
X****************************************************************************/
X
Xprivate void cmdline_help()
X{
X    fprintf(stderr,"adagio [options] filename [options]\n");
X    fprintf(stderr,"	 Options are below.  Those with * are for wizrds:\n");
X    fprintf(stderr,"*	   -at		     PC/AT (secondary interrupt channel)\n");
X    fprintf(stderr,"	   -block	     disable MIDI thru\n");
X    fprintf(stderr,"	   -debug (-d)	     enable verbose debug mode\n");
X    fprintf(stderr,"	   -help	     this message\n");
X    fprintf(stderr,"	   -metronome (-met) turn on MPU-401 metronome\n");
X    fprintf(stderr,"	   -miditrace (-m)   turn on MIDI command trace\n");
X    fprintf(stderr,"	   -print	     print note data\n");
X    fprintf(stderr,"	   -tune file	     use tuning from file\n");
X    fprintf(stderr,"	   -simulated (-s)   run with simulated MPU-401\n");
X    fprintf(stderr,"	   -trace (-t)	     trace music\n");
X    fprintf(stderr,"*	   -xt		     PC/XT (no secondary interrupt channel)\n");
X}
X
X/****************************************************************************
X*				     main
X* Inputs:
X*	int argc: Count of arguments
X*	char * argv[]: Vector of argument pointers
X* Effect: 
X*	Runs adagio
X****************************************************************************/
X
Xvoid main(argc,argv)
X   int argc;
X   char * argv[];
X{
X    FILE *fp = NULL;
X    char *s;	/* temp pointer to input file name */
X
X    cl_init(switches, nswitches, options, noptions, argv, argc);
X
X    score_na[0] = 0;
X
X    if (cl_switch("-help")) {
X	cmdline_help(); 
X	return;
X    }
X
X    IsAT = (atxt() == ISAT);
X    if (cl_switch("-at")) {
X	if (!IsAT) { /* lie! */
X	    fprintf(stderr,"-at but not running on PC/AT!\n");
X	    return;
X	}
X	IsAT = true;
X    }
X
X    if (cl_nswitch(msw, nmsw) != NULL)
X	 metronome(true);
X
X    if (cl_switch("-help")) {
X	cmdline_help(); 
X	return;
X    }
X
X    if (cl_nswitch(ssw, nssw) != NULL) no_mpu = true;
X
X    if (cl_switch("-xt")) {
X	if (IsAT) { /* lie! */
X	    fprintf(stderr,"-xt but running on PC/AT!\n");
X	    return;
X	}
X    }
X
X    /* get input file: */
X	if ((s = cl_arg(1)) != NULL) strcpy(score_na, s);
X	fp = fileopen(score_na, "gio", "r", "Name of Adagio score file");
X
X    phase2(phase1(fp));
X}
END_OF_FILE
if test 4104 -ne `wc -c <'adagio.c'`; then
    echo shar: \"'adagio.c'\" unpacked with wrong size!
fi
# end of 'adagio.c'
fi
if test -f 'adagio.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'adagio.h'\"
else
echo shar: Extracting \"'adagio.h'\" \(1149 characters\)
sed "s/^X//" >'adagio.h' <<'END_OF_FILE'
X#define name_length 255
X
X#define num_voices 16
X#define minpitch -12
X#define maxpitch 115
X#define NO_PITCH (maxpitch+1)
X#define minprogram 1
X#define maxprogram 128
X
Xstruct note_struct {
X    long ndur;		/* duration */
X    char npitch;	/* pitch (middle C = 48) */
X    char nloud;		/* loudness (MIDI velocity) */
X    char nprogram;	/* adagio Z parameter (MIDI program) */
X    };
X
Xstruct ctrl_struct {
X    char value;
X    };
X
Xtypedef struct event_struct {
X    struct event_struct *next;
X    long ntime;		/* start time */
X    int nline;		/* line number from source code */
X    char nvoice;	/* adagio voice (MIDI Channel)
X			 *  if this is a control change, high order 4 bits
X			 *  contain the control number, otherwise high order
X			 *  4 bits are 0 (see is_note macro below)
X			 */
X    union {
X	struct note_struct note;
X	struct ctrl_struct ctrl;
X	} u;
X    } *event_type;
X
X#define nctrl 7
X#define ctrlsize (sizeof(struct event_struct) - \
X		  sizeof(struct note_struct) + sizeof(struct ctrl_struct))
X#define ctrl_voice(c, v) (((c) << 4) + (v))
X#define vc_ctrl(v) ((v) >> 4)
X#define vc_voice(v) ((v) & 0x0F)
X#define is_note(n) (((n)->nvoice & 0xF0) == 0)
END_OF_FILE
if test 1149 -ne `wc -c <'adagio.h'`; then
    echo shar: \"'adagio.h'\" unpacked with wrong size!
fi
# end of 'adagio.h'
fi
if test -f 'adaspace.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'adaspace.c'\"
else
echo shar: Extracting \"'adaspace.c'\" \(406 characters\)
sed "s/^X//" >'adaspace.c' <<'END_OF_FILE'
X/* adaspace.c -- free space initialization module for adagio program */
X
X/* this file defines the maximum allowable number of notes for phase1 */
X/* the number must be determined emperically because it depends upon  */
X/* the amount of storage that must be left around for phase2 */
X
X/* this should leave about 2KB free */
X#define MAXSPACE 48000
X
X/* export the free space counter */
Xlong space = MAXSPACE;
END_OF_FILE
if test 406 -ne `wc -c <'adaspace.c'`; then
    echo shar: \"'adaspace.c'\" unpacked with wrong size!
fi
# end of 'adaspace.c'
fi
if test -f 'atxt.asm' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'atxt.asm'\"
else
echo shar: Extracting \"'atxt.asm'\" \(840 characters\)
sed "s/^X//" >'atxt.asm' <<'END_OF_FILE'
X	title	ATXT - distinguish which processor is whom
X	include dos.mac
X
X	PSEG
X
X;; This is callable from C and returns a boolean value.	 The codes are
X;;	0 - an 8088
X;;	1 - a 286
X;; other codes may be added
X	public	_ATXT
X	if	LPROG
X_ATXT	proc	far
X	else
X_ATXT	proc	near
X	endif
X
X; push the SP.	If we are an 8086/8088, we will have the new SP; 
X; if we are an 80286 we will have the old sp
X
X	push	bx
X
X	mov	bx,sp	; save current sp
X
X	push	sp	; push it (this is the test!)
X
X; if sp = tos we are an 8088
X
X	pop	ax	; get the value we just pushed
X	cmp	ax,bx	; is it same as sp before push?
X	je	L286	; yes, we pushed current SP and we are an 80286
X	; it is different, it was incremented before pushing, we are
X	; an 8088
X	xor	ax,ax	; set ax to 0
X	jmp	return
XL286:	mov	ax,1	; set ax to 1, meaning '286
Xreturn: pop	bx	; restore bx
X	ret
X_ATXT	ENDP
X	ENDPS
X	end
END_OF_FILE
if test 840 -ne `wc -c <'atxt.asm'`; then
    echo shar: \"'atxt.asm'\" unpacked with wrong size!
fi
# end of 'atxt.asm'
fi
if test -f 'atxt.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'atxt.h'\"
else
echo shar: Extracting \"'atxt.h'\" \(79 characters\)
sed "s/^X//" >'atxt.h' <<'END_OF_FILE'
X/* atxt.h -- header for atxt.asm */
X
Xint atxt();
X#define ISAT 1
X#define ISXT 0
END_OF_FILE
if test 79 -ne `wc -c <'atxt.h'`; then
    echo shar: \"'atxt.h'\" unpacked with wrong size!
fi
# end of 'atxt.h'
fi
if test -f 'cext.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cext.h'\"
else
echo shar: Extracting \"'cext.h'\" \(134 characters\)
sed "s/^X//" >'cext.h' <<'END_OF_FILE'
X/* cext.h -- extensions to c */
X
X#define true 1
X#define false 0
X#define private static
X#define boolean int
X#define byte unsigned char
END_OF_FILE
if test 134 -ne `wc -c <'cext.h'`; then
    echo shar: \"'cext.h'\" unpacked with wrong size!
fi
# end of 'cext.h'
fi
if test -f 'cintr.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cintr.h'\"
else
echo shar: Extracting \"'cintr.h'\" \(142 characters\)
sed "s/^X//" >'cintr.h' <<'END_OF_FILE'
Xvoid intr_init();
Xvoid intr_enable();
Xvoid intr_disable();
Xvoid intr_routine();
Xvoid intr_cleanup();
Xvoid intr_eoi();
Xvoid intr_set_vector();
END_OF_FILE
if test 142 -ne `wc -c <'cintr.h'`; then
    echo shar: \"'cintr.h'\" unpacked with wrong size!
fi
# end of 'cintr.h'
fi
if test -f 'cmdline.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cmdline.h'\"
else
echo shar: Extracting \"'cmdline.h'\" \(115 characters\)
sed "s/^X//" >'cmdline.h' <<'END_OF_FILE'
Xboolean cl_init();
Xchar *cl_option();
Xchar *cl_noption();
Xboolean cl_switch();
Xchar *cl_nswitch();
Xchar *cl_arg();
END_OF_FILE
if test 115 -ne `wc -c <'cmdline.h'`; then
    echo shar: \"'cmdline.h'\" unpacked with wrong size!
fi
# end of 'cmdline.h'
fi
if test -f 'cmt.lib.uu' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cmt.lib.uu'\"
else
echo shar: Extracting \"'cmt.lib.uu'\" \(1054 characters\)
sed "s/^X//" >'cmt.lib.uu' <<'END_OF_FILE'
Xbegin 644 cmt.lib
XM\ U* X % VUP=2:(!TU3($-NB 6?14U"B F?4TQ)0D90$(@(GU-,24)#9(@'
XMGTQ)0DBSB :=,'-/XX@&H0%#5C>6+@9$1U)/55 %7U1%6%0$0T]$105?1$%4
XM001$051!!4-/3E-4!%]"4U,#0E-3/Y@'*#@, P0![9@'2.,"!08!*)@'2! '
XM!P'ZF =() (("0'AF@@"_P/_!/\"5IP- P$" @$#!$ !10' C/P!"5]?9FQT
XM=7-E9 9&2E-245$!!D9)4U)140$&1DE%4E%1 09&241245$!!D9)5U)140$*
XM7U]A8W)T=7-E9 A?96YA8FQE9 =?;%]R97-T!5]E>&ET!U]C;')C=&P,7VQ?
XM<F5S='5N=&EL"E]M971R;VYO;64*7VUI9&E?8F5N9 Q?;6ED:5]B=69F97(*
XM7VUI9&E?8V]N= I?;6ED:5]C=')L"E]M:61I7W1H<G4/7VUI9&E?97AC;'5S
XM:79E"E]M:61I7VYO=&4-7VUI9&E?<')O9W)A;0M?;6ED:5]T;W5C:!!?;7!U
XM7V5R<F]R7V-H96-K#R @9FEX=7 R,#5C.64Q80I?;7!U97AI<W1S%2 @;7!U
XM7V-O;6UA;F0R,#5C.64Q818@(&UP=5]D<G)?=V%I=#(P-6,Y93%A"E]M=7-I
XM8VEN:702("!M<'5?<F5A9#(P-6,Y93%A"E]M=7-I8W1E<FT'7W)A;F1O;1(@
XM(&UP=5]W86ET,C U8SEE,6$*7W1I;65R97-E=!,@(&UP=5]W<FET93(P-6,Y
XM93%A!E]T<F%C91L@('1R86-E7VUP=5]C;VUM86YD,C U8SEE,6$*7W1R86-E
XM;6ED:0T@('=F83(P-6,Y93%A;[ ,!5]B=69F8H$$5HQ*"E]C;%]O<'1I;VX;
XM("!S971?<&ET8VA?9&5F875L=#(P-6,Y93%A"E]C;%]S=VET8V@%7V]U=' +
X:7V-L7VYS=VET8VB!L X)7WAB=69F;6%S8@)A
X 
Xend
END_OF_FILE
if test 1054 -ne `wc -c <'cmt.lib.uu'`; then
    echo shar: \"'cmt.lib.uu'\" unpacked with wrong size!
fi
# end of 'cmt.lib.uu'
fi
if test -f 'cmt.lnk' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cmt.lnk'\"
else
echo shar: Extracting \"'cmt.lnk'\" \(164 characters\)
sed "s/^X//" >'cmt.lnk' <<'END_OF_FILE'
Xcmt
X-+mpu-+cintr-+aintr-+atxt-+break-+pekpok-+cmdline-+userio-+moxcbend-+moxcasci-+moxckydn-+moxckyup-+moxcpddn-+moxcpdup-+moxcctrl-+moxcprgm-+moxctouc-+timdif
X
X
X
X
END_OF_FILE
if test 164 -ne `wc -c <'cmt.lnk'`; then
    echo shar: \"'cmt.lnk'\" unpacked with wrong size!
fi
# end of 'cmt.lnk'
fi
if test -f 'cmtc.bat' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cmtc.bat'\"
else
echo shar: Extracting \"'cmtc.bat'\" \(11 characters\)
sed "s/^X//" >'cmtc.bat' <<'END_OF_FILE'
Xmsc %1,,,;
END_OF_FILE
if test 11 -ne `wc -c <'cmtc.bat'`; then
    echo shar: \"'cmtc.bat'\" unpacked with wrong size!
fi
# end of 'cmtc.bat'
fi
if test -f 'cmtl.bat' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cmtl.bat'\"
else
echo shar: Extracting \"'cmtl.bat'\" \(25 characters\)
sed "s/^X//" >'cmtl.bat' <<'END_OF_FILE'
Xlink %1 \cmt\moxc,%1,,;
X
END_OF_FILE
if test 25 -ne `wc -c <'cmtl.bat'`; then
    echo shar: \"'cmtl.bat'\" unpacked with wrong size!
fi
# end of 'cmtl.bat'
fi
if test -f 'cmtprog.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cmtprog.h'\"
else
echo shar: Extracting \"'cmtprog.h'\" \(1011 characters\)
sed "s/^X//" >'cmtprog.h' <<'END_OF_FILE'
X/* cmtprog.h -- include file for cmt application programs */
X
X/* define true, false, private, boolean */
X#include "cext.h"
X#include "mpu.h"
X
X/*
X * override the definition of l_rest
X */
X#define l_rest(d) m_rest(d)
X#define l_restuntil(t) m_restuntil(t)
X
X#define rest(x) l_rest( (long) x )
X#define restuntil(x) l_restuntil( (long) x)
X
X#define when if (
X#define then ) {
X#define otherwise ;} else {
X#define endif ;}
X#define endwhen ;}
X#define begin {
X#define end ;}
X
X#define repeat(var, count) {int var; for (var=1; var <= count; var++) {
X#define endrep ;}}
X
Xextern long event_time;
X
Xint moxc_loudness = 127;
X
X#define loud(l) moxc_loudness = (l);
X
X/* pnote -- play a note, return immediately */
X/**/
Xvoid pnote(pitch, duration)
X    begin
X	midi_note(1, pitch, moxc_loudness);
X	cause(duration, midi_note, 1, pitch, 0);
X    end
X
X
X/* note -- play a note, return after end of note */
X/**/
Xvoid note(pitch, duration)
X    begin
X        midi_note(1, pitch, moxc_loudness);
X	rest(duration);
X	midi_note(1, pitch, 0);
X    end
END_OF_FILE
if test 1011 -ne `wc -c <'cmtprog.h'`; then
    echo shar: \"'cmtprog.h'\" unpacked with wrong size!
fi
# end of 'cmtprog.h'
fi
if test -f 'dos.mac' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'dos.mac'\"
else
echo shar: Extracting \"'dos.mac'\" \(1948 characters\)
sed "s/^X//" >'dos.mac' <<'END_OF_FILE'
X;**
X;
X; This macro library defines the operating environment for the 8086 small
X; memory model, which allows 64Kbytes of data and 64Kbytes of program.
X;
X;**
XMSDOS	EQU 	2
X
X;**
X;
X; The following symbols define the 8086 memory mode being used.  Set LPROG
X; to 1 for a large program segment (greater than 64K-bytes), and set LDATA
X; to 1 for a large data segment.  Set COM to 1 to generate .COM files
X; instead of .EXE files.  Note that if COM is not zero, then LPROG and
X; LDATA must be 0.
X;
X;**
XCOM	EQU	0
XLPROG	EQU	0
XLDATA	EQU	0
X
X;**
X;
X; The following symbols are established via LPROG and LDATA as follows:
X;
X;	S8086	set for small model (small prog, small data)
X;	D8086	set for model with large data, small prog
X;	P8086	set for model with large prog, small data
X;	L8086	set for large model
X;
X;**
X	IF	(LPROG EQ 0) AND (LDATA EQ 0)
XS8086	EQU	1
XD8086	EQU 	0
XP8086	EQU	0
XL8086	EQU	0
X	ENDIF
X
X	IF	(LPROG EQ 0) AND (LDATA NE 0)
XS8086	EQU	0
XD8086	EQU	1
XP8086	EQU	0
XL8086	EQU	0
X	ENDIF
X
X	IF	(LPROG NE 0) AND (LDATA EQ 0)
XS8086	EQU	0
XD8086	EQU	0
XP8086	EQU	1
XL8086	EQU	0
X	ENDIF
X
X	IF	(LPROG NE 0) AND (LDATA NE 0)
XS8086	EQU	0
XD8086	EQU	0
XP8086	EQU	0
XL8086	EQU	1
X	ENDIF
X
X
X;**
X;
X; The DSEG and PSEG macros are defined to generate the appropriate GROUP
X; and SEGMENT statements for the memory model being used.  The ENDDS and
X; ENDPS macros are then used to end the segments.
X;
X;**
XDSEG	MACRO	
XDGROUP	GROUP	_DATA
X_DATA	SEGMENT	WORD PUBLIC 'DATA'
X	ASSUME	DS:DGROUP
X	ENDM
XENDDS	MACRO
X_DATA	ENDS
X	ENDM
X
X	IF	S8086
XPSEG	MACRO
XPGROUP	GROUP	_TEXT
X_TEXT	SEGMENT	BYTE PUBLIC 'CODE'
X	ASSUME	CS:PGROUP
X	ENDM
XENDPS	MACRO
X_TEXT	ENDS
X	ENDM
X	ENDIF
X
X	IF	D8086
XPSEG	MACRO
XCGROUP	GROUP	CODE
XCODE	SEGMENT	BYTE PUBLIC 'CODE'
X	ASSUME	CS:CGROUP
X	ENDM
XENDPS	MACRO
XCODE	ENDS
X	ENDM
X	ENDIF
X
X	IF	P8086
XPSEG	MACRO
X_TEXT	SEGMENT	BYTE
X	ASSUME  CS:_TEXT
X	ENDM
XENDPS	MACRO
X_TEXT	ENDS
X	ENDM
X	ENDIF
X
X	IF	L8086
XPSEG	MACRO
X_PROG	SEGMENT	BYTE
X	ASSUME	CS:_PROG
X	ENDM
XENDPS	MACRO
X_PROG	ENDS
X	ENDM
X	ENDIF
END_OF_FILE
if test 1948 -ne `wc -c <'dos.mac'`; then
    echo shar: \"'dos.mac'\" unpacked with wrong size!
fi
# end of 'dos.mac'
fi
if test -f 'excldesc.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'excldesc.c'\"
else
echo shar: Extracting \"'excldesc.c'\" \(1384 characters\)
sed "s/^X//" >'excldesc.c' <<'END_OF_FILE'
X/* excldesc.c -- describe a system exclusive message if possible */
X
X/*****************************************************************************
X*	    Change Log
X*  Date	    | Change
X*-----------+-----------------------------------------------------------------
X* 13-Jun-86 | Created Change Log
X*****************************************************************************/
X
X#include "stdio.h"
X#include "cext.h"
X#include "midicode.h"
X
X/****************************************************************************
X*				excldesc
X* Inputs:
X*	char *msg: the system exclusive message
X* Effect: 
X*	prints manufacturer and device code, if known
X****************************************************************************/
X
Xexcldesc(msg)
X    byte *msg;
X{
X/* length of Exclusive message preamble: */
X#define HDRSIZ 6
X    int i;
X    if (msg[1] == 0x43) {
X	printf("YAMAHA, ");
X	switch (msg[3]) {
X	    case 0:
X		printf("single voice data (");
X		for (i = HDRSIZ+145; i < HDRSIZ+155; i++) printf("%c",msg[i]);
X		printf(")");
X		break;
X	    case 1:
X		printf("single performance data: ");
X		for (i = HDRSIZ+64; i < HDRSIZ+94; i++) printf("%c", msg[i]);
X		printf(")");
X		break;
X	    case 2:
X		printf("64 performance data");
X		break;
X	    case 9:
X		printf("32 voice data");
X		break;
X	    default:
X		printf("format %x", msg[3]);
X		break;
X	}
X    } else printf("I.D.: %x", msg[1]);
X    printf("\n");
X}
END_OF_FILE
if test 1384 -ne `wc -c <'excldesc.c'`; then
    echo shar: \"'excldesc.c'\" unpacked with wrong size!
fi
# end of 'excldesc.c'
fi
if test -f 'makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'makefile'\"
else
echo shar: Extracting \"'makefile'\" \(4786 characters\)
sed "s/^X//" >'makefile' <<'END_OF_FILE'
X# Makefile for cmt stuff
X# Last modified date: 20-Jul-86
X
X#CURRENT is the exe file we want to make now.
X#CURRENT = adagio.exe
X#EVERYTHING is everything this makefile knows how to make
X#E1 = adagio.exe mm.exe moxc.obj dxget.exe dxput.exe
X#E2 = record.exe transcri.exe tuning.exe
X#EVERYTHING = $(E1) $(E2)
X
X#INIT = rem Current default file to make is $(CURRENT)
X#DEINIT = echo Finished OK.`n:errdone`necho Done
X# #DEINIT = echo Finished OK.`n:errdone`necho Done
X# #BEFORE = echo before
X#AFTER  = if errorlevel 1 goto errdone
X
XmscARGS = -AS -I\bin\micro
XmasmARGS = /ML
XCLIB = # slibc.lib
XMLIB = 
XCOBJ =
XCMTLIB = cmt.lib
XLIBS = $(CLIB) $(CMTLIB) $(MLIB)
X
XMUOBJ1 = aintr.obj atxt.obj break.obj cintr.obj cmdline.obj
XMUOBJ2 = moxcasci.obj moxcbend.obj moxcctrl.obj moxckydn.obj moxckyup.obj
XMUOBJ3 = moxcpddn.obj moxcpdup.obj moxcprgm.obj moxctouc.obj 
XMUOBJ4 = mpu.obj userio.obj timdif.obj
XMUOBJ = $(MUOBJ1) $(MUOBJ2) $(MUOBJ3) $(MUOBJ4)
X
XADH = adagio.h phase1.h phase2.h atxt.h userio.h cmdline.h
XADOBJ = adagio.obj phase1.obj phase2.obj adaspace.obj noteoff.obj
X
XDXGOBJ = dxget.obj excldesc.obj
X
XDXPOBJ = dxput.obj excldesc.obj
X
XMMOBJ = mm.obj
X
XRECOBJ = recmain.obj recspace.obj phase1.obj trans2.obj noteoff.obj record.obj
X
XTRH = mpu.h cmdline.h userio.h record.h
XTROBJ = transcri.obj traspace.obj record.obj
X
X#current : $(CURRENT)
X#	echo making $(CURRENT)
X
X#everything : $(EVERYTHING)
X#	echo making $(EVERYTHING)
X
Xadagio.obj : $(ADH) adagio.c
X	msc $(mscARGS) adagio,,,;
X
Xadaspace.obj : adaspace.c
X	msc $(mscARGS) adaspace,,,;
X
Xaintr.obj : aintr.asm
X	masm aintr $(masmARGS),,;
X
Xatxt.obj : atxt.asm
X	masm atxt $(masmARGS),,;
X
Xbreak.obj : break.asm
X	masm break $(masmARGS),,;
X
Xpekpok.obj : pekpok.asm
X	masm pekpok $(masmARGS),,;
X
Xcintr.obj : cmdline.h cintr.c
X	msc $(mscARGS) cintr,,,;
X
Xcmdline.obj : cmdline.c
X	msc $(mscARGS) cmdline,,,;
X
Xdxget.obj :  dxget.c
X	msc $(mscARGS) dxget,,,;
X
Xdxput.obj :  dxput.c
X	msc $(mscARGS) dxput,,,;
X
Xexcldesc.obj : excldesc.c midicode.h
X	msc $(mscARGS) excldesc,,,;
X
Xmm.obj :  midicode.h mpu.h mm.c 
X	msc $(mscARGS) mm,,,;
X
Xmoxc.obj :  mpu.h cmdline.h midicode.h moxc.c
X	msc $(mscARGS) moxc,,,;
X
Xmoxcasci.obj : moxcasci.c
X	msc $(mscARGS) moxcasci,,,;
X
Xmoxcbend.obj : moxcbend.c
X	msc $(mscARGS) moxcbend,,,;
X
Xmoxcctrl.obj : moxcctrl.c
X	msc $(mscARGS) moxcctrl,,,;
X
Xmoxckydn.obj : moxckydn.c
X	msc $(mscARGS) moxckydn,,,;
X
Xmoxckyup.obj : moxckyup.c
X	msc $(mscARGS) moxckyup,,,;
X
Xmoxcpddn.obj : moxcpddn.c
X	msc $(mscARGS) moxcpddn,,,;
X
Xmoxcpdup.obj : moxcpdup.c
X	msc $(mscARGS) moxcpdup,,,;
X
Xmoxcprgm.obj : moxcprgm.c
X	msc $(mscARGS) moxcprgm,,,;
X
Xmoxctouc.obj : moxctouc.c
X	msc $(mscARGS) moxctouc,,,;
X
Xmpu.obj : mpu.c mpu.h atxt.h midicode.h cmdline.h userio.h pitch.h
X	msc $(mscARGS) mpu,,,;
X
Xnoteoff.obj : adagio.h noteoff.c
X	msc $(mscARGS) noteoff,,,;
X
Xphase1.obj : adagio.h cmdline.h phase1.c
X	msc $(mscARGS) phase1,,,;
X
Xphase2.obj :  adagio.h mpu.h userio.h phase2.c
X	msc $(mscARGS) phase2,,,;
X
Xrecmain.obj : adagio.h phase1.h phase2.h atxt.h userio.h cmdline.h recmain.c
X	msc $(mscARGS) recmain,,,;
X
Xrecord.obj :  mpu.h userio.h midicode.h record.c
X	msc $(mscARGS) record,,,;
X
Xrecspace.obj : recspace.c
X	msc $(mscARGS) recspace,,,;
X
Xtimdif.obj : timdif.asm timdif.h macsym.lib prcsym.lib
X	masm timdif $(masmARGS),,;
X
Xtrans2.obj :  adagio.h mpu.h record.h userio.h trans2.c
X	msc $(mscARGS) trans2,,,;
X
Xtranscri.obj : $(TRH) transcri.c
X	msc $(mscARGS) transcri,,,;
X
Xtraspace.obj : traspace.c
X	msc $(mscARGS) traspace,,,;
X
Xtuning.obj : tuning.c pitch.h
X	msc $(mscARGS) tuning,,,;
X
Xuserio.obj : userio.c userio.h
X	msc $(mscARGS) userio,,,;
X
Xcmt.lib : $(MUOBJ) cmt.lnk
X	lib @cmt.lnk
X
Xadagio.exe : $(ADOBJ) $(CMTLIB)
X	link $(COBJ) $(ADOBJ),adagio,,$(LIBS)
X
Xdxget.exe : $(DXGOBJ) $(CMTLIB)
X	link $(COBJ) $(DXGOBJ),dxget,,$(LIBS)
X
Xdxput.exe : $(DXPOBJ) $(CMTLIB)
X	link $(COBJ) $(DXPOBJ),dxput,,$(LIBS)
X
Xmm.exe : $(MMOBJ) $(CMTLIB)
X	link $(COBJ) $(MMOBJ),mm,,$(LIBS)
X
Xrecord.exe : $(RECOBJ) $(CMTLIB)
X	link $(COBJ) $(RECOBJ),record,,$(LIBS)
X
Xtranscri.exe : $(TROBJ) $(CMTLIB)
X	link $(COBJ) $(TROBJ),transcri,,$(LIBS)
X
Xtuning.exe : tuning.obj $(CMTLIB)
X	link $(COBJ) tuning,tuning,,$(LIBS)
X
Xclean :
X	del *.map
X	del *.lst
X	del *.cod
X
X# clean out all but moxc.obj (needed for cmtl.bat)
Xcleanob : 
X	del adagio.obj
X	del adaspace.obj
X	del aintr.obj
X	del atxt.obj
X	del break.obj
X	del pekpok.obj
X	del cintr.obj
X	del cmdline.obj
X	del dxget.obj
X	del dxput.obj
X	del excldesc.obj
X	del mm.obj
X	del moxcasci.obj
X	del moxcbend.obj
X	del moxcctrl.obj
X	del moxckydn.obj
X	del moxckyup.obj
X	del moxcpddn.obj
X	del moxcpdup.obj
X	del moxcprgm.obj
X	del moxctouch.obj
X	del mpu.obj
X	del noteoff.obj
X	del phase1.obj
X	del phase2.obj
X	del recmain.obj
X	del record.obj
X	del recspace.obj
X	del timdif.obj
X	del trans2.obj
X	del transcri.obj
X	del traspace.obj
X	del tuning.obj
X	del userio.obj
END_OF_FILE
echo shar: 2 control characters may be missing from \"'makefile'\"
if test 4786 -ne `wc -c <'makefile'`; then
    echo shar: \"'makefile'\" unpacked with wrong size!
fi
# end of 'makefile'
fi
if test -f 'maxspace.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'maxspace.h'\"
else
echo shar: Extracting \"'maxspace.h'\" \(273 characters\)
sed "s/^X//" >'maxspace.h' <<'END_OF_FILE'
X/* this file defines the maximum allowable number of notes for phase1 */
X/* the number must be determined emperically because it depends upon  */
X/* the amount of storage that must be left around for phase2 */
X
X/* this should leave about 2KB free */
X#define MAXSPACE 53500
END_OF_FILE
if test 273 -ne `wc -c <'maxspace.h'`; then
    echo shar: \"'maxspace.h'\" unpacked with wrong size!
fi
# end of 'maxspace.h'
fi
if test -f 'midicode.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'midicode.h'\"
else
echo shar: Extracting \"'midicode.h'\" \(533 characters\)
sed "s/^X//" >'midicode.h' <<'END_OF_FILE'
X/****************************************************************************
X*
X* Midi codes
X*
X****************************************************************************/
X
X#define MIDI_DATA(d) (0x7f & (d))
X#define MIDI_CHANNEL(c) (0x0f & ((c) - 1))
X#define MIDI_PROGRAM(p) MIDI_DATA((p) - 1)
X
X#define MIDI_CODE_MASK		0xf0
X#define MIDI_CHN_MASK		0x0f
X#define MIDI_OFF_NOTE		0x80
X#define MIDI_ON_NOTE		0x90
X#define MIDI_CTRL		0xb0
X#define MIDI_CH_PROGRAM		0xc0
X#define MIDI_TOUCH		0xd0
X#define MIDI_BEND		0xe0
X#define MIDI_EOX		0xF7
END_OF_FILE
if test 533 -ne `wc -c <'midicode.h'`; then
    echo shar: \"'midicode.h'\" unpacked with wrong size!
fi
# end of 'midicode.h'
fi
if test -f 'mm.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mm.c'\"
else
echo shar: Extracting \"'mm.c'\" \(4358 characters\)
sed "s/^X//" >'mm.c' <<'END_OF_FILE'
X/* mm.c -- midi monitor */
X
X/*****************************************************************************
X*	    Change Log
X*  Date	    | Change
X*-----------+-----------------------------------------------------------------
X*  7-Apr-86 | Created changelog
X*****************************************************************************/
X
X#include "cext.h"
X#include "stdio.h"
X#include "midicode.h"
X#include "mpu.h"
X#include "cmdline.h"
X
Xint bender;	/* record pitch bend etc.? */
X
X/****************************************************************************
X* Data for command line parsing
X****************************************************************************/
X#define nswitches 8
Xprivate char *switches[nswitches] = 
X    { "-help", "-miditrace", "-m", "-trace", "-t", "-block", "-d", "-debug"};
X
X#define noptions 1
Xprivate char *options[noptions] = { "-tune" };
X
X/*****************************************************************************
X*	Routines local to this module
X*****************************************************************************/
Xprivate	void	output(); 
Xprivate	void	put_pitch();
Xprivate	void	showhelp();
X
X/****************************************************************************
X*				main
X* Effect: prompts for parameters, starts monitor
X****************************************************************************/
X
Xvoid main(argc, argv)
X    int argc;
X    char *argv[];
X{
X    int done = false;
X    byte data[4];	/* midi input data buffer */
X
X    cl_init(switches, nswitches, options, noptions, argv, argc);
X    if (cl_switch("-help")) showhelp();
X
X    bender = askbool("pitch bend etc. on", false);
X
X    musicinit();
X    while (getkey(false) != -1) ;
X    midi_cont(bender);
X    printf("Midi Monitor ready.	 Type Q to stop.\n");
X
X    while (!done) {
X	char c;
X	if (kbhit()) {
X	    c = getch();
X	    if (tolower(c) == 'q') done = true;
X	    else printf("type q to quit\n");
X	}
X	if (getbuf(false, data)) {
X	    output(data);
X	}
X    }
X    musicterm();
X}
X
X/****************************************************************************
X*				output
X* Inputs:
X*	byte data[]: midi data buffer holding one command
X* Effect: format and print  midi data
X****************************************************************************/
X
Xprivate void output(data)
X    byte data[];
X{
X    int command;	/* the current command */
X    int chan;		/* the midi channel of the current event */
X
X    command = data[0] & MIDI_CODE_MASK;
X    chan = data[0] & MIDI_CHN_MASK;
X
X    if (command == MIDI_ON_NOTE && data[2] != 0) {
X	printf("Note On,  Chan %2d, Key %2d (", chan, data[1]);
X	put_pitch(data[1] - 12);
X	printf("), Vel %d\n", data[2]);
X    } else if (command == MIDI_ON_NOTE /* && data[2] == 0 */) {
X	printf("Note Off, Chan %2d, Key %2d (", chan, data[1]);
X	put_pitch(data[1] - 12);
X	printf("), Vel %d\n", data[2]);
X    } else if (command == MIDI_CH_PROGRAM) {
X	printf("Prog Chg, Chan %2d, Prog %2d\n", chan, data[1]);
X    } else if (command == MIDI_CTRL) {
X	printf("Ctrl Chg, Chan %2d, Ctrl %2d, Val %2d\n",
X	       chan, data[1], data[2]);
X    } else if (command == MIDI_TOUCH) {
X	printf("A. Touch, Chan %2d, Val %2d\n", chan, data[1]);
X    } else if (command == MIDI_BEND) {
X	printf("P. Bend,  Chan %2d, Val %2d\n", chan,
X	       (data[1] + (data[2]<<7)));
X    }
X}
X
X/****************************************************************************
X*				put_pitch
X* Inputs:
X*	int p: pitch number
X* Effect: write out the pitch name for a given number
X****************************************************************************/
X
Xprivate void put_pitch(p)
X    int p;
X{
X    static char *ptos[] = {"c", "cs", "d", "ef", "e", "f", "fs", "g",
X			   "gs", "a", "bf", "b"};
X    printf("%s%d", ptos[p % 12], p / 12);
X}
X
X/****************************************************************************
X*				showhelp
X* Effect: print help text
X****************************************************************************/
X
Xprivate void showhelp()
X{
X    fprintf(stderr,"mm is a midi monitor program, switches are:");
X    fprintf(stderr,"       -block            disable MIDI thru\n");
X    fprintf(stderr,"       -help             this message\n");
X    fprintf(stderr,"       -miditrace (-m)   turn on MIDI command trace\n");
X    fprintf(stderr,"       -trace (-t)       trace music\n");
X    fprintf(stderr,"       -debug (-d)	     debug flag for cintr.c\n");
X}
END_OF_FILE
if test 4358 -ne `wc -c <'mm.c'`; then
    echo shar: \"'mm.c'\" unpacked with wrong size!
fi
# end of 'mm.c'
fi
if test -f 'moxc.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moxc.h'\"
else
echo shar: Extracting \"'moxc.h'\" \(75 characters\)
sed "s/^X//" >'moxc.h' <<'END_OF_FILE'
Xvoid cause();
Xvoid m_rest();
Xvoid m_restuntil();
Xvoid main();
Xvoid quit();
END_OF_FILE
if test 75 -ne `wc -c <'moxc.h'`; then
    echo shar: \"'moxc.h'\" unpacked with wrong size!
fi
# end of 'moxc.h'
fi
if test -f 'moxcasci.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moxcasci.c'\"
else
echo shar: Extracting \"'moxcasci.c'\" \(144 characters\)
sed "s/^X//" >'moxcasci.c' <<'END_OF_FILE'
X/* moxcasci.c -- default asciievent() implementation */
X
Xvoid asciievent(c)
X{
X    if (c == 'q') quit();
X    else printf("Type q to quit.\n");
X}
END_OF_FILE
if test 144 -ne `wc -c <'moxcasci.c'`; then
    echo shar: \"'moxcasci.c'\" unpacked with wrong size!
fi
# end of 'moxcasci.c'
fi
if test -f 'moxcbend.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moxcbend.c'\"
else
echo shar: Extracting \"'moxcbend.c'\" \(90 characters\)
sed "s/^X//" >'moxcbend.c' <<'END_OF_FILE'
X/* moxcbend.c -- default bendchange() implementation */
X
Xvoid bendchange(chan, value)
X{
X}
END_OF_FILE
if test 90 -ne `wc -c <'moxcbend.c'`; then
    echo shar: \"'moxcbend.c'\" unpacked with wrong size!
fi
# end of 'moxcbend.c'
fi
if test -f 'moxcctrl.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moxcctrl.c'\"
else
echo shar: Extracting \"'moxcctrl.c'\" \(96 characters\)
sed "s/^X//" >'moxcctrl.c' <<'END_OF_FILE'
X/* moxcctrl.c -- default ctrlchange() implementation */
X
Xvoid ctrlchange(chan, ctrl, value)
X{
X}
END_OF_FILE
if test 96 -ne `wc -c <'moxcctrl.c'`; then
    echo shar: \"'moxcctrl.c'\" unpacked with wrong size!
fi
# end of 'moxcctrl.c'
fi
if test -f 'moxckydn.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moxckydn.c'\"
else
echo shar: Extracting \"'moxckydn.c'\" \(80 characters\)
sed "s/^X//" >'moxckydn.c' <<'END_OF_FILE'
X/* moxckydn.c -- default keydown() implementation */
X
Xvoid keydown(c, k, v)
X{
X}
END_OF_FILE
if test 80 -ne `wc -c <'moxckydn.c'`; then
    echo shar: \"'moxckydn.c'\" unpacked with wrong size!
fi
# end of 'moxckydn.c'
fi
if test -f 'moxckyup.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moxckyup.c'\"
else
echo shar: Extracting \"'moxckyup.c'\" \(73 characters\)
sed "s/^X//" >'moxckyup.c' <<'END_OF_FILE'
X/* moxckyup.c -- default keyup() implementation */
X
Xvoid keyup(c, k)
X{
X}
END_OF_FILE
if test 73 -ne `wc -c <'moxckyup.c'`; then
    echo shar: \"'moxckyup.c'\" unpacked with wrong size!
fi
# end of 'moxckyup.c'
fi
if test -f 'moxcpddn.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moxcpddn.c'\"
else
echo shar: Extracting \"'moxcpddn.c'\" \(74 characters\)
sed "s/^X//" >'moxcpddn.c' <<'END_OF_FILE'
X/* moxcpddn.c -- default peddown() implementation */
X
Xvoid peddown(c)
X{
X}
END_OF_FILE
if test 74 -ne `wc -c <'moxcpddn.c'`; then
    echo shar: \"'moxcpddn.c'\" unpacked with wrong size!
fi
# end of 'moxcpddn.c'
fi
if test -f 'moxcpdup.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moxcpdup.c'\"
else
echo shar: Extracting \"'moxcpdup.c'\" \(70 characters\)
sed "s/^X//" >'moxcpdup.c' <<'END_OF_FILE'
X/* moxcpdup.c -- default pedup() implementation */
X
Xvoid pedup(c)
X{
X}
END_OF_FILE
if test 70 -ne `wc -c <'moxcpdup.c'`; then
    echo shar: \"'moxcpdup.c'\" unpacked with wrong size!
fi
# end of 'moxcpdup.c'
fi
if test -f 'moxcprgm.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moxcprgm.c'\"
else
echo shar: Extracting \"'moxcprgm.c'\" \(90 characters\)
sed "s/^X//" >'moxcprgm.c' <<'END_OF_FILE'
X/* moxcprgm.c -- default prgmchange() implementation */
X
Xvoid prgmchange(chan, value)
X{
X}
END_OF_FILE
if test 90 -ne `wc -c <'moxcprgm.c'`; then
    echo shar: \"'moxcprgm.c'\" unpacked with wrong size!
fi
# end of 'moxcprgm.c'
fi
if test -f 'moxcprog.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moxcprog.h'\"
else
echo shar: Extracting \"'moxcprog.h'\" \(623 characters\)
sed "s/^X//" >'moxcprog.h' <<'END_OF_FILE'
X/*
X * override the definition of l_rest (from mpu.c):
X */
X#define l_rest(d) m_rest(d)
X#define l_restuntil(t) m_restuntil(t)
X
X#include "\music\musicfns.h"
X#define when if (
X#define then ) {
X#define otherwise ;} else {
X#define endif ;}
X#define endwhen ;}
X#define begin {
X#define end ;}
X
X#define repeat(var, count) {int var; for (var=1; var <= count; var++) {
X#define endrep ;}}
X
Xextern int moxcdone;
Xextern cause();
Xextern long event_time;
X
Xint moxc_loudness = 127;
X
X#define loud(l) moxc_loudness = (l);
X
Xnote(pitch, duration)
X    begin
X	midi_note(1, pitch, moxc_loudness);
X	cause(duration, midi_note, 1, pitch, 0);
X    end
X
END_OF_FILE
if test 623 -ne `wc -c <'moxcprog.h'`; then
    echo shar: \"'moxcprog.h'\" unpacked with wrong size!
fi
# end of 'moxcprog.h'
fi
if test -f 'moxctouc.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moxctouc.c'\"
else
echo shar: Extracting \"'moxctouc.c'\" \(92 characters\)
sed "s/^X//" >'moxctouc.c' <<'END_OF_FILE'
X/* moxctouc.c -- default touchchange() implementation */
X
Xvoid touchchange(chan, value)
X{
X}
END_OF_FILE
if test 92 -ne `wc -c <'moxctouc.c'`; then
    echo shar: \"'moxctouc.c'\" unpacked with wrong size!
fi
# end of 'moxctouc.c'
fi
if test -f 'mpu.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mpu.h'\"
else
echo shar: Extracting \"'mpu.h'\" \(665 characters\)
sed "s/^X//" >'mpu.h' <<'END_OF_FILE'
X/* mpu.h -- definitions for users of mpu.c */
X
X#define MODWHEEL 1
X#define BREATH 2
X#define FOOT 4
X#define PORTARATE 5
X#define VOLUME 7
X#define SUSTAIN 64
X#define PORTASWITCH 65
X
X#define NESTERR 1
X#define BUFFERR 2
X#define CMDERR 3
X#define TIMEOUT 4
X
Xvoid	exclusive();
Xboolean	getbuf();
Xint	getkey();
Xlong	gettime();
Xvoid	l_rest();
Xvoid	l_restuntil();
Xvoid	metronome();
Xvoid	midi_bend();
Xint	midi_buffer();
Xvoid	midi_cont();
Xvoid	midi_ctrl();
Xvoid	midi_exclusive();
Xvoid	midi_note();
Xvoid	midi_program();
Xvoid	midi_touch();
Xvoid	mpu_error_check();
Xvoid	mpuexists();
Xvoid	musicinit();
Xvoid	musicterm();
Xint	random();
Xvoid	timereset();
Xvoid	trace();
Xvoid	tracemidi();
END_OF_FILE
if test 665 -ne `wc -c <'mpu.h'`; then
    echo shar: \"'mpu.h'\" unpacked with wrong size!
fi
# end of 'mpu.h'
fi
if test -f 'musiprog.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'musiprog.h'\"
else
echo shar: Extracting \"'musiprog.h'\" \(988 characters\)
sed "s/^X//" >'musiprog.h' <<'END_OF_FILE'
X/* musiprog.h -- include file for cmt application programs */
X
X#define true 1
X#define false 0
X
X/*
X * override the definition of l_rest
X */
X#define l_rest(d) m_rest(d)
X#define l_restuntil(t) m_restuntil(t)
X
Xlong gettime();
X
X#define rest(x) l_rest( (long) x )
X#define restuntil(x) l_restuntil( (long) x)
X
X#define when if (
X#define then ) {
X#define otherwise ;} else {
X#define endif ;}
X#define endwhen ;}
X#define begin {
X#define end ;}
X
X#define repeat(var, count) {int var; for (var=1; var <= count; var++) {
X#define endrep ;}}
X
Xextern cause();
Xextern long event_time;
X
Xint moxc_loudness = 127;
X
X#define loud(l) moxc_loudness = (l);
X
X/* pnote -- play a note, return immediately */
X/**/
Xpnote(pitch, duration)
X    begin
X	midi_note(1, pitch, moxc_loudness);
X	cause(duration, midi_note, 1, pitch, 0);
X    end
X
X
X/* note -- play a note, return after end of note */
X/**/
Xnote(pitch, duration)
X    begin
X        midi_note(1, pitch, moxc_loudness);
X	rest(duration);
X	midi_note(1, pitch, 0);
X    end
END_OF_FILE
if test 988 -ne `wc -c <'musiprog.h'`; then
    echo shar: \"'musiprog.h'\" unpacked with wrong size!
fi
# end of 'musiprog.h'
fi
if test -f 'noteoff.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'noteoff.c'\"
else
echo shar: Extracting \"'noteoff.c'\" \(4366 characters\)
sed "s/^X//" >'noteoff.c' <<'END_OF_FILE'
X/* noteoff.c -- this module keeps track of pending note offs for adagio */
X
X/*****************************************************************************
X*	    Change Log
X*  Date	    | Change
X*-----------+-----------------------------------------------------------------
X* 31-Dec-85 | Created changelog
X* 31-Dec-85 | Add c:\ to include directives
X*  1-Jan-86 | Declare malloc char * for lint consistency
X* 21-Jan-86 | note_offs can now turn off more than one note per call
X*****************************************************************************/
X
X#include "cext.h"
X#include "stdio.h"
X#include "ctype.h"
X#include "malloc.h"
X#include "adagio.h"
X
X/* off_type is a structure containing note-off information */
X
Xtypedef struct off_struct {
X    long when;
X    int voice;
X    int pitch;
X    struct off_struct *next;
X} *off_type;
X
Xprivate off_type free_off;		/* free list of off_type structures */
Xprivate off_type off_events = NULL;	/* active list */
Xextern char * malloc();
X
X/****************************************************************************
X*	Routines declared in this module
X****************************************************************************/
X
X	boolean		note_offs();
Xprivate off_type	off_alloc();
Xprivate void		off_free();
X	void		off_init();
X	void		off_schedule();
X
X/****************************************************************************
X*				note_offs
X* Inputs:
X*	long time: the current time
X* Outputs:
X*	return true if off list has more notes 
X* Effect: turn off notes if it is time 
X* Assumes:
X* Implementation:
X*	Find scheduled note off events in off_events, compare with time
X****************************************************************************/
X
Xboolean note_offs(time)
Xlong time;
X{
X    off_type temp;
X    while (off_events != NULL && off_events->when <= time) {
X	midi_note((off_events->voice) + 1, off_events->pitch, 0);
X	temp = off_events;
X	off_events = off_events->next;
X	off_free(temp);
X    }
X    return (off_events != NULL);
X}
X
X/****************************************************************************
X*				off_alloc
X* Outputs:
X*	returns off_type: an allocated note off structure
X* Effect:
X*	allocates a structure using malloc
X****************************************************************************/
X
Xprivate off_type off_alloc()
X{
X    return (off_type) malloc(sizeof(struct off_struct));
X}
X
X/****************************************************************************
X*				off_free
X* Inputs:
X*	off_type off: a structure to deallocate
X* Effect: 
X*	returns off to freelist
X****************************************************************************/
X
Xprivate void off_free(off)
X    off_type off;
X{
X    off->next = free_off;
X    free_off = off;
X}
X
X/****************************************************************************
X*				off_init
X* Effect: initialize this module
X* Assumes:
X*	only called once, otherwise storage is leaked
X****************************************************************************/
X
Xvoid off_init()
X{
X    int i;
X    for (i = 0; i < 50; i++) off_free(off_alloc());
X}
X
X/****************************************************************************
X*				off_schedule
X* Inputs:
X*	long offtime: time to turn note off
X*	int voice: the midi channel
X*	int pitch: the pitch
X* Effect: 
X*	schedules a note to be turned off
X* Assumes:
X*	note_offs will be called frequently to actually turn off notes
X****************************************************************************/
X
Xvoid off_schedule(offtime, voice, pitch)
X    long offtime;
X    int voice, pitch;
X{
X    off_type off, ptr, prv;
X    /* allocate off */
X    if ((off = free_off) == NULL) {
X	off = off_alloc();
X    } else free_off = off->next;
X
X    if (off == NULL) {
X	fprintf(stderr, "out of space for note off events");
X	musicterm();
X	exit(1);
X    }
X
X    off->when = offtime;
X    off->voice = voice;
X    off->pitch = pitch;
X    /* insert into list of off events */
X    ptr = off_events;
X    if (ptr == NULL || offtime <= ptr->when) {
X	off->next = ptr;
X	off_events = off;
X    } else {
X	while (ptr != NULL && offtime > ptr->when) {
X	    prv = ptr;
X	    ptr = ptr->next;
X	}
X	prv->next = off;
X	off->next = ptr;
X    }
X/*
X *    printf("off_schedule(%ld, %d, %d): \n", offtime, voice, pitch);
X *    for (ptr = off_events; ptr != NULL; ptr = ptr->next) {
X *	printf("    %ld: %d, %d\n", ptr->when, ptr->voice, ptr->pitch);
X *    }
X */
X}
END_OF_FILE
if test 4366 -ne `wc -c <'noteoff.c'`; then
    echo shar: \"'noteoff.c'\" unpacked with wrong size!
fi
# end of 'noteoff.c'
fi
if test -f 'pekpok.asm' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pekpok.asm'\"
else
echo shar: Extracting \"'pekpok.asm'\" \(587 characters\)
sed "s/^X//" >'pekpok.asm' <<'END_OF_FILE'
X;routines to emultate lattice c peek and poke
Xinclude dos.mac
XPSEG
X	public _peek
X_peek	proc near
X	push 	bp
X	mov	bp,sp
X	push	es
X	push 	ds
X	push 	si
X	push 	di
X	cld
X	mov 	ax,ds
X	mov 	es,ax
X	mov 	ds,[bp+4]
X	mov 	si,[bp+6]
X	mov 	di,[bp+8]
X	mov 	cx,[bp+10]
X	cli
X	rep 	movsb
X	sti
X	pop 	di
X	pop 	si
X	pop 	ds
X	pop 	es
X	pop	bp
X	ret
X_peek	endp
X	public _poke
X_poke	proc near
X	push 	bp
X	mov	bp,sp
X	push	es
X	push 	ds
X	push 	si
X	push 	di
X	cld
X	mov es,[bp+4]
X	mov di,[bp+6]
X	mov si,[bp+8]
X	mov cx,[bp+10]
X	cli
X	rep movsb
X	sti
X	pop di
X	pop si
X	pop ds
X	pop es
X	mov bp,sp
X	pop	bp
X	ret
X_poke	endp
XENDPS
XEND
END_OF_FILE
if test 587 -ne `wc -c <'pekpok.asm'`; then
    echo shar: \"'pekpok.asm'\" unpacked with wrong size!
fi
# end of 'pekpok.asm'
fi
if test -f 'phase1.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'phase1.h'\"
else
echo shar: Extracting \"'phase1.h'\" \(74 characters\)
sed "s/^X//" >'phase1.h' <<'END_OF_FILE'
X/* phase1.h -- header file for users of phase1.c */
X
Xevent_type phase1();
END_OF_FILE
if test 74 -ne `wc -c <'phase1.h'`; then
    echo shar: \"'phase1.h'\" unpacked with wrong size!
fi
# end of 'phase1.h'
fi
if test -f 'phase2.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'phase2.h'\"
else
echo shar: Extracting \"'phase2.h'\" \(68 characters\)
sed "s/^X//" >'phase2.h' <<'END_OF_FILE'
X/* phase2.h -- header file for users of phase2.c */
X
Xvoid phase2();
END_OF_FILE
if test 68 -ne `wc -c <'phase2.h'`; then
    echo shar: \"'phase2.h'\" unpacked with wrong size!
fi
# end of 'phase2.h'
fi
if test -f 'pitch.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pitch.h'\"
else
echo shar: Extracting \"'pitch.h'\" \(105 characters\)
sed "s/^X//" >'pitch.h' <<'END_OF_FILE'
X/* mbc code */
Xtypedef struct pitch_struct {
X    int ppitch;
X    int pbend;
X    } pitch_table;
X/* end */
END_OF_FILE
if test 105 -ne `wc -c <'pitch.h'`; then
    echo shar: \"'pitch.h'\" unpacked with wrong size!
fi
# end of 'pitch.h'
fi
if test -f 'readme' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'readme'\"
else
echo shar: Extracting \"'readme'\" \(696 characters\)
sed "s/^X//" >'readme' <<'END_OF_FILE'
XThis is Version 2.00 of the Carnegie Mellon University MIDI Toolkit
Xfor Microsoft C
X
X		written by Roger B. Dannenberg
X		 with the help of many friends
X
X		 	16 Mar 1987
X
XThis system was produced using
X	Version 4.00 of Microsoft C
X	Version 1.00 of Microsoft MASM
X	Version 3.05 of Microsoft LINK
X
XTo make *.exe files, type
X"make makefile". 
XThis is different from Lattice C.
XI assume you have libraly and header files in \bin\micro.
XIf not, change 
X	mscARGS = -AS -I\bin\micro
Xto
X	mscARGS = -AS -I\??????(the right directory)
X.
X
XAlso, in source code ,there are some differnce between Lattice C
Xand Microsoft C version. Microsoft C doesn't have peek and poke,
Xso we wrote them in assambly language.
X
END_OF_FILE
if test 696 -ne `wc -c <'readme'`; then
    echo shar: \"'readme'\" unpacked with wrong size!
fi
# end of 'readme'
fi
if test -f 'recmain.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'recmain.c'\"
else
echo shar: Extracting \"'recmain.c'\" \(4118 characters\)
sed "s/^X//" >'recmain.c' <<'END_OF_FILE'
X/*****************************************************************************
X*	    Change Log
X*  Date	    | Change
X*-----------+-----------------------------------------------------------------
X* 12-Mar-86 | Created
X*****************************************************************************/
X/*   Record: scan command line, call phase1, trans2 */
X
X#include "cext.h"
X#include "stdio.h"
X#include "adagio.h"
X#include "phase1.h"
X#include "phase2.h"
X#include "atxt.h"
X#include "userio.h"
X#include "cmdline.h"
X
Xchar score_na[name_length];	/* this will be available to phase1 and 2 */
Xchar outfile[name_length];	/* output file name used by trans2 */
X
X/* Variables set by command line switches */
X
Xextern int musictrace;
Xextern int miditrace;
Xextern int IsAT;
Xextern int debug_intr;
Xextern int debug_rec;
Xboolean poll = false;		/* true if poll, false if interrupt */
Xboolean no_mpu = false;		/* true if simulated */
X
X#define nswitches 15
Xprivate char *switches[nswitches] = 
X    { "-debug", "-d", "-help", "-miditrace", "-m", "-trace", "-t", "-at",
X      "-metronome", "-met", "-simulated", "-s", "-xt", "-print", "-block" };
X
X#define noptions 5
Xprivate char *options[noptions] = { "-c", "-control", "-out", "-o", "-tune" };
X
X#define nmsw 2
Xprivate char *msw[nmsw] = { "-met", "-metronome" };
X
X#define noopt 2
Xprivate char *oopt[noopt] = { "-o", "-out" };
X
X#define nssw 2
Xprivate char *ssw[nssw] = { "-simulated", "-s" };
X
X/****************************************************************************
X*	Routines local to this module
X****************************************************************************/
Xprivate void cmdline_help();
X
X/****************************************************************************
X*				 cmdline_help
X* Effect: 
X*	Prints out command line help
X****************************************************************************/
X
Xprivate void cmdline_help()
X{
X    fprintf(stderr,"adagio [options] filename [options]\n");
X    fprintf(stderr,"	 Options are below.  Those with * are for wizrds:\n");
X    fprintf(stderr,"*	   -at		     PC/AT (secondary interrupt channel)\n");
X    fprintf(stderr,"	   -block	     disable MIDI thru\n");
X    fprintf(stderr,"	   -debug (-d)	     enable verbose debug mode\n");
X    fprintf(stderr,"	   -help	     this message\n");
X    fprintf(stderr,"	   -metronome (-met) turn on MPU-401 metronome\n");
X    fprintf(stderr,"	   -miditrace (-m)   turn on MIDI command trace\n");
X    fprintf(stderr,"	   -print	     print note data\n");
X    fprintf(stderr,"	   -tune file	     use tuning from file\n");
X    fprintf(stderr,"	   -simulated (-s)   run with simulated MPU-401\n");
X    fprintf(stderr,"	   -trace (-t)	     trace music\n");
X    fprintf(stderr,"*	   -xt		     PC/XT (no secondary interrupt channel)\n");
X}
X
X/****************************************************************************
X*				     main
X* Inputs:
X*	int argc: Count of arguments
X*	char * argv[]: Vector of argument pointers
X* Effect: 
X*	Runs record program.
X****************************************************************************/
X
Xvoid main(argc,argv)
X   int argc;
X   char * argv[];
X{
X    FILE *fp = NULL;
X    char *s;	/* temp pointer to input and output file names */
X
X    cl_init(switches, nswitches, options, noptions, argv, argc);
X
X    outfile[0] = 0;	/* initialize file names to null strings */
X    score_na[0] = 0;
X
X    if (cl_switch("-help")) {
X	cmdline_help(); 
X	return;
X    }
X
X    IsAT = (ATXT() == ISAT);
X    if (cl_switch("-at")) {
X	if (!IsAT) { /* lie! */
X	    fprintf(stderr,"-at but not running on PC/AT!\n");
X	    return;
X	}
X    }
X
X    if (cl_nswitch(msw, nmsw) != NULL)
X	 metronome(true);
X
X    s = cl_noption(oopt, noopt);
X    if (s != NULL) strcpy(outfile, s);
X
X    if (cl_switch("-help")) {
X	cmdline_help(); 
X	return;
X    }
X
X    if (cl_nswitch(ssw, nssw) != NULL) no_mpu = true;
X
X    if (cl_switch("-xt")) {
X	if (ISAT) { /* lie! */
X	    fprintf(stderr,"-xt but running on PC/AT!\n");
X	    return;
X	}
X    }
X
X    if ((s = cl_arg(1)) != NULL) strcpy(score_na, s);
X
X    fp = fileopen(score_na, "gio", "r", "Name of Adagio score file");
X    phase2(phase1(fp));
X    return;
X}
END_OF_FILE
if test 4118 -ne `wc -c <'recmain.c'`; then
    echo shar: \"'recmain.c'\" unpacked with wrong size!
fi
# end of 'recmain.c'
fi
if test -f 'record.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'record.h'\"
else
echo shar: Extracting \"'record.h'\" \(58 characters\)
sed "s/^X//" >'record.h' <<'END_OF_FILE'
Xboolean rec_init();
Xboolean rec_poll();
Xvoid rec_final();
END_OF_FILE
if test 58 -ne `wc -c <'record.h'`; then
    echo shar: \"'record.h'\" unpacked with wrong size!
fi
# end of 'record.h'
fi
if test -f 'recspace.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'recspace.c'\"
else
echo shar: Extracting \"'recspace.c'\" \(407 characters\)
sed "s/^X//" >'recspace.c' <<'END_OF_FILE'
X/* recspace.c -- free space initialization module for record program */
X
X/* this file defines the maximum allowable number of notes for phase1 */
X/* the number must be determined emperically because it depends upon  */
X/* the amount of storage that must be left around for phase2 */
X
X/* this should leave about 2KB free */
X
X#define MAXSPACE 49000
X
X/* export the free space counter */
Xlong space = MAXSPACE;
END_OF_FILE
if test 407 -ne `wc -c <'recspace.c'`; then
    echo shar: \"'recspace.c'\" unpacked with wrong size!
fi
# end of 'recspace.c'
fi
if test -f 'timdif.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'timdif.h'\"
else
echo shar: Extracting \"'timdif.h'\" \(17 characters\)
sed "s/^X//" >'timdif.h' <<'END_OF_FILE'
Xlong ibm_time();
END_OF_FILE
if test 17 -ne `wc -c <'timdif.h'`; then
    echo shar: \"'timdif.h'\" unpacked with wrong size!
fi
# end of 'timdif.h'
fi
if test -f 'trans2.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'trans2.h'\"
else
echo shar: Extracting \"'trans2.h'\" \(15 characters\)
sed "s/^X//" >'trans2.h' <<'END_OF_FILE'
Xvoid phase2();
END_OF_FILE
if test 15 -ne `wc -c <'trans2.h'`; then
    echo shar: \"'trans2.h'\" unpacked with wrong size!
fi
# end of 'trans2.h'
fi
if test -f 'traspace.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'traspace.c'\"
else
echo shar: Extracting \"'traspace.c'\" \(403 characters\)
sed "s/^X//" >'traspace.c' <<'END_OF_FILE'
X/* recspace.c -- free space initialization module for transcribe program */
X
X/* this file defines the maximum allocatable storage in bytes */
X/* the number must be determined emperically because it depends upon  */
X/* the amount of storage that must be left around for io etc. */
X
X/* this should leave about 2KB free */
X#define MAXSPACE 55000
X
X/* export the free space counter */
Xlong space = MAXSPACE;
END_OF_FILE
if test 403 -ne `wc -c <'traspace.c'`; then
    echo shar: \"'traspace.c'\" unpacked with wrong size!
fi
# end of 'traspace.c'
fi
if test -f 'userio.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'userio.c'\"
else
echo shar: Extracting \"'userio.c'\" \(4652 characters\)
sed "s/^X//" >'userio.c' <<'END_OF_FILE'
X/* userio.c -- handy user interface functions */
X
X/*****************************************************************************
X*	    Change Log
X*  Date	    | Change
X*-----------+-----------------------------------------------------------------
X* 21-May-86 | Created
X*****************************************************************************/
X
X#include "cext.h"
X#include "stdio.h"
X#include "userio.h"
X
X
X/****************************************************************************
X*				askbool
X* Inputs:
X*	char *prompt: string to prompt for user input
X*	int deflt: true or false default
X* Returns:
X*	boolean: true or false as entered by user
X* Effect:
X*	prompts user for yes or no input, returns result
X****************************************************************************/
X
Xint askbool(prompt, deflt)
X    char *prompt;
X    int deflt;
X{
X#define undefined -1
X    char defchar;	/* the default answer */
X    char c;		/* user input */
X    int result = -1;	/* the result: -1 = undefined, 0 = false, 1 = true */
X    if (deflt) defchar = 'y';
X    else defchar = 'n';
X    while (result == undefined) {
X	fprintf(stderr, "%s? [%c]: ", prompt, defchar);
X	c = getchar();
X	if (toupper(c) == 'Y') result = true;
X	else if (toupper(c) == 'N') result = false;
X	else if (c == '\n') result = deflt;
X	else fprintf(stderr, "Please type Y or N.\n");
X    }
X    while (c != '\n') c = getchar();	/* flush the input line */
X    return result;
X}
X
X
X/****************************************************************************
X*				fileopen
X* Inputs:
X*	char *deflt: the default file name (e.g. from command line)
X*	char *extension: default extension
X*	char *mode: read ("r") or write ("w")
X*	char *prompt: prompt for user
X* Returns:
X*	opened file pointer
X* Effect: 
X*	opens file, prompts for user input if necessary and warns about
X*	possible confusion.  If deflt is a null string, the user will
X*	be prompted for a name.	 The routine loops until a file is opened.
X*	If the mode is "r", a check is made to see if the file exists
X*	with and without the extension.	 If both exist a warning is given.
X*	For mode "w", a check is made to see if the file will be overwritten.
X*	The extension is automatically added if the default or user-typed
X*	file has no "."	 At the bottom of the loop body, if no file has
X*	been opened, the user is prompted for another file name.
X****************************************************************************/
X
XFILE *fileopen(deflt, extension, mode, prompt)
X    char *deflt;
X    char *extension;	/* default extension */
X    char *mode;		/* read "r" or write "w" */
X    char *prompt;	/* prompt for user */
X{
X    char filename[100]; /* trial name */
X    char extname[100];	/* trial name with extension added */
X    FILE *fp = NULL;	/* file corresponding to filename */
X    FILE *fpext;	/* file corresponding to extname */
X    char *problem;	/* tells user why he has to try again */
X
X    strcpy(filename, deflt);
X    while (fp == NULL) {	/* keep trying until a good file is found */
X	while (strlen(filename) == 0) { /* avoid null file names */
X	    fprintf(stderr, "%s: ", prompt);
X	    gets(filename);
X	}
X	if (mode[0] == 'r') {
X	    strcpy(extname, filename);
X	    strcat(extname, ".");
X	    strcat(extname, extension);
X	    fp = fopen(filename, mode);
X	    fpext = fopen(extname, mode);
X	    if (fp != NULL && fpext != NULL) {
X		fprintf(stderr,
X			"warning: both %s and %s exist.	 %s will be used.\n",
X			filename, extname, filename);
X		fclose(fpext);
X	    } else if (fpext != NULL) {
X		fp = fpext;
X	    }
X	    if (fp == NULL) problem = "Couldn't find %s.";
X	} else if (mode[0] == 'w') {
X	    /* add the extension if there is no '.' in the file name */
X	    if (!strchr(filename, '.')) {
X		strcat(filename, ".");
X		strcat(filename, extension);
X	    }
X	    fp = fopen(filename, "r");
X	    if (fp != NULL) {
X		char question[100];
X		fclose(fp);
X		strcpy(question, "OK to overwrite ");
X		strcat(question, filename);
X		if (askbool(question, false)) {
X		    fp = fopen(filename, mode);
X		} else {
X		    fp = NULL;
X		    problem = "";
X		}
X	    } else {
X		fp = fopen(filename, mode);
X		if (fp == NULL) problem = "Couldn't create %s.";
X	    }
X	}
X	if (fp == NULL) {
X	    fprintf(stderr, problem, filename);
X	    fprintf(stderr, "  Try again.\n%s: ", prompt);
X	    gets(filename);
X	}
X    }
X    return fp;
X}
X
X/****************************************************************************
X*				    readln
X* Inputs:
X*	FILE * fp: File to read from
X* Effect: 
X*	Reads and discards characters until a newline is seen
X****************************************************************************/
X
Xvoid readln(fp)
XFILE *fp;
X{
X	while (getc(fp) != '\n')
X		;
X}
END_OF_FILE
if test 4652 -ne `wc -c <'userio.c'`; then
    echo shar: \"'userio.c'\" unpacked with wrong size!
fi
# end of 'userio.c'
fi
if test -f 'userio.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'userio.h'\"
else
echo shar: Extracting \"'userio.h'\" \(48 characters\)
sed "s/^X//" >'userio.h' <<'END_OF_FILE'
Xint askbool();
XFILE *fileopen();
Xvoid readln();
END_OF_FILE
if test 48 -ne `wc -c <'userio.h'`; then
    echo shar: \"'userio.h'\" unpacked with wrong size!
fi
# end of 'userio.h'
fi
echo shar: End of archive 1 \(of 6\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 4 5 6 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 6 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
