Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-02 - decus/20-0046/abacus.mac
There are 5 other files named abacus.mac in the archive. Click here to see a list.

	TITLE ABACUS
	SUBTTL PROGRAM BY MARTY SCHULTZ
	SUBTTL V 2.002	8-12-72
;COPYRIGHT 1972,1973 MASCO PROGRAM DEVELOPMENT, SYOSSET NY

	IFNDEF SHARE,<SHARE==1>
	EXTERN EXP3.0,SIN,COS,ABS,ATAN,ASIN,ACOS,AMOD
	EXTERN AINT,ALOG10,EXP,SQRT,ALOG
	INTERN TYPER.,OVPCWD



IFNDEF HELPPN,	<HELPPN==<1,,4>>
	;PPN WHERE 'ABACUS.HLP' SHOULD BE FOUND.  IF NOTHING
	;ASSUME [1,4] (SYS:)

EXT=0
ACC=1
LOC=2
OFF=3
SOFF=4
SYM=5
CNT=6
MACP=7
PNT=10
PNF=11
STOR=12
TYP=13
SER=14
FF=15
Q=16
P=17

JOBFF==121
JOBSA==120
JOBCNI==126
JOBTPC==127

IC.MV1==<MOVE 1,>
IC.STO==<SETO>
IC.JSA==<JSA Q,>
IC.SKE==<SKIPE>
IC.MVM==<MOVEM>
IC.MVN==<MOVN>
IC.MVE==<MOVE>
IC.FAR==<FADR>
IC.FMR==<FMPR>
IC.FSR==<FSBR>
IC.FDR==<FDVR>
IC.JMP==<JUMP>
IC.SO1==<SETO 1,>
IC.SZ1==<SETZ 1,>
IC.SZ==<SETZ>
IC.STA==<SETCA>
IC.JRT==<JRST>



SYMTAB==0

V.COMU==4
V.BINR==^D13
V.UNAR==^D16
V.ASSN==^D17
V.SUBS==^D18
V.SEMI==^D21
V.FNCT==^D22

V.RTPR==^D20
V.LFPR==^D19

V.VNUM==2000+2

F.NPZ==1
F.NLN==2
F.OUT==4

.REPT==400000
.PDLOV==200000
.MEMV==30000
.FPOV==100
.AROV==10
B.LB40==1B35
B.UNRY==^D35
B.TYPE==^D34
B.HIER==^D29
B.OFFS==^D25

DEFINE SYCIDT (ENTLOC,OFFSET,ACTLOC),
	<MOVE ACC,STTB1
	MOVEM ACC,ENTLOC
	LDB ACC,POINT6
	MOVEM ACC,OFFSET
	PUSHJ P,LOKSYM
	MOVEI ACC,SYMTAB(SYM)
	MOVEM ACC,JUNK2
	HRRZ ACC,SYMTAB+1(SYM)
	MOVEM ACC,ACTLOC>

DEFINE SYCNUM (ENTLOC,OFFSET,ACTLOC),
	<MOVE ACC,STTB2
	MOVEM ACC,ENTLOC
	LDB ACC,POINT6
	MOVEM ACC,OFFSET
	AOS ACC,NUMP
	MOVEM SYM,NUMTAB(ACC)
	MOVEI ACC,NUMTAB(ACC)
	MOVEM ACC,ACTLOC>

DEFINE SYCOPR (ENTLOC,OFFSET,ACTLOC),
	<PUSHJ P,LOKSYM
	MOVEI ACC,SYMTAB(SYM)
	MOVEM ACC,ENTLOC
	LDB ACC,POINT6
	MOVEM ACC,OFFSET
	SETZM ACTLOC>

DEFINE W (WORD),
	<EXP WORD>

DEFINE GENER (INSTRUC),
	<PUSH Q,INSTRUC>

DEFINE POLOUT (POLARG)
	<PUSH Q,POLARG>

DEFINE T(P1,P2,P3,P4,P5,P6,P7),
	<EXP <P1>B11+<P2>B17+<P3>B19+<P4>B25+<P5>B29+<P6>B34+<P7>B35>


DEFINE LOAD,
	<HRLZI ACC,(IC.MVE)
	HRR ACC,LOC
	GENER ACC>


DEFINE GCHAR,
<	SETZM BUFCHR
	PUSHJ P,LODCHR>

DEFINE BOUND (A1,A2),
	<CAIG ACC,A1
	CAIGE ACC,A2>

DEFINE F (X1,X2),
	<XWD X1,X2>

	IFN SHARE,<TWOSEG>
	IFN SHARE,<RELOC 400000>

ABACUS:	JRST .+2
	OUTSTR [ASCIZ"
ABACUS, "]
	RESET
	OUTSTR [ASCIZ"  HLP(0) FOR HELP
"]
	MOVE P,PDLINF
	MOVE STOR,JOBFF
	ADDI STOR,77
	MOVEI ACC,.REPT+.PDLOV+.MEMV+.FPOV+.AROV
	CALLI ACC,16
	LOC 137
	W V.VNUM
	LOC 124
	W BEGIN
	LOC 125
	W TRAPER
	RELOC

BSTT:	HRLZI CNT,-V.INST
SETUP1:	MOVE ACC,SETLST(CNT)
	LDB SYM,POINT7
	LSH SYM,6
	PUSHJ P,LOKSYM
	HRRM ACC,SYMTAB(SYM)
	LDB ACC,POINT8
	MOVEI SYM,SYMTAB(SYM)
	MOVEM SYM,STTAB4(ACC)
	AOBJN CNT,SETUP1
	HRLZI CNT,-V.FUNC
SETUP2:	MOVE ACC,SETLSS(CNT)
	HLRZ SYM,ACC
	PUSHJ P,LOKSYM
	MOVEI OFF,1B35
	HRRM OFF,SYMTAB(SYM)
	HRRM ACC,SYMTAB+1(SYM)
	AOBJN CNT,SETUP2


INITY:	INIT 1,401
	SIXBIT/TTY/
	XWD IBUF
	JRST ERRTY
BEGIN:	SETOM IBUF+2
ASKEXP:	SETZB FF,BUFCHR
	SETZB CNT,NUMP
	SETZB MACP,PTEM
	SETZB ACC,LOC
	SETZB SYM,OFF
	MOVE P,PDLINF
	MOVE Q,POLINF
	OUTSTR [ASCIZ/
'/]

INFPOL:	PUSH P,[0]
ACT2.1:	PUSHJ P,GETSYM
	JRST @STTAB1(TYP)

SCIDN1:	SYCIDT JUNK,OFF,LOC
	JRST INFP2
SCNUM1:	SYCNUM JUNK,OFF,LOC
	JRST INFP2
SCOPR1:	SYCOPR JUNK,OFF,LOC

INFP2:	MOVEM TYP,TYPES
	PUSHJ P,GETSYM
	JRST @STTAB2(TYP)

SCIDN2:	SYCIDT NEXT1,SOFF,NEXT2
	JRST INFSYC
SCNUM2:	SYCNUM NEXT1,SOFF,NEXT2
	JRST INFSYC
SCOPR2:	SYCOPR NEXT1,SOFF,NEXT2
	JRST INFSYC
SCRLF2:	MOVEI SOFF,^D11

INFSYC:	EXCH TYP,TYPES
	IMULI SOFF,3
	SUBI SOFF,^D36
	MOVMS SOFF
	DPB SOFF,POINT1
	LDB ACC,POINT2
	JRST @STTAB3(ACC)


ACT1:	PUSHJ P,POLDO
	JRST NXTSYM
ACT2:	MOVE ACC,@JUNK2
	TRNN ACC,B.LB40
	JRST ERRFN
	POLOUT LOC
	PUSH P,[0]
	PUSH P,[-^D22,,5]
	TRO FF,F.NPZ
	JRST NXTSYM
ACT3:	PUSHJ P,POLDO
	MOVE ACC,NEXT1
	LDB ACC,POINT3
	MOVE ACC,STTB3(ACC)
	MOVEM ACC,NEXT1
	JRST NXTSYM
ACT4:	AOJA CNT,ACT1
ACT5:	SOJGE CNT,ACT1
	JRST ERRLP
ACT6:	AOJA CNT,ACT3
ACT7:	SKIPN (P)
	JRST ACT71
	POP P,ACC
	POLOUT ACC
	JRST ACT7
ACT71:	JUMPN CNT,ERRLP
	PUSH Q,[-^D14,,^D9]
	LDB ACC,POINT4
	MOVNS ACC
	HRLI ACC,3
	MOVSS ACC
	POLOUT ACC
	JRST NXTSYM


NXTSYM:	MOVE TYP,TYPES
	JUMPE TYP,INFDON
	MOVE ACC,NEXT1
	MOVEM ACC,JUNK
	LDB OFF,POINT6
	MOVE LOC,NEXT2
	JRST INFP2

INFDON:	POP P,OFF
	JUMPE OFF,INFDN1
	POLOUT OFF
	JRST INFDON
INFDN1:	JUMPN CNT,ERRLP
	PUSH Q,[-^D14,,^D9]
	CAME P,PDLINF
	JRST ABAERR
	HLRZ CNT,Q
	ADDI CNT,^D100
	MOVNS CNT
	HRLZ CNT,CNT
	MOVE Q,MACINF
	PUSH P,[1]
	PUSH P,[1]
	MOVE SER,EXTINF
	PUSH SER,[-1]
POLMAC:	MOVE OFF,POLLST(CNT)
	SKIPE -1(P)
	JRST POLM1
	PUSHJ P,MAKTMP
	HRLZI ACC,(IC.MVM)
	HRR ACC,LOC
	GENER ACC
	MOVEM LOC,-1(P)
POLM1:	JUMPL OFF,MACOPR
	PUSH P,OFF
POLMF:	AOBJN CNT,POLMAC
	JRST DONMAC

MACOPR:	HLRE TYP,OFF
	MOVMS TYP
	CAILE TYP,V.COMU
	JRST MACOP1
	POP P,SOFF
	JUMPE SOFF,COMUN1
	POP P,LOC
	JUMPE LOC,COMUN2
	LOAD
COMUN2:	MOVE LOC,SOFF
	JRST @MACTB1-1(TYP)
COMUN1:	POP P,LOC
	JRST @MACTB1-1(TYP)
MACFIN:	PUSH P,[0]
	JRST POLMF

MADD:	HRLI LOC,(IC.FAR)
MALL1:	GENER LOC
	JRST MACFIN
MMUL:	HRLI LOC,(IC.FMR)
	JRST MALL1
MAND:	HRLI LOC,(IC.FMR)
MMAL1:	GENER LOC
	HRLZI ACC,(IC.SKE)
	GENER ACC
	HRLZI ACC,(IC.STO)
	GENER ACC
	JRST MACFIN
MOR:	HRLI LOC,(IC.FAR)
	JRST MMAL1

MACOP1:	CAILE TYP,V.BINR
	JRST MACOP2
	POP P,SOFF
	JUMPE SOFF,BINRY1
	POP P,LOC
	JUMPE LOC,BINRY2
	LOAD
BINRY2:	MOVE LOC,SOFF
	JRST @MACTB1-1(TYP)
BINRY1:	HRLZI ACC,(IC.MV1)
	GENER ACC
	POP P,LOC
	LOAD
	MOVEI LOC,1
	JRST @MACTB1-1(TYP)

MSUB:	HRLI LOC,(IC.FSR)
MALL2:	GENER LOC
	JRST MACFIN
MDIV:	HRLI LOC,(IC.FDR)
	JRST MALL2
MEXP:	HRLI LOC,(IC.MV1)
	GENER LOC
	PUSH Q,[PUSHJ P,EXP3.0]
	JRST MACFIN
MREL:	HRLZI ACC,(IC.SO1)
	GENER ACC
	MOVE ACC,MACTB2-^D8(TYP)
	HRR ACC,LOC
	GENER ACC
	HRLZI ACC,(IC.SZ1)
	GENER ACC
	GENER [MOVE 0,1]
	JRST MACFIN





MACOP2:	CAILE TYP,V.UNAR
	JRST MACTYP
	POP P,LOC
	JUMPE LOC,UNARY1
	LOAD
UNARY1:	JRST @MACTB1-1(TYP)


MUS:	HRLZI ACC,(IC.MVN)
	GENER ACC
MUA:	JRST MACFIN
MNOT:	HRLZI ACC,(IC.STA)
	GENER ACC
	JRST MACFIN

MACTYP:	JRST @STTAB5-^D17(TYP)
MACOP3:	POP P,LOC
	JUMPE LOC,ASSIN1
	LOAD
ASSIN1:	POP P,LOC
	JUMPE LOC,ERRAS
	HRLZI ACC,(IC.MVM)
	HRR ACC,LOC
	GENER ACC
	TRO FF,F.OUT
	JRST MACFIN



MACOP6:	PUSH Q,[PUSHJ P,PUTFLT]
MACOP4:	POP P,
	JRST POLMF

MACOP5:	POP P,LOC
	PUSH SER,LOC
	POP P,LOC
	HRLI LOC,(IC.JSA)
	GENER LOC
	SKIPGE (SER)
	JRST MACFIN
	POP SER,LOC
	HRLI LOC,(IC.JMP)
	GENER LOC
	JRST .-5




MACOP7:	POP P,ACC
	JUMPN ACC,MCOP7
	PUSHJ P,MAKTMP
	HRLI LOC,(IC.MVM)
	GENER LOC
	HRRZ ACC,LOC
MCOP7:	PUSH SER,ACC
	JRST POLMF

MACOP8:	HRLI LOC,(IC.JRT)
	HRR LOC,Q
	POP SER,NEXT1
	POP SER,NEXT2
	PUSH SER,LOC
	MOVE LOC,MACTB2+5
	HRR LOC,NEXT1
	PUSH SER,LOC
	HRLI LOC,(IC.FAR)
	HRR LOC,NEXT2
	PUSH SER,LOC
	HRLI LOC,(IC.MVE)
	HRR LOC,(Q)
	PUSH SER,LOC
	PUSH SER,[-2]
	JRST POLMF




DONMAC:	SETZ MACP,
DONLOP:	POP SER,ACC
	CAME ACC,[-2]
	JRST FINMAC
	GENER [OUTSTR CRLF]
	HRRZM Q,EXETAB(MACP)
	MOVEI EXT,4
	POP SER,LOC
	GENER LOC
	SOJG EXT,.-2
	AOJA MACP,DONLOP
FINMAC:	HRRZM Q,EXETAB(MACP)
	GENER [JRST OUTVAL]
ENDMAC:	SETZB ACC,EXT
	MOVE P,PDLINF
	JRST MACLST

OUTVAL:	TRNN FF,F.OUT
	PUSHJ P,PUTFLT
	SETOM IBUF+2
	JRST ASKEXP

POLDO:	POP P,RETLOC
	CAIN TYP,3
	JRST POLOPR
	POLOUT LOC
	JRST @RETLOC
POLOPR:	LDB ACC,POINT4
	CAIE ACC,V.RTPR
	JRST POLD1
POLR1:	POP P,OFF
	JUMPE OFF,@RETLOC
	POLOUT OFF
	JRST POLR1
POLD1:	CAIE ACC,V.LFPR
	JRST POLD2
	TRZN FF,F.NPZ
	PUSH P,[0]
	JRST @RETLOC
POLD2:	LDB OFF,POINT5
	HRRZ SOFF,(P)
	CAMGE OFF,SOFF
	JRST POLD3
	MOVNS ACC
	HRL OFF,ACC
	PUSH P,OFF
	JRST @RETLOC
POLD3:	POP P,PNF
	POLOUT PNF
	JRST POLD2

GETSYM:	SETZ TYP,
	TRNE FF,F.NLN
	POPJ P,
	PUSHJ P,LODCHR
	POPJ P,
	BOUND "Z","A"
	JRST .+2
	JRST GETSID
	BOUND "9","0"
	JRST .+2
	JRST GETSNM
	CAIN ACC,"."
	JRST GETSNM
	MOVE PNT,[POINT 6,SYM,17]
	SETZ SYM,
GETOP1:	MOVE EXT,SYM
	SUBI ACC,40
	IDPB ACC,PNT
	MOVEM SYM,SYMTMP
	PUSHJ P,INTAB
	JRST GETOP2
	MOVE SYM,SYMTMP
	SETZM BUFCHR
	PUSHJ P,LODCHR
	JRST GETOP2+1
	JRST GETOP1
GETOP2:	MOVE SYM,EXT
	JUMPE SYM,ERRIO
	MOVEI TYP,3
	POPJ P,


GETSID:	MOVE PNT,[POINT 6,SYM]
	SETZ SYM,
GETSI1:	SUBI ACC,40
	IDPB ACC,PNT
	HRRZ ACC,PNT
	CAIE ACC,SYM
	JRST ERRTL
	SETZM BUFCHR
	PUSHJ P,LODCHR
	JRST GETSI2
	BOUND "Z","A"
	JRST .+2
	JRST GETSI1
	BOUND "9","0"
	JRST GETSI2
	JRST GETSI1
GETSI2:	MOVEI TYP,1
	HLRZS SYM
	POPJ P,



GETSNM:	SETZB EXT,PNT
	SETZB MACP,SYM
GETSN1:	BOUND "9","0"
	JRST GETSN2
	ADD PNT,MACP
	SUBI ACC,60
	FSC ACC,233
	FMPR EXT,TEN
	FADR EXT,ACC
GETSN3:	GCHAR
	JRST GETSN6
	JRST GETSN1
GETSN2:	CAIE ACC,"."
	JRST .+5
	JUMPL MACP,ERRNUM
	SETZ PNT,
	SETO MACP,
	JRST GETSN3
	MOVEI MACP,1
	CAIE ACC,"E"
	JRST GETSN6
	SETZB SYM,BUFCHR
	PUSHJ P,LODCHR
	JRST ERRNUM
	CAIN ACC,"+"
	JRST .+4
	CAIE ACC,"-"
	JRST GETSN4
	SETO MACP,
GETSN5:	GCHAR
	JRST GETSN6
GETSN4:	BOUND "9","0"
	JRST GETSN6
	IMULI SYM,12
	ADDI SYM,-60(ACC)
	JRST GETSN5

GETSN6:	IMUL SYM,MACP
	ADD PNT,SYM
	JUMPE PNT,GETSN7
	MOVE MACP,TEN
	JUMPG PNT,.+2
	MOVE MACP,PTONE
	MOVMS PNT
	FMPR EXT,MACP
	SOJN PNT,.-1
GETSN7:	MOVE SYM,EXT
	MOVEI TYP,2
	POPJ P,



SYN EXT,VAL
SYN ACC,ACA
SYN LOC,ACB
SYN OFF,ACE
SYN SOFF,ACD


PUTFLT:	OUTSTR [ASCIZ/	=/]
	SETZ ACB,
	JUMPE VAL,PUTLST
	MOVE ACE,VAL
	SETZB ACA,VAL
	JUMPGE ACE,.+3
	MOVN ACE,ACE
	OUTCHR ["-"]
PUTFCK:	CAML ACE,[100000000.]
	JRST PUTFDV
	CAML ACE,[10000000.]
	JRST PUTFOT
	FMPR ACE,TEN
	SOJA ACA,PUTFCK
PUTFDV:	FDVR ACE,TEN
	AOJA ACA,PUTFCK

PUTFOT:	MOVE ACD,ACE
	MULI ACE,400
	ASH ACD,-243(ACE)
	MOVE ACE,ACD
	ADDI ACE,5
	IDIVI ACE,^D10
	MOVE ACB,ACA
	ADDI ACA,1
	ADDI ACB,10
	CAIG ACB,6
	CAMG ACB,[-5]
	JRST PUTFEX
	PUSH P,[0]
	MOVMS ACA
	MOVEI ACB,20
PUTLOP:	IDIVI ACE,^D10
	ADDI ACD,60
	JUMPN ACA,.+3
	TRO VAL,1
	PUSH P,["."]
	CAIE ACD,60
	TROA VAL,1
	TRNE VAL,1
	PUSH P,ACD
	SUBI ACA,1
	SOJG ACB,PUTLOP
	TRZ VAL,1
	POP P,ACB
	CAIE ACB,60
	TROA VAL,1
	TRNE VAL,1
	OUTCHR ACB
	JUMPN ACB,.-5
	POPJ P,
PUTFEX:	MOVEI ACA,6
	PUSH P,ACB
	TRO VAL,1
	PUSHJ P,PUTLOP-3
	POP P,ACB
	OUTCHR ["E"]
	SUBI ACB,1
	MOVEI ACD,"+"
	SKIPGE ACB
	MOVEI ACD,"-"
	OUTCHR ACD
PUTLST:	MOVM SYM,ACB
	PUSHJ P,DECOUT
	POPJ P,

ONE:	1.0
PTONE:	0.1
TEN:	10.0

DECOUT:	IDIVI SYM,^D10
	HRLM SYM+1,(P)
	SKIPE SYM
	PUSHJ P,DECOUT
	HLRZ SYM,(P)
	ADDI SYM,60
	OUTCHR SYM
	POPJ P,

LODCHR:	SKIPE ACC,BUFCHR
	JRST NORCHR
	SOSL IBUF+2
	JRST BUFOK
	IN 1,
	JRST LODCHR
	JRST INITY
BUFOK:	ILDB ACC,IBUF+1
	JUMPE ACC,LODCHR
	CAIN ACC,40
	JRST LODCHR
	CAIN ACC,^D26
	JRST BEGIN
	CAIE ACC,7
	JRST NOALT
	OUTSTR [BYTE(7) 15,12,47,47,0]
	SETZM BUFCHR
	JRST LODCHR
NOALT:	CAIN ACC,175
	MOVEI ACC,33
	CAIN ACC,33
	JRST NOESC
	BOUND 15,12
	JRST NORCHR
NOESC:	TRO FF,F.NLN
	SETZ TYP,
	POPJ P,
NORCHR:	MOVEM ACC,BUFCHR
	AOS (P)
	POPJ P,


INTAB:	MOVE SER,SYM
	MOVE PNF,SER
	LSH SER,-6
	ADD PNF,SER
	LSH SER,-6
	ADD SER,PNF
	ANDI SER,77
	SKIPE BUKET(SER)
	JRST INTAB1
	AOS PNF,STOR
	MOVEM PNF,BUKET(SER)
	JRST INTAB3
INTAB1:	MOVE SER,BUKET(SER)
INTAB2:	HLRZ MACP,(SER)
	CAMN SYM,MACP
	JRST INTABY
	HLRZ PNF,1(SER)
	JUMPE PNF,.+3
	MOVE SER,PNF
	JRST INTAB2
	AOS PNF,STOR
	HRLM PNF,1(SER)
INTAB3:	AOS SER,STOR
	POPJ P,
INTABY:	AOS (P)
	MOVE SYM,SER
	POPJ P,

LOKSYM:	MOVEM SYM,SYMTMP
	PUSHJ P,INTAB
	JRST .+2
	POPJ P,
	MOVE SYM,SYMTMP
	HRLZM SYM,-1(SER)
	AOS PNF,STOR
	HRRM PNF,(SER)
	MOVEI SYM,-1(SER)
	POPJ P,



TRAPER:	MOVE ACC,JOBCNI
	TRNE ACC,.PDLOV
	JRST ABAERR
	TRNE ACC,.FPOV+.AROV
	JRST ARTOV$
	TRNN ACC,.MEMV
	JRST ABAERR
	MOVEI ACC,^D20(STOR)
	CALLI ACC,11
	JRST ERRCO
	SOS JOBTPC
	JRSTF @JOBTPC
ARTOV$:	SETO VAL,
	LSH VAL,-1
	JRST @JOBTPC


MAKTMP:	AOS SOFF,PTEM
	MOVEI LOC,TMPTAB(SOFF)
	POPJ P,


TYPER.:	HLRZS EXT
	OUTSTR @EXT
	POPJ P,
ERRTY:	OUTSTR [ASCIZ/
?ABACUS ERROR. CANNOT START TTY./]
	EXIT
ERRNUM:	OUTSTR [ASCIZ/
?NUMBER ERROR./]
	JRST BEGIN
ERRIF:	OUTSTR [ASCIZ/
?ABACUS WARNING: NO SUBSCRIPTS./]
	JRST BEGIN
ERRIC:	OUTSTR [ASCIZ/
?BAD OPERATION./]
	JRST BEGIN
ERRLP:	OUTSTR [ASCIZ/
?UNMATCHED ( ) ./]
	JRST BEGIN
ABAERR:	OUTSTR [ASCIZ/
?ABACUS ERROR. RESTARTING./]
	JRST BEGIN
ERRAS:	OUTSTR [ASCIZ/
?BAD ASSIGNMENT./]
	JRST BEGIN
ERRIO:	OUTSTR [ASCIZ/
?BAD OPERATOR./]
	JRST BEGIN
ERRTL:	OUTSTR [ASCIZ/
?ID TOO LONG./]
	JRST BEGIN
ERRCO:	OUTSTR [ASCIZ/
?ABACUS ERROR. NO MORE CORE LEFT./]
	JRST BEGIN
ERRFN:	OUTSTR [ASCIZ/
?FUNCTION DOES NOT EXIST/]
	JRST INITY


	LIT



STTAB1:	W BEGIN
	W SCIDN1
	W SCNUM1
	W SCOPR1

STTAB2:	W SCRLF2
	W SCIDN2
	W SCNUM2
	W SCOPR2

STTAB3:	W ERRIC
	W ACT1
	W ACT2
	W ACT3
	W ACT4
	W ACT5
	W ACT6
	W ACT7


POINT1:	POINT 6,POINT2,5
POINT3:	POINT 1,(ACC),B.UNRY
POINT4:	POINT 5,@JUNK,B.TYPE
POINT5:	POINT 4,@JUNK,B.HIER
POINT6:	POINT 6,(ACC),B.OFFS
POINT7:	POINT 12,ACC,11
POINT8:	POINT 6,ACC,17
POINT9:	POINT 9,VAL,8

STTAB5:	W MACOP3
	W ABAERR
	W ABAERR
	W ABAERR
	W MACOP4
	W MACOP5
	W MACOP6
	W MACOP7
	W MACOP8



MACTB1:	W MADD	;1
	W MMUL	;2
	W MAND	;3
	W MOR	;4
	W MSUB	;5
	W MDIV	;6
	W MEXP	;7
	W MREL	;8
	W MREL	;9
	W MREL	;10
	W MREL	;11
	W MREL	;12
	W MREL	;13
	W MUA	;14
	W MUS	;15
	W MNOT	;16

MACTB2:	CAME
	CAMLE
	CAMGE
	CAMN
	CAML
	CAMG

PDLINF:	IOWD 100,PDLST.
MACINF:	IOWD ^D100,MACLST
EXTINF:	IOWD 20,EXTLST
POLINF:	IOWD ^D100,POLLST
CRLF:	BYTE(7) 15,12,0

;SYMBOL	INST	EXT	SYNTAX	HIER	TYPE	UNRY
	RADIX ^D10

SETLST:	T (' I',3,0,1,0,0,0)
	T (' N',4,0,2,0,0,0)
	T (' +',1,0,3,12,14,0)
	T (' -',2,0,3,12,15,1)
	T ('+ ',0,0,3,9,1,0)
	T ('- ',0,0,3,9,5,1)
	T ('* ',0,0,4,10,2,0)
	T ('/ ',0,0,4,10,6,0)
	T ('^ ',0,0,4,11,7,0)
	T ('& ',0,0,4,7,3,0)
	T ('! ',0,0,4,7,4,0)
	T ('< ',0,0,9,8,12,0)
	T ('> ',0,0,9,8,13,0)
	T ('= ',0,0,9,8,8,0)
	T ('<=',0,0,9,8,9,0)
	T ('>=',0,0,9,8,10,0)
	T ('<>',0,0,9,8,11,0)
	T ('] ',0,0,8,12,16,0)
	T ('_ ',0,0,5,4,17,0)
ZZ='( '
	T (ZZ,0,0,6,0,19,0)
ZZ=') '
	T (ZZ,0,0,7,0,20,0)
	T ('; ',0,0,10,3,21,0)
	T ('\ ',0,0,10,3,23,0)
ZZ=', '
	T (ZZ,0,0,4,6,24,0)
	T (': ',0,0,12,3,25,0)

V.INST==.-SETLST


SETLSS:	F ('SIN',SIN)
	F ('COS',COS)
	F ('ABS',ABS)
	F ('ATN',ATAN)
	F ('ASN',ASIN)
	F ('ACS',ACOS)
	F ('INT',AINT)
	F ('LOG',ALOG10)
	F ('EXP',EXP)
	F ('SQR',SQRT)
	F ('LN ',ALOG)
	F ('HLP',HELP)
	F ('SYM',SYMBOL)
	F ('STP',STOP)
	F ('IF ',IF)
	F ('GET',GETTY)
	F ('TRU',TRUTH)
	F ('MOD',AMOD)

V.FUNC==.-SETLSS

RADIX 8

SYNTAX:	001112101110
	001100101110
	110001000000
	110001000000
	113001010000
	446004040000
	005550505550
	110001010000
	113001010000
	770007000077
	000000000000
	100000000000

	IFN SHARE,<RELOC 0>

POINT2:	POINT 3,SYNTAX-1(OFF),0
STTAB4:	Z
STTB3:	Z
	Z
STTB1:	Z
STTB2:	Z

EXETAB:	BLOCK 6
PTEM:	Z
IBUF:	BLOCK 3
BUFCHR:	Z
OVPCWD:	Z
JUNK:	Z
JUNK2:	Z
NUMP:	Z
TYPES:	Z
RETLOC:	Z
EXTLST:	BLOCK 20
PDLST.:	BLOCK 100
NEXT1:	Z
NEXT2:	Z
SYMTMP:	Z
SYMLOC:	Z
ACTLOC:	Z


STOP:	Z
	EXIT
	JRST .-1


HELP:	Z
	OUTSTR [ASCIZ"
IN MONITOR, TYPE 

.HELP ABACUS

FOR HELP.
"]
	JRA Q,(Q)

IF:	Z
	SKIPN @(Q)
	JRA Q,1(Q)
	MOVE ACC,@1(Q)
	SETZ LOC,
	FSBR ACC,ONE
	SKIPL ACC
	AOJA LOC,.-2
	MOVE ACC,EXETAB(LOC)
	JRST 1(ACC)




GETTY:	Z
GETTA:	SETZB LOC,IBUF+2
	OUTCHR ["#"]
GETTD:	SETZM BUFCHR
	PUSHJ P,LODCHR
	JRST GETTE
	CAIN ACC,"+"
	JRST GETTD
	CAIN ACC,"-"
	JRST	[SETCA LOC,LOC
		JRST GETTD]
	PUSHJ P,GETSNM
	CAIN ACC,33
	JRST GETTB
GETTE:	OUTCHR ["?"]
	JRST GETTA
GETTB:	JUMPGE LOC,.+2
	MOVN SYM,SYM
	MOVEM SYM,@(Q)
	JRA Q,1(Q)



SYMBOL:	Z
	SETZM SYMBOL
	HRLZI ACC,-100
SYMLL:	MOVE SER,BUKET(ACC)
SYML:	JUMPE SER,SYME
	HLLZ OFF,(SER)
	JUMPE OFF,SYME
	MOVEM ACC,JUNK
	HRRZ ACC,1(SER)
	SKIPN @ACC
	JRST SYMF
	MOVE PNT,[XWD 440600,OFF]
	ILDB EXT,PNT
	JUMPE EXT,.+4
	ADDI EXT,40
	OUTCHR EXT
	JRST .-4
	MOVEM SER,JUNK2
	MOVE VAL,(ACC)
CPUSH1:	PUSHJ P,PUTFLT
	OUTSTR CRLF
SYMF:	MOVE ACC,JUNK
	MOVE SER,JUNK2
	HLRZ SER,1(SER)
	JRST SYML
SYME:	AOBJN ACC,SYMLL
	JRA Q,(Q)



TRUTH:	Z
	MOVEI ACC,[ASCIZ/	=F/]
	SKIPE @(Q)
	MOVEI ACC,[ASCIZ/	=T/]
	OUTSTR (ACC)
	JRA Q,(Q)


NUMTAB:	BLOCK ^D50
TMPTAB:	BLOCK ^D50
MACLST:	BLOCK ^D100
POLLST:	BLOCK ^D100
BUKET:	BLOCK 100
	END ABACUS