User Tools

Site Tools


plato:source:plaopl:exec10

EXEC10

Table Of Contents

  • [00006] EXEC10 OVERLAYS FOR COMMAND EXECUTION
  • [00239] RBR - RESTORE B REGISTERS
  • [00261] PLC - CYBIL ASCII CODES TO PLATO OUTPUT
  • [00278] PLV - GENERATE VALUE FOR PLATO CODES
  • [00351] -NAPLPS- COMMAND EXECUTION

Source Code

EXEC10.txt
  1. EXEC10
  2. IDENT PLAT36$
  3. LCC OVERLAY(PLATO,1,0)
  4. END
  5. IDENT EXEC10
  6. TITLE EXEC10 OVERLAYS FOR COMMAND EXECUTION
  7.  
  8. CST
  9. SPACE 5,11
  10. EXEC10$ OVFILE
  11. * /--- BLOCK CHARCNV 00 000 83/07/29 09.13
  12. CHARCNV TITLE CHARCNV - CONVERT CHARACTER SETS.
  13. * CONVERT CHARACTERS FROM PLATO TO ASCII
  14. *
  15. * CHARCNV PLATO,BUF1,LEN1,BUF2,LEN2,LEN3
  16. *
  17. * CONVERT CHARACTERS FROM ASCII TO PLATO
  18. *
  19. * CHARCNV ASCII,BUF1,LEN1,BUF2,LEN2,LEN3
  20. *
  21. * LEN1 = SOURCE BUFFER LENGTH IN SOURCE CHARACTERS
  22. * LEN2 = MAXIMUM DESTINATION BUFFER LENGTH IN WORDS
  23. * LEN3 = DESTINATION BUFFER LENGTH IN CHARACTERS
  24. * /--- BLOCK CHARCNV 00 000 83/07/29 09.13
  25. SPACE 5,11
  26. CHARCNX OVRLAY
  27. SX6 6 (X6) = MAXIMUM OF 6 ARGUMENTS
  28. CALL GETARGS
  29.  
  30. * DETERMINE TYPE OF CONVERSION
  31.  
  32. SA1 VARBUF
  33. AX1 60-XCODEL
  34. SX6 X1 (X6) = 0 IF PLATO TO ASCII
  35. SA6 CVT SAVE CONVERSION TYPE
  36.  
  37. * CHECK SOURCE MESSAGE BUFFER
  38.  
  39. SA1 VARBUF+1
  40. BX5 X1
  41. NGETVAR
  42. SX6 A1
  43. SA6 SBA
  44.  
  45. * CHECK SOURCE MESSAGE BUFFER LENGTH
  46.  
  47. SA1 VARBUF+2
  48. BX5 X1
  49. NGETVAR
  50. BX6 X1
  51. SA6 SBL
  52. SA2 CVT
  53. SA2 CCH+X2 (X2) = CHARACTERS PER WORD
  54. PX1 X1 CONVERT CHARACTERS TO WORDS
  55. NX1 X1
  56. FX1 X1+X2
  57. FX1 X1/X2
  58. UX1,B1 X1
  59. LX1 B1
  60. SA2 SBA
  61. SA0 X2
  62. RJ =XBOUNDS VERIFY SOURCE BUFFER IN BOUNDS
  63.  
  64. * CHECK DESTINATION MESSAGE BUFFER
  65.  
  66. SA1 VARBUF+3
  67. BX5 X1
  68. NGETVAR
  69. SX6 A1
  70. SA6 DBA
  71.  
  72. * CHECK DESTINATION BUFFER LENGTH
  73.  
  74. SA1 VARBUF+4
  75. BX5 X1
  76. NGETVAR
  77. BX6 X1
  78. SA6 DBL
  79. SA2 DBA CHECK BUFFER IN BOUNDS
  80. SA0 X2
  81. RJ =XBOUNDS
  82. SB1 1 (B1) = 1
  83.  
  84. * SAVE B REGISTERS
  85.  
  86. SX6 B4
  87. SA6 SBR
  88. SX6 B5
  89. SA6 A6+B1
  90. SX6 B6
  91. SA6 A6+B1
  92. SX6 B7
  93. SA6 A6+B1
  94.  
  95. * SET UP REGISTERS
  96.  
  97. SA1 SBA
  98. SA2 SBL (X2) = INPUT CHARACTER COUNT
  99. MX0 -6 (X0) = MASK 6
  100. MX7 -8 (X7) = MASK 8
  101. SB4 B0 (B4) = OUTPUT CHARACTER COUNT
  102. SA1 X1 (X1) = INPUT WORD
  103. BX6 X6-X6 (X6) = OUTPUT WORD
  104. SA3 DBA
  105. SB5 X3 (B5) = OUTPUT WORD ADDRESS
  106. SA3 DBL
  107. SB6 B5+X3 (B6) = LWA+1 OUTPUT BUFFER
  108. SA3 CVT
  109. NZ X3,CAS CONVERT TO ASCII
  110. * /--- BLOCK CPL 00 000 83/07/29 09.14
  111.  
  112. * CONVERT ASCII TO PLATO
  113.  
  114. SB2 5 (B2) = CHARACTERS IN WORD
  115. SB3 60-6 (B3) = OUTPUT SHIFT COUNT
  116. CPL1 SX2 X2-1
  117. NG X2,CPL6 IF CONVERSION COMPLETE
  118. LX1 12
  119. BX5 -X7*X1
  120. SB2 B2-B1
  121. NZ B2,CPL2 IF MORE CHARACTERS
  122. SA1 A1+B1
  123. SB2 5
  124. CPL2 LX5 -1
  125. SA3 XAP+X5 GET PLATO CODES
  126. NG X5,CPL3 IF ODD CHARACTER
  127. AX3 8
  128. CPL3 BX5 -X0*X3 (X5) = PLATO CHARACTER
  129. LX3 59-7
  130. ZR X5,CPL1 IF NO TRANSLATION
  131. PL X3,CPL4 IF NO SHIFT PREFIX
  132. SX4 70B
  133. LX4 B3
  134. BX6 X6+X4
  135. SB3 B3-6
  136. SB4 B4+B1
  137. GE B3,CPL4 IF WORD NOT FULL
  138. GE B5,B6,CAS8 IF BUFFER TOO SHORT
  139. SA6 B5
  140. SB5 B5+B1
  141. BX6 X6-X6
  142. SB3 60-6
  143. CPL4 LX3 1
  144. PL X3,CPL5 IF NO ACCESS PREFIX
  145. SX4 76B
  146. LX4 B3
  147. BX6 X6+X4
  148. SB3 B3-6
  149. SB4 B4+B1
  150. GE B3,CPL5 IF WORD NOT FULL
  151. GE B5,B6,CAS8 IF BUFFER TOO SHORT
  152. SA6 B5
  153. SB5 B5+B1
  154. BX6 X6-X6
  155. SB3 60-6
  156. CPL5 LX5 B3
  157. BX6 X6+X5
  158. SB3 B3-6
  159. SB4 B4+B1
  160. GE B3,CPL1 IF WORD NOT FULL
  161. GE B5,B6,CAS8 IF BUFFER TOO SHORT
  162. SA6 B5
  163. SB5 B5+B1
  164. BX6 X6-X6
  165. SB3 60-6
  166. EQ CPL1
  167.  
  168. * CONVERSION COMPLETE
  169.  
  170. CPL6 SB7 60-6
  171. EQ CAS6
  172. * /--- BLOCK CAS 00 000 83/07/29 09.18
  173.  
  174. * CONVERT PLATO TO ASCII
  175.  
  176. CAS SB2 10 (B2) = CHARACTERS IN WORD
  177. SB3 60-12 (B3) = OUTPUT SHIFT COUNT
  178. BX4 X4-X4 (X4) = SHIFT/ACCESS FLAGS
  179. CAS1 SX2 X2-1
  180. NG X2,CAS5 IF CONVERSION COMPLETE
  181. LX1 6
  182. BX3 -X0*X1
  183. SB2 B2-B1
  184. NZ B2,CAS2 IF MORE CHARACTERS
  185. SA1 A1+B1
  186. SB2 10
  187. CAS2 SX5 X3-70B
  188. NZ X5,CAS3 IF NOT A SHIFT CODE
  189. SX3 8
  190. BX4 X4-X3
  191. EQ CAS1
  192.  
  193. CAS3 SX5 X3-76B
  194. NZ X5,CAS4 IF NOT AN ACCESS CODE
  195. SX3 16
  196. BX4 X4-X3
  197. EQ CAS1
  198.  
  199. CAS4 SA3 XAP+X3 GET ASCII CHARACTER
  200. SB7 X4+12+8
  201. LX3 B7
  202. BX3 -X7*X3 EXTRACT CHARACTER
  203. BX4 X4-X4 CLEAR SHIFT/ACCESS FLAG
  204. ZR X3,CAS1 IF NO TRANSLATION
  205. LX3 B3
  206. BX6 X6+X3
  207. SB3 B3-12
  208. SB4 B4+B1
  209. GE B3,CAS1 IF ROOM FOR MORE CHARACTERS
  210. GE B5,B6,CAS8 IF BUFFER TOO SHORT
  211. SA6 B5
  212. SB5 B5+B1
  213. SB3 60-12
  214. BX6 X6-X6
  215. EQ CAS1 PROCESS NEXT CHARACTER
  216.  
  217. * CONVERSION COMPLETE
  218.  
  219. CAS5 SB7 60-12
  220. CAS6 EQ B7,B3,CAS7 IF NO PARTIAL WORD LEFT
  221. GE B5,B6,CAS8 IF BUFFER TOO SHORT
  222. SA6 B5
  223.  
  224. * RETURN CONVERTED CHARACTER COUNT
  225.  
  226. CAS7 SA1 VARBUF+5
  227. BX5 X1
  228. SX6 B4 (X6) = OUTPUT CHARACTER COUNT
  229. RJ RBR RESTORE B REGISTERS
  230. NPUTVAR
  231. EQ =XCKPROC EXIT
  232.  
  233. * PROCESS DESTINATION BUFFER TOO SHORT
  234.  
  235. CAS8 RJ RBR RESTORE B REGISTERS
  236. EXECERR 46
  237. * /--- BLOCK SUBS/DATA 00 000 83/07/29 09.20
  238. RBR SPACE 5,11
  239. ** RBR - RESTORE B REGISTERS
  240. *
  241. * B REGISTERS B4 - B7 ARE RESTORED TO INITIAL VALUES
  242.  
  243.  
  244. RBR PS
  245. SA1 SBR
  246. SB4 X1
  247. SA1 A1+B1
  248. SB5 X1
  249. SA1 A1+B1
  250. SB6 X1
  251. SA1 A1+B1
  252. SB7 X1
  253. EQ RBR
  254.  
  255. * DATA STORAGE
  256.  
  257. CCH DATA 5.0 ASCII CHARACTERS PER WORD
  258. DATA 10.0 PLATO CHARACTERS PER WORD
  259. * /--- BLOCK TABLES 00 000 83/07/29 09.20
  260. PLC SPACE 5,11
  261. ** PLC - CYBIL ASCII CODES TO PLATO OUTPUT
  262. *
  263. * PLC (EVEN CODES,PLOT),(ODD CODES,PLOT)
  264. *
  265. * CODES = PLATO CHARACTER CODES TO PLOT CHARACTER
  266. * PLOT = CHARACTER PLOTTING ACTION
  267.  
  268.  
  269. PLC MACRO C0,C1
  270. PLV .3,C0
  271. PLV .4,C1
  272. .2 OCTMIC .1,3
  273. VFD 12/0,8/K".2",8/KS".2",8/KA".2",8/KSA".2",8/.3,8/.4
  274. .1 SET .1+1
  275. ENDM
  276.  
  277.  
  278. ** PLV - GENERATE VALUE FOR PLATO CODES
  279. *
  280. * PLV VALUE SYMBOL,PLATO CODES,PLOTTING ACTION
  281.  
  282.  
  283. PLV MACRO V,P,PA
  284. .5 SET 1
  285. .7 SET 0
  286. V SET 0
  287. .S MICRO 1,, K
  288. DUP 99
  289. .6 MICRO .5,2, P
  290. . IFC EQ,*".6"**
  291. V SET V+.7
  292. STOPDUP
  293. . ELSE
  294. .. IFC EQ,*".6"*70*
  295. V SET V+200B
  296. .S MICRO 1,, ".S"S
  297. .. ELSE
  298. ... IFC EQ,*".6"*76*
  299. V SET V+100B
  300. .S MICRO 1,, ".S"A
  301. ... ELSE
  302. .7 SET ".6"_B
  303. ... ENDIF
  304. .. ENDIF
  305. .5 SET .5+2
  306. . ENDIF
  307. ENDD
  308. .6 OCTMIC .7,3
  309. . IF -DEF,".S"_".6"
  310. ".S"_".6" EQU .N
  311. . ENDIF
  312. .N SET .N+1
  313. ENDM
  314.  
  315. NOREF .N,.1,.2,.3,.4,.5,.6,.7
  316.  
  317. .1 SET 0
  318. .N SET 0
  319.  
  320. LIST X
  321. *CALL PLATASC
  322. LIST *
  323. SPACE 5,11
  324. * BUILD SYMBOLS FOR ALL UNDEFINED CHARACTERS
  325.  
  326. .1 SET 0
  327. DUP 128
  328. .2 OCTMIC .1,3
  329. NOREF K".2",KS".2",KA".2",KSA".2"
  330. IF -DEF,K".2",1
  331. K".2" EQU 0
  332. IF -DEF,KS".2",1
  333. KS".2" EQU 0
  334. IF -DEF,KA".2",1
  335. KA".2" EQU 0
  336. IF -DEF,KSA".2",1
  337. KSA".2" EQU 0
  338. .1 SET .1+1
  339. ENDD
  340. SPACE 5,11
  341. * TEMPORARY VARIABLES
  342.  
  343. SBA EQU TBINTSV+0 SOURCE BUFFER ADDRESS
  344. SBL EQU TBINTSV+1 SOURCE BUFFER LENGTH
  345. DBA EQU TBINTSV+2 DESTINATION BUFFER ADDRESS
  346. DBL EQU TBINTSV+3 DESTINATION BUFFER LENGTH
  347. CVT EQU TBINTSV+4 CONVERSION TYPE
  348. SBR EQU TBINTSV+5 B-REGISTER SAVE (4 WORDS)
  349.  
  350. ENDOV
  351. TITLE -NAPLPS- COMMAND EXECUTION
  352.  
  353. **
  354. * -NAPLPS- (CODE = 300)
  355. *
  356. * NAPLPS SET,BUFFER,COUNT
  357. * NAPLPS '7ASCII'7,VIDBUF,12
  358. *
  359. * (NAPLPS = NORTH AMERICAN PRESENTATION LEVEL PROTOCOL SYNTAX)
  360. *
  361. * -NAPLPS- SENDS RAW NAPLPS (VIDEOTEX) DATA TO
  362. * A NAPLPS-SPEAKING TERMINAL VIA A SPECIAL
  363. * FORMATTER CODE.
  364. *
  365. * ',SET', IS A LEFT-JUSTIFIED STRING SPECIFYING THE
  366. * REPERTOIRE SET TO BE INVOKED.
  367. *
  368. * ',BUFFER', IS THE FIRST VARIABLE OF A BUFFER
  369. * CONTAINING NAPLPS CODES. CODES ARE PACKED
  370. * RIGHT-JUSTIFIED IN 12-BIT BYTES, 5 BYTES PER
  371. * 60-BIT WORD.
  372. *
  373. * ',COUNT', SPECIFIES THE NUMBER OF CODES TO BE
  374. * SENT TO THE TERMINAL.
  375. *
  376. * ON EXIT, *ZRETURN* = -1 IF EVERYTHING IS OK
  377. * 0 IF THE REPERTOIRE SET NAME
  378. * IS INVALID
  379. * 1 IF ',COUNT', IS INVALID
  380. **
  381.  
  382. EXT RETRNZ
  383. EXT PROCESS
  384.  
  385. NAPLPSX OVRLAY
  386. SX6 -1
  387. SA6 TRETURN INITIALLY OK
  388.  
  389. SA5 A5 ENSURE COMMAND WORD UNCHANGED
  390. SX6 3 THREE VARS TO UNPACK
  391. RJ =XGETCODX IN EXEC1
  392.  
  393. * CHECK COUNT AGAINST FREE SPACE IN *MOUT*
  394.  
  395. SA1 VARBUF+2 COUNT IN THIRD VAR
  396. BX5 X1 X5 = GETVAR CODE FOR -NGETVAR-
  397. NGETVAR RETURNS COUNT IN X1
  398. MX0 -6
  399. BX0 X0*X1 LIMIT MAX BYTES TO 0..127
  400. NZ X0,BADCNT -> BAD COUNT ERRROR
  401. BX6 X1 SAVE COUNT
  402. SA6 COUNT
  403. ZR X1,MOUTCHK -> NO BYTES; CHECK BUFFER SPACE
  404. SA2 FIVEP0 X2 = 5.0 (BYTES / WORD)
  405. BX0 X2 X0 = 5.0
  406. PX1 X1 FLOAT BYTES COUNT
  407. NX1 X1
  408. FX3 X1/X0 X3 = COUNT / 5.0
  409. UX2 X3,B2 X2 = WHOLE PART OF QUOTIENT
  410. LX2 B2
  411. PX2 X2 RE-FLOAT FOR SUBTRACT
  412. NX2 X2
  413. FX3 X2*X0 X3 = WHOLE PART * 5.0
  414. FX3 X1-X3 X3 = REMAINDER
  415. UX3 X3,B2
  416. LX3 B2
  417. ZR X3,WDS -> BYTE COUNT EVENLY DIV. BY 5
  418. SA1 ONEP0 X1 = 1.0
  419. FX2 X1+X2 BUMP WORDS COUNT BY 1
  420.  
  421. WDS BSS 0
  422. UX6 X2,B2 FIX WORDS COUNT
  423. LX6 B2
  424. SA6 WORDS
  425. MOUTCHK BSS 0
  426. SA1 MOUTLOC
  427. SX6 X6+1 ADD ONE FOR HEADER WORD
  428. IX1 X1+X6 COUNT + CURRENT *MOUT* CONTENTS
  429. SX1 X1-MOUTLTH SEE IF BUFFER CAN HOLD BYTES
  430. PL X1,RETRNZ -> BACK UP AND END TIMESLICE
  431.  
  432. * DECODE FIRST VAR (SET NAME)
  433.  
  434. SA1 VARBUF
  435. BX5 X1 NGETVAR WANTS IT IN X5
  436. NGETVAR RETRIEVE ALPHA STRING
  437. SA2 SETLIST SET NAME TABLE FIRST ENTRY
  438. SETCHEK BSS 0 MAKE SURE IT'7S A VALID SET NAME
  439. BX0 X1-X2 CHECK NAME AGAINST TABLE ENTRY
  440. ZR X0,OKSET -> FOUND IT
  441. SA2 A2+B1 GET NEXT TABLE ENTRY
  442. NZ X2,SETCHEK -> CHECK NEXT TABLE ENTRY
  443. SX6 0 BAD SET NAME
  444. SA6 TRETURN
  445. EQ PROCESS -> END COMMAND NOW
  446.  
  447. OKSET BSS 0 SET IS VALID
  448. SX6 A2-SETLIST+1 X6 = SET ORDINAL
  449. SA2 COUNT RETRIEVE BYTES COUNT
  450. LX6 18 POSITION ORDINAL FOR *MOUT* CODE
  451. BX1 X6+X2 ADD ORDINAL + COUNT
  452. *
  453. * ADD WORDS COUNT TO HEADER WORD SO FRAMAT KNOWS
  454. * HOW MANY WORDS TO SKIP IF USER IS ON A NON-NAPLPS
  455. * TERMINAL.
  456. *
  457. SA3 WORDS X3 = WORDS COUNT
  458. SX3 X3+1 ADD ONE FOR HEADER
  459. LX3 12 MAKE ROOM FOR *MOUT* CODE
  460. SX2 VTXCODE
  461. BX3 X3+X2 FORM *MOUT* CODE
  462. *
  463. * FINAL HEADER WORD FORMAT';
  464. * 10/0,8/SET ORDINAL,18/BYTE COUNT,12/WORD COUNT,12/VTXCODE
  465. *
  466. OUTP X3 SEND TO FRAMAT
  467.  
  468. * GET CODES FROM BUFFER. STORE IN *MOUT*.
  469. * (A6 MUST POINT TO CURRENT *MOUT* SLOT)
  470. * THIS ASSUMES THAT A1 CONTAINS THE ADDRESS OF THE
  471. * FIRST BUFFER VAR ON RETURN FROM -NGETVAR-.
  472.  
  473. SA2 COUNT RE-READ BYTES COUNT
  474. ZR X2,PROCESS -> DONE IF NO BYTES
  475. SA2 WORDS X2 = WORDS COUNT
  476. SB2 X2 B2 = BUFFER WORD COUNT
  477. SA1 VARBUF+1 X1 = BUFFER GETVAR CODE
  478. BX5 X1 TO X5 FOR -NGETVAR-
  479. NGETVAR
  480. SB1 1
  481. SA3 MOUTLOC CURRENT *MOUT* ENTRIES COUNTER
  482. BX7 X3
  483.  
  484. CODES BSS 0
  485. BX6 X1 MOVE CODES FOR STORAGE
  486. SA6 A6+B1 STORE IN *MOUT*
  487. SX7 X7+B1 INCREMENT *MOUT* ENTRIES COUNT
  488. SA7 A3 UPDATE *MOUTLOC*
  489. SB2 B2-B1 DECREMENT WORDS COUNT
  490. ZR B2,PROCESS -> FINISHED BUFFER
  491. SA1 A1+B1 GET NEXT BUFFER WORD
  492. EQ CODES -> SEND TO *MOUT*
  493.  
  494. BADCNT BSS 0
  495. SX6 1 BAD BYTES COUNT
  496. SA6 TRETURN
  497. EQ PROCESS
  498. *
  499. * INVOKING SEQUENCE NAMES.
  500. * NOTE -- FRAMAT DEPENDS UPON THE ORDER OF THESE
  501. * STRINGS.
  502. *
  503. SETLIST BSS 0
  504. DATA 0LASCII
  505. DATA 0LPDICODE
  506. DATA 0LSUPPLEMENT
  507. DATA 0LPDIMACRO
  508. DATA 0LDRCS
  509. DATA 0LMOSAIC
  510. DATA 0LG3
  511. DATA 0LSUPCON
  512. DATA 0LASCIICON
  513. DATA 0LNONE
  514. DATA 0LSETUP
  515. DATA 0LSWITCH
  516. DATA 0 END OF TABLE
  517.  
  518. COUNT BSS 1 COUNT OF BYTES TO SEND
  519. WORDS BSS 1 COUNT OF WORDS USED
  520. SETORD BSS 1 SET ORDINAL
  521. FIVEP0 DATA 5.0
  522. ONEP0 DATA 1.0
  523. ENDOV
  524. SPACE 5,11
  525. OVTABLE
  526.  
  527.  
  528. END EXEC10$
plato/source/plaopl/exec10.txt ยท Last modified: 2023/08/05 18:54 by Site Administrator