plato:source:plaopl:answin
Table of Contents
ANSWIN
Table Of Contents
- [00088] LISTIN
- [00216] ANSWER COMMAND
- [00496] MATCH
- [00679] ANSWERC
- [00758] AUNAM
- [00829] -OR-
- [00936] -ANSWERA-/-WRONGA-
Source Code
- ANSWIN.txt
- ANSWIN
- * /--- FILE TYPE = E
- * /--- BLOCK ANSWIN 00 000 81/07/13 01.09
- *******PROBLEMS
- * AT LERRS...JUST GIVE ERROR MESSAGE, FORGET ABOUT
- * SHOWING EXACT CHARACTER...
- *
- *******
- IDENT ANSWIN
- LCC OVERLAY(1,1)
- *
- *
- CST
- *
- *
- ANSWIN$ OVFILE
- *
- *
- EXT CONTENT,GETOP,GETOPN IN FILE -CONTEN-
- EXT COMCONT CONTINUED COMMAND WORD
- EXT PUTCODE
- EXT PUTCOMP IN LEX
- EXT COMPILE IN LEX
- EXT ERRORC
- EXT GETLINE
- EXT NXTLINE
- EXT UNAMX
- EXT ECSPRTY
- EXT LNGUNIT IN CONDEN
- EXT ERRTAGS,ERRNAME,ERRSTOR
- EXT ERRXYTG,ERR2MNY,ERR2FEW
- EXT ERRTERM,ERRUARG,ERRVTYP
- EXT ERROUTR,ERRCNTD,ERRXORQ
- EXT ERRBAL
- EXT NOARG
- EXT ARHDA=
- EXT VARDO
- *
- *
- * /--- BLOCK START 00 000 79/05/12 05.29
- *
- *
- ANSWOV OVRLAY
- *
- *
- SA1 OVARG1 DETERMINE WHICH ENTRY POINT
- SB3 X1
- JP B3+*+1
- *
- + EQ LIS01
- + EQ ANS01
- + EQ MATCH01
- + EQ * WAS -CONTAIN-,-DISCARD,-CANT-
- + EQ ANSC01
- + EQ ORC01
- + EQ OKWRD01
- + EQ ANSA01
- *
- *
- *
- * HUMAN ENTITIES IN ANSWER COMMANDS ARE CODED BY TWO 60-BIT
- * WORDS...
- * FIRST WORD...
- * 0...0 FOR WORD, 1 FOR LIST
- * 1-3...NUMBER OF VOWELS
- * 4-7...NUMBER OF CONSONANTS
- * 8-59...CONTENT BITS
- * SECOND WORD...
- * 0...UNUSED
- * 1...0=WORD, 1=NUMBER
- * 2-16...WORD HASH, OR 2=SIGN BIT OF NUMBER
- * 17-22...FIRST LETTER
- * 23-25...NUMBER OF CONSONANT/VOWEL PAIRS
- * 26...CAPITALIZATION BIT
- * FOLLOWING ARE NOT SET BY CONTENT
- * 27...1=START OF A PHRASE
- * 28...1=MIDDLE OF A PHRASE
- * 29...1=END OF A PHRASE
- * 30-41...UNUSED IN ANSWER AT PRESENT
- * 42-49...UNUSED AT PRESENT
- * 50-59...WORD INFORMATION NUMBER
- * /--- BLOCK LISTIN 00 000 76/07/25 10.13
- PHRASE BSS 1 PHRASE FLAG
- PSTART VFD 27/0,1/1,22/0 PHRASE START BIT
- PMIDDLE VFD 28/0,1/1,21/0 MIDDLE WORD IN PHRASE
- PEND VFD 29/0,1/1,20/0 LAST WORD IN PHRASE
- *
- TITLE LISTIN
- *
- *
- * THIS ROUTINE STORES A LIST OF WORDS THAT CAN LATER BE
- * REFERENCED BY THE OTHER ANSWER COMMANDS. THE LIST IS STORED
- * AS A DUMMY UNIT. THE -ULOC- TABLE ENTRY HAS...
- * BIT 1 = 1 IF SOMETHING WENT WRONG AND LIST BAD
- * ELSE TOP 18 BITS = RELATIVE ADDRESS OF START OF LIST
- * NEXT 12 BITS = LENGTH OF LIST ( 2 WORDS PER ENTRY)
- *
- *
- *
- LIS01 MX3 0 CLEAR SPECIAL TERMINATOR FOR AUNAM
- SA1 PRETAG SET UP INPUT CHARACTER ADDRESS (-1)
- RJ AUNAM GO PUT LIST NAME IN UNAME TABLE
- *
- SA2 X6+ULOC NOW SEE THAT ULOC INDICATES FIRST TIME SEE
- PL X2,ERRORC TOP BIT SET MEANS NOT SEEN BEFORE
- SA6 WKWD STORE NUMBER TEMPORARILY
- *
- MX7 0
- SA7 WORK ZERO WORD COUNT
- SA7 PHRASE ZERO PHRASE FLAG
- ZR X1,LGET2Z SEE IF AT END OF LINE
- *
- LGET RJ CONTENT CONTENT THE WORDS
- *
- NZ X7,LGETA SEE IF ANYTHING THERE
- SA4 PHRASE ERROR IF BUILDING PHRASE
- ZR X4,LGET2
- EQ ERRORC
- *
- LGETA MX5 0
- SX3 X1-COPASTR SET UP PHRASE CONTINUE TEST
- SA4 PHRASE LOAD PHRASE FLAG
- NZ X4,LGET0 SEE IF ALREADY STARTED PHRASE
- *
- NZ X3,LGET1 NOT IN PHRASE, NOT STARTING ONE
- SA5 PSTART STARTING PHRASE
- MX4 1 SET -PHRASE- FLAG
- EQ LGET1
- *
- LGET0 NZ X3,LGET00 IN PHRASE, SEE IF PHRASE CONTINUES
- SA5 PMIDDLE IN MIDDLE OF PHRASE
- EQ LGET1
- *
- LGET00 SA5 PEND AT END OF PHRASE
- MX4 0 CLEAR PHRASE FLAG
- *
- LGET1 BX7 X7+X5 PUT IN ANY PHRASE BITS
- SA2 WORK GET CURRENT WORD COUNT
- SX3 X2-WORKLTH+2 DO OVERFLOW TEST
- PL X3,ERR2MNY
- * /--- BLOCK LISTIN 00 000 77/04/04 16.21
- *
- SA6 X2+WORK+1 STORE FIRST PART
- SA7 A6+1 STORE SECOND PART
- SX6 X2+2 INCREMENT
- SA6 A2 AND PUT BACK IN -WORK-
- BX6 X4
- SA6 A4 MAINTAIN -PHRASE- FLAG
- *
- LGET2 ZR X1,LGET2Z SEE IF END OF LINE
- SX2 X1-COPPER PERIOD SEPARATES LETTER-LIKES FROM PUNCS
- NG X2,LGET ANYTHING LESS OK TO CONTINUE
- EQ LERRS ALL ELSE AN ERROR
- *
- LGET2Z SA1 NEXTCOM SEE IF NEXT LINE A CONTINUATION
- SA2 COMCONT
- BX1 X1-X2
- NZ X1,LGET3 NON-ZERO MEANS FINISH UP
- RJ GETLINE ELSE GET NEXT LINE
- SA1 PRETAG INITIALIZE CHAR POINTER FOR CONTENT
- EQ LGET AND BACK TO CONTENT LOOP
- *
- LGET3 SA2 WORK GET LOC AND LENGTH OF LIST TO OUTPUT
- ZR X2,ERRNAME SEE IF SOMETHING THERE
- MX7 60-ULOC4 MAKE SURE IT WILL FIT IN FIELD
- BX7 X7*X2
- NZ X7,ERRNAME
- SA1 CONDPNT GET CURRENT READ-IN ECS POINTER
- BX0 X1 INTO X0
- IX7 X1+X2 ADD LENGTH TO START TO GET END
- SA4 CONBUFF ADDRESS OF START OF CONDENSE BUFFER
- SA3 CBLTH LENGTH OF BUFFER
- IX3 X4+X3 GET END OF BUFFER
- IX3 X7-X3
- PL X3,ERR2MNY SEE IF TOO BIG
- SA7 A1 UPDATE NEXT AVAILABLE PLACE TO CONDENSOR
- SB7 X2
- SA0 WORK+1 CM STARTING ADDRESS OF LIST
- + WE B7 WRITE OUT
- RJ ECSPRTY
- *
- IX6 X1-X4 BIAS TO UNIT
- LX6 ULOC2+ULOC3+ULOC4
- BX6 X6+X2 AND PUT IN TOTAL LENGTH
- LX6 60-ULOC1-ULOC2-ULOC3-ULOC4
- SA1 WKWD GET LOCATION OF LIST IN ULOC TABLE
- SA6 X1+ULOC SET ENTRY INTO ULOC TABLE
- EQ NXTLINE
- * /--- BLOCK LISTIN 00 000 76/07/31 18.26
- *
- LERRS SX6 A1 GIVE NON-FATAL ERROR MESSAGE FOR
- SA6 WORDPT BAD PUNCTUATION AT THIS TIME
- *
- * EVENTUALLY FORGET ABOUT SHOWING EXACT CHARACTER...
- * JUST MAKE SURE POINTER IS ON IT...AND APPROPRIATE
- * MESSAGE IS GIVEN...
- BX6 X1
- LX6 54
- SA6 SHOWOUT
- SX6 1
- SA6 NCHAR
- *
- SB1 907
- SB2 B0
- SX1 B0
- SA2 NCHAR
- SB3 SHOWOUT
- SB4 1
- RJ =XRJERRB
- LNORM SA1 WORDPT RESTORE A1
- SA1 X1
- EQ LGET CONTINUE
- *
- *
- * /--- BLOCK ANSEY 00 000 76/10/12 17.24
- TITLE ANSWER COMMAND
- *
- * THIS ROUTINE IS USED TO READ-IN -ANSWER- AND -WRONG-
- * COMMANDS. THE COMMAND WORD STARTS WITH A 6 BIT FIELD SET
- * ZERO IF SINGLE ANSWER OR 1 IF SYNONYMOUS ANSWER
- * THEN 18 BIT RELATIVE BIAS FROM START OF ECS RESIDENT
- * EXTRA STORAGE FOR THIS UNIT, THEN 12 BITS LENGTH.
- * THEN 12 BITS HIGHEST KEYWORD NUMBER, REST OF WORD HAS
- * COMMAND NUMBER.
- * IF A SYNONYMOUS SET OF ANSWERS...THEN THE TOP 4-BIT FIELD
- * IS SET...THE RELATIVE LOCATION + LENGTH THEN POINTS
- * TO THE NEXT INFO WORD IN THE BINARY...AD INFINITUM.
- * THE WORD ENTRIES REFER EITHER TO THE WORDS
- * DIRECTLY (TOP BIT = 0) IN WHICH CASE TWO 60-BIT WORDS ARE
- * USED...OR...TO A LIST CONTAINING THE WORDS (TOP BIT = 1) IN
- * WHICH CASE ONLY ONE 60-BIT WORD IS USED TO POINT TO THE LIST.
- * THIS POINTER WORD THEN HAS ... BIT 1 = 1, BITS 2-30 = UNIT NUM
- * IN EITHER CASE, THE BOTTOM 10 BITS CONTAIN 0=IGNORE WORD OR
- * N=COUNT OF KEYWORD (A RUN OF THE SAME N MEANS SYNONYMS)
- * PHRASES ARE POSSIBLE IN WHICH CASE THE START, MIDDLE,
- * AND END PHRASE BITS MAY BE SET.
- *
- *
- * /--- BLOCK ANSEY 00 000 76/07/25 10.14
- *
- *
- ANS01 SA1 PRETAG SET TO START OF CHARACTER STRING
- MX7 0
- SA7 ANTYPE SET TO ANSWER
- RJ ANSXXX
- EQ PUTCODE
- *
- *
- *
- * THE FOLLOWING IS USED BY THE ANSWER COMMAND (ANS01)
- * AND ANSWERC COMMAND (ANSC01), BOTH IN THIS OVERLAY
- *
- * A1 AND X1 ARE CHANGED ONLY BY CONTENT, AUNAM, AND GETOP WITHIN
- * THIS ROUTINE.
- *
- ANSXXX EQ *
- MX7 0
- SA7 SAFLAG NO SYNONYMOUS ANSWER YET
- *
- ATOP MX7 0 CLEAR WORD COUNTER
- SA7 WORK
- SA7 PHRASE NOT IN PHRASE
- SA7 ASFND NOT FOUND SYNONYMOUS ANSWER MARK
- SX6 1 INITIALIZE WORD TYPE TO KEYWORD COUNT
- SA6 KEYWDS
- SA6 WDTYPE
- SA6 ATYPE 0=IGNORE, +=KWD, -=SYN.KWD
- *
- ALOOP RJ CONTENT GET ANY WORD
- NZ X7,ALOOPA SEE IF ANYTHING THERE
- SA4 PHRASE ERROR IF BUILDING PHRASE
- ZR X4,ACK
- SB1 63 INCOMPLETE PHRASE
- EQ =XERR
- *
- ALOOPA MX5 0
- SX3 X1-COPASTR SET UP PHRASE CONTINUE TEST
- SA4 PHRASE LOAD PHRASE FLAG
- NZ X4,ALOO0 SEE IF ALREADY STARTED PHRASE
- *
- NZ X3,ALOOP1 NOT IN PHRASE, NOT STARTING ONE
- SA5 PSTART STARTING PHRASE
- MX4 1 SET -PHRASE- FLAG
- EQ ALOOP1
- *
- ALOO0 NZ X3,ALOO00 IN PHRASE, SEE IF PHRASE CONTINUES
- SA5 PMIDDLE IN MIDDLE OF PHRASE
- EQ ALOOP1
- *
- ALOO00 SA5 PEND AT END OF PHRASE
- MX4 0 CLEAR PHRASE FLAG
- *
- ALOOP1 BX7 X7+X5 ADD ANY PHRASE BITS
- SA5 WDTYPE GET WORD TYPE
- BX7 X5+X7 PUT INTO WORD INFORMATION FIELD
- *
- SA2 WORK CHECK FOR OVERFLOW
- SX3 X2-WORKLTH+2
- PL X3,ERR2MNY
- SA6 X2+WORK+1 SEND WORD OUT
- SA7 A6+1
- SX6 X2+2 INCREMENT WORD COUNT
- SA6 A2
- BX6 X4 MAINTAIN PHRASE FLAG
- SA6 A4
- * /--- BLOCK ANSEY 00 000 75/12/11 11.40
- *
- SA5 ATYPE GET WHERE IN ANSWER COMMAND
- ZR X5,ACK IF PROCESSING IGNORE WORDS
- NG X5,ACK IF PROCESSING SYNONYMS
- NZ X4,ACK SEE IF DOING PHRASE
- SA2 KEYWDS INCREMENT NUMBER OF KEYWORDS
- SX6 X2+1
- SA6 A2
- SA6 WDTYPE
- *
- ACK ZR X1,ADONE SEE IF END OF LINE
- SX2 X1-COPCOMA ANYTHING LESS IS LETTER/NUMBER
- NG X2,ALOOP
- *
- SA4 PHRASE PHRASES SHOULD NOT BE HERE
- NZ X4,ERRORC
- SA2 ATYPE GET WHERE IN ANSWER COMMAND
- ZR X2,IGN BRANCH OFF TO IGNORE WORDS
- NG X2,SYNK SYNONYMOUS KEYWORDS
- *
- SX3 X1-COPCOMA SEE IF SYNONYMOUS ANSWER FOLLOWS
- ZR X3,ADONES
- SX3 X1-COPSEMI SEE IF ANSWERC DELIMITER
- ZR X3,ANDONC
- *
- SX3 X1-COPLPRN SEE IF START OF SYNONYMS
- NZ X3,OTH ELSE SEE IF OTHER THINGS
- MX6 -1
- SA6 ATYPE SET TO SYN KEYWORDS
- EQ ALOOP
- *
- SYNK SX3 X1-COPCOMA SEE IF COMMA
- ZR X3,ALOOP COMMA OK IN SYN KEYWORDS
- SX3 X1-COPRPRN SEE IF DONE WITH SYN KEYWORDS
- NZ X3,SYNKK
- SA3 KEYWDS INCREMENT KEYWORD COUNT
- SX6 X3+1
- SA6 A3
- SA6 ATYPE
- SA6 WDTYPE
- EQ ALOOP
- SYNKK SX3 X1-COPLPRN SEE IF KEYWORD LIST ((LIST))
- NZ X3,ERRORC ALL ELSE ERROR
- SX3 COPRPRN SET UNAM END TEST
- EQ ALISTIN
- *
- OTH SX3 X1-COPLTH SEE IF <
- NZ X3,ERRORC ALL ELSE ERRORS
- MX6 0
- SA6 WDTYPE SET WORDTYPE TO IGNORE
- SA6 ATYPE
- EQ ALOOP
- *
- IGN SX3 X1-COPGTH SEE IF >
- NZ X3,IGN1
- SA4 KEYWDS SET BACK TO KEYWORDS
- BX6 X4
- SA6 WDTYPE
- SA6 ATYPE
- EQ ALOOP
- * /--- BLOCK ANSEY 00 000 76/07/25 10.16
- *
- IGN1 SX3 X1-COPCOMA SEE IF COMMA
- ZR X3,ALOOP COMMA OK IN EXTRA WORDS
- SX3 X1-COPLTH SEE IF EXTRA LIST <<LIST>>
- NZ X3,ERRORC ALL ELSE ERROR
- SX3 COPGTH SET UNAM END TEST
- *
- ALISTIN BX7 X3 SAVE X3 FOR POSSIBLE SECOND USE
- SA7 WKWD
- RJ AUNAM ADD TO UNAM TABLE (X3 HOLDS TERMINATOR)
- *
- LX6 30 UNIT NUMBER
- MX7 1 SET TO LIST WORD
- BX6 X6+X7
- SA2 WDTYPE ADD WORD TYPE
- BX6 X6+X2
- SA2 WORK GET CURRENT WORD COUNT
- SX3 X2-WORKLTH+1 DO OVERFLOW TEST
- PL X3,ERR2MNY
- SA6 X2+WORK+1 STORE AWAY LIST REFERENCE
- SX6 X2+1 INCREMENT
- SA6 A2 AND PUT BACK IN -WORK-
- *
- SA3 WKWD PRE-SET X3
- SX4 X1-COPCOMA CHECK FOR COMMA ((LISTX,LISTY))
- ZR X4,ALISTIN GO RIGHT ON TO NEXT LIST
- *
- BX4 X1-X3 SEE THAT NEXT CHARACTER EITHER > OR )
- ZR X4,ALOOP
- EQ ERRTERM
- *
- ADONE SA1 NEXTCOM SEE IF NEXT READ-IN LINE A CONTINUATION
- SA2 COMCONT
- BX1 X1-X2
- NZ X1,ADONE1
- RJ GETLINE GET NEXT CONTINUATION LINE
- SA1 PRETAG SET ADDRESS OF INPUT STRING FOR CONTENT
- EQ ALOOP BACK TO MAIN WORD INPUT LOOP
- *
- ANDONC SA5 ANTYPE MAKE SURE JUST ANSWERC
- ZR X5,ERRORC
- MX7 1
- SA7 ANCEND MARK END BY SEMICOLON
- EQ ADONE1
- * /--- BLOCK ANSEY 00 000 77/03/29 21.04
- *
- ADONES SX6 1 SET FLAG FOR SYN ANSWER FOLLOWS
- SA6 ASFND
- *
- ADONE1 SA2 ATYPE MUST NOT BE IN IGNORE, SYN, OR PHRASE
- ZR X2,ERRORC
- NG X2,ERRORC
- SA2 PHRASE
- NZ X2,ERRORC
- *
- SA2 WORK GET LOC AND LENGTH OF LIST TO OUTPUT
- MX7 48 MAKE SURE WILL FIT IN 12 BITS
- BX7 X7*X2
- NZ X7,ERRORC
- *
- SA3 ECSARGS GET NUMBER OF ECS ARGS ALREADY
- IX7 X3+X2 ADD IN MORE
- SX4 X7-ECSRESL+1 SEE THAT BUFFER DOES NOT OVERFLOW
- * THE +1 IS FOR -ASYNC- FOLLOWING
- PL X4,LNGUNIT
- SA7 A3 UPDATE NEW NUMBER OF ECS ARGS
- SA5 ECSRESB GET START OF ECS BUFFER
- IX0 X5+X3 GET PLACE TO ADD MORE ARGS
- SB7 X2
- SA0 WORK+1 CM STARTING ADDRESS OF LIST
- + WE B7 WRITE OUT
- RJ ECSPRTY
- *
- LX3 12 GET REL LOC OF ECS ARGS IN PLACE
- BX6 X3+X2 PUT TOGETHER WITH LENGTH
- LX6 12
- SA5 KEYWDS PUT IN NUMBER OF KEYWORDS
- SX5 X5-1
- BX6 X5+X6
- LX6 12
- *
- SA5 ASFND SEE IF SYNONYMOUS ANSWER FOLLOWING
- NZ X5,ASYNA
- SA5 SAFLAG SEE IF A PREVIOUS SYNONYMOUS ANSWER
- ZR X5,ANSXXX EXIT TO CALLING ROUTINE
- SA6 A0 IF PREVIOUS, MUST PUT OUT COMMAND INFO
- SA2 SAHOLE IN HOLE LEFT IN ECS
- BX0 X2
- + WE 1
- RJ ECSPRTY
- BX6 X5 AND GET FIRST ANSWER INFO
- EQ ANSXXX TO ADD COMMAND CODE AND STORE
- *
- ASYNA LX5 54 SET SYNONYMOUS ANSWER BIT
- BX6 X6+X5
- SA5 SAFLAG SYNONYMOUS ANSWER, SEE IF THIS FIRST
- NZ X5,ASYNB
- SA6 A5 STORE AWAY FIRST FOR FINAL EXIT
- EQ ASYNC
- *
- ASYNB SA6 A0 NOW PUT INFO FOR THIS ANSWER INTO
- SA2 SAHOLE ECS HOLE PREVIOUSLY MADE
- BX0 X2
- + WE 1
- RJ ECSPRTY
- *
- ASYNC SA2 ECSARGS OPEN UP HOLE IN ECS
- SX7 X2+1 OVERFLOW TEST DONE ALREADY
- SA7 A2
- SA3 ECSRESB AND SAVE ADDRESS OF ECS HOLE
- IX7 X2+X3
- SA7 SAHOLE
- EQ ATOP AND ONTO NEXT SYNONYMOUS ANSWER
- *
- * /--- BLOCK ANSEY 00 000 75/10/16 22.39
- *
- *
- WDTYPE BSS 1 CURRENT WORD TYPE
- KEYWDS BSS 1 NUMBER OF KEYWORDS
- ATYPE BSS 1 0=IGNORE, 1=KEYWORD, -1=SYN KEYWORD
- WKWD BSS 1
- SAFLAG BSS 1 HOLDS FIRST OF SYN ANSWERS AS FLAG
- SAHOLE BSS 1 ECS ADDRESS OF HOLE FOR CURRENT SYN ANSWER
- ASFND BSS 1 FLAG THAT SYNONYMOUS ANSWER FOLLOWS
- ANTYPE BSS 1 0=ANSWER, -1=ANSWERC
- *
- * /--- BLOCK MATCH 00 000 78/06/13 13.53
- *
- TITLE MATCH
- * THIS ROUTINE IS USED TO READ-IN -MATCH- COMMANDS.
- * CURRENTLY IT IS SIMILAR TO ANSWER READ-IN.
- * COMMAND WORD HAS TOP XCODEL BITS WITH GETVAR CODE
- * THEN 18 BITS ADDRESS RELATIVE TO START OF ECS RESIDENT
- * EXTRA STORAGE FOR THIS UNIT
- * THEN 12 BITS LENGTH OF ENTRIES
- *
- *
- MATCH01 CALL PUTCOMP DECODE VARIABLE
- LX1 60-XCODEL POSITION -GETVAR- CODE AT TOP
- BX6 X1
- SA6 MAFLAG STORE AWAY FOR NOW
- *
- MX7 0 CLEAR WORD COUNTER
- SA7 WORK
- SA7 PHRASE NOT IN PHRASE
- SX6 1 INITIALIZE WORD TYPE TO KEYWORD COUNT
- SA6 KEYWDS +=KEYWORD, -=SYNONYMOUS KEYWORDS
- SA6 WDTYPE SET TO FIRST MATCH ENTRY
- *
- SA2 LASTKEY
- ZR X2,MDONE SEE IF AT END OF LINE ALREADY
- SA1 WORDPT X1 = ADDRESS OF CHARACTER AFTER SEPARATOR
- SA1 X1-1 SET ADDRESS OF INPUT STRING FOR CONTENT
- BX6 X1
- SA6 PREPUNC INITIALIZE PREVIOUS STOPER
- * /--- BLOCK MATCH 00 000 78/06/13 13.52
- *
- *
- MLOOP RJ CONTENT GET ANY WORD
- NZ X7,MLOOPA SEE IF ANYTHING THERE
- SA4 PHRASE ERROR IF BUILDING PHRASE
- NZ X4,ERRORC
- SA2 PREPUNC WHAT WAS PREVIOUS STOPER
- SX2 X2-COPCOMA
- NZ X2,MCK SEE IF WAS A COMMA
- SX2 X1-COPCOMA THEN SEE IF THIS ANOTHER COMMA
- ZR X2,MCK0 IF SO, MAYBE ADVANCE KEYWORD
- EQ MCK COUNT
- *
- MLOOPA MX5 0
- SX3 X1-COPASTR SET UP PHRASE CONTINUE TEST
- SA4 PHRASE LOAD PHRASE FLAG
- NZ X4,MLOO1 SEE IF ALREADY STARTED PHRASE
- *
- NZ X3,MLOOP1 NOT IN PHRASE, NOT STARTING ONE
- SA5 PSTART STARTING PHRASE
- MX4 1 SET -PHRASE- FLAG
- EQ MLOOP1
- *
- MLOO1 NZ X3,MLOO2 IN PHRASE, SEE IF PHRASE CONTINUES
- SA5 PMIDDLE IN MIDDLE OF PHRASE
- EQ MLOOP1
- *
- MLOO2 SA5 PEND AT END OF PHRASE
- MX4 0 CLEAR PHRASE FLAG
- *
- MLOOP1 BX7 X7+X5 ADD ANY PHRASE BITS
- SA5 WDTYPE GET WORD TYPE
- BX7 X5+X7 PUT INTO WORD INFORMATION FIELD
- *
- SA2 WORK CHECK FOR OVERFLOW
- SX3 X2-WORKLTH+2
- PL X3,ERR2MNY
- SA6 X2+WORK+1 SEND WORD OUT
- SA7 A6+1
- SX6 X2+2 INCREMENT WORD COUNT
- SA6 A2
- BX6 X4 MAINTAIN PHRASE FLAG
- SA6 A4
- *
- NZ X4,MCK SEE IF DOING PHRASE
- MCK0 SA5 KEYWDS SEE IF SINGLE WORD OR SYNONYMS
- NG X5,MCK IF PROCESSING SYNONYMS
- SA2 KEYWDS INCREMENT NUMBER OF KEYWORDS
- SX6 X2+1
- SA6 A2
- SA6 WDTYPE
- * /--- BLOCK MATCH 00 000 78/06/13 13.43
- *
- MCK ZR X1,MDONE SEE IF END OF LINE
- *
- BX6 X1 SAVE THIS ENDING PUNCTUATION
- SA6 PREPUNC FOR LATER TESTING
- *
- SX2 X1-COPCOMA ANYTHING LESS IS LETTER/NUMBER
- NG X2,MLOOP
- *
- SA4 PHRASE PHRASES SHOULD NOT BE HERE
- NZ X4,ERRORC
- *
- ZR X2,MLOOP ALLOW COMMA
- *
- SA2 KEYWDS SEE IF SINGLE OR SYNONYMS
- NG X2,MSYNK SYNONYMOUS KEYWORDS
- *
- SX3 X1-COPLPRN SEE IF START OF SYNONYMS
- NZ X3,ERRORC ALL ELSE ERROR
- BX6 -X2 MAKE NEGATIVE
- SA6 A2 RESTORE IN KEYWDS
- EQ MLOOP
- *
- MSYNK SX3 X1-COPRPRN SEE IF DONE WITH SYN KEYWORDS
- NZ X3,MSYNKK
- SA3 KEYWDS INCREMENT KEYWORD COUNT
- BX6 -X2 MAKE POSITIVE AGAIN
- SX6 X6+1 INCREMENT COUNT
- SA6 A2 RESTORE IN KEYWDS
- SA6 WDTYPE
- EQ MLOOP
- MSYNKK SX3 X1-COPLPRN SEE IF KEYWORD LIST ((LIST))
- NZ X3,ERRORC ALL ELSE ERROR
- * /--- BLOCK MATCH 00 000 78/06/13 13.44
- MLISTIN SX3 COPRPRN SET UNAM END TEST
- RJ AUNAM ADD TO UNAM TABLE (X3 HOLDS TERMINATOR)
- *
- *
- LX6 30 UNIT NUMBER
- MX7 1 SET TO LIST WORD
- BX6 X6+X7
- SA2 WDTYPE ADD WORD TYPE
- BX6 X6+X2
- SA2 WORK GET CURRENT WORD COUNT
- SX3 X2-WORKLTH+1 DO OVERFLOW TEST
- PL X3,ERR2MNY
- SA6 X2+WORK+1 STORE AWAY LIST REFERENCE
- SX6 X2+1 INCREMENT
- SA6 A2 AND PUT BACK IN -WORK-
- *
- SX3 X1-COPCOMA CHECK FOR COMMA ((LISTX,LISTY))
- ZR X3,MLISTIN GO ON TO NEXT LIST
- *
- SX3 X1-COPRPRN MAKE SURE END CHARACTER WAS )
- ZR X3,MLOOP
- EQ ERRTERM
- *
- MDONE SA1 NEXTCOM SEE IF NEXT READ-IN LINE A CONTINUATION
- SA2 COMCONT
- BX1 X1-X2
- NZ X1,MDONE1
- *
- SX6 COPCOMA END OF LINE ALWAYS LIKE COMMA
- SA6 PREPUNC
- *
- RJ GETLINE GET NEXT CONTINUATION LINE
- SA1 PRETAG SET ADDRESS OF INPUT STRING FOR CONTENT
- EQ MLOOP BACK TO MAIN WORD INPUT LOOP
- * /--- BLOCK MATCH 00 000 78/06/13 13.40
- *
- MDONE1 SA2 KEYWDS MUST NOT BE IN SYNONYMS
- NG X2,ERRORC
- SA2 PHRASE
- NZ X2,ERRORC
- *
- SA2 WORK GET LOC AND LENGTH OF LIST TO OUTPUT
- ZR X2,ERRNAME MUST BE SOMETHING THERE
- MX7 48 MAKE SURE WILL FIT IN 12 BITS
- BX7 X7*X2
- NZ X7,ERRORC
- *
- SA3 ECSARGS GET NUMBER OF ECS ARGS ALREADY
- IX7 X3+X2 ADD THESE ADDITIONAL ONES
- SX4 X7-ECSRESL SEE THAT NO BUFFER OVERFLOW
- PL X4,LNGUNIT
- SA7 A3 UPDATE NUMBER OF ECS ARGS
- SA4 ECSRESB GET ADDRESS OF ECS BUFFER
- IX0 X4+X3 GET LOCATION TO ADD NEW STUFF
- SB7 X2
- SA0 WORK+1 CM BUFFER
- + WE B7 WRITE OUT
- RJ ECSPRTY
- *
- LX3 12 GET REL LOC OF ECS ARGS IN PLACE
- BX6 X3+X2 PUT TOGETHER WITH LENGTH
- LX6 60-XCODEL-18-12
- SA3 MAFLAG
- BX6 X3+X6 ADD GETVAR CODE
- EQ PUTCODE EXIT TO ADD COMMAND CODE AND STORE
- *
- MAFLAG BSS 1 HOLDS GETVAR CODE
- PREPUNC BSS 1 HOLDS PREVIOUS PUNCTUATION
- * /--- BLOCK ANSWERC 00 000 78/08/18 12.09
- TITLE ANSWERC
- *
- * READ-IN ANSWERC COMMAND
- * PRODUCE A COMMAND WORD THAT CONTAINS
- * 1. A GETVAR CODE
- * 2. A RELATIVE POINTER TO TABLE OF ANS COMMANDS IN EXTRA STO
- * 3. THE NUMBER OF ANSWER COMMANDS IN TABLE
- *
- * THE ANSWER COMMANDS ARE CODED EXACTLY AS EXPLAINED AT ANS01
- * THE NULL CASE (;;) IS CODED BY A COMPLETELY ZERO ANS COMMAND
- *
- *
- ANSC01 MX7 1 SET FLAG TO ANSWERC
- SA7 ANTYPE
- CALL COMPILE GET CONDITION INTO COMPILED CODE
- LX1 60-XCODEL
- BX6 X1
- SA6 MAFLAG SAVE GETVAR CODE FOR LATER
- SA1 WORDPT
- SA1 X1-1 SET UP ADDRESS FOR CONTENT
- *
- SA2 INX SAVE STARTING EXTRA STORAGE
- BX6 X2
- SA6 INXST
- *
- SX2 X1-1R; SEMICOLON OK HERE
- ZR X2,ANSC02
- *
- SX2 X1-1R, OR UNIVERSAL DELIMITER ^,
- NZ X2,ERRTERM WHICH IS ACCESS-COMMA
- SX2 A1
- SA2 X2-1
- SX2 X2-ACCESS
- NZ X2,ERRTERM NOTHING ELSE ALLOWED
- *
- * /--- BLOCK ANSWERC 00 000 78/08/18 12.12
- *
- ANSC02 MX7 0 WILL COME BACK ZERO WHEN TOTALLY DONE
- SA7 ANCEND
- *
- RJ GETOPN GET NEXT OP...LOOK FOR NULL CASE (;;)
- SX2 B3-COPSEMI
- NZ X2,ANSC03 IF NOT, ONTO NEXT ANSWER
- RJ GETOP ADVANCE OVER ;
- MX6 1 NEGATIVE COMMAND IS NULL CASE
- SA6 ANCEND ALSO SET FLAG TO INDICATE NOT DONE
- EQ ANSC04 AND STORE ZERO FOR THIS CASE
- *
- ANSC03 RJ ANSXXX COMPILE THE NEXT ANSWER COMMAND
- *
- ANSC04 SA4 INX GET CURRENT EXTRA STORAGE LOC
- SX7 X4+1 INCREMENT
- SA2 ICX
- IX2 X7-X2 TEST FOR BUFFER OVERFLOW
- PL X2,LNGUNIT
- SA7 A4 UPDATE INX
- *
- SA6 INFO+X4 STORE AWAY ANSWER COMMAND INFO
- *
- SA4 ANCEND SEE IF ALL DONE
- NZ X4,ANSC02
- *
- ANSC05 SA1 MAFLAG GET GETVAR CODE
- SA2 INXST GET STARTING RELATIVE POINTER TO TABLE
- SA3 INX GET ENDING POINTER
- IX3 X3-X2 CALCULATE LENGTH
- LX2 24
- LX3 12
- BX6 X1+X2 PACK UP ALL THE GOODIES INTO COMMAND WORD
- BX6 X6+X3
- *
- *
- *
- EQ PUTCODE NOW STORE AWAY COMMAND
- *
- *
- ANCEND BSS 1 0 IF ALL DONE
- INXST BSS 1 START OF EXTRA STORAGE AREA
- * /--- BLOCK UNAM 00 000 79/03/21 02.49
- TITLE AUNAM
- *
- * INPUT...
- * A1 HOLDS ADDRESS OF INPUT CHARACTER STRING (-1)
- * X3 HOLDS SPECIAL ENDING CHARACTER...) OR >
- *
- * OUTPUT...
- * A1 HOLDS ADDRESS OF LAST CHARACTER USED
- * X1 HOLDS LAST OPERATION CODE
- * X6 HOLDS UNIT NUMBER ASSIGNED
- *
- AUNAM EQ * MAKE UP NAME FOR USE IN UNAM TABLE
- * ONLY NAME STARTING WITH A SPACE
- * X3 SET TO SPECIAL ENDING MARK
- SB1 42 ONLY ALLOW 7 CHARS, WILL PUT SPACE AT START
- MX6 0
- *
- VUN SB3 A1 SAVE CURRENT CHARACTER ADDRESS
- RJ GETOP GET NEXT OPERATION CODE
- SX0 B2-COPSP SEE IF LEADING SPACE
- ZR X0,VUN LOOP TO CLEAN OFF LEADING SPACES
- *
- VULOOP ZR B2,VUMADE SEE IF END OF LINE
- SX0 B2-COPCOMA SEE IF COMMA
- ZR X0,VUMADE
- SX0 B2-COPSP SEE IF SPACE
- ZR X0,VUMADE
- SX0 B2
- IX0 X0-X3 TEST FOR SPECIAL END MARK
- ZR X0,VUMADE
- *
- VUMAKE SB1 B1-6 DECREMENT SHIFT COUNT
- NG B1,ERRNAME SEE THAT NOT OVER 7 6-BIT CODES
- SB3 B3+1 NOW GET 6-BIT CHARACTERS NEEDED
- SA2 B3
- LX0 B1,X2 SHIFT TO CORRECT POSITION
- BX6 X6+X0 ADD TO NAME-A-BUILDING
- SX2 A1-B3
- NZ X2,VUMAKE LOOP FOR CHARACTERS OF MORE THAN 6-BITS
- *
- * B3 = A1 NOW BY NECESSITY
- RJ GETOP GET NEXT OP CODE FROM CONTENT
- EQ VULOOP
- *
- VUMADE ZR X6,ERRNAME SEE IF NOTHING THERE
- *
- SX0 1R PUT A SPACE AT START OF THIS WORD
- LX0 42
- BX6 X6+X0 ONLY UNAM ENTRY STARTING WITH SPACE
- *
- SX7 B2 SAVE LAST OPERATION CODE
- LX7 30
- SX2 A1 SAVE LAST CHARACTER ADDRESS
- BX7 X2+X7
- SA7 SAVIT
- SX7 A1 AND SAVE ADDRESS FOR ERROR EXIT IN UNAMX
- SA7 WORDPT
- *
- * NAME STARTS WITH SPACE
- RJ UNAMX CALL WITH NAME IN X6
- * RETURN WITH UNIT NUMBER IN X6
- *
- SA2 SAVIT RESTORE CHAR ADDRESS AND LAST OP
- SA1 X2
- LX2 30
- SX1 X2
- EQ AUNAM
- *
- SAVIT BSS 1
- *
- * /--- BLOCK OR 00 000 82/07/13 17.16
- TITLE -OR-
- * -OR- (CODE=135)
- *
- * THE COMMAND IS LEGAL ONLY WHEN FOLLOWED BY
- * AN ANSWER TYPE COMMAND.
- *
- * THIS COMMAND DOES NO CHECKS TO SEE IF THE PREVIOUS
- * COMMAND IS ALSO A JUDGING COMMAND, WHICH IS THE
- * COMMON USAGE. 'THIS ALLOWS THE SEQUENCE OF A
- * JUDGING COMMAND FOLLOWED BY REGULAR COMMANDS
- * FOLLOWED BY AN -OR- FOLLOWED BY A JUDGING COMMAND
- * AND MORE REGULAR COMMANDS. 'IF THE SECOND JUDGING
- * COMMAND IS MATCHED, ONLY THE REGULAR COMMANDS
- * FOLLOWING IT ARE EXECUTED, WHILE IF THE FIRST
- * ONE IS MATCHED, BOTH SETS OF REGULAR COMMANDS
- * ARE EXECUTED.
- *
- ORC01 SA1 NEXTCOM WHAT IS THE NEXT COMMAND
- BX7 X1
- SA7 ORSTOP PUT IT AT THE END OF THE LIST
- SA2 ORLIST-1 READY TO SCAN LIST
- SB1 1
- *
- ORSCAN SA2 A2+B1 READ NEXT ITEM OF LIST
- BX2 X2-X1 COMPARE WITH NEXT COMMAND
- NZ X2,ORSCAN
- *
- SX2 A2-ORSTOP SEE IF HIT END OF LIST
- NZ X2,NOARG JUMP IF OK
- EQ ERRNAME FLAG ANY ERROR
- *
- * LIST OF ANSWER TYPE COMMANDS
- *
- ORLIST VFD 60/8LANSWER
- VFD 60/8LANSWERC
- VFD 60/8LWRONG
- VFD 60/8LWRONGC
- VFD 60/8LCONCEPT
- VFD 60/8LMISCON
- VFD 60/8LMATCH
- VFD 60/8LANSV
- VFD 60/8LWRONGV
- VFD 60/8LOK
- VFD 60/8LNO
- VFD 60/8LIGNORE
- VFD 60/8LEXACT
- VFD 60/8LEXACTC
- VFD 60/8LEXACTV
- VFD 60/8LANSU
- VFD 60/8LWRONGU
- VFD 60/8LTOUCH
- VFD 60/8LTOUCHW
- VFD 60/8LNTOUCH
- VFD 60/8LNTOUCHW
- VFD 60/8LANSWERA
- VFD 60/8LWRONGA
- ORSTOP BSSZ 1
- * /--- BLOCK OKWORD 00 000 81/07/08 03.04
- *
- *
- * -OKWORD- (CODE=223)
- * -NOWORD- (CODE=224)
- * -ARHEADA-
- *
- * UP TO 9 CHARACTERS SPECIFYING WORD TO WRITE
- * FOR -OK- (-NO-) JUDGMENTS.
- *
- * UP TO 5 CHARACTERS SPECIFYING WORD TO WRITE
- * FOR -ARHEADA-
- *
- OKWRD01 SA1 TAGCNT NUMBER OF CHARS
- SB3 X1 SAVE FOR END TEST
- MX6 0 PRE-SET FOR NO CHAR CASE
- ZR X1,OKWRDC2 JUMP IF NO CHARS
- SX2 X1-10
- PL X2,ERRNAME --- ERROR EXIT IF OVER 9 CHARS
- SB2 0
- SA1 COMNUM
- SX3 ARHDA=
- IX1 X1-X3 CHECK FOR SPECIAL ARHEADA CASE
- NZ X1,OKWORD0 IF NOT ARHEADA
- SX1 B3-6
- PL X1,ERRNAME --- ERROR EXIT IF OVER 5 CHARS
- EQ OKWRDC1
- OKWORD0 SA1 TAG CHECK FOR RIGHT MARGIN OPS
- LX1 6
- SA2 TAG+1
- BX1 X1+X2
- SX1 X1-KUP*100B-1R0
- SX6 1R START WITH SPACE CODE
- NZ X1,OKWRDC1 IF NORMAL OKWORD
- SX1 KUP*100B+1R1 CHANGE TO LEFT
- LX1 6
- BX6 X1+X6
- SB2 2 AND SKIP IN TAG FIELD
- OKWRDC1 SA1 TAG+B2
- LX6 6
- BX6 X6+X1
- SB2 B2+1
- LT B2,B3,OKWRDC1
- OKWRDC2 SA2 INX
- SA6 INFO+X2 STORE WORD IN EXTRA STORAGE
- SX7 X2+1 INCREMENT EXTRA STORAGE POINTER
- SA7 A2
- BX6 X2
- LX6 XCMNDL POSITION POINTER
- EQ PUTCODE --- EXIT TO ADD COMMAND CODE AND STORE
- TITLE -ANSWERA-/-WRONGA-
- EJECT
- *
- * -ANSWERA-/-WRONGA- COMMAND CONDENSE.
- *
- * COMMAND FORMAT';
- * 20/ADDRESS IN ECS ARGS OF INFORMATION WORD
- * 28/0
- * 12/COMMAND NUMBER
- *
- * ECS ARGUMENTS INFORMATION WORD';
- * 20/BIAS INTO ECS ARGS OF ANSWERA BUFFER
- * 20/GETVAR CODE FOR STORED STRING
- * 20/GETVAR CODE FOR NUMBER OF CHARACTERS TO READ
- *
- * USES A1,A3,A5,A7
- * X1,X3,X4,X5,X6,X7
- *
- * CALLS VARDO
- *
- TEMPARG BSS 1 BRIEFLY HOLDS ECS ARGUMENT
- ARGADD BSS 1 SAVES ECS ARGUMENT OFFSET
- *
- ANSA01 BSS 0
- SA3 ECSARGS GET CURRENT NUMBER OF ECS ARGS
- BX7 X3 CURRENT NUMBER
- SA7 ARGADD SAVE FOR LATER
- * /--- BLOCK OKWORD 00 000 81/07/08 03.04
- SX7 X7+1 ADD 1 FOR COMMAND EXTRA WORD
- SX4 X7-ECSRESL-1 CHECK FOR BUFFER OVERFLOW
- PL X4,LNGUNIT UNIT TOO LONG
- SA7 ECSARGS STORE NEW NUMBER OF ARGUMENTS
- SA4 ANSABUF SEE IF ALLOCATED
- PL X4,ANSAVAR X4 = BUFFER ARGUMENT BASE ADDR
- SA7 A4 STORE OFFSET INTO ECS ARGS
- SX3 MAXLONG BUFFER MAX LENGTH
- IX7 X7+X3 ADD TO CURRENT NUMBER OF ARGS
- SX3 X7-ECSRESL-1 CHECK FOR BUFFER OVERFLOW
- PL X3,LNGUNIT UNIT TOO LONG
- SA7 ECSARGS STORE NEW NUMBER OF ARGUMENTS
- ANSAVAR RJ VARDO COMMA SEPARATED VARIABLES
- SA1 VARBUF+1 PICK UP FIRST GETVAR CODE
- NG X1,ERRSTOR MUST BE STOREABLE
- MX0 61-XCODEL+XFBIT MASK OUT I/F BIT
- BX1 -X0*X1 X1 = FIRST ARG GETVAR CODE
- SA3 VARBUF GET NUMBER OF ARGUMENTS
- SX3 X3-1 CHECK NUMBER OF ARGS
- SX2 10 GETVAR CODE FOR 10 CHARACTERS
- ZR X3,ANSAPUT BRANCH IF ONLY ONE ARGUMENT
- SX3 X3-1 CHECK FOR TOO MANY ARGS
- NZ X3,ERR2MNY
- SA2 VARBUF+2 X2 = SECOND ARG GETVAR CODE
- MX0 -XCODEL MASK TO *XCODEL* BITS
- BX2 -X0*X2 TO GET RID OF POSSIBLE LITERAL FLAG
- ANSAPUT SA4 ANSABUF ECS ARG BUFFER BASE ADDRESS
- LX4 2*XCODEL ECS BUFFER LOCATION
- LX1 XCODEL STRING GETVAR CODE
- BX6 X4+X1 FORM PARTIAL ECS ARG
- BX6 X6+X2 ADD ^$ CHARS CODE, COMPLETE ARG
- SA6 TEMPARG STORE TEMPORARILY
- SA3 ECSRESB ECS RESIDENT ARGS ADDRESS
- SA5 ARGADD ECS WORD OFFSET
- IX0 X3+X5 FORM INFO WORD ECS ADDRESS
- SA0 A6 TEMPORARY WORD ADDRESS
- LX5 2*XCODEL MOVE ECS ARG ADDRESS
- BX6 X5 FORM PARTIAL COMMAND WORD
- + WE 1 WRITE ECS ARGUMENT
- RJ ECSPRTY
- SA0 WORK WORK BUFFER
- SA1 AZERBUF ECS ZERO BUFFER
- SX0 X1 ADDRESS
- + RE MAXLONG FOR FUTURE CLEAR ECS BUFFER
- RJ ECSPRTY
- SA0 WORK ZEROED WORK BUFFER
- SA4 ANSABUF START OF ECS BUFFER
- * /--- BLOCK OKWORD 00 000 81/07/08 03.04
- IX0 X3+X4
- + WE MAXLONG CLEAR ECS BUFFER
- RJ ECSPRTY
- EQ PUTCODE FINISH COMMAND WORD
- *
- *
- * /--- BLOCK END 00 000 79/05/12 05.28
- *
- *
- *
- ENDOV
- *
- *
- OVTABLE
- *
- *
- END ANSWIN$
plato/source/plaopl/answin.txt ยท Last modified: 2023/08/05 18:54 by Site Administrator