Table of Contents

COMPILE

Table Of Contents

  • [00005] COMPILE TUTOR CALC COMPILER
  • [00082] COMMENTS
  • [00239] COMPCOM – ENTRY POINT FOR -COMPUTE-
  • [00279] CONTCOM – ENTRY POINT FOR CONTINUED CALCS
  • [00295] COMPNAM – ALLOW UNDEFINED SYMBOLS
  • [00309] COMPSYM – ALLOW SPECIAL DEFINED SYMBOLS
  • [00332] PUTCOMP – GENERATE CODE TO STORE VALUE
  • [00351] PCOMP1 – FORCE COMPILED CODE FOR PUTCOMP
  • [00372] GCOMP – ENTRY POINT FOR -GOTO- AND -DO-
  • [00409] QUIKCMP – ENTRY POINT FOR LIKELY LITERALS
  • [00500] COMPILU – ENTRY POINT FOR -ANSU- ARGUMENT
  • [00527] COMPILE – MAIN ENTRY POINT TO COMPILER
  • [00628] COMPNAM
  • [00717] COMPIL – MAIN LOOP FOR COMPILER
  • [00837] NEED PARENTHESES
  • [00929] MINUS, PLUS, ISDEGR, ISPI, ENDINST
  • [01027] SEGMENT AND ARRAY
  • [01221] ISEOL, ADS, UNITS, FORCE, OPJUMP
  • [01429] OPJUMP
  • [01522] ADD, SUB, MULT, DIVIDE
  • [01794] ARRAY MULTIPLICATION
  • [02035] ENDLINE – END OF EXPRESSION PROCESSING
  • [02231] COMPILE LOGICAL EXPRESSIONS
  • [02290] FUNCTIONS AND SYSTEM VARIABLES
  • [02711] INDEXED VARIABLES
  • [02933] SEGMENT INDEXING
  • [03054] GENERATE CODE FOR CONSTANT INDEX CASE
  • [03152] GENERATE CODE TO LOAD VERTICAL SEGMENT
  • [03184] GENERATE CODE FOR CONSTANT VERTICAL SEGMENT
  • [03242] SEGPUT
  • [03259] ARRAY/COMPLEX INDEXING
  • [03287] ARRAY PROCESSING
  • [03363] ARRAY PROCESSING
  • [03436] UNARY OPS
  • [03513] EXPONENTIATION
  • [03713] ASSIGNMENT OPERATION
  • [03966] ARRAY ASSIGNMENT OPERATION
  • [04105] PREBIN – DETERMINE TYPES OF OPERANDS
  • [04142] FLTBOTH – FLOAT BOTH OPERANDS
  • [04163] BINARY – PLACE 2 OPERANDS IN REGISTERS
  • [04277] TMPAD – FORMS ARRAYWORD/AD FOR *TMPARY*
  • [04314] SIZCHK – CHECKS ARRAYS FOR CONFORMALITY
  • [04341] GETARAD
  • [04360] LDAINTR – CODE TO TEST FOR ARRAY INTERRUPT
  • [04383] ARYPREP
  • [04408] LDAINIT
  • [04424] LDASUB
  • [04437] CALCTMP
  • [04503] STORTMP
  • [04545] SVAOPAD
  • [04559] LDARRAY – LOAD ARRAY/SCALAR OPERANDS
  • [04603] LBINARY – PREPARE ARGUMENTS FOR SHIFTING
  • [04794] MATVS
  • [04831] GETINDX – GET INTEGER INDEX
  • [04857] LOADIND – LOAD INDEX TO X(B1)
  • [04877] POPNADS – BACKUP NADS POINTER
  • [04894] ROW/COLUMN BOUNDS CHECKING
  • [04950] FCCHK – CHECK TYPE OF GETVAR CODE
  • [04987] FUNCTIONS (FROM GETVAR)
  • [05108] GENERATE A READ INSTRUCTION
  • [05267] VREAD – CODE TO READ VERTICAL SEGMENTS
  • [05319] VSTORE
  • [05363] VSINDX – CODE TO LOAD SEGMENT INFO WORD
  • [05463] LDLITAD – CODE TO GET ADDRESS OF INFO WORD
  • [05483] GENFCT – GENERATE CODE TO CALL FUNCTION
  • [05528] SETAD – MARK *ADS* ENTRY NOW IN REGISTER
  • [05545] FLOATIT – SET UP FLOAT INSTRUCTIONS
  • [05568] INDXFLT – GENERATE CODE TO ROUND INDEX
  • [05602] FORCEX – READ ADTYPE TO SPECIFIED REGISTER
  • [05654] CHEKRR – CHECK READ REGISTER AVAILABLE
  • [05700] PICKX – PICK A RESULT REGISTER
  • [05737] CHOOSEX – CHOOSE A VACANT REGISTER
  • [05778] STR7TMP – CODE TO STORE X7 IN TEMPORARY
  • [05812] RLLIT – RETRIEVE LONG LITERAL
  • [05863] SLLIT – STORE LONG LITERAL
  • [05893] FREEX – FREE UP A REGISTER
  • [05907] LSEEK – SEARCH FOR EXISTING LITERALS
  • [05953] MOVE CODE
  • [05993] PAD OUT INSTRUCTION WORD WITH NO-OPS
  • [06032] ADD SHORT INSTRUCTION TO STREAM
  • [06101] ADD LONG INSTRUCTION TO STREAM
  • [06136] STORAGE DEFINITIONS

Source Code

COMPILE.txt
  1. COMPILE
  2. * /--- FILE TYPE = E
  3. * /--- BLOCK COMPILE 00 000 79/11/13 23.15
  4. IDENT COMPILE
  5. TITLE COMPILE TUTOR CALC COMPILER
  6. *
  7. CST COMMON SYMBOL TABLE
  8. *
  9. EXT LEXADD ADDRESS OF LEX HOOK
  10. EXT KEYTYPE LEXICAL KEY LOOKUP ARRAY
  11. *
  12. * ERROR HANDLING ROUTINES
  13. *
  14. EXT CHARERR,BADPAR,VARERR
  15. EXT FORMERR,EQERR,TEMPERR
  16. EXT ALFERR,INDXERR,SEGERR
  17. EXT VARTERR,OPTERR,ASIGERR
  18. EXT COMPERR,LNGERR,LITERR
  19. EXT UNITERR,MATERR,CPXERR
  20. EXT TSTERR,NOAERR,SIZERR
  21. EXT MNYAERR,MINDERR
  22. EXT FIPERR
  23. *
  24. SYMLST SET 2
  25. *
  26. *********************************************************
  27. * KNOWN BUGS--
  28. * (1) CANNOT SUPERSCRIPT CAPITAL LETTERS USING
  29. * THE NON-LOCKING SUPERSCRIPT. LOCKING
  30. * SUPERSCRIPT DOES PERMIT CAPITAL LETTERS
  31. * IN THE EXPONENT.
  32. * 'RELATED PROBLEM IS THAT SUB-SUP-SUP IS NOT THE
  33. * SAME AS SUP...
  34. * 'WOULD BE NICE FOR KG. TO BE TAKEN AS KG'.
  35. * (2) SEARCH FOR LITERAL ALREADY IN UNIT MAY FIND
  36. * BRANCH-TABLE ENTRY WHICH WILL BE MODIFIED
  37. * LATER....IN WHICH CASE -CALC- USES WRONG LIT.
  38. * (3) CANNOT USE MATRIX(I,J) AS A FUNCTION ARGUMENT.
  39. * ALSO CANNOT SAY ',V+10&3', IF V IS A VECTOR.
  40. * (4) B',C', NEEDS IMPLIED MULTIPLY.
  41. *
  42. * QUIKNUM (2A), CHARSET/RESTART TAGS (2D), COMMA SEPARATOR
  43. * IN MATRICES (3F), AND FLOATING-POINT NUMBER INTERPRETING
  44. * (15E,F,G,16B,C) ALL USE ',1R'X', WHERE THEY SHOULD BE
  45. * USING (PERHAPS'.) SOME OPCODE COMPARISONS.....
  46. *********************************************************
  47. * /--- BLOCK PLATO 00 000 81/07/27 21.52
  48. * POINTERS TO EXEC ROUTINES - DEFINED HERE FOR PLATO
  49. * PASSED TO THE CONDENSOR THROUGH ECS
  50. *
  51. IFPLT PLATO
  52. *
  53. EXT ERXINDX ERROR EXIT, -GETVAR-
  54. EXT ALEXLOC
  55. EXT SEGMNTI,SEGMNTO,ALOOPS
  56. EXT VECEL,MATEL,VECO,MATO
  57. EXT ASVARS,ACVARS,ARVARS,ALVARS,AWVARS
  58. INSTLNG EQU INFOLTH-ARAYLTH-2 COMPILE INST BUFF LGTH (500-258)
  59. *
  60. ENTRY LLAERR,LLSEGI,LLSEGO
  61. ENTRY LLVECEL,LLMATEL,LLVECO,LLMATO
  62. ENTRY LLALOOP,RVARL,LVARN
  63. *
  64. LLEXLOC EQU ALEXLOC
  65. LLAERR VFD 60/ERXINDX
  66. LLSEGI VFD 60/SEGMNTI
  67. LLSEGO VFD 60/SEGMNTO
  68. LLVECEL VFD 60/VECEL
  69. LLMATEL VFD 60/MATEL
  70. LLVECO VFD 60/VECO
  71. LLMATO VFD 60/MATO
  72. LLALOOP VFD 60/ALOOPS
  73. RVARL VFD 60/RVARLIM
  74. LVARN VFD 60/0
  75. *
  76. LIST X
  77. *CALL LEXTXT
  78. LIST *
  79. *
  80. IFPLT ENDIF
  81. * /--- BLOCK COMMENTS 00 000 78/12/21 18.18
  82. TITLE COMMENTS
  83. *
  84. *WRITTEN BY BRUCE SHERWOOD 1971
  85. *SEGMENTS BY DAVE ANDERSEN 1972
  86. *ARRAYS BY DON SHIRER 1974
  87. *
  88. *COMPILES 6400 MACHINE CODE FROM AN INPUT SOURCE LINE.
  89. ****RETURNS MACHINE CODE IN INFO ARRAY
  90. ****AND GETVAR CODE IN X1.
  91. ****B1 RETURNED 0 IF OK TO STORE INTO EXPRESSION.
  92. *
  93. *THESE ROUTINES USE A0-A4, A6-A7, X0-X7, B1-B3.
  94. *
  95. *THE GENERATED MACHINE CODE USES X0-X7, A1,A2,A6,A7.
  96. *B1 IS USED FOR INLINE SHIFT OPERATIONS.
  97. *OUT-OF-LINE FUNCTIONS (FILES -GETVAR- AND -TFUNCT-)
  98. *USE MANY REGISTERS BUT SAVE AND RESTORE THE ABOVE
  99. *REGISTERS, AS WELL AS B3, WHICH HOLDS THE RETURN
  100. *ADDRESS FROM THE CALC---JP B3 TERMINATES THE CALC.
  101. *
  102. *
  103. *THE COMPILATION PROCEDURE IS ESSENTIALLY AS DESCRIBED IN
  104. *CHAPTER 8 OF -THE ANATOMY OF A COMPILER-,
  105. *BY JOHN A. N. LEE.
  106. ***A MODIFICATION OF THIS SCHEME IS THAT
  107. *EACH OPERATOR HAS TWO DIFFERENT
  108. *PRECEDENCE LEVELS--ONE WHEN IN HAND
  109. *AND ONE WHEN IN THE STACK. THIS IS
  110. *DUE TO A SUGGESTION OF LOUIS
  111. *STEINBERG, AND VASTLY SIMPLIFIES
  112. *UNARY MINUS AND MULTIPLE ASSIGNMENTS.
  113. *
  114. *
  115. *COMPILE CALLS LEX FOR THE NEXT LEXICAL
  116. *ITEM IN A ONE-PASS COMPILATION. LEX
  117. *RETURNS IN OP THE OPERATOR NUMBER
  118. *OR AN OPERAND IN ADTYPE, AS A GETVAR
  119. *CODE. THIS CODE CONSISTS OF A BIT
  120. *TO SPECIFY MODE (0 I, 1 F), A 3-BIT
  121. *TYPE CODE -- 0 SHORT LITERAL, 1 LONG
  122. *LITERAL, 2 STUDENT BANK, 3 COMMON,
  123. *4 CALC -- , AND XCODEAL=14 BITS OF
  124. *ADDRESS.
  125. *TYPE 4 IS NEVER RETURNED
  126. *BY LEX BUT IS USED INTERNALLY BY
  127. *COMPILE TO FLAG A COMPUTED INDEXED
  128. *ADDRESS.
  129. *WITH TYPE 4 (CALC) THE ADDRESS+B5 IS THE BEGINNING
  130. *ADDRESS OF THE CALC IN -EXTRA STORAGE-.
  131. *OPERANDS ALREADY IN REGISTERS APPEAR
  132. *
  133. * /--- BLOCK COMMENTS 00 000 78/12/21 18.18
  134. *IN THE ADS LIST AS (SIGN BIT, I/F BIT
  135. *IN USUAL POSITION, REGISTER NUMBER IN
  136. *BOTTOM OF WORD). IF OPERAND CODE IS
  137. *NEGATIVE, OPERAND IS IN REGISTER.
  138. *
  139. * LITERALS ARE SAVED IN *LITS* BY *LEX* IF IMMEDIATE (IE';
  140. * '74.5'7 IN '7N1_4.5'7) AND THE 22ND BIT OF THEIR ADTYPES
  141. * ARE SET TO DISTINGUISH THEM FROM LITERALS WHOSE ADTYPES
  142. * POINT INTO *TOKBUF*. AT CODE GENERATION TIME, LITERALS
  143. * ARE RETRIEVED FROM EITHER *LITS* OR *TOKBUF* AND ARE
  144. * PLANTED IN THE *INFO* BUFFER BY *LSEEK* WHICH ELIMINATES
  145. * DUPLICATE LITERALS TO SAVE ON UNIT BINARY SPACE. LITERALS
  146. * ARE STORED EITHER AS I OR F, WHICH EVER IS MORE EFFICIENT.
  147. * FOR EXAMPLE, 3.00 AND 3 ARE TREATED IDENTICALLY.
  148. *
  149. *
  150. *VARIABLE NAMES MUST NOT START WITH A NUMBER.
  151. *EXPRESSIONS SUCH AS 45.3ALFA OR 34(-X)(3+X) ARE LEGAL.
  152. *THE ONLY PLACE WHERE AN EXPLICIT MULTIPLICATION SIGN
  153. *IS REQUIRED IS IN 3X*Y, WHERE X AND Y ARE DEFINED
  154. *VARIABLES. HOWEVER, IN STUDENT MODE (STORE, ANSV) EVEN
  155. *THIS IS ALLOWED--- 3XY IS TAKEN AS 3*X*Y IF THERE IS NO
  156. *VARIABLE XY . ALSO, ALTHO AUTHORS MUST USE PARENS
  157. *AROUND FUNCTION ARGUMENTS -- SIN(3X) --, STUDENTS CAN
  158. *WRITE -- SIN3X -- . STUDENTS MAY REFER TO DEFINED
  159. *VARIABLES, BUT V(INDEX) IS TAKEN TO MEAN V*(INDEX).
  160. *
  161. *OTHER SPECIAL FEATURES INCLUDE ---
  162. *MULTIPLE ASSIGNMENT - X_3+Y_7+(Z_12)-W_34 .
  163. *RELATIONAL OPERATORS - <,>,=,^<,^>,^= FOR
  164. * $LT$,$GT$,$EQ$,$LE$,$GE$,$NE$
  165. *TRUTH VALUE = -1 , FALSE VALUE = 0.
  166. *COMBINE RELATIONS WITH $AND$ AND $OR$ WHICH GIVE -1 OR 0.
  167. *PARENTHESES - ^[ AND [ EQUIVALENT TO (
  168. * ^] AND ] EQUIVALENT TO )
  169. *^P IS PI, ^O IS PI/180 -- SIN(45^O) IS SIN(.785) .
  170. *MIXED MODE OK, WITH N1_V2_34.7 LEAVING V2=34.7, N1=35.
  171. * NOTE ROUNDING WHEN SETTING AN INTEGER VARIABLE.
  172. *BIT OPERATIONS - $UNION$,$MASK$,$DIFF$,$ARS$,$CLS$ .
  173. * (ARS IS ARITHMETIC RIGHT SHIFT, CLS IS CIR. LEFT SHIFT)
  174. *SUPERSCRIPTS (LOCKING AND NON-LOCKING) INDICATE
  175. * EXPONENTIATION. FOR INTEGER LITERAL EXPONENTS
  176. * BETWEEN -63 AND +63 THE MULTIPLIES ARE CODED
  177. * IN LINE RATHER THAN AS CALL TO EXPONENTIATION ROUTINE.
  178. *
  179. *
  180. *
  181. * /--- BLOCK COMMENTS 00 000 78/06/20 22.15
  182. *
  183. * ARRAYS ARE HANDLED AS FOLLOWS...
  184. *
  185. * ARRAYS AND ARRAY ELEMENTS BOTH HAVE GETVAR CODE=6
  186. *
  187. * AN ARAYWORD IS STUCK IN EXTRA STORAGE DESCRIBING TYPE
  188. * AND SIZE OF EACH ARRAY USED IN A UNIT
  189. * THERE ARE 2 OF THESE WORDS IF ARRAY IS SEGMENTED OR
  190. * BASE IS REDEFINED
  191. * DESCRIPTIONS OF THESE ARRAY INFO WORDS ARE IN DEFINE,
  192. * BLOCK *ARRAY*
  193. *
  194. * ARRAY ELEMENTS ARE CONVERTED TO REGULAR SCALARS IN
  195. * CONDENSOR IF HAVE LITERAL ARGUMENTS, IF NOT, COMPILATION
  196. * IS FORCED TO EVALUATE INDICES THRU SUBROUTINES
  197. * (VECEL, MATEL) AT EXECUTION TIME.
  198. * 'IN THIS CASE, CODE IS GENERATED TO SET B1 TO POINT TO
  199. * THE ARRAY DESCRIPTOR WORD (B5+N), X3 TO THE ROW, AND
  200. * X4 TO THE COLUMN.
  201. *
  202. * WHOLE ARRAYS ARE MARKED WHEN ENCOUNTERED BY SETTING
  203. * BIT 58 IN OPERAND ADTYPE
  204. *
  205. * IF ANY WHOLE ARRAY IS ENCOUNTERED IN INITIAL LEXICAL
  206. * PASS, SEARCH FOR ARRAY OPERATIONS IS TURNED ON
  207. *
  208. * ELEMENT-BY-ELEMENT ARRAY OPERATIONS, INCLUDING MOST
  209. * BINARY OPERATIONS AND ASSIGNMENT USE STANDARD SCALAR
  210. * CODE GENERATORS, BUT CODE IS PREFACED BY CALL TO -AINIT-
  211. * AND FOLLOWED BY CALL TO -ALOOPS-...THESE EXECUTION
  212. * ROUTINES DO THE INDEX LOOPING AND EXITS
  213. *
  214. * ALL WHOLE ARRAY OPERATION RESULTS ARE PUT INTO TEMPORARY
  215. * STORAGE AT TOP OF *WORK* BEFORE ASSIGNMENT OPERATION
  216. * IS CALLED, SO YOU CAN DO THINGS LIKE CALC V_V*V.
  217. *
  218. * ASSIGNMENTS REQUIRING NO I/F CONVERSION COULD BE SPEEDED
  219. * UP IN FUTURE BY USING ECS TRANSFER OPERATIONS
  220. *
  221. * ARRAYS ARE CHECKED FOR TYPE AND CONFORMALITY WHEN
  222. * OPERATION IS ENCOUNTERED, ARRAY ELEMENTS ARE CHECKED
  223. * FOR IN-BOUNDS WHEN EVALUATED
  224. *
  225. * MANY NON-STANDARD EXTENSIONS OF MATRIX OPERATIONS ARE
  226. * INCLUDED TO MAKE THESE USEFUL TO WIDER AUDIENCE
  227. *
  228. * THE DEFINE STRUCTURE INCLUDES PROVISIONS FOR FUTURE
  229. * COMPLEX, SEGMENTED, OR 3-DIMENSIONAL ARRAYS, BUT
  230. * MACHINERY HAS NOT YET BEEN INCLUDED FOR THESE IN EITHER
  231. * THE CONDENSOR OR THE EXECUTOR
  232. * THEY NOW GIVE CONDENSE ERROR MESSAGES
  233. *
  234. * MORE ON ARRAY USAGE AND FUTURE PLANS IN LESSON -ARRAY-
  235. *
  236. *
  237. * /--- BLOCK COMPCOM 00 000 79/12/04 07.03
  238. PLATO
  239. TITLE COMPCOM -- ENTRY POINT FOR -COMPUTE-
  240. PUTCOMP BSS 1 TO SATISFY REFERENCES
  241. COMPNAM BSS 1 TO SATISFY REFERENCES
  242. *
  243. ENTRY COMPCOM
  244. COMPCOM EQ * SPECIAL ENTRY POINT FOR COMPUTE COMMAND
  245. SA1 COMPCOM
  246. BX6 X1
  247. MX7 0
  248. SA6 COMPILE
  249. SX6 1 FLAG THAT CODE MUST BE GENERATED
  250. SA6 COMPALL EVEN FOR SIMPLE VARIABLE REF.
  251. SA7 COMPNAM
  252. SA7 CSYMADD NO -COMPSYM- SYMBOL TABLE
  253. SA7 PUTCOMP NOT A -PUTCOMP- CALL
  254. MX7 1
  255. LX7 -OKASIGN SET OKASSIGN BIT
  256. SA7 COMSPEC THIS CELL USED TO CHECK SPECS
  257. SX7 -2 NO UNIT DIMENSION STUFF
  258. SA7 NUNITS
  259. EQ CMPCOM2
  260. *
  261. * QCMPCOM IS THE ENTRY POINT FOR THE 3-ARG -COMPUTE-
  262. *
  263. ENTRY QCMPCOM
  264. QCMPCOM EQ *
  265. SA1 QCMPCOM
  266. MX7 1
  267. LX7 -OKASIGN SET OKASSIGN BIT
  268. SA7 COMSPEC CELL CHECKED FOR SPECS VALUES
  269. BX6 X1
  270. SA6 QUIKCMP PLANT EQ FOR RETURN
  271. SX6 -2
  272. SA6 NUNITS NO UNIT DIMENSIONS ALLOWED
  273. EQ QUIK2 JUMP INTO QUIKCMP
  274. *
  275. ENDIF
  276. *
  277. * /--- BLOCK CONTCOM 00 000 78/01/25 15.08
  278. CONDEN
  279. TITLE CONTCOM -- ENTRY POINT FOR CONTINUED CALCS
  280. * CONTCOM IS THE ENTRY POINT FOR CONTINUED CALC
  281. *
  282. ENTRY CONTCOM
  283. CONTCOM EQ *
  284. SA1 CONTCOM LOAD UP RJ WORD
  285. BX6 X1
  286. SA6 COMPILE TRANSFER IT
  287. SX6 1 FLAG THAT THIS IS A CALC COMMAND
  288. SA6 CALC
  289. MX7 0
  290. SA7 COMPNAM
  291. SA7 PUTCOMP NOT A -PUTCOMP- CALL
  292. SA7 CSYMADD NO -COMPSYM- SYMBOL TABLE
  293. EQ COMPIL2
  294. *
  295. TITLE COMPNAM -- ALLOW UNDEFINED SYMBOLS
  296. *
  297. * -COMPNAM- IS A SPECIAL ENTRY POINT USED BY
  298. * COMMANDS SUCH AS -MICRO- AND -CHARSET- WHERE
  299. * THE AUTHOR MAY WISH TO ENTER AN UNDEFINED NAME
  300. * AS THE ARGUMENT
  301. *
  302. ENTRY COMPNAM
  303. COMPNAM BSSZ 1
  304. SA1 COMPNAM SAVE RJ ADDRESS
  305. BX6 X1
  306. SA6 COMPILE
  307. EQ CMPLX
  308. *
  309. TITLE COMPSYM -- ALLOW SPECIAL DEFINED SYMBOLS
  310. *
  311. * -COMPSYM- IS A SPECIAL ENTRY USED BY COMMANDS
  312. * THAT WISH TO ALLOW SPECIAL SYMBOLS ...SUCH AS
  313. * -SLIDE NOSLIDE-
  314. *
  315. *
  316. ENTRY COMPSYM
  317. COMPSYM EQ *
  318. SA1 COMPSYM PLANT RETURN ADDRESS
  319. BX6 X1
  320. SX7 B1 ADDRESS OF SYMBOL TABLE
  321. SA6 COMPILE
  322. SA7 CSYMADD
  323. SX6 B2 NUMBER OF SYMBOL(S)
  324. SA6 CSYMNUM
  325. MX7 0
  326. SA7 COMPNAM
  327. SA7 COMPALL SET NO COMPILE OF SIMPLE VAR OR LIT
  328. SA7 PUTCOMP NOT A -PUTCOMP- CALL
  329. EQ CMPCOM2
  330. *
  331. * /--- BLOCK PUTCOMP 00 000 78/01/25 15.14
  332. TITLE PUTCOMP -- GENERATE CODE TO STORE VALUE
  333. *
  334. * -PUTCOMP- SPECIAL ENTRY TO GENERATE CODE
  335. * TO STORE THE QUANTITY IN X6
  336. *
  337. ENTRY PUTCOMP
  338. PUTCOMP EQ *
  339. SA1 PUTCOMP FIX UP ENTRY POINT
  340. BX6 X1
  341. MX7 1
  342. SA6 COMPILE
  343. SA7 RSULTX1 DONT NEED RESULT IN X1
  344. MX7 0
  345. SA7 CALC NOT A CALC
  346. SA7 COMPALL
  347. SA7 COMPNAM
  348. SA7 CSYMADD NO -COMPSYM- SYMBOL TABLE
  349. EQ CMPCOM3
  350. *
  351. TITLE PCOMP1 -- FORCE COMPILED CODE FOR PUTCOMP
  352. *
  353. * SAME AS -PUTCOMP- EXCEPT THAT COMPILED CODE IS
  354. * PRODUCED EVEN FOR SIMPLE VARIABLE REFERENCES
  355. *
  356. ENTRY PCOMP1
  357. PCOMP1 EQ *
  358. SA1 PCOMP1 FIX UP ENTRY POINT
  359. BX6 X1
  360. MX7 1
  361. SA6 COMPILE
  362. SA6 PUTCOMP MARK AS -PUTCOMP- CALL
  363. SA7 RSULTX1 DONT NEED RESULT IN X1
  364. SA7 COMPALL MUST ALWAYS COMPILE CODE
  365. SA7 CMOVFLG DONT MOVE CODE TO EXTRA STORAGE
  366. MX7 0
  367. SA7 CALC NOT A CALC
  368. SA7 COMPNAM
  369. SA7 CSYMADD NO -COMPSYM- SYMBOL TABLE
  370. EQ COMPIL2
  371. *
  372. TITLE GCOMP -- ENTRY POINT FOR -GOTO- AND -DO-
  373. *
  374. * SPECIAL DRIVER FOR -COMPILE- USED BY GOTO AND DO
  375. *
  376. *
  377. ENTRY GCOMP
  378. GCOMP EQ *
  379. SA1 GCOMP
  380. BX6 X1 PLANT RETURN ADDRESS
  381. SA6 COMPILE
  382. RJ GCOMP0
  383. EQ CMPCOM4 DECODE EXPRESSION
  384. *
  385. *
  386. ENTRY GCOMP1
  387. GCOMP1 EQ *
  388. SA1 GCOMP1 SET UP EXIT ADDRESS
  389. BX6 X1
  390. SA6 COMPILE
  391. RJ GCOMP0
  392. EQ COMPIL2 LEAVE *NINST* ALONE
  393. *
  394. *
  395. GCOMP0 EQ *
  396. SX6 1 ALWAYS COMPILED CODE
  397. SA6 COMPALL
  398. SA6 CMOVFLG DONT MOVE CODE TO EXTRA STORAGE
  399. MX7 0
  400. SA7 COMPNAM NOT A -COMPNAM- CALL
  401. SA7 CSYMADD NO -COMPSYM- SYMBOL TABLE
  402. SA7 PUTCOMP
  403. SA7 RSULTX1 LEAVE RESULT IN X1
  404. SA7 CALC NOT A -CALC- COMMAND
  405. EQ GCOMP0
  406. *
  407. ENDIF
  408. * /--- BLOCK QUIKCMP 00 000 79/12/05 01.16
  409. TITLE QUIKCMP -- ENTRY POINT FOR LIKELY LITERALS
  410. *
  411. *
  412. * -QUIKCMP-
  413. * SPECIAL ENTRY FOR CASES WHERE THE INPUT IS LIKELY
  414. * TO BE A LITERAL
  415. *
  416. *
  417. ENTRY QUIKCMP
  418. QUIKCMP EQ *
  419. PLATO
  420. SA1 TSPECS PULL IN -SPECS- BITS
  421. BX6 X1
  422. SA6 COMSPEC COPY TO CELL CHECKED BY COMPILE
  423. ENDIF
  424. QUIK2 SA1 WORDPT POINTER TO FIRST CHARACTER
  425. SA1 X1
  426. SA2 X1+KEYTYPE
  427. ZR X2,QUIKNUM JUMP IF FIRST CHARACTER NUMERIC
  428. *
  429. PLATO
  430. QCOMP SA1 QUIKCMP
  431. BX6 X1
  432. SA6 COMPILE PLANT RETURN
  433. EQ CMPCOM1 ENTER COMPILE AFTER COMSPEC SET
  434. ENDIF
  435. CONDEN
  436. QCOMP RJ COMPILE DO NORMAL COMPILE CALL
  437. EQ QUIKCMP AND RETURN
  438. ENDIF
  439. * /--- BLOCK QUIKCMP 00 000 78/12/18 21.00
  440. *
  441. * PROCESS NUMERIC CONSTANT
  442. *
  443. QUIKNUM SX0 X1-1R. CHECK FOR DECIMAL POINT
  444. ZR X0,QCOMP
  445. SX6 X1-1R0 SAVE FIRST NUMBER
  446. MX7 12 MASK FOR 48 BIT CHECK
  447. SB2 3
  448. *
  449. QNLP SA1 A1+1 LOAD NEXT CHARACTER
  450. SA2 X1+KEYTYPE
  451. NZ X2,QUIKN10 JUMP IF NOT NUMERIC
  452. SX0 X1-1R.
  453. ZR X0,QCOMP EXIT IF DECIMAL POINT
  454. LX4 X6,B2 MULTIPLY BY 8
  455. LX6 1 MULTIPLY BY 2
  456. IX6 X4+X6 MULTIPLY BY 10
  457. SX1 X1-1R0 CONVERT CHARACTER TO NUMERIC
  458. IX6 X1+X6
  459. BX1 X7*X6 SEE IF OVER 48 BITS LONG
  460. ZR X1,QNLP
  461. EQ QCOMP EXIT IF OVER 48 BITS
  462. *
  463. QUIKN10 BX7 X1 SAVE LAST CHARACTER
  464. SA7 LASTKEY
  465. ZR X1,QUIKN20 JUMP IF END-OF-LINE
  466. SX0 X2-OPCOMMA
  467. NZ X0,QCOMP EXIT IF NOT COMMA
  468. SX7 A1+1
  469. SA7 WORDPT UPDATE *WORDPT*
  470. EQ QUIKN25
  471. *
  472. QUIKN20 SX7 A1 POINTER TO LAST CHARACTER
  473. SA7 WORDPT UPDATE *WORDPT*
  474. *
  475. QUIKN25 SB1 1 MARK NOT STOREABLE
  476. MX0 -XCODEAL CHECK FOR 14 BIT LITERAL
  477. BX1 X0*X6
  478. NZ X1,QUIKN30 JUMP IF LONG LITERAL
  479. BX1 -X0*X6 SET UP -GETVAR- CODE
  480. EQ QUIKN90
  481. *
  482. QUIKN30 SA1 INX GET XSTOR POINTER
  483. SA6 X1+INFO STORE LONG LITERAL
  484. SX6 X1+1
  485. SA6 A1 UPDATE *INX*
  486. SX6 1 1 = GETVAR TYPE FOR LONG LIT
  487. LX6 XCODEAL
  488. BX1 X1+X6 LONG INTEGER LITERAL
  489. *
  490. QUIKN90 MX6 0
  491. SA6 TOPCNT CLEAR *OPCNT*
  492. SA6 TVARCNT CLEAR *VARCNT*
  493. SA2 NUNITS CHECK FOR UNIT DIMENSIONS WANTED
  494. SX2 X2+1
  495. NG X2,QUIKCMP JUMP IF NO UNIT DIM WANTED
  496. ZERO UADS,NUMAX MUST CLEAR *UADS*
  497. EQ QUIKCMP RETURN
  498. * /--- BLOCK COMPILU 00 000 78/01/25 15.39
  499. CONDEN
  500. TITLE COMPILU -- ENTRY POINT FOR -ANSU- ARGUMENT
  501. ENTRY COMPILU
  502. *
  503. * ENTRY POINT FOR CONDENSING FIRST ARG OF -ANSU- COMMAND
  504. *
  505. COMPILU EQ *
  506. SA1 COMPILU
  507. BX6 X1
  508. MX7 0
  509. SA6 COMPILE
  510. SA7 COMPNAM
  511. SA7 COMPALL SET NO COMPILE OF SIMPLE VAR OR LIT
  512. SA7 CSYMADD NO -COMPSYM- SYMBOL TABLE
  513. SA7 PUTCOMP NOT A -PUTCOMP- CALL
  514. SA7 RSULTX1 SET TO LEAVE RESULT IN X1
  515. SA7 CALC FLAG THAT THIS IS NOT A CALC COMMAND
  516. SA7 CMOVFLG SET TO MOVE CODE TO XTRA STOR AT END OF LIN
  517. SX6 INST
  518. SA6 NINST INSTRUCTION STREAM POINTER
  519. SA7 X6 CLEAR FIRST INSTRUCTION WORD
  520. SX7 X6+INSTLNG
  521. SA7 NINSTLIM LIMIT ON ADVANCE OF NINST
  522. SX7 -1 ALLOW UNITS
  523. SA7 NUNITS
  524. EQ COMPIL2B
  525. ENDIF
  526. * /--- BLOCK COMPILE 00 000 79/12/05 01.15
  527. TITLE COMPILE -- MAIN ENTRY POINT TO COMPILER
  528. *
  529. * -COMPILE-
  530. *
  531. * PARSES EXPRESSION AT CURRENT POSITION IN THE
  532. * INPUT LINE AND RETURNS A GETVAR CODE FOR THE
  533. * RESULTING COMPILED CODE.
  534. *
  535. *
  536. ENTRY COMPILE
  537. COMPILE EQ *
  538. PLATO
  539. SA1 TSPECS PICK UP -SPECS- BITS
  540. BX7 X1
  541. SA7 COMSPEC AND PUT THEM HERE
  542. ENDIF
  543. CMPCOM1 MX7 0
  544. SA7 COMPNAM
  545. CMPLX MX7 0
  546. SA7 COMPALL SET NO COMPILE OF SIMPLE VAR OR LIT
  547. SA7 CSYMADD NO -COMPSYM- SYMBOL TABLE
  548. SA7 PUTCOMP NOT A -PUTCOMP- CALL
  549. CMPCOM2 MX7 0
  550. SA7 RSULTX1 SET TO LEAVE RESULT IN X1
  551. SA7 CALC FLAG THAT THIS IS NOT A CALC COMMAND
  552. *
  553. CMPCOM3 SA7 CMOVFLG SET TO MOVE CODE TO XTRA STOR AT END OF LIN
  554. *
  555. CONDEN
  556. CMPCOM4 SX6 INST
  557. ENDIF
  558. PLATO
  559. CMPCOM4 SX6 INFO+INFOX COMPILE CODE INTO INFO BUFFER
  560. * (OFFSET INFOX TO LEAVE ROOM FOR LITERALS)
  561. ENDIF
  562. *
  563. SA6 NINST INSTRUCTION STREAM POINTER
  564. MX7 0
  565. SA7 X6 CLEAR FIRST INSTRUCTION WORD
  566. SX7 X6+INSTLNG
  567. SA7 NINSTLIM LIMIT ON ADVANCE OF NINST
  568. CONDEN
  569. COMPIL2 SX7 -2 SUPPRESS UNIT DIMENSION STUFF
  570. SA7 NUNITS -1 TO USE COMPILE DIMENSIONS, -2 SUPPRESSES
  571. ENDIF
  572. COMPIL2B BSS 0
  573. * USEFUL FOR DEBUGGING
  574. * DMADBUG CONDEN
  575. * SA1 AZERBUF
  576. * BX0 X1
  577. * SA0 SHARE
  578. *+ RE ADSMAX ZERO OUT ADS BUFFER
  579. * RJ ECSPRTY
  580. * DMADBUG ENDIF
  581. * /--- BLOCK COMPILE 00 000 78/06/06 21.50
  582. MX7 0 CLEAR COMPILE VARIABLES
  583. SA7 TVARCNT COUNT NUMBER OF VARIABLE REFERENCES
  584. SA7 VSKMODE SET -VSEEK- MODE
  585. SA7 INHAND
  586. SA7 PREVOPL
  587. SA7 ADS
  588. SA7 OPSL
  589. SA7 RX CLEAR REGISTER RESERVATIONS
  590. SA7 RX+1
  591. SA7 RX+2
  592. SA7 RX+3
  593. SA7 RX+4
  594. SA7 RX+5
  595. SA7 RX+6
  596. SA7 RX+7
  597. SA7 NADS
  598. SA7 TEMP FLAG NO TEMPORARY STORAGE USED YET
  599. SA7 NARGS NO MULTIPLE ARGUMENTS EXPECTED
  600. SA7 NARRAYS PERMIT WHOLE ARRAY OPERATIONS
  601. SA7 TMPAFLG CLEAR TEMP ARRAY INFO WORD
  602. SA7 TMPASIZ NO TEMP ARRAY WORDS USED
  603. SA7 BUFCHK NO ECS ARRAY BUFFER CHECK YET
  604. SA7 OPSL+1 BOL PRECEDENCE IS ZERO
  605. SX7 -1
  606. SA7 TOPCNT INITIALIZE COUNT OF NUMBER OF OPERATORS
  607. SA7 NUADS FLAG NO UNIT OPERANDS
  608. SX7 1
  609. SA1 PUTCOMP SEE IF -PUTCOMP- CALL
  610. ZR X1,COMPILA
  611. SA7 RX+6 RESERVE X6
  612. MX1 1
  613. SX6 6 MARK QUANTITY TO STORE IN X6
  614. BX6 X1+X6
  615. SA6 ADS
  616. COMPILA SA7 NOPS
  617. SA7 OPS+1
  618. SA7 LASTOP
  619. CALL INITDEF GO INITIALIZE FOR -DEFINE-
  620. CALL INITLEX INITIALIZE -LEX- PARAMETERS
  621. PLATO
  622. SA1 NCOMPIL
  623. BX7 X1
  624. SA7 COMPIL BE SURE LOCATION COMPIL CONTAINS RJ LEX
  625. ENDIF
  626. *
  627. * /--- BLOCK COMPNAM 00 000 75/08/20 02.01
  628. TITLE COMPNAM
  629. *
  630. *
  631. * DO PROCESSING FOR *COMPNAM* CALLS
  632. *
  633. SA1 COMPNAM
  634. ZR X1,COMPIL JUMP IF NOT A -COMPNAM- CALL
  635. *
  636. * DECIDE IF ALPHA STRING OR EXPRESSION
  637. *
  638. SA1 WORDPT GET POINTER TO FIRST CHARACTER
  639. *
  640. CMPN100 SA2 X1 LOAD NEXT CHARACTER
  641. SX0 X2-1R STRIP OFF LEADING SPACES
  642. NZ X0,CMPN110
  643. SX1 X1+1 ADVANCE CHARACTER POINTER
  644. EQ CMPN100
  645. *
  646. CMPN110 SX0 X2-1R(
  647. ZR X0,COMPIL EXPRESSION IF LEFT PAREN
  648. SX0 X2-KLBRACK
  649. ZR X0,COMPIL EXPRESSION IF LEFT BRACKET
  650. SX0 X2-KUP
  651. NZ X0,CMPN120 ALPHA STRING IF NOT SHIFT CODE
  652. SA2 A2+1 LOAD NEXT CHARACTER
  653. SX0 X2-1R,
  654. ZR X0,COMPIL EXPRESSION IF DOUBLE QUOTE
  655. SX0 X2-1R7
  656. ZR X0,COMPIL EXPRESSION IF SINGLE QUOTE
  657. *
  658. * COLLECT CHARACTERS OF ALPHA LITERAL
  659. *
  660. CMPN120 SB1 60 INITIALIZE SHIFT
  661. MX6 0 INITIALIZE WORD BUILDING
  662. SA1 X1-1 INITIALIZE READ REGISTER
  663. *
  664. CMPN130 SA1 A1+1 LOAD NEXT CHARACTER
  665. ZR X1,CMPN140 CHECK IF END-OF-LINE
  666. SA2 X1+KEYTYPE
  667. SX0 X2-OPCOMMA CHECK IF COMMA
  668. ZR X0,CMPN142
  669. SB1 B1-6 DECREMENT SHIFT COUNT
  670. NG B1,ALFERR
  671. LX1 X1,B1 POSITION NEXT CHARACTER
  672. BX6 X1+X6 MERGE WITH WORD BUILDING
  673. EQ CMPN130
  674. *
  675. * /--- BLOCK COMPNAM 00 000 78/12/18 21.01
  676. *
  677. CMPN140 SX7 A1 UPDATE *WORDPT* FOR END-OF-LINE
  678. SA7 WORDPT
  679. EQ CMPN145
  680. *
  681. CMPN142 SX7 A1+1 UPDATE *WORDPT* FOR COMMA
  682. SA7 WORDPT
  683. *
  684. CMPN145 ZR X6,ALFERR ERROR IF NO CHARACTERS
  685. BX7 X1
  686. SA7 LASTKEY SET LAST CHARACTER
  687. ZR B1,CMPN160 JUMP IF FULL WORD
  688. SA1 IFILL
  689. ZR X1,CMPN160 JUMP IF ZERO FILL
  690. *
  691. CMPN150 SB1 B1-6 COMPUTE SHIFT COUNT
  692. NG B1,CMPN160
  693. BX0 X1 GET FILL CHARACTER
  694. LX0 X0,B1
  695. BX6 X0+X6 ADD TO WORD BUILDING
  696. EQ CMPN150
  697. *
  698. * SET UP -GETVAR- CODE AND RETURN INFO
  699. *
  700. CMPN160 SA1 INX GET XSTOR POINTER
  701. SA6 X1+INFO STORE LONG LITERAL
  702. SX6 X1+1
  703. SA6 A1 UPDATE *INX*
  704. SX6 1 1 = GETVAR TYPE FOR LONG LIT
  705. LX6 XCODEAL
  706. BX1 X1+X6 X1 = -GETVAR- CODE (LONG LIT)
  707. MX6 0
  708. SA6 TOPCNT CLEAR *OPCNT*
  709. SA6 TVARCNT CLEAR *VARCNT*
  710. SB1 1 MARK NOT STOREABLE
  711. SA2 NUNITS CHECK UNIT DIMENSIONS NEEDED
  712. SX2 X2+1
  713. NG X2,COMPNAM EXIT IF NO UNITS NEEDED
  714. ZERO UADS,NUMAX MUST CLEAR *UADS*
  715. EQ COMPNAM EXIT
  716. * /--- BLOCK COMPIL 00 000 78/06/06 21.38
  717. TITLE COMPIL -- MAIN LOOP FOR COMPILER
  718. *
  719. PLATO
  720. *WHEN COLLECTING ARGUMENT FOR PARENS-LESS FUNCTION,
  721. *LOCATION COMPIL CONTAINS EQ SPECIAL.
  722. ENDIF
  723. *
  724. * THERE IS A LOOK-AHEAD INSIDE -LEX- WHEN A MINUS IS
  725. * ENCOUNTERED DURING EXECUTION, TO SEE WHETHER THE
  726. * NEXT LEXICAL ITEM IS A UNIT SUCH AS METER, IN WHICH CASE
  727. * OP IS RETURNED AS A MULTIPLICATION. -COMPILE- MUST NOT
  728. * CHANGE -AD- OR -ADTYPE-, WHICH CONTAIN THE INFO ON THE
  729. * LOOK-AHEAD ITEM, AND IT MUST USE -OP- AS THE TEST
  730. * FOR WHETHER THE ITEM IN HAND IS AN OP OR AN AD.
  731. *
  732. COMPIL CALL LEX GET NEXT LEXICAL ITEM
  733. COMPIL1 SA1 OP
  734. ZR X1,AD1 JUMP IF ADDRESS, NOT OP
  735. COMPILB NG X1,OP0 BYPASS SPL TEST IF OP IS NEG
  736. SX2 X1-OPMULT TEST FOR SPECIAL CASE OP
  737. PL X2,OP0 JUMP IF NOT
  738. SB1 X1
  739. JP B1+OPJMP GO TO SPECIAL CASE ROUTINE
  740. OPJMP EQ OP0 JUST IN CASE X1=0 ACCIDENTLY
  741. + EQ ISEOL END OF LINE OP
  742. + EQ PLUS CHECK FOR UNARY +
  743. + EQ MINUS CHECK FOR UNARY -
  744. + EQ ISEOL COMMA AS END-OF-LINE
  745. + EQ ISPIAD CHECK IF PI IS OP OR AD
  746. + EQ ISDEGR DEGREE SIGN OPERATOR
  747. + EQ ISSEG SEGMENT OP
  748. + EQ ISARRAY MATRIX OP
  749. + EQ ISARRAY VECTOR OP
  750. + EQ ISARRAY SCALAR OP
  751. OP0 BX7 X1
  752. SA7 LASTOP SAVE FOR LATER UNARY- CHECK
  753. OP1 SA2 TOPCNT COUNT OPERATORS ENCOUNTERED
  754. SX7 X2+1 OPTOTAL COUNT USEFUL IN FORMULA JUDGING
  755. SA7 TOPCNT
  756. SA3 PREVOPL PREVIOUS OP LEVEL
  757. PLATO
  758. NG X1,NEEDPAR JUMP IF FUNCTION NEEDS PARENS
  759. ENDIF
  760. SA2 X1+PRECED GET PRECEDENCE
  761. OP2 SB1 X2 GET INHAND PRECEDENCE
  762. SB2 X3 PRECEDENCE OF TOP OF STACK
  763. LT B1,B2,FORCE FORCE COMPILE IF PRECEDENCE RIGHT
  764. MX7 30
  765. BX7 -X7*X2 GET 2 PRECEDENCE LEVELS
  766. AX7 18 GET STACK PRECEDENCE
  767. SA7 PREVOPL UPDATE PREVIOUS PRECEDENCE LEVEL
  768. SA2 NOPS
  769. SX2 X2+1
  770. SX0 X2-OPSMAX SEE IF TOO MANY OPS
  771. PL X0,LNGERR
  772. SA7 X2+OPSL ADD OP LEVEL TO LIST
  773. BX7 X1
  774. SA7 X2+OPS ADD OP TO LIST
  775. BX7 X2
  776. SA7 NOPS UPDATE OP POINTER
  777. SX7 X1-OPASIGN CHECK FOR ASSIGNMENT TO INDEXED VARIABLE
  778. NZ X7,COMPIL JUMP IF NOT ASSIGNMENT
  779. * /--- BLOCK COMPIL 00 000 79/12/04 00.30
  780. *
  781. * CHECK FOR SPECS OKASSIGN DURING EXECUTION.
  782. *
  783. PLATO
  784. SA2 COMSPEC GET SPECS BITS
  785. LX2 OKASIGN OKASSIGN BIT IN SIGN BIT
  786. PL X2,ASIGERR JUMP IF NOT ALLOWED
  787. ENDIF
  788. *
  789. SA2 NADS CHECK FOR LAST AD BEING INDEXED
  790. ZR X2,EQERR JUMP IF NO ADDRESS TO STORE INTO
  791. SA2 X2+ADS
  792. BX7 X2 NOW EXAMINE AD
  793. AX7 XCODEAL POSTION TYPE CODE
  794. MX1 -3
  795. BX7 -X1*X7 MASK OFF 3 BIT CODE
  796. SX7 X7-4 CHECK FOR INDEXED VARIABLE
  797. NZ X7,COMPIL EXIT IF NOT
  798. *
  799. *MOVE ABSOLUTE ADDRESS IN A1 TO AVAILABLE X-REGISTER
  800. *TO USE LATER WHEN ASSIGNMENT OP IS PROCESSED.
  801. *
  802. * 'I BELIEVE THAT THIS ROUTINE SHOULD USE -CHOOSEX-
  803. * INSTEAD OF THIS JUNK. 'HAVEN'7T GOTTEN INTO WHY IT
  804. * DOESN'7T YET. (THEY MIGHT TRY REGISTER X7 TOO) M.MIDDEN
  805. *
  806. * 'REASON IS THIS'; THE INDEX OF THE INDEXED VARIABLE IS
  807. * EVALUATED EARLY IN THE EXPRESSION (TO THE LEFT OF THE
  808. * ASSIGNMENT ARROW), AND WE WANT TO USE TYPICAL DESTINATION
  809. * REGISTERS IN THE EVALUATION OF THE RIGHT-HAND SIDE,
  810. * ENDING FINALLY WITH USING THE SAVED ADDRESS. B. SHERWOOD
  811. SA1 RX+3 USE X3 IF AVAILABLE
  812. ZR X1,PICKED (RX+3) = 0 IF X3 NOT IN USE
  813. SA1 RX+4 IF X3 NOT AVAILABLE, TRY X4
  814. ZR X1,PICKED
  815. SA1 RX+5 THEN TRY X5
  816. ZR X1,PICKED
  817. SA1 RX+0 KEEP LOOKING
  818. ZR X1,PICKED
  819. EQ MINDERR CANT COMPILE IF NO REGISTER
  820. PICKED SB1 A1-RX CALC CHOSEN REGISTER NUMBER
  821. SX7 1
  822. SA7 A1 MARK IT TO BE IN USE
  823. MX7 57
  824. BX7 X7*X2 DISCARD ORIGINAL REGISTER NUMBER (X1)
  825. SX1 B1
  826. BX7 X1+X7 MERGE NEW REGISTER NUMBER
  827. SA7 A2 WRITE BACK NEW AD ENTRY
  828. SX7 74010B SXN A1+B0
  829. LX1 6 BUILD SXN A1
  830. BX7 X7+X1
  831. RJ SHORT
  832. SB1 1
  833. RJ FREEX FREE X1
  834. EQ COMPIL
  835. * /--- BLOCK NEEDPAR 00 000 78/06/06 21.40
  836. PLATO
  837. TITLE NEED PARENTHESES
  838. *
  839. NEEDPAR SA2 JPSPEC EQ SPECIAL INSTRUCTION
  840. BX7 X2
  841. BX1 -X1 MAKE OP CODE POSITIVE
  842. SA7 COMPIL PLANT IN PLACE OF RJ LEX
  843. SA2 NEEDPRL GET PRECEDENCE LEVEL PARENLESS FUNCTION
  844. MX7 0
  845. SA7 PRELEX PRELEX=0 MEANS NO LOOK-AHEAD LEX CALL YET
  846. BX7 X1 SAVE OPCODE IN LASTOP
  847. SA7 LASTOP
  848. EQ OP2
  849. NEEDPRL VFD 30/0,12/60,18/95 INSTACK PRECEDENCE LT DIV AND MULT
  850. *ASSURES COLLECTION OF TERMS IN SUCH EXPRESSIONS AS SIN2PIX/L.
  851. JPSPEC EQ SPECIAL REPLACES COMPIL RJ LEX WHEN COLLECTING
  852. * ARGUMENT OF PARENS-LESS FUNCTION.
  853. PRELEX BSS 1 NONZERO IF PREOP AND PREAD HAVE INFO
  854. PREOP BSS 1 PRE-OP SET BY EXTRA LOOK-AHEAD CALL TO LEX
  855. NCOMPIL CALL LEX NORMAL CONTENTS OF LOCATION COMPIL
  856. *
  857. *
  858. *WHEN COLLECTING THE ARGUMENT OF A PARENS-LESS FUNCTION
  859. *LOCATION -COMPIL- IS ALTERED TO BRANCH HERE, WHERE WE
  860. *LOOK AHEAD ONE LEXICAL ITEM IF NECESSARY. IF OP IS
  861. *MULTIPLY OR DIVIDE, WE CALL LEX AN EXTRA TIME TO SEE
  862. *WHETHER THIS OP IS FOLLOWED BY A FUNCTION, IN WHICH CASE
  863. *WE SET OP INHAND PRECEDENCE LOW TO FORCE COMPILATION OF
  864. *THE PARENS-LESS FUNCTION. THIS HANDLES SUCH STUDENT
  865. *STATEMENTS AS SINXCOSX AND SINX/COSX.
  866. *
  867. SPECIAL SA1 PRELEX CHECK FOR PREAD AND PREOP ALREADY SET
  868. ZR X1,SPEC2 JUMP IF PREOP AND PREAD DO NOT HAVE INFO
  869. NG X1,LASTSP JUMP IF LAST USE OF SPECIAL ROUTINE
  870. MX7 0
  871. SA7 A1 CLEAR PRELEX FLAG
  872. SA1 PREOP USE ALREADY ACQUIRED PREOP AND PREAD
  873. BX7 X1
  874. SA7 OP
  875. EQ SPEC3 BYPASS REGULAR CALL TO LEX
  876. *
  877. SPEC2 CALL LEX GET NEXT LEXICAL ITEM (OP AND AD)
  878. SPEC3 SA1 OP CHECK FOR * OR /
  879. ZR X1,AD1 JUMP IF NOT AN OPERATOR
  880. SX2 X1-OPMULT
  881. ZR X2,CHECKUP JUMP IF *
  882. SX2 X1-OPDIV
  883. ZR X2,CHECKUP JUMP IF /
  884. EQ COMPILB BACK TO MAINSTREAM
  885. *
  886. LASTSP SA2 NCOMPIL RESTORE LOCATION COMPIL TO NORMAL FORM
  887. * /--- BLOCK CHECKUP 00 000 78/06/06 21.40
  888. BX7 X2
  889. SA7 COMPIL
  890. SA1 PREOP MOCK UP RJ LEX
  891. BX7 X1
  892. SA7 OP
  893. ZR X1,AD1 JUMP IF OPERAND NOT OPERATOR
  894. EQ COMPILB
  895. *
  896. CHECKUP BX7 X1 CHECK WHETHER NEXT LEXICAL ITEM IS FUNCTION
  897. SA7 PREOP SAVE OP
  898. SA7 PRELEX SET PRELEX NONZERO TO FLAG LOOK-AHEAD
  899. CALL LEX LOOK AHEAD ONE LEXICAL ITEM
  900. SA1 PREOP PICK UP * OR /
  901. SA2 OP
  902. BX7 X2
  903. SA7 A1 SAVE NEW OP IN PREOP
  904. BX7 X1
  905. SA7 A2 REPLACE OP WITH PREOP
  906. ZR X2,COMPILB JUMP IF OPERAND, NOT FUNCTION OR OPERATOR
  907. NG X2,ISFUNCT JUMP IF IT IS A FUNCTION (PARES-LESS)
  908. SX3 X2-OP( CHECK FOR LEFT PARENS
  909. ZR X3,ISFUNCT EITHER ( OR FUNCTION TERMINATES ARGUMENT
  910. SX3 X2-OPFCT CHECK WHETHER OP CORRESPONDS TO A FUNCTION
  911. NG X3,COMPILB JUMP IF NOT FUNCTION
  912. SX3 X2-ARAYOP
  913. PL X3,COMPILB JUMP IF NOT FUNCTION
  914. *
  915. ISFUNCT MX7 1 NEGATIVE
  916. SA7 PRELEX SET NEGATIVE FOR LAST JUMP TO SPECIAL
  917. BX7 X1
  918. SA7 LASTOP DUPLICATE OPERATIONS AT LOCATION OP1
  919. SA2 TOPCNT COUNT OPERATORS ENCOUNTERED
  920. SX7 X2+1
  921. SA7 A2
  922. MX2 0 SPECIAL PRECEDENCE TO FORCE
  923. * ALL OPERATIONS, BACK TO PRECEDING FUNCT.
  924. * (CORRECT PRECEDENCE RESTORED AT CMPF3)
  925. EQ FORCE FORCE COMPILATION
  926. ENDIF
  927. *
  928. *
  929. TITLE MINUS, PLUS, ISDEGR, ISPI, ENDINST
  930. *
  931. *
  932. MINUS SA2 LASTOP NEED OLD LASTOP FOR UNARY CHECK
  933. BX7 X1 BUT SAVE MINUS OP IN LASTOP
  934. SA7 A2
  935. RJ UPLMIN CHECK WHETHER UNARY OPERATION
  936. SX1 OPUSUB LABEL AS UNARY MINUS
  937. EQ OP1
  938. *
  939. PLUS SA2 LASTOP NEED LASTOP FOR UNARY CHECK
  940. BX7 X1 BUT SAVE PLUS IN LASTOP
  941. SA7 A2
  942. RJ UPLMIN CHECK WHETHER UNARY OPERATION
  943. EQ COMPIL IGNORE UNARY PLUS
  944. *
  945. ISDEGR SX7 B0 DEGREE OPERATOR IS EFFECTIVELY AN ADDRESS
  946. SA7 LASTOP SO CLEAR LASTOP
  947. EQ OP1
  948. *
  949. *
  950. *PI CAN EITHER BE AN OPERATOR, AS IN 3PI, WHERE IT MEANS
  951. *GENERATE LITERAL -AND- A MULTIPLY INSTRUCTION, OR
  952. *PI CAN BE AN ADDRESS (OPERAND) AS IN 3+PI.
  953. *THE SAME ROUTINE THAT CHECKS FOR UNARY PLUS OR MINUS
  954. *MAKES THE APPROPRIATE CHECKS FOR THE TWO KINDS OF PI.
  955. * /--- BLOCK ENDINST 00 000 78/01/25 15.46
  956. *
  957. ISPIAD SA2 LASTOP NEED LASTOP FOR UNARY CHECK
  958. SX7 B0 CLEAR LASTOP SINCE BOTH KINDS OF PI ARE ADS
  959. SA7 A2
  960. RJ UPLMIN UPLMIN RETURNS IF PI IS AN ADDRESS
  961. SX0 B0 PI IS STORED AT LITS+0
  962. RJ LITREF FORM LONG LITERAL REFERENCE
  963. EQ COMPIL
  964. *
  965. UPLMIN EQ * CHECK FOR UNARY + OR - OPERATION
  966. *LASTOP MUST BE IN X2
  967. ZR X2,OP1 NOT IF PRECEDING ITEM NOT OP
  968. SX7 X2-OP)
  969. ZR X7,OP1 NOT IF )
  970. SX7 X2-OPNAME CHECK FOR PRECEDING SPECIAL NAME
  971. PL X7,OP1 EFFECTIVELY AN AD, NOT AN OP
  972. EQ UPLMIN
  973. *
  974. ENDINSA SA1 NARRAYS
  975. NZ X1,ENDAINS JUMP IF ARRAYS BEING PROCESSED
  976. ENDINST SA1 NOPS END OF THIS INSTRUCTION
  977. SX7 X1-1
  978. SA7 NOPS DECREMENT NOPS
  979. SA3 X1+OPS SAVE LAST OPERATION PERFORMED
  980. BX6 X3
  981. SA6 FINALOP
  982. ENDINS2 SA1 INHAND RESTORE TO OP2 CONDITIONS
  983. SA2 INHANDL
  984. SA3 X7+OPSL PREVIOUS LEVEL
  985. EQ OP2 AGAIN COMPARE LEVELS
  986. *
  987. ENDAINS PL X1,ENDINST EXIT IF NO ARRAY LOOP GOING ON
  988. BX7 -X1 RESET +
  989. SX7 X7+1 INCREMENT NUMBER OF ARRAY OPS
  990. SA7 A1
  991. SA1 TMPARAY STORE IN TEMPORARY ARRAY
  992. RJ LDALOOP GENERATE RJ ALOOPS, ETC.
  993. RJ AIFBIT SET I/F BIT OF RESULT ARRAYWD
  994. * SB1 RAINTER
  995. * RJ LDASUB GENERATE *RJ INTERRUPT TEST*
  996. RJ LDAINTR GENERATE *RJ AINTER* INTRUPTEST
  997. EQ ENDINST
  998. *
  999. AIFBIT EQ * SET I/F BIT OF RESULT ARRAYWD
  1000. MX0 1
  1001. LX0 XCODEAL+4 I/F BIT
  1002. SA1 NADS
  1003. SA2 X1+ADS GET ADTYPE OF RESULT
  1004. SA3 FLOAT
  1005. BX7 -X0*X2 CLEAR I/F BIT
  1006. ZR X3,ENDAIN5 JUMP IF RESULT INTEGER
  1007. BX7 X7+X0 SET I/F BIT
  1008. ENDAIN5 SA7 A2 RESTORE ADTYPE
  1009. EQ AIFBIT
  1010. *
  1011. LDALOOP EQ * ENTER WITH STORE ADDRESS IN X1
  1012. SX7 6110B CODE FOR SB1
  1013. LX7 18
  1014. BX7 X7+X1 GENERATE SB1 STORADDRESS
  1015. RJ LONGI
  1016. *****NEW CHANGE MIGHT PUT SA6 X4+B1 HERE*****
  1017. SA1 LLALOOP
  1018. SX7 0100B CODE FOR RJ **
  1019. LX7 18
  1020. BX7 X7+X1 GENERATE RJ ALOOPS
  1021. RJ LONGI
  1022. RJ PAD MAKE SURE START NEW WORD
  1023. SB1 6
  1024. RJ FREEX RELEASE RESULT REGISTER
  1025. EQ LDALOOP
  1026. * /--- BLOCK ISSEG 00 000 78/06/06 21.41
  1027. TITLE SEGMENT AND ARRAY
  1028. *
  1029. * -SEGMENT- INVOLVES AN *OP* AND AN *AD*
  1030. * SO DOES ARRAY/COMPLEX WHICH USES THIS TOO
  1031. *
  1032. ISSEG SA2 NUNITS NO UNITS ALLOWED
  1033. PL X2,UNITERR
  1034. SA2 NOPS
  1035. SX7 X2+1 INCREMENT *NOPS*
  1036. SX6 X7-OPSMAX-1
  1037. PL X6,LNGERR EXIT IF TOO MANY OPS
  1038. SA7 A2
  1039. BX6 X1 STORE -SEG- OR -ARRAY- OP
  1040. SA6 X7+OPS AND IN OPS LIST
  1041. SA3 X1+PRECED GET PRECEDENCE OF SEG OR ARRAY
  1042. AX3 18 POSITION STACK PRECEDENCE
  1043. MX0 -12
  1044. BX6 -X0*X3 MASK OFF PRECEDENCE
  1045. SA6 X7+OPSL
  1046. *
  1047. CALL LEX GET SEGMENT,ARRAY ADTYPE
  1048. SA1 OP
  1049. NZ X1,SEGERR ERROR IF OPERATOR
  1050. SA2 NADS
  1051. SX7 X2+1
  1052. SX2 X7-ADSMAX SEE IF TOO MANY ADS
  1053. PL X2,LNGERR
  1054. SA7 A2 INCREMENT NADS
  1055. SA3 ADTYPE
  1056. MX0 -XCODEAL
  1057. BX1 -X0*X3 MASK OFF ADDRESS OF LIT
  1058. AX3 XCODEAL
  1059. MX0 -3 MASK FOR TYPE CODE
  1060. BX0 -X0*X3
  1061. SA2 NOPS
  1062. SA2 X2+OPS GET LAST OP
  1063. SX2 X2-OPSEG IS EITHER ARRAY OR SEG OP
  1064. NZ X2,ISARY1 JUMP IF ARRAY
  1065. SX3 X0-5 MUST BE 5 FOR -SEGMENT-
  1066. NZ X3,SEGERR
  1067. *
  1068. SA2 ATOKEN ADDRESS OF *TOKBUF*
  1069. IX0 X1+X2 ECS ADDR OF LITERAL
  1070. SA0 LITEMP
  1071. + RE 1
  1072. RJ ECSPRTY
  1073. SA1 LITEMP GET LITERAL INTO X1
  1074. BX6 X1
  1075. RJ LSEEK ADD LITERAL TO XSTOR
  1076. SX7 5
  1077. LX7 XCODEAL
  1078. BX6 X6+X7 FORM CODE WITH NEW ADDRESS
  1079. SA1 NADS
  1080. SA6 X1+ADS ADD TO *ADS* LIST
  1081. CALL LEX GET LEFT PAREN
  1082. SA1 OP
  1083. SX2 X1-OP( ERROR IF NOT LEFT PAREN
  1084. NZ X2,BADPAR
  1085. SA2 NOPS
  1086. SX7 X2+1 INCREMENT *NOPS*
  1087. SA7 A2
  1088. BX6 X1
  1089. SA6 LASTOP
  1090. SA6 X7+OPS
  1091. SA3 X6+PRECED
  1092. AX3 18 PRECEDENCE OF LEFT PAREN
  1093. MX0 -12
  1094. BX6 -X0*X3
  1095. SA6 PREVOPL SAVE PRECEDENCE LEVEL
  1096. SA6 X7+OPSL
  1097. EQ COMPIL DONT FORCE COMPILATION
  1098. *
  1099. LITEMP BSS 1
  1100. LITEMP2 BSS 1
  1101. *
  1102. * /--- BLOCK ISARRAY 00 000 78/01/26 21.34
  1103. *
  1104. ISARRAY EQU ISSEG SEE PREVIOUS BLOCK
  1105. *
  1106. *
  1107. ISARY1 SX3 X0-6 MUST BE 6 FOR -ARRAY-
  1108. NZ X3,MATERR
  1109. SA3 ATOKEN ADDRESS OF *TOKBUF*
  1110. IX0 X1+X3 ECS ADDR OF LITERAL
  1111. SA0 LITEMP
  1112. + RE 2
  1113. RJ ECSPRTY
  1114. SA1 LITEMP GET LITERAL INTO X1
  1115. SX2 X2+OPSEG-OPSCAL
  1116. ZR X2,SCALEL JUMP IF SCALAR ARRAY
  1117. BX6 X1 NOW MUST CHECK TO SEE IF 1OR2
  1118. MX0 2 LITWORDS TO PUT IN XTRA STORAGE
  1119. LX0 58 MASK FOR BASE/SEGMENT BITS
  1120. BX0 X0*X6 IS ZERO IF NO 2D ARAYWD
  1121. SA0 A1 SAVE 1ST LIT ADDR
  1122. ZR X0,ISARY3 JUMP IF NO 2ND INFO WORD
  1123. SA1 A1+1 GET 2ND INFO WORD
  1124. BX7 X1
  1125. RJ LSEEK2 INFO WORDS IN X6 AND X7
  1126. EQ ISARY6
  1127. ISARY3 RJ LSEEK
  1128. ISARY6 SA2 A0 GET BACK ARAYWD
  1129. MX0 1
  1130. LX0 XCODEAL+4 MASK OFF I/F BIT
  1131. BX0 X0*X2
  1132. SX7 6 CODE FOR ARRAY/COMPLEX
  1133. LX7 XCODEAL
  1134. BX7 X7+X0 MERGE CODE, I/F BIT,
  1135. BX6 X6+X7 AND XSTOR ADDRESS
  1136. SA1 NADS
  1137. SA6 X1+ADS ADD TO *ADS* LIST
  1138. CALL LEX GET NEXT LEXICAL ITEM
  1139. SA1 OP
  1140. * CHECK FOR WHOLE ARRAY OR ARRAY ELEMENT
  1141. SX2 X1-OP( ERROR IF NOT LEFT PAREN
  1142. NZ X2,WARRAY IF NO ( MUST BE WHOLE ARRAY
  1143. SA2 NOPS
  1144. SX7 X2+1 INCREMENT *NOPS*
  1145. SA7 A2
  1146. BX6 X1
  1147. SA6 LASTOP
  1148. SA6 X7+OPS
  1149. SA3 X6+PRECED
  1150. ISARY8 AX3 18 PRECEDENCE OF LEFT PAREN
  1151. MX0 -12
  1152. SA1 TOPCNT INCREMENT TOTAL OP COUNT
  1153. SX6 X1+2
  1154. SA6 A1
  1155. BX6 -X0*X3
  1156. SA6 PREVOPL SAVE PRECEDENCE LEVEL
  1157. SA6 X7+OPSL
  1158. SA1 X2+OPS GET LAST OP
  1159. SX1 X1-OPMAT
  1160. ZR X1,ISMATR JUMP IF MATRIX
  1161. EQ COMPIL DONT FORCE COMPILATION
  1162. *
  1163. * /--- BLOCK WARRAY 00 000 77/12/19 16.02
  1164. ISMATR SA1 WORDPT
  1165. SX0 1R, ONLY , AND EOL TERMINATE
  1166. CALL PSCAN FIND COMMA SEPARATING ARGUMENTS
  1167. ZR X1,FORMERR ERROR IF EOL ENCOUNTERED FIRST
  1168. SX7 COPARGS PUT ARGUMENT SEPARATOR CHARCTR
  1169. SA7 B1 INTO COMMA POSITION
  1170. SX6 B1
  1171. SA6 NARGS SAVE THIS POSITION
  1172. EQ COMPIL
  1173. *
  1174. WARRAY SA1 NARRAYS IS 0 IF NO ARRAYS FOUND YET
  1175. NG X1,NOAERR NO ARRAYS ALLOWED IF -
  1176. NZ X1,WARRAY2 IF ALREADY SET, DONT CHANGE
  1177. SX6 1 THIS TURNS ON ARRAY OPS SEARCH
  1178. SA6 NARRAYS
  1179. WARRAY2 MX0 1
  1180. LX0 59 SET BIT 58
  1181. SA1 NADS
  1182. SA2 X1+ADS GET ADTYPE
  1183. BX6 X2+X0 MERGE IN WHOLE ARRAY BIT
  1184. SA6 A2 AND RESTORE
  1185. SA1 NOPS
  1186. SX7 X1-1 DECREMENT TO DISCARD ARRAY OP
  1187. SA7 A1
  1188. SX7 B0
  1189. SA7 LASTOP CLEAR IT FOR UNARY CHECKSJ
  1190. EQ COMPIL1 HAVE NEXT OP OR ADTYPE ALREADY
  1191. *
  1192. * NOTE, SEGMENTED SCALARS NOT ALLOWED
  1193. * SO ONLY REAL OR COMPLEX REAL SCALAR REACHES HERE
  1194. SCALEL BX3 X1 COPY OF ARRAYWD
  1195. LX3 1 REAL/COMPLEX BIT AT LEFT
  1196. NG X3,CPXERR JUMP IF COMPLEX**FOR NOW
  1197. MX0 -XCODEAL-4
  1198. BX6 -X0*X1 ISOLATE GETVARCODE OF STARTLOC
  1199. SA6 ADTYPE SAVE IT
  1200. SA2 NOPS
  1201. SX7 X2-1 DECREMENT OPS TO DISCARD
  1202. SA7 A2 OPSCAL OP
  1203. SA2 NADS
  1204. SX7 X2-1 DECREMENT NADS--WILL INCREMENT
  1205. SA7 A2 AGAIN IN AD1
  1206. EQ AD1 PUT SCALAR GETVAR IN ADS LIST
  1207. *
  1208. *
  1209. * ARGUMENT SEPARATOR FOR MATRICES, MULT.ARG.FUNCTS
  1210. ARGSEP SA1 TOPCNT DONT COUNT AS OPERATOR
  1211. SX7 X1-1
  1212. SA7 A1
  1213. MX7 0
  1214. SA7 LASTOP
  1215. SA4 NARGS
  1216. SX7 1R, REPLACE ARGSEP WITH , AGAIN
  1217. SA7 X4
  1218. EQ ENDINST JUST DISCARD THIS OP NOW
  1219. *
  1220. * /--- BLOCK ISEOL 00 000 74/07/13 05.03
  1221. TITLE ISEOL, ADS, UNITS, FORCE, OPJUMP
  1222. *
  1223. ISEOL SA2 PUTCOMP SEE IF *PUTCOMP* CALL
  1224. ZR X2,OP0
  1225. NG X2,OP0
  1226. *
  1227. * IF -PUTCOMP- CALL GENERATE CODE TO STORE X6 UNLESS
  1228. * SIMPLE VARIABLE REFERENCE
  1229. *
  1230. MX6 -1 RESET -PUTCOMP- FLAG
  1231. SA6 A2
  1232. SA2 COMPALL SEE IF SHOULD ALWAYS COMPILE
  1233. NZ X2,PUTCMP1
  1234. SA2 NOPS
  1235. SX2 X2-2 NOT SIMPLE IF MORE THAN 1 OP
  1236. PL X2,PUTCMP1
  1237. SA2 NADS CHECK FOR EXACTLY 1 ADTYPE
  1238. SX6 X2-1
  1239. NG X6,EQERR
  1240. NZ X6,PUTCMP1 JUMP IF NOT SIMPLEST CASE
  1241. SA2 X2+ADS
  1242. NG X2,PUTCMP1 JUMP IF IN REGISTER
  1243. AX2 XCODEAL POSITION -GETVAR- TYPE CODE
  1244. MX6 -3
  1245. BX2 -X6*X2 MASK OFF TYPE CODE
  1246. SX6 X2-2
  1247. ZR X6,OP0 EXIT IF TYPE 2 (STUDENT VAR)
  1248. SX6 X2-3
  1249. ZR X6,OP0 EXIT IF TYPE 3 (COMMON VAR)
  1250. *
  1251. PUTCMP1 SX1 OPASIGN RETURN OP CODE FOR ASSIGN
  1252. BX7 X1
  1253. SA7 OP
  1254. SX7 PUTCMP2 NEXT CALL TO -LEX- WILL BRANCH
  1255. SA7 LEXADD TO -PUTCMP2-
  1256. EQ OP0
  1257. *
  1258. PUTCMP2 SX7 EOL RETURN OP CODE FOR END-OF-LINE
  1259. SA7 OP
  1260. SA1 NADS ALSO ADD TO ADDRESS STACK
  1261. ZR X1,FORMERR ERROR IF NO ADTYPE TO STORE IN
  1262. SA2 X1+ADS
  1263. SX6 1
  1264. LX6 XCODEAL+3 MASK FOR I/F BIT
  1265. BX6 X2*X6 SAVE I/F BIT
  1266. SX7 X1+1
  1267. SX1 X7-ADSMAX
  1268. PL X1,LNGERR ERROR IF TOO MANY ADDRESSES
  1269. SA7 A1
  1270. MX0 -3
  1271. SA1 ADS GET CURRENT REGISTER NUMBER
  1272. BX2 -X0*X1
  1273. MX1 1 MARK IN REGISTER
  1274. BX1 X1+X2
  1275. BX6 X1+X6 ATTACH I/F BIT
  1276. SA6 X7+ADS STORE ADTYPE
  1277. EQ LEX RETURN TO CALLER VIA -LEX-
  1278. *
  1279. * /--- BLOCK RPAREN/AD 00 000 74/08/08 22.26
  1280. *
  1281. RPAREN SA1 TOPCNT DECREMENT TOPCNT BY 2 (LEFT AND RIGHT PAR)
  1282. SX7 X1-2
  1283. SA7 A1
  1284. SA1 NOPS TO PROCESS RT PAREN,
  1285. SX1 X1-1 JUST BACK UP STACK POINTER
  1286. SA2 X1+OPS GET PREVIOUS OPERATOR
  1287. SX7 X2-OP( MUST BE LEFT PAREN
  1288. NZ X7,BADPAR
  1289. SX7 X1-1 BACK STACK POINTER OVER LEFT PAREN
  1290. SA7 NOPS
  1291. EQ ENDINS2
  1292. *
  1293. *
  1294. AD1 SX7 B0 ADDRESS, NOT OP IN HAND
  1295. SA7 LASTOP CLEAR LAST ITEM OPCODE
  1296. SA1 ADTYPE GETVAR CODE
  1297. NG X1,VARERR ADTYPE NEGATIVE IF UNRECOGNIZED NAME
  1298. SA3 NADS
  1299. SX7 X3+1
  1300. SX6 X7-ADSMAX SEE IF TOO MANY ADS
  1301. PL X6,LNGERR
  1302. SA7 A3 INCREMENT NADS
  1303. BX6 X1
  1304. SA6 X7+ADS ADD ADDRESS TO ADS LIST
  1305. SA2 NUNITS
  1306. NG X2,COMPIL JUMP IF NO UNITS
  1307. * MOVE UADTYPE DIMENSION VECTOR INTO UADS BUFFER
  1308. SB1 X2 NUMBER OF DIMENSIONS
  1309. SA1 ATEMPEC
  1310. BX0 X1
  1311. SA0 UADTYPE
  1312. + WE B1
  1313. RJ ECSPRTY
  1314. SA1 NUADS
  1315. PL X1,AD2 JUMP IF NOT FIRST UNITS AD
  1316. DX1 X2*X3 CALC NUADS STARTING PLACE
  1317. IX1 X1-X2
  1318. AD2 SX7 X1-UADSMAX
  1319. PL X7,LNGERR JUMP IF TOO MANY UNIT ADS
  1320. SX7 X1+B1
  1321. SA7 A1 UPDATE NUADS
  1322. SA0 X7+UADS
  1323. + RE B1
  1324. RJ ECSPRTY
  1325. EQ COMPIL
  1326. * ENTER WITH X2=NUMBER OF UNITS, X1=CODE TO PLANT
  1327. DOUNITS EQ * MANIPULATE UNIT COEFFS
  1328. SB2 X2 NUNITS IN X2, CODE IN X1
  1329. BX7 X1 OPERATION CODE IN X1
  1330. SA7 DOUNIOP PLANT CODE
  1331. SB1 1 INDEX
  1332. SA1 NUADS NUADS STARTS AT ZERO
  1333. ZR X1,UNITERR MUST BE TWO OPERANDS
  1334. IX7 X1-X2 DECREMENT NUADS
  1335. SA7 A1
  1336. SA2 X1+UADS-1 SECOND LIST (MINUS 1)
  1337. SA1 A2-B2 FIRST LIST (MINUS 1)
  1338. DOUNIOP EQ * PLANT CODE HERE
  1339. + SA7 A1 STORE DIMENSION COEFF RESULT
  1340. SB2 B2-B1 COUNT
  1341. GT B2,B0,DOUNIOP
  1342. EQ DOUNITS
  1343. *
  1344. ADDEM SA1 A1+B1 FROM FIRST LIST
  1345. SA2 A2+B1 FROM SECOND LIST
  1346. FX7 X1+X2 ADD COEFFS IF MULTIPLYING UNITS
  1347. NX7 X7
  1348. *
  1349. SUBEM SA1 A1+B1 FROM FIRST LIST
  1350. SA2 A2+B1 FROM SECOND LIST
  1351. FX7 X1-X2 SUB COEFFS IF DIVIDING UNITS
  1352. NX7 X7
  1353. * /--- BLOCK DOUNITS 00 000 78/12/21 18.20
  1354. *
  1355. * ENTER WITH X2=NUMBER OF UNITS
  1356. *
  1357. ZEROU EQ * CHECK FOR ZERO UNITS COEFFS
  1358. SB2 X2 NUNITS IN X2
  1359. SB1 1 INDEX
  1360. SA1 NUADS NUADS STARTS AT ZERO
  1361. SA1 X1+UADS-1 START OF DIMENSIONS (-1)
  1362. DOZEROU SA1 A1+B1 PICK UP COEFF
  1363. NZ X1,UNITERR JUMP IF COEFF NOT ZERO
  1364. SB2 B2-B1 COUNT
  1365. GT B2,B0,DOZEROU
  1366. EQ ZEROU
  1367. *
  1368. *
  1369. * ENTER WITH X2=NUMBER OF UNITS
  1370. *
  1371. SAMEU EQ * CHECK FOR UNITS BEING THE SAME
  1372. SB2 X2 NUNITS IN X2, CODE IN X1
  1373. SB1 1 INDEX
  1374. SA1 NUADS NUADS STARTS AT ZERO
  1375. ZR X1,FORMERR MUST BE TWO OPERANDS
  1376. IX7 X1-X2 DECREMENT NUADS
  1377. SA7 A1
  1378. SA2 X1+UADS-1 SECOND LIST (MINUS 1)
  1379. SA1 A2-B2 FIRST LIST (MINUS 1)
  1380. SAMEU1 SA1 A1+B1 FROM FIRST LIST
  1381. SA2 A2+B1 FROM SECOND LIST
  1382. BX7 X1-X2 COMPARE COEFFS IF ADDING UNITS
  1383. NZ X7,UNITERR JUMP IF UNITS DO NOT MATCH
  1384. SB2 B2-B1 COUNT
  1385. GT B2,B0,SAMEU1
  1386. EQ SAMEU
  1387. *
  1388. * /--- BLOCK DOUNITS 00 000 78/12/21 18.22
  1389. *
  1390. UADZERO EQ * CREATE ZERO UNITS COEFFS
  1391. SB2 X2
  1392. SA2 NUADS POINTER IN UNIT STACK
  1393. NG X2,UNITERR NUADS SHOULD NOT BE NEGATIVE
  1394. SX7 X2+B2 INCREMENT
  1395. SX0 X7-UADSMAX
  1396. PL X0,LNGERR JUMP IF TOO MANY
  1397. SA7 A2
  1398. SA0 X7+UADS
  1399. SX1 A0 MOVE TO *X1* BECAUSE OF -CALL-
  1400. ZERO X1,B2 ZERO UNIT COEFFS FOR PI OR DEG
  1401. EQ UADZERO
  1402. *
  1403. * 3KG=3KG OR 5KG $ARS$ 3KG --- DIMENSIONLESS RESULT
  1404. SAMEUZ EQ * ARGS MUST HAVE SAME UNITS
  1405. RJ SAMEU (AND ZERO UNITS RESULT)
  1406. SA2 NUNITS
  1407. SB2 X2
  1408. SA2 NUADS
  1409. SA0 X2+UADS
  1410. SX1 A0 MOVE TO *X1* BECAUSE OF -CALL-
  1411. ZERO X1,B2 ZERO REST OF UNIT
  1412. EQ SAMEUZ
  1413. *
  1414. *
  1415. FORCE BX7 X1 SAVE IN HAND OP
  1416. SA7 INHAND
  1417. BX7 X2 AND ITS LEVEL
  1418. SA7 INHANDL
  1419. SA1 NOPS
  1420. SA1 X1+OPS GET FORCED OP
  1421. SB1 X1
  1422. OPJUMP1 SX7 1
  1423. SA7 NOTLITS OPERANDS NOT LITERALS UNTIL PROVEN ELSEWISE
  1424. SX7 B1
  1425. SA7 SAVEOP SAVE OP NUMBER
  1426. JP B1+OPJUMP GO PROCESS
  1427. *
  1428. * /--- BLOCK OPJUMP 00 000 75/06/28 03.29
  1429. TITLE OPJUMP
  1430. *
  1431. * *** WARNING ***
  1432. * IF THE ORDER OF THIS TABLE IS CHANGED
  1433. * THE XTEXT FILE FOR COMPILE (-LEXTXT-)
  1434. * MUST ALSO BE CHANGED
  1435. *
  1436. PURGMAC SYM
  1437. SYM MACRO NAM,P1,P2,JUMP
  1438. + EQ JUMP
  1439. - VFD 12/P1,18/P2
  1440. ENDM
  1441. *
  1442. *
  1443. OPJUMP BSS 1 TABLE OF JUMPS FOR PROCESSING OPS
  1444. PRECED EQU OPJUMP STACK AND INHAND PRECEDENCE LEVELS
  1445. * IN LOWER PARTS OF JUMP TABLE ENTRIES
  1446. + EQ ENDLINE END OF LINE (0 AS TERMINATOR)
  1447. - VFD 12/0,18/-1
  1448. + EQ ADD
  1449. - VFD 12/50,18/49
  1450. + EQ SUB
  1451. - VFD 12/50,18/49
  1452. + EQ ENDLINE COMMA AS TERMINATOR
  1453. - VFD 12/0,18/-1
  1454. + EQ PILIT PI LITERAL
  1455. - VFD 12/64,18/63
  1456. + EQ DEGREE DEGREE TO RADIAN
  1457. - VFD 12/64,18/63
  1458. + EQ SEGRAY SEGMENT(I)
  1459. - VFD 12/96,18/95
  1460. + EQ MATRAY REAL/COMPLEX MATRIX ELEMENT
  1461. - VFD 12/96,18/95
  1462. + EQ VECTRAY REAL/COMPLEX VECTOR ELEMENT
  1463. - VFD 12/96,18/95
  1464. + EQ SCALRAY REAL/COMPLEX SCALAR ELEMENT
  1465. - VFD 12/96,18/95
  1466. + EQ MULT
  1467. - VFD 12/64,18/63
  1468. DIVIDE EQ DIV
  1469. - VFD 12/62,18/61
  1470. + EQ BADPAR
  1471. - VFD 12/2,18/99
  1472. + EQ RPAREN RIGHT PAREN
  1473. - VFD 12/98,18/3
  1474. + EQ ARGSEP ARGUMENT SEPARATOR
  1475. - VFD 12/7,18/6
  1476. + EQ ASSIGN ASSIGNMENT
  1477. - VFD 12/10,18/95
  1478. + EQ UMINUS UNARY MINUS
  1479. - VFD 12/54,18/95
  1480. + EQ DOTMULT DOT MULTIPLY
  1481. - VFD 12/68,18/67
  1482. + EQ CRSMULT CROSS MULTIPLY
  1483. - VFD 12/72,18/71
  1484. + EQ CHARERR ILLEGAL CHARACTER
  1485. - VFD 12/100,18/100 HIGH PRECEDENCE
  1486. + EQ UNION UNION
  1487. - VFD 12/26,18/25
  1488. + EQ MASK MASK
  1489. - VFD 12/28,18/27
  1490. + EQ DIFF LOGICAL DIFFERENCE
  1491. - VFD 12/28,18/27
  1492. + EQ ARS ARITHMETIC RIGHT SHIFT
  1493. - VFD 12/28,18/27
  1494. + EQ CLS CIRCULAR LEFT SHIFT
  1495. - VFD 12/28,18/27
  1496. FSTFCT EQ COMPLOG OR
  1497. - VFD 12/20,18/19
  1498. + EQ COMPLOG AND
  1499. - VFD 12/22,18/21
  1500. + EQ COMPLOG GT
  1501. - VFD 12/24,18/23
  1502. + EQ COMPLOG GE
  1503. - VFD 12/24,18/23
  1504. + EQ COMPLOG LT
  1505. - VFD 12/24,18/23
  1506. + EQ COMPLOG LE
  1507. - VFD 12/24,18/23
  1508. + EQ COMPLOG EQ
  1509. - VFD 12/24,18/23
  1510. + EQ COMPLOG NE
  1511. - VFD 12/24,18/23
  1512. * /--- BLOCK OPJUMP 00 000 80/03/23 11.17
  1513. + EQ EXPO EXPONENTIATION (2 ARGUMENTS, LIKE GT)
  1514. - VFD 12/68,18/69
  1515. LIST G,X
  1516. *CALL LEXDEF
  1517. LIST *
  1518. *
  1519. NFUNCTS EQU *-FSTFCT NUMBER OF FUNCTIONS / NAMES
  1520. *
  1521. * /--- BLOCK ADD 00 000 78/07/31 05.11
  1522. TITLE ADD, SUB, MULT, DIVIDE
  1523. *
  1524. ADD SX7 36000B INTEGER ADD
  1525. SA7 IOP
  1526. SX7 34000B FLOAT ADD (RX)
  1527. SA7 FLOAT
  1528. SA2 NUNITS ARE THERE UNITS
  1529. NG X2,ADD1 JUMP IF NOT
  1530. RJ SAMEU CHECK FOR SAME UNIT DIMENSIONS
  1531. ADD1 RJ PREBIN DETERMINE 'I/'F TYPE
  1532. NZ B3,ADDJP IF NOT BOTH INTEGER
  1533. SA3 NOTLITS
  1534. ZR X3,ADDJP WILL BE OPTIMIZED ELSEWISE
  1535. SA3 NARRAYS
  1536. ZR X3,NTADDAR JUMP IF NO ARRAYS
  1537. BX7 X1+X2 TEST WHOLE ARRAY FLAG
  1538. LX7 1 IN BIT 58
  1539. NG X7,ADDJP JUMP IF EITHER IS AN ARRAY
  1540. NTADDAR MX7 0
  1541. SA7 FLOAT NOT FLOATING INSTRUCTION
  1542. MX7 57
  1543. BX3 X1 GETVAR CODE IN X1
  1544. NG X3,TRY2ND 1ST ARG IN REGISTER
  1545. AX3 XCODEAL
  1546. BX3 -X7*X3
  1547. ZR X3,SMALAD SMALL 1ST ARG
  1548. TRY2ND NG X2,ADDJP 2ND ARG IN REGISTER
  1549. BX4 X2
  1550. AX4 XCODEAL
  1551. BX4 -X7*X4
  1552. NZ X4,ADDJP JUMP IF NEITHER SMALL INTEGER
  1553. BX7 X1 SWITCH ORDER OF ADS
  1554. SA7 A2
  1555. BX7 X2
  1556. SA7 A1
  1557. SA1 A1
  1558. SA2 A2
  1559. SMALAD MX7 60-XCODEAL
  1560. BX7 -X7*X1 GET 14 BITS OF SMALL LITERAL
  1561. SX7 X7-1
  1562. NZ X7,ADDJP JUMP IF NOT 1
  1563. SB1 1
  1564. *BECAUSE FUNCTIONS AND SEGMENTS PUT INTO X1'.
  1565. RJ GENREAD GET THE NON-ONE ARGUMENT
  1566. SX7 1
  1567. SA7 B1+RX RESERVE THAT REGISTER
  1568. SA0 B1
  1569. SA1 NADS
  1570. IX7 X1-X7 GET TO OTHER ADS
  1571. SA7 A1
  1572. SB1 2
  1573. RJ CHEKRR
  1574. SX7 B1+430B GENERATE -1
  1575. LX7 6
  1576. SX7 X7+59 MXN 60-1
  1577. RJ SHORT
  1578. RJ FREEX
  1579. MX7 0 CLEAR FIRST REGISTER
  1580. SA7 A0+RX
  1581. SB2 A0
  1582. SX0 B2
  1583. LX0 3
  1584. * /--- BLOCK ADD 00 000 78/07/31 04.45
  1585. SX3 X0+B1 ORIGIN REGISTER
  1586. RJ PICKX GET DESTINATION REGISTER
  1587. MX7 1 RESERVE IT
  1588. SA7 B1+RX
  1589. SX7 B1
  1590. LX7 6
  1591. BX7 X3+X7
  1592. SX6 37000B SUBTRACT INSTRUCTION
  1593. BX7 X6+X7
  1594. RJ SHORT
  1595. EQ ENDINSA
  1596. ADDJP LX0 1 FLAG FIRST OPERAND FOR CHANGE
  1597. JP B3+ADDS
  1598. ADDS EQ IADD I+I
  1599. EQ ADDIF I+F
  1600. EQ ADDFI F+I
  1601. EQ ADD2 F+F
  1602. * ADDIF LX0 1 FLAG FIRST OPERAND FOR MODE CHANGE
  1603. ADDIF BX7 X1+X0 (PREBIN SET X0 TO I/F MASK)
  1604. SA7 A1
  1605. EQ ADD2
  1606. * ADDFI LX0 1 FLAG SECOND OPERAND FOR MODE CHANGE
  1607. ADDFI BX7 X2+X0 (PREBIN SET X0 TO I/F MASK)
  1608. SA7 A2
  1609. EQ ADD2
  1610. IADD SX7 B0
  1611. SA7 FLOAT
  1612. ADD2 RJ BINARY READ TWO OPERANDS
  1613. SA1 FLOAT IS IT FLOATING
  1614. NZ X1,ADDF JUMP IF FLOATING
  1615. SA1 IOP GET INTEGER OPERATION
  1616. BX7 X1+X7 MERGE REGISTERS
  1617. RJ SHORT ADD INSTRUCTION TO STREAM
  1618. EQ ENDINSA
  1619. ADDF BX7 X1+X7 MERGE FLOATING OPERATION WITH REGISTERS
  1620. RJ SHORT ADD INSTRUCTION TO STREAMF
  1621. NORM SA1 NOTLITS SHORT LEAVES LITERAL IN X7 IF NOTLITS=0
  1622. NZ X1,NORM2 JUMP IF NOT LITERALS
  1623. NX7 X7 NORM THE LITERAL
  1624. SA7 A7 AND STORE AGAIN INTO LITS TABLE
  1625. EQ ENDINST
  1626. *
  1627. NORM2 SX2 B1 NORMALIZE, B1 IS REGISTER NUMBER
  1628. LX2 6 CONSTRUCT NXI XI INSTRUCTION
  1629. SX2 X2+B1
  1630. SX7 X2+24000B 24 IS NORMALIZE
  1631. RJ SHORT
  1632. EQ ENDINSA
  1633. *
  1634. SUB SX7 37000B INTEGER SUB
  1635. SA7 IOP
  1636. SX7 35000B FLOAT SUB (RX)
  1637. SA7 FLOAT
  1638. SA2 NUNITS
  1639. NG X2,SUB1
  1640. RJ SAMEU
  1641. SUB1 RJ PREBIN
  1642. LX0 1 FLAG FIRST OPERAND FOR MODE CHANGE
  1643. JP B3+ADDS
  1644. *
  1645. MULT SA2 NUNITS CHECK FOR UNITS
  1646. NG X2,MULT1 JUMP IF NO UNITS
  1647. SA1 ADDEM CODE FOR ADDING UNIT COEFFS
  1648. RJ DOUNITS
  1649. MULT1 RJ PREBIN CHECK FOR I/F TYPE
  1650. MULT1B SX7 41000B FLOAT MULT (RX)
  1651. SA7 FLOAT
  1652. LX0 1 (PREBIN SET X0 TO I/F MASK)
  1653. JP MULTS+B3
  1654. * /--- BLOCK MULT 00 000 75/10/18 20.16
  1655. MULTS EQ IMULT I * I
  1656. + BX7 X1+X0 I * F
  1657. SA7 A1 FLAG 1ST OPERAND FOR MODE CHANGE
  1658. EQ MULT2
  1659. + BX7 X2+X0 F * I
  1660. SA7 A2 FLAG 2ND OPERAND FOR MODE CHANGE
  1661. MULT2 RJ BINARY MODE CHANGE BITS ARE NOW SET
  1662. SA1 FLOAT GET INSTRUCTION CODE
  1663. BX7 X1+X7 MERGE REGISTER NUMBERS
  1664. RJ SHORT ADD INSTRUCTION TO STREAM
  1665. EQ ENDINSA
  1666. *
  1667. *INTEGER MULTIPLY-----
  1668. IMULT SX7 B0 CLEAR FLOAT FOR INT MULT.
  1669. SA7 FLOAT
  1670. RJ BINARY GET OPERANDS INTO REGISTERS
  1671. SX7 X7+42000B INTEGER MULTIPLY
  1672. RJ SHORT ADD INSTRUCTION TO STREAM
  1673. EQ ENDINSA
  1674. *
  1675. *
  1676. DIV SX7 45000B FLOAT DIV (RX)
  1677. SA7 FLOAT
  1678. RJ FLTBOTH FLOAT BOTH OPERANDS
  1679. SA2 NUNITS
  1680. NG X2,MULT2 JUMP IF NOT UNITS
  1681. SA1 SUBEM CODE TO SUBTRACT UNIT COEFFS
  1682. RJ DOUNITS
  1683. EQ MULT2
  1684. *
  1685. PILIT SX0 B0 PI LITERAL STORED AT LITS+0
  1686. RJ LITREF GENERATE LONG LITERAL REFERENCE
  1687. EQ MULT GENERATE MULTIPLY INSTRUCTION
  1688. *
  1689. *
  1690. DEGREE SX0 1 PI/180 LITERAL IN LITS+1
  1691. RJ LITREF GENERATE LONG LITERAL REFERENCE
  1692. SA1 TOPCNT DO NOT COUNT AS AN OPERATION
  1693. SX7 X1-1
  1694. SA7 A1
  1695. EQ MULT GENERATE MULTIPLY INSTRUCTION
  1696. *
  1697. *
  1698. *LITREF CREATES ENTRY IN ADS LIST FOR FLOATING LONG
  1699. *LITERAL AT LITS+(X0). X0=0 FOR PI, X0=1 FOR PI/180.
  1700. LITREF EQ * CREATE LONG LITERAL REFERENCE
  1701. SA1 NLITS INCREMENT NLITS SINCE GENREAD
  1702. SX7 X1+1 WILL DECREMENT NLITS
  1703. SA7 A1
  1704. SA1 NADS HANDLE DEGREE SIGN
  1705. SX7 X1+1 GENERATE REFERENCE TO DEGREE-RADIAN FACTOR
  1706. SX6 X7-ADSMAX
  1707. PL X6,LNGERR ERROR IF TOO MANY ADS
  1708. SA7 A1 UPDATE NADS
  1709. SX6 11B GETVAR CODE FOR FLOATING LIT
  1710. LX6 XCODEAL
  1711. BX6 X6+X0
  1712. SX2 1 SET *LITS* FLAG
  1713. LX2 LITSHFT
  1714. BX6 X6+X2
  1715. SA6 X7+ADS LITERAL IS PI OR PI/180
  1716. SA2 NUNITS
  1717. NG X2,LITREF JUMP IF NO UNITS INVOLVED
  1718. RJ UADZERO
  1719. EQ LITREF
  1720. *
  1721. MASK RJ PREBIN INTEGER MASK
  1722. MX7 0
  1723. SA7 FLOAT
  1724. RJ BINARY
  1725. SX7 X7+11000B
  1726. RJ SHORT
  1727. SA2 NUNITS
  1728. NG X2,ENDINSA
  1729. * /--- BLOCK MULT 00 000 75/10/18 20.16
  1730. RJ SAMEUZ MUST HAVE SAME UNITS
  1731. EQ ENDINSA
  1732. * /--- BLOCK UNION 00 000 75/10/18 20.47
  1733. *
  1734. UNION RJ PREBIN INTEGER UNION
  1735. MX7 0
  1736. SA7 FLOAT
  1737. RJ BINARY
  1738. SX7 X7+12000B
  1739. RJ SHORT
  1740. SA2 NUNITS
  1741. NG X2,ENDINSA
  1742. RJ SAMEUZ MUST HAVE SAME UNITS
  1743. EQ ENDINSA
  1744. *
  1745. DIFF RJ PREBIN LOGICAL DIFFERENCE
  1746. MX7 0
  1747. SA7 FLOAT
  1748. RJ BINARY
  1749. SX7 X7+13000B BXN XA-XB
  1750. RJ SHORT
  1751. SA2 NUNITS
  1752. NG X2,ENDINSA
  1753. RJ SAMEUZ MUST HAVE SAME UNITS
  1754. EQ ENDINSA
  1755. *
  1756. ARS MX7 0 ARITHMETIC RIGHT SHIFT
  1757. SA7 SHIFTDN
  1758. SX7 21000B SHIFT WITH 2ND ARG CONSTANT
  1759. SA7 IOP STORE FOR POSSIBLE OPTIMIZATION
  1760. RJ PREBIN
  1761. RJ LBINARY
  1762. SA2 SHIFTDN
  1763. ZR X2,ARSB1
  1764. SA2 NOTLITS
  1765. ZR X2,ENDINSA
  1766. SA2 IOP
  1767. BX7 X7+X2 UNION IN REGISTER
  1768. EQ ARSSTR
  1769. ARSB1 SX7 X7+23000B
  1770. ARSSTR RJ SHORT
  1771. EQ ENDINSA
  1772. *
  1773. CLS SX7 0 CIRCULAR LEFT SHIFT
  1774. SA7 SHIFTDN FLAG FOR SHIFT OPTIMIZED
  1775. SX7 20000B SHIFT WITH 2ND ARG CONSTANT
  1776. SA7 IOP STORE FOR POSSIBLE OPTIMIZATION
  1777. RJ PREBIN CHECK IF BOTH LITERALS
  1778. RJ LBINARY
  1779. SA2 SHIFTDN
  1780. ZR X2,CLSB1
  1781. SA2 NOTLITS
  1782. ZR X2,ENDINSA DONE IF HAD LITERALS
  1783. SA2 IOP
  1784. BX7 X7+X2 UNION IN REGISTER
  1785. EQ CLSSTR
  1786. CLSB1 SX7 X7+22000B
  1787. CLSSTR RJ SHORT
  1788. EQ ENDINSA
  1789. *
  1790. *
  1791. SHIFTDN BSS 1 CHECK TO SEE IF SHIFT OPTIMIZED
  1792. *
  1793. * /--- BLOCK DOTMULT 00 000 77/12/18 16.55
  1794. TITLE ARRAY MULTIPLICATION
  1795. *
  1796. DOTMULT SX7 RDOTMUL FLAG FOR DOT MULTIPLY
  1797. SA7 IOP SAVE IT
  1798. ARAYMUL SA2 NUNITS
  1799. NG X2,DOTM01 JUMP IF NO UNITS
  1800. SA1 ADDEM ADD UNIT COEFFS
  1801. RJ DOUNITS
  1802. DOTM01 RJ PREBIN B3=I/F BIT INFO, CHK FOR 2 ADS
  1803. * SA3 IOP
  1804. * SB2 X3-RDOTMUL SET B2=0 IF DOT PRODUCT
  1805. BX4 X1+X2
  1806. LX4 1 EXAMINE WHOLE-ARRAY BIT
  1807. PL X4,MULT1B IF NEITHER ARRAY,NORMAL MULTPY
  1808. BX4 X1*X2
  1809. LX4 1
  1810. MX7 -XCODEAL
  1811. NG X4,DOTM10 JUMP IF BOTH ARE ARRAYS
  1812. * NE B2,B0,SIZERR NO SCALARS IN CROSSPRODUCT
  1813. SA3 IOP
  1814. SX3 X3-RDOTMUL
  1815. NZ X3,SIZERR NO SCALARS IN CROSSPRODUCT
  1816. MX3 -9
  1817. BX4 X1
  1818. LX4 1
  1819. NG X4,DOTM02 JUMP IF 1ST OPERAND IS ARRAY
  1820. BX4 -X7*X2 GET ADDRESS AND
  1821. SA4 X4+INFO 2D OPERAND ARAYWD
  1822. AX4 36
  1823. BX4 -X3*X4 ISOLATE ROWS
  1824. NZ X4,SIZERR ROWS2 MUST BE 1 IF OP1 SCALAR
  1825. EQ MULT1B DO REGULAR MULTIPLY
  1826. *
  1827. DOTM02 BX4 -X7*X1 GET ADDRESS AND
  1828. SA4 X4+INFO 1ST OPERAND ARAYWD
  1829. AX4 27
  1830. BX4 -X3*X4 ISOLATE COLS
  1831. NZ X4,SIZERR COLS1 MUST BE 1 IF OP2 SCALAR
  1832. EQ MULT1B DO REGULAR MULTIPLY
  1833. *
  1834. * /--- BLOCK DOTMULT 00 000 76/11/28 10.26
  1835. DOTM10 BX1 -X7*X1 ADDRESSES OF ARRAYWDS
  1836. BX2 -X7*X2
  1837. SA3 X1+INFO GET ARRAY WDS
  1838. SA4 X2+INFO
  1839. BX6 X3-X4
  1840. LX6 1 EXAMINE REAL/COMPLEX BIT
  1841. NG X6,CPXERR ERROR UNLESS BOTH SAME TYPE
  1842. *
  1843. BX6 X3+X4
  1844. LX6 3 TEST MERGED SEGMENT BITS
  1845. PL X6,DOTM14 JUMP IF NEITHER SEGMENTED
  1846. SX6 B3 SAVE IFTYPE
  1847. SA6 FLOAT
  1848. LX4 3
  1849. PL X4,DOTM12 JUMP IF 2D ARRAY NOT SEGMENTED
  1850. LX4 57
  1851. BX7 X4
  1852. SA7 ASIZE
  1853. RJ ARYPREP CLEAR X1,X2,X6,CHECK SAVEBUFFER
  1854. RJ ASEGTMP CONVERT 2D ARG TO TEMP ARRAY
  1855. SA1 NADS
  1856. SA1 X1+ADS-1 GET 1ST OPERAND ADTYPE
  1857. MX7 -XCODEAL
  1858. BX1 -X7*X1 ADDR OF ARAYWD
  1859. SA3 X1+INFO GET 1ST ARAYWD
  1860. DOTM12 LX3 3
  1861. PL X3,DOTM13 JUMP IF 1ST NOT SEGMENTED
  1862. * EQ TSTERR **THIS PART NOT FULLY TESTED**
  1863. LX3 57
  1864. BX7 X3
  1865. SA7 ASIZE
  1866. RJ POPNADS SET FOR FIRST OPERAND
  1867. RJ ARYPREP CLEAR X1,X2,X6,CHECK SAVEBUFFER
  1868. RJ ASEGTMP CONVERT 1ST ARG TO TEMP ARRAY
  1869. SA1 NADS
  1870. SX7 X1+1 BACKUP TO 2D OPERAND
  1871. SA7 A1
  1872. DOTM13 SA1 NADS
  1873. SA2 X1+ADS
  1874. SA1 X1+ADS-1
  1875. MX7 -XCODEAL
  1876. BX1 -X7*X1 ADDRESS OF ARRAYWDS
  1877. BX2 -X7*X2
  1878. SA3 FLOAT GET SAVED B3
  1879. SB3 X3
  1880. SA3 X1+INFO ARRAY INFO WORDS (NOW TEMPARAY)
  1881. SA4 X2+INFO
  1882. * NOW CHECK FOR CONFORMALITY
  1883. DOTM14 MX0 2 MASK FOR DIMENSIONS
  1884. BX5 X3+X4
  1885. LX5 4 MERGED DIMENSIONS AT LEFT
  1886. MX0 -9 MASK FOR SIZE FIELDS
  1887. LX3 24
  1888. LX4 24 GET ROWS AT RIGHT
  1889. BX6 -X0*X3 ROWS1-1
  1890. BX7 -X0*X4 ROWS2-1
  1891. LX3 9
  1892. LX4 9
  1893. BX3 -X0*X3 COLS1-1
  1894. BX4 -X0*X4 COLS2-1
  1895. * NE B2,B0,CRSMUL5 JUMP IF CROSSPRODUCT
  1896. SA1 IOP
  1897. SX1 X1-RDOTMUL
  1898. NZ X1,CRSMUL5 JUMP IF CROSSPRODUCT
  1899. * CHECK CONFORMALITY OF VECTOR PROD SEPARATELY
  1900. PL X5,DOTM30 JUMP IF NEITHER ARE MATRICES
  1901. DOTM15 IX5 X3-X7 COLS1-ROWS2
  1902. NZ X5,SIZERR INNER DIMENSIONS MUST MATCH
  1903. * /--- BLOCK DOTMULT 00 000 78/01/25 16.08
  1904. **LATER MUST CHECK FOR COMPLEX ARRAY..DOUBLE SIZE
  1905. SX0 X6+1 ROWS1
  1906. SX5 X4+1 COLS2
  1907. DX5 X0*X5 ROWS1*COLS2
  1908. SX0 X5-1 SIZE-1
  1909. ZR X0,DOTM21 JUMP IF RESULT SCALAR (SIZE=1)
  1910. SX0 X0-ARAYLTH+1
  1911. PL X0,SIZERR ERROR IF SIZE TOO BIG
  1912. * RESULT IS MATRIX
  1913. DOTM20 LX5 9
  1914. BX5 X5+X6 SIZE,ROWS1
  1915. LX5 9
  1916. BX0 X5+X4 SIZE,ROWS1,COL2
  1917. LX0 27 =RESULT ARAYWD SIZE FIELDS
  1918. *
  1919. * WHEN COMPLEX ADDED...INSERT CMPLX/REAL BIT HERE
  1920. DOTM21 LX7 9
  1921. BX7 X7+X4 ROW2,COL2
  1922. SA7 TMPARAY SAVE TEMPORARILY
  1923. BX7 X0
  1924. SA7 ASIZE RESULT SIZE FIELD (0 IF SCALAR)
  1925. SX7 B3 IFBITS
  1926. SA7 FLOAT SAVE FOR ADTYPE IN AIFBIT
  1927. SX5 7110B SX1 B0+...
  1928. LX5 18
  1929. LX6 9
  1930. BX6 X6+X7 ROWS1/IFBITS
  1931. BX7 X5+X6 SX1 ROWS1/IFBITS
  1932. **
  1933. SA7 FFLT SAVE TEMPORARILY
  1934. RJ ARYPREP CLEAR X1,2,6, FORM RJ ABUFCHK
  1935. SA1 FFLT
  1936. BX7 X1 RESTORE X1 INFO
  1937. RJ LONGI GENERATE SX1 ROWS1/IFBITS
  1938. *
  1939. SA1 TMPARAY ROW2/COL2
  1940. SX7 7120B SX2 B0+...
  1941. LX7 18
  1942. BX7 X7+X1
  1943. RJ LONGI GENERATE SX2 ROWS2/COLS2
  1944. * NOW GET ADDRESSES INTO B1,B2
  1945. SA1 NADS
  1946. SA1 X1+ADS GET 2D OPERAND IN X1
  1947. RJ GETARAD GET ACTUAL 2D ARAY ADDR IN X3
  1948. SX7 6120B SB2 B0+...
  1949. LX7 18
  1950. BX7 X7+X3
  1951. RJ LONGI GENERATE SB2 (ARAY2 STARTLOC)
  1952. *
  1953. SA2 FLOAT TYPE STORED HERE
  1954. SX3 X2-4
  1955. PL X3,ISATRA JUMP IF TYPE 4,5,6,7 ETC
  1956. *
  1957. SA1 NADS
  1958. SA1 X1+ADS-1 GET 1ST OPERAND IN X1
  1959. RJ GETARAD
  1960. SX7 6110B SB1 B0+...
  1961. LX7 18
  1962. BX7 X7+X3
  1963. RJ LONGI GENERATE SB1(ARAY1 STARTLOC)
  1964. RJ POPNADS DECREMENT NADS
  1965. *
  1966. DOTM60 SB1 1 FORCE NEW TMPARAY
  1967. RJ CALCTMP
  1968. SA1 TMPARAY WHERE TO STORE
  1969. SX7 5100B
  1970. LX7 18
  1971. BX7 X7+X1 GENERATE SA0 TMPARAY
  1972. RJ LONGI
  1973. *
  1974. * /--- BLOCK CROSSMULT 00 000 76/06/20 05.34
  1975. *
  1976. DOTM70 SA1 IOP GET DISPLACEMENT
  1977. SB1 X1 FOR DOT/CROSS PROD
  1978. RJ LDASUB GENERATE RJ DOT/CROSS PROD
  1979. *
  1980. RJ TMPAD CREATE TEMP ARRAYWD, ADTYPE
  1981. RJ AIFBIT SET I/F BIT OF TEMP ARAYWD
  1982. * SB1 RAINTER
  1983. * RJ LDASUB GENERATE *RJ ARRAY INTERRUPT*
  1984. RJ LDAINTR GENERATE *RJ AINTER* INTRUPTEST
  1985. SA1 NARRAYS
  1986. SX7 X1+1 INCREMENT TO COUNT ARRAY OPS
  1987. SA7 NARRAYS
  1988. EQ ENDINST
  1989. *
  1990. * ENTER HERE IF BOTH OPERANDS VECTORS
  1991. DOTM30 IX5 X6-X7 TEST ROWS1-ROWS2
  1992. NZ X5,SIZERR MUST BE IDENTICAL LENGTH
  1993. MX6 0 MOCK UP ROW1=1
  1994. MX0 0 TO SET SIZE=0
  1995. EQ DOTM21
  1996. *
  1997. * PATCH SO TRANSPOSE, REVERSE, ETC CAN USE DOTPROD
  1998. ISATRA SX7 66120B SB1 B2+B0
  1999. RJ SHORT ONLY ONE OPERAND ADDR FOR FUNCT
  2000. SA1 NADS
  2001. SA2 X1+ADS
  2002. MX0 1
  2003. LX0 XCODEAL+4 I/F BIT MASK
  2004. BX7 X0*X2
  2005. SA7 FLOAT I/F BIT OF OPERAND FOR AIFBIT
  2006. SX7 RDOTMUL
  2007. SA7 IOP TRANSPOSE,REV USE DOT MUL
  2008. EQ DOTM60
  2009. * IF PUT TRACE IN HERE, SHOULD GOTO DOTM70
  2010. *
  2011. *
  2012. *
  2013. * ARRAY CROSS PRODUCT
  2014. *
  2015. CRSMULT SX7 RCRSMUL
  2016. SA7 IOP SAVE FLAG
  2017. EQ ARAYMUL
  2018. *
  2019. CRSMUL5 SB1 X7-1 CROSS MULT MUST HAVE
  2020. LE B1,B0,SIZERR 3 OR MORE ELEMENTS
  2021. PL X5,CRSMUL7 JUMP IF BOTH VECTORS
  2022. NZ X4,SIZERR 2D OPERAND MUST BE VECTOR
  2023. IX0 X6-X3 AND 1ST OPERAND SQUARE ARRAY
  2024. NZ X0,SIZERR JUMP UNLESS ROWS1=COLS1
  2025. BX0 X7 SAVE COLS2 TEMPORARILY
  2026. SX7 RDOTMUL RESET FLAG SINCE ARRAY
  2027. SA7 IOP CROSS MULT SAME AS DOT
  2028. BX7 X0
  2029. EQ DOTM15 DO DOT MULTIPLY ON ARRAY.VECTOR
  2030. *
  2031. CRSMUL7 SX5 X7+1 SIZE=ROWS2 FOR VECTOR CROSSMULT
  2032. EQ DOTM20 NOTE ROW1 USED ONLY IN ASIZE
  2033. *
  2034. * /--- BLOCK ENDLINE 00 000 78/12/18 21.07
  2035. TITLE ENDLINE -- END OF EXPRESSION PROCESSING
  2036. *
  2037. PLATO
  2038. ENDLINE SA1 OLDB5 -1 IF STUD DEF UNIT NOT IN CM
  2039. NG X1,ENDL
  2040. CALL POSTOR RESTORE PRESENT UNIT
  2041. ENDIF
  2042. CONDEN
  2043. ENDLINE BSS 0
  2044. ENDIF
  2045. ENDL SA1 NUNITS
  2046. SX7 X1+1 CHECKING FOR NUNITS=-1
  2047. NZ X7,ENDLIN2
  2048. ZERO UADS,NUMAX MUST CLEAR *UADS*
  2049. ENDLIN2 SA1 WORDPT RETURN LAST KEY FOUND (0 OR COMMA)
  2050. SA2 X1-1
  2051. BX7 X2
  2052. SA7 LASTKEY
  2053. NZ X7,NOTEOL
  2054. SX7 A2
  2055. SA7 A1 BACK UP WORDPT IF EOL
  2056. NOTEOL SA1 NADS CHECK THAT THERE IS EXACTLY ONE OPERAND
  2057. SA2 X1+ADS
  2058. MX7 1 SET NOTLITS FOR ANY ROUTINE
  2059. SA7 NOTLITS WHICH CALLS COMPILE AND USES SHORT
  2060. SX0 1 AND SAVE I/F INFO
  2061. LX0 XCODEAL+3 I/F BIT MASK
  2062. BX7 X0*X2
  2063. SA7 FLOAT SAVE FLOAT BIT
  2064. SX1 X1-1
  2065. NZ X1,FORMERR OTHERWISE ERROR IN FORM OF EXPRESSION
  2066. SA1 COMPALL IF THIS FLAG SET, COMPILE CODE EVEN
  2067. NZ X1,ENDL1 FOR SIMPLE VARIABLE OR LITERAL
  2068. *
  2069. * CHECK FOR SPECS NOOPS OR SPECS NOVARS
  2070. *
  2071. PLATO
  2072. SA3 COMSPEC
  2073. BX1 X3
  2074. LX1 NOOPS CHECK FOR NOOPS SPECIFIED
  2075. PL X1,OPSOK
  2076. SA1 TOPCNT NUMBER OF OPERATIONS
  2077. NZ X1,OPTERR
  2078. * /--- BLOCK ENDLINE 00 000 79/12/04 00.39
  2079. OPSOK LX3 NOVARS CHECK FOR NOVARS SPECIFIED
  2080. PL X3,VARSOK
  2081. SA1 TVARCNT NUMBER OF VARIABLE REFERENCES
  2082. NZ X1,VARTERR
  2083. ENDIF
  2084. *
  2085. VARSOK SA1 CALC CHECK WHETHER A CALC COMMAND
  2086. ZR X1,NOTCALC JUMP IF NOT A CALC COMMAND
  2087. SA1 FINALOP LAST OPERATION IN CALC SHOULD BE ASSIGN
  2088. SX1 X1-OPASIGN
  2089. NZ X1,EQERR JUMP IF NOT ASSIGN
  2090. SA3 NARRAYS
  2091. ZR X3,VARSOK2 JUMP IF NO ARRAYS USED
  2092. BX3 X2
  2093. LX3 1 CHECK WHOLE ARRAY BIT
  2094. NG X3,ENDARAY SKIP GENREAD FOR ARRAYS
  2095. VARSOK2 PL X2,SIMPLE JUMP IF RESULT NOT IN REGISTER
  2096. ENDL1 SA1 RSULTX1 IF ZERO, MAKE SURE RESULT IN X1
  2097. NZ X1,ENDL2 AT END OF CALC
  2098. SB1 1 GENERATE A READ IF NECESSARY (EXPRESSION)
  2099. RJ GENREAD
  2100. SB2 B1-1 CHECK FOR NOT IN X1
  2101. ZR B2,ENDL2 JUMP IF VALUE IN X1
  2102. SX7 B1 B1 IS PRESENT REGISTER
  2103. LX7 3
  2104. SX7 X7+10100B CONSTRUCT BX1 XN
  2105. RJ SHORT ADD TO STREAM
  2106. ENDL2 SX0 B0 CLEAR X0, IN CASE MOVCODE NOT CALLED
  2107. SA1 CMOVFLG IF ZERO, COMPILE CALC EXIT JUMP
  2108. NZ X1,COMPEND AND MOVE CODE GENERATED INTO EXTRA STORAGE
  2109. * /--- BLOCK COMPEND 00 000 76/06/17 16.06
  2110. SX7 23B
  2111. LX7 21 COMPILE JP B3
  2112. RJ LONGI LAST INSTRUCTION
  2113. RJ PAD PAD OUT THE INSTRUCTION TO LEFT-ADJUST IT
  2114. RJ MOVCODE AND MOVE CODE TO EXTRA STORAGE
  2115. *MOVCODE SETS X0 TO EXTRA STORAGE LOCATION OF CODE.
  2116. COMPEND SX1 4 FLAG CALC CODE
  2117. LX1 XCODEAL
  2118. BX1 X0+X1 BRING IN EXTRA STORAGE POINTER
  2119. *X0 IS ZERO IF MOVCODE WAS NOT CALLED, AS WITH -BRANCH-
  2120. *COMMAND. IN THIS CASE -BRANCH- SIMPLY NEEDS I/F INFO.
  2121. SA2 FLOAT PICK UP I/F BIT
  2122. BX1 X1+X2
  2123. EQ CHKSTOR
  2124. SIMPLE SA1 NADS SIMPLE VARIABLE REFERENCE, NO CALC
  2125. SA1 X1+ADS
  2126. CHKSTOR SB1 B0 FLAG FOR STORE-INTO-ABLE
  2127. BX3 X1 GETVAR CODE INTO X3
  2128. AX3 XCODEAL GET INITIAL BITS
  2129. MX0 57
  2130. BX3 -X0*X3 THROW AWAY I/F INFO
  2131. SB2 X3 0SHORT,1LONG,2STUDENT,3COMMON,4CALC
  2132. JP B2+CHKSTR2
  2133. CHKSTR2 EQ NOSTORE SHORT LIT
  2134. EQ LONGLIT LONG LIT
  2135. EQ COMPILE STUDENT
  2136. EQ COMPILE COMMON
  2137. EQ CHKSTR3 CALC
  2138. EQ COMPERR SEGMENT
  2139. EQ COMPERR ARRAY/COMPLEX
  2140. EQ NOSTORE -JUMP-TYPE GETVAR CODE
  2141. *
  2142. CHKSTR3 SA2 ADS+1 PICK UP AD TO CHECK FOR INDEXED VARIABLE
  2143. AX2 XCODEAL POSITION TYPE CODE
  2144. MX0 -3
  2145. BX2 -X0*X2 MASK OFF TYPE CODE
  2146. SX2 X2-4 TYPE 4 = INDEXED STORE
  2147. ZR X2,COMPILE JUMP IF CAN STORE INTO INDEXED VARIABLE
  2148. SA2 PUTCOMP
  2149. ZR X2,NOSTORE EXIT IF NOT -PUTCOMP- CALL
  2150. SA2 FINALOP LAST OPERATION IN CALC SHOULD BE AN ASSIGN
  2151. SX2 X2-OPASIGN
  2152. NZ X2,EQERR JUMP IF NOT ASSIGN
  2153. SB1 1
  2154. EQ COMPILE
  2155. * /--- BLOCK NOTCALC 00 000 76/06/17 16.11
  2156. *
  2157. NOTCALC SA3 NARRAYS
  2158. NZ X3,ARYUSED JUMP IF WHOLE ARRAYS USED
  2159. NOARAY SX7 0
  2160. SA7 ARAYFLG INDICATE RESULT NOT ARRAY
  2161. EQ VARSOK2
  2162. *
  2163. ARYUSED SA3 TMPAFLG =0IF NO OPERATIONS PERFORMED
  2164. NZ X3,NOAERR NO ARRAY CALCS ALLOWED
  2165. * PROBLEM IS ARAY CALCS USE A0, ALSO USED BY GETVAR
  2166. BX3 X2 TEST ADTYPE
  2167. LX3 1 ARAYBIT AT LEFT
  2168. PL X3,NOARAY JUMP IF RESULT NOT WHOLE ARRAY
  2169. LX3 1 TEST TEMP ARAY BIT
  2170. NG X3,TEMPERR CANT USE TEMPARAY ***CHANGE***
  2171. SA3 ARAYFLG =1 IF ARAYS PERMITTED
  2172. BX7 -X3 REVERSE SIGN TO
  2173. SA7 A3 NOTIFY CALLING PGM ARRAYS FOUND
  2174. SX3 X3-1
  2175. NZ X3,NOAERR NO ARRAYS PERMITTED
  2176. MX0 -17
  2177. BX1 -X0*X2 MASK OFF ARAY AND I/F BITS
  2178. SB1 0 CAN STORE INTO 1ST ELEMENT
  2179. EQ COMPILE EXIT WITH GETVAR=6
  2180. * /--- BLOCK NOSTORE 00 000 77/02/26 13.31
  2181. *
  2182. NOSTORE SB1 1 CANT STORE INTO THIS
  2183. SA2 PUTCOMP
  2184. ZR X2,COMPILE EXIT IF NOT -PUTCOMP- CALL
  2185. EQ EQERR
  2186. LONGLIT BSS 0
  2187. RJ RLLIT (X6) = LONG LITERAL
  2188. MX0 59 MASK OUT *LITS* BIT
  2189. LX1 60-LITSHFT
  2190. BX1 X0*X1
  2191. LX1 LITSHFT
  2192. MX0 -XCODEAL
  2193. BX2 X6
  2194. ***SEE WHETHER LITERAL CAN BE EXPRESSED AS SHORT INTEGER
  2195. NG X6,LNGLIT2 SHORT LITERAL CANT BE NEGATIVE
  2196. BX3 X1 X1 HAS COMPLETE GETVAR CODE
  2197. AX3 XCODEAL+3 GET I/F BIT
  2198. ZR X3,ILNGLIT ZERO IF LONG INTEGER
  2199. UX2 X2,B1 FIX THE FLOATING LITERAL--MAY BE INTEGER
  2200. LX2 X2,B1
  2201. PX3 X2
  2202. NX3 X3
  2203. BX3 X6-X3 COMPARE REFLOATED INTEGER WITH F LITERAL
  2204. NZ X3,LNGLIT2 JUMP IF FRACTIONAL FLOATING LITERAL
  2205. BX6 X2 CALL IT A LONG INTEGER
  2206. MX3 57-XCODEAL DROP F BIT
  2207. BX1 -X3*X1
  2208. ILNGLIT BX3 X0*X6 SEE WHETHER LONG INTEGER IS IN FACT SHORT
  2209. NZ X3,LNGLIT2 JUMP IF LONGER THAN XCODEAL BITS
  2210. BX1 X6 OTHERWISE, SHORT LITERAL HAS CODE 0
  2211. EQ NOSTORE
  2212. LNGLIT2 BX0 X0*X1 SAVE CODE TYPE
  2213. RJ LSEEK PLANT LITERAL
  2214. MX1 -XCODEAL
  2215. BX0 X0*X1
  2216. BX1 X0+X6 X6 RETURNED WITH EXTRA STORAGE ADDRESS
  2217. EQ NOSTORE
  2218. *
  2219. ENDARAY SX0 B0 THIS IS LIKE ENDL2
  2220. SA1 CMOVFLG
  2221. NZ X1,COMPEND
  2222. SX7 23B
  2223. LX7 21 COMPILE JP B3
  2224. RJ LONGI LAST INSTRUCTION
  2225. RJ PAD
  2226. RJ MOVCODE AND MOVE CODE TO EXTRA STORAGE
  2227. EQ COMPEND CREATE FINAL CALC CODE
  2228. *
  2229. *
  2230. * /--- BLOCK LOGICAL 00 000 78/01/25 13.49
  2231. TITLE COMPILE LOGICAL EXPRESSIONS
  2232. *
  2233. COMPLOG SX7 B0 CLEAR FLOAT FLAG
  2234. SA7 FLOAT
  2235. SA2 NUNITS
  2236. NG X2,CMPLG0
  2237. RJ SAMEUZ LOGICAL OPERATIONS
  2238. * EXPONENTIATION JUMPS TO CMPLG0 WITH FLOAT SET....
  2239. CMPLG0 RJ PREBIN FIND OUT MODES (I OR F)
  2240. SX7 1 FLAG NOT LITERALS
  2241. SA7 NOTLITS
  2242. SX6 B3 SAVE FLOATING/INTEGER FLAG
  2243. SA6 FFLT
  2244. JP B3+COMPL B3=0,1,2,3 FOR II,IF,FI,FF ARGS
  2245. COMPL EQ CMPLOG1 BOTH ARGUMENTS INTEGERS
  2246. EQ COMPIF FIRST I, SECOND FLOATING
  2247. EQ COMPFI FIRST F, SECOND I
  2248. EQ COMPFF BOTH ARGUMENTS FLOATING
  2249. COMPIF LX0 1 FLAG FIRST OPERAND FOR MODE CHANGE
  2250. BX7 X1+X0 (PREBIN LEAVES X0 WITH I/F MASK IN IT)
  2251. SA7 A1
  2252. EQ COMPFF
  2253. COMPFI LX0 1 FLAG SECOND OPERAND FOR MODE CHANGE
  2254. BX7 X2+X0
  2255. SA7 A2
  2256. COMPFF SX7 1 FLAG FLOATING RESULT
  2257. LX7 XCODEAL+3
  2258. SA7 FLOAT
  2259. CMPLOG1 SA4 NARRAYS
  2260. NZ X4,ACMPLOG JUMP IF ARRAY OPS IN PROGRESS
  2261. CMPLGA1 SB1 2
  2262. RJ FORCEX FORCE ARG INTO X2
  2263. RJ FREEX THEN FREE THE REGISTER
  2264. * (BECAUSE WE USE ITS CONTENTS IMMEDIATELY)
  2265. CMPLOG2 SA1 NADS WORK ON FIRST ARGUMENT
  2266. SX7 X1-1
  2267. ZR X7,FORMERR ERROR IF NO OPERANDS
  2268. SA7 A1 BY DECREMENTING AD POINTER
  2269. EQ CMPF31
  2270. *
  2271. * HANDLE 2-ARG FUNCTIONS WITH ARRAY ARGUMENTS
  2272. *
  2273. ACMPLOG SA1 NADS
  2274. SA2 X1+ADS
  2275. SA3 A2-1 OPERAND ADS 1,2 IN X3,X2
  2276. BX7 X3+X2 TEST WHOLARRAY FLAG
  2277. LX7 1 IN BIT 58
  2278. PL X7,CMPLGA1 EXIT IF NEITHER IS ARRAY
  2279. * UP TO HERE SHOULD BE INLINE CODE FOR SPEED
  2280. RJ BINARY INITIALIZE AND LOAD ARRAYS
  2281. SA1 SAVEOP
  2282. SX0 X1-FUNCT0 GET FUNCTION NUMBER
  2283. RJ GENFCT GENERATE RJ FUNCTIONSUBR
  2284. SX7 10611B
  2285. RJ SHORT GENERATE CODE FOR BX6 X1
  2286. EQ ENDINSA GENERATE RJ ALOOPS
  2287. *
  2288. *
  2289. * /--- BLOCK INTCMP 00 000 77/12/18 17.03
  2290. TITLE FUNCTIONS AND SYSTEM VARIABLES
  2291. *
  2292. * HANDLE -INT- FUNCTION
  2293. *
  2294. INTCMP RJ FCCHK CHECK FOR CONSTANT
  2295. ZR X0,ICOMPF
  2296. ZR X2,INTIN JUMP IF INTEGER
  2297. BX1 X3
  2298. RJ TINTX TAKE INTEGER PART OF CONSTANT
  2299. MX4 0 RESULT IS INTEGER
  2300. *
  2301. INT10 SA2 NUNITS
  2302. PL X2,ICOMPF EXIT IF *UNITS* INVOLVED
  2303. NZ X4,INTLONG CHECK FOR FLOATING LITERAL
  2304. INTIN MX0 -XCODEAL
  2305. BX0 X0*X1
  2306. NZ X0,INTLONG STORE LONG LITERAL IN LIT TABLE
  2307. BX7 X1 0 CODE = SHORT LITERAL CALC
  2308. EQ INTBOTH
  2309. *
  2310. INTLONG BX6 X1 (X6) = LITERAL
  2311. SX1 X4+1 LONG INTEGER CALC
  2312. RJ SLLIT (X6) = ADTYPE WITH ADDRESS
  2313. BX7 X6
  2314. INTBOTH SA1 NADS
  2315. SA7 X1+ADS STORE LONG LITERAL GETVAR CODE
  2316. EQ CMPFCT3
  2317. *
  2318. * HANDLE -ROUND- FUNCTION
  2319. *
  2320. RNDCMP RJ FCCHK CHECK FOR CONSTANT
  2321. ZR X0,ICOMPF
  2322. ZR X2,INTIN JUMP IF INTEGER
  2323. BX1 X3
  2324. RJ TRND ROUND CONSTANT
  2325. MX4 0 RESULT IS INTEGER
  2326. EQ INT10
  2327. *
  2328. * HANDLE FRAC FUNCTION
  2329. *
  2330. FRACCMP RJ FCCHK CHECK FOR CONSTANT
  2331. ZR X0,COMPFCT
  2332. NZ X2,FRACTK JUMP IF FLOATING
  2333. SX1 0
  2334. EQ FRACBTH
  2335. FRACTK BX1 X3
  2336. RJ TFRACX FRACTIONAL PART OF CONSTANT
  2337. FRACBTH SX4 10B RESULT IS FLOATING
  2338. EQ INT10
  2339. * /--- BLOCK L/R MASK 00 000 77/12/19 16.43
  2340. EJECT
  2341. *
  2342. * HANDLE -LMASK- AND -RMASK- FUNCTIONS
  2343. *
  2344. LMSKCMP RJ FCCHK CHECK FOR CONSTANT
  2345. ZR X0,ICOMPF
  2346. ZR X2,LMSKCM1 JUMP IF INTEGER
  2347. BX1 X3
  2348. RJ TRND CONVERT TO INTEGER
  2349. LMSKCM1 RJ TLMASK CREATE LMASK
  2350. MX4 0 RESULT IS INTEGER
  2351. EQ INT10
  2352. *
  2353. MASKERR EQ ICOMPF IF ERROR, LET EXECUTOR GIVE IT.
  2354. *
  2355. RMSKCMP RJ FCCHK CHECK FOR CONSTANT
  2356. ZR X0,ICOMPF
  2357. ZR X2,RMSKCM1 JUMP IF INTEGER
  2358. BX1 X3
  2359. RJ TRND CONVERT TO INTEGER
  2360. RMSKCM1 RJ TRMASK CREATE RMASK
  2361. MX4 0 RESULT IS INTEGER
  2362. EQ INT10
  2363. * /--- BLOCK VARLOC 00 000 86/03/12 19.32
  2364. *
  2365. EJECT
  2366. *
  2367. * HANDLE -VARLOC- FUNCTION
  2368. *
  2369. VARLCMP RJ FCCHK CHECK FOR CONSTANT
  2370. NZ X0,VARCNST IS A CONSTANT
  2371. NG X1,VARINRG EXPRESSION/INDEXED VARIABLE
  2372. SA1 FINDXED FLAG FOR INDEXED VARIABLE
  2373. ZR X1,ICOMPF INDEXED, CREATE CALL TO TVARLOC
  2374. *
  2375. SX4 X4-1
  2376. ZR X4,VARL2 IF TYPE 3 GETVAR (COMMON)
  2377. SX1 VARLIM+1
  2378. IX1 X3-X1
  2379. NG X1,VARL2 IF STUDENT VAR
  2380. SA1 ARVARS
  2381. SA4 ASVARS
  2382. IX1 X1-X4 X4 NOW BIAS TO NR1
  2383. IX1 X3-X1
  2384. SX4 X1-RVARLIM-1
  2385. NG X4,VARCMPT
  2386. SA1 ALVARS TRY LOCAL VARS
  2387. SA4 ASVARS
  2388. IX1 X1-X4 X4 NOW BIAS TO NL1
  2389. IX1 X3-X1
  2390. SX4 X1-LVARLIM-1
  2391. NG X4,VARCMPT
  2392. EQ ICOMPF
  2393.  
  2394. VARL2 BX1 X3 X3 = THE XCODEAL BITS, INDEX
  2395. EQ VARCMPT
  2396. *
  2397. VARINRG SA1 FINDXED FLAG FOR IF INDEXED VARIABLE
  2398. ZR X1,ICOMPF INDEXED, CREATE CALL TO TVARLOC
  2399. *
  2400. VARCNST MX1 0 CONSTANT/EXPRESSION
  2401. VARCMPT MX4 0 RESULT IS INTEGER
  2402. EQ INT10
  2403. *
  2404. *
  2405. EJECT
  2406. *
  2407. * HANDLE FIP FUNCTIONS
  2408. *
  2409. FIPCMP RJ FCCHK CHECK FOR CONSTANT
  2410. NZ X0,FIPERR --- ERROR IF CONSTANT
  2411. NG X1,FIPCMP2 --- IF EXPRESSION/INDEXED VAR.
  2412. EQ ICOMPF --- CREATE FUNCTION CALL
  2413. *
  2414. FIPCMP2 SA1 FINDXED INDEXED VARIABLE FLAG
  2415. NZ X1,FIPERR --- ERROR IF EXPRESSION
  2416. EQ ICOMPF --- CREATE FUNCTION CALL
  2417. * /--- BLOCK ICMPNAM 00 000 76/12/11 01.11
  2418. EJECT
  2419. *
  2420. * HANDLE INTEGER SPL NAMES LIKE -ANSOK- -WHERE-
  2421. *
  2422. ICMPNAM SX7 B0 FLAG INTEGER RESULT
  2423. EQ CMPNAMI
  2424. *
  2425. * HANDLE FLOATING SPL NAMES -SIZE-CLOCK-PROCTIM-
  2426. *
  2427. COMPNM SX7 1 FLAG FLOATING RESULT
  2428. LX7 XCODEAL+3
  2429. CMPNAMI SA7 FLOAT
  2430. SA1 NADS
  2431. SX7 X1+1 INCREMENT NADS TO CREATE REFERENCE TO X1
  2432. SX1 X7-ADSMAX
  2433. PL X1,LNGERR ERROR IF TOO MANY ADS
  2434. SA7 A1
  2435. SB1 1 CHECK THAT REGISTER X1 IS AVAILABLE
  2436. RJ CHEKRR MOVE X1 ELSEWHERE IF NECESSARY
  2437. SA2 NUNITS
  2438. NG X2,CMPFCT2 JUMP IF NO UNITS INVOLVED
  2439. RJ UADZERO CLEAR UNITS COEFFS
  2440. * SA1 NARRAYS
  2441. * NZ X1,NOAERR NO ARRAY OPERATIONS ALLOWED YET
  2442. EQ CMPFCT2
  2443. *
  2444. *
  2445. *I/F MODE OF ARG IRRELEVANT FOR ABS(X) OR COMP(X)
  2446. IFCOMP RJ IFIRR SET FLOAT SPEC TO OPERAND MODE
  2447. SX7 B0 FLAG NOT ARRAY OPERATION
  2448. SA7 FFLT SET AS INTEGER ARGUMENT
  2449. EQ CMPF3
  2450. *
  2451. IFIRR EQ * I/F MODE IRRELEVANT
  2452. SA1 NADS GET OPERAND TYPE
  2453. SA1 X1+ADS
  2454. SX0 10B
  2455. LX0 XCODEAL I/F BIT
  2456. BX7 X0*X1
  2457. SA7 FLOAT SAVE IN FLOAT FOR RESULT I/F TYPING
  2458. EQ IFIRR
  2459. *
  2460. *
  2461. ICOMPF MX7 0 INTEGER RESULT
  2462. SA7 FLOAT
  2463. SX7 1 THEN PLACE I/F BIT MASK IN X7
  2464. LX7 XCODEAL+3
  2465. EQ CMPF1
  2466. *
  2467. *
  2468. * PROCESS SQRT(X)
  2469. SQTFCT SA2 NUNITS
  2470. NG X2,COMPFCT JUMP IF NO UNITS
  2471. SA3 =.5
  2472. RJ MULTEM UNIT DIMENSIONS TIMES .5
  2473. SQTFCT2 SX7 1 ENTRY POINT FOR X**.5
  2474. LX7 XCODEAL+3
  2475. SA7 FLOAT
  2476. SA1 NADS
  2477. SA2 X1+ADS GET OPERAND TO CHECK FOR NEEDED MODE CHANGE
  2478. BX6 X7*X2 GET FLOAT BIT
  2479. SA6 FFLT SAVE FLOAT BIT
  2480. EQ CMPF3
  2481. *
  2482. *
  2483. CONST SA3 NADS
  2484. SX7 X3+1 INCREMENT NADS
  2485. SX6 X7-ADSMAX ERROR IF TOO MANY ADS
  2486. SA7 A3
  2487. MX6 0
  2488. SA6 X7+ADS ADD ADDRESS TO ADS LIST
  2489. SA2 NUNITS
  2490. NG X2,CONST1 SEE IF *UNITS*
  2491. RJ UADZERO
  2492. EQ CONST1 'N'O'T'E'; CONSTANT CHECKED FOR SPECIAL'.
  2493. *
  2494. * /--- BLOCK ACMPF30 00 000 78/06/06 21.44
  2495. * HANDLE ONE-ARGUMENT FUNCTIONS WITH ARRAY OPERANDS
  2496. ACMPF30 SA1 NADS ENTER WITH X4=NARRAYS
  2497. SA2 X1+ADS GETVAR CODE
  2498. LX2 1 LOOK AT WHOLE-ARRAY BIT
  2499. PL X2,CMPF31 EXIT IF NOT ARRAY
  2500. LX2 59 RESTORE GETVARCODE
  2501. MX0 -XCODEAL
  2502. BX2 -X0*X2 GET ARRAYWD ADDR
  2503. SA2 X2+INFO GET ARRAYWD
  2504. BX7 X2
  2505. SA7 ASIZE SAVE FOR CALCTMP
  2506. BX6 -X4
  2507. SA6 NARRAYS - FOR ALOOPS FLAG
  2508. SB1 0 REUSE TMPARRAY
  2509. RJ CALCTMP
  2510. RJ ARYPREP CLEAR X1,2,6, FORM RJ ABUFCHK
  2511. SB1 RAINIT
  2512. RJ LDAINIT GENERATE ALOOP INITIALIZATION
  2513. SB1 1
  2514. RJ LDARRAY GENERATE LOAD OPERAND TO X1
  2515. SA1 SAVEOP
  2516. SX0 X1-FUNCT0 GET FUNCTION NUMBER
  2517. RJ GENFCT GENERATE RJ FUNCTION
  2518. SX7 10611B
  2519. RJ SHORT GENERATE CODE FOR BX6 X1
  2520. RJ TMPAD CHANGE ADTYPE TO TEMP ARRAY
  2521. PLATO
  2522. SA1 PRELEX
  2523. NG X1,ENDINSA QUIT IF REGULAR LEX CALL
  2524. SA1 NCOMPIL MAKESURE COMPIL HAS RJ LEX
  2525. BX7 X1
  2526. SA7 COMPIL
  2527. ENDIF
  2528. EQ ENDINSA GO DO ALOOP
  2529. *
  2530. *
  2531. * HANDLE ONE-ARGUMENT FUNCTION CALLS
  2532. *
  2533. COMPFCT SX7 1 FLAG AS FLOATING RESULT
  2534. LX7 XCODEAL+3
  2535. SA7 FLOAT
  2536. CMPF1 SA1 NADS
  2537. SA2 X1+ADS GET OPERAND TO CHECK FOR NEEDED MODE CHANGE
  2538. BX6 X7*X2 GET FLOAT BIT
  2539. SA6 FFLT SAVE FLOAT BIT
  2540. SA2 NUNITS
  2541. NG X2,CMPF3 JUMP IF NO UNITS
  2542. RJ ZEROU CHECK FOR ZERO UNIT COEFFS
  2543. *
  2544. CMPF3 SA1 INHAND RESTORE CORRECT INHAND PRECEDENCE LEVEL
  2545. SA1 X1+PRECED BECAUSE WE MAY BE COMPILING
  2546. BX7 X1 A PARENS-LESS FUNCTION.
  2547. SA7 INHANDL (SEE -ISFUNCT- CODE ABOVE)
  2548. SA4 NARRAYS
  2549. NZ X4,ACMPF30 JUMP IF ARRAY OPS IN PROGRESS
  2550. CMPF31 SB1 1
  2551. RJ FORCEX FORCE ARG INTO X1
  2552. CMPFCT2 RJ SETAD SET AD REFERENCE IN ADS LIST
  2553. CONST1 SA1 SAVEOP
  2554. SX0 X1-FUNCT0 GET FUNCTION NUMBER
  2555. RJ GENFCT GENERATE CODE TO LOAD FN TO X1
  2556. CMPFCT3 BSS 0
  2557. PLATO
  2558. SA1 PRELEX
  2559. NG X1,ENDINST JUMP IF PREAD AND PREOP CONTAIN INFO
  2560. SA1 NCOMPIL ELSE INSURE LOCATION COMPIL CONTAINS RJ LEX
  2561. BX7 X1
  2562. SA7 COMPIL
  2563. ENDIF
  2564. EQ ENDINST
  2565. * /--- BLOCK ARAYFN 00 000 77/12/19 16.51
  2566. EJECT
  2567. *
  2568. * SCALAR RESULT ARRAY FUNCTIONS
  2569. *
  2570. ARAYFN SA1 NADS
  2571. SA2 X1+ADS OPERAND ADTYPE
  2572. MX0 -XCODEAL
  2573. MX7 1
  2574. LX7 XCODEAL+4 I/F BIT MASK
  2575. BX7 X7*X2 I/F BIT OF OPERAND
  2576. SA7 FLOAT SAVE IT FOR SETAD
  2577. BX6 -X0*X2
  2578. LX2 1
  2579. PL X2,NOTARFN
  2580. SA1 X6+INFO GET ARRAYWD
  2581. BX6 X1
  2582. SA6 ASIZE SAVE IT
  2583. *
  2584. SA3 SAVEOP
  2585. SX6 X3-ASUMOP GET RELATIVE ARAYFN NUMBER
  2586. IX6 X6+X6 INTEGER ARAYFN TYPE
  2587. ZR X7,ARAYF10 JUMP IF INTEGER TYPE
  2588. SX6 X6+1 ADD 1 TO TYPE NUM IF FLOATING
  2589. ARAYF10 SA6 IOP SAVE TYPE
  2590. NG X6,COMPERR
  2591. SX6 X6-12 ONLY ARAYFNTYPES 0-11 LEGAL YET
  2592. PL X6,COMPERR
  2593. RJ ARYPREP CLEAR X1,2,6, FORM RJ ABUFCHK
  2594. * /--- BLOCK ARAYFN10 00 000 76/07/29 00.06
  2595. SA1 ASIZE GET BACK ARRAYWD
  2596. LX1 3
  2597. PL X1,ARAYF20 JUMP IF NOT SEGMENTED ARRAY
  2598. *
  2599. RJ ASEGTMP CHANGE SEG ARRAY TO REAL TEMP.
  2600. *
  2601. ARAYF20 SA1 IOP GET TYPE
  2602. SX7 6120B SB2 B0+...
  2603. LX7 18
  2604. BX7 X7+X1
  2605. RJ LONGI GENERATE SB2 (ARAYFN TYPE)
  2606. *
  2607. SA1 NADS
  2608. SA1 X1+ADS ARRAY ADTYPE
  2609. RJ GETARAD X3=ARAYSTART ADDR
  2610. *
  2611. SX7 5100B
  2612. LX7 18
  2613. BX7 X7+X3
  2614. RJ LONGI GENERATE SA0(ARAY ADDR)
  2615. SA1 ASIZE GET BACK ARRAYWORD
  2616. MX0 -9
  2617. AX1 45
  2618. BX1 -X0*X1 SIZE FIELD
  2619. SX7 6110B SB1 B0+...
  2620. LX7 18
  2621. BX7 X7+X1
  2622. RJ LONGI GENERATE SB1 SIZE
  2623. SB1 RARAYFN
  2624. RJ LDASUB GENERATE RJ ARAYFN
  2625. RJ SETAD RESULT LEFT IN X1
  2626. SA1 NARRAYS
  2627. SX7 X1+1
  2628. SA7 NARRAYS INCREMENT NUMBER ARRAY OPNS
  2629. EQ CMPFCT3
  2630. *
  2631. NOTARFN SB1 1 IS SCALAR OPERAND
  2632. RJ FORCEX RETURN RESULT=OPERAND
  2633. RJ SETAD IN X1
  2634. EQ CMPFCT3
  2635. *
  2636. * NEXT SUBROUTINE CONVERTS SEGMENTED TO TEMPORARY REALARRAY
  2637. *
  2638. ASEGTMP EQ * (SET ASIZE=ARAYWD BEFORE ENTRY)
  2639. SB1 RAINIT GENERATE RJ AINIT
  2640. RJ LDAINIT
  2641. SB1 1 GENERATE CODE TO LOAD AND
  2642. RJ LDARRAY CONVERT SEG ARAY TO INTEGER
  2643. SB1 1
  2644. RJ CALCTMP FORCE NEW TMPARRAY ADDRESS
  2645. RJ TMPAD FORM NEW TMPARRAYWD AND ADTYPE
  2646. SX7 10611B GENERATE BX6 X1
  2647. RJ SHORT
  2648. SA1 TMPARAY STORE ADDRESS
  2649. RJ LDALOOP
  2650. * NOTE...DONT HAVE TO RJ AIFBIT SINCE RESULT IS INTEGER
  2651. RJ LDAINTR GENERATE TIMESLICE CHECK
  2652. EQ ASEGTMP
  2653. *
  2654. * /--- BLOCK ARAYTRSP 00 000 76/07/29 01.19
  2655. *
  2656. ATRANSP SX7 4 'TRANSP('A) TYPE FOR DOTMULT
  2657. SA7 IOP SAVE IT
  2658. ATRA2 SA1 NADS
  2659. SA2 X1+ADS OPERAND ADTYPE
  2660. LX2 1 TEST WHOLEARRAY BIT
  2661. PL X2,NOTATRA JUMP IF SCALAR
  2662. LX2 59
  2663. MX0 -XCODEAL
  2664. BX1 -X0*X2
  2665. SA2 X1+INFO ARRAY INFO WORD
  2666. **
  2667. BX7 X2
  2668. LX7 3
  2669. PL X7,ATRA3 JUMP IF NOT SEGMENTED
  2670. BX7 X2
  2671. SA7 ASIZE SAVE IT FOR CALCTMP
  2672. RJ ARYPREP CLEAR X1,X2,X6, FORM RJ ABUFCHK
  2673. RJ ASEGTMP CONVERT SEG ARAY TO REAL TEMP
  2674. SA2 ASIZE RESTORE INFO
  2675. **
  2676. ATRA3 BX0 X2 SAVE IT
  2677. MX6 -9
  2678. AX2 27
  2679. BX4 -X6*X2 COLS
  2680. AX2 9
  2681. BX7 -X6*X2 ROWS
  2682. AX2 9
  2683. BX6 -X6*X2 SIZE
  2684. MX3 -18
  2685. LX3 27 ROWCOL MASK
  2686. SB1 5
  2687. SA1 IOP FN TYPE
  2688. SB3 X1
  2689. EQ B3,B1,DOTM21 JUMP IF REV(X)
  2690. BX0 X3*X0 CLEAR OUT ROW/COL
  2691. BX1 X4
  2692. LX1 9
  2693. BX1 X1+X7
  2694. LX1 27
  2695. BX0 X1+X0 RESULT HAS COLS/ROWS REVERSED
  2696. EQ DOTM21 GENERATE CALL TO DOTPROD
  2697. *
  2698. ATRACE EQ TSTERR TRACE
  2699. *
  2700. AREVERS SX7 5 'REV('A) TYPE FOR DOTPROD
  2701. SA7 IOP SAVE IT
  2702. EQ ATRA2
  2703. *
  2704. NOTATRA MX0 1
  2705. LX0 XCODEAL+4 I/F BIT MASK
  2706. LX2 59 RESTORE ADTYPE
  2707. BX7 X0*X2 OPERAND I/F TYPE
  2708. SA7 FLOAT SAVE FOR SETAD
  2709. EQ NOTARFN RESULT=OPERAND
  2710. * /--- BLOCK INDEXEDVAR 00 000 78/09/19 20.26
  2711. TITLE INDEXED VARIABLES
  2712. *
  2713. * DESPITE THE LABELS, THIS BLOCK OF CODE CONCERNS
  2714. * INDEXED VARIABLES, NOT REAL/COMPLEX ARRAYELEMENTS
  2715. * SEE *ISARRAY* *MATRAY* ETC FOR THOSE
  2716. *
  2717. *
  2718. ARAYN EQ * RETURN WITH LITERAL INDEX
  2719. MX6 59
  2720. SA6 FINDXED FLAG NON-INDEXED VARIABLE
  2721. *INDEX RETURNED IN X6 (NEGATIVE IF NOT LITERAL)
  2722. SA2 NUNITS
  2723. NG X2,ARAYN1
  2724. RJ ZEROU CHECK FOR ZERO UNIT COEFFS
  2725. ARAYN1 SA1 NADS CHECK FOR LITERAL
  2726. SA2 X1+ADS
  2727. BX6 X2 A COPY OF GETVAR CODE
  2728. NG X2,ARAYN3 NOT LITERAL IF IN REGISTER
  2729. AX2 XCODEAL SHIFT OUT GETVAR ADDRESS
  2730. ZR X2,ARAYN IF SHORT LITERAL, EXIT WITH INDEX IN X6
  2731. MX1 -4 ISOLATE TYPE CODE
  2732. BX2 -X1*X2
  2733. SX7 X2-1
  2734. NZ X7,ARAYN2 JUMP IF NOT LONG INTEGER
  2735. BX1 X6
  2736. RJ RLLIT (X6) = LITERAL
  2737. NG X6,VARERR
  2738. EQ ARAYN
  2739. ARAYN2 SX7 X2-11B CHECK FOR FLOATING LITERAL
  2740. NZ X7,ARAYN3 JUMP IF NOT FLOATING LITERAL
  2741. BX1 X6
  2742. RJ RLLIT (X6) = LONG LITERAL
  2743. NG X6,VARERR
  2744. SA3 =.5 ROUND THE FLOATING LITERAL
  2745. FX6 X6+X3
  2746. UX6 X6,B2 FIX THE FLOATING LITERAL
  2747. LX6 X6,B2 LEAVE IN X6
  2748. EQ ARAYN RETURN INDEX IN X6
  2749. ARAYN3 LX6 1 WHOLE-ARRAY BIT AT TOP
  2750. NG X6,NOAERR INDEX CANT BE WHOLE-ARRAY
  2751. MX6 59 SET X6 NEGATIVE TO SIGNAL NOT LITERAL
  2752. EQ ARAYN
  2753. *
  2754. *
  2755. ARYII RJ ARAYN CHECK FOR LITERAL INDEX
  2756. SA0 VARLIM STUDENT VAR LIMIT
  2757. SA1 ASVARS
  2758. BX7 X1 ADDRESS OF STUDENT BANK VARS
  2759. SA7 IOP
  2760. NG X6,IARRAY JUMP IF NOT LITERAL INDEX
  2761. SX7 2 STUDENT BANK INTEGER
  2762. ARYV LX7 XCODEAL
  2763. BX7 X7+X6
  2764. SA7 A2 REPLACE ADS REFERENCE (A2 SET BY ARAYN)
  2765. CALL VBOUND CHECK STUDENT BANK BOUNDS
  2766. EQ ENDINST VBOUND WILL EXIT TO VARERR IF NO GOOD
  2767. *
  2768. ARYFI RJ ARAYN CHECK FOR LITERAL INDEX
  2769. SA0 VARLIM STUDENT VAR LIMIT
  2770. SA1 ASVARS
  2771. BX7 X1 ADDRESS OF STUDENT BANK VARS
  2772. SA7 IOP
  2773. NG X6,FARRAY JUMP IF NOT LITERAL INDEX
  2774. SX7 12B STUDENT BANK FLOATING
  2775. EQ ARYV
  2776. *
  2777. * /--- BLOCK RARRAY 00 000 79/02/09 12.09
  2778. *
  2779. ARYCII RJ ARAYN CHECK FOR LITERAL INDEX
  2780. SA0 NCVRLIM INDEX LIMIT
  2781. SA1 ACVARS
  2782. BX7 X1 ADDRESS OF COMMON VARS
  2783. SA7 IOP
  2784. NG X6,IARRAY JUMP IF NOT LITERAL INDEX
  2785. SX7 3 COMMON INTEGER
  2786. ARYC LX7 XCODEAL
  2787. BX7 X7+X6
  2788. SA7 A2 REPLACE ADS REFERENCE (A2 SET BY ARAYN)
  2789. CALL CBOUND CHECK STUDENT BANK BOUNDS
  2790. EQ ENDINST CBOUND WILL EXIT TO VARERR IF NO GOOD
  2791. *
  2792. ARYCFI RJ ARAYN CHECK FOR LITERAL INDEX
  2793. SA0 NCVRLIM INDEX LIMIT
  2794. SA1 ACVARS
  2795. BX7 X1 ADDRESS OF COMMON VARS
  2796. SA7 IOP
  2797. NG X6,FARRAY JUMP IF NOT LITERAL INDEX
  2798. SX7 13B COMMON FLOATING
  2799. EQ ARYC
  2800. *
  2801. *
  2802. RARRAY RJ ARAYN CHECK FOR LITERAL INDEX
  2803. SA1 ARVARS
  2804. BX7 X1 ADDRESS OF R-VARIABLES
  2805. SA7 IOP
  2806. SA1 RVARL GET NUMBER OF R-VARIABLES
  2807. SA0 X1
  2808. NG X6,IARRAY JUMP IF NOT LITERAL INDEX
  2809. MX7 0
  2810. SA7 FLOAT MARK AS INTEGER
  2811. SA7 FINDXED FLAG EXECUTION TIME VARIABLE
  2812. *
  2813. NRK CALL RBOUND CHECK BOUNDS
  2814. SA1 ASVARS COMPUTE BIAS TO R-VARS
  2815. SA3 ARVARS
  2816. IX1 X3-X1
  2817. IX6 X1+X6 ADD BIAS TO INDEX
  2818. SX7 2
  2819. LX7 XCODEAL TYPE 2 = STUDENT BANK
  2820. SA1 FLOAT
  2821. BX7 X1+X7 MERGE I/F BIT AND TYPE
  2822. BX7 X6+X7 ATTACH ADDRESS
  2823. SA1 NADS
  2824. SA7 X1+ADS REPLACE ENTRY IN ADDRESS STACK
  2825. EQ ENDINST
  2826. *
  2827. RFARRAY RJ ARAYN CHECK FOR LITERAL INDEX
  2828. SA1 ARVARS
  2829. BX7 X1 ADDRESS OF R-VARIABLES
  2830. SA7 IOP
  2831. SA1 RVARL GET NUMBER OF R-VARIABLES
  2832. SA0 X1
  2833. NG X6,FARRAY JUMP IF NOT LITERAL INDEX
  2834. MX7 0
  2835. SA7 FINDXED FLAG EXECUTION TIME VARIABLE
  2836. SX7 1
  2837. LX7 XCODEAL+3 MARK AS FLOATING
  2838. SA7 FLOAT
  2839. EQ NRK
  2840. LARRAY RJ ARAYN CHECK FOR LITERAL INDEX
  2841. SA1 ALVARS
  2842. BX7 X1 ADDRESS OF L-VARIABLES
  2843. SA7 IOP
  2844. SA1 LVARN X1 = NUMBER OF L-VARIABLES
  2845. SA0 X1
  2846. NG X6,IARRAY JUMP IF NOT LITERAL INDEX
  2847. *
  2848. MX7 0
  2849. SA7 FLOAT MARK AS INTEGER
  2850. SA7 FINDXED FLAG EXECUTION TIME VARIABLE
  2851. *
  2852. * /--- BLOCK RARRAY 00 000 78/09/19 20.28
  2853. NLK RJ =XLBOUND CHECK BOUNDS
  2854. SA1 ASVARS COMPUTE BIAS TO L-VARS
  2855. SA3 ALVARS
  2856. IX1 X3-X1
  2857. IX6 X1+X6 ADD BIAS TO INDEX
  2858. SX7 2
  2859. LX7 XCODEAL TYPE 2 = N(I) REFERENCE
  2860. SA1 FLOAT
  2861. BX7 X1+X7 MERGE I/F BIT AND TYPE
  2862. BX7 X6+X7 ATTACH ADDRESS
  2863. SA1 NADS
  2864. SA7 X1+ADS REPLACE ENTRY IN ADDRESS STACK
  2865. EQ ENDINST
  2866. *
  2867. LFARRAY RJ ARAYN CHECK FOR LITERAL INDEX
  2868. SA1 ALVARS
  2869. BX7 X1 ADDRESS OF L-VARIABLES
  2870. SA7 IOP
  2871. SA1 LVARN X1 = NUMBER OF L-VARIABLES
  2872. SA0 X1
  2873. NG X6,FARRAY JUMP IF NOT LITERAL INDEX
  2874. *
  2875. MX7 0
  2876. SA7 FINDXED FLAG EXECUTION TIME VARIABLE
  2877. SX7 1 MARK AS FLOATING
  2878. LX7 XCODEAL+3
  2879. SA7 FLOAT
  2880. EQ NLK
  2881. *
  2882. * /--- BLOCK IARRAY 00 000 79/02/09 12.10
  2883. *
  2884. IARRAY SX7 B0 INTEGER INDEXED VARIABLE
  2885. EQ SCARRAY
  2886. FARRAY SX7 1 FLOATING INDEXED VARIABLE
  2887. LX7 XCODEAL+3 FORM FLOAT BIT
  2888. SCARRAY SA7 FLOAT FLOAT=0/1 FOR I/F
  2889. SB1 1 STUDENT OR COMMON ARRAY
  2890. RJ GENREAD READ INDEX INTO X1
  2891. RJ FREEX FREE REGISTER WHICH NOW HOLDS INDEX
  2892. MX6 0
  2893. SA6 FINDXED FLAG INDEXED VARIABLE IN X1
  2894. SA1 NADS DETERMINE WHETHER INDEX IS I OR F
  2895. SA1 X1+ADS GET OPERAND
  2896. LX1 59-XCODEAL-3 SHIFT I/F BIT INTO SIGN BIT
  2897. PL X1,SCARAY2 JUMP IF INTEGER INDEX
  2898. RJ INDXFLT ROUND INDEX
  2899. *
  2900. SCARAY2 SX7 B1 CONSTRUCT -SB1 XN- (INDEX IS IN XN)
  2901. LX7 3
  2902. SX7 X7+63100B FORM SB1 XN+B0
  2903. RJ SHORT SHORT PRESERVES B1
  2904. SX7 A0 VARLIM OR NCVRLIM--INDEX LIMIT
  2905. SX6 612B FORM SB2 VARLIM OR SB2 NCVRLIM
  2906. LX6 21
  2907. BX7 X6+X7 30-BIT INSTRUCTION
  2908. RJ LONGI
  2909. SA1 LLAERR ADDRESS OF -ARAYERR-
  2910. SX6 0601B GE B0,B1,ARAYERR
  2911. LX6 18
  2912. BX7 X1+X6
  2913. RJ LONGI
  2914. SA1 LLAERR ADDRESS OF -ARAYERR-
  2915. SX6 0721B LT B2,B1,ARAYERR
  2916. LX6 18
  2917. BX7 X6+X1
  2918. RJ LONGI
  2919. SA1 IOP PICK UP BASE VARIABLE ADDRESS
  2920. SX7 5111B
  2921. LX7 18 FORM A SA1 B1+K
  2922. BX7 X1+X7
  2923. RJ LONGI
  2924. SA1 FLOAT
  2925. SX7 4 FLAG ARRAY AS TYPE 4 GETVAR CODE
  2926. LX7 XCODEAL
  2927. BX7 X1+X7
  2928. SA7 A1 SETAD WILL MERGE FLOAT WITH SIGN BIT
  2929. RJ SETAD SET AD REFERENCE
  2930. EQ ENDINST
  2931. *
  2932. * /--- BLOCK SEGMENT 00 000 77/12/18 17.17
  2933. TITLE SEGMENT INDEXING
  2934. * PRE-CHECK TO SEE IF SEGMENT WILL BE STORED INTO
  2935. *
  2936. SEGRAY SB2 SEGRAY1
  2937. RJ NESTCHK
  2938. EQ SEGPUT
  2939. *
  2940. * SUBROUTINE TO CHECK IF NESTED SEG/ARRAY OPS
  2941. * B2 CONTAINS NESTED EXIT, B1 SAVES OP
  2942. NESTCHK EQ * EXITS HERE IF NOT NESTED
  2943. SA1 INHAND LOAD FORCING OPERATOR
  2944. SX7 X1-OPASIGN
  2945. NZ X7,PARCHK JUMP IF NOT ASSIGN
  2946. SA1 NOPS
  2947. SX1 X1-1 BACK UP TO PREVIOUS OP
  2948. ZR X1,NESTCHK ASSIGN INTO IF THIS IS LAST OP
  2949. SA1 X1+OPS
  2950. SX2 X1-OPSEG CHECK FOR NESTING
  2951. ZR X2,NESTOUT JUMP OUT IF NESTED ARRAY/SEG
  2952. SX2 X1-OPMAT
  2953. ZR X2,NESTOUT
  2954. SX2 X1-OPVEC
  2955. ZR X2,NESTOUT
  2956. SX2 X1-OPSCAL
  2957. ZR X2,NESTOUT
  2958. SX2 X1-ARAYOP
  2959. ZR X2,NESTOUT
  2960. SX2 X1-ARAYOP-1
  2961. ZR X2,NESTOUT
  2962. SX2 X1-CARAYOP
  2963. ZR X2,NESTOUT
  2964. SX2 X1-CARAYOP-1
  2965. ZR X2,NESTOUT
  2966. SX2 X1-RARAYOP
  2967. ZR X2,NESTOUT
  2968. SX2 X1-RARAYOP-1
  2969. ZR X2,NESTOUT
  2970. SX2 X1-LARAYOP
  2971. ZR X2,NESTOUT
  2972. SX2 X1-LARAYOP-1
  2973. ZR X2,NESTOUT
  2974. SB2 B0 FLAG TO MARK ASSIGNED INTO
  2975. EQ NESTCHK
  2976. * CHECK FOR (SEG) OR (ARRAY)
  2977. PARCHK SX7 X1-OP) INSIDE NESTED PARENS
  2978. NZ X7,NESTOUT JUMP IF NO RT PAREN
  2979. SA1 NOPS
  2980. SX1 X1-1 BACK UP TO PREVIOUS OPERATOR
  2981. ZR X1,BADPAR UNBALANCED PARENS IF NO OP
  2982. SA2 X1+OPS LOAD PREVIOUS OPERATOR
  2983. SX2 X2-OP(
  2984. NZ X2,NESTOUT EXIT IF NOT LEFT PAREN
  2985. SX6 B1 OP WAS IN B1(ALSO IN SAVEOP)
  2986. SA6 X1+OPS MOVE BACK -ARRAY- OPCODE
  2987. SA3 X1+OPSL+1 LOAD ARRAY PRECEDENCE
  2988. BX6 X3
  2989. SA6 X1+OPSL MOVE BACK ARRAY PRECEDENCE
  2990. SA6 PREVOPL
  2991. BX7 X1 UPDATE *NOPS*
  2992. SA7 A1
  2993. SA1 TOPCNT
  2994. SX6 X1-2 DECREMENT *OPCNT* FOR ()
  2995. SA6 A1
  2996. MX6 0
  2997. SA6 LASTOP FOR UNARY + AND - CHECKS
  2998. EQ COMPIL
  2999. *
  3000. NESTOUT JP B2 GO COMPILE SEG/ARRAY
  3001. *
  3002. * /--- BLOCK SEGMENT 00 000 78/09/15 17.05
  3003. *
  3004. * COMPILE CODE TO LOAD SEGMENT TO X1
  3005. *
  3006. SEGRAY1 MX7 0 SET FOR INTEGER
  3007. SA7 FLOAT
  3008. SA1 NADS
  3009. SX7 X1-1 MUST BE TWO ADDRESSES
  3010. NG X7,SEGERR
  3011. ZR X7,SEGERR
  3012. MX0 -XCODEAL
  3013. SA2 X7+ADS LOAD ADTYPE OF INFO WORD
  3014. BX0 -X0*X2 MASK OFF ADDRESS OF LITERAL
  3015. SA2 X0+INFO LOAD SEGMENT INFO WORD
  3016. BX6 X2
  3017. SA6 SEGWD
  3018. LX6 2 POSITION -VERTICAL- BIT
  3019. NG X6,SEGVERT
  3020. *
  3021. CONDEN
  3022. SA1 X1+ADS LOAD INDEX ADTYPE
  3023. BX2 X1
  3024. AX2 XCODEAL POSITION TYPE CODE
  3025. ZR X2,SCONST TREAT CONSTANT INDEX SPECIALLY
  3026. ENDIF
  3027. *
  3028. SEG05 SB1 1 READ INDEX TO X1
  3029. RJ FORCEX
  3030. SA1 NADS
  3031. SX7 X1-1 BACK UP IN ADDRESS STACK
  3032. SA7 A1
  3033. SA1 X1+ADS SEE IF INDEX IS I OR F
  3034. LX1 59-XCODEAL-3
  3035. PL X1,SEG10 JUMP IF INTEGER INDEX
  3036. RJ INDXFLT ROUND FLOATING TO INTEGER
  3037. *
  3038. SEG10 RJ LDLITAD GENERATE (SB1 SEG LITWD ADDR)
  3039. SA1 LLSEGI RJ ADDRESS
  3040. SX7 0100B
  3041. LX7 18 POSITION RJ OPERATION CODE
  3042. BX7 X1+X7 GENERATE RJ SEGMNTI
  3043. RJ LONGI
  3044. RJ PAD
  3045. * SCONST COMES HERE TOO...
  3046. SEG20 SX7 1 SET UP GETVAR CODE FOR LITERAL
  3047. LX7 14
  3048. SA7 FLOAT
  3049. RJ SETAD CHANGE SEGMENT ENTRY TO LITERAL
  3050. MX6 0
  3051. SA6 FINDXED FLAG INDEXED VARIABLE *SIGH*
  3052. EQ ENDINST
  3053. * /--- BLOCK SEGMENT 00 000 77/12/18 17.19
  3054. TITLE GENERATE CODE FOR CONSTANT INDEX CASE
  3055. *
  3056. * PRODUCE CODE FOR LOAD OF CONSTANT INDEX CASE
  3057. *
  3058. CONDEN
  3059. SCONST SA2 NADS
  3060. SX7 X2-1 BACK UP IN ADDRESS STACK
  3061. SA7 A2
  3062. SX1 X1-1 COMPUTE INDEX
  3063. NG X1,VARERR
  3064. PX7 X1 CONVERT INDEX TO FLOATING
  3065. NX7 X7
  3066. SA3 =0.01 AVOID ROUND-OFF ERROR
  3067. FX3 X3+X7
  3068. NX3 X3
  3069. SA2 SEGWD LOAD SEGMENT INFO WORD
  3070. SX7 X2 PICK OFF BYTES/WORD
  3071. PX6 X7
  3072. NX6 X6 CONVERT TO FLOATING
  3073. FX3 X3/X6 COMPUTE WORD COUNT
  3074. UX3 X3,B2
  3075. LX3 X3,B2 X3 = WORD COUNT
  3076. DX7 X3*X7
  3077. IX7 X1-X7 X7 = REMAINDER
  3078. SA7 SEGWD1
  3079. AX2 18 BIAS TO START OF ARRAY
  3080. SX6 X2
  3081. IX6 X3+X6 COMPUTE INDEX
  3082. PL X2,SCSVAR STUDENT BANK OR ROUTER VARIABLE
  3083. CALL CBOUND CHECK AGAINST COMMON BOUNDS
  3084. SA1 ACVARS BASE ADDRESS FOR COMMON
  3085. EQ SCSA1
  3086. *
  3087. SCSVAR SB1 X2-VARLIM-1 CHECK BASE ADDRESS
  3088. PL B1,SCRVAR JUMP IF ROUTER VARIABLE
  3089. CALL VBOUND CHECK STUDENT BANK BOUNDS
  3090. EQ SCSTUD
  3091. *
  3092. SCRVAR SA1 ASVARS ADDRESS OF STUDENT VARIABLES
  3093. SA3 ARVARS ADDRESS OF ROUTER VARIABLES
  3094. IX1 X3-X1
  3095. BX7 X6 SAVE ADDRESS REL TO STUDENT
  3096. IX6 X6-X1 SUBTRACT OFF R-VARIABLE BIAS
  3097. SB1 X6-RVARLIM-1 CHECK BASE ADDRESS
  3098. PL B1,SCLVAR JUMP IF LOCAL VARIABLE
  3099. *
  3100. CALL RBOUND CHECK ROUTER VARIABLE BOUNDS
  3101. BX6 X7
  3102. EQ SCSTUD
  3103. *
  3104. SCLVAR SA1 ASVARS ADDRESS OF STUDENT VARIABLES
  3105. SA3 ALVARS ADDRESS OF LOCAL VARIABLES
  3106. IX1 X3-X1
  3107. BX6 X7 RESTORE ADDRESS REL TO STUDENT
  3108. IX6 X6-X1 X6 = LOCAL BANK INDEX
  3109. RJ =XLBOUND CHECK LOCAL VARIABLE BOUNDS
  3110. BX6 X7
  3111. EQ SCSTUD
  3112. *
  3113. *
  3114. * /--- BLOCK SEGVERT 00 000 78/01/25 16.20
  3115. *
  3116. SCSTUD SA1 ASVARS BASE ADDRESS FOR STUDENT/ROUTER
  3117. *
  3118. SCSA1 IX6 X1+X6 ABSOLUTE ADDRESS TO LOAD
  3119. SA6 IOP
  3120. SB1 1 OBTAIN READ REGISTER
  3121. RJ CHEKRR
  3122. SX7 1 MARK REGISTER IN USE
  3123. SA7 B1+RX
  3124. SX6 B1 SAVE REGISTER NUMBER
  3125. SA6 FREG
  3126. LX6 3 POSITION REGISTER NUMBER
  3127. SX7 X6+5100B GENERATE A SAN B0+K
  3128. SA1 IOP
  3129. LX7 18 POSITION INSTRUCTION CODE
  3130. BX7 X1+X7 ATTACH ADDRESS PORTION
  3131. RJ LONGI
  3132. *
  3133. SA1 SEGWD
  3134. LX1 1 SIGNED BIT
  3135. NG X1,SCSA2 SKIP IF SIGNED SEGMENT
  3136. SB1 2
  3137. RJ CHEKRR RESERVE X2 FOR MASK
  3138. SX7 1
  3139. SA7 B1+RX MARK BUSY
  3140. SA1 SEGWD
  3141. LX1 1 GET INFO WORD BACK
  3142. SCSA2 AX1 18+18+1
  3143. SX3 X1 PICK OFF BITS/BYTE COUNT
  3144. SB2 X1
  3145. SA2 SEGWD1 LOAD BYTE INDEX
  3146. DX6 X2*X3 SHIFT COUNT TO LEFT-JUSTIFY
  3147. SB1 X6
  3148. EQ SEGVER3 GENERATE CODE TO EXTRACT SEGMT
  3149. *
  3150. ENDIF
  3151. * /--- BLOCK SEGVERT 00 000 78/01/25 14.09
  3152. TITLE GENERATE CODE TO LOAD VERTICAL SEGMENT
  3153. *
  3154. * COMPILE CODE TO LOAD VERTICAL SEGMENT
  3155. *
  3156. SEGVERT RJ VSINDX GENERATE CODE TO LOAD INDEX
  3157. SA1 NADS
  3158. SX6 X1-1 BACK UP IN ADDRESS STACK
  3159. SA6 A1
  3160. SA1 SEGWD LOAD SEGMENT INFO WORD
  3161. LX1 1 PUTS SIGNBIT AT LEFT
  3162. NG X1,SEGVER2 SKIP IF SIGNED
  3163. SB1 2
  3164. RJ CHEKRR RESERVE X2 FOR MASK
  3165. SX7 1
  3166. SA7 B1+RX MARK BUSY
  3167. SEGVER2 SA1 SEGWD HERE WE GO AGAIN
  3168. SB1 X1-1 STARTBIT-1 = LEFTJUSTIFY SHIFT
  3169. LX1 1 PUTS SIGNBIT AT LEFT
  3170. AX1 18+18+1 POSITION BITS / BYTE COUNT
  3171. SB2 X1 BITS/BYTE
  3172. SEGVER3 SA0 112B SPECIFY MASKREG=X2, WORD REG=X1
  3173. *
  3174. RJ VREAD GENERATE VERTSEG EXTRACT CODE
  3175. *
  3176. * HERE, IF THE SEGMENT WAS SIGNED, X2 DIDN'7T GET CHECKED.
  3177. * THIS MAY CAUSE A PROBLEM SOMEDAY, AND TRYING TO HELP...
  3178. SB1 2
  3179. RJ FREEX RELEASE MASK REGISTER
  3180. EQ SEG20
  3181. *
  3182. * /--- BLOCK SVCONST 00 000 79/02/09 12.11
  3183. CONDEN
  3184. TITLE GENERATE CODE FOR CONSTANT VERTICAL SEGMENT
  3185. *
  3186. * PRODUCE CODE FOR CONSTANT INDEX VERTICAL SEGMENT
  3187. *
  3188. SVCONST ZR X2,VARERR ERROR IF INDEX ZERO
  3189. SB1 X2-1
  3190. SA3 SEGWD LOAD SEGMENT INFO WORD
  3191. AX3 18 POSITION BASE ADDRESS
  3192. SX6 X3+B1 INDEX + RELATIVE BASE ADDRESS
  3193. NG X3,SVCC JUMP IF -NC- VARIABLE
  3194. SA1 ASVARS
  3195. IX7 X1+X6 COMPUTE ABSOLUTE ADDRESS
  3196. SA7 SEGWD1
  3197. SB2 X3-VARLIM-1
  3198. PL B2,SVCR JUMP IF -NR- VARIABLE
  3199. SX1 VARLIM SET END TEST
  3200. EQ SVC100
  3201. *
  3202. SVCR IX3 X3+X1 CM ADDR OF BASE
  3203. SA2 ARVARS CM ADDR OF RVARS
  3204. IX2 X3-X2 NR INDEX
  3205. SB2 X2-RVARLIM-1
  3206. PL B2,SVCL IF COULD BE IN LOCAL VAR BANK
  3207. *
  3208. SA1 RVARL X1 = MAX RVAR INDEX
  3209. SX6 X2+B1 X6 = RVAR INDEX
  3210. EQ SVC100
  3211. *
  3212. SVCL SA2 ALVARS CM ADDR OF LVARS
  3213. IX2 X3-X2 NL INDEX
  3214. SA1 LVARN X1 = MAX LVAR INDEX
  3215. SX2 X2
  3216. IX3 X1-X2
  3217. NG X3,VARERR
  3218. SX6 X2+B1 X6 = LVAR INDEX
  3219. EQ SVC100
  3220. *
  3221. SVCC SA3 ACVARS
  3222. IX7 X3+X6 COMPUTE ABSOLUTE BASE ADDRESS
  3223. SA7 SEGWD1
  3224. SX1 NCVRLIM SET END TEST
  3225. *
  3226. SVC100 IX0 X1-X6 CHECK IF INDEX IN BOUNDS
  3227. NG X0,VARERR
  3228. SVC110 SB1 1
  3229. CALL CHEKRR OBTAIN REGISTER X1 FOR READ
  3230. SX6 1
  3231. SA6 RX+1 MARK REGISTER IN USE
  3232. SA1 SEGWD1
  3233. SX7 5110B GENERATE SA1 B0+ADDRESS
  3234. LX7 18
  3235. BX7 X1+X7 ATTACH ABSOLUTE ADDRESS
  3236. CALL LONGI
  3237. EQ VSINDX
  3238. *
  3239. ENDIF
  3240. *
  3241. * /--- BLOCK SEGPUT 00 000 77/12/18 17.24
  3242. TITLE SEGPUT
  3243. *
  3244. * SWITCH SEGMENT AND INDEX ADTYPES FOR LATER
  3245. * ASSIGNMENT OPERATION
  3246. *
  3247. SEGPUT SA1 NADS
  3248. SX7 X1-1 BACK UP INDEX IN ADDRESS STACK
  3249. NG X7,SEGERR
  3250. ZR X7,SEGERR
  3251. SA3 X1+ADS LOAD ADTYPE OF INDEX EXPRESSION
  3252. SA2 X1+ADS-1 GET SEGMENT ADTYPE
  3253. BX6 X2
  3254. SA6 X1+ADS MOVE ADTYPE DOWN IN STACK
  3255. BX6 X3
  3256. SA6 X1+ADS-1 MOVE INDEX UP IN STACK
  3257. EQ ENDINST
  3258. * /--- BLOCK GETARY 00 000 77/12/18 17.22
  3259. TITLE ARRAY/COMPLEX INDEXING
  3260. *
  3261. * SUBROUTINE TO PUT ARAYWD IN X1, ARAYWD2 OR 0 IN X2
  3262. * ENTER WITH NADS OF ARAYWD IN X7 (DONT CHANGE X6)
  3263. GETARY EQ *
  3264. SA1 X7+ADS LOAD ARRAY ADTYPE
  3265. MX0 -XCODEAL MASK OUT ADDRESS
  3266. BX2 -X0*X1 OF INFO WORD
  3267. SA1 X2+INFO GET ARRAYWD IN X1
  3268. MX2 0
  3269. BX7 X1
  3270. LX7 4
  3271. MX0 -2
  3272. BX7 -X0*X7 MASK OFF BASE+SEG BITS
  3273. ZR X7,GETARY IF NO ARAYWD2, EXIT WITH X2=0
  3274. SA2 A1+1 ARAYWD2 STORED AFTER ARAYWD
  3275. EQ GETARY
  3276. *
  3277. * GETS ARAYWD AND PUTS IN X4 X7 HAS NADS
  3278. * DONT TOUCH X1,X2,X3,X7
  3279. GETARY4 EQ *
  3280. SA4 X7+ADS LOAD ARRAY ADTYPE
  3281. MX0 -XCODEAL MASK OUT ADDRESS
  3282. BX4 -X0*X4 OF INFO WORD
  3283. SA4 X4+INFO GET ARRAYWD IN X4
  3284. EQ GETARY4
  3285. *
  3286. * /--- BLOCK MATRAY 00 000 78/09/15 17.09
  3287. TITLE ARRAY PROCESSING
  3288. *
  3289. * PRE-CHECK TO SEE IF ARRAY WILL BE STORED INTO
  3290. *
  3291. MATRAY SB2 MATRAY1
  3292. RJ NESTCHK SETS B2=0 IF ASSIGNED INTO
  3293. *
  3294. MATRAY1 SA3 NADS MUST HAVE 2INDEX + ARRAYWD
  3295. SX7 X3-3 SO CHECK FOR 3 ADS
  3296. NG X7,MATERR
  3297. *
  3298. CONDEN
  3299. SA1 X3+ADS LOAD 2D INDEX AD (COL) TO X1
  3300. SA2 A1-1 AND 1ST INDEX AD (ROW) TO X2
  3301. BX7 X1
  3302. AX7 XCODEAL+1 POSITION UPPER 2 GETVAR BITS
  3303. NZ X7,MATRAY3 JUMP IF NOT CONSTANT
  3304. BX7 X2
  3305. AX7 XCODEAL+1
  3306. ZR X7,MCONST JUMP IF BOTH INDICES CONST
  3307. ENDIF
  3308. *
  3309. MATRAY3 ZR B2,MATPUT JUMP IF ASSIGNED INTO
  3310. SB1 4
  3311. RJ LOADIND LOAD COL INDEX TO X4
  3312. RJ POPNADS BACK UP TO ROW INDEX
  3313. SB1 3
  3314. RJ LOADIND LOAD ROW INDEX TO X3
  3315. RJ POPNADS BACK UP TO ARRAY ADTYPE
  3316. RJ LDLITAD LOAD ARAYWD ADDR TO B1
  3317. SB1 1
  3318. RJ CHEKRR CLEAR X1 FOR RESULT
  3319. SB1 4
  3320. RJ FREEX RELEASE X4 (RISKY'/)
  3321. SA1 LLMATEL RJ ADDRESS
  3322. MATRAY5 SX7 0100B
  3323. LX7 18 POSITION RJ OPERATION CODE
  3324. BX7 X1+X7 GENERATE RJ MATEL
  3325. RJ LONGI
  3326. RJ PAD
  3327. SB1 3
  3328. RJ FREEX RELEASE X3
  3329. SA1 IOP
  3330. SA1 X1+INFO GET ARAYWD(KEEP ADDR IN A1)
  3331. MX0 1
  3332. LX0 XCODEAL+4 MASK FOR I/F BIT
  3333. SX7 4 TYPE 4 CODE FOR INDEXED CALC
  3334. LX7 XCODEAL
  3335. BX2 X0*X1 ADD I/F BIT FROM ARAYWD
  3336. BX7 X2+X7 SETAD WILL ADD SIGN BIT
  3337. LX1 3 CHECK FOR VERTICAL SEGMENT
  3338. SA7 FLOAT
  3339. PL X1,MATRAY9 JUMP IF NOT SEGMENTED
  3340. SB1 1 GETVAR LEAVES IN X1
  3341. RJ MATVS FORM CODE TO EXTRACT VERTSEGMT
  3342. *
  3343. MATRAY9 RJ SETAD CHANGE OPERAND TO CALC IN X1
  3344. MX6 0
  3345. SA6 FINDXED FLAG INDEXED VARIABLE
  3346. EQ ENDINST IN X1
  3347. *
  3348. MATPUT SA1 NADS
  3349. SX7 X1-2 MUST BE AT LEAST 3 ADS
  3350. NG X7,MATERR
  3351. ZR X7,MATERR
  3352. SA2 X1+ADS LOAD 2D INDEX AD
  3353. SA3 X1+ADS-1 LOAD 1ST INDEX AD
  3354. SA4 X1+ADS-2 LOAD ARAYWD ADTYPE
  3355. BX6 X4 AND MOVE ARAYWD TO ENDOFSTACK
  3356. SA6 A2 WHERE ASSIGN CAN FIND IT
  3357. BX6 X2
  3358. SA6 A3 THEN 2D INDEX BEFORE THAT
  3359. BX6 X3
  3360. SA6 A4 THEN 1ST
  3361. EQ ENDINST
  3362. * /--- BLOCK VECTRAY 00 000 78/09/15 17.14
  3363. TITLE ARRAY PROCESSING
  3364. *
  3365. VECTRAY SB2 VECTRA1
  3366. RJ NESTCHK SETS B2=0 IF ASSIGNED INTO
  3367. *
  3368. VECTRA1 SA3 NADS
  3369. SX7 X3-2 MUST BE TWO ADDRESSES
  3370. NG X7,MATERR
  3371. *
  3372. CONDEN
  3373. VECTRA2 SA1 X3+ADS LOAD INDEX ADTYPE
  3374. BX7 X1
  3375. AX7 XCODEAL+1 POSITION UPPER 2 GETVAR BITS
  3376. ZR X7,VCONST TREAT CONSTANT INDEX SPECIALLY
  3377. ENDIF
  3378. *
  3379. VECTRA3 ZR B2,SEGPUT IF ASSIGN, EXCHANGE ADTYPE,INDX
  3380. SB1 3
  3381. RJ LOADIND LOAD ROW INDEX TO X3
  3382. RJ POPNADS BACK UP TO ARRAY ADTYPE
  3383. RJ LDLITAD LOAD ARAYWD ADDR TO B1
  3384. SB1 1
  3385. RJ CHEKRR CLEAR X1 FOR RESULT
  3386. SA1 LLVECEL RJ ADDRESS
  3387. EQ MATRAY5 GENERATE RJ VECEL
  3388. *
  3389. *
  3390. SCALRAY SB2 SCALRA1
  3391. RJ NESTCHK SETS B2=0 IF ASSIGNED INTO
  3392. *
  3393. SCALRA1 EQ CPXERR ONLY COMPLEX AT THIS POINT
  3394. *
  3395. *
  3396. CONDEN
  3397. * CHANGE MATRIX ELEMENT INTO REGULAR VARIABLE
  3398. * IF IT HAS CONSTANT INDICES
  3399. MCONST SX7 X3-2 ENTER WITH R,C ADS IN X1,X2
  3400. RJ GETARY4 GET ARAYWD IN X4
  3401. LX4 3 CHECK SEGMENT BIT
  3402. NG X4,MATRAY3 DONT DO SEGMENTED ARRAYS HERE
  3403. SA7 A3 BACKUP NADS PAST INDICES
  3404. RJ GETINDX C (COL) IN X6
  3405. SA6 SEGWD1 SAVE C
  3406. BX1 X2 ROW INDEX AD
  3407. RJ GETINDX R (ROW) IN X6
  3408. RJ GETARY GET ARAYWDS IN X1,X2
  3409. RJ ROWCHK ADJUSTED ROW INDEX IN X7
  3410. SA3 SEGWD1 GET BACK C
  3411. RJ COLCHK ADJ COL IN X6, NUMCOL-1 IN X4
  3412. SX4 X4+1
  3413. DX3 X4*X7 (R-ROW1)*COLS
  3414. IX7 X3+X6 +(C-COL1)
  3415. EQ VCONST2
  3416. *
  3417. *
  3418. * CHANGE VECTOR ELEMENT INTO REGULAR VARIABLE
  3419. VCONST SX7 X3-1 BACKUP ADDR. STACK((NADS)IN X3)
  3420. RJ GETARY4 GET ARAYWD IN X2
  3421. LX4 3 CHECK SEGMENT BIT
  3422. NG X4,VECTRA3 DONT DO SEGMENTED ARRAYS HERE
  3423. SA7 A3 BACKUP NADS PAST INDEX(KEEP X7)
  3424. RJ GETINDX EXTRACT INTEGER INDEX
  3425. RJ GETARY GET ARAYWDS IN X1,X2
  3426. RJ ROWCHK GET ADJUSTED ROW INDEX
  3427. VCONST2 RJ MERGAD GET ELEMENT AD IN X6
  3428. SA1 NADS
  3429. SA6 X1+ADS REPLACE ARRAY WITH EL ADTYPE
  3430. MX6 0
  3431. SA6 FINDXED FLAG INDEXED VARIABLE
  3432. EQ ENDINST
  3433. *
  3434. ENDIF
  3435. * /--- BLOCK UNARY 00 000 77/12/18 17.28
  3436. TITLE UNARY OPS
  3437. *
  3438. UMINUS SA1 TOPCNT DO NOT COUNT UNARY MINUS AS AN OPERATION
  3439. SX7 X1-1
  3440. SA7 A1
  3441. SA1 NADS CHECK FOR LITERAL UNARY MINUS
  3442. SA4 NARRAYS
  3443. NZ X4,AUMINUS JUMP IF ARRAYS OPS IN PROGRESS
  3444. UMINUS1 SA1 X1+ADS GET OPERAND
  3445. SB1 A1 SAVE ADTYPE ADDR IN B1
  3446. NG X1,UMINUS2 JUMP IF IN REGISTER
  3447. BX7 X1
  3448. AX7 XCODEAL+1 THROW AWAY BOTTOM GETVAR CODE BIT
  3449. MX0 58 MASK OUT I/F BIT
  3450. BX7 -X0*X7 GET UPPER TWO BITS OF GETVAR CODE
  3451. NZ X7,UMINUS2 JUMP IF NOT LITERAL (0 OR 1 CODE)
  3452. BX0 X1
  3453. AX0 XCODEAL CHECK FOR SHORT OR LONG LITERAL
  3454. SX6 X1 (X6)=SHORT LITERAL
  3455. ZR X0,UMSHORT JUMP IF SHORT LITERAL
  3456. *
  3457. BX2 X0 SAVE TYPE CODE
  3458. RJ RLLIT (X6) = LONG LITERAL
  3459. BX0 X2 RESTORE TYPE CODE
  3460. BX1 X6 (X0=1 OR 3 FOR I OR F LONG LITERAL)
  3461. UMSHORT BSS 0
  3462. BX6 -X6 COMPLEMENT THE LITERAL
  3463. SX1 1 MAKE SURE LONG LIT GETVAR CODE
  3464. BX1 X0+X1 (X1) = TYPE CODE
  3465. RJ SLLIT STORE LIT AND (X6) = ADTYPE
  3466. SA6 B1 AND CHANGE OPERAND IN ADS LIST
  3467. EQ ENDINST
  3468. *
  3469. UMINUS2 RJ IFIRR UNARY MINUS, I/F IRRELEVANT
  3470. SB1 1
  3471. RJ GENREAD READ TO X1 IF NOT IN REGISTER
  3472. SX0 B1 CONSTRUCT COMPLEMENT INSTRUCTION
  3473. SX1 14000B
  3474. BX3 X0+X1
  3475. RJ PICKX PICK DESTINATION REGISTER
  3476. SX7 B1 DESTINATION IN B1
  3477. LX7 6
  3478. BX7 X3+X7 COMPLETE COMPLEMENT INSTRUCTION
  3479. RJ SHORT ADD TO INSTRUCTION STREAM
  3480. EQ ENDINST
  3481. *
  3482. AUMINUS SA2 X1+ADS ENTER FROM UMINUS WITH X1=NADS
  3483. LX2 1 LOOK AT WHOLE ARRAY BIT
  3484. PL X2,UMINUS1 EXIT IF NOT ARRAY
  3485. LX2 59
  3486. MX0 -XCODEAL
  3487. BX3 -X0*X2
  3488. SA3 X3+INFO GET ARRAYWD
  3489. BX7 X3*X0
  3490. SA7 ASIZE AND SAVE
  3491. SB1 0 ALLOW RE-USE OF TMPARAY
  3492. RJ CALCTMP GET ADDRESS OF TEMP STOR
  3493. RJ ARYPREP CLEAR X1,2,6, FORM RJ ABUFCHK
  3494. SB1 RAINIT
  3495. RJ LDAINIT INITIALIZE FOR LOOP
  3496. SB1 1
  3497. RJ LDARRAY
  3498. SX7 14611B CODE FOR BX6 -X1
  3499. RJ SHORT
  3500. RJ TMPAD CHANGE ADTYPE TO TEMP ARRAY
  3501. MX0 1
  3502. * /--- BLOCK UNARY 00 000 78/12/21 18.19
  3503. LX0 XCODEAL+4 I/F BIT MASK
  3504. BX7 X0*X2 I/F BIT OF OPERAND(LEFT IN X2)
  3505. SA7 FLOAT ENDAINS WILL SET ADTYPE I/F
  3506. SA1 NARRAYS
  3507. BX7 -X1 SET - AS FLAG FOR LOOPING OP
  3508. SA7 A1
  3509. EQ ENDINSA
  3510. *
  3511. * /--- BLOCK UEXPON 00 000 79/08/24 13.46
  3512. *
  3513. TITLE EXPONENTIATION
  3514. *
  3515. EXPO SA1 NOPS FOR EXPONENTS, FIRST CHECK FOR PI
  3516. SA2 X1+OPS-1 GET PRECEDING STACK OPERATOR
  3517. SX7 X2-OPPI
  3518. NZ X7,EXPOA JUMP IF NOT PRECEDED BY PI OPERATOR
  3519. SX7 OPMULT CHANGE STACK PI TO MULT
  3520. SA7 A2
  3521. SX0 B0 PI IS LITS+0
  3522. RJ LITREF ADD PI LITERAL TO ADS STACK
  3523. SA1 NADS SWITCH PI AND EXPONENT IN ADS STACK
  3524. SX2 X1-2
  3525. NG X2,FORMERR MUST BE AT LEAST 2 OPERANDS
  3526. SA2 X1+ADS GET PI
  3527. SA1 A2-1 GET EXPONENT
  3528. BX7 X2
  3529. SA7 A1 SWITCH THEM
  3530. BX7 X1
  3531. SA7 A2
  3532. EXPOA SX7 1 HANDLE EXPONENTIATION
  3533. LX7 XCODEAL+3
  3534. SA7 FLOAT FLOATING RESULT
  3535. SX7 B0
  3536. SA7 RECIP CLEAR RECIPROCAL FLAG
  3537. SA1 NADS CHECK FOR EXPONENT TYPE
  3538. SX2 X1-2
  3539. NG X2,FORMERR MUST BE AT LEAST 2 OPERANDS
  3540. SA3 X1+ADS GET EXPONENT OPERAND
  3541. BX7 X3
  3542. SA7 POWER SAVE EXPONENT
  3543. SA4 NARRAYS
  3544. ZR X4,EXPOA1 JUMP IF NO ARRAYS
  3545. BX2 X3 MUST PRESERVE X3,X7
  3546. LX2 1 CHECK EXPONENT ADTYPE ARRAY BIT
  3547. NG X2,NOAERR WHOLE ARRAYS NOT ALLOWED
  3548. SA2 A3-1 OPERAND ADTYPE
  3549. LX2 1
  3550. NG X2,NOAERR NO ARRAYS...UNDEFINED OPERATION
  3551. EXPOA1 SA2 NUNITS CHECK FOR UNITS
  3552. NG X2,EXPOAA JUMP IF NO UNITS
  3553. NG X3,UNITERR JUMP IF POWER IS IN REGISTER
  3554. AX7 XCODEAL
  3555. ZR X7,INTPOW JUMP IF SHORT LITERAL
  3556. MX0 57
  3557. BX0 -X0*X7
  3558. AX0 1
  3559. NZ X0,UNITERR JUMP IF NOT LITERAL
  3560. BX1 X3 (X1) = ADTYPE
  3561. RJ RLLIT (X6) = LONG LITERAL
  3562. BX3 X6
  3563. LX7 59-3 SIGN BIT = I/F BIT
  3564. NG X7,GOTPOW IF FLOATING LITERAL
  3565. *
  3566. INTPOW PX3 X3
  3567. NX3 X3 ELSE FLOAT IT
  3568. GOTPOW RJ ZEROU CHECK THAT EXPONENT HAS NO DIMENSIONS
  3569. SA2 NUNITS NUNITS IN X2, EXPONENT IN X3
  3570. SA1 NUADS
  3571. IX7 X1-X2 DECREMENT UADS POINTER
  3572. SA7 A1
  3573. RJ MULTEM MULTIPLY UNIT COEFFICIENTS
  3574. SA1 NADS RESTORE A1
  3575. SA3 POWER RESTORE X3
  3576. *
  3577. * /--- BLOCK EXPO1 00 000 78/11/21 22.20
  3578. * USED TO TREAT ZERO EXPONENT SPECIALLY, BUT THAT MEANT THAT
  3579. * A&0 GAVE 1 INSTEAD OF 0/0 WHEN A=0.
  3580. EXPOAA ZR X3,CMPLG0 NOT SPECIAL IF EXPONENT IS ZERO
  3581. MX0 54 KEEP ALL BUT BOTTOM 6 BITS
  3582. BX0 X0*X3
  3583. ZR X0,EXPO1 JUMP IF POS EXPONENT LT 64
  3584. AX0 XCODEAL CHECK FOR NEGATIVE EXPONENT
  3585. MX7 57 SHOULD BE LONG LITERAL
  3586. BX7 -X7*X0 MASK FOR GETVAR CODE ID
  3587. SX7 X7-1 WHICH SHOULD BE 1
  3588. NZ X7,CMPLG0 JUMP IF NOT LONG LIT
  3589. LX0 56 THEN CHECK FOR INT OR FLOAT
  3590. MX7 60-XCODEAL ACQUIRE LITERAL
  3591. BX7 -X7*X3
  3592. SA4 X7+LITS LITERAL IN X4
  3593. PL X0,EXPO0 JUMP IF NOT FLOATING
  3594. SA2 =.5 CHECK FOR X**.5
  3595. BX7 X2-X4
  3596. NZ X7,CMPLG0 JUMP IF EXPONENT NOT .5
  3597. NG X7,CMPLG0 JUMP IF EXPONENT IS -.5
  3598. SX7 X1-1
  3599. ZR X7,FORMERR JUMP IF NO BASE
  3600. SA7 A1 DECREMENT NADS
  3601. SX7 1
  3602. SA7 NOTLITS FLAG ARG NOT LITERAL
  3603. SX7 OPSQRT
  3604. SA7 SAVEOP SAVE OP CODE
  3605. EQ SQTFCT2 GO DO SQRT
  3606. *
  3607. EXPO0 PL X4,CMPLG0 JUMP IF NOT NEGATIVE INTEGER
  3608. BX3 -X4 MAKE INT EXPONENT POSITIVE
  3609. MX0 54 CHECK FOR EXPONENT&lt;64
  3610. BX0 X0*X3
  3611. NZ X0,CMPLG0 JUMP IF EXPONENT>64
  3612. SX7 1 NEED TO TAKE RECIPROCAL
  3613. SA7 RECIP
  3614. BX7 X3 SAVE POWER
  3615. SA7 POWER
  3616. EXPO1 SX7 X1-1 DECREMENT NADS
  3617. ZR X7,FORMERR ERROR IF NO OPERANDS LEFT
  3618. SA7 A1
  3619. SX7 X3-1 CHECK FOR EXPONENT 1
  3620. ZR X7,RECIPRO NOTHING TO DO--X**1
  3621. RJ FLOTONE FLOAT THE BASE IF REQUIRED
  3622. SB1 1 READ BASE INTO X1
  3623. RJ GENREAD IF NOT IN A REGISTER
  3624. SX3 B1 GET REGISTER NUMBER
  3625. LX3 3
  3626. SX3 X3+B1
  3627. LX3 3
  3628. SX3 X3+B1 FORM NNN REFERENCE
  3629. SB1 X3 SAVE NNN
  3630. SA4 POWER RESTORE POWER
  3631. LX4 59
  3632. MX5 1 FORM SIGN BIT MASK
  3633. NG X4,ODD JUMP IF ODD POWER
  3634. * EVEN SX7 B1+40000B FORM FXN XN*XN TO SQUARE BASE
  3635. EVEN SX7 B1+41000B (RX)
  3636. RJ SHORT SQUARE THE BASE
  3637. LX4 59 START WITH BASE**2 IN XN
  3638. * /--- BLOCK ODD 00 000 74/07/13 15.54
  3639. PL X4,EVEN JUMP BACK IF STILL NO BIT SET IN EXPONENT
  3640. BX4 -X5*X4 THROW OUT SIGN BIT
  3641. ZR X4,EXPOD JUMP IF ALL DONE
  3642. ODD AX3 3 MAKE NN REFERENCE
  3643. SX7 X3+41200B FORM RX2 XN*XN
  3644. RJ SHORT
  3645. LX3 3
  3646. SB1 X3+2 FORM NN2 FOR USE IN FORMING FXN XN*X2
  3647. EXPOC BX4 -X5*X4 THROW OUT SIGN BIT
  3648. LX4 59 CHECK NEXT HIGHER BIT IN EXPONENT
  3649. PL X4,NOTON JUMP IF BIT NOT ON
  3650. SX7 B1+41000B FORM RXN XN*X2 TO MULTIPLY UP
  3651. RJ SHORT
  3652. BX4 -X5*X4 THROW OUT SIGN BIT
  3653. ZR X4,EXPOD JUMP IF MULTIPLIES DONE
  3654. NOTON SX7 41222B RX2 X2*X2 TO SQUARE AGAIN
  3655. RJ SHORT
  3656. EQ EXPOC KEEP GOING
  3657. EXPOD SX3 B1 GET FINAL REGISTER NUMBER
  3658. AX3 6
  3659. SX7 1
  3660. SA7 X3+RX TAG REGISTER IN USE
  3661. BX7 X5+X3 TACK ON SIGN BIT TO INDICATE REGISTER
  3662. LX5 XCODEAL+4 FORM FLOAT BIT
  3663. BX7 X7+X5
  3664. SA1 NADS
  3665. SA7 X1+ADS
  3666. EQ RECIPRO CHECK FOR RECIPROCAL
  3667. *
  3668. *
  3669. RECIPRO SA1 RECIP CHECK FOR NEEDED RECIPROCAL
  3670. ZR X1,ENDINST JUMP IF NO RECIPROCAL NEEDED
  3671. SA1 NADS MOVE DIVIDEND UP
  3672. SX6 X1+1
  3673. SX7 X6-ADSMAX SEE IF TOO MANY ADS
  3674. PL X7,LNGERR
  3675. SA6 A1
  3676. SA2 X1+ADS
  3677. BX7 X2
  3678. SA7 A2+1
  3679. SX7 1 INSERT NUMERATOR (1)
  3680. SA7 A2 INTO ADS LIST
  3681. SX7 45000B FLOATING DIVIDE (RX)
  3682. SA7 FLOAT NORMAL DIVIDE STUFF EXCEPT FOR UNITS
  3683. RJ FLTBOTH WHICH ARE ALREADY DONE
  3684. EQ MULT2
  3685. *
  3686. *
  3687. FLOTONE EQ * SET CHANGE BIT TO FLOAT OPERAND
  3688. SA1 NADS GET OPERAND
  3689. SA1 X1+ADS
  3690. SX0 1 FORM I/F BIT MASK
  3691. LX0 XCODEAL+3
  3692. BX7 X0*X1 GET BIT
  3693. NZ X7,FLOTONE DONE IF ALREADY FLOATED
  3694. LX0 1 ELSE SET CHANGE BIT
  3695. BX7 X1+X0
  3696. SA7 A1
  3697. EQ FLOTONE
  3698. *
  3699. * ENTER MULTEM WITH X2=NUNITS, X3=EXPONENT
  3700. *
  3701. MULTEM EQ * MULTIPLY UNITS BY EXPONENT
  3702. SB2 X2 NUNITS IN X2
  3703. SB1 1 INDEX
  3704. SA1 NUADS NUADS STARTS AT ZERO
  3705. SA1 X1+UADS-1 START OF DIMENSIONS (-1)
  3706. MULTEM2 SA1 A1+B1 PICK UP COEFF
  3707. FX7 X1*X3 EXPONENT IN X3
  3708. SA7 A1
  3709. SB2 B2-B1 COUNT
  3710. GT B2,B0,MULTEM2
  3711. EQ MULTEM
  3712. * /--- BLOCK ASSIGN 00 000 77/12/18 17.29
  3713. TITLE ASSIGNMENT OPERATION
  3714. *
  3715. ASSIGN RJ PREBIN ASSIGNMENT OPERATION
  3716. SA1 NOTLITS BOTH OPERANDS LITERALS IF ZERO
  3717. ZR X1,EQERR CANT STORE INTO LITERAL
  3718. SA3 NUNITS
  3719. PL X3,UNITERR CANT STORE IF UNITS INVOLVED
  3720. SA4 NARRAYS
  3721. NZ X4,AASSIGN JUMP IF WHOLE ARRAYS FOUND
  3722. ASSIGN1 JP B3+ASSIGN2 B3=0 ITOI, 1 FTOI, 2 ITOF, 3 FTOF
  3723. ASSIGN2 EQ ASSIGN3 I=I
  3724. EQ ASFTOI I=F
  3725. EQ ASITOF F=I
  3726. EQ ASSIGN3 F=F
  3727. ASFTOI SA1 NOPS MOCK UP ROUND OPERATION
  3728. SX7 X1+1
  3729. SX1 X7-OPSMAX SEE IF TOO MANY OPS
  3730. PL X1,LNGERR
  3731. SA7 A1 BY INCREMENTING NO. OF OPERATIONS
  3732. SB1 RNDFIOP AND JUMPING THRU OPJUMP TABLE
  3733. EQ OPJUMP1
  3734. ASITOF LX0 1 FLAG MODE CHANGE FOR GENREAD
  3735. BX7 X2+X0 (PREBIN SET X0 TO I/F BIT)
  3736. SA7 A2 AND A2 IS ADDRESS OF SECOND OPERAND
  3737. * /--- BLOCK ASSIGN 00 000 78/01/25 14.37
  3738. ASSIGN3 SB1 6 TRY TO GET IN X6
  3739. RJ GENREAD
  3740. SX0 B1-6 MUST BE IN X6 OR X7 TO STORE
  3741. PL X0,ASSIGN4 JUMP IF IN X6 OR X7
  3742. SX7 1
  3743. SA7 B1+RX MARK RESULT REGISTER IN USE
  3744. SX7 B1 SAVE REGISTER
  3745. SA7 IOP
  3746. SB1 6
  3747. RJ CHEKRR MOVE X6 SOMEPLACE
  3748. SA1 IOP GENERATE BX6 XN
  3749. BX7 X1
  3750. LX7 3 POSITION REGISTER FOR BX INST.
  3751. SX7 X7+10600B BX6 XN
  3752. MX6 0
  3753. SA6 X1+RX MARK REGISTER NO LONGER IN USE
  3754. RJ SHORT PUT BX6 XN INTO CALC CODE
  3755. ASSIGN4 SA1 NADS SET UP RESULT ADTYPE
  3756. SX7 X1-1
  3757. ZR X7,FORMERR JUMP IF NO OPERAND TO STORE INTO
  3758. SA7 A1 DECREMENT NADS
  3759. *FLAG RESULT AS I OR F
  3760. SA1 X7+ADS RESULT ADDRESS
  3761. SX0 1
  3762. LX0 XCODEAL+3 MASK FOR I/F BIT
  3763. BX2 X0*X1
  3764. SX7 1 FLAG RESULT REGISTER IN USE
  3765. SA7 RX+B1
  3766. SX7 B1 RESULT REGISTER ASSIGNMENT
  3767. BX7 X7+X2 MERGE WITH I/F BIT
  3768. MX0 1
  3769. BX7 X7+X0 AND FLAG AS BEING IN REGISTER
  3770. SA7 A1 STORE ADTYPE
  3771. *
  3772. MX0 60-XCODEAL
  3773. BX2 -X0*X1 GET ADDRESS OF STORE
  3774. AX1 XCODEAL CODE TYPE
  3775. MX0 57
  3776. BX1 -X0*X1 THROW AWAY I/F INFO
  3777. SB2 X1
  3778. JP B2+ASSIGN5
  3779. ASSIGN5 EQ EQERR CANT STORE INTO SHORT
  3780. EQ EQERR OR LONG LITERAL
  3781. EQ ASTUD STUDENT
  3782. EQ ACOM COMMON
  3783. EQ AINDEX INDEXED VARIABLE
  3784. EQ ASEG SEGMENT
  3785. EQ AARRAYL ARRAY
  3786. EQ EQERR 7
  3787. * /--- BLOCK ASSIGN 00 000 76/07/07 01.59
  3788. ASTUD SA1 ASVARS
  3789. IX2 X1+X2 ABSOLUTE ADDRESS
  3790. ASTUD2 SX7 B1+510B SAN B0+K
  3791. LX7 18+3
  3792. BX7 X7+X2 ATTACH ADDRESS
  3793. RJ LONGI
  3794. EQ ENDINST
  3795. ACOM SA1 ACVARS COMMON VARIABLE ADDRESS
  3796. IX2 X1+X2
  3797. EQ ASTUD2
  3798. AINDEX SX7 B1+530B SAN XM
  3799. LX7 3
  3800. BX7 X7+X2
  3801. LX7 3
  3802. MX6 0 FREE THE X REGISTER
  3803. SA6 X2+RX
  3804. RJ SHORT
  3805. EQ ENDINST
  3806. *
  3807. *
  3808. AARRAYL SA1 X2+INFO GET ARRAYWORD
  3809. MX0 1
  3810. LX0 XCODEAL+4 I/F BIT MASK
  3811. SX7 A1 SAVE ARRAYWORD ADDR FOR ASEG22
  3812. SA7 TMPARAY
  3813. BX7 X0*X1
  3814. LX1 4 TOP DIM. BIT
  3815. SA7 SEGWD SAVE I/F BIT
  3816. PL X1,AVEC JUMP IF NOT MATRIX
  3817. LX1 1 OTHER DIMEN BIT
  3818. NG X1,MATERR NO 3-D YET
  3819. SX1 6115B SB1 B5+**
  3820. LX1 18
  3821. BX7 X1+X2 ATTACH ADDRESS
  3822. SA7 SEGWD1 SAVE
  3823. RJ POPNADS BACK UP TO COL ADTYPE
  3824. SB1 4
  3825. RJ LOADIND LOAD COL INDEX TO X4
  3826. RJ POPNADS BACK UP TO ROW ADTYPE
  3827. SB1 3
  3828. RJ LOADIND LOAD ROW INDEX TO X3
  3829. SA1 NADS
  3830. SX7 X1+2 RESULT NADS
  3831. SA7 A1
  3832. * SB1 7 READ RESULT TO X7
  3833. SB1 6 READ RESULT TO X6 ***
  3834. RJ FORCEX
  3835. SA2 SEGWD1
  3836. BX7 X2 LOAD SB1 B5+ARAYWD
  3837. RJ LONGI
  3838. SA1 NADS
  3839. SX6 X1-2 X6 NEEDED LATER
  3840. SA6 A1
  3841. SA3 SEGWD I/F BIT
  3842. SA1 LLMATO RJ ADDRESS
  3843. EQ ASEG20
  3844. *
  3845. *
  3846. AVEC LX1 1
  3847. PL X1,CPXERR NO COMPLEX YET
  3848. SX1 6115B
  3849. LX1 18
  3850. BX7 X1+X2 GENERATE SB1 B5+ARAYWD
  3851. SA7 SEGWD1 SAVE IT
  3852. RJ POPNADS BACK UP TO INDEX
  3853. SB1 3
  3854. RJ LOADIND LOAD INDEX TO X3
  3855. SA1 NADS ADVANCE TO RESULT
  3856. SX7 X1+1
  3857. SA7 A1
  3858. * SB1 7 READ RESULT TO X7
  3859. SB1 6 READ RESULT TO X6
  3860. RJ FORCEX
  3861. SA2 SEGWD1
  3862. BX7 X2 LOAD SB1 B5+ARAYWD
  3863. RJ LONGI
  3864. SA1 NADS
  3865. SX6 X1-1 X6 USED LATER
  3866. SA6 A1
  3867. SA3 SEGWD I/F BIT
  3868. SA1 LLVECO RJ ADDRESS
  3869. EQ ASEG22
  3870. * /--- BLOCK ASSIGN 00 000 78/01/25 16.36
  3871. *
  3872. * ASSIGNMENT INTO SEGMENT
  3873. *
  3874. ASEG BX6 X2 SAVE ADDRESS OF SEGMENT LITERAL
  3875. SA6 IOP
  3876. MX6 0
  3877. SA6 TMPARAY FLAG FOR ARAY TEST IN ASEG22
  3878. SA1 X2+INFO LOAD SEGMENT INFO WORD
  3879. BX6 X1
  3880. SA6 SEGWD SAVE
  3881. LX6 2 POSITION -VERTICAL- OPTION BIT
  3882. NG X6,ASEGV
  3883. *
  3884. SB1 4 MUST BE SURE REGISTER X4 FREE
  3885. RJ CHEKRR
  3886. SX7 5145B GENERATE CODE TO LOAD SEGMENT
  3887. SA1 IOP GET ADDRESS OF INFO WORD
  3888. LX7 18 INFO WORD TO X4
  3889. BX7 X1+X7
  3890. RJ LONGI ADD A SA4 B5+K
  3891. SX7 1
  3892. SA7 RX+4 MARK X4 AS IN USE
  3893. RJ POPNADS BACK UP TO INDEX ADTYPE
  3894. SB1 3
  3895. RJ LOADIND LOAD INDEX TO X3
  3896. *
  3897. ASEG10 SA1 NADS ADVANCE NADS AGAIN TEMPORARILY
  3898. SX7 X1+1
  3899. SA7 A1
  3900. * SB1 7 READ TO X7
  3901. SB1 6 READ RESULT TO X6 ***
  3902. RJ FORCEX
  3903. SA1 NADS
  3904. SX6 X1-1 BACK UP ADTYPE POINTER AGAIN
  3905. SA6 A1
  3906. SA1 LLSEGO RJ ADDRESS
  3907. MX3 0 SEGMENT I/F BIT ALWAYS 0
  3908. ASEG20 SB1 4 RELEASE X4
  3909. RJ FREEX DOES NOT CHANGE X1,X3,X6
  3910. *
  3911. ASEG22 MX2 1 TOP BIT FOR IN REGISTER
  3912. * SX7 7 FORM RESULT ADTYPE (BE IN X7)
  3913. SX7 6 FORM RESULT ADTYPE IN X6 ***
  3914. BX7 X3+X7 MERGE IN I/F BIT
  3915. BX7 X2+X7 AND REGISTER BIT
  3916. SA7 X6+ADS REWRITE ADDRESS ENTRY
  3917. SX7 0100B BUILD AN RJ INSTRUCTION
  3918. LX7 18
  3919. BX7 X7+X1 RJ ADDR IN X1
  3920. RJ LONGI ADD CALL TO SEGMENT ROUTINE
  3921. RJ PAD
  3922. SA1 TMPARAY
  3923. NZ X1,AMATSG JUMP IF ARRAY TO TEST FOR SEGMT
  3924. ASEG29 SB1 3 RELEASE X3
  3925. RJ FREEX
  3926. EQ ENDINST
  3927. *
  3928. *
  3929. * /--- BLOCK ASSIGN 00 000 77/12/18 17.30
  3930. ASEGV RJ POPNADS BACK UP TO INDEX ADTYPE
  3931. RJ VSINDX GENERATE CODE TO LOAD TO X1
  3932. SA1 NADS
  3933. SX6 X1+1 ADVANCE TO QUANTITY TO STORE
  3934. SA6 A1
  3935. SB1 6 READ QUANTITY TO STORE TO X6
  3936. RJ FORCEX
  3937. SB1 3 OBTAIN X3 FOR MASK
  3938. RJ CHEKRR
  3939. SX7 1
  3940. SA7 RX+3 MARK BUSY
  3941. SB1 7 OBTAIN X7 FOR STORE
  3942. RJ CHEKRR
  3943. RJ POPNADS BACK UP TO INDEX AGAIN
  3944. *
  3945. SA1 SEGWD LOAD SEGMENT INFO WORD
  3946. SB1 X1-1 GET STARTING BIT POSITION
  3947. AX1 18+18
  3948. SB2 X1 GET NUMBER OF BITS PER BYTE
  3949. *
  3950. RJ VSTORE GENERATE CODE TO STORE VSEG
  3951. *
  3952. SB1 1
  3953. CALL FREEX RELEASE X1
  3954. SB1 3
  3955. CALL FREEX RELEASE X3
  3956. * SB1 7
  3957. * CALL FREEX RELEASE X7 (NEVER RESERVED'/)
  3958. *
  3959. MX1 1 FORM RESULT ADTYPE
  3960. SX6 6 RESULT IS IN X6
  3961. BX6 X1+X6
  3962. SA1 NADS LOAD POINTER IN ADDRESS STACK
  3963. SA6 X1+ADS STORE RESULT ADTYPE
  3964. EQ ENDINST
  3965. * /--- BLOCK AASSIGN 00 000 77/12/18 17.33
  3966. TITLE ARRAY ASSIGNMENT OPERATION
  3967. *
  3968. * CHECK IF ASSIGNMENT TO WHOLE ARRAY
  3969. AASSIGN SA1 NADS ENTER WITH NARRAYS IN X4
  3970. SA2 X1+ADS
  3971. SA3 A2-1 OPERANDS IN X2,X3
  3972. BX7 X3+X2
  3973. LX7 1
  3974. PL X7,ASSIGN1 JUMP BACK IF NEITHER IS ARRAY
  3975. *
  3976. SB1 X4-2 TEST FOR NO MORE THAN 2ARAYOPS
  3977. SX7 1 RESET NARRAYS AFTER STORE IF OK
  3978. LE B1,B0,AASGN0 JUMP IF 2 OR 1 ARAYOPS
  3979. PLATO
  3980. EQ MNYAERR ONLY ONE OPERATION IN COMPUTE
  3981. ENDIF
  3982. *
  3983. * SX7 1000B FLAG FOR 2MANYARAYS IN ENDLIN
  3984. AASGN0 SA7 NARRAYS RESTORE COUNT
  3985. SX7 B3
  3986. SA7 IOP SAVE I/F MODES OF OPERANDS
  3987. BX4 X3*X2
  3988. LX4 1
  3989. NG X4,AASGN10 JUMP IF BOTH ARRAYS
  3990. LX3 1
  3991. PL X3,EQERR CANT STORE ARRAY INTO SCALAR
  3992. RJ STORTMP IS IN REGISTER, STORE IT
  3993. SA1 NADS
  3994. SX1 X1-1
  3995. SA2 X1+ADS GET 1ST (ARRAY) OPERAND
  3996. RJ STORTMP GET ASIZE
  3997. EQ AASGN20
  3998. AASGN10 RJ SIZCHK CHECK IF ARRAYS ARE CONFORMAL
  3999. AASGN20 RJ ARYPREP CLEAR X1,2,6, FORM RJ ABUFCHK
  4000. SB1 RAINIT
  4001. RJ LDAINIT INITIALIZE LOOP
  4002. SB1 1
  4003. RJ LDARRAY GENERATE LOAD RESULT TO X1 CODE
  4004. SA1 IOP GET BACK OPERAND I/F TYPES
  4005. SB3 X1
  4006. JP B3+AASGN22 =0 IF I=I, =1 IF I=F, ETC
  4007. AASGN22 EQ AASGN30 IS I=I
  4008. EQ AASGN80 I=F
  4009. EQ AASGN70 F=I
  4010. AASGN30 SX7 10611B F=F
  4011. RJ SHORT GENERATE CODE FOR BX6 X1
  4012. AASGN40 RJ POPNADS DECREMENT ADS
  4013. SA1 X7+ADS GET ADTYPE
  4014. BX2 X1
  4015. LX2 2 SEE IF IS TMPARRAY
  4016. NG X2,EQERR CANT STORE INTO TMPARRAY
  4017. MX0 -XCODEAL
  4018. BX2 -X0*X1 GET ADDRESS OF ARRAYWD
  4019. SA3 X2+INFO GET ARRAYWD FROM XTRA STORAGE
  4020. BX1 -X0*X3 REL. ADDRESS OF ARRAY TO STORE
  4021. SA4 ASVARS
  4022. PL X3,AASGN45 SIGN BIT=0 FOR STUD, =1 FOR COM
  4023. SA4 ACVARS
  4024. * /--- BLOCK AASSIGN 00 000 76/07/17 04.13
  4025. AASGN45 IX1 X1+X4 ADD RELATIVE ADDR TO BASE
  4026. LX3 3
  4027. PL X3,AASGN50
  4028. SA2 A3+1 GET 2D ARRAYWD
  4029. LX2 1
  4030. PL X2,MATERR SEE AMATVS BELOW
  4031. LX2 11
  4032. MX0 -6
  4033. BX4 -X0*X2
  4034. SB2 X4
  4035. LX2 6
  4036. BX4 -X0*X2
  4037. SB1 X4-1
  4038. BX6 X1
  4039. SA6 SEGWD SAVE REL BASE ADDR
  4040. SX7 5214B CODE FOR *SA1 X4+K*
  4041. LX7 18
  4042. BX7 X7+X1 GENERATE *SA1 X4+BASEADDR*
  4043. RJ LONGI GET WD IN X1, RESULT IN X6
  4044. RJ VSTORE MASK IN X3, STORE FROM X7
  4045. ***TEMP KLUDGE TO PREVENT OVERWRITING BY ALOOP
  4046. SX7 10670B MOCKUP BX6 X7 SO ALOOPS
  4047. RJ SHORT STORES SEGMENTED WD AGAIN
  4048. SA1 SEGWD GET BACK BASE ADDR
  4049. *
  4050. AASGN50 RJ LDALOOP GENERATE RJ ALOOPS, ETC
  4051. RJ LDAINTR GENERATE *RJ AINTER* INTRUPTEST
  4052. *
  4053. EQ ENDINST
  4054. *
  4055. * COME HERE TO FLOAT RESULT FOR F=I
  4056. AASGN70 SX7 27601B GENERATE CODE FOR PX6 X1
  4057. RJ SHORT
  4058. SX7 24606B GENERATE CODE FOR NX6 X6
  4059. RJ SHORT
  4060. EQ AASGN40 NOW STORE IT
  4061. *
  4062. * COME HERE TO ROUND RESULT FOR I=F
  4063. AASGN80 SX1 RNDFIOP ROUNDING OPERATOR
  4064. SX0 X1-FUNCT0 GET FUNCTION NUMBER
  4065. SX6 1
  4066. SA6 FFLT SET FOR FLOATING ARGUMENT
  4067. RJ GENFCT LOAD ROUNDED INTEGER TO X1
  4068. EQ AASGN30 NOW PUT IN X6 AND STORE
  4069. *
  4070. *
  4071. AMATSG SA1 X1 GET ARRAYWD1
  4072. LX1 3 TEST SEGMENT BIT
  4073. PL X1,ASEG29 EXIT IF NOT SEGMENTED
  4074. SA2 A1+1 GET SECOND ARAYWD
  4075. LX2 1
  4076. PL X2,MATERR NO HORIZONTAL SEGMENTS YET
  4077. *
  4078. * ASSIGN TO VERTICAL-SEGMENTED ARRAY ELEMENT...
  4079. * ARRAY STORE ROUTINE IN GETVAR, READS INSTEAD OF
  4080. * STORES IF ARRAY IS VERTICAL SEGMENT
  4081. *
  4082. LX2 11
  4083. MX0 -6
  4084. BX3 -X0*X2
  4085. SB2 X3 EXTRACT BITS/BYTE
  4086. LX2 6
  4087. BX4 -X0*X2
  4088. SB1 X4-1 AND STARTBIT-1
  4089. RJ VSTORE GENERATE SEGMENT STORE CODE
  4090. SX7 10722B
  4091. RJ SHORT FORM BX7 X2 TO RESTORE X7
  4092. SX1 1
  4093. SX7 5012B FORM SA1 A2+1
  4094. LX7 18
  4095. BX7 X7+X1
  4096. RJ LONGI
  4097. SX1 2
  4098. SX7 5022B FORM SA2 A2+2
  4099. LX7 18
  4100. BX7 X7+X1
  4101. RJ LONGI TO RESTORE X1, X2
  4102. EQ ASEG29
  4103. *
  4104. * /--- BLOCK PREBIN 00 000 77/12/19 16.12
  4105. TITLE PREBIN -- DETERMINE TYPES OF OPERANDS
  4106. *
  4107. * -PREBIN-
  4108. *
  4109. * PREBIN CALLED BEFORE BINARY TO DETERMINE I/F TYPES
  4110. * OF 2 OPERANDS.
  4111. *
  4112. PREBIN EQ * PLACE IN B3 THE I/F TYPES OF THE 2 OPERANDS
  4113. SX0 1 B3=0 II, 1 IF, 2 FI, 3 FF
  4114. LX0 XCODEAL+3 I/F MASK
  4115. SA1 NADS
  4116. SX2 X1-2
  4117. NG X2,FORMERR MUST BE AT LEAST 2 OPERANDS
  4118. SA2 X1+ADS GET SECOND OPERAND
  4119. SA1 A2-1 GET FIRST OPERAND
  4120. BX3 X0*X1 FIRST TYPE
  4121. BX4 X0*X2 SECOND TYPE
  4122. LX3 1
  4123. BX3 X3+X4 FIRST TYPE--SECOND TYPE (2 BITS)
  4124. AX3 XCODEAL+3
  4125. SB3 X3
  4126. *NEXT CHECK WHETHER BOTH ARE LITERALS
  4127. NG X1,PREBIN NOT IF IN REGISTER
  4128. NG X2,PREBIN NOT IF IN REGISTER
  4129. MX7 58
  4130. BX3 X1 FIRST ADTYPE
  4131. AX3 XCODEAL+1 DISCARD ADDRESS AND LIT BIT
  4132. BX3 -X7*X3 UPPER TWO BITS OF TYPE CODE, NO I/F BIT
  4133. NZ X3,PREBIN MUST BE STUDENT OR COMMON IF NZ
  4134. BX3 X2 SECOND ADTYPE
  4135. AX3 XCODEAL+1 DISCARD ADDRESS AND LIT BIT
  4136. BX3 -X7*X3 UPPER TWO BITS OF TYPE CODE, NO I/F BIT
  4137. NZ X3,PREBIN MUST BE STUDENT OR COMMON IF NZ
  4138. SX7 B0
  4139. SA7 NOTLITS 0 IF LITERALS, NZ IF VARIABLES
  4140. EQ PREBIN
  4141. *
  4142. TITLE FLTBOTH -- FLOAT BOTH OPERANDS
  4143. *
  4144. * -FLTBOTH-
  4145. *
  4146. * CONVERTS BOTH BINARY OPERANDS TO FLOATING POINT
  4147. *
  4148. *
  4149. FLTBOTH EQ * FLOAT BOTH OPERANDS
  4150. RJ PREBIN DETERMINE I/F TYPES
  4151. BX7 X0*X1 PREBIN SET X0 TO I/F MASK
  4152. BX7 X7-X0 COMPLEMENT BIT
  4153. LX7 1 SHIFT TO CHANGE MODE POSITION
  4154. BX7 X1+X7 MERGE WITH ORIGINAL ADTYPE
  4155. SA7 A1
  4156. BX7 X0*X2 PREBIN SET X0 TO I/F MASK
  4157. BX7 X7-X0 COMPLEMENT BIT
  4158. LX7 1 SHIFT TO CHANGE MODE POSITION
  4159. BX7 X2+X7 MERGE WITH ORIGINAL ADTYPE
  4160. SA7 A2
  4161. EQ FLTBOTH
  4162. * /--- BLOCK BINARY 00 000 77/12/19 16.14
  4163. TITLE BINARY -- PLACE 2 OPERANDS IN REGISTERS
  4164. *
  4165. * -BINARY-
  4166. *
  4167. * GENERATE CODE TO PUT 2 OPERANDS FROM THE TOP OF
  4168. * THE *ADS* STACK INTO REGISTERS FOR A BINARY
  4169. * OPERATION.
  4170. *
  4171. *
  4172. BINARY EQ * PLACE TWO OPERANDS IN REGISTERS
  4173. SA1 NADS
  4174. SX2 X1-2
  4175. NG X2,FORMERR MUST BE AT LEAST 2 OPERANDS
  4176. SA2 NARRAYS
  4177. NZ X2,ABINARY JUMP IF ARRAYS BEING PROCESSED
  4178. BINARY1 SB1 2 READ SECOND OPERAND INTO X2
  4179. RJ GENREAD GENERATE READ OF LAST OPERAND
  4180. SX7 1
  4181. SA7 B1+RX RESERVE REGISTER TEMPORARILY
  4182. SA0 B1 SAVE REGISTER LOCATION
  4183. SA1 NADS
  4184. SX7 X1-1 DECREMENT NADS TO GET FIRST OPERAND
  4185. SA7 A1
  4186. SB1 1 READ FIRST OPERAND INTO X1
  4187. SX7 A0 A0 GENREAD DESTROYS A0
  4188. SA7 BINA0
  4189. RJ GENREAD GENERATE READ OF FIRST OPERAND
  4190. SA1 BINA0
  4191. SA0 X1
  4192. MX7 0
  4193. SA7 A0+RX RELEASE FIRST REGISTER
  4194. SA1 NOTLITS CHECK WHETHER LITERAL OPERANDS
  4195. NZ X1,BINARY3 JUMP IF NOT LITERALS
  4196. SA1 FLOAT IS RESULT FLOATING
  4197. ZR X1,BINARY2 JUMP IF INTEGER
  4198. SX1 10B I/F BIT
  4199. BINARY2 SX7 X1+1 1 FOR LONG LITERAL
  4200. LX7 XCODEAL
  4201. SA1 NLITS INCREMENT NUMBER OF LITERALS
  4202. SX6 X1+1 RESULT WILL BE PLACED THERE
  4203. SA6 A1
  4204. SX1 X6-LITL
  4205. PL X1,LITERR JUMP IF TOO MANY LITERALS IN THIS CALC
  4206. BX7 X7+X6 FORM RESULT ADTYPE
  4207. SA1 NADS AND STORE IN ADS LIST
  4208. SA7 X1+ADS
  4209. SX7 712B LITERAL OPERATION FROM X1,X2 INTO X7
  4210. EQ BINARY
  4211. BINARY3 SX0 B1 NOT LITERALS
  4212. LX0 3
  4213. SB2 A0
  4214. SX3 X0+B2 ORIGIN REGISTERS
  4215. RJ PICKX PICK A DESTINATION REGISTER
  4216. BINARY4 SX7 1
  4217. SA7 B1+RX RESERVE RESULT REGISTER
  4218. SX7 B1 RETURNED IN B1
  4219. LX7 6
  4220. BX7 X3+X7 ALL 3 REGISTERS
  4221. EQ BINARY RETURNED IN X7
  4222. *
  4223. * /--- BLOCK BINARY 00 000 78/01/23 21.44
  4224. *
  4225. * COME HERE WHEN PROCESSING ARRAY ELEMENTS
  4226. * INTIALIZE ARRAY ELEMENT BY ELEMENT LOOP
  4227. *
  4228. ABINARY SA2 X1+ADS ENTER FROM BINARY WITH X1=NADS
  4229. SA3 A2-1 OPERAND ADS 1,2 IN X3,X2
  4230. BX7 X3+X2 TEST WHOLARRAY FLAG
  4231. LX7 1 IN BIT 58
  4232. PL X7,BINARY1 EXIT IF NEITHER IS ARRAY
  4233. * UP TO HERE SHOULD BE INLINE CODE FOR SPEED
  4234. BX4 X3*X2
  4235. LX4 1 LOOK AT $AND$ OF W-ARRAY BITS
  4236. NG X4,ABIN10 JUMP IF BOTH ARE ARRAYS
  4237. * ONE IS SCALAR...MAKE SURE NOT IN REGISTER
  4238. * ROUTINE AINIT IN FILE GETVAR STORES REGISTERS X7,X4,X3.
  4239. * 'THUS THESE REGISTERS MUST NOT CONTAIN THE SCALAR TO BE
  4240. * ADDED TO THE ARRAY.
  4241. *
  4242. * X4 IS THE LOOP COUNTER, AND X3 IS THE ARRAYSEGV MASK.
  4243. * X7 IS USED IN AINIT, BUT POSSIBLY SHOULDN'7T BE. 'INSTEAD
  4244. * X6 SHOULD BE USED TO STORE X3 AND X4 INTO MEMORY.
  4245. RJ STORTMP CHK 2D OPERAND AND SET ASIZE
  4246. SA1 NADS
  4247. SX1 X1-1 GET 1ST ADTYPE
  4248. SA2 X1+ADS
  4249. RJ STORTMP CHK 1ST OPERAND
  4250. EQ ABIN20
  4251. ABIN10 RJ SIZCHK CHECK IF ARRAYS ARE CONFORMAL
  4252. *
  4253. ABIN20 RJ ARYPREP CLEAR X1,2,6, FORM RJ ABUFCHK
  4254. **
  4255. SB1 RAINIT
  4256. RJ LDAINIT GENERATE ALOOP INITIALIZATION
  4257. SB1 2
  4258. RJ LDARRAY GENERATE LOAD 2D OPERAND TO X2
  4259. RJ POPNADS DECREMENT NADS
  4260. SB1 1
  4261. RJ LDARRAY GENERATE LOAD 1ST OPERAND TO X1
  4262. *FORM RESULT ADTYPE
  4263. SB1 0 ALLOW RE-USE OF TMPARAY
  4264. RJ CALCTMP GET LOC OF TMPARRAY BUFFER
  4265. RJ TMPAD FORM TEMP ARRAYWD AND ADTYPE
  4266. SA1 NARRAYS
  4267. BX7 -X1 FLAG FOR ARRAY OP IN PROGRESS
  4268. SA7 A1
  4269. *SET REGISTER ASSIGNMENTS
  4270. * SX3 12B ORIGIN REGISTERS
  4271. * EQ BINARY4
  4272. SB1 6 RESULT REGISTER
  4273. SX7 612B RESULT IN X6, BUT DONT RESERVE
  4274. EQ BINARY
  4275. BINA0 BSS 1
  4276. * /--- BLOCK TMPAD 00 000 77/12/19 16.19
  4277. TITLE TMPAD -- FORMS ARRAYWORD/AD FOR *TMPARY*
  4278. *
  4279. * -TMPAD-
  4280. *
  4281. * FORMS ARRAYWORD AND *ADS* FOR OPERATIONS FROM
  4282. * *TMPARY*
  4283. *
  4284. TMPAD EQ * FORMS ARRAYWD AND AD FOR TMPARY
  4285. SA1 ASIZE TEMPORARY ARRAY LITWORD
  4286. SA2 TMPARAY AND ADDRESS
  4287. ZR X1,TMPAD2 JUMP IF RESULT IS SCALAR
  4288. MX0 -18
  4289. BX6 X0*X1 MASK OUT OLD AND ADD NEW
  4290. BX6 X6+X2 CM START ADDRESS (I/F BIT=0)
  4291. MX0 2
  4292. LX0 58 ALL TMP ARRAYS ARE WHOLE WORDS
  4293. BX6 -X0*X6 SO MASK OUT BASE REDEF,SEG BITS
  4294. RJ LSEEK PLANT X6 AS LITERAL
  4295. MX0 2
  4296. LX0 59 BITS 57,58 SET FOR TEMPARRAY
  4297. BX7 X6+X0 ADD ADDRESS OF LIT FROM LSEEK
  4298. SX0 6
  4299. LX0 XCODEAL ARRAY CODE TYPE
  4300. BX7 X7+X0 MERGE IN
  4301. TMPAD6 SA1 NADS
  4302. SA2 X1+ADS ORIGINAL ADTYPE NEEDED 4 UMINUS
  4303. SA7 X1+ADS REPLACE 1ST OPERAND WITH
  4304. EQ TMPAD RESULT TEMP-ARRAY ADTYPE
  4305. *
  4306. * IF SCALAR FROM DOTMULT, RESULT STILL IN REGISTER X7
  4307. TMPAD2 MX0 1 IN-REGISTER BIT
  4308. SX7 7 REGISTER NUMBER
  4309. BX7 X7+X0 WILL ADD I/F BIT LATER
  4310. SX6 1
  4311. SA6 RX+7 MARK REGISTER 7 IN USE
  4312. EQ TMPAD6 AND PUT IN RESULT ADTYPE
  4313. * /--- BLOCK SIZCHK 00 000 77/12/19 16.21
  4314. TITLE SIZCHK -- CHECKS ARRAYS FOR CONFORMALITY
  4315. *
  4316. * -SIZCHK-
  4317. *
  4318. * CHECKS THE ARRAY BINARY OPERANDS TO MAKE SURE
  4319. * THEIR SIZES CONFORM.
  4320. *
  4321. *
  4322. SIZCHK EQ * CHECKS ARRAYS FOR CONFORMALITY
  4323. MX0 -XCODEAL
  4324. BX1 -X0*X3
  4325. BX2 -X0*X2 EXTRACT ADDRESSES FROM ADTYPES
  4326. MX0 36 MASK FOR SIZE+ROWS+COLS+PLANES
  4327. SA1 X1+INFO
  4328. SA2 X2+INFO GET ARRAYWD LITERALS
  4329. BX7 X1
  4330. SA7 ASIZE SAVE TMPARRAY LITWORD
  4331. LX0 54
  4332. BX3 X0*X1 EXTRACT SIZE,SHAPE INFO
  4333. BX4 X0*X2
  4334. IX7 X3-X4
  4335. NZ X7,SIZERR ERROR IF NOT CONFORMAL
  4336. BX7 X1-X2 LOOK AT DIFFERENCE BETWEEN
  4337. LX7 1 REAL/COMPLEX BITS
  4338. PL X7,SIZCHK EXIT IF IDENTICAL
  4339. EQ CPXERR ERROR IF NOT
  4340. *
  4341. TITLE GETARAD
  4342. *
  4343. GETARAD EQ * ENTER WITH OPERAND ADS IN X1
  4344. MX0 -XCODEAL
  4345. * BX3 -X0*X1
  4346. BX6 -X0*X1 ADDR OF ARRAY LIT WD
  4347. * SA3 X3+INFO
  4348. SA3 X6+INFO ARAYWD INFO
  4349. SA6 SEGWD SAVE ADDR
  4350. MX4 0 TEMP ARAY ADDR ALREADY ABSOLUTE
  4351. LX1 2 PUT TEMP ARAY BIT AT LEFT
  4352. NG X1,GETARA5 JUMP IF TEMP ARAY
  4353. SA4 ASVARS
  4354. PL X3,GETARA5 JUMP IF IN STUDENT BANK
  4355. SA4 ACVARS MUST BE IN COMMON BANK
  4356. GETARA5 BX3 -X0*X3 EXTRACT RELATIVE START ADDR
  4357. IX3 X4+X3 MAKE IT ABSOLUTE
  4358. EQ GETARAD
  4359. * /--- BLOCK LDAINTR 00 000 79/02/09 13.54
  4360. TITLE LDAINTR -- CODE TO TEST FOR ARRAY INTERRUPT
  4361. * -LDAINTR-
  4362. * GENERATE CODE TO TEST IF ARRAY INTERRUPT NEEDED
  4363. *
  4364. LDAINTR EQ *
  4365. SA1 TMPAFLG
  4366. SX2 X1 GET TMPARAY ADDR
  4367. MX0 -9
  4368. LX1 15 POSITION SIZE CODE
  4369. BX1 -X0*X1
  4370. SA3 AWVARS WORK-1
  4371. SX3 X3-ARAYLTH START OF TEMPARAY
  4372. IX6 X2-X3
  4373. IX6 X1+X6 ADD SIZE TO GET TMP WORDS USED
  4374. BX6 -X0*X6 9BITLIMIT
  4375. SX7 6110B CODE FOR *SB1*
  4376. LX7 18
  4377. BX7 X7+X6
  4378. RJ LONGI GENERATE *SB1 TMPASIZ*
  4379. SB1 RAINTER
  4380. RJ LDASUB GENERATE *RJ AINTER*
  4381. EQ LDAINTR
  4382. *
  4383. TITLE ARYPREP
  4384. *
  4385. * THIS MUST BE DONE BEFORE ANY WHOLE-ARRAY PROCESS
  4386. * CLEARS X1,X2,X6 FOR GETVAR ARRAY ROUTINES AND
  4387. * CALLS ECS INTERRUPT BUFFER AVAILABILITY ROUTINE
  4388. *
  4389. *'N'O'T'E'; THE ONLY REASON THIS WORKS IS THAT CHOOSEX DOES NOT
  4390. *CHOOSE X1,X2,X6. 'THUSLY THE FOLLOWING DOESN'7T HAPPEN';
  4391. *CHEKRR FREES UP X1. CHEKRR THEN MOVES X2 INTO X1.
  4392. *
  4393. ARYPREP EQ *
  4394. SB1 1 CLEAN OUT X1,X2,X6 FOR
  4395. RJ CHEKRR ARRAY LOOP ROUTINES
  4396. SB1 2
  4397. RJ CHEKRR
  4398. SB1 6
  4399. RJ CHEKRR
  4400. SA2 BUFCHK ZR IF NO INTERRUPT CALL YET
  4401. NZ X2,ARYPREP EXIT IF DONE ALREADY THIS LINE
  4402. MX7 -1 SET FLAG TO SHOW CHECK DONE
  4403. SA7 A2 FOR ECS SAVE BUFFER
  4404. SB1 RBUFCHK
  4405. RJ LDASUB GENERATE *RJ ABUFCHK*
  4406. EQ ARYPREP
  4407. *
  4408. TITLE LDAINIT
  4409. *
  4410. * GENERATE CODE TO INITIALIZE SIZE,INDEX FOR ALOOPS
  4411. * ENTER WITH ENTRY OFFSET IN B1 (RAINIT, ETC)
  4412. LDAINIT EQ *
  4413. SA1 ASIZE
  4414. LX1 15
  4415. MX0 -9
  4416. BX1 -X0*X1 MASK OUT NO. OF ARRAY ELEMENTS
  4417. SX7 6110B CODE FOR SB1 **
  4418. LX7 18
  4419. BX7 X1+X7 GENERATE CODE FOR SB1 SIZE
  4420. RJ LONGI
  4421. RJ LDASUB GENERATE RJ AINIT (ETC)
  4422. EQ LDAINIT
  4423. *
  4424. TITLE LDASUB
  4425. *
  4426. LDASUB EQ * GENERATE RJ ARRAY*SUBR*ADDR
  4427. SA2 LLALOOP ENTRY REFERENCE ADDRESS
  4428. SX7 B1 ENTER WITH RELATIVE ADDR IN B1
  4429. IX2 X2-X7 ABSOLUTE ADDR OF ARRAY SUBR
  4430. SX7 0100B CODE FOR RJ **
  4431. LX7 18
  4432. BX7 X7+X2 GENERATE RJ **
  4433. RJ LONGI
  4434. RJ PAD MAKE SURE START NEW INSTR WORD
  4435. EQ LDASUB
  4436. * /--- BLOCK CALCTMP 00 000 79/02/09 13.54
  4437. TITLE CALCTMP
  4438. *
  4439. * SUBROUTINE TO PUT ABSOLUTE ARRAY STARTING ADDRESS
  4440. * INTO X3
  4441. *
  4442. CALCTMP EQ *
  4443. SA4 TMPAFLG GET CURRENT TMPARAY INFO
  4444. MX7 -XCODEAL
  4445. BX7 -X7*X4 EXTRACT 14BIT CURRENT ADDRESS
  4446. MX0 9
  4447. LX0 54 POSITION SIZE FIELD MASK
  4448. SA3 ASIZE GET CURRENT SIZE INFO
  4449. ZR X3,CLCTMP8 JUMP IF ONLY NEED SCALAR
  4450. BX3 X0*X3 EXTRACT SIZE
  4451. ZR X7,CLCTMP2 JUMP IF NOT INITIALIZED YET
  4452. NE B1,B0,CLCTMP5 FORCE NEW TMPARAY IF B1=1
  4453. SA2 AOPAD 2 OPERAND ADDR IN LOWER 36 BITS
  4454. SX6 X2 GET ONE
  4455. IX6 X6-X7 IF CURRENT TMPARRAY MATCHES ONE
  4456. ZR X6,CLCTMP3 CAN USE IT FOR RESULT AS WELL
  4457. AX2 18
  4458. SX6 X2 TRY 2D
  4459. IX6 X6-X7
  4460. NZ X6,CLCTMP5 GET NEW TMPARAY IF NO MATCH
  4461. CLCTMP3 SA7 TMPARAY SAVE ADDRESS FOR IMMED. USE
  4462. BX7 X7+X3 MERGE ADDRESS, CURRENT SIZE
  4463. SX3 X7 EXTRACT ADDRESS AGAIN
  4464. SA7 TMPAFLG RESTORE ARRAY FLAG
  4465. RJ SVAOPAD TEMPARAY WAS LAST OPERAND
  4466. EQ CALCTMP
  4467. *
  4468. CLCTMP2 BSS 0 MUST GET INITIAL TMPARAY ADDR
  4469. SA4 AWVARS LOC OF TOP OF WORK-1
  4470. SX7 ARAYLTH
  4471. IX7 X4-X7 LOC OF START OF TEMP ARAY BUFFR
  4472. EQ CLCTMP3
  4473. *
  4474. * NEW TMPARAY NEEDED...SEE IF ROOM ENOUGH
  4475. CLCTMP5 BX6 X0*X4 EXTRACT CURRENT TMPARRAY SIZE
  4476. AX6 45
  4477. BX4 X3*X0 COPY NEW SIZE FIELD
  4478. AX4 45 POSITION NEEDED SIZE AT RIGHT
  4479. IX7 X6+X7 LOC OF START OF NEXT TMPARRAY
  4480. IX6 X7+X4 +SIZ = END
  4481. SA2 AWVARS
  4482. IX6 X2-X6 WORK-1 - END
  4483. NG X6,MNYAERR ERROR IF OVERFLOW
  4484. SA7 TMPARAY SAVE ADDRESS
  4485. BX7 X7+X3 MERGE IN NEW SIZE
  4486. SA7 TMPAFLG RESTORE NEW TMPAFLG
  4487. EQ CALCTMP
  4488. *
  4489. CLCTMP8 MX0 1
  4490. BX7 X0+X4 SET TMPAFLG NONZERO FOR NOTCALC
  4491. SA7 TMPAFLG
  4492. SA2 TEMP TEMP STORAGE POINTER
  4493. SX7 X2+1
  4494. SA7 A2 INCREMENT POINTER
  4495. SX7 X7-TEMPLIM
  4496. PL X7,TEMPERR CHECK FOR TOO MANY TEMPS
  4497. SX7 X2+VARLIM+1 RELATIVE TEMP STORE ADDRESS
  4498. SA4 ASVARS STUDVAR START
  4499. IX7 X7+X4
  4500. SA7 TMPARAY ABSOLUTE TEMP STORE ADDR
  4501. EQ CALCTMP
  4502. * /--- BLOCK STORTMP 00 000 78/09/15 18.56
  4503. TITLE STORTMP
  4504. *
  4505. * -STORTMP-
  4506. *
  4507. * SUBROUTINE TO STORE REGISTER TO TEMP LOC
  4508. *
  4509. STORTMP EQ * ENTER WITH NADS IN X1,AD IN X2
  4510. NG X2,STORT2 IF SCALAR IN REGISTER, STORIT
  4511. LX2 1 CHECK ARRAY FLAG
  4512. PL X2,STORTMP IF SCALAR IN MEMORY, EXIT
  4513. MX0 -XCODEAL IS ARRAY
  4514. LX2 59
  4515. BX2 -X0*X2 GET XSTOR ADDRESS
  4516. SA2 X2+INFO GET ARRAYWD INFO
  4517. BX7 X2
  4518. SA7 ASIZE SAVE TMPARRAY INFO
  4519. EQ STORTMP
  4520. STORT2 SA0 X1 SAVE NADS
  4521. MX0 -3 MASK FOR REGISTER NUMBER
  4522. BX1 -X0*X2 REGISTER NUMBER NOW IN
  4523. * SB1 X1
  4524. * SB2 7
  4525. * EQ B1,B2,STORT5 JUMP IF IN X7
  4526. * RJ FREEX FREE CURRENT REGISTER
  4527. SB2 X1
  4528. SB1 7
  4529. EQ B1,B2,STORT5 JUMP IF IN X7
  4530. CALL CHEKRR B1=7, FREE UP REG 7
  4531. SA2 A0+ADS GET BACK ADS
  4532. MX0 -3
  4533. BX1 -X0*X2 REGISTER AGAIN IN X1
  4534. SB1 X1
  4535. RJ FREEX FREE CURRENT REGISTER
  4536. SX7 1070B CODE FOR BX7J
  4537. BX7 X7+X1 X1 UNCHANGED BY FREEX
  4538. LX7 3 BX7J0
  4539. RJ SHORT ADD *BX7 XJ* TO INSTRUCTIONS
  4540. STORT5 SA1 A0+ADS SET A1=ADDRESS OF ADTYPE
  4541. RJ STR7TMP STORE IN TMP AND RESET ADTYPE
  4542. CALL FREEX,7 RELEASE X7
  4543. EQ STORTMP
  4544. *
  4545. TITLE SVAOPAD
  4546. *
  4547. * SUBR TO SAVE ARRAY OPERAND ADDRESS
  4548. *
  4549. SVAOPAD EQ * OP ADDR IN X3 ON ENTRY
  4550. SA1 AOPAD
  4551. LX1 18 SHIFT PREVIOUS ONE OUT
  4552. MX0 -18
  4553. BX6 X0*X1
  4554. BX3 -X0*X3 LEAVE 18 BIT ADDR IN X3
  4555. BX6 X3+X6 MERGE IN LATEST OPND ADDR
  4556. SA6 A1
  4557. EQ SVAOPAD
  4558. * /--- BLOCK STORTMP 00 000 77/12/19 16.28
  4559. TITLE LDARRAY -- LOAD ARRAY/SCALAR OPERANDS
  4560. *
  4561. * -LDARRAY-
  4562. *
  4563. * SUBROUTINE TO LOAD ARRAY OR SCALAR OPERANDS
  4564. *
  4565. * B1 = REGISTER NUMBER
  4566. *
  4567. LDARRAY EQ * ENTER WITH DESIRED REG. IN B1
  4568. SA1 NADS
  4569. SA1 X1+ADS GET ADTYPE
  4570. NG X1,MATERR ERROR IF STILL IN REGISTER*****
  4571. * SX2 B1 REGISTER NUMBER
  4572. LX1 1
  4573. * RJ FREEX MAKE SURE REGISTER FREE 2 READ
  4574. NG X1,LDARAY2 JUMP IF IT IS ARRAY
  4575. SX3 0 FLAG FOR NOT ARRAY
  4576. RJ SVAOPAD SAVE FOR CALCTMP CHECK
  4577. RJ GENREAD IS SCALAR, SO READ INTO X(B1)
  4578. EQ LDARRAY
  4579. *
  4580. LDARAY2 LX1 59 RESTORE OPERAND ADTYPE
  4581. RJ GETARAD RETURN ABS STARTLOC IN X3
  4582. *
  4583. LDARAY4 RJ SVAOPAD SAVE ARRAY ADDR FOR CALCTMP
  4584. SX7 5204B CODE FOR SA* X4+**
  4585. LX7 18
  4586. BX7 X7+X3 MERGE IN ADDRESS OF START
  4587. SX2 B1 GET BACK REGISTER NUMBER
  4588. LX2 21 POSITION IT
  4589. BX7 X7+X2 FORM SAN X4+(STARTLOC)
  4590. RJ LONGI
  4591. SA1 SEGWD GET BACK ARRAYWD
  4592. SA1 X1+INFO
  4593. LX1 3
  4594. PL X1,LDARAY5 SKIP IF NOT SEGMENT
  4595. RJ MATVS FORM CODE TO EXTRACT SEGMNT
  4596. LDARAY5 SA1 NADS
  4597. SA1 X1+ADS GET BACK ADTYPE
  4598. LX1 60-XCODEAL-5 PUT MODECHANGE BIT AT LEFT
  4599. PL X1,LDARRAY EXIT IF NO MODECHANGE
  4600. RJ FLOATIT GENERATE PACK AND NORMALIZE
  4601. EQ LDARRAY
  4602. * /--- BLOCK LBINARY 00 000 77/12/19 16.29
  4603. TITLE LBINARY -- PREPARE ARGUMENTS FOR SHIFTING
  4604. *
  4605. * -LBINARY-
  4606. *
  4607. * PREPARE ARGUMENTS FOR SHIFT OPERATIONS
  4608. * ALSO DO OPTIMIZING FOR CONSTANT 2ND ARG,
  4609. * AS WELL AS FOR BOTH ARGUMENTS CONSTANT.
  4610. *
  4611. LBINARY EQ * PLACE 2 ARGUMENTS IN X1 AND B1
  4612. MX7 0
  4613. SA7 FLOAT CALL THE RESULT INTEGER TYPE
  4614. SA1 NADS
  4615. SX2 X1-2
  4616. NG X2,FORMERR MUST BE AT LEAST 2 OPERANDS
  4617. SA4 NARRAYS
  4618. NZ X4,ALBINRY JUMP IF ARRAY OPS IN PROGRESS
  4619. LBINRY1 SA1 X1+ADS SEE WHETHER SHIFT COUNT MUST BE FIXED
  4620. SX0 1
  4621. LX0 XCODEAL+3 I/F BIT
  4622. BX0 X0*X1
  4623. NZ X0,ASFTOI MOCK UP A ROUND F TO I FUNCTION
  4624. SA2 NUNITS
  4625. NG X2,LBINAR2
  4626. RJ SAMEUZ SAME UNIT, DIMENSIONLESS RESULT
  4627. LBINAR2 SB1 1 READ SECOND OPERAND INTO X1
  4628. SA2 NADS
  4629. SA2 X2+ADS
  4630. NG X2,LBINA21 JUMP IF IN REGISTER
  4631. MX0 58
  4632. AX2 XCODEAL+1
  4633. BX2 -X0*X2
  4634. ZR X2,LBINAR5 JUMP IF 2ND ARG CONSTANT
  4635. *
  4636. LBINA21 RJ GENREAD GENERATE READ OF LAST OPERAND
  4637. SX1 B1 REGISTER ASSIGNMENT
  4638. SX7 X1+6310B GENERATE SB1 XN
  4639. LX7 3
  4640. RJ SHORT
  4641. GET1ST SA1 NADS
  4642. SX7 X1-1 DECREMENT NADS TO GET FIRST OPERAND
  4643. SA7 A1
  4644. SB1 1 READ FIRST OPERAND INTO X1
  4645. RJ GENREAD
  4646. SA2 NOTLITS CHECK FOR BOTH CONSTANT
  4647. ZR X2,SHIFDO
  4648. SA2 SHIFTDN
  4649. NZ X2,LBINAR6 JUMP IF 2ND ARG WAS CONSTANT
  4650. SA0 B1+10B ORIGIN REGISTERS (B1 AND XN)
  4651. RJ PICKX PICK A DESTINATION REGISTER
  4652. LBINAR4 SX7 1
  4653. SA7 B1+RX RESERVE RESULT REGISTER
  4654. SX7 B1 RETURNED IN B1
  4655. LX7 6
  4656. SX0 A0 ORIGIN REGISTERS
  4657. BX7 X7+X0 X(DESINATION)--B1--X(ORIGIN)
  4658. EQ LBINARY
  4659. * /--- BLOCK LBINARY 00 000 78/01/20 15.00
  4660. *
  4661. LBINAR6 SX7 1
  4662. SA7 B1+RX RESERVE REGISTER
  4663. SX7 B1
  4664. MX0 1
  4665. BX6 X7+X0 FLAG REGISTER ADTYPE WITH SIGN BIT
  4666. LX7 6 POSITION REGISTER CORRECTLY
  4667. SA1 NADS
  4668. SA6 X1+ADS STORE ADTYPE OF RESULT
  4669. EQ LBINARY
  4670. *
  4671. LBINAR5 SA2 NOTLITS
  4672. BX7 X2
  4673. MX6 0
  4674. SA6 A2 KLUGE NOTLITS SO GENREAD
  4675. SA7 SHIFTDN RETURNS CONSTANT
  4676. RJ GENREAD GET 2ND ARGUMENT
  4677. SA2 SHIFTDN
  4678. BX7 X2
  4679. MX6 -6
  4680. SA7 NOTLITS RESTORE NOTLITS
  4681. SX7 1
  4682. SA7 A2 SET SHIFTDN TO SAY 2ND ARG CONSTANT
  4683. SA3 IOP
  4684. SA2 ARGX1 LOAD 2ND ARGUMENT
  4685. PL X2,LBINAR7 NEGATIVE, SHIFT OTHER WAY
  4686. BX2 -X2
  4687. SX4 X3-20000B
  4688. ZR X4,LBINA55
  4689. SX3 20000B
  4690. EQ LBINAR7
  4691. LBINA55 SX3 21000B
  4692. LBINAR7 BX6 -X6*X2 LIMIT CONSTANT TO SIX BITS
  4693. BX6 X6+X3 UNION CONSTANT INTO INSTRUCTION
  4694. SA6 A3
  4695. EQ GET1ST GET 1ST ARGUMENT
  4696. *
  4697. *
  4698. SHIFDO SX7 1 1 FOR LONG LITERAL
  4699. SA1 NLITS INCREMENT NUMBER OF LITERALS
  4700. SX6 X1+1 RESULT WILL BE PLACED THERE
  4701. SA6 A1
  4702. SX1 X6-LITL
  4703. PL X1,LITERR JUMP IF TOO MANY LITERALS IN THIS CALC
  4704. LX7 XCODEAL TURN CORRECT BIT ON
  4705. BX7 X7+X6 FORM RESULT ADTYPE
  4706. SX1 1 INDICATE STORED IN *LITS*
  4707. LX1 LITSHFT
  4708. BX7 X7+X1
  4709. SA1 NADS AND STORE IN ADS LIST
  4710. SA7 X1+ADS
  4711. *
  4712. *NOTE THAT INSTRUCTION HAS X7 SPECIFIED AS SHIFTING REGISTER
  4713. SA1 =46000460004600000700B THREE PASSES
  4714. SA2 IOP
  4715. BX7 X1+X2 PUT NOPS AND INST. TOGETHER
  4716. SA7 EXECUTE PLANT THE INSTRUCTION
  4717. SA1 ARGX1 LOAD FIRST ARG
  4718. BX7 X1 PUT INTO X7
  4719. RJ EXECIT EXECUTE THE PLANTED INSTRUCTION
  4720. SA1 NLITS RESULT IN X7
  4721. *NLITS HAS BEEN ALREADY INCREMENTED ABOVE
  4722. SA7 X1+LITS STORE IN LITS TABLE
  4723. MX0 60-XCODEAL CHECK TO SEE IF RESULT IS SHORT LITERAL
  4724. BX0 X0*X7
  4725. NZ X0,LBINARY LONG, ALREADY SET UP CORRECTLY
  4726. SA1 NADS
  4727. SA7 X1+ADS CHANGE TO SHORT
  4728. EQ LBINARY
  4729. *
  4730. *
  4731. * /--- BLOCK LBINARY 00 000 78/09/16 00.56
  4732. *
  4733. ALBINRY SA2 X1+ADS ENTER FROM LBINARY WITH X1=NADS
  4734. SA3 A2-1 OPERAND ADS 1,2 IN X3,X2
  4735. BX7 X3+X2 TEST WHOLARRAY FLAG
  4736. LX7 1 IN BIT 58
  4737. PL X7,LBINRY1 EXIT IF NEITHER IS ARRAY
  4738. * UP TO HERE SHOULD BE INLINE CODE FOR SPEED
  4739. BX4 X3*X2
  4740. LX4 1
  4741. NG X4,ALBIN10 JUMP IF BOTH ARE ARRAYS
  4742. BX0 X2
  4743. LX0 1 IS 2D OPERAND AN ARRAY
  4744. NG X0,ALBIN05 JUMP IF IS, CHECK FLOAT LATER
  4745. LX0 59-XCODEAL-4 CHECK I/F BIT OF SCALAR
  4746. NG X0,ASFTOI IF FLOATING,MOCK UP ROUNDING OP
  4747. RJ STORTMP PUT FIXED SCALAR IN TMP STORAGE
  4748. **** EQ ALBIN20 AND SET ASIZ IF ARRAY
  4749. SA1 NADS RESTORE AFTER STORTMP
  4750. SA2 X1+ADS
  4751. SA3 A2-1
  4752. ALBIN05 SX1 X1-1 NADS-1=1ST OPERAND ADDR
  4753. BX2 X3 1ST OPERAND
  4754. RJ STORTMP STORE SCALAR, SET ASIZ IF ARRAY
  4755. EQ ALBIN20
  4756. ALBIN10 RJ SIZCHK CHECK IF ARRAYS CONFORMAL
  4757. **
  4758. ALBIN20 RJ ARYPREP CLEAR X1,2,6, FORM RJ ABUFCHK
  4759. SB1 RAINIT
  4760. RJ LDAINIT GENERATE ALOOP INITIALIZATION
  4761. SB1 1
  4762. RJ LDARRAY LOAD 2D OPERAND TO X1
  4763. SA1 NADS
  4764. SA2 X1+ADS 2D OPERAND
  4765. * NOTE SCALAR 2D OPERAND WAS FIXED ABOVE
  4766. LX2 60-XCODEAL-4 CHECK I/F BIT
  4767. NG X2,ALBIN80 JUMP IF FLOATING
  4768. ALBIN30 SX7 63110B SB1 X1
  4769. RJ SHORT GENERATE INSTRUCTION
  4770. RJ POPNADS
  4771. SB1 1
  4772. RJ LDARRAY GENERATE SA1 1ST OPERAND
  4773. SB1 0 ALLOW REUSE OF TMPARAY
  4774. RJ CALCTMP GET LOC OF TMPARAY
  4775. RJ TMPAD FORM TEMPARAYWD AND OPERAND
  4776. SA1 NARRAYS
  4777. BX7 -X1 FLAG FOR ARRAY LOOP IN PROGRESS
  4778. SA7 A1
  4779. SX7 611B TAG FOR X6,B1,X1 SHIFT CODES
  4780. EQ LBINARY (DEST=X6, BUT X6 RESTORED LATER
  4781. * SA0 11B ORIGIN REGISTERS B1,X1
  4782. * SB1 6 RESULT IN X6
  4783. * EQ LBINAR4
  4784. *
  4785. * ROUNDS 2D OPERAND (IN X1) AND FIXES INTO X1
  4786. ALBIN80 SX1 RNDFIOP ROUNDING OPERATOR
  4787. SX0 X1-FUNCT0 GET FUNCTION NUMBER
  4788. SX6 1
  4789. SA6 FFLT MARK FLOATING ARGUMENT
  4790. RJ GENFCT GENERATE ROUNDING RJ CODE
  4791. EQ ALBIN30
  4792. *
  4793. * /--- BLOCK MATVS 00 000 77/12/19 19.33
  4794. TITLE MATVS
  4795. *
  4796. * EXTRACT VERTICALSEGMENT FROM WORD IN X1
  4797. * FOR ARRAY OPERATIONS
  4798. *
  4799. * A1 = ADDRESS OF ARRAY INFO WORDS
  4800. *
  4801. MATVS EQ * ARRAY INFO WD ADDR IN A1
  4802. SA1 A1+1 GET 2D ARAYWORD
  4803. LX1 1 CHECK VERTSEG BIT
  4804. PL X1,MATERR DONT ALLOW HORIZSEG YET
  4805. SX6 B1
  4806. SA6 MATB1 SAVE B1
  4807. LX6 3
  4808. SX6 X6+B1
  4809. LX6 3 A0=(B1)(B1)4B INDICATING
  4810. **** SA0 X6+4 WORD IN X(B1), MASK IN X4
  4811. SA0 X6+3 WORD IN X(B1), MASK IN X3
  4812. LX1 59 SIGNED BIT AT TOP
  4813. AX1 42 POSITION STARTBIT
  4814. MX0 -6
  4815. BX6 -X0*X1
  4816. SB1 X6-1 STARTBIT-1
  4817. AX1 6
  4818. BX3 -X0*X1 BITS/BYTE
  4819. SB2 X3
  4820. *
  4821. RJ VREAD GENERATE VERTSEG EXTRACT CODE
  4822. *
  4823. SA1 MATB1 RESTORE B1
  4824. SB1 X1
  4825. EQ MATVS
  4826. *
  4827. MATB1 BSS 1 SAVE B1
  4828. *
  4829. * /--- BLOCK GETINDX 00 000 77/12/19 20.04
  4830. CONDEN
  4831. TITLE GETINDX -- GET INTEGER INDEX
  4832. *
  4833. * SUBROUTINE TO GET INTEGER INDEX INTO X6
  4834. * ENTER WITH INDEX GETVAR CODE IN X1
  4835. * ABS(INDEX) MUST BE LESS THAN 13 BITS
  4836. * MUST NOT CHANGE X7
  4837. GETINDX EQ *
  4838. MX0 -XCODEAL
  4839. BX6 -X0*X1 MASK OFF ADDRESS
  4840. AX1 XCODEAL-1 CHECK FOR 13BIT SHORT LITERAL
  4841. ZR X1,GETINDX IF IS, EXIT WITH X6=LITERAL
  4842. AX1 1 POSITION GETVAR TYPE
  4843. SX1 X1-1 CHECK FOR LONG INTEGER LIT TYPE
  4844. NZ X1,INDXERR ONLY CALLED BY 0,1 TYPE
  4845. SA1 X6+LITS GET LONG LITERAL INDEX
  4846. BX6 X1
  4847. PL X1,INDXERR IF PLUS, IS GT 13 BITS
  4848. ZR X1,GETINDX -0 IS OK
  4849. BX1 -X1 GET ABS(INDEX)
  4850. MX0 -13
  4851. BX1 X0*X1 CHECK FOR UPPER BITS
  4852. ZR X1,GETINDX
  4853. EQ INDXERR ERROR IF GT 13 BITS
  4854. *
  4855. ENDIF
  4856. * /--- BLOCK LOADIND 00 000 77/12/19 19.35
  4857. TITLE LOADIND -- LOAD INDEX TO X(B1)
  4858. *
  4859. * -LOADIND-
  4860. *
  4861. * GENERATES CODE TO LOAD THE CURENT INDEX, ADS(NADS)
  4862. * TO REGISTER(B1) AS IN INTEGER VALUE.
  4863. *
  4864. * ON ENTRY,
  4865. * B1 = REGISTER NUMBER TO BE LOADED
  4866. *
  4867. *
  4868. LOADIND EQ * LOADS INDEX TO X(B1)
  4869. RJ FORCEX
  4870. SA1 NADS
  4871. SA1 X1+ADS SEE IF INDEX IS I OR F
  4872. LX1 59-XCODEAL-3
  4873. PL X1,LOADIND EXIT IF INTEGER INDEX
  4874. RJ INDXFLT ROUND INDEX
  4875. EQ LOADIND
  4876. * /--- BLOCK POPNADS 00 000 77/12/19 19.35
  4877. TITLE POPNADS -- BACKUP NADS POINTER
  4878. *
  4879. * -POPNADS-
  4880. *
  4881. * BACKUP THE NADS POINTER TO THE PREVIOUS ENTRY
  4882. * IN THE ADS LIST. THIS ESSENTIALLY POPS THE LAST
  4883. * OPERAND OFF THE STACK.
  4884. *
  4885. POPNADS EQ * BACKUP NADS POINTER
  4886. SA1 NADS
  4887. SX7 X1-1 BACK UP TO INDEX GETVAR CODE
  4888. ZR X7,INDXERR
  4889. NG X7,INDXERR ERROR IF NO INDEX ADTYPE
  4890. SA7 A1
  4891. EQ POPNADS
  4892. * /--- BLOCK ROW/COLCHK 00 000 77/12/19 20.05
  4893. CONDEN
  4894. TITLE ROW/COLUMN BOUNDS CHECKING
  4895. *
  4896. * SUBROUTINE TO CHECK IF ROWS IN BOUNDS
  4897. ROWCHK EQ * INDEX IN X6, ARAYWDS IN X1,X2
  4898. SX7 1 DEFAULT ROW1
  4899. ZR X2,ROWCHK2 JUMP IF NO ARAYWD2
  4900. BX7 X2 EXTRACT ROW1 FROM ARAYWD2
  4901. LX7 18
  4902. AX7 46 EXTEND SIGN+PUT ROW1 AT RT
  4903. ROWCHK2 IX7 X6-X7
  4904. NG X7,INDXERR ROW MUST BE GE ROW1
  4905. BX3 X1 EXTRACT ROWS-1 FROM ARAYWD
  4906. LX3 6+2*9 POSITION ROWS-1 AT RIGHT
  4907. MX0 -9
  4908. BX3 -X0*X3 MASK OFF NUMROWS-1
  4909. IX3 X3-X7 (ROWS-1)-(INDEX-ROW1)
  4910. NG X3,INDXERR ERROR IF TOO MANY ROWS
  4911. EQ ROWCHK EXIT WITH ADJUSTED INDEX IN X7
  4912. *
  4913. * SUBROUTINE TO CHECK COLUMN BOUNDS
  4914. * DONT CHANGE X1,X2,X7 (SEE ROWCHK FOR DETAILS)
  4915. COLCHK EQ * ENTER WITH ARAYWDS IN X1,X2
  4916. BX4 X1 AND COL INDEX IN X3
  4917. LX4 6+3*9
  4918. MX0 -9
  4919. BX4 -X0*X4 NUMCOLS-1 LEFT IN X4
  4920. SX6 1
  4921. ZR X2,COLCHK2
  4922. BX6 X2
  4923. LX6 32
  4924. AX6 46
  4925. COLCHK2 IX6 X3-X6 COL-COL1
  4926. NG X6,INDXERR
  4927. IX3 X4-X6 (NUMCOLS-1)-(INDEX-COL1)
  4928. NG X3,INDXERR
  4929. EQ COLCHK EXIT WITH COL-COL1 IN X6
  4930. *
  4931. *SUBROUTINE TO MERGE ADJUSTED INDEX (IN X7) WITH
  4932. *ARRAYWD START LOC AND I/F BIT (IN X1)
  4933. MERGAD EQ *
  4934. MX0 -XCODEAL
  4935. BX3 -X0*X1 EXTRACT ARRAY START ADDRESS
  4936. IX6 X7+X3 ADD ADJUSTED ARRAY ELEMENT INDX
  4937. MX0 1
  4938. LX0 XCODEAL+4 POSITION MASK
  4939. BX4 X0*X1 TO EXTRACT I/F BIT
  4940. BX6 X6+X4 AND MERGE IN
  4941. SX4 2 STUD BANK GETVAR TYPE
  4942. PL X1,MERGAD2 JUMP IF ARRAY IN STUD BANK
  4943. SX4 3 COMMON BANK GETVAR TYPE
  4944. MERGAD2 LX4 XCODEAL POSITION GETVAR TYPE
  4945. BX6 X6+X4 AND MERGE IN
  4946. EQ MERGAD EXIT WITH GETVAR CODE IN X6
  4947. *
  4948. ENDIF
  4949. * /--- BLOCK FCCHK 00 000 86/03/12 19.37
  4950. TITLE FCCHK -- CHECK TYPE OF GETVAR CODE
  4951. *
  4952. *
  4953. * RETURNS X0 = -1 IF CONSTANT, 0 IF NOT
  4954. * X1 = GETVAR CODE
  4955. * X2 = I/F TYPE
  4956. * X3 = VALUE OF CONSTANT
  4957. * X4 = GETVAR TYPE - 2
  4958. * (USED BY *VARLOC*)
  4959. *
  4960. FCCHK EQ *
  4961. MX0 0 PRE-SET NOT CONSTANT
  4962. SA1 NADS LOAD POINTER IN ADDRESS STACK
  4963. SA1 X1+ADS LOAD -GETVAR- CODE
  4964. SX2 1
  4965. SX3 1
  4966. LX3 LITSHFT *LITS* BIT
  4967. BX4 -X3*X1 TURN OFF *LITS* BIT
  4968. LX2 XCODEAL+3 POSITION I/F BIT
  4969. BX4 -X2*X4
  4970. BX2 X2*X1
  4971. NG X1,FCCHK EXIT IF IN REGISTER
  4972. *
  4973. MX3 -XCODEAL
  4974. BX3 -X3*X1 MASK OFF ADDRESS PORTION
  4975. AX4 XCODEAL POSITION TYPE CODE
  4976. SX4 X4-2 0 AND 1 = CONSTANT CODES
  4977. PL X4,FCCHK EXIT IF NOT CONSTANT
  4978. MX0 -1
  4979. SX4 X4+1 CHECK FOR SHORT LITERAL
  4980. NZ X4,FCCHK
  4981. RJ =XRLLIT X6 = LITERAL
  4982. BX3 X6
  4983. BX1 X3 X1 = LITERAL
  4984. MX0 -1
  4985. EQ FCCHK
  4986. * /--- BLOCK TRND 00 000 77/12/19 16.40
  4987. TITLE FUNCTIONS (FROM GETVAR)
  4988. *
  4989. * -TRND-
  4990. *
  4991. * ROUND VALUE IN X1 TO NEAREST INTEGER BOUNDARY
  4992. *
  4993. *
  4994. TRND EQ *
  4995. SA2 =.5 ROUND TO NEAREST INTEGER
  4996. PL X1,PLRND
  4997. BX2 -X2 SUBTRACT .5 IF NUMBER IS NEG
  4998. PLRND RX1 X1+X2 ADD .5
  4999. UX1 X1,B1 TRUNCATE X1
  5000. LX1 X1,B1
  5001. MX2 0
  5002. IX1 X1+X2 CHANGE -0 TO +0
  5003. EQ TRND
  5004. *
  5005. EJECT
  5006. *
  5007. * -TLMASK-
  5008. *
  5009. * MASK GENERATING FUNCTIONS (LEFT AND RIGHT)
  5010. *
  5011. TLMASK EQ *
  5012. SX1 X1+0 CONVERT -0 TO +0
  5013. ZR X1,TLMASK +++ DONE
  5014. NG X1,MASKERR --- ERROR IF NEGATIVE COUNT
  5015. SB1 X1-1
  5016. SX1 B1-BPW
  5017. PL X1,MASKERR --- ERROR IF OVER BITS PER WORD
  5018. MX1 1
  5019. AX1 X1,B1
  5020. EQ TLMASK
  5021. *
  5022. TRMASK EQ *
  5023. SX1 X1+0 CONVERT -0 TO +0
  5024. ZR X1,TRMASK +++ DONE
  5025. NG X1,MASKERR --- ERROR IF NEGATIVE COUNT
  5026. SB1 X1-1
  5027. SX1 B1-BPW
  5028. PL X1,MASKERR --- ERROR IF OVER BITS PER WORD
  5029. MX1 1
  5030. AX1 X1,B1
  5031. LX1 1
  5032. LX1 X1,B1 RE-POSITION AT RIGHT
  5033. EQ TRMASK
  5034. * /--- BLOCK TINTX 00 000 77/12/19 16.41
  5035. EJECT
  5036. *
  5037. PLATO USE ROUTINES FROM -GETVAR-
  5038. EXT TINTX,TFRACX
  5039. ENDIF
  5040. *
  5041. CONDEN ROUTINES COPIED FROM -GETVAR-
  5042. EQTOLER DATA 1.0E-9 A=B IF ABS(A-B) LT EQTOLER
  5043. *
  5044. *
  5045. * -TINTX-
  5046. *
  5047. TINTX EQ *
  5048. SA2 EQTOLER MUST ROUND ARGUMENT
  5049. PL X1,TINT1
  5050. BX2 -X2
  5051. TINT1 FX1 X1+X2 ROUND
  5052. NX1 X1
  5053. UX1 X1,B1
  5054. SB2 B1-11
  5055. PL B2,TINT2 NUMBER IS TOO BIG
  5056. LX1 X1,B1
  5057. NZ X1,TINTX
  5058. MX1 0 ELIMINATE -0
  5059. EQ TINTX
  5060. TINT2 NG X1,TINT3 HUGE NEGATIVE NUMBER
  5061. MX1 -1
  5062. LX1 59 MAXIMUM POSITIVE NUMBER
  5063. EQ TINTX
  5064. TINT3 MX1 1 MAXIMUM NEGATIVE NUMBER
  5065. EQ TINTX
  5066. *
  5067. EJECT
  5068. *
  5069. * -TFRACX-
  5070. *
  5071. TFRACX EQ *
  5072. NG X1,NGFRAC HANDLE NEGATIVE ARGUMENT SEPARATELY
  5073. SA2 EQTOLER ROUND BY FLOATING TOLERANCE
  5074. FX2 X1+X2
  5075. UX2 X2,B1
  5076. *
  5077. GT B1,B0,ZRFRAC CANNOT USE INTEGER > 48 BITS
  5078. *
  5079. LX2 X2,B1 TRUNCATE
  5080. PX2 X2
  5081. NX2 X2 REFLOAT
  5082. FX1 X1-X2 SUBTRACT INTEGER PART FROM NUMBER
  5083. NX1 X1
  5084. NG X1,ZRFRAC CONSIDER THE FRACTION TO BE ZERO
  5085. SA2 EQTOLER
  5086. FX2 X1-X2 CHECK FOR FRACTION SMALLER THAN TOLER
  5087. NG X2,ZRFRAC CONSIDER FRACTION TO BE ZERO
  5088. EQ TFRACX
  5089. ZRFRAC MX1 0 SET FRACTION ZERO
  5090. EQ TFRACX
  5091. NGFRAC SA2 EQTOLER ROUND BY TOLERANCE
  5092. FX2 X1-X2 ARG WAS NEGATIVE
  5093. UX2 X2,B1
  5094. LX2 X2,B1 TRUNCATE
  5095. PX2 X2
  5096. NX2 X2 REFLOAT
  5097. FX1 X1-X2 SUBTRACT OFF THE INTEGER PART
  5098. NX1 X1
  5099. PL X1,ZRFRAC CONSIDER SMALL FRACTION ZERO
  5100. SA2 EQTOLER
  5101. FX2 X1+X2
  5102. PL X2,ZRFRAC CONSIDER SMALL FRACTION ZERO
  5103. EQ TFRACX
  5104. *
  5105. *
  5106. ENDIF
  5107. * /--- BLOCK GENREAD 00 000 78/09/15 19.10
  5108. TITLE GENERATE A READ INSTRUCTION
  5109. *
  5110. * -GENREAD-
  5111. *
  5112. * GENERATE A READ INSTRUCTION
  5113. *
  5114. GENREAD EQ * GENERATE A READ IF NEEDED
  5115. SA1 NADS GET OPERAND
  5116. ZR X1,FORMERR
  5117. NG X1,FORMERR MUST BE AT LEAST ONE OPERAND
  5118. SA1 X1+ADS
  5119. NG X1,GENR0 JUMP IF ALREADY IN REGISTER
  5120. SX3 B1-6 SEE IF X6 OR X7
  5121. NG X3,GENR0 JUMP IF NOT
  5122. BX3 X1
  5123. AX3 XCODEAL SHIFT OFF ADDRESS PORTION
  5124. ZR X3,GENR0 JUMP IF SHORT I LITERAL
  5125. SB1 1 ELSE RESET TO USE X1
  5126. *
  5127. GENR0 MX3 1 MASK TO STRIP OFF SIGN BIT
  5128. BX2 X3 AND LITS/TOKBUF BIT
  5129. LX2 LITSHF1
  5130. BX3 X2+X3
  5131. BX3 -X3*X1 SAVE IN X3
  5132. PL X1,NOTINR JUMP IF NOT ALREADY IN REGISTER
  5133. *****KLUGE FIXUP FOR THE CASE OF 3/SQRT(49)
  5134. *****IN WHICH SQRT(49) IS IN X1 AND MUST BE MOVED
  5135. MX1 57
  5136. BX2 -X1*X3 REGISTER NUMBER--THROW AWAY I/F BIT
  5137. SX1 B1-2
  5138. NZ X1,GENR1 JUMP IF NOT SA2
  5139. SX1 X2-1
  5140. NZ X1,GENR1 JUMP IF NOT IN X1
  5141. SX7 10210B MOVE X1 TO X2
  5142. RJ SHORT
  5143. SB1 1 AND FREE X1
  5144. RJ FREEX
  5145. SX2 2 OPERAND IN X2
  5146. GENR1 SB1 X2 FINAL REGISTER LOCATION
  5147. RJ FREEX FREE IT
  5148. MX6 -1
  5149. SA6 FINDXED FLAG NOT INDEXED VARIABLE
  5150. AX3 XCODEAL+4 CHECK FOR CHANGE MODE
  5151. ZR X3,GENREAD
  5152. RJ FLOATIT FLOAT THE INTEGER
  5153. EQ GENREAD
  5154. *
  5155. ***OPERAND NOT IN REGISTER--
  5156. NOTINR SA2 NOTLITS IS THIS A LITERAL OPERATION
  5157. ZR X2,GENR2 JUMP IF LITERALS
  5158. RJ CHEKRR CHECK READ REGISTER AVAILIBILITY
  5159. GENR2 MX0 60-XCODEAL MASK FOR ADDRESS PART OF CODE
  5160. MX6 -1
  5161. SA6 FINDXED FLAG NOT INDEXED VARIABLE
  5162. BX6 -X0*X3
  5163. AX3 XCODEAL
  5164. MX0 56
  5165. BX2 -X0*X3 SAVE 4-BIT TYPE
  5166. SB2 X2
  5167. AX3 4 X3 NONZERO NOW MEANS CHANGE MODE
  5168. JP B2+VTYPE
  5169. * /--- BLOCK GENREAD 00 000 78/07/28 03.26
  5170. *
  5171. VTYPE EQ ISHORT
  5172. EQ ILONG
  5173. EQ ISTUD
  5174. EQ ICOM
  5175. EQ COMPERR IMPOSSIBLE CODE TYPE
  5176. EQ SEGERR
  5177. EQ MATERR
  5178. EQ COMPERR IMPOSSIBLE CODE TYPE
  5179. EQ COMPERR NO SHORT F LITERALS
  5180. EQ FLONG
  5181. EQ ISTUD
  5182. EQ ICOM
  5183. EQ COMPERR IMPOSSIBLE CODE TYPE
  5184. EQ COMPERR IMPOSSIBLE CODE TYPE
  5185. EQ COMPERR IMPOSSIBLE CODE TYPE
  5186. EQ COMPERR IMPOSSIBLE CODE TYPE
  5187. *
  5188. ISHORT NZ X3,ISHORT2 IF NO I TO F NEEDED, X3 ZERO
  5189. SA1 NOTLITS IS IT LITERAL OPERATION
  5190. ZR X1,ITSLIT JUMP IF ITS LITERALS
  5191. ZR X6,ISHORT0 JUMP IF LITERAL = 0
  5192. ITSHT1 SX7 B1+710B CONSTRUCT SXN LITERAL
  5193. LX7 21
  5194. BX7 X7+X6 X6 HOLDS LITERAL
  5195. RJ LONGI ADD INSTUCTION TO STREAM
  5196. RJ FREEX FREE THE REGISTER
  5197. EQ GENREAD
  5198. *
  5199. ISHORT0 SX1 0
  5200. ITMSK SX7 B1+430B MXN 0
  5201. LX7 6
  5202. BX7 X7+X1
  5203. RJ SHORT ADD INSTRUCTION TO STREAM
  5204. RJ FREEX
  5205. EQ GENREAD
  5206. *
  5207. ISHORT2 PX6 X6 NEED FLOATED, SO PLANT FLOATED LITERAL
  5208. NX6 X6
  5209. ISHORT3 SA1 NOTLITS CHECK FOR LITERAL OPERATION
  5210. NZ X1,ISHORT4 JUMP IF NOT LITERALS
  5211. ITSLIT SA6 ARG+B1 B1 IS 1 OR 2---STORE IN ARG1 OR ARG2
  5212. EQ GENREAD
  5213. ISHORT4 BSS 0
  5214. ZR X6,ISHORT0 -- LITERAL 0 CAN BE HANDLED
  5215. SB2 B1 ELSE SAVE B1
  5216. RJ LSEEK PLANT LITERAL IN EXTRA STORAGE
  5217. SB1 B2 RESTORE B1
  5218. SX3 B0 CHANGE DONE
  5219. SX0 5 LITERALS RELATIVE TO B5
  5220. GENR3 SX7 B1+510B CONSTRUCT SAN BM+(ADDRESS)
  5221. LX7 3
  5222. BX7 X7+X0 BRING IN B-REGISTER
  5223. LX7 18
  5224. BX7 X7+X6 X6 CONTAINS ADDRESS
  5225. RJ LONGI ADD INSTRUCTION TO STREAM
  5226. RJ FREEX FREE REGISTER
  5227. ZR X3,GENREAD ALL DONE IF NO FLOAT NEEDED
  5228. RJ FLOATIT ADD IN FLOAT INSTRUCTIONS (PXN, NXN)
  5229. EQ GENREAD
  5230. *
  5231. * /--- BLOCK GENREAD 00 000 78/07/28 03.39
  5232. ILONG SA1 NADS X1 = GETVAR CODE
  5233. SA1 X1+ADS
  5234. RJ RLLIT X6 = LITERAL
  5235. NZ X3,ISHORT2 FLOAT IF NECESSARY
  5236. * EQ ISHORT3
  5237. BX1 X6 SAVE LITERAL IN X6
  5238. AX1 17
  5239. NZ X1,ISHORT3 NOT FIT IN 18 BITS
  5240. SA1 NOTLITS
  5241. ZR X1,ITSLIT JUMP IF ITS LITERALS
  5242. PL X6,ITSHT1 SHORT 18 BIT POSITIVE NUMBER
  5243. NZ X6,FIXMNS IT IS NEGATIVE
  5244. SX1 60 MINUS 0
  5245. EQ ITMSK
  5246. FIXMNS SX1 X6+1
  5247. ZR X1,MNS1
  5248. MX1 -18
  5249. BX6 -X1*X6
  5250. EQ ITSHT1 IT IS NOW 18 BITS LONG
  5251. MNS1 SX1 59
  5252. EQ ITMSK MINUS 1 = MXN 60-1
  5253. *
  5254. ISTUD MX0 0 NO B REGISTER NEEDED
  5255. SA1 ASVARS
  5256. IX6 X1+X6 FORM ABSOLUTE ADDRESS
  5257. EQ GENR3
  5258. ICOM MX0 0 NO B REGISTER NEEDED
  5259. SA1 ACVARS
  5260. IX6 X1+X6 FORM ABSOLUTE ADDRESS
  5261. EQ GENR3
  5262. FLONG SA1 NADS X1 = GETVAR CODE
  5263. SA1 X1+ADS
  5264. RJ RLLIT X6 = LITERAL
  5265. EQ ISHORT3
  5266. * /--- BLOCK VREAD 00 000 77/12/18 17.20
  5267. TITLE VREAD -- CODE TO READ VERTICAL SEGMENTS
  5268. *
  5269. * COMPILE CODE TO READ VERTICAL SEGMENT OUT OF
  5270. * WORD IN X1 ... B1=STARTBIT-1, B2=BITS/BYTE
  5271. * AND A0 HAS REGISTERS TO USE (*SHORT* SAVES THESE)
  5272. *
  5273. VREAD EQ *
  5274. NG X1,VREADS JUMP IF SIGNED SEGMENT
  5275. SX6 B1+B2 SB-1+BB = SHIFT TO RIGHTJUSTIFY
  5276. MX0 -6
  5277. BX6 -X0*X6 PROTECTION
  5278. SX3 X6-60
  5279. ZR X3,VREAD2 CHECK FOR SHIFT = 60
  5280. SX2 A0
  5281. BX2 X0*X2 GET WORD REGISTER N00B
  5282. SX2 X2+20000B ADD LX CODE
  5283. BX7 X2+X6 AND SHIFT COUNT
  5284. CALL SHORT FORM *LXN SHIFT*
  5285. *
  5286. VREAD2 SX2 60
  5287. SX1 B2
  5288. IX1 X2-X1
  5289. MX0 -6 PROTECTION
  5290. BX1 -X0*X1
  5291. MX0 -3
  5292. SX2 A0
  5293. BX2 -X0*X2 GET MASK REGISTER
  5294. SX2 X2+430B FORM MXK MASK
  5295. LX2 6
  5296. BX7 X2+X1
  5297. CALL SHORT
  5298. SX7 A0+15000B FORM BXN -XM*XN
  5299. CALL SHORT
  5300. EQ VREAD
  5301. *
  5302. VREADS MX0 -6
  5303. SX6 B1 LEFT JUSTIFY SHIFT
  5304. BX6 -X0*X6 PROTECTION
  5305. SX1 A0
  5306. BX1 X0*X1 GET WORD REGISTER N00B
  5307. SA0 X1 AND SAVE IT
  5308. SX7 X6+20000B FORM AN LXN K
  5309. BX7 X1+X7
  5310. RJ SHORT ADD INSTRUCTION
  5311. SB1 60
  5312. SX2 B1-B2 60-BB = RIGHTJUSTIFY SHIFT
  5313. SX1 A0 GET WORD REGISTER
  5314. BX1 X1+X2
  5315. SX7 X1+21000B FORM AN AXN K
  5316. RJ SHORT
  5317. EQ VREAD
  5318. * /--- BLOCK VSTORE 00 000 77/12/18 17.31
  5319. TITLE VSTORE
  5320. *
  5321. * VSTORE CALLED WITH B1=STARTBIT, B2=BITS/BYTE
  5322. * GENERATE CODE TO SHIFT RESULT (IN X6), FORM
  5323. * MASK (IN X3), CLEAR OUT BYTE IN OLD WORD (IN X1)
  5324. * AND STORE (FROM X7) BACK WITH NEW BYTE
  5325. *
  5326. VSTORE EQ *
  5327. SX6 B1+B2 COMPUTE SHIFT TO RIGHT JUSTIFY
  5328. MX0 -6
  5329. BX6 -X0*X6 PROTECTION
  5330. SA0 X6 SAVE
  5331. SX0 X6-60 SKIP IF LX1 60
  5332. ZR X0,VSTOR2
  5333. SX7 20100B FORM LX1 SHIFT
  5334. BX7 X6+X7
  5335. CALL SHORT
  5336. * NOTE SHORT SAVES B1,B2,A0
  5337. VSTOR2 SB1 60
  5338. SX1 B1-B2 MASK SIZE
  5339. MX0 -6
  5340. BX1 -X0*X1 PROTECTION
  5341. SX7 43300B FORM MX3 MASK
  5342. BX7 X1+X7
  5343. CALL SHORT
  5344. SX7 11131B FORM BX1 X3*X1
  5345. CALL SHORT
  5346. SX7 15763B GENERATE AN BX7 -X3*X6
  5347. CALL SHORT
  5348. SX7 12717B FORM BX7 X1+X7
  5349. CALL SHORT
  5350. *
  5351. SB1 A0 LOAD RIGHT-JUSTIFY SHIFT
  5352. SB2 60
  5353. SX1 B2-B1 COMPUTE SHIFT TO RE-POSITION
  5354. ZR X1,VSTOR4 SKIP IF SHIFT IS 0
  5355. SX7 20700B GENERATE AN LX7 SHIFT
  5356. BX7 X1+X7
  5357. CALL SHORT
  5358. *
  5359. VSTOR4 SX7 54710B GENERATE AN SA7 A1+B0
  5360. CALL SHORT
  5361. EQ VSTORE DONE
  5362. * /--- BLOCK VSINDX 00 000 77/12/18 17.20
  5363. TITLE VSINDX -- CODE TO LOAD SEGMENT INFO WORD
  5364. *
  5365. * -VSINDX-
  5366. * GENERATE CODE TO LOAD VERTICAL SEGMENT WORD
  5367. * ON ENTRY - *SEGWD* = SEGMENT INFO WORD
  5368. * *NADS* = POINTER TO INDEX
  5369. *
  5370. VSINDX EQ *
  5371. CONDEN
  5372. SA1 NADS INDEX IN ADDRESS STACK
  5373. SA2 X1+ADS LOAD INDEX ADTYPE
  5374. MX0 -XCODEAL
  5375. BX3 X0*X2
  5376. ZR X3,SVCONST JUMP IF CONSTANT INDEX
  5377. ENDIF
  5378. *
  5379. SB1 1 READ INDEX TO X1
  5380. CALL FORCEX
  5381. SA1 NADS LOAD POINTER IN ADDRESS STACK
  5382. SA1 X1+ADS LOAD INDEX ADTYPE
  5383. LX1 59-XCODEAL-3 POSITION I/F BIT
  5384. PL X1,VSEG10 JUMP IF INTEGER INDEX
  5385. SB1 2
  5386. CALL CHEKRR OBTAIN X2 FOR -INDXFLT-
  5387. SB1 1 REGISTER NUMBER OF INDEX
  5388. CALL INDXFLT GENERATE CODE TO ROUND INDEX
  5389. *
  5390. VSEG10 SX6 1 SET INDEX REGISTER NUMBER
  5391. SA6 FREG
  5392. SX7 63110B GENERATE A SB1 X1+B0
  5393. CALL SHORT
  5394. * SX7 0601B SET UP GE B0,B1,K
  5395. * LX7 18
  5396. * SA1 LLAERR ADDRESS OF -ARAYERR-
  5397. * BX7 X1+X7
  5398. * CALL LONGI GE B0,B1,ARAYERR
  5399. SA1 SEGWD LOAD SEGMENT INFO WORD
  5400. AX1 18 POSITION BASE ADDRESS
  5401. SX4 X1 PICK OFF BASE ADDRESS
  5402. NG X1,VSEGC JUMP IF -NC- VARIABLE
  5403. SA2 ASVARS ADDRESS OF -N- VARIABLES
  5404. IX6 X2+X4
  5405. SA6 SEGWD1 SAVE ABSOLUTE BASE ADDRESS
  5406. SX2 X4-VARLIM-1
  5407. PL X2,VSEGR JUMP IF -NR- VARIABLE
  5408. * /--- BLOCK VSINDX 00 000 79/02/09 13.55
  5409. *
  5410. SX1 VARLIM SET LIMIT FOR -N- VARIABLES
  5411. EQ VSEG30
  5412. *
  5413. VSEGR SA2 ARVARS X2 = CM ADDR OF NR1
  5414. IX4 X6-X2 X4 = RVAR BASE INDEX OF SEG
  5415. SX3 X4-RVARLIM-1
  5416. PL X3,VSEGL IF -NL- VARIABLE
  5417. *
  5418. SA1 RVARL
  5419. ZR X1,VARERR SET LIMIT FOR -NR- VARIABLES
  5420. EQ VSEG30
  5421. *
  5422. VSEGL SA2 ALVARS X2 = CM ADDR OF NL1
  5423. IX4 X6-X2 X4 = LVAR BASE ADDRESS OF SEG
  5424. SA1 LVARN X1 = LOCALS IN THIS UNIT
  5425. IX3 X2-X4
  5426. NG X3,VARERR IF NOT INSIDE ANY VAR BANK
  5427. *
  5428. EQ VSEG30
  5429. *
  5430. VSEGC SA2 ACVARS ADDRESS OF -NC- VARIABLES
  5431. IX6 X2+X4
  5432. SA6 SEGWD1 SAVE ABSOLUTE BASE ADDRESS
  5433. SX1 NCVRLIM SET LIMIT FOR -NC- VARIABLES
  5434. *
  5435. VSEG30 IX1 X1-X4 SUBTRACT BASE ADDRESS
  5436. NG X1,VARERR
  5437. SX1 X1+1 COMPUTE MAX LEGAL INDEX
  5438. SX7 6120B GENERATE A SB2 B0+LIMIT
  5439. LX7 18
  5440. BX7 X1+X7 ATTACH LIMIT
  5441. CALL LONGI
  5442. *
  5443. SX7 0601B SET UP GE B0,B1,K
  5444. LX7 18
  5445. SA1 LLAERR ADDRESS OF -ARAYERR-
  5446. BX7 X1+X7
  5447. CALL LONGI GE B0,B1,ARAYERR
  5448. *
  5449. SX7 0721B GENERATE A LT B2,B1,ARAYERR
  5450. LX7 18
  5451. SA1 LLAERR ADDRESS OF -ARAYERR-
  5452. BX7 X1+X7
  5453. CALL LONGI LT B2,B1,ARAYERR
  5454. *
  5455. SX7 5111B GENERATE A SA1 B1+BASE
  5456. LX7 18
  5457. SA1 SEGWD1 LOAD ABSOLUTE BASE ADDRESS
  5458. SX1 X1-1 ADJUST (INDEX STARTS AT 1)
  5459. BX7 X1+X7
  5460. CALL LONGI SA1 B1+BASE
  5461. EQ VSINDX
  5462. * /--- BLOCK LDLITAD 00 000 77/12/19 19.24
  5463. TITLE LDLITAD -- CODE TO GET ADDRESS OF INFO WORD
  5464. *
  5465. * -LDLITAD-
  5466. *
  5467. * GENERATES CODE TO LOAD THE ADDRESS OF THE SEGMENT/
  5468. * ARRAY LITERAL INFO WORD TO REGISTER B1.
  5469. *
  5470. *
  5471. LDLITAD EQ * SUBROUT TO LOAD LITWD ADR TO B1
  5472. SA1 NADS LOAD SEGMENT/ARRAY ADTYPE
  5473. SA1 X1+ADS
  5474. MX0 -XCODEAL
  5475. BX7 -X0*X1 MASK OFF ADDRESS OF INFO
  5476. SA7 IOP SAVE FOR ARRAY
  5477. SX1 6115B GENERATE A SB1 B5+K
  5478. LX1 18
  5479. BX7 X1+X7 ATTACH ADDRESS
  5480. RJ LONGI
  5481. EQ LDLITAD
  5482. * /--- BLOCK GENFCT 00 000 77/12/19 16.50
  5483. TITLE GENFCT -- GENERATE CODE TO CALL FUNCTION
  5484. *
  5485. * -GENFCT-
  5486. *
  5487. * GENERATE CODE TO CALL FUNCTION AND RETURN RESULT
  5488. * IN REGISTER X1.
  5489. *
  5490. *
  5491. GENFCT EQ * GENERATE CODE TO GET FN RESULT
  5492. SA1 LLEXLOC ADDRESS OF TABLE OF ADDRESSES
  5493. IX0 X0+X1 ENTER WITH FN NUMBER IN X0
  5494. SA0 ITEMP
  5495. + RE 1 READ TABLE ENTRY
  5496. RJ ECSPRTY
  5497. SA1 A0 LOAD ADDRESS AND CONSTANT BIT
  5498. NG X1,CMPKON JUMP IF CONSTANT NOT FUNCTION
  5499. BX0 X1
  5500. LX0 1 SEE IF FUNCTION HAS AN ARGUMENT
  5501. NG X0,CMPF20 JUMP IF NO ARGUMENT
  5502. SA2 FFLT
  5503. ZR X2,CMPF20 JUMP IF INTEGER ARGUMENT
  5504. SX1 X1-2 DECREMENT ADDRESS FOR FLOATING
  5505. *
  5506. CMPF20 SX1 X1 PICK OFF ADDRESS PORTION
  5507. SX7 0100B
  5508. LX7 18 SET UP -RJ- INSTRUCTION
  5509. BX7 X1+X7
  5510. RJ LONGI ADD -RJ- TO INSTRUCTION STREAM
  5511. RJ PAD FILL OUT REST OF WORD
  5512. EQ GENFCT
  5513. *
  5514. CMPKON BX0 X1
  5515. LX0 1 JUMP IF CONSTANT
  5516. NG X0,CMPKON1 FALL THROUGH IF MEMORY FETCH
  5517. SX1 X1 GET ADDRESS PORTION
  5518. SX7 5110B GENERATE A SA1 B0+K
  5519. LX7 18
  5520. BX7 X1+X7 ATTACH ADDRESS
  5521. RJ LONGI ADD TO INSTRUCTION STREAM
  5522. EQ GENFCT
  5523. CMPKON1 MX0 2
  5524. BX1 -X0*X1
  5525. MX4 0
  5526. EQ INTIN CREATE INTEGER GETVAR
  5527. * /--- BLOCK SETAD 00 000 77/12/19 16.48
  5528. TITLE SETAD -- MARK *ADS* ENTRY NOW IN REGISTER
  5529. *
  5530. * -SETAD-
  5531. *
  5532. * MARK ENTRY IN *ADS* LIST NOW IN REGISTER
  5533. *
  5534. SETAD EQ * SET AD IN ADS LIST TO REGISTER ASSIGNMENT
  5535. SX7 1 UPDATE AD REFERENCE
  5536. SA7 RX+1 FLAG X1 IN USE
  5537. MX1 1 SIGN BIT FOR REGISTER
  5538. BX7 X7+X1
  5539. SA1 FLOAT 0 IF INTEGER RESULT OF FUNCTION
  5540. BX7 X7+X1
  5541. SA1 NADS
  5542. SA7 X1+ADS
  5543. EQ SETAD
  5544. * /--- BLOCK FLOATIT 00 000 77/12/19 19.37
  5545. TITLE FLOATIT -- SET UP FLOAT INSTRUCTIONS
  5546. *
  5547. * -FLOATIT-
  5548. *
  5549. * GENERATE CODE TO CONVERT THE INTEGER CONTENTS OF
  5550. * A REGISTER TO FLOATING POINT FORMAT.
  5551. *
  5552. * B1 = REGISTER NUMBER
  5553. *
  5554. *
  5555. FLOATIT EQ * SET UP FLOAT INSTRUCTIONS
  5556. SX7 B1 B1 HAS REGISTER NO.
  5557. LX7 6
  5558. SX7 X7+B1 N0N
  5559. SX7 X7+27000B 27 IS PXN
  5560. RJ SHORT
  5561. SX7 B1 B1 HAS REGISTER NO.
  5562. LX7 6
  5563. SX7 X7+B1 N0N
  5564. SX7 X7+24000B 24 IS NXN
  5565. RJ SHORT
  5566. EQ FLOATIT
  5567. * /--- BLOCK INDXFLT 00 000 77/12/18 17.16
  5568. TITLE INDXFLT -- GENERATE CODE TO ROUND INDEX
  5569. *
  5570. * -INDXFLT-
  5571. * GENERATE INSTRUCTIONS TO ROUND INDEX
  5572. * B1 = REGISTER NUMBER OF INDEX
  5573. *
  5574. * CODE PRODUCED WILL DESTROY X2
  5575. *
  5576. *
  5577. INDXFLT EQ *
  5578. SX7 17174B 0.5 = 17174 00000 00000 00000
  5579. SX6 712B -SX2- OPERATION
  5580. LX6 21
  5581. BX7 X6+X7 MERGE TO FORM -SX2 17174B-
  5582. RJ LONGI LONGI PRESERVES B1
  5583. SX7 20255B -LX2 45-
  5584. RJ SHORT SX2 AND LX2 FORM 0.5 IN X2
  5585. SX7 B1 NEXT FORM -FXN X2+XN-
  5586. LX7 6
  5587. SX7 X7+B1 N0N
  5588. SX7 X7+30020B FORM -FXN X2+XN-
  5589. RJ SHORT
  5590. SX7 B1
  5591. LX7 6
  5592. SX7 X7+B1
  5593. SX7 X7+26010B FORM -UXN B1,XN-
  5594. RJ SHORT
  5595. SX7 B1
  5596. LX7 6
  5597. SX7 X7+B1
  5598. SX7 X7+22010B FORM -LXN B1,XN-
  5599. RJ SHORT
  5600. EQ INDXFLT
  5601. * /--- BLOCK FORCEX 00 000 78/01/31 23.21
  5602. TITLE FORCEX -- READ ADTYPE TO SPECIFIED REGISTER
  5603. *
  5604. * -FORCEX-
  5605. *
  5606. * READ ADTYPE TO SPECIFIED REGISTER
  5607. * B1 ENTERED WITH REGISTER TO GET. EXITS THE SAME.
  5608. *
  5609. FORCEX EQ *
  5610. SX6 B1 SAVE DESIRED REGISTER NUMBER
  5611. SA6 FREG
  5612. RJ GENREAD TRY TO READ TO DESIRED REGISTER
  5613. SA2 FREG
  5614. SB2 X2 SEE IF READ TO PROPER REGISTER
  5615. MX7 1
  5616. SA7 B1+RX MARK CURRENT REGISTER IN USE
  5617. EQ B1,B2,FORCEX
  5618. SX6 B1 SAVE CURRENT REGISTER NUMBER
  5619. SA6 FREG
  5620. SB1 B2 GET DESIRED REGISTER NUMBER
  5621. SA1 B1+RX
  5622. ZR X1,FCONT DESIRED REGISTER IS FREE
  5623. SX6 X6-7
  5624. ZR X6,PMIND IS EXPRESSION TOO COMPLICATED
  5625. PFCONT RJ CHEKRR FREE DESIRED REGISTER
  5626. * B1 SAVED IN CHEKRR
  5627. FCONT SX7 1 MARK DESIRED REGISTER IN USE
  5628. SA7 B1+RX
  5629. SX1 B1
  5630. SA2 FREG CURRENT REGISTER NUMBER
  5631. MX7 0 FREE CURRENT REGISTER
  5632. SA7 X2+RX
  5633. LX1 6 POSITION REGISTER NUMBERS
  5634. LX2 3
  5635. BX1 X1+X2
  5636. SX7 X1+10000B FORM A BXN XM
  5637. RJ SHORT
  5638. EQ FORCEX
  5639. *
  5640. * BELOW IS FIX TO FIX
  5641. PMIND SA1 RX+3 IS X3 AVAILABLE
  5642. ZR X1,PFCONT
  5643. SA1 RX+4
  5644. ZR X1,PFCONT
  5645. SA1 RX+5
  5646. ZR X1,PFCONT
  5647. SA1 RX+0
  5648. ZR X1,PFCONT
  5649. EQ MINDERR EXPRESSION IS COMPLICATED
  5650. *
  5651. FREG BSS 1
  5652. *
  5653. * /--- BLOCK CHEKRR 00 000 80/01/17 22.19
  5654. TITLE CHEKRR -- CHECK READ REGISTER AVAILABLE
  5655. *
  5656. * -CHEKRR-
  5657. *
  5658. * CHECK IF A READ REGISTER IS AVAILABLE. IF NOT,
  5659. * CODE IS GENERATED TO MAKE IT AVAILABLE BY SAVING
  5660. * THE DESIRED REGISTER IN A TEMPORARY.
  5661. *
  5662. * ENTER WITH B1 = REGISTER TO CHECK. EXITS THE SAME.
  5663. *
  5664. *
  5665. CHEKRR EQ * CHECK READ REGISTER AVAILABILITY
  5666. SA1 B1+RX REQUESTED READ REGISTER NO. IN B1
  5667. ZR X1,CHEKRR AVAILABLE
  5668. SB2 B1 NOPE, SAVE DESIRED REGISTER NO. IN B2
  5669. RJ CHOOSEX CHOOSE A REGISTER TO SEND X1 TO.
  5670. SX7 B0
  5671. SA7 B2+RX FREE IT
  5672. EQ B1,B2,CHEKRR AVOID BX7 X7
  5673. SX7 B2
  5674. SB3 1
  5675. MX2 57 MASK FOR REGISTER NUMBER
  5676. SA1 ADS-1
  5677. FINDXN SA1 A1+B3 FIND THE REFERENCE TO IT
  5678. PL X1,FINDXN REGISTER REFERENCE HAS SIGN BIT LIT
  5679. BX6 -X2*X1 REG. NO.
  5680. BX6 X6-X7
  5681. NZ X6,FINDXN MUST BE IN ADS LIST
  5682. *** ERROR PROTECTION
  5683. SX6 OPS+OPSMAX
  5684. SX7 A1
  5685. IX6 X7-X6
  5686. PL X6,MINDERR EXPRESSION TOO COMPLICATED
  5687. ***
  5688. SX7 B1 DESTINATION REGISTER NO.
  5689. BX1 X2*X1 SAVE BITS OTHER THAN REGISTER NO.
  5690. BX6 X1+X7 BRING IN NEW REG. NO.
  5691. SA6 A1 CHANGE ADDRESS TO NEW REGISTER
  5692. SX7 X7+100B BUILD BX(DESTINATION) ORIGIN
  5693. LX7 3
  5694. SX7 X7+B2 ORIGIN REGISTER NO.
  5695. LX7 3
  5696. RJ SHORT ADD TO INSTRUCTION STREAM
  5697. SB1 B2 RESTORE B1
  5698. EQ CHEKRR
  5699. * /--- BLOCK PICKX 00 000 77/12/19 19.40
  5700. TITLE PICKX -- PICK A RESULT REGISTER
  5701. *
  5702. * -PICKX-
  5703. *
  5704. * CHOOSE A RESULT DESTINATION REGISTER. THIS ALSO
  5705. * UPDATES THE ADS ENTRY CORRESPONDING TO THE DESIRED
  5706. * REGISTER.
  5707. *
  5708. * B1 = REGISTER NUMBER
  5709. *
  5710. *
  5711. PICKX EQ * PICK A RESULT DESTINATION REGISTER
  5712. *****
  5713. * ATTEMPT TO USE X1 FOR DESTINATION IF LAST OP.
  5714. *
  5715. *INHAND OP PRECEDENCE LEVEL FOR END OF LINE OR COMMA IS -1
  5716. SA1 INHANDL CHECK WHETHER LAST OPERATION
  5717. SX1 X1+B0 OP INHAND LEVEL IN LOW-ORDER BITS
  5718. PL X1,PICKXX JUMP IF NOT END OF LINE OR COMMA
  5719. SA1 NOPS
  5720. SX1 X1-2 IF LAST OP, NOPS=2 (OPS(1) IS BEGIN LINE)
  5721. NZ X1,PICKXX JUMP IF NOT LAST OP
  5722. SB1 1 CHOOSE X1 DESTINATION
  5723. EQ PICKED2
  5724. PICKXX RJ CHOOSEX CHOOSE A VACANT REGISTER
  5725. PICKED2 SX7 B1 UPDATE OPERAND REFERENCE (B1 GIVES REG. NO)
  5726. MX0 1 SIGN BIT
  5727. BX7 X7+X0 FLAG REGISTER ADTYPE WITH SIGN BIT
  5728. SA1 FLOAT IS IT FLOATING RESULT
  5729. ZR X1,PICKED3 JUMP IF INTEGER RESULT
  5730. SX0 1
  5731. LX0 XCODEAL+3 SET UP I/F BIT
  5732. BX7 X7+X0 MERGE
  5733. PICKED3 SA1 NADS
  5734. SA7 X1+ADS STORE ADTYPE OF RESULT
  5735. EQ PICKX
  5736. * /--- BLOCK CHOOSEX 00 000 77/12/19 19.42
  5737. TITLE CHOOSEX -- CHOOSE A VACANT REGISTER
  5738. *
  5739. * -CHOOSEX-
  5740. *
  5741. * CHOOSE ANY UNUSED REGISTER. IF ALL REGISTERS ARE
  5742. * IN USE, CODE WILL BE GENERATED TO MAKE FREE X7 BY
  5743. * STORING THE VALUE INTO A TEMPORARY CM CELL.
  5744. *
  5745. * ON EXIT,
  5746. * B1 = UNUSED REGISTER NUMBER
  5747. *
  5748. *
  5749. CHOOSEX EQ * CHOOSE A VACANT REGISTER
  5750. SA1 RX+7 USE X7 IF AVAILABLE
  5751. ZR X1,CHOSEN (RX+7) = 0 IF X7 NOT IN USE
  5752. SA1 RX+0 THEN TRY X0
  5753. ZR X1,CHOSEN
  5754. SA1 RX+5 KEEP LOOKING
  5755. ZR X1,CHOSEN
  5756. SA1 RX+4
  5757. ZR X1,CHOSEN
  5758. SA1 RX+3
  5759. ZR X1,CHOSEN
  5760. SX7 7 NO REGISTER AVAILABLE, STORE X7 IN TEMPS
  5761. MX2 57 MASK FOR REGISTER NUMBER
  5762. SB1 1
  5763. SA1 ADS-1
  5764. FINDX7 SA1 A1+B1 FIND THE OPERAND NOW IN X7
  5765. PL X1,FINDX7 REGISTER IS FLAGGED NEGATIVE
  5766. BX1 -X2*X1 GET REGISTER NUMBER
  5767. BX1 X1-X7
  5768. NZ X1,FINDX7
  5769. RJ STR7TMP PUT CONTENTS OF X7 IN TEMPSTOR
  5770. SB1 7 MARK REGISTER 7 CHOSEN
  5771. EQ CHOOSEX
  5772. *
  5773. CHOSEN SB1 A1-RX CALC CHOSEN REGISTER NUMBER
  5774. SX7 1
  5775. SA7 A1 MARK IT TO BE IN USE
  5776. EQ CHOOSEX
  5777. * /--- BLOCK STR7TMP 00 000 77/12/19 19.43
  5778. TITLE STR7TMP -- CODE TO STORE X7 IN TEMPORARY
  5779. *
  5780. * GENERATES CODE TO STORE X7 IN TEMPSTOR LOC
  5781. * AND UPDATES ADS LIST ACCORDINGLY.
  5782. *
  5783. * ON ENTRY,
  5784. * A1 = ADDRESS OF ENTRY IN *ADS* LIST CORRESPONDING
  5785. * TO THE OPERAND IN REGISTER X7.
  5786. *
  5787. *
  5788. STR7TMP EQ * ENTER WITH *ADS+NADS* IN A1
  5789. SA2 TEMP PICK UP PRESENT TEMP STACK PTR
  5790. SX7 X2+1 INCREMENT TEMP POINTER
  5791. SA7 TEMP
  5792. SX7 X7-TEMPLIM
  5793. PL X7,TEMPERR JUMP IF TOO MANY TEMPS USED
  5794. SX2 X2+VARLIM+1 FIRST TEMP IS V(VARLIM+1)
  5795. SX7 1 CONSTRUCT I/F MASK
  5796. LX7 XCODEAL+3
  5797. SA1 A1 GET ADTYPE OF OPERAND IN X7
  5798. BX7 X7*X1 GET I/F BIT
  5799. BX7 X7+X2 BRING IN TEMP ADDRESS
  5800. SX1 2 GETVAR CODE FOR STUDENT BANK
  5801. LX1 XCODEAL
  5802. BX7 X7+X1 FORM COMPLETE GETVAR CODE
  5803. SA7 A1 AND CHANGE STACK AD (WAS IN X7)
  5804. SX7 5170B GENERATE SA7 B0+**
  5805. LX7 18
  5806. SA1 ASVARS GET BASE ADD FOR STUDENT VARS
  5807. IX2 X1+X2
  5808. BX7 X7+X2
  5809. RJ LONGI
  5810. EQ STR7TMP
  5811. * /--- BLOCK FREEX 00 000 77/12/19 19.43
  5812. TITLE RLLIT -- RETRIEVE LONG LITERAL
  5813. *
  5814. * -RLLIT-
  5815. * RETRIEVE LONG LITERAL
  5816. *
  5817. * (X6) = LONG LITERAL
  5818. *
  5819. * ON ENTRY - (X1) = GETVAR CODE FOR LITERAL
  5820. *
  5821. * ON EXIT - (X6) = LITERAL
  5822. * (X1) = GETVAR CODE W/LIST BIT RESET
  5823. *
  5824. * USES A/X0,A/X6,A1
  5825. *
  5826. ENTRY RLLIT
  5827. RLLIT EQ *
  5828. MX0 60-XCODEAL ADDRESS MASK
  5829. BX0 -X0*X1 ADDRESS OF LITERAL
  5830. BX6 X1 SAVE ADTYPE
  5831. LX1 60-LITSHF1 *LITS* BIT = SIGN BIT
  5832. PL X1,RLLIT10 IF LITERAL IS IN *TOKBUF*
  5833. *
  5834. SA1 NLITS LITS STACK POINTER
  5835. BX1 X1-X0 CHECK FOR TOP OF LITS STACK
  5836. NZ X1,RLLIT08 DO NOT DECREMENT IF NOT TOP
  5837. *
  5838. BX1 X6 SAVE ADTYPE
  5839. SX6 X0-1 POP LITS STACK
  5840. SA6 A1
  5841. BX6 X1 SAVE ADTYPE
  5842. RLLIT08 SA1 X0+LITS GET LIT
  5843. * MX0 59 TURN OFF *LITS* BIT
  5844. * LX1 60-LITSHFT
  5845. * BX1 X0*X1
  5846. * LX1 LITSHFT
  5847. EQ RLLIT20
  5848. *
  5849. RLLIT10 BSS 0 LITERAL IS IN *TOKBUF*
  5850. SA1 ATOKEN ADDR OF TOKENS
  5851. IX0 X1+X0 ADDR OF LIT IN ECS
  5852. SA0 LLITEMP
  5853. RE 1 LITERAL IS IN *LLITEMP*
  5854. RJ ECSPRTY
  5855. SA1 LLITEMP (X1) = LITERAL
  5856. *
  5857. RLLIT20 BX0 X6 RESTORE (X1) AND SET (X6)
  5858. BX6 X1
  5859. BX1 X0
  5860. EQ RLLIT
  5861. *
  5862. *
  5863. TITLE SLLIT -- STORE LONG LITERAL
  5864. *
  5865. * -SLLIT-
  5866. * STORE LONG LITERAL
  5867. *
  5868. * ON ENTRY - (X6) = LONG LITERAL
  5869. * (X1) = TYPE CODE
  5870. *
  5871. * ON EXIT - (X6) = ADTYPE WITH ADDRESS
  5872. *
  5873. * USES X0,A/X1,X6
  5874. *
  5875. ENTRY SLLIT
  5876. SLLIT EQ *
  5877. BX0 X1 SAVE TYPE CODE
  5878. SA1 NLITS
  5879. SA6 LITS+1+X1 STORE LITERAL AND FREE X6
  5880. SX6 X1+1
  5881. SA6 A1
  5882. SX1 X6-LITL JUMP IF TOO MANY LITERALS
  5883. PL X1,LITERR
  5884. * /--- BLOCK FREEX 00 000 77/12/19 19.43
  5885. LX0 XCODEAL POSITION TYPE CODE
  5886. BX6 X0+X6 CREATE GETVAR CODE
  5887. SX0 1
  5888. LX0 LITSHFT POSITION *LITS* BIT
  5889. BX6 X0+X6 FLAG LIT ADDR POINTS TO *LITS*
  5890. EQ SLLIT
  5891. *
  5892. LLITEMP BSS 1
  5893. TITLE FREEX -- FREE UP A REGISTER
  5894. *
  5895. * -FREEX-
  5896. *
  5897. * MARK A REGISTER UNUSED
  5898. *
  5899. * B1 = REGISTER TO FREE UP
  5900. *
  5901. *
  5902. FREEX EQ * FREE REGISTER NO LONGER IN USE
  5903. SX7 B0 MUST NOT ALTER X1,X3,X6
  5904. SA7 B1+RX REGISTER SPECIFIED IN B1
  5905. EQ FREEX
  5906. * /--- BLOCK LSEEK 00 000 77/12/17 18.01
  5907. TITLE LSEEK -- SEARCH FOR EXISTING LITERALS
  5908. *
  5909. * -LSEEK-
  5910. *
  5911. * SUBROUTINE TO PLANT LITERAL IN XTRA STORAGE
  5912. * MUST NOT CHANGE B2,X0,A0 OR X6,X1,A1 AS SET
  5913. * RETURN B1=0 IF NEW LITERAL
  5914. *
  5915. LSEEK EQ * ADD ONE LITERAL
  5916. MX2 0 FLAG ONLY ONE
  5917. RJ LSEEKA
  5918. EQ LSEEK
  5919. *
  5920. LSEEK2 EQ * ADD TWO LITERALS
  5921. MX2 -1 FLAG TWO
  5922. RJ LSEEKA (X7 HAS 2ND LITERAL)
  5923. EQ LSEEK2
  5924. *
  5925. LSEEKA EQ * SEEK LITERAL IN EXTRA STORAGE
  5926. SA1 INX GET EXTRA STORAGE POINTER
  5927. SA6 X1+INFO PLANT SEARCH ITEM
  5928. SA1 INFO-1 INITIAL ADDRESS
  5929. SB1 1
  5930. SA7 A6+B1 PLANT 2ND LITERAL
  5931. LSEEKB SA1 A1+B1 GET NEXT ITEM
  5932. BX1 X6-X1 COMPARE WITH X6
  5933. NZ X1,LSEEKB
  5934. NG X1,LSEEKB PROTECT AGAINST (-0)-(0)
  5935. ZR X2,LSEEKC JUMP IF ONLY ONE LITERAL
  5936. SA3 A1+B1 GET 2ND LIT
  5937. IX3 X3-X7
  5938. NZ X3,LSEEKB
  5939. NG X3,LSEEKB PROTECT AGAINST (-0)-(0)
  5940. LSEEKC SB1 INFO COMPUTE LOCATION OF LITERAL
  5941. SX6 A1-B1
  5942. SB1 A6 CHECK FOR NEW OR OLD LITERAL
  5943. SB1 A1-B1 COMPARE FOUND AND PLANT ADDRESSES
  5944. NZ B1,LSEEKA DONE IF OLD LITERAL
  5945. SA1 INX OTHERWISE ADVANCE INX
  5946. SX7 X1+1
  5947. SA7 A1
  5948. ZR X2,LSEEKA
  5949. SX7 X7+1 TWO LITERALS
  5950. SA7 A7
  5951. EQ LSEEKA
  5952. * /--- BLOCK MOVCODE 00 000 77/12/19 19.45
  5953. TITLE MOVE CODE
  5954. *
  5955. * -MOVCODE-
  5956. *
  5957. * MOVE CODE INTO *ARGUMENT STORAGE*
  5958. * EXITS WITH ARG STORAGE ADDRESS OF CODE IN X0
  5959. * ALSO DESTROYS A1,X1,A2,X2,A7,X7,B1,A0
  5960. *
  5961. * ****NOTE**** THIS ROUTINE IS NO LONGER
  5962. * USED BY -CALCS- BECAUSE IT DOES NOT DO
  5963. * PROPER END TESTS FOR POSSIBLE OVERFLOW
  5964. * OF THE -INFO- BUFFER -- 'PHIL 8/3/76
  5965. *
  5966. *
  5967. ENTRY MOVCODE
  5968. MOVCODE EQ *
  5969. CONDEN
  5970. SX2 INST CONDEN
  5971. ENDIF
  5972. PLATO
  5973. SX2 INFO+INFOX LOCATION OF CODE DURING EXEC
  5974. ENDIF
  5975. *
  5976. SA0 X2
  5977. SA1 NINST POINTER TO LAST WORD OF CODE PLUS 1
  5978. IX2 X1-X2
  5979. SB1 X2 COUNT OF CODE WORDS
  5980. SA1 ATEMPEC ECS WORK BUFFER POINTER
  5981. BX0 X1
  5982. + WE B1 SEND CODE TO ECS
  5983. - RJ =XECSPRTY
  5984. SA1 INX INFO POINTER
  5985. SX7 X1+B1 INCREMENT INX
  5986. SA7 A1
  5987. SA0 X1+INFO
  5988. + RE B1 MOVE CODE INTO INFO BUFFER
  5989. - RJ =XECSPRTY
  5990. BX0 X1 LOCATION OF CODE IN INFO
  5991. EQ MOVCODE
  5992. * /--- BLOCK PAD 00 000 78/01/25 13.50
  5993. TITLE PAD OUT INSTRUCTION WORD WITH NO-OPS
  5994. *
  5995. * -PAD-
  5996. *
  5997. * -LABDEF- IN IDENT CALCS ASSUMES THAT -PAD-
  5998. * DOES NOT DESTROY A4,B4,X4,A5,B5,X5,A7,B7,X7
  5999. *
  6000. * THIS ROUTINE DOES NOT CHANGE B1,B2,A0
  6001. *
  6002. ENTRY PAD
  6003. PAD EQ * PAD OUT AN INSTRUCTION WITH NO-OPS
  6004. SA1 NINST GET CURRENT INSTRUCTION WORD
  6005. SA2 X1
  6006. PADX1 ZR X2,PAD NO NEED TO PAD IF WORD EMPTY
  6007. LX2 15 MAY HAVE 15 OR 30 BITS TO PAD
  6008. MX0 15 CHECK FOR NEEDED PADDING TO LEFT-ADJUST
  6009. BX6 X2*X0 EXAMINE LEFT-MOST INSTRUCTION
  6010. SX0 46000B SET UP NO-OP INSTRUCTION
  6011. NZ X6,PAD2 IF BITS SET, NOW LEFT-ADJUSTED
  6012. BX2 X2+X0 NO-OP AT RIGHT
  6013. EQ PADX1 LOOP
  6014. PAD2 BX6 X2+X0 STICK IN A NO-OP
  6015. SA6 A2 PUT BACK LEFT-SHIFTED
  6016. SB3 PAD
  6017. *
  6018. * UPDATE INSTRUCTION WORD POINTER--- ASSUMES A1,X1,B3 SET AT ENTRY
  6019. * DESTROYS X6,A6,X1,A2,X2
  6020. * DO NOT ALTER B1,B2,A0...A4,B4,X4,A5,B5,X5,A7,B7,X7
  6021. ENTRY UPNINST
  6022. UPNINST SX1 X1+1 INCREMENT INSTUCTION WORD POINTER AND
  6023. SA2 NINSTLIM LIMIT ON NINST
  6024. IX2 X1-X2
  6025. PL X2,LNGERR TOO BAD, RAN OVER
  6026. BX6 X1
  6027. SA6 A1 STORE NEW POINTER
  6028. MX6 0
  6029. SA6 X1 CLEAR OUT NEW INST WORD
  6030. JP B3 RETURN TO CALLER
  6031. * /--- BLOCK SHORT 00 000 78/01/20 14.58
  6032. TITLE ADD SHORT INSTRUCTION TO STREAM
  6033. *
  6034. * -SHORT-
  6035. *
  6036. * ADD A SHORT (15-BIT) INSTRUCTION TO THE OUTPUT
  6037. * STREAM.
  6038. *
  6039. * X7 = INSTRUCTION TO ADD (LOWER 15 BITS)
  6040. *
  6041. *
  6042. * DONT ALTER B1,B2,A0 IN THIS SUBROUTINE (DLS)
  6043. *
  6044. ENTRY SHORT
  6045. SHORT EQ * ADD SHORT INSTRUCTION TO STREAM
  6046. SA1 NOTLITS IS IT LITERAL OPERATION
  6047. NZ X1,SHORT2 JUMP IF NOT LITERALS
  6048. SA1 =46000460004600000000B THREE PASSES
  6049. BX7 X1+X7 PLUS INSTRUCTION
  6050. SA7 EXECUTE PLANT IT
  6051. SA1 ARGX1 LOAD FIRST ARG
  6052. SA2 ARGX2 LOAD SECOND ARG
  6053. RJ EXECIT EXECUTE THE PLANTED INSTRUCTION
  6054. SA1 NLITS RESULT IN X7
  6055. *NLITS HAS BEEN ALREADY INCREMENTED BY -BINARY-.
  6056. SA7 X1+LITS STORE IN LITS TABLE
  6057. MX0 60-XCODEAL CHECK TO SEE IF RESULT IS SHORT LITERAL
  6058. BX0 X0*X7
  6059. NZ X0,SHORT3 IF LONG, SET LITS BIT
  6060. *
  6061. SA1 NADS
  6062. SA7 X1+ADS CHANGE TO SHORT
  6063. EQ SHORT
  6064. SHORT2 SA1 NINST NOT LITERAL OPERATION
  6065. SA2 X1 GET CURRENT WORD
  6066. LX2 15
  6067. BX7 X7+X2 MERGE NEW INSTRUCTION
  6068. SA7 A2 STORE
  6069. MX0 15
  6070. BX0 X7*X0 CHECK FOR FULL WORD
  6071. ZR X0,SHORT
  6072. SB3 SHORT
  6073. EQ UPNINST UPDATE NINST, RETURN TO SHORT
  6074. *
  6075. SHORT3 SA2 NADS INSERT *LITS* ADDRESS/BIT
  6076. SA2 X2+ADS
  6077. AX2 XCODEAL
  6078. LX2 XCODEAL
  6079. BX6 X1+X2 ADDRESS
  6080. SX1 1 INDICATE STORED IN *LITS
  6081. LX1 LITSHFT
  6082. BX6 X1+X6
  6083. SA1 NADS
  6084. SA6 X1+ADS
  6085. EQ SHORT
  6086. *
  6087. *
  6088. *
  6089. * THIS LITTLE THING IS DONE TO INSURE THAT THE INSTRUCTION
  6090. * STACK IS VOIDED. 'ON 'C'D'C MACHINES, A -RJ- INSTRUCTION
  6091. * FORCES THE MACHINE TO RE-READ THE INSTRUCTIONS.
  6092. * THIS ROUTINE IS REFERENCED FROM ',SHORT', AND ',LBINARY',.
  6093. * (ALL OPTIMIZATIONS ARE DONE IN SHORT BUT SHIFTS, AND THOSE
  6094. * ARE DONE IN LBINARY.)
  6095. *
  6096. EXECIT EQ *
  6097. EXECUTE BSS 1 EXECUTE THE COMMAND
  6098. EQ EXECIT RETURN FROM WHENCE IT CAME
  6099. *
  6100. * /--- BLOCK LONGI 00 000 77/12/19 16.05
  6101. TITLE ADD LONG INSTRUCTION TO STREAM
  6102. *
  6103. * -LONGI-
  6104. *
  6105. * ADD LONG INSTRUCTION TO OUTPUT STREAM.
  6106. *
  6107. * X7 = 30-BIT INSTRUCTION
  6108. *
  6109. *
  6110. * DO NOT ALTER B1,B2,A0,A5,B5,X5 IN THIS SUBROUTINE
  6111. *
  6112. ENTRY LONGI
  6113. LONGI EQ * ADD LONG INSTRUCTION TO STREAM
  6114. SA1 NINST
  6115. SA2 X1 GET CURRENT WORD
  6116. MX0 30
  6117. BX0 X0*X2 CHECK FOR ENOUGH SPACE
  6118. ZR X0,LONG2 JUMP IF SPACE
  6119. LX2 15
  6120. SX6 46000B SET UP PASS
  6121. BX6 X6+X2
  6122. SA6 A2 PUT IT AWAY
  6123. SB3 LONG2A
  6124. EQ UPNINST INC NINST, RETURN TO LONG2A
  6125. LONG2A SA1 NINST RELOAD IT
  6126. MX2 0
  6127. LONG2 LX2 30
  6128. BX7 X7+X2 BUILD WHOLE INSTRUCTION WORD
  6129. SA7 X1 STORE IT IN STREAM
  6130. MX0 15 CHECK FOR FULL WORD
  6131. BX0 X0*X7
  6132. ZR X0,LONGI
  6133. SB3 LONGI
  6134. EQ UPNINST INC INST POINTER, RETURN TO LONGI
  6135. * /--- BLOCK STORAGE 00 000 78/09/15 19.13
  6136. TITLE STORAGE DEFINITIONS
  6137. *
  6138. * * STORAGE DEFINITIONS
  6139. *
  6140. *
  6141. PREVOPL BSS 1 PREVIOUS OP LEVEL
  6142. LASTOP BSS 1 LAST ITEM OPCODE, FOR UNARY - CHECK
  6143. FINALOP BSS 1 LAST OPERATION COMPILED
  6144. CALC BSS 1 1 IF CALC, 0 IF NOT A CALC COMMAND
  6145. INHAND BSS 1 OP IN HAND
  6146. INHANDL BSS 1 OP LEVEL IN HAND
  6147. IOP BSS 1 SAVE INSTRUCTION CODE
  6148. SAVEOP BSS 1 SAVE OP
  6149. FFLT BSS 1 FLOATING ARGUMENT FLAG
  6150. POWER BSS 1 SAVE EXPONENTIATION POWER
  6151. FLOAT BSS 1 SAVE FLOATING-PT INSTRUCTION CODE
  6152. TEMP BSS 1 TEMP STACK POINTER
  6153. ENTRY NOTLITS
  6154. NOTLITS BSS 1 NZ IF OPERANDS NOT BOTH LITERALS
  6155. RECIP BSS 1 RECIPROCAL FLAG (0 IF NOT NEEDED)
  6156. ARGX1 BSS 2 LITERAL ARGUMENTS
  6157. ARGX2 EQU ARGX1+1
  6158. ARG EQU ARGX1-1
  6159. SEGWD BSS 1 TEMP VARIABLES USED
  6160. SEGWD1 BSS 1 BY SEGMENT, ARRAY ROUTINES
  6161. BUFCHK BSS 1 NZ IF HAVE CHEKED ECS AVAILABLE
  6162. ASIZE BSS 1 TEMP-ARRAY SIZE,TYPE
  6163. ENTRY ARAYFLG
  6164. ARAYFLG BSS 1 SET=1 BY CALLER IF EXPECTS ARAY
  6165. TMPASIZ BSS 1 TEMP ARRAY STORAGE USED
  6166. TMPAFLG BSS 1 TEMPORARY ARRAY INFO
  6167. AOPAD BSS 1 SAVE ARRAY OPERAND ADDRESSES
  6168. TMPARAY BSS 1 TEMPORARY ARRAY ADDRESS
  6169. NARGS BSS 1 NO. OF COMMAS IN MULTIPLE-ARGUMENT FUNCTION
  6170. NARRAYS BSS 1 NO. OF WHOLE ARRAYS ENCOUNTERED
  6171. RX BSS 8 REGISTER RESERVATIONS
  6172. * ZERO IF NOT IN USE, 1 IF IN USE
  6173. ENTRY CSYMADD,CSYMNUM
  6174. CSYMADD BSS 1 SYMBOL TABLE ADDRESS
  6175. CSYMNUM BSS 1 NUMBER OF SYMBOLS IN TABLE
  6176. CONDEN
  6177. TOPCNT BSS 1 NUMBER OF OPERATORS ENCOUNTERED
  6178. ENTRY TVARCNT
  6179. TVARCNT BSS 1 NUMBER OF VARIABLES REFERENCED
  6180. ENDIF
  6181. *
  6182. FINDXED BSS 1 0=INDEXED VARIABLE, IF IN REG.
  6183. *SEE VARLOC OPTIMIZATION FOR EXAMPLE USEAGE
  6184. * /--- BLOCK END 00 000 77/12/16 15.14
  6185. *
  6186. END