User Tools

Site Tools


plato:source:plaopl:embed

Table of Contents

EMBED

Table Of Contents

  • [00019] EMBED –EMBEDS COMMANDS IN TEXT
  • [00188] COMMAND SCANNING ROUTINE FOR EMBED
  • [00294] NXTNAMR
  • [00334] SHOW –READIN FOR SHOW, SHOWT, SHOWE
  • [00402] READIN FOR -COLOR-

Source Code

EMBED.txt
  1. EMBED
  2. * /--- FILE TYPE = E
  3. * /--- BLOCK EMBED 00 000 79/07/12 05.24
  4. IDENT EMBED
  5. *
  6. * GET COMMON SYMBOL TABLE
  7. *
  8. CST
  9. *
  10. EXT ERRTAGS,ERRNAME,ERRSTOR
  11. EXT ERRXYTG,ERR2MNY,ERR2FEW
  12. EXT ERRTERM,ERRUARG,ERRVTYP
  13. EXT ERROUTR,ERRCNTD,ERRXORQ
  14. EXT ERRBAL,PUTCODE,VARDO
  15. EXT KEYTYPE,VARFIN
  16. EXT VARDO2
  17. *
  18. * /--- BLOCK EMBED 00 000 78/09/09 01.03
  19. TITLE EMBED --EMBEDS COMMANDS IN TEXT
  20. * THIS ROUTINE IS CALLED WITH WORDPT POINTING TO
  21. * THE NEXT CHARACTER (AFTER SWALLOWING THE EMBEDDING
  22. * CHARACTER)
  23. *
  24. * --> NOTE <--
  25. * IF YOU ADD AN -EXT- TO THIS DECK, YOU MAY HAVE
  26. * TO NAME THE ENTRY POINT TO THE *DUMMY* LIST IN
  27. * DECK MCOND1. THIS IS BECAUSE MCOND1 USES EMBED,
  28. * AND MUST SATISFY EXTERNAL REFERENCES TO KEEP THE
  29. * LOADER HAPPY.
  30. * J R SCHRAMM 83/02/08
  31. *
  32. * --> MORE NOTE <--
  33. * IF YOU ARE ADDING AN EMBEDDED FUNCTION AND YOU
  34. * WANT IT TO WORK IN THE -PACK- AND PACKC- COMMANDS,
  35. * BE SURE TO ADD AN ENTRY TO THE *PACKLST* TABLE IN
  36. * THE -PACK- OVERLAY (PACKOV) IN DECK COVLAY3. UGH.
  37. * CHRIS JOHNSON. 83/03/24.
  38. *
  39. JUMP MACRO NAME,TAG,PROCED
  40. VFD 60/0L_TAG
  41. JMP RMT
  42. SX7 =X_NAME_TAG_=
  43. EQ PROCED
  44. JMP RMT
  45. JUMP ENDM
  46. *
  47. LIST G,M
  48. EXT ZAT= GET AROUND LOADER
  49. AT= EQU ZAT=-1
  50. EXT COLOR=
  51. C= EQU COLOR=
  52. EXT HIDDEN=
  53.  
  54. ENTRY EMBED
  55. * TABLE OF EMBED COMMAND NAMES
  56. CLIST JUMP ,SHOW,SEMB
  57. JUMP SHOW,A,SAEMB
  58. JUMP SHOW,T,SEMB
  59. JUMP SHOW,O,SOEMB
  60. JUMP SHOW,H,SHEMB
  61. JUMP SHOW,E,SEMB
  62. JUMP SHOW,Z,SEMB
  63. JUMP SHOW,S,SEMB
  64. JUMP SHOW,K,SKEMB
  65. JUMP ,SHOWK,SKEMB
  66. JUMP ,AT,ATEMB
  67. JUMP ,ATNM,ATEMB
  68. JUMP ,SIZE,SIZEMB
  69. JUMP ,ROTATE,ROTEMB
  70. JUMP ,SHOWA,SAEMB
  71. JUMP ,SHOWT,SEMB
  72. JUMP ,SHOWO,SOEMB
  73. JUMP ,SHOWH,SHEMB
  74. JUMP ,SHOWE,SEMB
  75. JUMP ,SHOWZ,SEMB
  76. JUMP ,COLOR,COLREMB
  77. JUMP ,C,COLREMB
  78. JUMP ,HIDDEN,SAEMB
  79.  
  80. ENDLIST DATA 0 TEMPORARY
  81. *
  82. *
  83. EMBED EQ * ENTRY/EXIT LINE
  84. SB1 1 CONSTANT
  85. SA1 WORDPT POINTS TO CURRENT CHARACTER
  86. SA1 X1 GET 1ST CHAR
  87. SX2 76B ACCESS CODE
  88. EMLOOP BX3 X2-X1
  89. ZR X3,HAVACC
  90. EMLOOPR ZR X1,EMBERRC
  91. SA1 A1+1 USE CONSTANT TO ELIM PASS
  92. EQ EMLOOP
  93. HAVACC SA1 A1+B1
  94. SX0 1R1
  95. BX3 X0-X1 SEE IF HAVE END-EMBED CODE
  96. NZ X3,EMLOOPR
  97. SX7 A1-B1 POINT TO ACCESS CODE
  98. SA7 SAVACC
  99. MX7 0
  100. SA7 A1 ZERO THE 1
  101. SA7 A1-B1 ZERO ACCESS CODE TOO
  102. *** GET COMMAND NAME TO BE PROCESSED
  103. SB1 CLIST
  104. * /--- BLOCK EMBED 00 000 78/09/09 01.03
  105. SB2 ENDLIST
  106. RJ COMSCAN SCAN FOR COMMAND NAME
  107. JP B3+CTABLE JUMP INTO COMMAND TABLE
  108. **
  109. CTABLE BSS 0
  110. JMP HERE
  111. + SB1 154 BAD FORMAT DESCRIPTOR
  112. EQ =XERR
  113. * /--- BLOCK EXECEMBED 00 000 78/09/09 01.05
  114. *
  115. SIZEMB SA7 COMNUM
  116. CALL VARDO
  117. SA1 VARBUF+1 FIRST TAG
  118. SA2 VARBUF+2 SECOND TAG
  119. SA3 VARBUF
  120. SX3 X3-2
  121. ZR X3,SIZEC IF TWO TAG
  122. PL X3,=XERR2MNY IF MORE THAN 2 TAGS
  123. MX2 1 IF ONE TAG, SET SIGN OF 2ND
  124. LX2 XCODEL
  125. SIZEC MX6 -XCODEL
  126. BX2 -X6*X2
  127. BX6 -X6*X1
  128. LX6 60-XCODEL
  129. LX2 60-2*XCODEL
  130. BX6 X6+X2
  131. EQ ENDEMB DONE
  132. *
  133. ROTEMB SA7 COMNUM
  134. CALL COMPILE GET -GETVAR- CODE
  135. LX1 -XCODEL SHIFT TO CORRECT POSITION
  136. BX6 X1 AND PUT IT IN X6
  137. EQ ENDEMB DONE
  138. *
  139. ATEMB SA7 COMNUM
  140. RJ =XATGO
  141. EQ ENDEMB
  142. *
  143. SAEMB SA7 COMNUM
  144. SX7 10 DEFAULT FOR SHOWA
  145. RJ =XSHOWAGO
  146. MX0 1
  147. LX0 60-2*XCODEL
  148. BX6 X6+X0 ADD FLAG--FOR SIMPLOT UPDATING
  149. EQ ENDEMB
  150. *
  151. SOEMB SA7 COMNUM RESET COMMAND NUMBER
  152. SX7 20 DEFAULT FOR SHOWO EMBEDDED
  153. RJ =XSHOWAGO READIN FOR SHOWO
  154. MX0 1
  155. BX6 -X0*X6 CLEAR LITERAL FLAG FOR SHOWO
  156. EQ ENDEMB END EMBEDDING
  157. *
  158. SHEMB SA7 COMNUM RESET COMMAND NUMBER
  159. SX7 15 DEFAULT FOR SHOWH EMBEDDED
  160. RJ =XSHOWAGO CONDENSE SHOWH
  161. MX0 1
  162. BX6 -X0*X6 CLEAR LITERAL FLAG FOR SHOWH
  163. EQ ENDEMB END EMBEDDING
  164. *
  165. SKEMB SA7 COMNUM RESET COMMAND NUMBER
  166. RJ =XSHOWKGO CONDENSE -SHOWK-
  167. EQ ENDEMB END EMBEDDING
  168. *
  169. SEMB SA7 COMNUM
  170. RJ =XSHOWGO
  171. * FALL INTO ENDEMB
  172. *** END EMBED PROCESSING
  173. ENDEMB SB1 1
  174. SA1 SAVACC
  175. SX7 76B ACCESS CODE
  176. SA7 X1
  177. SX7 1R1 COMPLETE END-EMBED CODE
  178. SA7 X1+B1
  179. SX7 A7+B1
  180. SA7 WORDPT RESET TO NEXT CHAR TO PROCESS
  181. EQ EMBED
  182. EMBERRC SX7 A1
  183. SA7 WORDPT
  184. EQ ERRTERM
  185. SAVACC BSS 1 SAVE ACCESS CODE LOCATION
  186. *
  187. * /--- BLOCK COMSCAN 00 000 76/11/26 17.47
  188. TITLE COMMAND SCANNING ROUTINE FOR EMBED
  189. * FINDS RECOGNIZED WORDS IN TAG FIELD AND SETS B3 TO
  190. * 0 IF FIRST ELEMENT, ETC., AND TO B2-B1 IF NOT FOUND
  191. * (I.E., AT END-OF-LIST)
  192. * ENTRY';
  193. * B1 = FIRST OF LIST OF WORDS TO BE RECOGNIZED
  194. * B2 = SCRATCH LOCATION AT END OF LIST
  195. *
  196. * EXIT';
  197. * B3 = OFFSET INTO LIST FOR WORD FOUND (ADDRESS B1+B3)
  198. *
  199. * USES REGISTERS';
  200. * A0,A1,A3,A7
  201. * B3,B5,B7
  202. * X1,X2,X3,X7
  203. *
  204. * ERRORS';
  205. * NO SYMBOL, OR TOO MANY CHARACTERS--ERRNAME
  206. * NO COMMA OR E-O-L AS TERMINATOR----ERRTERM
  207. * NO MATCH FOR SYMBOL--RETURNS B3 SET AT
  208. * END-OF-LIST
  209. *
  210. *
  211. ENTRY COMSCAN
  212. *
  213. COMSCAN EQ * FOR RETURN JUMP ENTRY
  214. *
  215. * * INITIALIZE
  216. *
  217. SB7 1 STORE A CONSTANT ONE
  218. MX7 0 CLEAR WORD ACCUMULATOR
  219. SB4 B1 MOVE ADDRESS TO B4
  220. SB5 60 INITIALIZE SHIFT FOR END
  221. SA1 WORDPT GET POINTER TO FIRST -1 POINTER
  222. SB1 X1-1 IN B1
  223. *
  224. * * STRIP LEADING BLANKS
  225. *
  226. CSCAN SB1 B1+B7 POINT TO NEXT CHARACTER
  227. SA1 B1 GET NEXT CHARACTER
  228. SX2 X1-1R CHECK FOR BLANK
  229. ZR X2,CSCAN SKIP UNTIL FIRST NON-BLANK
  230. SA2 X1+KEYTYPE CHECK LEXICAL TYPE FOR THIS CHARACTER
  231. SX2 X2-1 (ALPHA=-1, NUM=0, EOL=1,...)
  232. PL X2,TOERRN END OF SYMBOL BEFORE WE START
  233. *
  234. * * GET ALPHANUMERIC SYMBOL IN X7
  235. * * USING (KEYTYPE) TO DEFINE ALPHANUMERIC
  236. *
  237. CSLOOP LX7 6 SHIFT WORD
  238. BX7 X7+X1 ADD THIS NEW CHARACTER IN
  239. SB5 B5-6 DECREMENT END SHIFT COUNT
  240. NG B5,TOERRN TEST FOR OVER 10 CHARACTERS
  241. SB1 B1+B7
  242. SA1 B1 GET NEXT CHARACTER
  243. SA2 X1+KEYTYPE
  244. SX2 X2-1 (ALPH=-1,NUM=0,EOL=1,...)
  245. NG X2,CSLOOP CONTINUE FORMING SYMBOL
  246. *
  247. * * LEFT-JUSTIFY SYMBOL
  248. *
  249. LX7 B5,X7 SHIFT WORD --LEFT JUSTIFIED
  250. * /--- BLOCK SCANLOOP 00 000 76/11/26 17.51
  251. *
  252. * * SEARCH LIST FOR THIS SYMBOL
  253. *
  254. SA7 B2 STORE IN END SCRATCH WORD
  255. SA0 B4-B7 SET POINTER TO ORIGIN OF SEARCH WORD LIST
  256. CSCNLOO SA0 A0+B7 POINT TO NEXT WORD
  257. SA3 A0 GET NEXT WORD
  258. BX3 X3-X7
  259. NZ X3,CSCNLOO SEE IF FOUND MATCH
  260. *
  261. * * SET B3 TO EXIT VALUE
  262. *
  263. SB3 A3-B4 HOW FAR INTO LIST
  264. * B3 IS EQUAL TO B2-B1 IF NOT FOUND
  265. *
  266. * * STRIP TRAILING BLANKS
  267. * * FORCE COMMA OR E-O-L
  268. *
  269. CSLP ZR X1,CSCEND
  270. SX2 X1-1R, CHECK FOR COMMA
  271. ZR X2,CSCEND SWALLOW A COMMA
  272. * FORCE A CLEAR SYNTAX--REQUIRE COMMA
  273. SX2 X1-1R CHECK FOR BLANK
  274. NZ X2,CSTERM TERMINATOR ERROR
  275. SB1 B1+B7
  276. SA1 B1 LOOP TO END OF BLANKS
  277. EQ CSLP
  278. *
  279. CSCEND NZ X1,*+1
  280. SB1 B1-1
  281. + SX7 B1+B7
  282. SA7 WORDPT
  283. EQ COMSCAN
  284. *
  285. CSTERM SX7 B1
  286. SA7 WORDPT
  287. EQ ERRTERM
  288. *
  289. * TOERRN USED BY COMSCAN, NXTNAMR
  290. TOERRN SX7 B1
  291. SA7 WORDPT
  292. EQ ERRNAME
  293. * /--- BLOCK NXTNAMR 00 000 76/11/26 17.51
  294. TITLE NXTNAMR
  295. *
  296. * NXTNAMR RETURNS THE NEXT SYMBOL IN X6, WITH ITS
  297. * MASK IN X3. X1 CONTAINS THE TERMINATING CHARACTER.
  298. *
  299. * THIS ROUTINE SCANS FORWARD, SKIPPING BLANKS, UNTIL
  300. * A TERMINATOR IS FOUND. THE NON-BLANK CHARACTERS
  301. * ARE COLLECTED AS A SYMBOL IN X6. MORE THAN 10
  302. * CHARACTERS IS AN ERROR. WORDPT IS NOT UPDATED,
  303. * BUT B1 IS APPROPRIATELY SET.
  304. * ERROR EXIT TO -ERRNAME- IF MORE THAN 10 CHARACTERS
  305. * 10 CHARACTERS.
  306. *
  307. *
  308. ENTRY NXTNAMR
  309. NXTNAMR EQ *
  310. SA1 WORDPT
  311. SB1 X1
  312. SB2 60
  313. MX6 0
  314. LPNXT SA1 B1
  315. ZR X1,ENDLP
  316. SB1 B1+1 POINT TO NEXT CHARACTER
  317. SX2 X1-1R
  318. ZR X2,LPNXT SKIP BLANKS
  319. SA2 X1+KEYTYPE STANDARD SYNTAX
  320. SX3 X2-1
  321. PL X3,ENDLP CHECK FOR TERMINATOR
  322. SB2 B2-6 SHIFT COUNT
  323. LX1 B2,X1
  324. BX6 X6+X1 FORM SYMBOL
  325. EQ LPNXT
  326. *
  327. ENDLP LT B2,B0,TOERRN GT 10 CHARS IS ERROR
  328. SB2 -B2 DO CALCULATION
  329. SB2 B2+59
  330. MX3 1
  331. AX3 B2,X3
  332. EQ NXTNAMR
  333. * /--- BLOCK SHOWIN 00 000 77/04/23 21.26
  334. TITLE SHOW --READIN FOR SHOW, SHOWT, SHOWE
  335. *
  336. * -SHOW- (CODE=9)
  337. *
  338. EXT ARAYFLG
  339. EXT VARFEM
  340. *
  341. *
  342. ENTRY SHOWIN
  343. *
  344. SHOWIN RJ SHOWGO USE RETURN JUMP--FOR EMBEDDER
  345. EQ PUTCODE
  346. *
  347. *
  348. SHOWGO EQ * ENTRY/EXIT LINE
  349. SX6 1
  350. SA6 ARAYFLG ALLOW -SHOW ARRAY-
  351. MX6 0
  352. SA6 VARBUF+2
  353. SA6 VARBUF+3
  354. RJ VARDO INITIALIZE VARBUF, GET ALL ARGS. COMPILED
  355. SA1 VARBUF SEE HOW MANY ARGS
  356. SX2 X1-3 CHECK IF HAVE
  357. ZR X2,SHOWG3 THREE
  358. PL X2,ERR2MNY OR MORE.
  359. SX2 X1-2 CHECK IF HAVE TWO
  360. ZR X2,SHOWG2 OR ONLY ONE
  361. MX6 1
  362. LX6 XCODEL
  363. SA6 VARBUF+2 SET 2ND ARG TO DEFAULT
  364. SHOWG2 RJ VARFEM
  365. MX2 1
  366. LX2 60-2*XCODEL SHIFT FLAG INTO PLACE
  367. BX6 X6+X2 SET FLAG
  368. EQ SHOWGO
  369. *
  370. SHOWG3 RJ VARFEM GET IT ALL READY
  371. EQ SHOWGO
  372. *
  373. SHOWK TITLE READIN FOR -SHOWK-
  374. *
  375. * -SHOWK- (DISPLAY ALTERNATE KEY NAME)
  376. *
  377.  
  378. ENTRY SHOWKIN ENTRY FOR NON-EMBEDDED -SHOWK-
  379.  
  380. SHOWKIN RJ SHOWKGO
  381. EQ PUTCODE
  382. *
  383. *
  384. SHOWKGO EQ * ENTRY/EXIT
  385. RJ VARDO INITIALIZE VARBUF
  386. SA1 VARBUF CHECK NUMBER OF ARGUMENTS
  387. SX2 X1-1
  388. NG X2,ERR2FEW IF NO ARGUMENTS
  389. NZ X2,SHOWKG2 IF MORE THAN ONE ARGUMENT
  390. MX6 1 DENOTE NO COLOR PASSED
  391. LX6 XCODEL POSITION TO TOP BIT OF XCODEL
  392. SA6 VARBUF+2 SAVE SETTING
  393. SX1 2 SET NUMBER OF ARGUMENTS TO 2
  394. SX6 X1 SET INTO WRITE REGISTER
  395. SA6 VARBUF SAVE
  396. SHOWKG2 SX2 X1-2
  397. NZ X2,ERR2MNY IF TOO MANY ARGUMENTS
  398. RJ VARFEM PACK UP VARBUF VARIABLES
  399. EQ SHOWKGO EXIT
  400. *
  401. * /--- BLOCK SHOWIN 00 000 79/09/07 16.54
  402. TITLE READIN FOR -COLOR-
  403. COLREMB BSS 0 EMBEDDED -COLOR DISPLAY-
  404. *
  405. * FIRST ARG = FOREGROUND COLOR, SECOND ARG =
  406. * BACKGROUND COLOR. EITHER IS OPTIONAL, BUT
  407. * AT LEAST ONE MUST BE PRESENT.
  408. *
  409. SA7 COMNUM STORE COMMAND NUMBER
  410. SX6 1 PLACE -COLOR DISPLAY- CODE IN
  411. SA6 VARBUF INITIALIZE VARBUF,
  412. SA6 VARBUF+1 SET FIRST ENTRY = -DISPLAY-
  413.  
  414. SA1 WORDPT X1 = ADDRESS OF NEXT CHARACTER
  415. SA2 X1 X2 = NEXT CHARACTER
  416. SX7 KCOMMA
  417. IX2 X2-X7 SEE IF COMMA IS FIRST CHARACTER
  418. NZ X2,FCOLOR --- GO GET FOREGROUND TAG
  419. SA7 LASTKEY PLACE COMMA IN *LASTKEY* FOR -BCOLOR-
  420. IX6 X6+X1 ADVANCE *WORDPT*
  421. SA6 A1
  422. RJ OMIT PLACE OMITTED TAG IN VARBUF
  423. EQ BCOLOR --- GO CHECK FOR BACKGROUND TAG
  424.  
  425. FCOLOR BSS 0 GET FOREGROUND TAG
  426. RJ VARDO2
  427.  
  428. BCOLOR BSS 0 GET BACKGROUND TAG
  429. SA1 LASTKEY CHECK FOR DELIMITER = COMMA
  430. SX1 X1-KCOMMA
  431. NZ X1,BOMIT --- NOT COMMA; OMIT BGND TAG
  432. *
  433. * THIS MAKES THE BIG ASSUMPTION THAT -COMPILE-
  434. * CATCHES BAD CRAZINESS LIKE ',,^1',
  435. *
  436. RJ VARDO2 GET BACKGROUND TAG
  437. EQ COLREND --- FINISH COMMAND
  438.  
  439. BOMIT BSS 0 OMIT BACKGROUND TAG
  440. *
  441. * MIGHT HAVE TO DO SOME CHARACTER CHECKING HERE
  442. * TO MAKE SURE *WORDPT* IS KOSHER. MAYBE CHECK
  443. * TO SEE WHAT'7S IN (WORDPT) AND *LASTKEY* AND
  444. * CONTINUE IF THE COMBINATION = CLOSING EMBED.
  445. *
  446. RJ OMIT
  447.  
  448. COLREND BSS 0
  449. SA1 VARBUF SET X1 FOR CALL TO -VARFEM- (CONDC)
  450. RJ VARFEM BUILD COMMAND WORD, EXTRA STORAGE
  451. EQ ENDEMB --- FINISH EMBEDDED COMMAND
  452. *
  453. * OMIT -- SET SPECIAL OMITTED CODE
  454. *
  455. OMIT EQ *
  456. MX6 1
  457. LX6 XCODEL X6 = OMITTED ARG CODE
  458. SA1 VARBUF CURRENT VARBUF INDEX
  459. SX7 X1+1 INCREMENT INDEX
  460. SX2 X7-VARBUFL CHECK FOR VARBUF OVERFLOW
  461. PL X2,ERR2MNY --- VARBUF FULL
  462. SA7 A1 STORE NEW VARBUF COUNT
  463. SA6 VARBUF+X7 STORE OMITTED ARGUMENT
  464. EQ OMIT
  465.  
  466. KCOMMA EQU 56B COMMA CHARACTER
  467. *
  468. END
plato/source/plaopl/embed.txt Β· Last modified: 2023/08/05 18:54 by Site Administrator