User Tools

Site Tools


plato:source:plaopl:cmpipio

CMPIPIO

Table Of Contents

  • [00007] CMP PLATO I/O.
  • [00376] GLI - GETLINE INITIALIZATIONS.
  • [00431] IFD - INITIALIZE FILE DIRECTORY.
  • [00483] IIF - INITIALIZE THE INPUT FILE.
  • [00530] IOF - INITIALIZE THE OUTPUT FILE.
  • [00612] MAS - MASTOR REQUEST.
  • [00656] OIF - OPEN INPUT FILE.
  • [00693] OOF - OPEN OUTPUT FILE.
  • [00756] RFD - READ FILE DIRECTORY.
  • [00782] WFD - WRITE FILE DIRECTORY.
  • [00809] WPF - WRITE PLATO FILE.
  • [00837] WSB - WRITE SOURCE BLOCK.

Source Code

CMPIPIO.txt
  1. CMPIPIO
  2. * /--- FILE TYPE = E
  3. * /--- BLOCK CMPIPIO 00 000 82/01/10 14.09
  4. IDENT CMPIPIO
  5. CMPIPIO TITLE CMPIPIO - CMP PLATO I/O.
  6. *COMMENT CMP PLATO I/O.
  7. *** CMPIPIO - CMP PLATO I/O.
  8. *
  9. * ALL PLATO FILE I/O ROUTINES USED BY THE CENTRAL
  10. * MICRO PLATO TRANSLATOR ARE IN THIS IDENT.
  11. *
  12. * INPUT IS DONE USING THE STANDARD CONDENSOR
  13. * *GETLINE* ROUTINE. TO USE *GETLINE* REL RECORDS
  14. * CONDC1, LEX, LEXERR, MCOND, MCOND2, AND MGET2 ARE
  15. * LOADED WITH THE CMP OVERLAY.
  16. *
  17. * THE CODE FOR PLATO FILE OUTPUT IS ALL PART OF THIS
  18. * IDENT. THE TRANSLATED OUTPUT IS WRITTEN TO PLATO FILE
  19. * *S0CMPN* WHERE N = THE CONDENSOR ORDINAL.
  20.  
  21. CST
  22. LIST X
  23. *CALL ZPXIDEF
  24. LIST *
  25.  
  26. EXT CMPIF,CMPBS,CMPBN,CMPSB,CMPFD,CMPNB
  27. CMPA5B5 BSS 1 24/0, 18/(A5), 18/(B5)
  28. CMPB2B3 BSS 1 24/0, 18/(B2), 18/(B3)
  29.  
  30. * /--- BLOCK CMPIPIO 00 000 81/12/14 13.03
  31. MPP$CLS TITLE CLOSE PLATO FILES.
  32. *** MPP$CLS - CLOSE PLATO FILES.
  33. *
  34. * ENTRY (B1) = 1.
  35. * (B2) = CYBIL STACK FRAME POINTER.
  36. * (B3) = CYBIL STACK LIMIT.
  37. * (X1) = ADDRESS OF RETURN STATUS.
  38. * (X7) = RETURN ADDRESS.
  39. *
  40. * EXIT (B1) = 1.
  41. * (B2) = AS ON ENTRY.
  42. * (B3) = AS ON ENTRY.
  43. *
  44. * THE RETURN STATUS IS STORED AT ((X1)).
  45.  
  46.  
  47. ENTRY MPO$CLS
  48.  
  49. MPO$CLS ENTR ENTRY
  50.  
  51. * SAVE CYBIL REGISTERS B2 AND B3.
  52.  
  53. SX6 B2
  54. SX7 B3
  55. LX6 18
  56. BX6 X6+X7
  57. SA6 CMPB2B3
  58.  
  59. * SAVE RETURN STATUS ADDRESS.
  60.  
  61. BX6 X1
  62. SA6 CLSA
  63.  
  64. * CLOSE THE INPUT FILE.
  65.  
  66. RJ =XCLOSE
  67.  
  68. * WRITE THE CURRENT SOURCE BLOCK TO DISK.
  69.  
  70. RJ WSB
  71. SX7 CMP.IOE I/O ERROR CODE
  72. NZ X6,CLS1 IF ERRORS
  73.  
  74. * WRITE THE DIRECTORY TO DISK.
  75.  
  76. RJ WFD
  77. SX7 CMP.IOE I/O ERROR CODE
  78. NZ X6,CLS1 IF ERRORS
  79.  
  80. * CLOSE THE OUTPUT FILE.
  81.  
  82. SX6 MS.CPF
  83. RJ MAS
  84. SX7 CMP.OK NO ERROR CODE
  85.  
  86. * SET RETURN STATUS. (X7) = STATUS.
  87.  
  88. CLS1 SA1 CLSA
  89. SA7 X1
  90.  
  91. * RESTORE CYBIL REGISTERS B2 AND B3.
  92.  
  93. SA1 CMPB2B3
  94. SB3 X1
  95. AX1 18
  96. SB2 X1
  97. DONE RETURN
  98.  
  99. CLSA BSS 1
  100.  
  101. * /--- BLOCK CMPIPIO 00 000 81/12/14 13.02
  102. MPP$GTL TITLE MPP$GTL - GET PLATO SOURCE LINE.
  103. *** MPP$GTL - GET PLATO SOURCE LINE.
  104. *
  105. * GET THE NEXT LINE OF PLATO SOURCE CODE.
  106. *
  107. * THE NEXT NON-COMMENT SOURCE LINE IS READ FROM THE
  108. * PLATO FILE. -USE- COMMANDS ARE HANDLED TRANSPARENTLY.
  109. * THE END OF FILE IS SIGNALLED BY RETURNING A -CSTOP*-
  110. * COMMAND.
  111. *
  112. * ENTRY (B1) = 1.
  113. * (B2) = CYBIL STACK FRAME POINTER.
  114. * (B3) = CYBIL STACK LIMIT.
  115. * ((B5)) = COMMAND NAME POINTER ADDRESS.
  116. * (X1) = INDENTATION LEVEL POINTER ADDRESS.
  117. * (X2) = TAG POINTER ADDRESS.
  118. * (X3) = TAG LENGTH POINTER ADDRESS.
  119. * (X4) = BLOCK NUMBER POINTER ADDRESS.
  120. * (X5) = LINE NUMBER POINTER ADDRESS.
  121. * (X7) = RETURN ADDRESS.
  122. *
  123. * EXIT (B1) = 1.
  124. * (B2) = AS ON ENTRY.
  125. * (B3) = AS ON ENTRY.
  126. * /--- BLOCK CMPIPIO 00 000 81/12/09 15.40
  127.  
  128. ENTRY MPO$GTL
  129.  
  130. MPO$GTL ENTR ENTRY
  131.  
  132. * SAVE CYBIL REGISTERS B2 AND B3.
  133.  
  134. SX6 B2
  135. SX7 B3
  136. LX6 18
  137. BX6 X6+X7
  138. SA6 CMPB2B3
  139.  
  140. * STORE POINTER ARGUMENTS.
  141.  
  142. SX6 INDENT
  143. SX7 TAG
  144. SA6 X1
  145. SA7 X2
  146. SX6 TAGCNT
  147. SX7 BLKNUM
  148. SA6 X3
  149. SA7 X4
  150. SX6 LINENUM
  151. SA6 X5
  152. SA1 B5
  153. SX6 COMMAND
  154. SA6 X1
  155.  
  156. * RESTORE (A5), THE SOURCE WORD POINTER, AND
  157. * (B5), THE END OF BLOCK POINTER.
  158.  
  159. SA1 CMPA5B5
  160. SB5 X1
  161. AX1 18
  162. SA5 X1
  163.  
  164. * READ THE NEXT SOURCE LINE.
  165.  
  166. RJ =XGETLINE
  167.  
  168. * PRESERVE (A5), THE SOURCE WORD POINTER, AND
  169. * (B5), THE END OF BLOCK POINTER.
  170.  
  171. SX6 A5
  172. SX7 B5
  173. LX6 18
  174. BX6 X6+X7
  175. SA6 CMPA5B5
  176.  
  177. * RESTORE CYBIL REGISTERS B2 AND B3.
  178.  
  179. SA1 CMPB2B3
  180. SB3 X1
  181. AX1 18
  182. SB2 X1
  183. DONE EXIT
  184.  
  185. * /--- BLOCK CMPIPIO 00 000 81/12/14 13.03
  186. MPP$OPN TITLE MPP$OPN - OPEN PLATO FILES.
  187. *** MPP$OPN - OPEN PLATO FILES.
  188. *
  189. * ENTRY (B1) = 1.
  190. * (B2) = CYBIL STACK FRAME POINTER.
  191. * (B3) = CYBIL STACK LIMIT.
  192. * (X1) = ADDRESS OF RETURN STATUS.
  193. * (X7) = RETURN ADDRESS.
  194. *
  195. * EXIT (B1) = 1.
  196. * (B2) = AS ON ENTRY.
  197. * (B3) = AS ON ENTRY.
  198. *
  199. * THE RETURN STATUS IS STORED AT ((X1)).
  200.  
  201.  
  202. ENTRY MPO$OPN
  203.  
  204. MPO$OPN ENTR ENTRY
  205.  
  206. * SAVE CYBIL REGISTERS B2 AND B3.
  207.  
  208. SX6 B2
  209. SX7 B3
  210. LX6 18
  211. BX6 X6+X7
  212. SA6 CMPB2B3
  213.  
  214. * SAVE RETURN STATUS ADDRESS.
  215.  
  216. BX6 X1
  217. SA6 OPNA
  218.  
  219. * INITIALIZE THE OUTPUT FILE.
  220.  
  221. RJ IOF
  222. SX7 CMP.OIE OUTPUT INITIALIZATION ERROR CODE
  223. NZ X6,OPN1 IF ERRORS
  224.  
  225. * INITIALIZE THE INPUT FILE.
  226.  
  227. RJ IIF
  228. SX7 CMP.IIE INPUT INITIALIZATION ERROR CODE
  229. NZ X6,OPN1 IF ERRORS
  230. SX7 CMP.OK NO ERROR CODE
  231.  
  232. * SET RETURN STATUS. (X7) = STATUS.
  233.  
  234. OPN1 SA1 OPNA
  235. SA7 X1
  236.  
  237. * RESTORE CYBIL REGISTERS B2 AND B3.
  238.  
  239. SA1 CMPB2B3
  240. SB3 X1
  241. AX1 18
  242. SB2 X1
  243. DONE RETURN
  244.  
  245. OPNA BSS 1
  246.  
  247. * /--- BLOCK CMPIPIO 00 000 81/12/14 13.02
  248. MPP$PTL TITLE MPP$PTL - PUT PLATO SOURCE LINE.
  249. *** MPP$PTL - PUT PLATO SOURCE LINE.
  250. *
  251. * WRITE A SOURCE LINE TO A PLATO FILE.
  252. *
  253. * ENTRY (B1) = 1.
  254. * (B2) = CYBIL STACK FRAME POINTER.
  255. * (B3) = CYBIL STACK LIMIT.
  256. * (X1) = SOURCE LINE FWA.
  257. * (X2) = SOURCE LINE WORD LENGTH.
  258. * (X3) = ADDRESS OF TERMINATION CONDITION.
  259. * (X7) = RETURN ADDRESS.
  260. *
  261. * EXIT (B1) = 1.
  262. * (B2) = AS ON ENTRY.
  263. * (B3) = AS ON ENTRY.
  264.  
  265. * /--- BLOCK CMPIPIO 00 000 81/12/11 14.17
  266.  
  267. ENTRY MPO$PTL
  268.  
  269. MPO$PTL ENTR ENTRY
  270.  
  271. * TEST LINE LENGTH.
  272.  
  273. SX7 CMP.ILL ILLEGAL LINE LENGTH ERROR CODE
  274. NG X2,PTLX IF NEGATIVE LENGTH
  275. ZR X2,PTLX IF ZERO LENGTH
  276. SX0 X2-13-1
  277. PL X0,PTLX IF LONGER THAN 13 WORDS
  278.  
  279. * TEST FOR END OF LINE.
  280.  
  281. IX6 X1+X2
  282. MX0 -12
  283. SA5 X6-1
  284. BX0 -X0*X5
  285. SX7 CMP.NEL NO END OF LINE ERROR CODE
  286. NZ X0,PTLX IF NO END OF LINE
  287.  
  288. * COMPUTE NEW SPACE IN CURRENT BLOCK.
  289.  
  290. PTL1 SA4 CMPBS
  291. IX6 X4-X2
  292. NG X6,PUTL3 IF BLOCK FULL
  293. SX0 BLKLTH
  294. SA6 A4
  295.  
  296. * MOVE LINE TO SOURCE BLOCK.
  297.  
  298. IX0 X0-X4
  299. SA4 CMPSB
  300. IX0 X0+X4
  301. SA0 X1
  302. SB4 X2+
  303. + WE B4
  304. RJ =XECSPRTY
  305.  
  306. * RETURN WITH NO ERRORS.
  307.  
  308. PUTL2 SX7 CMP.OK NO ERROR CODE
  309.  
  310. * RETURN TO CALLER. (X7) = TERMINATION CONDITION.
  311.  
  312. PTLX SA7 X3
  313. DONE EXIT
  314.  
  315. * SAVE THE ARGUMENTS.
  316.  
  317. PUTL3 BX6 X1
  318. BX7 X2
  319. SA6 PTLA
  320. SA7 A6+B1
  321. BX6 X3
  322. SA6 A7+1
  323.  
  324. * SAVE CYBIL REGISTERS B2 AND B3.
  325.  
  326. SX6 B2
  327. SX7 B3
  328. LX6 18
  329. BX6 X6+X7
  330. SA6 CMPB2B3
  331.  
  332. * WRITE THE SOURCE BLOCK.
  333.  
  334. RJ WSB
  335.  
  336. * RESTORE CYBIL REGISTERS B2 AND B3.
  337.  
  338. SA1 CMPB2B3
  339. SB3 X1+
  340. AX1 18
  341. SB2 X1
  342.  
  343. * RESTORE THE ARGUMENTS.
  344.  
  345. SA1 PTLA
  346. SA2 A1+B1
  347. SA3 A2+B1
  348.  
  349. * TEST FOR I/O ERRORS.
  350.  
  351. SX7 CMP.IOE I/O ERROR CODE
  352. NZ X6,PTLX RETURN IF I/O ERRORS
  353.  
  354. * INCREMENT THE BLOCK NUMBER.
  355.  
  356. SA4 CMPBN
  357. SX6 X4+B1
  358. SA5 CMPNB
  359. IX5 X6-X5
  360. SX7 CMP.OFO OUTPUT FILE OVERFLOW ERROR CODE
  361. PL X5,PTLX RETURN IF FILE OVERFLOW
  362. SA6 A4
  363.  
  364. * RESET THE SPACE REMAINING.
  365.  
  366. SX7 BLKLTH
  367. SA7 CMPBS
  368. EQ PTL1 WRITE THE SOURCE LINE
  369.  
  370. PTLA BSS 3 60/(X1), 60/(X2), 60/(X3)
  371.  
  372. * /--- BLOCK CMPIPIO 00 000 81/12/05 19.46
  373. CMPIOS TITLE CMPIOS - CMP I/O SUBROUTINES.
  374. * /--- BLOCK CMPIPIO 00 000 81/12/05 17.17
  375. GLI SPACE 4,10
  376. ** GLI - GETLINE INITIALIZATIONS.
  377. *
  378. * INITIALIZE LINE BY LINE I/O BY READING THE FIRST
  379. * LINE. THIS IS THE NORMAL CONDENSOR TECHNIQUE.
  380. *
  381. * ENTRY (B1) = 1.
  382. *
  383. * EXIT (B1) = 1.
  384. * (ICX) = COMMAND STORAGE POINTER.
  385. * (INX) = EXTRA STORAGE POINTER.
  386. * (IST) = LOCATION OF NEXT COMMAND WORD.
  387. * (CMPA5B5) = SAVED (A5) AND (B5) FOR GETLINE.
  388. *
  389. * USES A - 5, 6, 7.
  390. * B - 5.
  391. * X - 5, 6, 7.
  392. *
  393. * CALLS GETCMD.
  394. *
  395. * MACROS NONE.
  396.  
  397.  
  398. GLI PS ENTRY/EXIT
  399.  
  400. * SETUP EXTRA STORAGE AND COMMAND STORAGE POINTERS.
  401.  
  402. SX6 INFOLTH
  403. SA6 ICX
  404. SX7 B0
  405. SA7 INX
  406.  
  407. * READ THE FIRST LINE.
  408.  
  409. SB5 CBUF+1
  410. SA5 B5-B1
  411. RJ =XGETCMD
  412. SX6 A5
  413.  
  414. * SETUP POINTER TO NEXT COMMAND WORD.
  415.  
  416. SX6 A5
  417. SA6 IST
  418.  
  419. * PRESERVE (A5), THE SOURCE WORD POINTER, AND
  420. * (B5), THE END OF BLOCK POINTER.
  421.  
  422. SX6 A5
  423. SX7 B5
  424. LX6 18
  425. BX6 X6+X7
  426. SA6 CMPA5B5
  427. EQ GLI RETURN
  428.  
  429. * /--- BLOCK CMPIPIO 00 000 81/12/05 17.27
  430. IFD SPACE 4,10
  431. ** IFD - INITIALIZE FILE DIRECTORY.
  432. *
  433. * INITIALIZE THE FILE DIRECTORY SUCH THAT
  434. * ALL BLOCKS ARE EMPTY, PARTIALED IN, AND THE
  435. * BLOCK NUMBERS EQUAL THE PHYSICAL BLOCK NUMBERS.
  436. *
  437. * ENTRY (B1) = 1.
  438. * (CMPFD) = DIRECTORY EM FWA.
  439. *
  440. * EXIT (B1) = 1.
  441. *
  442. * USES A - 1, 2, 4.
  443. * B - NONE.
  444. * X - ALL.
  445. *
  446. * MACROS RX, WX.
  447.  
  448.  
  449. IFD PS ENTRY/EXIT
  450.  
  451. * WRITE THE BLOCK INFORMATION WORDS.
  452.  
  453. SA1 CMPFD
  454. SX0 D.BINFO
  455. SX7 D.BNAME-D.BINFO (X7) = OFFSET FROM INFO TO NAME WORD
  456. IX1 X0+X1 (X1) = BLOCK INFO WORDS FWA
  457. SX5 B1 (X5) = 1 (DECREMENT)
  458. SA2 CMPNB (X2) = BLOCK NUMBER
  459. IX2 X2-X5
  460. IX0 X1+X2
  461. SA4 IFDA (X4) = MASK
  462. IFD1 RX3 X0 READ BLOCK INFO WORD
  463. BX6 -X4*X3 CLEAR SELECTED FIELDS
  464. BX6 X2+X6 INSERT BLOCK NUMBER
  465. WX6 X0 REWRITE THE INFO WORD
  466. MX6 0
  467. IX0 X0+X7
  468. WX6 X0 CLEAR THE BLOCK NAME
  469. IX2 X2-X5
  470. IX0 X1+X2
  471. NZ X2,IFD1 LOOP
  472. EQ IFD RETURN
  473.  
  474. IFDA VFD BI.PW/-0 PARTIAL FLAG
  475. VFD BI.TW/-0 BLOCK TYPE
  476. VFD BI.UNW/0 UNUSED
  477. VFD BI.DW/0 EDIT DATE
  478. VFD BI.BW/-0 BLOCKS
  479. VFD BI.BLW/-0 BLOCK LENGTH
  480. VFD BI.BNW/-0 BLOCK NUMBER
  481. * /--- BLOCK CMPIPIO 00 000 81/12/05 17.53
  482. IIF SPACE 4,10
  483. ** IIF - INITIALIZE THE INPUT FILE.
  484. *
  485. * OPEN THE INPUT SOURCE FILE AND PERFORM INITIALIZAIONS
  486. * FOR GETLINE.
  487. *
  488. * NORMAL CONDENSOR I/O IS USED.
  489. *
  490. * ENTRY (B1) = 1.
  491. *
  492. * EXIT (B1) = 1.
  493. * (CMPIF) = INPUT FILE NAME (2 WORDS).
  494. * (X6) = 0 IF NO ERRORS.
  495. * (X6) .NE. IF ERRORS.
  496. *
  497. * USES A - 0, 1, 6, 7.
  498. * B - NONE.
  499. * X - 0, 1, 6, 7.
  500. *
  501. * CALLS GLI, OIF.
  502. *
  503. * MACROS NONE.
  504.  
  505.  
  506. IIF PS ENTRY/EXIT
  507.  
  508. * GET THE FILE NAME.
  509.  
  510. SA1 APLACOM
  511. SX0 PC.SRCA
  512. SA0 CMPIF
  513. IX0 X0+X1
  514. + RE 2
  515. RJ =XECSPRTY
  516.  
  517. * OPEN THE INPUT FILE.
  518.  
  519. RJ OIF
  520. NZ X6,IIF RETURN IF ERRORS
  521.  
  522. * PERFORM GETLINE INITIALIZATIONS.
  523.  
  524. RJ GLI
  525. MX6 0
  526. EQ IIF RETURN
  527.  
  528. * /--- BLOCK CMPIPIO 00 000 82/01/10 11.51
  529. IOF SPACE 4,10
  530. ** IOF - INITIALIZE THE OUTPUT FILE.
  531. *
  532. * OPEN THE CMP OUTPUT FILE *S0CMP*, INITIALIZE AS AN
  533. * EMPTY FILE.
  534. *
  535. * THE EM BINARY BUFFER IS USED AS THE I/O BUFFER.
  536. *
  537. * ENTRY (B1) = 1.
  538. * (CONBUFF) = BINARY BUFFER EM FWA.
  539. *
  540. * EXIT (B1) = 1.
  541. * (X6) = 0 IF NO ERRORS.
  542. * (X6) .NE. 0 IF ERRORS.
  543. * (CMPFD) = DIRECTORY EM FWA.
  544. * (CMPSB) = SOURCE BLOCK EM FWA.
  545. * (CMPNB) = NUMBER OF BLOCKS IN THE FILE.
  546. * (CMPBN) = 1 (CURRENT BLOCK NUMBER).
  547. * (CMPBS) = *BLKLTH* (SPACE IN BLOCK).
  548. *
  549. * USES A - 0, 1, 6, 7.
  550. * B - NONE.
  551. * X - 0, 1, 6, 7.
  552. *
  553. * CALLS ECSPRTY, IFD, OOF, RFD.
  554. *
  555. * MACROS RX.
  556.  
  557.  
  558. IOF PS ENTRY/EXIT
  559.  
  560. * SET DIRECTORY AND SOURCE BLOCKS EM FWAS. THE
  561. * LESSON BINARY BUFFER IS USED FOR OUTPUT I/O.
  562.  
  563. SA1 CONBUFF
  564. SX7 BLKLTH ADVANCE BEYOND THE HEADER
  565. IX6 X1+X7
  566. SA6 CMPFD
  567. IX6 X6+X7
  568. SA6 CMPSB
  569.  
  570. * SETUP THE BLOCK NUMBER AND SPACE IN BLOCK.
  571.  
  572. SX6 B1+
  573. SA7 CMPBS
  574. SA6 CMPBN
  575.  
  576. * OPEN THE OUTPUT FILE.
  577.  
  578. RJ OOF
  579. NZ X6,IOF RETURN IF ERRORS
  580.  
  581. * READ THE FILE DIRECTORY.
  582.  
  583. RJ RFD
  584. NZ X6,IOF RETURN IF ERRORS
  585.  
  586. * GET THE NUMBER OF BLOCKS IN THE FILE.
  587.  
  588. SA0 CMPNB
  589. SA1 CMPFD
  590. SX0 D.BLKS
  591. IX0 X0+X1
  592. + RE 1
  593. RJ =XECSPRTY
  594.  
  595. * VERIFY THAT THE NUMBER OF BLOCKS IS REASONABLE.
  596.  
  597. SA1 A0
  598. SX6 DSBLKS*MAXPART
  599. IX6 X6-X1
  600. NG X6,IOF RETURN IF TOO MANY BLOCKS
  601. SX6 X1-DSBLKS
  602. NG X6,IOF RETURN IF TOO FEW BLOCKS
  603.  
  604. * INITIALIZE THE FILE DIRECTORY.
  605.  
  606. RJ IFD
  607. MX6 0
  608. EQ IOF RETURN
  609.  
  610. * /--- BLOCK CMPIPIO 00 000 82/01/10 14.10
  611. MAS SPACE 4,10
  612. ** MAS - MASTOR REQUEST.
  613. *
  614. * ENTRY (B1) = 1.
  615. * (X6) = MASTOR REQUEST CODE.
  616. * (CMP.OF) = OUTPUT FILE NAME (1ST ARGUMENT).
  617. * (X1) = 2ND MASTOR ARGUMENT.
  618. * (X2) = 3RD MASTOR ARGUMENT.
  619. *
  620. * EXIT (B1) = 1.
  621. * (X6) = MASTOR ERROR CODE.
  622. *
  623. * USES A - 1, 3, 6, 7.
  624. * B - NONE.
  625. * X - 1, 3, 6, 7.
  626. *
  627. * CALLS MASREQ, MASWAIT.
  628. *
  629. * MACROS NONE.
  630.  
  631.  
  632. MAS PS ENTRY/EXIT
  633. SA3 CMP.OF
  634. SA6 MASA
  635. BX6 X3
  636. BX7 X1
  637. SA6 A6+2
  638. SA7 A6+B1
  639. BX7 X2
  640. SA7 A7+1
  641. SX1 MASA
  642. RJ =XMASREQ
  643. SX1 MASA
  644. RJ =XMASWAIT
  645. SB1 1 RESTORE (B1)
  646. SA1 MASA
  647. MX6 -5
  648. AX1 6
  649. BX6 -X6*X1
  650. EQ MAS RETURN
  651.  
  652. MASA BSS MS.RDIM
  653.  
  654. * /--- BLOCK CMPIPIO 00 000 81/12/09 15.57
  655. OIF SPACE 4,10
  656. ** OIF - OPEN INPUT FILE.
  657. *
  658. * USE NORMAL CONDENSOR I/O ROUTINES TO OPEN
  659. * THE INPUT FILE.
  660. *
  661. * ENTRY (B1) = 1.
  662. *
  663. * EXIT (B1) = 1.
  664. * (X6) = 0 IF NO ERRORS.
  665. * (X6) .NE. 0 IF ERRORS.
  666. *
  667. * USES A - 0, 1, 2, 3, 5.
  668. * B - 2.
  669. * X - 0, 1, 2, 3, 5.
  670. *
  671. * CALLS ECSPRTY, OPEN.
  672. *
  673. * MACROS NONE.
  674.  
  675.  
  676. OIF PS ENTRY/EXIT
  677.  
  678. * SET UP FILE POINTERS.
  679.  
  680. SA2 CMPIF
  681. SB2 FREQ
  682. SA3 A2+1
  683. SA0 CBUF
  684. SA1 AFILEBF
  685.  
  686. * OPEN THE FILE.
  687.  
  688. RJ =XOPEN
  689. EQ OIF RETURN
  690.  
  691. * /--- BLOCK CMPIPIO 00 000 82/01/10 14.18
  692. OOF SPACE 4,10
  693. ** OOF - OPEN OUTPUT FILE.
  694. *
  695. * THE OUTPUT FILE NAME IS SET TO *S0CMPN* WHERE N = THE
  696. * CONDENSOR ORDINAL.
  697. * 10 ATTEMPTS ARE MADE BEFORE GIVING UP.
  698. *
  699. * ENTRY (B1) = 1.
  700. * (CONDN) = CONDENSOR ORDINAL (BITS 0-17).
  701. *
  702. * EXIT (B1) = 1.
  703. * (CMP.OF) = OUTPUT FILE NAME.
  704. * (X6) = 0, IF NO ERRORS.
  705. * (X6) .NE. 0, IF UNABLE TO OPEN THE FILE.
  706. *
  707. * USES A - 1.
  708. * B - 1.
  709. * X - 1, 5, 6.
  710. *
  711. * CALLS MAS, S=WAIT.
  712. *
  713. * MACROS NONE.
  714.  
  715.  
  716. OOF PS ENTRY/EXIT
  717.  
  718. * BUILD THE OUTPUT FILE NAME.
  719.  
  720. SA1 CONDN
  721. SA2 =0LS0CMP
  722. SX6 X1+1R0
  723. LX6 29-5
  724. BX6 X2+X6
  725. SA6 CMP.OF
  726.  
  727. * REQUEST MASTOR TO OPEN THE FILE.
  728.  
  729. SX5 9 (X5) = RETRY COUNTER
  730. OOF1 SA1 OOFA
  731. SX6 MS.OPF
  732. RJ MAS
  733.  
  734. * CHECK FOR ERRORS.
  735.  
  736. ZR X6,OOF IF NO ERRORS
  737. BX1 X6
  738. SX6 X1-8
  739. ZR X6,OOF OKAY IF FILE ALREADY OPEN
  740. SX6 X1-6
  741. NZ X6,OOF ERROR IF TABLES NOT FULL
  742. SX5 X5-1
  743. NG X5,OOF ERROR IF 10 FAILURES
  744.  
  745. * WAIT FOR TABLES TO CLEAR.
  746.  
  747. SB1 1000
  748. RJ =XS=WAIT
  749. SB1 1 RESET (B1)
  750. EQ OOF1 TRY AGAIN
  751.  
  752. OOFA DATA 0LWRITE
  753.  
  754. * /--- BLOCK CMPIPIO 00 000 81/12/05 19.51
  755. RFD SPACE 4,10
  756. ** RFD - READ FILE DIRECTORY.
  757. *
  758. * ENTRY (B1) = 1.
  759. * (CMPFD) = DIRECTORY EM FWA.
  760. *
  761. * EXIT (B1) = 1.
  762. * (X6) = 0 IF NO ERRORS.
  763. * (X6) .NE. 0 IF ERRORS.
  764. *
  765. * USES A - 2.
  766. * B - NONE.
  767. * X - 1, 2, 6.
  768. *
  769. * CALLS MAS.
  770. *
  771. * MACROS NONE.
  772.  
  773.  
  774. RFD PS ENTRY/EXIT
  775. SX6 MS.RPF
  776. SA2 CMPFD
  777. SX1 B0
  778. RJ MAS
  779. EQ RFD RETURN
  780.  
  781. WFD SPACE 4,10
  782. ** WFD - WRITE FILE DIRECTORY.
  783. *
  784. * ENTRY (B1) = 1.
  785. * (CMPFD) = DIRECTORY EM FWA.
  786. *
  787. * EXIT (B1) = 1.
  788. * (X6) = 0 IF NO ERRORS.
  789. * (X6) .NE. 0 IF ERRORS.
  790. *
  791. * USES A - 2.
  792. * B - NONE.
  793. * X - 1, 2, 6.
  794. *
  795. * CALLS MAS.
  796. *
  797. * MACROS NONE.
  798.  
  799.  
  800. WFD PS ENTRY/EXIT
  801. SX6 MS.WPF
  802. SA2 CMPFD
  803. SX1 B0
  804. RJ MAS
  805. EQ WFD RETURN
  806.  
  807. * /--- BLOCK CMPIPIO 00 000 81/12/05 17.44
  808. WPF SPACE 4,10
  809. ** WPF - WRITE PLATO FILE.
  810. *
  811. * WRITE A BLOCK TO A PLATO FILE.
  812. *
  813. * ENTRY (B1) = 1.
  814. * (X1) = BLOCK NUMBER.
  815. * (X2) = EM FWA OF BLOCK.
  816. *
  817. * EXIT (B1) = 1.
  818. * (X6) = 0 IF NO ERRORS.
  819. * (X6) .NE. 0 IF ERRORS.
  820. *
  821. * USES A - NONE.
  822. * B - NONE.
  823. * X - 6.
  824. *
  825. * CALLS MAS.
  826. *
  827. * MACROS NONE.
  828.  
  829.  
  830. WPF PS ENTRY/EXIT
  831. SX6 MS.WPF
  832. RJ MAS
  833. EQ WPF RETURN
  834.  
  835. * /--- BLOCK CMPIPIO 00 000 82/01/07 15.29
  836. WSB SPACE 4,10
  837. ** WSB - WRITE SOURCE BLOCK.
  838. *
  839. * WRITE A PLATO SOURCE BLOCK.
  840. *
  841. * ENTRY (CMPBN) = BLOCK NUMBER.
  842. * (CMPBS) = SPACE IN BLOCK.
  843. * (CMPSB) = EM FWA OF BLOCK.
  844. * (CMPFD) = EM FWA OF DIRECTORY.
  845. *
  846. * EXIT (X6) = 0, IF NO ERRORS.
  847. * (X6) .NE. 0 IF ERRORS.
  848. *
  849. * USES A - 1, 4, 5.
  850. * B - NONE.
  851. * X - 0, 1, 4, 5, 6, 7.
  852. *
  853. * CALLS WPF.
  854. *
  855. * MACROS RX, WX.
  856.  
  857.  
  858. WSB PS ENTRY/EXIT
  859.  
  860. * RETURN IF NO DATA IN BLOCK.
  861.  
  862. SX6 B0 PRESET ERROR RETURN
  863. SA1 CMPBS
  864. SX1 X1-BLKLTH
  865. ZR X1,WSB IF NO DATA IN BLOCK
  866.  
  867. * UPDATE LAST PHYSICAL BLOCK NUMBER IN THE DIRECTORY.
  868.  
  869. SA1 CMPBN (X1) = BLOCK NUMBER
  870. SA5 CMPFD (X5) = DIRECTORY EM FWA
  871. MX6 1 (X6) = NEW FILE FORMAT FLAG
  872. SX0 D.LPBLK
  873. BX6 X1+X6
  874. IX0 X0+X5
  875. WX6 X0
  876.  
  877. * SET THE BLOCK LENGTH IN THE DIRECTORY.
  878.  
  879. SA4 CMPBS
  880. SX7 BLKLTH
  881. IX6 X7-X4 (X6) = BLOCK LENGTH
  882. SX0 D.BINFO
  883. IX0 X0+X5
  884. IX0 X0+X1
  885. RX5 X0 (X5) = BLOCK INFO WORD
  886. LX6 BI.BLF
  887. BX6 X5+X6
  888. WX6 X0
  889.  
  890. * SET BLOCK NAME TO INPUT FILE NAME.
  891.  
  892. SA5 CMPIF+1
  893. SX7 D.BNAME-D.BINFO
  894. IX0 X0+X7
  895. BX6 X5
  896. WX6 X0
  897.  
  898. * WRITE THE SOURCE BLOCK TO DISK.
  899.  
  900. SA2 CMPSB
  901. RJ WPF
  902. EQ WSB RETURN
  903.  
  904. * /--- BLOCK CMPIPIO 00 000 81/12/09 15.59
  905.  
  906. END
plato/source/plaopl/cmpipio.txt ยท Last modified: 2023/08/05 18:54 by Site Administrator