Trailing-Edge
-
PDP-10 Archives
-
decus_20tap5_198111
-
decus/20-0145/ante.mac
There are 3 other files named ante.mac in the archive. Click here to see a list.
00100 ; A Nother Text Editor -- W.R. Bush
00200
00300 TITLE ANTE
00400
00500 F.SYS==1 ; -1 IF TOPS-10, 1 IF TENEX/TOPS-20
00600
00700 ; An executable ANTE is made by
00800 ; 1) choosing the operating system ANTE is to run under by
00900 ; a) setting the assembly switch F.SYS for either
01000 ; TOPS-10 or TENEX/TOPS-20
01100 ; b) selecting the universal file for TENEX/TOPS-20
01200 ; (STENEX or MONSYM, below)
01300 ; 2) assembling ANTE.MAC with MACRO-10 (no other .MAC files
01400 ; are needed, and any version of MACRO-10 may be used)
01500 ; 3) loading ANTE.REL with either LOADER or LINK
01600
01700 IF1,< IFL F.SYS,<PRINTX ANTE for TOPS-10...>
01800 IFG F.SYS,<PRINTX ANTE for TENEX and TOPS-20...>>
01900 IF2,<PRINTX ...is halfway>
02000
02100 ; Command Input Controls
02200 ;
02300 ;^A delete the last character
02400 ;^E print the command stream
02500 ;^F delete and save the command stream (two in succession)
02600 ;^G delete the command stream (two in succession)
02700 ;^H delete the last character
02800 ;^R print the current line
02900 ;^U delete the current line
03000 ;^W delete the last word
03100 ;^V insert the next character into the command stream
03200 ;<rubout> delete the last character
03300 ;<escape> terminate command stream input (two in succession)
03400 ;
03500 ;^H and ^^ equivalent to -LV$$ if first character
03600 ;<line feed> equivalent to LV$$ if first character
03700 ;^L equivalent to -NV$$ if first character
03800 ;^N equivalent to NV$$ if first character
03900 ;
04000 ; Values
04100 ;
04200 ;<digits> integer
04300 ;+<value>{1} unary sign
04400 ;-<value>{1} unary sign
04500 ;<value>+<value> addition
04600 ;<value>-<value> subtraction
04700 ;. the pointer position
04800 ;Z the number of characters in the buffer
04900 ;: to the end of the line (equivalent to .UaL-2C.UbQaJ.,Qb)
05000 ;H all text (equivalent to 0,Z)
05100 ; the value-producing commands Q, W, FN, FO, FTI, FZ, F*, F/, #
05200 ;
05300 ; Commands
05400 ;
05500 ;Values may occur wherever n or m occur.
05600 ;Integers in braces are default values.
05700 ;Valid Qregs are 0 through 9, A through Z, and *.
05800 ;
05900 ; characters, lines, words
06000 ;
06100 ;<n>{1}C move pointer n characters
06200 ;<n>{1}D delete n characters
06300 ;<n>{0}J jump to the nth character
06400 ;<n>{1}<,m>K delete n lines (or from characters n to m)
06500 ;<n>{1}L move the pointer n lines
06600 ;<n>{1}N move the pointer n words
06700 ;<n>{1}O delete n words
06800 ;<n>{1}<,m>T print n lines (or from characters n to m)
06900 ;<n>{1}<,m>V equivalent to -(n-1)T FTS~$ nT (m is the print mode)
07000 ;
07100 ; strings
07200 ;
07300 ;I[string] insert text (<tab> is equivalent)
07400 ;<n>{1}R[string1][string2] replace the nth instance of s1 with s2
07500 ; (a null second string simply deletes the first string)
07600 ;<n>{1}S[string] search n times for the string
07700 ;
07800 ; Q-registers
07900 ;
08000 ;A[Qreg] change the editing context to the Qreg (initially Qreg *)
08100 ;B[Qreg] save the last command in the Qreg
08200 ; (the command is inserted if the Qreg is the one being edited;
08300 ; otherwise the command replaces the Qreg's contents)
08400 ;G[Qreg] get the text from the Qreg
08500 ;<n><,m>M[Qreg] execute the text in the Qreg (n and m are passed as arguments)
08600 ;<n>{1}<,m>P[Qreg] put n lines into the Qreg (or from characters n to m)
08700 ;Q[Qreg] get the value from the Qreg
08800 ;<n>{0}U[Qreg] put the value into the Qreg
08900 ;<n>{1}<,m>X[Qreg] equivalent to <n><,m>P <n><,m>K
09000 ;<n>{1}%[Qreg] add n to the value in the Qreg
09100 ;
09200 ; input-output
09300 ;
09400 ;EG[string] write file, exit and go
09500 ;EE exit without writing a file
09600 ;EN[string] set the default file name used by EG, ER, EW, EX
09700 ;EP[Qreg][string] put the file into the Qreg
09800 ;ER[string] read file
09900 ;EW[string] write file
10000 ;EX[string] write file and exit
10100 ;
10200 ; iteration
10300 ;
10400 ;<n>{infinity}< iterate n times
10500 ;> end the body of an iteration
10600 ;<n>{1}[ iterate n times (like < but with default of 1)
10700 ;] end the body of an iteration (like >)
10800 ;
10900 ; other commands
11000 ;
11100 ;<n>= print n
11200 ;W(B|I|S) return the specified saved pointer position
11300 ; (B: before last search, I: start of insert, S: start of search)
11400 ;FA return to the Qreg last edited
11500 ;<n>{10}FB change the base of numeric input/output
11600 ;<n>{0}<,m>{1}FC<E|N|G|L> if n satisfies the given relation
11700 ; then exit m iteration levels
11800 ; (E:n=0, N:n#0, G:n>0, L:n<0) (the innermost level is 1)
11900 ;<n>{1}FD[string] delete n instances of the string
12000 ; (equivalent to <n><R[string]>)
12100 ;FG[Qreg] print the text in the Qreg (equivalent to @FTS[Qreg])
12200 ;<n>{" "}FI insert n as a character at .
12300 ;FK[Qreg] eliminate the contents of the Qreg
12400 ;FM[Qreg][Qreg] copy the contents of the first Qreg into the second Qreg
12500 ;<n>{1}FN[string] search (like S) and return value (0 for success)
12600 ;FO get the value of the character at .
12700 ;<n>{1}<,m>FP[Qreg] insert n lines into the Qreg (or from characters n to m)
12800 ;FQ list the status of all nonempty Qregs
12900 ;<n>{1}FS[string1][string2] replace n instances of s1 with s2
13000 ; (equivalent to <n><R[string1][string2]>)
13100 ;<n>{0}FTE set echo mode (1:monitor, 0:every char, -1:efficient)
13200 ;FTI input a character from the terminal
13300 ;<n>{" "}<,m>FTO output n as a character to the terminal (with print mode m)
13400 ;<n>{0}FTP set the print mode (-1:direct, 0:terse, 1:verbose)
13500 ;<n>FTS[string] output the string to the terminal (with print mode n)
13600 ;FV[string] set the pointer indicator string used by the V command
13700 ;<n>{0}FW set <n> as the window size for the automatically executed V
13800 ;<n>{1}<,m>FX[Qreg] equivalent to <n><,m>FP <n><,m>K
13900 ;FZ[Qreg] get the Z value from the Qreg
14000 ;<n,m>F* multiply n by m
14100 ;<n,m>F/ divide n by m
14200 ;#[char] produce the character's value
14300 ;? print commands as they are executed
14400 ;![string] comment
14500 ;; accept and discard arguments
14600
14700
14800 ; ***DEFINITIONS***
14900
15000 NSIZE==20
15100 SSIZE==40
15200 BSIZE==200
15300 PSIZE==1000
15400
15500 PBLOCK==5 ; POINTER BLOCK LENGTH (CB, BB, SB, NB, QREGS)
15600 Q.B==0 ; BUFFER POINTER OFFSET
15700 Q.A==1 ; ALLOCATED POINTER OFFSET
15800 Q.Z==2 ; Z POINTER OFFSET
15900 Q.P==3 ; . POINTER OFFSET
16000 Q.V==4 ; VALUE POINTER OFFSET
16100
16200 .JBREN==124
16300
16400 ; REGISTER DEFINITIONS
16500
16600 R1==1
16700 R2==2
16800 R3==3
16900 R4==4
17000 R5==5
17100 R6==6
17200 R7==7
17300 R10==10
17400 R11==11
17500 R12==12
17600 R13==13
17700 R14==14
17800 R15==15
17900 R16==16
18000 R17==17
18100
18200 ; (SCRATCH REGISTERS)
18300 X1==R1
18400 X2==R2
18500 X3==R3
18600 X4==R4
18700
18800 ; (COMMONLY USED REGISTERS)
18900 CH==R5
19000 PTR==R6
19100 N==R7
19200 M==R10
19300 V1==R11
19400 V2==R12
19500 UTIL==R13
19600 FLAG==R14
19700 LEVEL==R15
19800 ENVIR==R16
19900 STACK==R17
20000
20100
20200 ; MACRO DEFINITIONS
20300
20400 SALL
20500
20600 DEFINE BEGINR(SAVLST,%RETN)
20700 < ..SAVL==0
20800 ..SAVC==0
20900 IFIDN <SAVLST><ALL>,<..SAVL==77777>
21000 IFDIF <SAVLST><ALL>,<
21100 IRP SAVLST,<
21200 IFG <SAVLST>-20,<!!
21300 PRINTX SAVLST NOT A REGISTER>
21400 IFLE <SAVLST>-20,<
21500 IFN ..SAVL&1_SAVLST,<!!
21600 PRINTX SAVLST SAVED TWICE>
21700 ..SAVL==..SAVL!1_SAVLST
21800 ..SAVC==..SAVC+1>>>
21900 IFN ..SAVL,<
22000 ..REG==17
22100 REPEAT 20,<
22200 IFN ..SAVL&1_..REG,<PUSH STACK,..REG>
22300 ..REG==..REG-1>>
22400 DEFINE .%RETN <%RETN> ; UNIQUE LOCATION FOR RETURN AND ENDR
22500 DEFINE .%RETL <%RETN':!>
22600 ..SFLG==0 ; LARGEST SKIP RETURN
22700 >
22800
22900 DEFINE RETURN(S,N)
23000 <
23100 IFB <S>,<
23200 IFE ..SAVC,<POPJ STACK,>
23300 IFN ..SAVC,<JRST .%RETN>>
23400 IFIDN <S><SKIP>,<
23500 IFG N-..SFLG,<..SFLG==N>
23600 JRST .%RETN-N>
23700 >
23800
23900 DEFINE RETN(N)
24000 <.%RETN-N
24100 IFNB <N>,<IFG N-..SFLG,<..SFLG==N>>>
24200
24300 DEFINE ENDR(S,N)
24400 < IFB <S>,<..N==0>
24500 IFIDN <S><SKIP>,<..N==N
24600 IFG <..N-..SFLG>,<..SFLG==..N>>
24700 IFN <..SFLG>,<IFN <..N-..SFLG>,<JRST .%RETN-..N>
24800 REPEAT ..SFLG,<
24900 AOS -..SAVC(STACK)>>
25000 .%RETL
25100 ..REG==0
25200 REPEAT 20,<
25300 IFN ..SAVL&1_..REG,<POP STACK,..REG
25400 ..SAVL==..SAVL-1_..REG>
25500 ..REG==..REG+1>
25600 POPJ STACK,>
25700
25800 DEFINE CALLR(ROUTIN)
25900 < PUSHJ STACK,ROUTIN>
26000
26100 DEFINE DBP (REG)
26200 < ADD REG,[070000,,0]
26300 TLNN REG,400000
26400 JRST .+3
26500 HRRI REG,-1(REG)
26600 HRLI REG,010700>
26700
26800 DEFINE LETEST(LETTER,ROUTIN)
26900 < CAIE CH,"LETTER"
27000 CAIN CH,"LETTER"+40
27100 JRST ROUTIN>
27200
27300 DEFINE A$INT(VALUE)
27400 < MOVEI N,VALUE
27500 CALLR EXVALU>
27600
27700 DEFINE A$QREG
27800 < CALLR EXQREG>
27900
28000 DEFINE A$STR(NUMBER)
28100 < CALLR EXSTRI
28200 MOVEM N,EX%S1N
28300 MOVEM M,EX%S1P
28400 IFIDN <NUMBER><2>,< CALLR EXSTRI
28500 MOVEM N,EX%S2N
28600 MOVEM M,EX%S2P>>
28700
28800 DEFINE A$$END
28900 < CALLR EXARGE
29000 JRST EXNEXT>
29100
29200 ; POINTER UPDATING DUE TO ALLOCATION AND BUFFER MOVEMENT
29300 ; IMMEDIATE (STRING SOURCES)
29400 ; I (EXEBIP -- TEXT STRING)
29500 ; R (EXSBI -- TEXT STRING AND SEARCH STRING, EXEBIP -- TEXT STRING)
29600 ; S (EXSBI -- SEARCH STRING)
29700 ; NOTE THAT SOME COMMANDS ARE NOT A PROBLEM
29800 ; G (A PBLOCK POINTER INSTEAD OF A TEXT POINTER)
29900 ; P (EB SOURCE WITH EXBPE POINTER)
30000 ; ER (STRING SOURCE NO LONGER NEEDED)
30100 ; FH (A PBLOCK POINTER INSTEAD OF A TEXT POINTER)
30200 ; FU (A VALUE INSTEAD OF A STRING)
30300 ; DEFERRED (COMMAND POINTER)
30400 ; M AND EXCHAR
30500 ; < AND >
30600 ; ALLOC
30700
30800 DEFINE EXQPTR(REG)
30900 < MOVNI REG,(REG)
31000 ADD REG,@EX%Q
31100 HRRZI REG,(REG)
31200 ADDM REG,EX%PTR>
31300
31400
31500 ; SYSTEM DEPENDENT DEFINITIONS
31600
31700 ; (((TOPS-10)))
31800 IFL F.SYS,<
31900 F.SEGS==2 ; NUMBER OF SEGMENTS (1 OR 2)
32000 IF1,< IFE <F.SEGS-2>,<PRINTX ... with two segments>>
32100
32200 IFE <F.SEGS-2>,<
32300 TWOSEG
32400 RELOC 400000
32500 >; TWOSEG
32600
32700 TTCHAN==0
32800 IOCHAN==1
32900
33000 DEFINE TBIN(REG)
33100 < SKIPL FLAGEF
33200 INCHRW REG
33300 SKIPGE FLAGEF
33400 INCHWL REG>
33500
33600 DEFINE TBOUT(REG)
33700 < OUTCHR REG>
33800
33900 DEFINE TSOUT(STRING)
34000 < IRP STRING
34100 < OUTSTR STRING>>
34200
34300 .JBREL==44
34400 .JBFF==121
34500 .JBINT==134
34600
34700 >
34800 ; (((^^^)))
34900
35000 ; (((TENEX)))
35100 IFG F.SYS,<
35200 ; SEARCH STENEX ; IF TENEX
35300 SEARCH MONSYM ; IF TOPS-20
35400
35500 DEFINE TBIN(REG)
35600 < PBIN
35700 IFN <X1-REG>,< MOVEI REG,(X1)>>
35800
35900 DEFINE TBOUT(REG)
36000 < IFN <X1-REG>,< MOVEI X1,(REG)>
36100 PBOUT>
36200
36300 DEFINE TSOUT(STRING)
36400 < IRP STRING
36500 < HRROI X1,STRING
36600 PSOUT>>
36700 >
36800 ; (((^^^)))
36900
37000 ; TENEX fork version
37100 ;
37200 ; ACs passed down:
37300 ; 0: 0 -> EN; -1 -> ER
37400 ; 1-N: ASCIZ file name
37500 ; ACs passed up:
37600 ; 0: >0 -> ^C continue location; =0 -> EH or EX; <0 -> EG
37700 ; superior fork JSYSes
37800 ; CFORK
37900 ; 1> 1B1+1B3
38000 ; 2> AC pointer
38100 ; 1< handle
38200 ; GTJFN
38300 ; 1> 1B2+1B17
38400 ; 2> ANTE.SAV pointer
38500 ; 1< jfn
38600 ; GET
38700 ; 1> handle,,jfn
38800 ; GEVEC
38900 ; 1> handle
39000 ; 2< entry (start location)
39100 ; SFORK
39200 ; 1> handle
39300 ; 2> entry (GEVEC entry + 1 or ^C continue entry)
39400 ; WFORK
39500 ; 1> handle
39600 ; RFACS
39700 ; 1> handle
39800 ; 2> AC pointer
39900
40000
40100
40200 ; ***INITIALIZATION***
40300
40400 ANTE: JRST START1
40500 JRST START2
40600 REANTE: JRST REENT
40700
40800 START1: SKIPA FLAG,[0] ; REGULAR ENTRY
40900 START2: SETO FLAG, ; INITIAL ARGUMENT ENTRY
41000 MOVEM FLAG,FLAGIF
41100 MOVEI UTIL,REANTE
41200 MOVEM UTIL,.JBREN
41300 MOVE STACK,[IOWD SSIZE,STACKB]
41400 SETZM IONAME
41500 SETOM FLAGIR
41600 CALLR FIRSTN ; GET OPTIONAL INITIAL FILE NAME
41700 RESET
41800 SETZM FLAGIF
41900 CALLR FIRSTI ; PERFORM LOW LEVEL INITIALIZATION
42000 MOVE N,ZU
42100 MOVEI PTR,C.B
42200 FIRSTP: MOVEM N,Q.B(PTR) ; INITIALIZE BUFFERS AND QREGS
42300 SETZM Q.A(PTR)
42400 SETZM Q.Z(PTR)
42500 SETZM Q.P(PTR)
42600 SETZM Q.V(PTR)
42700 ADDI PTR,PBLOCK
42800 CAIE PTR,E.B
42900 JRST FIRSTP
43000 MOVEI PTR,<Q.$+Q.B>
43100 MOVEM PTR,E.B
43200 MOVEI PTR,<Q.$+Q.A>
43300 MOVEM PTR,E.A
43400 MOVEI PTR,<Q.$+Q.Z>
43500 MOVEM PTR,E.Z
43600 MOVEI PTR,<Q.$+Q.P>
43700 MOVEM PTR,E.P
43800 SETZM FLAGCC
43900 SETZM FLAGCD
44000 MOVEI N,^D10
44100 MOVEM N,EXBASE
44200 SETZM EXDBUG
44300 SETZM EXPRIM
44400 MOVE PTR,[BSIZE*5,,C.B]
44500 CALLR ALLOC ; ALLOCATE COMMAND BUFFER
44600 JRST QUIT
44700 SKIPE FLAGIR
44800 SKIPN IONAME
44900 JRST .+3
45000 CALLR IO$ER
45100 JRST INBEG
45200 CALLR EXFIP
45300 JRST INBEG
45400 REENT: MOVE STACK,[IOWD SSIZE,STACKB]
45500 RESET
45600 SETOM FLAGIF
45700 CALLR FIRSTI ; PERFORM LOW LEVEL INITIALIZATION
45800 TSOUT <[ASCIZ/(. is /]>
45900 MOVEI M,^D10
46000 MOVE N,@E.P
46100 CALLR M$I.S
46200 TSOUT <M$I.SR,<[ASCIZ/ and Z is /]>>
46300 MOVE N,@E.Z
46400 CALLR M$I.S
46500 TSOUT <M$I.SR,[ASCIZ/ in /]>
46600 MOVE PTR,E.B
46700 CALLR QNOUT
46800 TSOUT <[ASCIZ/)/],CRLF>
46900 SKIPN FLAGCD
47000 JRST INBEG
47100 SETZM FLAGCC
47200 SETZM FLAGCD
47300 TSOUT <[ASCIZ/ ? Text may be trashed ?/],CRLF>
47400 JRST INBEG
47500
47600
47700 ; ***COMMAND INPUT***
47800
47900 INBEG$: TSOUT <CRLF>
48000 INBEG: MOVEI UTIL,"*"
48100 TBOUT <UTIL> ; PROMPT
48200 HRR PTR,C.B
48300 HRLI PTR,440700 ; PREPARE FOR A NEW COMMAND STRING
48400 SETZ N,
48500 MOVE M,C.A
48600 SETZM EX%B
48700 INNEXT: TBIN <CH> ; INPUT A CHAR AND DISPATCH
48800 INNE$0: HLRZ UTIL,DISPCH(CH)
48900 JRST (UTIL)
49000
49100 INSERT: CALLR TERME
49200 CALLR INADD
49300 JRST INNEXT
49400 JRST INNEXT
49500
49600 IN$A%: CALLR INSUB ; ^A AND RUBOUT
49700 JRST INBEG$
49800 MOVEI UTIL,"\"
49900 TBOUT <UTIL>
50000 CALLR TERMO
50100 JRST INNEXT
50200
50300 IN$E: JUMPE N,INBEG$ ; ^E
50400 TSOUT <CRLF>
50500 MOVEI UTIL,"*"
50600 TBOUT <UTIL>
50700 SETZ UTIL,
50800 HRR PTR,C.B
50900 HRLI PTR,440700
51000 IN$E0: ILDB CH,PTR
51100 CALLR TERMO
51200 ADDI UTIL,1
51300 CAIE UTIL,(N)
51400 JRST IN$E0
51500 JRST INNEXT
51600
51700 IN$F: CALLR TERME ; ^F
51800 TBIN <CH>
51900 CAIE CH,"F"-100
52000 JRST INNE$0
52100 CALLR TERME
52200 MOVEM N,C.Z
52300 MOVE PTR,[C.B,,B.B]
52400 CALLR EXQTOQ
52500 JRST INBEG$
52600 JRST INBEG$
52700
52800 IN$G: CALLR TERME ; ^G
52900 TBIN <CH>
53000 CAIE CH,"G"-100
53100 JRST INNE$0
53200 CALLR TERME
53300 JRST INBEG$
53400
53500 IN$H%: JUMPE N,IN$H%0 ; ^H
53600 CAIN CH,"H"-100
53700 JRST IN$A%
53800 JRST INSERT
53900 IN$H%0: SETOM EX%B
54000 MOVE UTIL,[BYTE (7)"-","L","V",33,0]
54100 MOVEM UTIL,@C.B
54200 MOVEI N,4
54300 JRST EXBEG
54400
54500 IN$J: JUMPN N,INSERT ; <LINE-FEED>
54600 SETOM EX%B
54700 MOVE UTIL,[BYTE (7)"L","V",33,0,0]
54800 MOVEM UTIL,@C.B
54900 MOVEI N,3
55000 SKIPLE FLAGEF
55100 JRST EXBEG$
55200 JRST EXBEG
55300
55400 IN$L: JUMPN N,INSERT ; ^L
55500 SETOM EX%B
55600 MOVE UTIL,[BYTE (7)"-","N","V",33,0]
55700 MOVEM UTIL,@C.B
55800 MOVEI N,4
55900 JRST EXBEG
56000
56100 IN$N: JUMPN N,INSERT ; ^N
56200 SETOM EX%B
56300 MOVE UTIL,[BYTE (7)"N","V",33,0,0]
56400 MOVEM UTIL,@C.B
56500 MOVEI N,3
56600 JRST EXBEG
56700
56800 IN$R: JUMPE N,INBEG$ ; ^R
56900 LDB UTIL,PTR
57000 PUSH STACK,N
57100 CALLR INSUB
57200 JRST IN$R2
57300 IN$R1: CALLR INSUB
57400 JRST IN$R2
57500 CAIN CH,12
57600 JRST IN$R2
57700 CAIN CH,37
57800 JRST IN$R2
57900 JRST IN$R1
58000 IN$R2: CAIN UTIL,12
58100 JRST IN$R3
58200 CAIN UTIL,37
58300 JRST IN$R3
58400 TSOUT <CRLF>
58500 IN$R3: JUMPN N,IN$R4
58600 MOVEI UTIL,"*"
58700 TBOUT <UTIL>
58800 JRST IN$R5
58900 IN$R4: IBP PTR
59000 AOJ N,
59100 IN$R5: MOVEI UTIL,(N)
59200 POP STACK,N
59300 IN$R6: ILDB CH,PTR
59400 CALLR TERMO
59500 ADDI UTIL,1
59600 CAIE UTIL,(N)
59700 JRST IN$R6
59800 JRST INNEXT
59900
60000 IN$U: JUMPE N,INBEG$ ; ^U
60100 TSOUT <[ASCIZ/^U/],CRLF>
60200 CALLR INSUB
60300 JRST INBEG
60400 IN$U1: CALLR INSUB
60500 JRST INBEG
60600 CAIN CH,12
60700 JRST IN$U2
60800 CAIN CH,37
60900 JRST IN$U2
61000 JRST IN$U1
61100 IN$U2: IBP PTR
61200 AOJA N,INNEXT
61300
61400 IN$V: TBIN <CH> ; ^V
61500 CALLR TERME
61600 CALLR INADD
61700 JRST INNEXT
61800 JRST INNEXT
61900
62000 IN$W: JUMPE N,INBEG$ ; ^W
62100 MOVEI UTIL,"\"
62200 TBOUT <UTIL>
62300 IN$W1: CALLR INSUB ; PASS OVER TRAILING SEPARATOR (IF ANY)
62400 JRST INBEG$
62500 CALLR TERMO
62600 CALLR WORDET
62700 JRST IN$W1
62800 JRST IN$W2
62900 JRST IN$W3
63000 IN$W2: TBOUT <UTIL> ; PUNCTUATION (ONE CHARACTER)
63100 JRST INNEXT
63200 IN$W3: CALLR INSUB ; WORD (MANY CHARACTERS)
63300 JRST INBEG$
63400 CALLR WORDET
63500 JRST IN$W4
63600 JRST IN$W4
63700 CALLR TERMO
63800 JRST IN$W3
63900 IN$W4: TBOUT <UTIL>
64000 IBP PTR
64100 AOJA N,INNEXT
64200
64300 IN$%: CALLR TERME ; <END-OF-LINE>
64400 MOVEI CH,15
64500 CALLR INADD
64600 JRST INNEXT
64700 MOVEI CH,12
64800 CALLR INADD
64900 JRST INNEXT
65000 JRST INNEXT
65100
65200 IN$$: CALLR TERME ; <ESCAPE>
65300 CALLR INADD
65400 JRST INNEXT
65500 TBIN <CH>
65600 CAIE CH,33
65700 JRST INNE$0
65800 CALLR TERME ; <ESCAPE><ESCAPE>
65900 CAIN N,1
66000 JRST IN$$0
66100 CALLR INADD
66200 JRST INNEXT
66300 JRST EXBEG
66400 IN$$0: MOVE UTIL,[BYTE (7)"V",33,0,0,0]
66500 MOVEM UTIL,@C.B
66600 MOVEI N,2
66700 JRST EXBEG
66800
66900 ; ADD CH TO COMMAND BUFFER (UPDATE PTR AND N)
67000 ;
67100 INADD: BEGINR
67200 ADDI N,1
67300 CAMGE N,M
67400 JRST INADD1
67500 PUSH STACK,PTR
67600 MOVE PTR,[BSIZE*2*5,,C.B]
67700 CALLR ALLOC
67800 JRST INADD0
67900 POP STACK,PTR
68000 ADDI M,<BSIZE*2*5>
68100 JRST INADD1
68200 INADD0: POP STACK,PTR
68300 SOJA N,RETN(0)
68400 INADD1: IDPB CH,PTR
68500 ENDR SKIP,1
68600
68700 ; SUBTRACT CH FROM COMMAND BUFFER (UPDATE PTR AND N)
68800 ;
68900 INSUB: BEGINR
69000 JUMPE N,RETN(0)
69100 LDB CH,PTR
69200 SOJ N,1
69300 DBP <PTR>
69400 ENDR SKIP,1
69500
69600
69700 ; ***COMMAND EXECUTION***
69800
69900
70000 ; EXECUTION FLAGS (LEFT HALF)
70100 ;
70200 F$EI==400000 ; EXECUTION INHIBIT
70300 F$EM==200000 ; EXECUTING MACRO
70400 ;
70500 ; ARGUMENT FLAGS (RIGHT HALF)
70600 ;
70700 F$V== 700000 ; ALL VALUE FLAGS
70800 F$V1==400000 ; VALUE 1 DEFINED
70900 F$VC==200000 ; , ENCOUNTERED
71000 F$V2==100000 ; VALUE 2 DEFINED
71100 F$P== 070000 ; ALL PREFIX FLAGS
71200 F$PA==040000 ; PREFIX @
71300 F$PC==020000 ; PREFIX :
71400 F$PS==010000 ; PREFIX /
71500 F$O== 006000 ; ALL OPERATOR FLAGS
71600 F$OA==004000 ; OPERATOR -- ADD
71700 F$OS==002000 ; OPERATOR -- SUBTRACT
71800
71900 EXBEG: TSOUT <CRLF>
72000 EXBEG$: MOVEM N,C.Z
72100
72200 EXPAS1: HRR PTR,C.B
72300 HRLI PTR,440700
72400 MOVEM PTR,EX%PTR
72500 MOVE N,C.Z
72600 MOVEM N,EX%N
72700 HRLZI FLAG,F$EI ; PASS 1 IS SYNTAX
72800 SETZ LEVEL,
72900 MOVE ENVIR,[IOWD BSIZE,ENVIRB]
73000 PUSH ENVIR,[EXPAS2]
73100 JRST EXNEXT
73200 EXPAS2: MOVE PTR,@E.P
73300 MOVEM PTR,EX..
73400 HRR PTR,C.B
73500 HRLI PTR,440700
73600 MOVEM PTR,EX%PTR
73700 MOVE N,C.Z
73800 MOVEM N,EX%N
73900 SETZ FLAG, ; PASS 2 IS SEMANTICS
74000 SETZ LEVEL,
74100 SETZM EX%Q
74200 PUSH ENVIR,[EXEND]
74300 JRST EXNEXT
74400
74500 EXEND: TRNN FLAG,F$V1
74600 JRST EXEND%
74700 MOVE N,V1
74800 MOVE M,EXBASE
74900 CALLR M$I.S
75000 TSOUT <M$I.SR,CRLF>
75100 EXEND%: HRRZI PTR,C.B ; PBLOCK POINTER
75200 HRRZ FLAG,C.B ; DOWN POINTER
75300 EXEND1: MOVE N,Q.Z(PTR)
75400 ADDI N,4
75500 IDIVI N,5 ; NUMBER OF WORDS USED
75600 CAMN FLAG,Q.B(PTR)
75700 JRST EXEND2 ; BUFFER NEED NOT BE MOVED
75800 HRL UTIL,Q.B(PTR)
75900 HRRM FLAG,Q.B(PTR) ; MOVE Q.B DOWN
76000 JUMPE N,EXEND2
76100 HRRI UTIL,(FLAG)
76200 HRRZI M,(FLAG)
76300 ADDI M,-1(N)
76400 BLT UTIL,(M) ; MOVE BUFFER DOWN
76500 EXEND2: ADDI N,<BSIZE-1>
76600 IDIVI N,BSIZE ; NUMBER OF BLOCKS USED
76700 MOVEI UTIL,(N)
76800 CAILE UTIL,2
76900 ADDI UTIL,2 ; IF MORE THAN 2 BLOCKS USED THEN ALLOW 2 EXTRA
77000 MOVE N,Q.A(PTR)
77100 IDIVI N,<BSIZE*5> ; NUMBER OF BLOCKS ALLOCATED
77200 CAIG N,(UTIL)
77300 JRST EXEND3
77400 IMULI UTIL,<BSIZE*5>
77500 MOVEM UTIL,Q.A(PTR)
77600 EXEND3: MOVE N,Q.A(PTR)
77700 IDIVI N,5
77800 ADDI FLAG,(N) ; INCREMENT DOWN POINTER BY WORDS ALLOCATED
77900 ADDI PTR,PBLOCK
78000 CAIE PTR,E.B
78100 JRST EXEND1
78200 MOVEM FLAG,ZU ; RESET GLOBAL USED POINTER
78300 CAMN FLAG,ZW
78400 JRST EXEND$
78500 MOVE UTIL,ZW
78600 SUBI FLAG,(UTIL)
78700 CALLR GETCOR ; RECLAIM CORE
78800 JRST .+1
78900 EXEND$: MOVE N,EX..
79000 MOVEM N,B.V
79100 SKIPE EX%B
79200 JRST INBEG
79300 MOVE PTR,[C.B,,B.B]
79400 CALLR EXQTOQ
79500 JRST INBEG
79600 JRST INBEG
79700
79800 EXNEXT: CALLR EXCHAR ; GET A CHAR AND DISPATCH
79900 EXNEX0: HRRZ UTIL,DISPCH(CH)
80000 JRST (UTIL)
80100
80200 EX$A: TRNE FLAG,-1
80300 JRST EXER01
80400 A$QREG
80500 EX$A0: JUMPL FLAG,EXNEXT ; -- END PARSING
80600 CALLR EXESTS
80700 MOVE UTIL,E.B
80800 MOVEM UTIL,EX%A
80900 MOVEM PTR,E.B
81000 ADDI PTR,1
81100 MOVEM PTR,E.A
81200 ADDI PTR,1
81300 MOVEM PTR,E.Z
81400 ADDI PTR,1
81500 MOVEM PTR,E.P
81600 CALLR EXAV ; (IMPLICIT V)
81700 JRST EXNEXT
81800
81900 EX$B: TRNE FLAG,-1
82000 JRST EXER01
82100 SETOM EX%B
82200 A$QREG
82300 JUMPL FLAG,EXNEXT ; -- END PARSING
82400 CALLR EXESTS
82500 SKIPG B.Z
82600 JRST EXNEXT
82700 CAME PTR,E.B
82800 JRST EX$B1
82900 HRRZI PTR,B.B
83000 JRST EX$G0
83100 EX$B1: HRLI PTR,B.B
83200 CALLR EXQTOQ
83300 JRST EXERER
83400 MOVE N,B.V
83500 MOVEM N,Q.V(PTR)
83600 JRST EXNEXT
83700
83800 EX$C: TRNE FLAG,F$VC!F$V2!F$P
83900 JRST EXER01
84000 A$INT <1>
84100 A$$END ; -- END PARSING
84200 MOVE N,@E.P
84300 ADD N,V1
84400 CAIGE N,0 ; (IF <N> < 0 THEN . GETS 0)
84500 SETZ N,
84600 CAMLE N,@E.Z ; (IF <N> > Z THEN . GETS Z)
84700 MOVE N,@E.Z
84800 MOVEM N,@E.P ; SET .
84900 CALLR EXAV ; (IMPLICIT V)
85000 JRST EXNEXT
85100
85200 EX$D: TRNE FLAG,F$VC!F$V2!F$P
85300 JRST EXER01
85400 A$INT <1>
85500 A$$END ; -- END PARSING
85600 JUMPE V1,EXNEXT
85700 JUMPG V1,EX$D2
85800 MOVN N,V1 ; -<N>D
85900 MOVE V1,@E.P
86000 JUMPE V1,EXNEXT
86100 SUB V1,N ; CALCULATE NEW . (OLD - DELETION)
86200 JUMPGE V1,EX$D1
86300 MOVE N,@E.P
86400 SETZ V1, ; (IF <N> > . THEN <N> GETS . AND . GETS 0)
86500 EX$D1: MOVEM V1,@E.P
86600 CALLR EXEBC ; DELETE TEXT
86700 CALLR EXAV ; (IMPLICIT V)
86800 JRST EXNEXT
86900 EX$D2: MOVE N,V1
87000 MOVE V1,@E.Z
87100 SUB V1,@E.P
87200 CAMLE N,V1
87300 MOVE N,V1 ; (IF <N> > Z-. THEN <N> GETS Z-.)
87400 CALLR EXEBC ; DELETE TEXT
87500 CALLR EXAV ; (IMPLICIT V)
87600 JRST EXNEXT
87700
87800 EX$E$: CALLR EXCHAR
87900 LETEST (E,HALT)
88000 LETEST (G,EX$EW)
88100 LETEST (N,EX$EN)
88200 LETEST (P,EX$EP)
88300 LETEST (R,EX$ER)
88400 LETEST (W,EX$EW)
88500 LETEST (X,EX$EW)
88600 JRST EXER03
88700
88800 EX$F$: CALLR EXCHAR
88900 LETEST (A,EX$FA)
89000 LETEST (B,EX$FB)
89100 LETEST (C,EX$FC)
89200 LETEST (D,EX$FD)
89300 LETEST (G,EX$FG)
89400 LETEST (I,EX$FI)
89500 LETEST (K,EX$FK)
89600 LETEST (M,EX$FM)
89700 LETEST (N,EX$FN)
89800 LETEST (O,EX$FO)
89900 LETEST (P,EX$FP)
90000 LETEST (Q,EX$FQ)
90100 LETEST (S,EX$FS)
90200 LETEST (T,EX$FT$)
90300 LETEST (V,EX$FV)
90400 LETEST (W,EX$FW)
90500 LETEST (X,EX$FP)
90600 LETEST (Z,EX$FZ)
90700 LETEST (/,EX$F%D)
90800 LETEST (*,EX$F%M)
90900 JRST EXER05
91000
91100 EX$G: TRNE FLAG,-1
91200 JRST EXER01
91300 A$QREG
91400 JUMPL FLAG,EXNEXT ; -- END PARSING
91500 SKIPG Q.Z(PTR)
91600 JRST EXER09
91700 CAMN PTR,E.B
91800 JRST EXER10
91900 EX$G0: MOVE N,@E.P
92000 MOVEM N,EX.I
92100 MOVE N,Q.Z(PTR) ; N GETS LENGTH OF QREG TEXT
92200 JUMPE N,EXNEXT
92300 CALLR ABORTI
92400 CALLR EXEBIS
92500 CALLR EXEBE ; EXPAND EB
92600 HRR M,Q.B(PTR)
92700 HRLI M,440700
92800 CALLR EXEBIT
92900 CALLR ABORTE
93000 CALLR EXAV ; (IMPLICIT V)
93100 JRST EXNEXT
93200
93300 EX$H: TRNE FLAG,-1
93400 JRST EXER02
93500 TRO FLAG,F$V1!F$V2
93600 SETZ V1,
93700 MOVE V2,@E.Z
93800 JRST EXNEXT
93900
94000 EX$I: TRNE FLAG,F$V!F$PC!F$O
94100 JRST EXER01
94200 A$STR <1>
94300 A$$END ; -- END PARSING
94400 MOVE N,@E.P
94500 MOVEM N,EX.I
94600 MOVE N,EX%S1N ; N GETS SIZE OF INSERT
94700 MOVE M,EX%S1P ; M POINTS TO INSERT TEXT
94800 JUMPE N,EXNEXT
94900 CALLR ABORTI
95000 CALLR EXEBIP
95100 CALLR EXEBE ; EXPAND EB
95200 CALLR EXEBIT
95300 CALLR ABORTE
95400 CALLR EXAV ; (IMPLICIT V)
95500 JRST EXNEXT
95600
95700 EX$J: TRNE FLAG,F$VC!F$V2!F$P!F$O
95800 JRST EXER01
95900 A$INT <0>
96000 A$$END ; -- END PARSING
96100 CAIGE V1,0 ; (IF <N> < 0 THEN . GETS 0)
96200 SETZ V1,
96300 CAMLE V1,@E.Z ; (IF <N> > Z THEN . GETS Z)
96400 MOVE V1,@E.Z
96500 MOVEM V1,@E.P ; SET .
96600 CALLR EXAV ; (IMPLICIT V)
96700 JRST EXNEXT
96800
96900 EX$K: TRNE FLAG,F$VC!F$PA!F$PS
97000 JRST EXER01
97100 A$INT <1>
97200 A$$END ; -- END PARSING
97300 CALLR EXLINE ; PRODUCE STARTING POSITION AND LENGTH
97400 EX$K0: JUMPE V2,EXNEXT
97500 MOVE M,@E.P
97600 MOVEM V1,@E.P
97700 MOVE N,V2
97800 CALLR EXEBC ; DELETE TEXT
97900 TRNN UTIL,F$V2
98000 JRST EX$K3 ; IF <N>K (LINE-BASED) THEN SKIP . CONCERNS
98100 MOVE N,V1
98200 ADD N,V2
98300 CAMGE M,V1
98400 JRST EX$K1
98500 CAMLE M,N
98600 JRST EX$K2
98700 JRST EX$K3 ; IF V1 <= . <= V1+V2 THEN . GETS V1
98800 EX$K1: MOVEM M,@E.P
98900 JRST EX$K3 ; IF . < V1 THEN . IS UNCHANGED
99000 EX$K2: SUB M,V2
99100 MOVEM M,@E.P ; IF V1+V2 < . THEN . GETS .-V2
99200 EX$K3: CALLR EXAV ; (IMPLICIT V)
99300 JRST EXNEXT
99400
99500 EX$L: TRNE FLAG,F$VC!F$V2!F$PA!F$PS
99600 JRST EXER01
99700 A$INT <1>
99800 A$$END ; -- END PARSING
99900 CALLR EXLINE ; PRODUCE STARTING POSITION AND LENGTH