v07i078: A BASIC Interpreter, Part06/06
sources-request at mirror.UUCP
sources-request at mirror.UUCP
Fri Dec 5 01:38:09 AEST 1986
Submitted by: phil at Cs.Ucl.AC.UK
Mod.sources: Volume 7, Issue 78
Archive-name: basic/Part06
# Shar file shar06 (of 6)
#
# This is a shell archive containing the following files :-
# pyramid/conf.h
# pyramid/term.c
# vax/Makefile
# vax/as.s
# vax/asm.sed
# vax/conf.h
# vax/term.c
# ------------------------------
# This is a shell archive, shar, format file.
# To unarchive, feed this text into /bin/sh in the directory
# you wish the files to be in.
echo x - pyramid/conf.h 1>&2
sed 's/^X//' > pyramid/conf.h << 'End of pyramid/conf.h'
X/*
X * BASIC by Phil Cockcroft
X */
X/*
X * configuration file for pyramid systems (BSD unix only)
X */
X
X/*
X * memory sizes.
X */
X
X#define MAXMEM (memp)1000000 /* max amount of memory */
X#define MEMINC 8191 /* sizeof memory increments -1 */
X
X/*
X * various options
X */
X
X#define V7 /* must be defined */
X#define BERK /* must be defined */
X#define UCB_NTTY /* must be defined */
X#define LKEYWORDS
X#define LNAMES
X#define RENUMB
X#define SCOMMS
X#define VFORK
X#define BLOCKSIZ 1024
X#define BSD42
X#define ALIGN4
X#define MPORTABLE
X#define PORTABLE
X
X/*
X * terminal dependent stuff
X */
X
X#define CTRLINT 03 /* sig int control c */
X#define CTRLQUIT 034 /* sig quit FS */
X#define DEFPAGE 80 /* default terminal width */
X#define DEFLENGTH 24 /* default number of lines on screen */
X
X/* #define VAX_ASSEM */ /* if you want to use assembler in various routines*/
X /* this only works for the vax */
X
X/* #define NOEDIT /* define if don't want editing ever ! */
X /* NB basic -e will still turn on editing */
X /* basic -x will still turn off editing */
X
X/* #define LKEYWORDS /* define this if you want to have variable names which*/
X /* contain commands this is like the later versions of */
X /* microsoft but not like the orignal version */
X /* it wastes more space since you have to have some */
X /* spaces in to distinguish keywords */
X
X/* #define RENUMB /* define if you want to put the code for renumbering */
X /* in. It works but is very wasteful of space. If you */
X /* are short of space then don't use it. */
X
X/* #define LNAMES /* define if you want long variables names. This only */
X /* slows it down by a small fraction */
X
X/* #define _BLOCKED /* This is a switch to allow block mode files */
X /* don't define it here look below for where it is done*/
X /* in the file handling bits */
X
X/* #define BSD42 /* if useing a 4.2 system */
X
X/* #define SCOMMS /* to allow shortened command names e.g. l. -> list */
X /* this might cause some problems with overwriting of */
X /* core but I think they have all been solved */
X/* #define VFORK /* if your system supports vfork() */
End of pyramid/conf.h
chmod u=rw-,g=r,o=r pyramid/conf.h
echo x - pyramid/term.c 1>&2
sed 's/^X//' > pyramid/term.c << 'End of pyramid/term.c'
X/*
X * BASIC by Phil Cockcroft
X */
X/*
X * machine dependent terminal info
X */
X
X#include "pyramid/conf.h"
X#include <sgtty.h>
X
X#ifndef SCOPE
X#define SCOPE 0
X#endif
X
Xstruct sgttyb nsttyb, osttyb;
Xstruct tchars ntchr,otchr;
X#ifdef UCB_NTTY
Xstruct ltchars nltchr,oltchr;
X#endif
X
Xextern int ter_width;
Xextern char noedit;
X
Xstatic int got_mode;
X
Xsetu_term()
X{
X register i;
X char *p, *getenv();
X
X ioctl(0,TIOCGETP,&osttyb);
X ioctl(0,TIOCGETC,&otchr);
X nsttyb = osttyb;
X ntchr = otchr;
X#ifdef TIOCSLPN
X osttyb.sg_length = DEFLENGTH;
X nsttyb.sg_length = 0;
X if(ter_width <= 0)
X ter_width = osttyb.sg_width & 0377;
X osttyb.sg_width = DEFPAGE;
X nsttyb.sg_width = 0;
X#endif
X ntchr.t_brkc = -1;
X ntchr.t_eofc = -1;
X ntchr.t_intrc = CTRLINT;
X ntchr.t_quitc = CTRLQUIT;
X if( (p = getenv("TERM")) && strcmp(p, "ucl7009") == 0){
X ntchr.t_startc = -1;
X ntchr.t_stopc = -1;
X }
X i = osttyb.sg_flags & ( LCASE | XTABS);
X nsttyb.sg_flags = CBREAK | ANYP | i;
X osttyb.sg_flags = ECHO | ANYP | CRMOD | SCOPE | i;
X#ifdef UCB_NTTY
X ioctl(0,TIOCGLTC,&oltchr);
X nltchr = oltchr; /* is this needed ?? */
X nltchr.t_suspc = -1;
X nltchr.t_dsuspc = -1;
X nltchr.t_rprntc = -1;
X nltchr.t_flushc = -1;
X nltchr.t_werasc = -1;
X nltchr.t_lnextc = -1;
X#endif
X if(ter_width <= 0)
X ter_width=DEFPAGE;
X got_mode = 1;
X}
X
Xset_term()
X{
X if(noedit || !got_mode)
X return;
X ioctl(0,TIOCSETN,&nsttyb);
X ioctl(0,TIOCSETC,&ntchr);
X#ifdef UCB_NTTY
X ioctl(0,TIOCSLTC,&nltchr);
X#endif
X}
X
Xrset_term(type)
X{
X
X if(noedit || !got_mode)
X return;
X#ifdef TIOCSLPN
X if(type)
X osttyb.sg_width = ter_width;
X#endif
X ioctl(0,TIOCSETN,&osttyb);
X ioctl(0,TIOCSETC,&otchr);
X#ifdef UCB_NTTY
X ioctl(0,TIOCSLTC,&oltchr);
X#endif
X}
End of pyramid/term.c
chmod u=rw-,g=r,o=r pyramid/term.c
echo x - vax/Makefile 1>&2
sed 's/^X//' > vax/Makefile << 'End of vax/Makefile'
X# Makefile for a vax
X
X# which cursor file we want.
X# can be ucl or ukc
XCURSOR = ucl
X
Xbasic: as.o bas1.o bas2.o bas3.o bas4.o bas5.o bas6.o bas7.o bas8.o \
X bas9.o cursor.o termcap.o assist.o term.o
X cc -O as.o bas1.o bas2.o bas3.o bas4.o bas5.o bas6.o bas7.o \
X bas8.o bas9.o cursor.o termcap.o assist.o term.o -lm -ltermcap -o basic
X
Xclean:
X rm -f *.o *.s cursor.c term.c
X
Xassist.o: bas.h assist.c
X cc -O -c assist.c
X
Xtermcap.o: bas.h termcap.c cursor.c
X cc -O -c termcap.c
X
Xcursor.c: cursor/cursor.c.${CURSOR}
X cp cursor/cursor.c.${CURSOR} cursor.c
X
Xcursor.o: cursor.c
X cc -O -c cursor.c
X
Xterm.o: term.c
X cc -O -c term.c
X
Xterm.c: vax/term.c vax/conf.h
X cp vax/term.c term.c
X
Xas.o: vax/as.s
X cp vax/as.s as.s
X cc -O -c as.s
X rm as.s
X
X.c.o:
X cc -O -S -DBSD42 $*.c
X sed -f vax/asm.sed <$*.s | as -o $*.o
X rm -f $*.s
X
Xbas.h: vax/conf.h
X
Xbas1.o: bas1.c bas.h
Xbas2.o: bas2.c bas.h
Xbas3.o: bas3.c bas.h
Xbas4.o: bas4.c bas.h
Xbas5.o: bas5.c bas.h
Xbas6.o: bas6.c bas.h
Xbas7.o: bas7.c bas.h
Xbas7.c: cursor.c
Xbas8.o: bas8.c bas.h
Xbas9.o: bas9.c bas.h
End of vax/Makefile
chmod u=rw-,g=r,o=r vax/Makefile
echo x - vax/as.s 1>&2
sed 's/^X//' > vax/as.s << 'End of vax/as.s'
X .text
X .align 1
X .globl _Getch
X_Getch:
X movl _point,r0
XL190:
X cmpb (r0)+,$32
X beql L190
X movl r0,_point
X movzbl -(r0),r0
X rsb
X
X .globl _Check
X_Check:
X movl _point,r1
XL197:
X cmpb (r1)+,$32
X beql L197
X movzbl -(r1),r0
X beql L198
X cmpb r0,$58
X beql L198
X cmpl r0,$233 # ELSE = 0351
X bneq L199
X tstb _elsecount
X beql L199
XL198:
X movl r1,_point
X rsb
XL199:
X pushl $1
X calls $1,_error
X # no return since _error does not return
X
X .globl __cleanup
X .globl __exit
X__cleanup:
X pushl $0
X calls $1,__exit
X ret
End of vax/as.s
chmod u=rw-,g=r,o=r vax/as.s
echo x - vax/asm.sed 1>&2
sed 's/^X//' > vax/asm.sed << 'End of vax/asm.sed'
Xs/calls $0,_getch$/jsb _Getch/
Xs/calls $0,_check$/jsb _Check/
Xs/calls r[0-9]*,_getch$/jsb _Getch/
Xs/calls r[0-9]*,_check$/jsb _Check/
End of vax/asm.sed
chmod u=rw-,g=r,o=r vax/asm.sed
echo x - vax/conf.h 1>&2
sed 's/^X//' > vax/conf.h << 'End of vax/conf.h'
X/*
X * BASIC by Phil Cockcroft
X */
X/*
X * configuration file for vax systems (BSD unix only)
X */
X
X/*
X * memory sizes.
X */
X
X#define MAXMEM (memp)1000000 /* max amount of memory */
X#define MEMINC 8191 /* sizeof memory increments -1 */
X
X/*
X * various options
X */
X
X#define V7 /* must be defined */
X#define BERK /* must be defined */
X#define UCB_NTTY /* must be defined */
X#define LKEYWORDS
X#define LNAMES
X#define RENUMB
X#define SCOMMS
X#define VFORK
X#define VAX_ASSEM
X#define BLOCKSIZ 1024
X
X/*
X * terminal dependent stuff
X */
X
X#define CTRLINT 03 /* sig int control c */
X#define CTRLQUIT 034 /* sig quit FS */
X#define DEFPAGE 80 /* default terminal width */
X#define DEFLENGTH 24 /* default number of lines on screen */
X
X/* #define VAX_ASSEM */ /* if you want to use assembler in various routines*/
X /* this only works for the vax */
X
X/* #define NOEDIT /* define if don't want editing ever ! */
X /* NB basic -e will still turn on editing */
X /* basic -x will still turn off editing */
X
X/* #define LKEYWORDS /* define this if you want to have variable names which*/
X /* contain commands this is like the later versions of */
X /* microsoft but not like the orignal version */
X /* it wastes more space since you have to have some */
X /* spaces in to distinguish keywords */
X
X/* #define RENUMB /* define if you want to put the code for renumbering */
X /* in. It works but is very wasteful of space. If you */
X /* are short of space then don't use it. */
X
X/* #define LNAMES /* define if you want long variables names. This only */
X /* slows it down by a small fraction */
X
X/* #define _BLOCKED /* This is a switch to allow block mode files */
X /* don't define it here look below for where it is done*/
X /* in the file handling bits */
X
X/* #define BSD42 /* if useing a 4.2 system */
X
X/* #define SCOMMS /* to allow shortened command names e.g. l. -> list */
X /* this might cause some problems with overwriting of */
X /* core but I think they have all been solved */
X/* #define VFORK /* if your system supports vfork() */
End of vax/conf.h
chmod u=rw-,g=r,o=r vax/conf.h
echo x - vax/term.c 1>&2
sed 's/^X//' > vax/term.c << 'End of vax/term.c'
X/*
X * BASIC by Phil Cockcroft
X */
X/*
X * machine dependent terminal info
X */
X
X#include "vax/conf.h"
X#include <sgtty.h>
X
X#ifndef SCOPE
X#define SCOPE 0
X#endif
X
Xstruct sgttyb nsttyb, osttyb;
Xstruct tchars ntchr,otchr;
X#ifdef UCB_NTTY
Xstruct ltchars nltchr,oltchr;
X#endif
X
Xextern int ter_width;
Xextern char noedit;
X
Xstatic int got_mode;
X
Xsetu_term()
X{
X register i;
X char *p, *getenv();
X
X ioctl(0,TIOCGETP,&osttyb);
X ioctl(0,TIOCGETC,&otchr);
X nsttyb = osttyb;
X ntchr = otchr;
X#ifdef TIOCSLPN
X osttyb.sg_length = DEFLENGTH;
X nsttyb.sg_length = 0;
X if(ter_width <= 0)
X ter_width = osttyb.sg_width & 0377;
X osttyb.sg_width = DEFPAGE;
X nsttyb.sg_width = 0;
X#endif
X ntchr.t_brkc = -1;
X ntchr.t_eofc = -1;
X ntchr.t_intrc = CTRLINT;
X ntchr.t_quitc = CTRLQUIT;
X if( (p = getenv("TERM")) && strcmp(p, "ucl7009") == 0){
X ntchr.t_startc = -1;
X ntchr.t_stopc = -1;
X }
X i = osttyb.sg_flags & ( LCASE | XTABS);
X nsttyb.sg_flags = CBREAK | ANYP | i;
X osttyb.sg_flags = ECHO | ANYP | CRMOD | SCOPE | i;
X#ifdef UCB_NTTY
X ioctl(0,TIOCGLTC,&oltchr);
X nltchr = oltchr; /* is this needed ?? */
X nltchr.t_suspc = -1;
X nltchr.t_dsuspc = -1;
X nltchr.t_rprntc = -1;
X nltchr.t_flushc = -1;
X nltchr.t_werasc = -1;
X nltchr.t_lnextc = -1;
X#endif
X if(ter_width <= 0)
X ter_width=DEFPAGE;
X got_mode = 1;
X}
X
Xset_term()
X{
X if(noedit || !got_mode)
X return;
X ioctl(0,TIOCSETN,&nsttyb);
X ioctl(0,TIOCSETC,&ntchr);
X#ifdef UCB_NTTY
X ioctl(0,TIOCSLTC,&nltchr);
X#endif
X}
X
Xrset_term(type)
X{
X
X if(noedit || !got_mode)
X return;
X#ifdef TIOCSLPN
X if(type)
X osttyb.sg_width = ter_width;
X#endif
X ioctl(0,TIOCSETN,&osttyb);
X ioctl(0,TIOCSETC,&otchr);
X#ifdef UCB_NTTY
X ioctl(0,TIOCSLTC,&oltchr);
X#endif
X}
End of vax/term.c
chmod u=rw-,g=r,o=r vax/term.c
More information about the Mod.sources
mailing list