User Tools

Site Tools


plato:source:plaopl:binaryx

BINARYX

Table Of Contents

  • [00005] LESSON BINARY SUBROUTINES
  • [00040] -TESTBIN- COMMAND
  • [00078] TESTBIN CHECK IF BINARY SHOULD EXIST
  • [00166] NVERSC N-VERSION CONVERSION
  • [00167] NVERSC CHECK FOR N-VERSION SUBSTITUTION
  • [00168] NVERSC - N-VERSION SUBSTITUTION CHECKS
  • [00275] -BINSUM- SUM-CHECK FOR BINARY
  • [00330] -LOADBIN- LOAD BINARY FROM DISK
  • [00802] MAKEBIN CREATE A BINARY FILE
  • [01016] -DELBIN- DESTROY BINARY FILE
  • [01052] -DESTROY- DESTROY A FILE
  • [01091] PACKWRT WRITE PACK DIRECTORY TO DISK
  • [01253] PCHOOSE CHOOSE PACK TO PUT BINARY ON

Source Code

BINARYX.txt
  1. BINARYX
  2. * /--- FILE TYPE = E
  3. * /--- BLOCK BINARY 00 000 78/12/18 20.48
  4. IDENT BINARYX
  5. TITLE LESSON BINARY SUBROUTINES
  6. *
  7. CST
  8. *
  9. EXT ECSPRTY,PROLIST,DEVSYS
  10. EXT PROCESS
  11. EXT NOECS
  12. EXT SLIBERR (ERROR ON WAY TO SYSLIB)
  13. *
  14. LIST F
  15. *
  16. * /--- BLOCK DEFINES 00 000 80/01/18 21.27
  17.  
  18. * TEMPORARY STORAGE DEFINES
  19.  
  20. TBSCHK EQU TCONDEN SUMCHECK OF BINARY
  21. TBLKS EQU TCONBUF NUMBER OF BINARY BLOCKS
  22.  
  23. * DEFINITION OF BINARY DIRECTORY
  24. *
  25. * IF YOU CHANGE THE DIRECTORY DEFINITIONS, BE SURE
  26. * YOU MAKE A CORRESPONDING CHANGE IN TUTOR LESSONS
  27. * (IE., LESSON BINARY).
  28.  
  29. DIRCTRY EQU WORK
  30. EXTRAI EQU DIRCTRY+4 START OF EXTRA INFO
  31. BTIME EQU EXTRAI+1 CREATION TIME OF PLATO
  32. BDATE EQU EXTRAI+2 CREATION DATE OF PLATO
  33. BSUMCHK EQU EXTRAI+3 SUMCHECK OF BINARY
  34. BCDATE EQU EXTRAI+4 CREATION DATE OF BINARY
  35. BJDATE EQU EXTRAI+5 CREATION JULIAN DATE OF BINARY
  36. BSYSCHK EQU EXTRAI+6 SUMCHECK OF SYS VARIABLES
  37. BUSEINF EQU EXTRAI+7 USE FILE INFORMATION
  38. (USEINFL WORDS)
  39. * /--- BLOCK TESTBIN 00 000 80/01/25 21.27
  40. TITLE -TESTBIN- COMMAND
  41. *
  42. *
  43. *
  44. * -TESTBIN- COMMAND
  45. * CHECKS IF THERE IS A BINARY FOR THE INDICATED FILE
  46. *
  47. * RETURNS *ERROR* = 0 OR BINARY FILE NAME
  48. *
  49. *
  50. ENTRY TSTBINX
  51. TSTBINX SX6 3 UNPACK 3 ARGUMENTS
  52. CALL GETARGS
  53. MX7 0 DEFAULT FOR 3RD ARGUMENT
  54. SX6 X6-3 SEE IF 3RD ARG PRESENT
  55. NG X6,TSTBX2 --- IF 3RD ARG ABSENT
  56. *
  57. SA1 VARBUF+2 LOAD 3RD GETVAR CODE
  58. BX5 X1
  59. NGETVAR
  60. BX7 X1
  61. *
  62. TSTBX2 SA7 TBINTSV SAVE FLAG
  63. *
  64. CALL ACCFILE,VARBUF,VARBUF,0 GET FILE NAME
  65. SA1 TBINTSV RETRIEVE N-VERSION FLAG
  66. CALL TESTBIN,VARBUF,X1
  67. SA6 TERROR RETURN IN *TERROR*
  68. ZR X6,PROCESS
  69. BX1 X6 BINARY FILE NAME
  70. CALL FINDFN
  71. PL X7,PROCESS EXIT IF BINARY DOES EXIST
  72. MX6 0
  73. SA6 TERROR MARK NO BINARY FILE
  74. EQ PROCESS
  75. *
  76. *
  77. * /--- BLOCK TESTBIN 00 000 78/01/27 10.18
  78. TITLE TESTBIN CHECK IF BINARY SHOULD EXIST
  79. *
  80. * -TESTBIN-
  81. * CHECK IF THERE SHOULD BE A BINARY FOR THIS LESSON
  82. *
  83. * ON ENTRY - B1 = ADDRESS OF TWO-WORD FILE NAME (ACCOUNT, FILE)
  84. * B2 = 0 IF N-VERSION SUBSTITUTION DESIRED
  85. * -1 IF NOT
  86. *
  87. * ON RETURN - X6 = 0 IF NO BINARY SHOULD EXIST
  88. * = BINARY FILE NAME
  89. *
  90. * BINARY FILE NAME = BPPPPXXXXX
  91. * B = B
  92. * PPPP = FIRST 4 CHARACTERS OF PACKNAME ON WHICH
  93. * THE LESSON SOURCE RESIDES.
  94. * XXXXX= FILE SPACE NUMBER FROM FILE INFO WORD OF
  95. * SOURE FILE, CONVERTED TO DISPLAY CODE.
  96. *
  97. *
  98. * ** NOTE ** THE FIRST 4 CHARACTERS OF EACH SOURCE
  99. * PACK MUST BE A UNIQUE SET OF CHARARCTERS FOR THIS
  100. * PROCESS TO WORK CORRECTLY.
  101. *
  102. * /--- BLOCK TESTBIN 00 000 79/07/23 21.37
  103. *
  104. ENTRY TESTBIN
  105. TESTBIN EQ *
  106. SA1 B1+1 GET FILE NAME
  107. SA2 BINFLAG
  108. NZ X2,TNOBIN
  109. SA2 KS0LANG+1 (MUST BE CONDENSED EACH RELOAD)
  110. BX2 X1-X2 DO NOT CREATE A BINARY FOR
  111. ZR X2,TNOBIN LESSON SYSLIB
  112. NG B2,TSTBN2 CHECK IF NVERSION SUBST DESIRED
  113. SB2 TBNV WHERE TO STORE CONVERTED NAME
  114. CALL NVERSC CHECK/CONVERT FOR N-VERSION
  115. SA1 TBNV+1 (X1) = CONVERTED FILE NAME
  116. TSTBN2 BSS 0
  117. *
  118. * CHECK IF FILE EXISTS AND OBTAIN FILE INFO WORD
  119. *
  120. CALL FINDFN
  121. NG X7,TNOBIN --- EXIT IF NOT FOUND
  122. SA1 FITS+X7
  123. IX0 X1+X6 INDEX TO FILE INFO WORD
  124. RX2 X0 (-RXX- 1 WD READ, MAY CHG *A2*)
  125. *
  126. * * * SAVE TOP 4 CHARACTERS OF PACK NAME ON WHICH
  127. * THE LESSON SOURCE RESIDES.
  128. SA1 X7+PNAMES LOAD PACK NAME
  129. MX0 24
  130. BX6 X0*X1 SAVE TOP 4 CHAR. OF PACKNAME
  131. SA6 ITEMP1 SAVE FOR LATER USE
  132. *
  133. * * * ISOLATE FILE SPACE NUMBER OF SOURCE FILE
  134. MX0 -15
  135. BX6 -X0*X2 EXTRACT FILE SPACE NUMBER
  136. SA6 ITEMP
  137. *
  138. * * * CONVERT FILE SPACE NUMBER TO DISPLAY CODE
  139. CALL TITOA,ITEMP,ITEMP
  140. *
  141. * * * LEFT JUSTIFY CONVERTED FILE SPACE NUMBER
  142. SA1 ITEMP
  143. CALL LJUST,(1R ),0
  144. *
  145. * * * MERGE SPACE NUMBER AND 4 CHARACTERS OF PACKNAME
  146. AX1 30
  147. MX6 30
  148. BX6 -X6*X1 BE SURE TOP 5 CHARS CLEAR
  149. SA1 ITEMP1 GET 4 PACKNAME CHARACTERS
  150. LX1 54
  151. SA2 =1LB
  152. BX2 X1+X2 MERGE B AND PACKNAME CHARS
  153. BX6 X2+X6 MERGE WITH FILE SPACE NUMBER
  154. EQ TESTBIN
  155. *
  156. TNOBIN MX6 0 MARK NO BINARY
  157. EQ TESTBIN
  158.  
  159. TBNV BSS 2 BUFFER FOR N-VERSION NAME
  160. *
  161. *
  162. ENTRY BINFLAG
  163. *
  164. BINFLAG DATA 0
  165. * /--- BLOCK +NVERSC 00 000 78/11/14 14.33
  166. TITLE NVERSC N-VERSION CONVERSION
  167. TITLE NVERSC CHECK FOR N-VERSION SUBSTITUTION
  168. ** NVERSC - N-VERSION SUBSTITUTION CHECKS
  169. *
  170. * CONVERT INPUT FILE NAME TO N-VERSION FILE NAME IF
  171. * 1) THE CURRENT SYSTEM IS A DEVELOPENT SYSTEM
  172. * 2) THE FILE IS FOUND IN THE N-VER SUBST. LIST AND
  173. * 3) SUBSTITUTION IS NOT INHIBITED FOR THE FILE.
  174. *
  175. * EMPLOYS A BINARY CHOP SEARCH IN A SORTED LIST
  176. * WITH MULTIPLE WORD ENTRIES WHICH MAY BE POSITIVE
  177. * OR NEGATIVE (COMPRESSED PLATO FILE NAMES).
  178. *
  179. * SEE LESSON *PSCM* FOR ADDITIONAL INFORMATION.
  180. *
  181. * ENTRY (B1) = ADDR OF 2-WORD FILE NAME (INPUT).
  182. * (B2) = ADDR OF 2-WORD FILE NAME (OUTPUT).
  183. *
  184. * EXIT OUTPUT FILE NAME IN ADDR SPECIFIED BY (B2)
  185. * (SAME AS INPUT FILE IF NO SUBSTITUTION).
  186. *
  187. * USES X - 0, 1, 2, 3, 4, 6, 7.
  188. * A - 0, 1, 2, 3, 6.
  189. * B - 1, 2.
  190. *
  191. * CALLS FSQUISH, FEXPAND.
  192. *
  193. ENTRY NVERSC
  194. NVERSC EQ *
  195. * COPY ORIGINAL NAME TO OUTPUT FOR NO SUBSTITUTION COND.
  196. SA2 B1 (X2) = ACCOUNT NAME
  197. SA1 B1+1 (X1) = FILE NAME
  198. BX6 X2
  199. SA6 B2
  200. BX6 X1
  201. SA6 B2+1
  202.  
  203. SA2 DEVSYS CHECK IF DEVELOPMENT SYSTEM
  204. ZR X2,NVERSC -- NOT DEV SYSTEM, NO SUBST.
  205. SX2 NVERS *NVERS* FLAG
  206. ZR X2,NVERSC -- *NVERS* OFF, NO SUBST.
  207. SX6 B2+0 SAVE RETURN BUFFER ADDRESS
  208. SA6 NVRB
  209. *
  210. CALL FSQUISH (X1) = 1-WORD FILE NAME
  211. SA2 ASCMTAB (X2) = EM ADDR OF N-VERS TABLE
  212. ZR X2,NVERSC -- NO N-VERS TABLE
  213. SX0 SCM.B-1 OFFSET TO LIST LENGTH IN HEADER
  214. IX0 X2+X0 COMPUTE EM ADDR
  215. SX4 SCM.L MAXIMUM LENGTH OF LIST
  216. RX3 X0 (-RXX- 1 WD READ, MAY CHG *A3*)
  217. IX4 X4-X3 COMPARE WITH CURRENT
  218. NG X4,NVERSC -- ERROR IN LIST LENGTH
  219. SB1 1 (B1) = CONSTANT 1
  220. SX6 B1+0 INCR EM ADDR PAST LIST LTH CELL
  221. IX2 X0+X6 (X2) = EM ADDR OF N-VERS LIST
  222. BX6 X2 (X6) = COPY OF X2 INITIALLY
  223. EQ HALF1 -- START SEARCH
  224. *
  225. * /--- BLOCK +NVERSC 00 000 78/11/13 18.41
  226. * BINARY CHOP SEARCH FOR MULTI-WORD ENTRIES
  227. * X1 = TARGET
  228. * X2 = EM ADDR OF SORTED LIST
  229. * X3 = LENGTH OF LIST (IN ENTRIES)
  230. * COULD KEEP LTH IN X4 IF X5 USED FOR COMPARE
  231. *
  232. HALF2 SX4 3 X4 = ENTRY SIZE
  233. IX6 X0+X4 ADVANCE BASE POINTER
  234. SX7 B1 X7 = 1
  235. NG B2,HALF1 CONTINUE SEARCH IF LTH IS ODD
  236. IX3 X3-X7 REDUCE LENGTH BY 1 IF EVEN
  237. *
  238. HALF1 ZR X3,NVERSC -- NO MORE TO SEARCH, NOT FOUND
  239. SX4 3 X4 = ENTRY SIZE
  240. AX7 X3,B1 DIVIDE LENGTH BY 2
  241. IX0 X7*X4 INDEX * ENTRY SIZE
  242. IX0 X6+X0 COMPUTE EM ADDRESS
  243. LX3 17 MOVE ODD/EVEN TO 18TH BIT
  244. RX3 X0 (-RXX- 1 WD READ, MAY CHG *A3*)
  245. SB2 X3 B2 IS NEG IF LTH WAS ODD
  246. IX4 X1-X3 TEST AGAINST TARGET WORD
  247. BX3 X7 X3 = LENGTH REMAINING
  248. NG X4,HALF1 -- JUMP, IN FIRST HALF
  249. NZ X4,HALF2 -- JUMP, IN SECOND HALF
  250. *
  251. * X0 = ECS ADDR OF ENTRY
  252. *
  253. SX2 2
  254. IX0 X0+X2 EM ADDR OF SUBST INFO WORD
  255. MX2 2 MASK INHIBIT-SUBST. BITS
  256. RX3 X0 (-RXX- 1 WD READ, MAY CHG *A3*)
  257. BX2 X2*X3 MASK OFF INHI-BITS
  258. NZ X2,NVERSC -- IF EITHER INHIBIT BIT SET
  259. SX2 B1 (X2) = 1
  260. IX0 X0-X2 EM ADDR OF N-VERS FILE NAME
  261. RX1 X0 (-RXX- 1 WD READ, MAY CHG *A1*)
  262. BX6 X1
  263. SA2 NVRB GET RETURN BUFFER ADDRESS
  264. SA6 X2+B1 STORE FILE NAME IN RETURN BUFF
  265. SB1 X2 (B1) = RETURN BUFFER ADDRESS
  266. CALL FEXPAND CONVERT TO 2-WORD NAME
  267. EQ NVERSC -- EXIT
  268. *
  269. TEMP BSSZ 1 EM READ BUFFER
  270.  
  271. NVRB BSS 1 SAVED RETURN BUFFER ADDRESS
  272. *
  273. *
  274. * /--- BLOCK BINSUM 00 000 85/03/31 09.54
  275. TITLE -BINSUM- SUM-CHECK FOR BINARY
  276. *
  277. *
  278. *
  279. * -BINSUM- FORMS SUM-CHECK OF BINARY
  280. *
  281. * ON ENTRY - B1 = ADDRESS OF ECS ADDRESS OF BINARY
  282. * B2 = ADDRESS OF NUMBER OF BLOCKS
  283. * (WITH NEW FORMAT FLAG IN SIGNBIT)
  284. *
  285. * ON RETURN - X6 = SUM
  286. *
  287. *
  288. BINSUM EQ *
  289. SA1 B1 BEGINNING ADDRESS OF BINARY
  290. BX0 X1
  291. SA1 B2 NUMBER OF BLOCKS TO PROCESS
  292. SB1 X1-1
  293. SX3 BLKLTH INCREMENT TO NEXT BLOCK
  294. RX1 X0 (-RXX- 1 WD READ, MAY CHG *A1*)
  295. SX6 X1 LENGTH OF LESSON
  296. AX1 18
  297. SX1 X1 LENGTH OF *ULOC* TABLE
  298. IX6 X6+X1
  299. SX1 B1 COMPUTE LENGTH OF LAST (PARTIAL) BLOCK
  300. IX1 X1*X3
  301. IX6 X6-X1
  302. SA6 BINSUMA
  303. SA1 66B (X1) = LWA OF TABLES (FL)
  304. SX6 X1
  305. NG B1,BINSUM
  306. *
  307. SA0 INFO
  308. BLP SB1 B1-1 END TEST
  309. NG B1,BINSUM
  310. + RE BLKLTH READ NEXT BLOCK OF BINARY
  311. RJ ECSPRTY
  312. SB2 BLKLTH-1
  313. NZ B1,BLP10 IF NOT LAST BLOCK
  314. SA1 BINSUMA GET PARTIAL BLOCK LENGTH
  315. SB2 X1-1
  316. NG B2,BINSUM IF NOTHING IN LAST BLOCK
  317. *
  318. BLP10 SA2 B2+INFO LOAD NEXT WORD OF BLOCK
  319. SB2 B2-4
  320. IX6 X2+X6 ADD TO SUM
  321. PL B2,BLP10 LOOP THROUGH ENTIRE BLOCK
  322. *
  323. IX0 X0+X3 ADVANCE ECS ADDR TO NEXT BLOCK
  324. EQ BLP PROCESS NEXT BLOCK
  325.  
  326. BINSUMA BSS 1 LENGTH OF LAST (PARTIAL) BLOCK
  327. *
  328. *
  329. * /--- BLOCK LOADBIN 00 000 80/01/18 21.27
  330. TITLE -LOADBIN- LOAD BINARY FROM DISK
  331. *
  332. *
  333. *
  334. * -LOADBIN-
  335. * LOAD BINARY OF LESSON FROM DISK
  336. *
  337. * ON ENTRY -
  338. * IODATA + 0 = BINARY FILE NAME
  339. * DACT IS ASSUMED ALREADY RESERVED
  340. *
  341. * ON RETURN - *NERROR* = 0 IF NO ERROR
  342. * -1 IF BINARY NOT LOADED
  343. *
  344. *
  345. ENTRY LOADBIN
  346. LOADBIN EQ *
  347. CALL BSLICE CHECK FOR END OF TIME-SLICE
  348. *
  349. * LOCATE FILE AND SET DISK UNIT AND FILE INFO WORD
  350. *
  351. SA1 IODATA
  352. CALL FINDFN CHECK IF FILE EXISTS
  353. NG X7,NOGO
  354. SA7 SDISKU SET DISK UNIT NUMBER
  355. SA7 TDISKU
  356. SA1 X7+FITS
  357. IX0 X1+X6 INDEX TO FILE INFO WORD
  358. SA0 SFINF
  359. + RE 1 READ FILE INFO WORD
  360. RJ ECSPRTY
  361. SA1 A0 SAVE FILE INFO WORD
  362. MX0 -6
  363. BX6 X1
  364. AX1 30
  365. SA6 BFINF
  366. BX1 -X0*X1 MASK OFF FILE TYPE CODE
  367. SX0 X1-2
  368. NZ X0,NOGO MUST BE = 2 = BINARY FILE
  369. *
  370. * READ DIRECTORY BLOCK OF BINARY
  371. *
  372. SA1 ADISKEC
  373. BX6 X1 SET ECS ADDRESS FOR DISK READ
  374. SA6 SECS
  375. MX1 0 SET FOR DIRECTORY BLOCK
  376. SX2 1 SET NUMBER OF BLOCKS TO READ
  377. SX3 1 SET TO READ DISK
  378. CALL ODISKIO,SDBATTS READ DIRECTORY BLOCK
  379. SA1 NERROR
  380. NZ X1,BINERR1 EXIT IF DISK ERROR
  381. *
  382. * /--- BLOCK LOADBIN 00 000 80/01/18 21.27
  383. *
  384. * BRING DIRECTORY BLOCK TO CM AND CHECK VALIDITY
  385. *
  386. SA1 ADISKEC ECS ADDRESS OF DIRECTORY
  387. BX0 X1
  388. SA0 DIRCTRY
  389. + RE BLKLTH READ DIRECTORY TO CM
  390. RJ ECSPRTY
  391. SA1 DIRCTRY CHECK THAT FILE NAME CORRECT
  392. SA2 IODATA
  393. BX0 X1-X2
  394. NZ X0,BINERR3 EXIT IF FILE NAME BAD
  395. SA1 DIRCTRY+1
  396. SA2 =10LBINARY B
  397. BX0 X1-X2 CHECK THAT FILE TYPE CORRECT
  398. NZ X0,BINERR3
  399. SA1 BDATE DATE OF PLATO VERSION OF BINARY
  400. SA2 EDDATE DATE OF THIS VERSION OF PLATO
  401. BX1 X1-X2
  402. NZ X1,LBAD EXIT IF WRONG DATE
  403. SA1 BTIME
  404. SA2 EDTIME CHECK TIME ALSO
  405. BX1 X1-X2
  406. NZ X1,LBAD
  407. SA1 SYSCHK CHECK FOR CONFIG FILE CHANGES
  408. SA2 BSYSCHK
  409. BX1 X1-X2 VERIFY NO SYS VARIABLES CHANGED
  410. NZ X1,LBAD IF SYS VARIABLES CHANGED
  411.  
  412. * SAVE USE FILE INFORMATION
  413.  
  414. SA1 ATEMPEC
  415. SA0 BUSEINF
  416. BX0 X1
  417. WE USEINFL
  418. RJ ECSPRTY
  419. SA0 USEINF2
  420. RE USEINFL
  421. RJ ECSPRTY
  422. SA1 BSUMCHK SAVE SUMCHECK / BLOCKS NEEDED
  423. SA2 DIRCTRY+3
  424. BX6 X1
  425. BX7 X2
  426. SA6 TBSCHK
  427. SA7 TBLKS
  428. CALL ACCUSE,A0 ISSUE ACCOUTING MESSAGES
  429. * /--- BLOCK LOADBIN 00 000 80/01/18 21.27
  430.  
  431. * VERIFY USE FILES HAVE NOT BEEN EDITED
  432.  
  433. LBN1 SA1 USEINF2
  434. ZR X1,LBN10 IF NO MORE USE FILES
  435. SX6 X1-1
  436. SA6 A1 UPDATE COUNT OF FILES LEFT
  437. *
  438. * LOCATE USE FILE AND SET DISK INFO WORDS
  439. *
  440. LX6 2 MULTIPLY BY 4
  441. SA1 USEINF2+1+1+X6
  442. CALL FINDFN CHECK IF FILE EXISTS
  443. NG X7,LBAD
  444. SA7 SDISKU SET DISK UNIT NUMBER
  445. SA1 X7+FITS
  446. IX0 X1+X6 INDEX TO FILE INFO WORD
  447. SA0 SFINF
  448. + RE 1 READ FILE INFO WORD
  449. RJ ECSPRTY
  450. *
  451. * READ DIRECTORY BLOCK OF USE FILE
  452. *
  453. SA1 ADISKEC
  454. BX6 X1 SET ECS ADDRESS FOR DISK READ
  455. SA6 SECS
  456. MX1 0 SET FOR DIRECTORY BLOCK
  457. SX2 1 SET NUMBER OF BLOCKS TO READ
  458. SX3 X2 SET TO READ DISK (1)
  459. CALL ODISKIO,SDBATTS READ DIRECTORY BLOCK
  460. SA1 NERROR
  461. NZ X1,BINERR1 EXIT IF DISK ERROR
  462. *
  463. * CHECK LAST EDIT DATE AND TIME OF USE FILE
  464. *
  465. SA1 ADISKEC ECS ADDRESS OF DIRECTORY
  466. BX0 X1
  467. SA0 DIRCTRY
  468. RE BLKLTH READ DIRECTORY BLOCK TO CM
  469. RJ ECSPRTY
  470. *
  471. SX1 DIRCTRY+4 X1 = BIAS TO BASE OF INFO
  472. SA2 X1+O.LDATE X2 = LAST EDIT DATE
  473. SA3 X1+O.LTIME X3 = LAST EDIT TIME
  474. SA1 USEINF2
  475. LX1 2 MULTIPLY BY 4
  476. SA4 USEINF2+1+2+X1 LAST EDIT DATE
  477. BX4 X4-X2
  478. NZ X4,LBAD IF USE FILE EDITED
  479. SA4 USEINF2+1+3+X1 LAST EDIT TIME
  480. BX4 X4-X3
  481. NZ X4,LBAD IF USE FILE EDITED
  482. EQ LBN1 CHECK NEXT USE FILE
  483. * /--- BLOCK LOADBIN 00 000 80/01/18 21.27
  484. *
  485. * READ REST OF BINARY FILE TO ECS
  486. *
  487. LBN10 SA1 TBLKS NUMBER OF BLOCKS USED
  488. PL X1,BINERR3 MUST BE NEW FORMAT FILE
  489. SX2 X1
  490. NG X2,BINERR3 CHECK NUMBER BLOCKS REASONABLE
  491. ZR X2,BINERR3
  492. SX1 X2-BMAXB-1 CHECK IF BINARY TOO LONG
  493. PL X1,BINERR3
  494. SX6 X2 SAVE NUMBER OF BLOCKS
  495. SA6 I1
  496. CALL GECS GET ECS FOR BINARY
  497. NG X6,LBNOEM -- IF NOT ENOUGH EM
  498. NZ X6,NOGO IF LESSON JUST CONDENSED
  499. SA1 TDISKU SET TO BINARY FILE
  500. SA2 BFINF
  501. BX6 X1
  502. BX7 X2
  503. SA6 SDISKU
  504. SA7 SFINF
  505. SA1 ABINBUF
  506. SX6 LPRMLTH
  507. IX6 X1+X6 (X6) = FWA TO LOAD BINARY
  508. SA6 I2
  509. SA6 SECS
  510. SX1 1 SET TO BEGIN READ AT BLOCK 1
  511. SA2 I1 (X2) = NUMBER OF BLOCKS TO READ
  512. SX3 1 SET FOR DISK READ
  513. CALL ODISKIO,SDBATTS BRING IN REST OF BINARY
  514. SA1 NERROR
  515. NZ X1,BINERR1 EXIT IF DISK ERROR
  516. *
  517. * PERFORM SUM-CHECK ON BINARY
  518. *
  519. CALL BINSUM,I2,TBLKS
  520. SA1 TBSCHK
  521. BX0 X1-X6
  522. NZ X0,BINERR2
  523. CALL CBL COMPLETE BINARY LOAD
  524.  
  525. * VERIFY LESSON NAME IN LESSON HEADER
  526.  
  527. SA1 ABINBUF
  528. SX0 LLESNAM
  529. IX0 X1+X0
  530. RX1 X0 READ LESSON NAME
  531. SA2 TBLESSN
  532. BX2 X1-X2
  533. NZ X2,BINERR3
  534. * /--- BLOCK LOADBIN 00 000 80/01/18 21.27
  535. *
  536. LOADOK SA1 BINST3
  537. SX6 X1+1 NUMBER OF BINARIES LOADED
  538. SA6 A1
  539. EQ LOADBIN
  540. *
  541. LBNOEM BSS 0
  542. SA1 OPTION CONDENSE TYPE
  543. SX1 X1-4 CHECK FOR SYSLIB CALL
  544. ZR X1,SLIBERR -- RETURN TO SYSLIB ERR PROC
  545. EQ NOECS -- ELSE, FATAL LESSON ERROR
  546. *
  547. BINERR1 SB1 B1ERR *BINARY READ ERROR*
  548. EQ BINERR
  549. *
  550. BINERR2 BX1 X6 X1 = BAD SUM-CHECK
  551. CALL FSTOTOA
  552. SA6 B2ERR3 STORE 1ST 10 DIGITS
  553. SA7 A6+1 STORE 2ND 10 DIGITS
  554. CALL S=MSG,B2ERR1
  555. SA1 TBLESSN
  556. CALL LJUST,(0),(1R )
  557. BX6 X1 SET LESSON NAME
  558. SA6 B2ERR2
  559. SA1 IODATA
  560. CALL LJUST,(0),(1R )
  561. BX6 X1 SET BINARY FILE NAME
  562. SA6 B2ERR2+1
  563. CALL S=MSG,B2ERR2
  564. SA1 TBSCHK (X1) = ORIGINAL SUMCHECK
  565. CALL FSTOTOA
  566. SA6 B2ERR2 STORE 1ST 10 DIGITS
  567. SA7 A6+1 STORE 2ND 10 DIGITS
  568. CALL S=MSG,B2ERR2
  569. CALL S=MSG,B2ERR3
  570. EQ LBAD
  571. *
  572. BINERR3 SB1 B3ERR *BINARY DIRECTORY BAD*
  573.  
  574. BINERR SA1 TBLESSN SET LESSON NAME IN MESSAGE
  575. BX6 X1
  576. SA6 B1+2
  577. CALL S=MSG,B1
  578. *
  579. LBAD CALL BSLICE CHECK FOR END OF TIME-SLICE
  580. CALL DELBIN,IODATA
  581.  
  582. * RELEASE ECS
  583.  
  584. SA1 ABINBUF CHECK IF ANY BUFFER
  585. ZR X1,NOGO IF NO BUFFER
  586. SA0 LHBUFF CLEAR UP LESSON HEADER
  587. BX0 X1
  588. MX6 0
  589. RE LESHEAD READ THE LESSON HEADER
  590. RJ ECSPRTY
  591. SA6 LHBUFF+LCOMUSE
  592. WE LESHEAD
  593. RJ ECSPRTY
  594. SA6 ABINBUF CLEAR BUFFER ADDRESS
  595. SA1 ILESUN
  596. CALL DELETE DELETE THE LESSON
  597. *
  598. NOGO MX6 -1 MARK BINARY NOT LOADED
  599. SA6 NERROR
  600. EQ LOADBIN
  601. *
  602. BINERR4 SB1 B4ERR *BINARY TRUNCATED*
  603. EQ BINERR
  604. *
  605. *
  606. B1ERR DATA 20HBINARY READ ERROR -
  607. DATA 0,0
  608.  
  609. B2ERR1 DIS ,*BINARY SUMCHECK ERROR*
  610. B2ERR2 BSSZ 3
  611. B2ERR3 BSSZ 3
  612.  
  613. I1 EQU B2ERR2 TEMPORARY
  614. I2 EQU B2ERR2+1
  615. BFINF EQU B2ERR2+2 BINARY FILE INFO WORD
  616. *
  617. B3ERR DATA 20HBINARY DIRECT BAD -
  618. DATA 0,0
  619. *
  620. B4ERR DATA 20HBINARY TRUNCATED --
  621. DATA 0,0
  622.  
  623.  
  624. ENTRY USEINF1,USEINF2
  625. USEINF1 BSS USEINFL USE FILE INFO FROM CONDENSOR
  626. * /--- BLOCK LOADBIN 00 000 80/01/18 21.27
  627. USEINF2 BSS USEINFL USE FILE INFO FROM BINARY
  628.  
  629. * /--- BLOCK GECS 00 000 80/01/18 21.27
  630. GECS SPACE 5,11
  631. *** GECS - GET ECS FOR BINARY LOAD
  632. *
  633. * ENTRY - (X2) - LENGTH OF BINARY IN BLOCKS
  634. *
  635. * EXIT - (X6) - 0 IF ECS ACQUIRED
  636. * 1 IF LESSON JUST CONDENSED
  637. * -1 IF NO ECS AVAILABLE
  638. * (ABINBUF) - ADDRESS OF BUFFER
  639.  
  640.  
  641. GECS1 SX6 1 LESSON JUST CONDENSED
  642.  
  643. GECS PS
  644. SX6 5 INITIALIZE ECS ATTEMPT COUNTER
  645. SA6 GECSA
  646. SX7 BLKLTH COMPUTE AMOUNT OF ECS NEEDED
  647. IX7 X2*X7
  648. SX7 X7+LPRMLTH ACCOUNT FOR LESSON HEADER
  649. SA7 GECSB
  650. *
  651. * CHECK IF LESSON HAS JUST BEEN CONDENSED
  652. *
  653. GECS2 CALL FINDLES,TBLESUN,ILESUN
  654. SA1 ILESUN
  655. PL X1,GECS1 IF LESSON NOW CONDENSED
  656. ZR X6,GECS1 IF NOW CONDENSING
  657. *
  658. * SET UP ECS AREA FOR LESSON
  659. *
  660. INTLOK X,I.SIGN,W INTERLOCK CREATION OF LESSON
  661. SA1 GECSB
  662. BX6 X1 SET UP LESSON LENGTH WORD
  663. SA6 LESINF
  664. CALL GETECS TRY TO GET THE ECS
  665. PL X7,GECS3
  666. SA1 GECSA
  667. SX6 X1-1 CHECK IF SHOULD GIVE UP
  668. NG X6,GECS EXIT IF NO ECS
  669. SA6 A1
  670. INTCLR X,I.SIGN
  671. TUTIM 1000 PAUSE FOR A WHILE
  672. EQ GECS2
  673. *
  674. GECS3 CALL ADDLES,TBLESUN,ILESUN
  675. CALL IOLESSN,ILESUN,2000B
  676. INTCLR X,I.ADDL RELEASE LESNAM INTERLOCK
  677. INTCLR X,I.SIGN
  678. SA1 LESLOC (X1) = ADDRESS OF ECS BUFFER
  679. BX7 X1
  680. BX6 X6-X6 SHOW ECS ACQUIRED
  681. SA7 ABINBUF
  682. EQ GECS EXIT
  683.  
  684. GECSA DATA 0 RE-TRY COUNT TO GET ECS
  685. GECSB DATA 0 LENGTH OF ECS GOTTEN
  686. * /--- BLOCK CBL 00 000 78/12/18 20.48
  687. CBL SPACE 5,11
  688. *** CBL - COMPLETE BINARY LOAD
  689. *
  690. * MOVE BINARY UP TO ACTUAL BEGINNING OF LESSON
  691. * RELEASE UNUSED ECS AT END OF LESSON
  692. * SET UP LESSON HEADER
  693.  
  694.  
  695. CBL PS
  696. INTLOK X,I.SIGN,W INTERLOCK CREATION OF LESSON
  697. INTLOK X,I.ADDL,W
  698. GETX EMAVL
  699. GETX NLESSIN
  700.  
  701. * MOVE LESSON UP TWO WORDS OVER ACTUAL LESSON HEADER
  702.  
  703. SA1 ABINBUF (X1) = TO ADDRESS FOR MOVE
  704. SX2 LPRMLTH
  705. IX2 X1+X2 (X2) = FROM ADDRESS FOR MOVE
  706. BX0 X2
  707. SA0 LHBUFF READ LESSON HEADER
  708. RE LESHEAD
  709. RJ ECSPRTY
  710. SA3 A0
  711. SX4 X3 (X4) = LENGTH OF LESSON
  712. AX3 18
  713. SX3 X3 (X3) = NO. OF UNITS (ULOC LTH)
  714. IX3 X3+X4 (X3) = TOTAL LTH = WDS TO MOVE
  715. BX7 X7-X7 (X7) = NO ECS ERROR RECOVERY
  716. CALL MVECS
  717.  
  718. * SET UP LESSON HEADER
  719.  
  720. SA1 LHBUFF SET LESSON NUMBER
  721. MX6 12
  722. LX6 -12
  723. BX6 -X6*X1 CLEAR LESSON NUMBER FIELD
  724. SA2 ILESUN (X2) = LESSON NUMBER
  725. LX2 2*18
  726. BX6 X2+X6 RESTORE CORRECT LESSON NUMBER
  727. SA6 A1
  728. SA1 LHBUFF+1 SET I/O FLAGS
  729. MX6 12
  730. BX6 -X6*X1 CLEAR ALL I/O FLAGS
  731. MX1 1
  732. LX1 -1
  733. BX6 X1+X6 SET LESSON CONDENSING I/O FLAG
  734. SA6 A1
  735.  
  736. MX6 0
  737. SA6 LHBUFF+LINTLOK CLEAR LESSON INTERLOCK
  738.  
  739. ZERO LHBUFF+LBITTAB,LBITLTH ZERO STATN BIT TBL
  740.  
  741. SA0 LHBUFF
  742. SA1 ABINBUF
  743. BX0 X1
  744. WE LESHEAD WRITE HEADER TO ECS
  745. RJ ECSPRTY
  746.  
  747. * REDUCE LENGTH OF LESSON
  748.  
  749. SA1 ABINBUF SEARCH FOR LESTAB ENTRY
  750. SA2 ALESTAB
  751. SA3 NLESSIN
  752. MX4 -24
  753. BX4 -X4 (X4) = MASK
  754. * /--- BLOCK CBL 00 000 79/12/05 11.54
  755. CALL BINCHOP
  756. PL X7,*+1S17 IF NOT FOUND
  757. SA1 ALESTAB READ LESTAB ENTRY
  758. IX0 X1+X6
  759. RX1 X0 (-RXX- 1 WD READ, MAY CHG *A1*)
  760. BX6 X1
  761. SA6 ITEMP SAVE *LESTAB* ENTRY FOR LATER
  762. SA1 LHBUFF COMPUTE LENGTH OF LESSON
  763. SX7 X1 (X7) = LENGTH OF LESSON
  764. AX1 18
  765. SX1 X1 (X1) = NO. OF UNITS = ULOC LTH
  766. IX7 X1+X7 (X7) = TOTAL LENGTH OF LESSON
  767. SA2 GECSB (X2) = OLD LENGTH OF LESSON
  768. IX2 X2-X7 (X2) = AMOUNT TO REDUCE
  769. SX3 X7-LESHEAD
  770. NG X2,BINERR4 IF NOT REASONABLE
  771. NG X3,*+1S17
  772. SA4 EMAVL (X4) = AVAILABLE ECS
  773. IX6 X4+X2
  774. SA6 A4
  775. SA1 ITEMP (X1) = LESTAB ENTRY
  776. LX2 24 INCREMENT AMOUNT OF FREE SPACE
  777. IX6 X2+X1
  778. WX6 X0 (-WXX- 1 WD WRITE, MAY CHG *A6*)
  779. REPLAX EMAVL
  780. INTCLR X,I.SIGN
  781. INTCLR X,I.ADDL
  782. BX6 X6-X6 CLEAR ORIGINAL ECS LENGTH
  783. SA6 GECSB
  784. EQ CBL EXIT
  785. *
  786. * /--- BLOCK BSLICE 00 000 80/04/22 01.12
  787. *
  788. *
  789. * BSLICE CHECK FOR END OF TIME-SLICE
  790. * CHECK IF TIME-SLICE UP - INTERRUPT IF SO
  791. * ASSUMES RJ TRAIL PROTECTED BY *DACT*
  792. *
  793. BSLICE EQ *
  794. SA1 XSLCLOK GET RUNNING MSEC CLOCK
  795. SA2 MAXCLOK GET END OF TIME-SLICE
  796. IX2 X1-X2
  797. NG X2,BSLICE CHECK IF TIME-SLICE OVER
  798. TUTIM 10 INTERRUPT BRIEFLY
  799. EQ BSLICE
  800. *
  801. * /--- BLOCK MAKEBIN 00 000 79/01/04 23.58
  802. TITLE MAKEBIN CREATE A BINARY FILE
  803. *
  804. * MAKEBIN
  805. *
  806. * CREATES A BINARY FILE AND WRITES OUT LESSON BINARY
  807. *
  808. * ON ENTRY -
  809. * IODATA + 0 = BINARY FILE NAME
  810. * + 1 = ECS ADDRESS OF BINARY
  811. * DACT IS ASSUMED ALREADY RESERVED
  812. *
  813. * ON RETURN -
  814. * NERROR = 1 BINARY ALREADY EXISTS
  815. * 0 BINARY CREATED
  816. * -1 BINARY NOT CREATED
  817. *
  818. *
  819. ENTRY MAKEBIN
  820. MAKEBIN EQ *
  821. CALL BSLICE CHECK FOR END OF TIME-SLICE
  822. *
  823. MB120 SA1 IODATA CHECK IF FILE ALREADY EXISTS
  824. CALL FINDFN
  825. PL X7,ISBIN EXIT IF ALREADY A BINARY
  826. *
  827. * COMPUTE NUMBER OF BLOCKS REQUIRED FOR BINARY
  828. *
  829. SA1 IODATA+1 ECS ADDRESS OF BINARY
  830. BX0 X1
  831. SA0 LHBUFF
  832. + RE LESHEAD READ LESSON HEADER
  833. RJ ECSPRTY
  834. SA1 A0
  835. SB1 X1 COMPUTE TOTAL LENGTH OF BINARY
  836. AX1 18
  837. SX1 X1+B1
  838. SX1 X1-1 LENGTH-1
  839. NG X1,NOBIN EXIT IF NOTHING THERE
  840. PX2 X1
  841. SX3 BLKLTH LENGTH OF A BLOCK
  842. PX3 X3
  843. NX3 X3
  844. FX1 X2/X3 (NUMBER OF BLOCKS - 1) NEEDED
  845. UX1 X1,B1
  846. LX1 X1,B1
  847. SX2 X1-BMAXB CHECK AGAINST MAXIMUM
  848. PL X2,NOBIN EXIT IF TOO MANY NEEDED
  849. SX6 X1+1
  850. SA6 BNBLKS SAVE NUMBER OF BLOCKS NEEDED
  851. * /--- BLOCK MAKEBIN 00 000 76/10/10 13.30
  852. *
  853. * COMPUTE NUMBER OF FILE SPACES REQUIRED
  854. *
  855. PX1 X6 BLOCKS - 1 (DIRECTORY BLOCK NOT COUNTED)
  856. SX2 DSBLKS BLOCKS PER FILE SPACE
  857. PX2 X2
  858. NX2 X2
  859. FX1 X1/X2 (FILE SPACES - 1) NEEDED
  860. UX1 X1,B1
  861. LX1 X1,B1
  862. SX6 X1+1
  863. SA6 BNSPACE SAVE NUMBER OF SPACES NEEDED
  864. *
  865. * FIND DISK FOR BINARY
  866. *
  867. CALL PCHOOSE PICK A PACK TO PUT BINARY ON
  868. NG X6,NOBIN EXIT IF NOWHERE TO PUT IT
  869. SA6 TDISKU SET DISK UNIT NUMBER
  870. SA6 SDISKU
  871. SA1 PNAMES+X6
  872. BX7 X1 SET PACK NAME
  873. SA7 TPNAME
  874. * /--- BLOCK MAKEBIN 00 000 79/01/05 00.55
  875. *
  876. * CREATE DISK FILE FOR BINARY
  877. *
  878. SA1 IODATA
  879. BX6 X1 SET FILE NAME
  880. SA6 OVARG1
  881. SA1 BNSPACE
  882. SX6 200B SET FILE TYPE AND LENGTH
  883. BX6 X1+X6
  884. SA6 OVARG2
  885. INTLOK X,I.DDIR,W INTERLOCK DISK DIRECTORIES
  886. CALL S=UDSKR READ DISK SYSTEM PARAMETERS
  887. EXEC EXEC4,ALLOCOV
  888. CALL S=UDSKW WRITE DISK SYSTEM PARAMETERS
  889. INTCLR X,I.DDIR RELEASE INTERLOCK
  890. SA1 TERROR
  891. PL X1,NOBIN EXIT IF UNABLE TO ALLOCATE
  892. SA1 IODATA LOAD FILE NAME
  893. CALL FINDFN
  894. NG X7,NOBIN EXIT IF NO FILE
  895. SA7 SDISKU RE-SET UNIT NUMBER
  896. SA1 FITS+X7
  897. IX0 X1+X6 INDEX TO FILE INFO WORD
  898. SA0 SFINF
  899. + RE 1 READ FILE INFO WORD
  900. RJ ECSPRTY
  901. SA1 A0
  902. BX6 X1 SET FILE INFO WORD
  903. SA6 TFINFO
  904. TUTIM 10 FORCE END OF TIME-SLICE
  905. CALL PACKWRT CHECKPOINT PACK DIRECTORY
  906. *
  907. * /--- BLOCK MAKEBIN 00 000 78/12/18 20.49
  908. *
  909. * INITIALIZE DIRECTORY BLOCK
  910. *
  911. ZERO DIRCTRY,BLKLTH PRE-ZERO DIRECTORY
  912. SA1 IODATA
  913. BX6 X1
  914. SA6 DIRCTRY SET BINARY FILE NAME
  915. SA1 =10LBINARY B
  916. BX6 X1
  917. SA6 DIRCTRY+1 SET FILE TYPE
  918. SA1 BNSPACE FILE SPACES NEEDED
  919. SX2 DSBLKS BLOCKS PER DISK FILE SPACE
  920. IX6 X1*X2
  921. SA6 DIRCTRY+2 SET TOTAL NUMBER OF BLOCKS
  922. SA1 BNBLKS
  923. MX6 1 FLAG FOR NEW FORMAT FILE
  924. BX6 X1+X6 MERGE WITH BLOCK COUNT
  925. SA6 DIRCTRY+3 SET LAST BLOCK USED
  926. CALL BINSUM,(IODATA+1),BNBLKS
  927. SA6 BSUMCHK SET SUM CHECK
  928. SA1 EDDATE
  929. BX6 X1 SET DATE OF THIS PLATO VERSION
  930. SA6 BDATE
  931. SA1 EDTIME
  932. BX6 X1 SET TIME OF THIS PLATO VERSION
  933. SA6 BTIME
  934. CALL S=TDATE,ITEMP GET DATE BINARY CREATED
  935. SA1 ITEMP+1
  936. BX6 X1 SET DATE
  937. SA6 BCDATE
  938. CALL JULIAN JULIAN DATE BINARY CREATED
  939. SA6 BJDATE
  940. SA1 SYSCHK SAVE CHECKSUM OF SYS VARIABLES
  941. SA2 ATEMPEC SET USE FILE INFORMATION
  942. BX6 X1
  943. BX0 X2
  944. SA6 BSYSCHK
  945. SA0 USEINF1
  946. WE USEINFL
  947. RJ ECSPRTY
  948. SA0 BUSEINF
  949. RE USEINFL
  950. RJ ECSPRTY
  951. *
  952. * INITIALIZE DIRECTORY BLOCK
  953. *
  954. SA4 DIRCTRY+2 BLOCK COUNT
  955. SX5 BLKLTH
  956. LX5 9 POSITION LENGTH OF BLOCK
  957. SA1 =6LBINARY
  958. BX7 X1 SET UP BLOCK NAME
  959. *
  960. MAKB100 SX4 X4-1 END TEST
  961. NG X4,MAKB200
  962. BX6 X4+X5 MERGE BLOCK NUMBER / LENGTH
  963. SA6 X4+DIRCTRY+64 SET BLOCK INFO WORD
  964. SA7 X4+DIRCTRY+192 AND BLOCK NAME
  965. EQ MAKB100
  966. *
  967. MAKB200 SA1 ADISKEC ECS ADDRESS OF DISK BUFFER
  968. BX0 X1
  969. SA0 DIRCTRY
  970. + WE BLKLTH WRITE DIRECTORY TO ECS
  971. RJ ECSPRTY
  972. * /--- BLOCK MAKEBIN 00 000 77/06/22 21.22
  973. *
  974. * WRITE BINARY FILE TO DISK
  975. *
  976. SA1 IODATA+1
  977. BX6 X1 SET ECS ADDRESS OF BINARY
  978. SA6 SECS
  979. SX1 1 STARTING BLOCK NUMBER
  980. SA2 BNBLKS NUMBER OF BLOCKS TO WRITE
  981. SX3 2 2 = DISK WRITE
  982. CALL ODISKIO,SDBATTS WRITE BINARY TO DISK
  983. SA1 NERROR
  984. NZ X1,BFAIL EXIT IF DISK ERROR
  985. *
  986. * WRITE DIRECTORY BLOCK TO DISK
  987. *
  988. SA1 ADISKEC
  989. BX6 X1 SET ECS ADDRESS
  990. SA6 SECS
  991. SX1 0 STARTING BLOCK NUMBER
  992. SX2 1 NUMBER OF BLOCKS TO WRITE
  993. SX3 2 2 = DISK WRITE
  994. CALL ODISKIO,SDBATTS
  995. SA1 NERROR
  996. NZ X1,BFAIL EXIT IF DISK ERROR
  997. SA1 BINST1
  998. SX6 X1+1 NUMBER OF BINARIES CREATED
  999. SA6 A1
  1000. EQ MAKEBIN EXIT
  1001. *
  1002. ISBIN SX6 1 MARK ALREADY A BINARY
  1003. SA6 NERROR
  1004. EQ MAKEBIN ERROR EXIT
  1005. *
  1006. BFAIL CALL DESTROY,IODATA
  1007. NOBIN SX6 -1 MARK BINARY NOT CREATED
  1008. SA6 NERROR
  1009. EQ MAKEBIN ERROR EXIT
  1010. *
  1011. *
  1012. BNBLKS BSS 1 BLOCKS NEEDED FOR BINARY
  1013. BNSPACE BSS 1 FILE SPACES
  1014. *
  1015. * /--- BLOCK DELBIN 00 000 77/10/13 05.49
  1016. TITLE -DELBIN- DESTROY BINARY FILE
  1017. *
  1018. *
  1019. *
  1020. * -DELBIN-
  1021. * DESTROYS INDICATED FILE IF IT IS A LESSON BINARY
  1022. *
  1023. * ON ENTRY - IODATA + 0 = FILE NAME
  1024. *
  1025. * DACT IS ASSUMED ALREADY RESERVED
  1026. *
  1027. *
  1028. ENTRY DELBIN
  1029. DELBIN EQ *
  1030. SA1 IODATA
  1031. CALL FINDFN CHECK IF FILE EXISTS
  1032. NG X7,DELBIN
  1033. SA1 X7+FITS
  1034. IX0 X1+X6 INDEX TO FILE INFO WORD
  1035. SA0 ITEMP
  1036. + RE 1 READ FILE INFO WORD
  1037. RJ ECSPRTY
  1038. MX0 -6
  1039. SA1 A0 LOAD FILE INFO WORD
  1040. AX1 30
  1041. BX1 -X0*X1 MASK OFF FILE TYPE CODE
  1042. SX0 X1-2
  1043. NZ X0,DELBIN MUST BE = 2 = BINARY FILE
  1044. CALL DESTROY,IODATA
  1045. SA1 BINST2
  1046. SX6 X1+1 NUMBER OF BINARIES DESTROYED
  1047. SA6 A1
  1048. EQ DELBIN
  1049. *
  1050. *
  1051. * /--- BLOCK DESTROY 00 000 77/10/18 02.45
  1052. TITLE -DESTROY- DESTROY A FILE
  1053. *
  1054. *
  1055. *
  1056. * -DESTROY-
  1057. * DESTROYS SPECIFIED FILE
  1058. *
  1059. * ON ENTRY - B1 = ADDRESS OF FILE NAME
  1060. *
  1061. * DACT IS ASSUMED ALREADY RESERVED
  1062. *
  1063. *
  1064. DESTROY EQ *
  1065. SA1 B1 LOAD FILE NAME
  1066. BX6 X1
  1067. SA6 OVARG1
  1068. CALL FINDFN CHECK IF FILE EXISTS
  1069. NG X7,DESTROY
  1070. SA7 TDISKU SET DISK UNIT NUMBER
  1071. SA1 X7+FITS
  1072. IX0 X1+X6 INDEX TO FILE INFO WORD
  1073. SA0 TFINFO
  1074. + RE 1 READ FILE INFO WORD
  1075. RJ ECSPRTY
  1076. SA1 X7+PNAMES
  1077. BX6 X1 SET PACK NAME
  1078. SA6 TPNAME
  1079. INTLOK X,I.DDIR,W INTERLOCK DISK DIRECTORIES
  1080. CALL S=UDSKR READ DISK SYSTEM PARAMETERS
  1081. EXEC EXEC4,DEALLOV
  1082. CALL S=UDSKW WRITE DISK SYSTEM PARAMETERS
  1083. INTCLR X,I.DDIR RELEASE INTERLOCK
  1084. SA1 TERROR SEE IF ANY ERROR OCCURRED
  1085. PL X1,DESTROY
  1086. CALL PACKWRT WRITE PACK DIRECTORY TO DISK
  1087. EQ DESTROY
  1088. *
  1089. *
  1090. * /--- BLOCK PACKWRT 00 000 85/11/15 10.19
  1091. TITLE PACKWRT WRITE PACK DIRECTORY TO DISK
  1092. *
  1093. * PACKWRT
  1094. *
  1095. * WRITES PACK DIRECTORY SPECIFIED BY *TDISKU*
  1096. *
  1097. * ON ENTRY - TDISKU = DISK UNIT NUMBER
  1098. *
  1099. * DACT IS ASSUMED ALREADY RESERVED
  1100. *
  1101. * ON RETURN - NERROR = 0 IF ALL OK
  1102. * -1 IF AN ERROR OCCURRED
  1103. *
  1104. *
  1105. ENTRY PACKWRT
  1106. PACKWRT EQ *
  1107. MX6 0 INITIALIZE WRITE RE-TRY FLAG
  1108. SA6 PRETRY
  1109. *
  1110. * CHECK FOR IMPENDING *MASTOR* REQUEST BUFF OVERFLOW
  1111. *
  1112. PWRT1 CALL S=MTST CHECK FOR IMPENDING OVERFLOW
  1113. NG X6,PWRT10
  1114. TUTIM 100 ALLOW MASTOR TO CATCH UP
  1115. EQ PWRT1
  1116. *
  1117. * SET-UP FOR DISK REQUEST
  1118. *
  1119. PWRT10 BSS 0
  1120. SA1 TDISKU (X1) = MASTERFILE NUMBER
  1121. CALL SNMFBLK DETERMINE NUMBER OF DIR BLKS
  1122. BX2 X1 (X2) = NUMBER OF DIR BLKS IN MF
  1123. SA1 TDISKU LOAD DISK UNIT
  1124. SA3 X1+PNAMES
  1125. ZR X3,PERRX EXIT IF PACK NOT ACTIVE
  1126. SA3 PDADDR LOAD DISK ADDRESS OF DIRECTORY
  1127. SA4 PITS+X1 LOAD ECS ADDRESS OF DIRECTORY
  1128. LX4 36 POSITION ECS ADDRESS
  1129. LX1 24 POSITION DISK UNIT
  1130. BX6 X4+X1
  1131. BX6 X6+X3
  1132. SA6 DISKINF STORE DISK INFORMATION WORD
  1133. *
  1134. SX1 4 4 = NEW DISK WRITE I/O CODE
  1135. SX7 BLKLTH WORDS PER DISK BLOCK
  1136. IX7 X2*X7 MULTIPLY BY NUMBER OF BLOCKS
  1137. LX7 12 POSITION WORD COUNT
  1138. BX7 X7+X1
  1139. SA7 IOSW SET DISK I/O REQUEST SWITCH
  1140. *
  1141. * * COLLECT DISK STATISTICS
  1142. *
  1143. CALL DSKSTAT,IOSW,SDPATTS,=0
  1144. * /--- BLOCK PACKWRT 00 000 85/11/15 10.25
  1145. *
  1146. * POST DISK REQUEST TO *MASTOR*
  1147. *
  1148. SA1 DISKINF
  1149. SA2 IOSW
  1150. CALL SAVEDI SAVE INFO IN CASE OF ERROR
  1151. DISKRQ DISKINF,IOSW
  1152. SX7 X6+NPPUERR
  1153. SA7 PIORET SAVE POSSIBLE ERROR CODE
  1154. PL X6,PERRX
  1155. SA1 POSTED INCREMENT REQUESTS PENDING
  1156. SX6 X1+1
  1157. SA6 A1
  1158. *
  1159. PWT TUTIM -1,,IOKEY WAIT FOR KEY
  1160. SA1 KEY
  1161. SX1 X1-IOKEY CHECK IF I/O COMPLETE
  1162. NZ X1,PWT
  1163. SA1 POSTED
  1164. SX6 X1-1 DECREMENT REQUESTS PENDING
  1165. SA6 A1
  1166. SA1 IORET LOAD I/O RETURN CODE
  1167. BX6 X1
  1168. SA6 PIORET SAVE I/O RETURN CODE
  1169. SX6 X1-1
  1170. ZR X6,PUNLOD EXIT IF PACK DISMOUNTED
  1171. PL X6,PERR1 EXIT IF ERROR OCCURRED
  1172. MX6 0
  1173. SA6 NERROR MARK NO ERROR
  1174. EQ PACKWRT
  1175. *
  1176. PERR1 SA1 PRETRY CHECK IF 1ST OR 2ND TRY
  1177. NZ X1,PNOGO
  1178. MX6 -1 MARK SECOND TRY
  1179. SA6 A1
  1180. EQ PWRT1 GO TRY TO WRITE DIRECTORY AGAIN
  1181. *
  1182. * /--- BLOCK PACKWRT 00 000 85/11/15 10.25
  1183. *
  1184. * OUTPUT DAYFILE MESSAGE FOR DISMOUNTED PACK
  1185. *
  1186. PUNLOD SA1 TDISKU GET DISK UNIT NUMBER
  1187. SA2 X1+PTYPES GET PACK TYPE
  1188. SA3 PDTYPES+3 BINARY
  1189. IX3 X2-X3 CHECK IF BINARY PACK
  1190. ZR X3,PUNL10
  1191. SA3 PDTYPES+1 BACKUP
  1192. IX3 X2-X3 CHECK IF BACKUP PACK
  1193. NZ X3,PNOGO
  1194. *
  1195. PUNL10 SA1 X1+PNAMES GET PACK NAME
  1196. BX6 X1
  1197. SA6 PMSG4+2 PLANT PACK NAME
  1198. CALL S=MSG,PMSG4 OUTPUT DAYFILE MESSAGE
  1199. INTLOK X,I.DDIR,W INTERLOCK DISK PARAMETERS
  1200. CALL S=UDSKR READ DISK SYSTEM PARAMETERS
  1201. SA1 TDISKU GET DISK UNIT NUMBER
  1202. MX6 0
  1203. SA6 X1+PNAMES CLEAR PACK NAME
  1204. SA6 X1+PTYPES CLEAR PACK TYPE
  1205. SA6 X1+PCLOKS CLEAR TIME OF LAST ORDER CHANGE
  1206. SA6 X1+PMODELS CLEAR PACK MODEL
  1207. CALL S=UDSKW WRITE DISK SYSTEM PARAMETERS
  1208. INTCLR X,I.DDIR RELEASE INTERLOCK
  1209. *
  1210. PERRX MX6 -1
  1211. SA6 NERROR MARK ERROR OCCURRED
  1212. EQ PACKWRT
  1213. *
  1214. * /--- BLOCK PACKWRT 00 000 85/11/15 10.27
  1215. *
  1216. * OUTPUT DAYFILE MESSAGE FOR ERROR IN PACK DIRECTORY
  1217. *
  1218. PNOGO INTLOK X,I.DDIR,W INTERLOCK DISK PARAMETERS
  1219. CALL S=WAIT,1000 ALLOW FOR DISK ERR DAYFILE MSG
  1220. CALL S=MSG,PMSG1
  1221. CALL S=MSG,PMSG2
  1222. SA1 TDISKU GET DISK UNIT NUMBER
  1223. SA1 X1+PNAMES GET PACK NAME
  1224. CALL LJUST,0,(1R ) SPACE FILL PACK NAME
  1225. BX6 X1
  1226. SA6 PMSG3 STORE PACK NAME
  1227. CALL TITOA,TDISKU,ITEMP
  1228. SA1 ITEMP UNIT NUMBER IN ALPHA FORMAT
  1229. CALL LJUST,0,(1R ) SPACE FILL UNIT NUMBER
  1230. LX1 60-12 POSITION UNIT NUMBER
  1231. MX0 -18
  1232. BX6 X0*X1 CLEAR OUT BOTTOM CHARS
  1233. SA6 PMSG3+1
  1234. CALL S=MSG,PMSG3
  1235. CALL S=MSG,PMSG1
  1236. CALL S=ABORT ABORT PLATO
  1237. *
  1238. *
  1239. PMSG1 DIS 0,*++++++++++++++++++++++++++*
  1240. *
  1241. PMSG2 DIS 0,*MF DIRECTORY ERROR*
  1242. *
  1243. PMSG3 BSS 1
  1244. BSS 1
  1245. *
  1246. PMSG4 DIS 0,*MF TURNED OFF XXXXXXXXXX*
  1247. *
  1248. *
  1249. PRETRY BSS 1
  1250. *
  1251. *
  1252. * /--- BLOCK PCHOOSE 00 000 80/01/12 21.27
  1253. TITLE PCHOOSE CHOOSE PACK TO PUT BINARY ON
  1254. *
  1255. *
  1256. * -PCHOOSE-
  1257. * THIS ROUTINE FINDS THE BINARY PACK WITH THE MOST
  1258. * FREE SPACE
  1259. *
  1260. * ON RETURN - X6 = DISK UNIT NUMBER (-1=NONE)
  1261. *
  1262. *
  1263. PCHOOSE EQ *
  1264. SX3 2 BIAS TO FREE SPACE TOTAL
  1265. SA4 PDTYPES+3 BINARY
  1266. MX7 -1 INITIALIZE MAXIMUM SPACE
  1267. SA0 PTEMP
  1268. SB1 NDSUS NUMBER OF DRIVES TO SEARCH
  1269. *
  1270. PCLP SB1 B1-1 END TEST
  1271. NG B1,PCHK
  1272. SA1 B1+PTYPES PACK TYPE
  1273. BX0 X1-X4 CHECK FOR *BINARY* PACK
  1274. NZ X0,PCLP
  1275. SA2 B1+PITS ECS ADDRESS OF PACK INFO
  1276. IX0 X2+X3 BIAS TO AMOUNT OF FREE SPACE
  1277. + RE 2 READ SPACE/FILE LIMIT WORDS
  1278. RJ ECSPRTY
  1279. SA2 A0
  1280. SX0 X2 PICK OFF NUMBER OF SPACES USED
  1281. AX2 18
  1282. SX2 X2 PICK OFF TOTAL NUMBER OF SPACES
  1283. IX2 X2-X0 X2 = SPACES AVAILABLE
  1284. IX0 X2-X7
  1285. NG X0,PCLP CHECK IF MAXIMUM SO FAR
  1286. SA1 A0+1 CHECK FOR FILE LIMIT
  1287. SX0 X1 (X0) = FILES ON PACK
  1288. AX1 18
  1289. SX1 X1 (X1) = MAXIMUM FILES
  1290. IX0 X0-X1
  1291. PL X0,PCLP IF AT FILE LIMIT
  1292. BX7 X2 SAVE MAX SPACES SO FAR
  1293. SX6 B1 SAVE DISK UNIT NUMBER
  1294. EQ PCLP
  1295. *
  1296. PCHK SX1 X7-25 CHECK AT LEAST 25 SPACES LEFT
  1297. PL X1,PCHOOSE EXIT IF ENOUGH SPACE
  1298. SX1 X7-5
  1299. NG X1,PNO GIVE UP IF NOT 5 SPACES LEFT
  1300. SA6 PTEMP SAVE DISK UNIT
  1301. CALL PROSRCH,LHBUFF+LACCNAM
  1302. SA1 PTEMP RESTORE UNIT NUMBER
  1303. BX6 X1
  1304. LX2 ZBLDSHF
  1305. NG X2,PCHOOSE IF HIGH PRIORITY
  1306. *
  1307. PNO MX6 -1
  1308. EQ PCHOOSE MARK NO SPACE AVAILABLE
  1309. *
  1310. *
  1311. PTEMP BSS 2
  1312. *
  1313. END
plato/source/plaopl/binaryx.txt ยท Last modified: 2023/08/05 18:54 by Site Administrator