User Tools

Site Tools


plato:source:plaopl:ecsmgr

ECSMGR

Table Of Contents

  • [00005] ECSMGR ECS LESSON BUFFER MANAGEMENT
  • [00025] ENTRY
  • [00074] SEARCH FOR ADEQUATE FREE SPACE
  • [00192] DELETE UNUSED LESSONS
  • [00390] COLLECT FREE SPACE
  • [00712] EMSET - SET UP INTERLOCKS / VARIABLES
  • [00726] EMCLR - CLEAR INTERLOCKS / SAVE VARIABLES
  • [00741] -GETECS- OBTAIN ECS FROM LESSON BUFFER
  • [00765] -GETECS1- OBTAIN ECS FROM LESSON BUFFER

Source Code

ECSMGR.txt
  1. ECSMGR
  2. * /--- FILE TYPE = E
  3. * /--- BLOCK ECSMGR 00 000 78/05/03 01.44
  4. IDENT ECSMGR
  5. TITLE ECSMGR ECS LESSON BUFFER MANAGEMENT
  6. *
  7. *
  8. CST
  9. *
  10. EXT LSNADDR
  11. *
  12. *
  13. * PARAMETERS FROM -IPTEXT- VIA -INSTALP-
  14. *
  15. * EMPRM1 MAX SHORT REQUEST SIZE
  16. * EMPRM2 MIN ECS FREE FOR LONG REQUEST
  17. * EMPRM3 *EMAVL* SCAN THRESHOLD
  18. * EMPRM4 NORMAL AMOUNT FREE ECS DESIRED
  19.  
  20.  
  21. LTABPZ EQU WORKLTH+INFOLTH PAGE SIZE FOR LESTAB READ
  22. *
  23. *
  24. * /--- BLOCK ENTRY 00 000 80/04/22 01.38
  25. TITLE ENTRY
  26. *
  27. *
  28. *
  29. * -EMANAG- LESSON BUFFER MANAGER
  30. *
  31. * THIS ROUTINE MAINTAINS FREE SPACE WITHIN THE
  32. * LESSON BUFFER BY DELETING UNUSED LESSONS AND BY
  33. * RE-LOCATING LESSONS TO COMBINE FREE SPACES
  34. *
  35. *
  36. ENTRY EMANAG
  37. EMANAG EQ * ENTRY/EXIT
  38. SA1 XSLCLOK
  39. SA2 EMMODE
  40. BX6 X1 SAVE TIME OF ENTRY
  41. BX7 X2
  42. SA7 EMEMOD SAVE ENTRY MODE
  43. SA6 EMENTIM
  44.  
  45. * DETERMINE THE AMOUNT OF EM TO SEARCH FOR. IF A
  46. * REQUEST IS HANGING, THEN SEARCH FOR EITHER THE
  47. * MAXIMUM STORAGE BUFFER OR 1/8 OF THE LESSON BUFFER
  48. * (WHICHEVER IS LARGER). IF THERE IS NO REQUEST
  49. * HANGING, THEN JUST USE THE CONFIG PARAMETER TO
  50. * DETERMINE HOW MUCH TO SEARCH FOR.
  51.  
  52. SX6 =XEMPRM4 AMOUNT OF FREE ECS REQUIRED
  53. SA1 EMREQ
  54. ZR X1,EMR1 CHECK IF A REQUEST IS HANGING
  55. SA2 ILESBF4
  56. AX2 1 COMPUTE BUFF LENGTH/8
  57. BX6 X2
  58. SX2 100000 MINIMUM REQUEST = MAX STORAGE SIZE
  59. IX7 X6-X2
  60. PL X7,EMR1
  61. BX6 X2
  62. *
  63. EMR1 SA6 ECREQ
  64. SA1 EMMODE
  65. SB1 X1 JUMP BY CURRENT MANAGEMENT MODE
  66. JP B1+*+1
  67. *
  68. + EQ EM1000 SEARCH FOR ADEQUATE FREE SPACE
  69. + EQ EM2000 DELETE UNUSED LESSONS
  70. + EQ EM3000 RE-LOCATE TO COLLECT SPACE
  71. *
  72. *
  73. * /--- BLOCK SCAN 00 000 78/05/14 17.54
  74. TITLE SEARCH FOR ADEQUATE FREE SPACE
  75. *
  76. *
  77. * CHECK IF ENOUGH FREE SPACE LEFT FROM LAST TIME
  78. *
  79. EM1000 CALL EMSET SET UP INTERLOCKS / VARIABLES
  80. SA3 NLESSIN (X3) = ENTRIES IN *LESTAB*
  81. SX1 LESSNS-5 CHECK IF *LESTAB* TABLE FILLING
  82. IX1 X3-X1
  83. PL X1,EM1910
  84. *
  85. SA4 ECREQ X4 = AMOUNT FREE SPACE REQUIRED
  86. SX5 =XEMPRM1 (X5) = SHORT REQUEST SIZE
  87. SA1 APRETAB X1 = ADDR OF PRE-LESTAB TABLE
  88. SA2 EMINDX INDEX TO POSSIBLE FREE SPACE
  89. IX0 X1+X2
  90. RX2 X0 (-RXX- 1 WD READ, MAY CHG *A2*)
  91. MX0 -24
  92. AX2 24
  93. BX2 -X0*X2
  94. IX2 X2-X4
  95. SA0 INFO REQUIRED - *RX2* MAY ZAPPED IT
  96. NG X2,EM1140 JUMP IF NOT ENOUGH FREE SPACE
  97. SA2 EMREQ
  98. NZ X2,EM1300 CHECK IF REQUEST HANGING
  99. SA1 EMAVL
  100. SX2 =XEMPRM3 CHECK REASONABLE AMOUNT FREE
  101. IX2 X1-X2
  102. NG X2,EM1300
  103. EQ EMEXIT
  104. *
  105. * SEARCH *LESTAB* FOR AN ADEQUATE FREE SPACE
  106. *
  107. EM1140 SB3 LTABPZ SIZE OF READ *LESTAB* READ
  108. SB4 -B3 (B4) = INDEX INTO LESTAB
  109. BX0 X1
  110. EM1150 SB2 B0 INDEX INTO THIS PAGE
  111. SB4 B4+B3
  112. RE LTABPZ
  113. RJ =XECSPRTY
  114. MX3 -24 MASK FOR FREE SPACE
  115. SA1 INFO-1 INITIALIZE FOR SEARCH
  116. * /--- BLOCK SCAN 00 000 78/05/14 17.56
  117. *
  118. EM1200 SA1 A1+1 LOAD NEXT *LESTAB* ENTRY
  119. SB2 B2+1 CHECK IF WITHIN PAGE
  120. LE B2,B3,EM1210 IF WITHIN PAGE
  121. SX1 B3 READ NEXT PAGE
  122. IX0 X0+X1
  123. EQ EM1150
  124.  
  125. EM1210 ZR X1,EM1910 IF END OF TABLE
  126. AX1 24
  127. BX1 -X3*X1
  128. IX2 X1-X4 CHECK FOR A BIG HOLE
  129. IX1 X1-X5 CHECK FOR SHORT REQUEST HOLE
  130. PL X2,EM1220 IF A BIG HOLE
  131. NG X1,EM1200 IF NOT A SMALL HOLE
  132. SX6 B2+B4 SAVE INDEX INTO *LESTAB*
  133. SX6 X6-1
  134. SA6 EMPTRS
  135. EQ EM1200 CONTINUE SEARCH
  136.  
  137. EM1220 SX6 B2+B4 COMPUTE INDEX INTO *LESTAB*
  138. SX6 X6-1
  139. SA6 EMINDX
  140. SA6 EMPTRL SET FREE POINTER FOR LONG REQ
  141. *
  142. SA1 EMREQ CHECK IF REQUEST WAS HANGING
  143. ZR X1,EMEXIT
  144. *
  145. EM1300 MX6 0
  146. SA6 EMREQ CLEAR REQUEST HANGING FLAG
  147. SA1 APRETAB
  148. BX0 X1 ECS ADDRESS OF TABLE
  149. SA0 INFO
  150. SB3 LTABPZ PAGE SIZE OF *LESTAB*
  151. BX6 X6-X6 X6 = TOTAL FREE SPACE
  152. MX7 0 X7 = CURRENT ECS ADDRESS
  153. *
  154. EM1306 RE LTABPZ READ *LESTAB* TABLE TO CM
  155. RJ =XECSPRTY
  156. SB2 B0 B2 = INDEX WITHIN PAGE
  157. *
  158. * SCAN TO FIND TOTAL ECS FREE
  159. *
  160. MX3 -24 MASK FOR FREE SPACE
  161. SA1 INFO-1 INITIALIZE FOR SEARCH
  162. *
  163. EM1310 SA1 A1+1 LOAD NEXT *LESTAB* ENTRY
  164. SB2 B2+1 INCREMENT INDEX INTO THIS PAGE
  165. LE B2,B3,EM1314 IF WITHIN PAGE
  166. SX1 B3
  167. IX0 X0+X1
  168. EQ EM1306 READ NEXT PAGE
  169. *
  170. EM1314 ZR X1,EM1320 IF END OF TABLE
  171. BX2 -X3*X1 GET ECS ADDRESS
  172. IX2 X2-X7
  173. NG X2,"CRASH" CHECK IF ADDRESSES IN ORDER
  174. BX7 -X3*X1
  175. AX1 24 POSITION FREE SPACE
  176. BX2 -X3*X1
  177. IX6 X2+X6 INCREMENT FREE SPACE TOTAL
  178. EQ EM1310
  179. *
  180. EM1320 SA6 EMAVL SET FREE SPACE TOTAL
  181. EQ EMEXIT EXIT
  182. *
  183. EM1910 SX6 1
  184. SA6 EMINDX INITIALIZE INDEX
  185. SA6 EMMODE RE-SET MANAGEMENT MODE
  186. CALL EMCLR CLEAR INTERLOCKS
  187. EQ EM2100
  188. *
  189. *
  190. *
  191. * /--- BLOCK DELETE 00 000 80/04/22 01.38
  192. TITLE DELETE UNUSED LESSONS
  193. *
  194. *
  195. * DELETE UNUSED LESSONS TO PROVIDE MORE SPACE
  196. *
  197. EM2000 SA1 EMINDX
  198. SX6 X1-5 BACK-UP INDEX AFTER INTERRUPT
  199. + PL X6,*+1 IN CASE LESSONS WERE DELETED
  200. SX6 1
  201. + SA6 A1
  202. *
  203. EM2100 INTLOK X,I.SIGN,W
  204. CALL EMSET SET INTERLOCKS
  205. EM2110 SA1 XSLCLOK COMPUTE ELASPED TIME
  206. SA2 EMENTIM
  207. IX1 X1-X2
  208. SA2 EMTIME CHECK IF TAKING TOO MUCH TIME
  209. IX1 X1-X2
  210. PL X1,EM2600 IF OUT OF TIME
  211. SA1 APRETAB ADDRESS OF PRE-LESTAB TABLE
  212. BX6 X1
  213. *
  214. SA1 EMINDX LOAD INDEX IN *LESTAB*
  215. SA2 NLESSIN
  216. IX0 X1-X2 CHECK IF INDEX TOO BIG
  217. + NG X0,*+1
  218. SX1 X2-1 RE-SET INDEX
  219. + PL X1,*+1 CHECK IF INDEX TOO SMALL
  220. SX1 1
  221. + NZ X1,*+1 CHECK IF INDEX TOO SMALL
  222. SX1 1
  223. + SX1 X1-1
  224. IX6 X6+X1
  225. MX4 -2*18 MASK FOR USER COUNTS
  226. MX5 -24 MASK FOR ECS ADDRESS
  227. *
  228. * /--- BLOCK DELETE 00 000 81/07/21 03.37
  229. *
  230. * SEARCH FOR UNUSED LESSONS TO DELETE
  231. *
  232. EM2200 SX0 1
  233. IX6 X0+X6 READ NEXT LESTAB ENTRY
  234. RX1 X6 (-RXX- 1 WD READ, MAY CHG *A1*)
  235. ZR X1,EM2500
  236. BX0 -X5*X1 MASK OFF ECS ADDRESS OF LESSON
  237. SA0 LHBUFF RESET BECAUSE OF -RXX-
  238. + RE 2 READ LESSON HEADER
  239. RJ =XECSPRTY
  240. SA1 LHBUFF+1
  241. BX7 -X4*X1 MASK OFF STUDENT COUNTS
  242. NZ X7,EM2200 EXIT IF LESSON IN USE
  243. MX2 12
  244. BX7 X2*X1 MASK I/O AND DELETE BITS
  245. NZ X7,EM2200 EXIT IF CANNOT BE DELETED
  246. SA1 LHBUFF
  247. ZR X1,"CRASH" BAD LESSON NUMBER
  248. BX7 X2*X1 MASK OFF LESSON TYPE CODE
  249. LX7 12
  250. MX2 -12
  251. LX1 24 POSITION LESSON NUMBER
  252. BX1 -X2*X1
  253. ZR X7,EM2210 JUMP IF TUTOR LESSON
  254. SX2 X7-2
  255. ZR X2,EM2215 JUMP IF COMMON
  256. SX2 X7-4
  257. ZR X2,EM2220 JUMP IF CHARSET
  258. SX2 X7-8
  259. ZR X2,EM2220 JUMP IF LINESET
  260. EQ EM2300
  261. *
  262. * SPECIAL CHECKS FOR TUTOR LESSON
  263. *
  264. EM2210 RE LESHEAD READ ENTIRE LESSON HEADER
  265. RJ =XECSPRTY
  266. CALL SYSLES,LHBUFF+LACCNAM
  267. SX3 X3-1 CHECK FOR SPECIAL SYSTEM LESSON
  268. ZR X3,EM2200 DO NOT DELETE SPECIAL LESSON
  269. EQ EM2300
  270. *
  271. * ALLOW DELAY BEFORE DELETING COMMON
  272. *
  273. EM2215 RE COMHEAD READ ENTIRE COMMON HEADER
  274. RJ ECSPRTY
  275. SA2 A0+LCOMTIM
  276. SA3 SYSCLOK CHECK IF TIME TO DELETE COMMON
  277. IX2 X3-X2
  278. PL X2,EM2300 DELETE COMMON IF TIME ELAPSED
  279. EQ EM2200
  280. *
  281. * ALLOW DELAY BEFORE DELETING CHARSETS AND LINESETS
  282. *
  283. EM2220 RE CHRHEAD READ ENTIRE CHARSET HEADER
  284. RJ =XECSPRTY
  285. SA2 A0+LCHRTIM
  286. SA3 SYSCLOK CHECK IF TIME TO DELETE CHARSET
  287. IX2 X3-X2
  288. PL X2,EM2300 DELETE CHARSET IF TIME ELAPSED
  289. EQ EM2200
  290. *
  291. * /--- BLOCK DELETE 00 000 78/05/14 17.58
  292. *
  293. * DELETE UNUSED LESSON
  294. *
  295. EM2300 SA3 APRETAB SAVE INDEX IN *LESTAB*
  296. IX6 X6-X3
  297. SA6 EMINDX
  298. SA3 EMSTAT+8 COUNT NUMBER OF DELETES
  299. SX6 1
  300. IX6 X3+X6
  301. SA6 A3
  302. SA3 A0 COUNT WORDS RECLAIMED
  303. SX6 X3
  304. AX3 18
  305. SX3 X3
  306. IX6 X6+X3
  307. SA3 EMSTAT+9
  308. IX6 X6+X3
  309. SA6 A3
  310.  
  311. * DELETE THE LESSON WITHOUT CLEARING I.ADDL
  312.  
  313. CALL DELLES DELETE LESSON (X1 = LESSON NO)
  314. EQ EM2110
  315.  
  316. EM2500 CALL EMCLR
  317. INTCLR X,I.SIGN
  318. CALL EMSET
  319. *
  320. * SEARCH FOR MAXIMUM FREE SPACE
  321. *
  322. SA1 APRETAB
  323. SA0 INFO
  324. SB3 LTABPZ PAGE SIZE FOR EACH LESTAB READ
  325. SB4 -B3 (B4) = PAGE INDEX INTO LESTAB
  326. BX3 X3-X3
  327. BX6 X6-X6
  328. SX5 =XEMPRM1 (X5) = SHORT REQUEST SIZE
  329. BX0 X1
  330. EM2506 SB2 0 READ NEXT PAGE
  331. MX4 -24
  332. SB4 B4+B3
  333. RE LTABPZ
  334. RJ =XECSPRTY
  335. SA1 A0-1
  336. *
  337. EM2510 SA1 A1+1 LOAD NEXT *LESTAB* ENTRY
  338. SB2 B2+1
  339. LE B2,B3,EM2514 IF WITHIN PAGE
  340. SX1 B3
  341. IX0 X0+X1
  342. EQ EM2506
  343.  
  344. EM2514 ZR X1,EM2520 IF END OF TABLE
  345. AX1 24 POSITION FREE SPACE
  346. BX2 -X4*X1
  347. IX6 X6+X2 ADD TO TOTAL FREE SPACE
  348. IX1 X3-X2
  349. PL X1,EM2516 IF NOT MAXIMUM SO FAR
  350. BX3 X2 RE-SET MAXIMUM FOUND
  351. SB1 B4+B2 SAVE INDEX OF MAXIMUM
  352. EQ EM2510
  353.  
  354. EM2516 IX1 X2-X5
  355. NG X1,EM2510 IF NOT A SMALL HOLE
  356. SX7 B4+B2 SAVE INDEX OF SMALL HOLE
  357. SX7 X7-1
  358. SA7 EMPTRS
  359. EQ EM2510 CONTINUE SEARCH
  360. *
  361. EM2520 SA6 EMFREE SAVE TOTAL AMOUNT OF ECS FREE
  362. SA6 EMAVL
  363. SA4 ECREQ GET SIZE OF FREE SPACE REQUIRED
  364. IX2 X3-X4
  365. NG X2,EM2900 JUMP IF MAXIMUM NOT BIG ENOUGH
  366. SB1 B1-1
  367. SX6 B1 INDEX INTO LESTAB
  368. SA6 EMINDX
  369. SA6 EMPTRL SET LONG FREE POINTER
  370. MX6 0 RE-SET ECS MANAGEMENT MODE
  371. SA6 EMMODE
  372. SA6 EMREQ CLEAR REQUEST HANGING FLAG
  373. EQ EMEXIT EXIT
  374.  
  375. * /--- BLOCK DELETE 00 000 78/05/14 17.58
  376. EM2600 INTCLR X,I.SIGN
  377. EQ EMEXIT
  378. *
  379. EM2900 MX7 0 RE-SET INDEX IN *LESTAB*
  380. SA7 EMINDX
  381. SA1 GECSLIM MINIMUM ECS FREE REQUIRED
  382. IX2 X6-X1
  383. NG X2,EMEXIT EXIT IF NOT ENOUGH ECS
  384. SX6 2
  385. SA6 EMMODE RE-SET ECS MANAGEMENT MODE
  386. SA6 EMKICK FORCE ECS MANAGER TO BE CALLED
  387. EQ EMEXIT
  388. *
  389. * /--- BLOCK COLLECT 00 000 78/11/12 18.42
  390. TITLE COLLECT FREE SPACE
  391. *
  392. *
  393. * SEARCH TO FIND STARTING INDEX FOR MOVE LOOP
  394. *
  395. EM3000 CALL EMSET
  396. SA1 EMINDX BACK-UP IN CASE OF INTERRUPT
  397. SX6 X1-10 IN CASE LESSONS WERE DELETED
  398. + PL X6,*+1
  399. SX6 0
  400. + SA6 A1
  401. SA1 EMAVL CHECK AMOUNT APROX TOTAL FREE
  402. SX2 EMPRM2
  403. LX2 1
  404. IX2 X1-X2
  405. NG X2,EM3910 TRY TO DELETE LESSONS
  406. *
  407. EM3100 SA1 EMINDX INITIALIZE INDEX FOR SEARCH
  408. SA2 NLESSIN
  409. IX0 X1-X2 CHECK IF INDEX TOO BIG
  410. + NG X0,*+1
  411. SX1 X2-1 RE-SET INDEX
  412. + PL X1,*+1
  413. SX1 0 RE-SET INDEX
  414. + SA5 APRETAB
  415. SX4 2000
  416. MX2 -24
  417. IX0 X5+X1
  418. SA0 INFO
  419. SB3 LTABPZ
  420. SB4 X1 INITIALIZE INDEX IN TABLE
  421. SB4 B4-B3
  422. EM3110 RE LTABPZ READ A PAGE OF LESTAB
  423. RJ ECSPRTY
  424. SA1 INFO-1
  425. SB2 B0
  426. SB4 B4+B3
  427.  
  428. EM3120 SA1 A1+1 LOAD NEXT LESTAB ENTRY
  429. SB2 B2+1
  430. LE B2,B3,EM3130 IF WITHIN A PAGE
  431. SX1 B3
  432. IX0 X0+X1
  433. EQ EM3110 READ NEXT PAGE
  434. *
  435. EM3130 ZR X1,EM3910 IF END OF TABLE
  436. AX1 24
  437. IX1 X1-X4
  438. NG X1,EM3120 IF NOT ENOUGH FREE SPACE
  439. SX6 B4+B2
  440. SX6 X6-1 SET INDEX TO START COMPRESSION
  441. SA6 EMINDX
  442. *
  443. * /--- BLOCK COLLECT 00 000 80/04/22 01.38
  444. *
  445. * BEGIN COLLECTION OF FREE SPACE
  446. *
  447. EM3300 SA1 EMINDX LOAD INDEX FOR START OF SEARCH
  448. SA2 APRETAB
  449. IX0 X1+X2 INDEX TO NEXT LESSON
  450. RX1 X0 (-RXX- 1 WD READ, MAY CHG *A1*)
  451. BX6 X1
  452. SA6 OLESTAB INITIALIZE
  453. MX7 -24
  454. ZR X1,EM3910 EXIT IF END OF TABLE
  455. SA6 XLESTAB PRE-SET CURRENT ENTRY WORD
  456. BX0 -X7*X1 ECS ADDRESS OF LESSON
  457. RX2 X0 (-RXX- 1 WD READ, MAY CHG *A2*)
  458. BX6 X2
  459. SA6 XLHEAD SAVE LENGTH
  460. SX3 X2
  461. AX2 18
  462. IX6 X0+X3
  463. SX2 X2
  464. IX6 X6+X2
  465. SA6 RLOCADD INITIALIZE RELOCATION ADDRESS
  466. LX1 -24 POSITION FREE SPACE LENGTH
  467. BX0 -X7*X1
  468. SA1 ECREQ AMOUNT OF ECS REQUESTED
  469. IX1 X0-X1
  470. PL X1,EM3900 EXIT IF FOUND ENOUGH ECS
  471. *
  472. * LOOP TO CONTINUE COLLECTION OF FREE SPACE
  473. *
  474. EM3400 SA1 XSLCLOK COMPUTE ELAPSED TIME
  475. SA2 EMENTIM
  476. IX1 X1-X2
  477. SA2 EMTIME CHECK IF TAKING TOO MUCH TIME
  478. IX1 X1-X2
  479. PL X1,EMEXIT
  480. SA1 EMINDX
  481. SX6 X1+1 ADVANCE INDEX
  482. SA6 A1
  483. SA2 APRETAB
  484. IX0 X6+X2 INDEX TO NEXT LESSON
  485. RX1 X0 (-RXX- 1 WD READ, MAY CHG *A1*)
  486. BX6 X1
  487. SA6 XLESTAB SAVE *LESTAB* ENTRY
  488. ZR X1,EM3910 EXIT IF END OF TABLE
  489. MX7 -24
  490. BX0 -X7*X1 ECS ADDRESS OF LESSON
  491. LX1 -24
  492. BX1 -X7*X1 MASK OFF FREE SPACE LENGTH
  493. SA2 ECREQ AMOUNT OF ECS REQUESTED
  494. IX2 X1-X2
  495. PL X2,EM3900 EXIT IF FOUND ENOUGH ECS
  496. *
  497. * /--- BLOCK COLLECT 00 000 78/05/03 00.05
  498. *
  499. * CHECK IF LESSON CAN BE RELOCATED
  500. *
  501. SA0 XLHEAD
  502. + RE 2 READ FIRST 2 WORDS OF HEADER
  503. RJ =XECSPRTY
  504. SA1 XLHEAD+1 SECOND WORD OF LESSON HEADER
  505. SA2 NORELOC BITS TO SUPPRESS RELOCATION
  506. BX2 X2*X1
  507. NZ X2,EM3300 EXIT IF CANT RELOCATE LESSON
  508.  
  509. * CHECK IF LESSON ALREADY IN DESIRED SPOT
  510.  
  511. SA1 RLOCADD ADDRESS TO MOVE TO
  512. SA3 XLESTAB
  513. BX2 -X7*X3 ADDRESS TO MOVE FROM
  514. SA4 XLHEAD
  515. SX3 X4
  516. AX4 18
  517. SX4 X4
  518. IX3 X3+X4 LENGTH TO MOVE
  519. IX6 X1-X2
  520. ZR X6,EM3450 JUMP IF *FROM* = *TO* = NO MOVE
  521. BX6 X3 SAVE LESSON LENGTH
  522. SA6 TEMP
  523. TSLNK IFNE 0,0
  524.  
  525. * DECKERS ALGORITHM, READ UP LESNAM ENTRY
  526.  
  527. MX0 -12
  528. SA1 XLHEAD 1ST WORD OF LESSON HEADER
  529. LX1 12
  530. BX2 -X0*X1 (X0) = LESSON TYPE
  531. SX2 X2-1 CHECK FOR STORAGE LESSON
  532. NZ X2,EM3430 IF NOT STORAGE OK TO MOVE
  533. LX1 12
  534. BX1 -X0*X1 (X1) = LESSON NUMBER
  535. CALL LSNADDR GET *LESNAM* ECS ADDR
  536. SX1 2
  537. IX0 X0+X1 READ PLATO*S NEED WORD
  538. RX1 X0 READ OLD WORD
  539. MX2 1
  540. BX6 X1+X2 SET FLAG
  541. WX6 X0 RETURN WORD FOR PPU TO READ
  542.  
  543. * IF (NOS NEED FLAG=0) CONTINUE, YOU HAVE THE BUFFER
  544.  
  545. MX1 59 -1
  546. IX0 X0+X1
  547. RX2 X0 FETCH NOS NEED
  548. PL X2,EM3430 NOS NEED =0, YOU HAVE BUFFER
  549.  
  550. * OTHERWISE CLEAR YOUR FLAG AND EXIT.
  551.  
  552. SX2 1 SET BACK TO PLATO NEED
  553. IX0 X0+X2
  554. RX1 X0 READ UP OLD WORD
  555. MX6 1
  556. BX6 -X6*X1 CLEAR PLATO NEED BIT
  557. WX6 X0
  558. SX2 2
  559. IX0 X0-X2 (X0) = ADDR. OF NOS/PLATO TURN
  560. RX1 X0 (X1) = NEG. IF PLATO TURN
  561. PL X1,EM3300 IF ALREADY NOS TURN
  562. MX6 1
  563. BX6 -X6*X1 SET TURN = NOS
  564. WX6 X0 UPDATE NOS/PLATO TURN FLAG
  565. EQ EM3300 EXIT IF CAN NOT MOVE LESSON
  566. TSLNK ENDIF
  567. *
  568. * RELOCATE LESSON TO COLLECT FREE SPACE AND ADJUST
  569. * *LESNAM* AND *LESTAB* TABLES ACCORDINGLY
  570. *
  571. * /--- BLOCK COLLECT 00 000 79/06/27 17.28
  572. TSLNK IFNE 0,0
  573. EM3430 SA1 RLOCADD ADDRESS TO MOVE TO
  574. SA3 TEMP RETRIEVE LENGTH TO MOVE
  575. SA2 XLESTAB
  576. BX2 -X7*X2 ADDRESS TO MOVE FROM
  577. TSLNK ENDIF
  578.  
  579. SA5 EMSTAT+10 COUNT MOVES
  580. SX7 1
  581. IX7 X5+X7
  582. SA7 A5
  583. SA5 A5+1 COUNT WORDS MOVED
  584. IX7 X5+X3
  585. SA7 A5
  586. MX7 -1 MARK NO ECS ERROR RECOVERY
  587. CALL MVECS
  588. *
  589. *
  590. * ADJUST *LESNAM* AND *LESTAB* TABLES
  591. *
  592. MX7 -24
  593. SA1 OLESTAB PREVIOUS *LESTAB* ENTRY
  594. LX1 -24 POSITION FREE SPACE
  595. BX6 X7*X1
  596. LX6 24
  597. SA6 A1 CLEAR OUT FREE SPACE
  598. SA2 EMSTAT+12 COUNT WORDS RECLAIMED
  599. BX6 -X7*X1
  600. IX6 X2+X6
  601. SA6 A2
  602. SA2 EMINDX
  603. SX0 X2-1 INDEX TO PREVIOUS LESSON
  604. SA3 A1 GET *OLESTAB*
  605. SA2 APRETAB
  606. IX0 X0+X2 PREVIOUS *LESTAB* ENTRY
  607. WX3 X0 (-WXX- 1 WD WRITE, MAY CHG *A6*)
  608. BX6 -X7*X1 MASK OFF FREE SPACE LENGTH
  609. SA1 XLESTAB LESSONS *LESTAB* ENTRY
  610. BX1 X7*X1 CLEAR OUT ECS ADDRESS
  611. SA3 TEMP
  612. LX1 -24
  613. IX1 X1+X6 ADD TO FREE SPACE
  614. BX5 -X7*X1 TOTAL NOW FREE
  615. LX1 24 BACK TO ORIGINAL POSITION
  616. SA2 RLOCADD
  617. IX6 X2+X3 UPDATE RELOCATION ADDRESS
  618. SA6 A2
  619. BX6 X1+X2 ATTACH NEW ADDRESS
  620. SA6 XLESTAB
  621. SA6 OLESTAB UPDATE OLD COPY ALSO
  622. SA1 EMINDX INDEX TO THIS LESSON
  623. SA3 APRETAB
  624. IX0 X1+X3 ADDRESS OF *LESTAB* ENTRY
  625. WX6 X0 (-WXX- 1 WD WRITE, MAY CHG *A6*)
  626. * /--- BLOCK COLLECT 00 000 80/11/10 00.29
  627. *
  628. MX0 -12
  629. SA1 XLHEAD 1ST WORD OF LESSON HEADER
  630. LX1 12+12
  631. BX1 -X0*X1 INDEX IN *LESNAM*
  632. BX6 X2 *LSNADDR* WIPES *X2* OUT
  633. CALL LSNADDR
  634. BX2 X6 RESTORE *X2*
  635. SA0 ITEMP
  636. RE 4 READ LESNAM ENTRY
  637. RJ ECSPRTY
  638. SA1 A0+3 (X1) = ECS ADDRESS
  639. BX6 X7*X1
  640. BX6 X6+X2 ATTACH NEW ECS ADDRESS
  641. SA6 A1
  642. TSLNK IFNE 0,0
  643. SA1 A0+3 GET 4TH WORD OF LESNAM ENTRY
  644. LX1 12
  645. MX2 -12
  646. BX1 -X2*X1 (X1) = LESSON TYPE
  647. SX1 X1-1 CHECK FOR STORAGE LESSON
  648. NZ X1,EM3440 IF NOT STORAGE TYPE
  649. SA1 A0+2 GET PLATO NEED WORD (TSLINK)
  650. MX2 1
  651. BX6 -X2*X1
  652. SA6 A1 CLEAR PLATO NEED FLAG
  653. SA1 A0 (X1) = NEG. IF PLATO TURN
  654. BX6 -X2*X1 SET TURN = NOS (POSITIVE)
  655. SA6 A1 UPDATE NOS/PLATO TURN FLAG
  656.  
  657. TSLNK ENDIF
  658. EM3440 WE 4 RE-WRITE LESNAM ENTRY
  659. RJ =XECSPRTY
  660. SA1 ECREQ AMOUNT OF ECS REQUESTED
  661. IX1 X5-X1
  662. PL X1,EM3900 JUMP IF FOUND ENOUGH ECS
  663. EQ EM3400
  664. *
  665. EM3450 IX6 X2+X3 UPDATE RELOCATION ADDRESS
  666. SA6 RLOCADD
  667. SA1 XLESTAB
  668. BX6 X1 UPDATE *OLESTAB*
  669. SA6 OLESTAB
  670. EQ EM3400 CONTINUE LOOP
  671. *
  672. *
  673. EM3900 MX6 0 RE-SET MANAGEMENT MODE
  674. SA6 EMMODE
  675. SA6 EMREQ CLEAR REQUEST HANGING FLAG
  676. EQ EMEXIT EXIT
  677. *
  678. EM3910 SX6 1 RE-SET MANAGEMENT MODE
  679. SA6 EMMODE
  680. MX6 0 RE-SET INDEX IN *LESTAB*
  681. SA6 EMINDX
  682. CALL EMCLR
  683. EQ EM2100 PROCEED TO DELETION LOOP
  684. *
  685. *
  686. ECREQ BSS 1
  687. OLESTAB BSS 1
  688. XLESTAB BSS 1
  689. RLOCADD BSS 1
  690. XLHEAD BSS 2
  691. TEMP BSS 1
  692. NORELOC VFD 12/LRBITS,48/0
  693. EMEMOD DATA 0 ENTRY MODE FOR STATISTICS
  694. *
  695. *
  696. EMEXIT SA1 XSLCLOK COMPUTE TIME SPENT
  697. SA2 EMENTIM
  698. SA3 EMEMOD
  699. SA4 EMSTAT+X3 UPDATE ENTRY COUNT
  700. SA5 EMSTAT+4+X3 UPDATE CPU TIME IN THIS MODE
  701. IX1 X1-X2
  702. IX6 X5+X1
  703. SX7 1
  704. IX7 X4+X7
  705. SA6 A5
  706. SA7 A4
  707. CALL EMCLR CLEAR INTERLOCK / SAVE VARIABLE
  708. EQ EMANAG -- RETURN
  709. *
  710. * /--- BLOCK EMSET 00 000 79/06/27 17.12
  711. EMSET SPACE 5,11
  712. ** EMSET - SET UP INTERLOCKS / VARIABLES
  713.  
  714.  
  715. EMSET PS
  716. INTLOK X,I.ADDL,W
  717. GETX NLESSIN
  718. GETX LCIRC1
  719. GETX EMAVL
  720. GETX EMSTAT,,EMSTATL
  721. GETX EMPTRS
  722. GETX EMPTRL
  723. GETX EMFREE
  724. EQ EMSET EXIT
  725. EMCLR SPACE 5,11
  726. ** EMCLR - CLEAR INTERLOCKS / SAVE VARIABLES
  727.  
  728.  
  729. EMCLR PS
  730. REPLAX NLESSIN
  731. REPLAX LCIRC1
  732. REPLAX EMAVL
  733. REPLAX EMSTAT,,EMSTATL
  734. REPLAX EMPTRS
  735. REPLAX EMPTRL
  736. REPLAX EMFREE
  737. INTCLR X,I.ADDL
  738. EQ EMCLR EXIT
  739. *
  740. * /--- BLOCK GETECS 00 000 79/06/27 17.31
  741. TITLE -GETECS- OBTAIN ECS FROM LESSON BUFFER
  742. *
  743. *
  744. * -GETECS-
  745. * FINDS FREE SPACE FOR ECS STORAGE REQUESTS
  746. *
  747. * ON ENTRY - *LESINF* = AMOUNT OF ECS REQUESTED
  748. *
  749. * ON RETURN - X7 = 0 IF FOUND ENOUGH ECS
  750. * X7 = -1 IF NOT ENOUGH ECS
  751. *
  752. * RETURNS *LESLOC* WITH THE ADDRESS OF THE STORAGE
  753. * AND *LINDEX* WITH THE INDEX IN *LESTAB*
  754. *
  755. *
  756. ENTRY GETECS
  757. GETECS EQ *
  758. INTLOK X,I.ADDL,W GETLES/ADDLES/DELETE INTERLOCK
  759. CALL GETECS1
  760. PL X7,GETECS EXIT IF FOUND THE SPACE
  761. INTCLR X,I.ADDL
  762. EQ GETECS
  763. *
  764. * /--- BLOCK GETECS 00 000 79/06/27 21.49
  765. TITLE -GETECS1- OBTAIN ECS FROM LESSON BUFFER
  766. *
  767. *
  768. *
  769. * -GETECS1-
  770. * ATTEMPTS TO LOCATE SPECIFIED AMOUNT OF FREE ECS
  771. *
  772. * ON ENTRY - *LESINF* = AMOUNT OF ECS REQUESTED
  773. *
  774. * ON RETURN - X7 = *EMGETF* = 0 IF ECS FOUND
  775. * -1 IF ECS COULD NOT BE FOUND
  776. *
  777. * *LINDEX* = INDEX IN *LESTAB* OF FREE SPACE
  778. * *LESLOC* = ECS ADDRESS OF FREE SPACE
  779. *
  780. *
  781. ENTRY GETECS1
  782. GETECS1 EQ * ENTRY/EXIT
  783. GETX NLESSIN GET ECS-RESIDENT VARIABLES
  784. GETX LCIRC1
  785. GETX EMFREE
  786. GETX EMAVL
  787. GETX EMPTRS
  788. GETX EMPTRL
  789. GETX EMSTAT,,EMSTATL
  790. SA1 XSLCLOK
  791. BX6 X1
  792. SA6 GETECA SAVE ENTRY TIME
  793. SA1 NLESSIN NUMBER OF ENTRIES IN *LESTAB*
  794. SB1 X1+2
  795. SX2 LESSNS-3 CHECK FOR *LESTAB* OVERFLOW
  796. IX1 X1-X2
  797. NG X1,GET010 IF *LESTAB* NOT FULL
  798. CALL S=MSG,LTFULL
  799. EQ NOECS
  800.  
  801. LTFULL DIS ,*LESSON TABLE FULL.*
  802.  
  803. GET010 SA1 LESINF AMOUNT(S) OF EM REQUESTED
  804. SX4 X1
  805. AX1 18
  806. IX4 X4+X1 X4 = TOTAL ECS REQUESTED
  807. SX7 500 COUNT GROUP OF REQUESTS BY SIZE
  808. PX5 X4
  809. NX5 X5
  810. PX7 X7
  811. NX7 X7
  812. FX7 X5/X7
  813. UX7 X7,B2
  814. LX7 X7,B2
  815. SX5 X7+14-EMSTATL
  816. + NG X5,*+1 CHECK WITHIN STATS BUFFER LTH
  817. SX7 EMSTATL-1-14 RE-SET TO MAXIMUM
  818. + SA5 EMSTAT+14+X7
  819. SX7 1
  820. IX7 X7+X5
  821. SA7 A5
  822. SX1 =XEMPRM1
  823. IX1 X4-X1
  824. SA5 EMPTRS GET POINTER FOR SHORT REQUESTS
  825. NG X1,GET020 CHECK FOR SHORT REQUEST
  826. SA1 EMAVL
  827. SX2 =XEMPRM2 CHECK MINIMUM AMOUNT FREE
  828. SA5 EMPTRL GET POINTER FOR LONG REQUESTS
  829. IX1 X1-X2
  830. NG X1,NOECS RESERVE MIN AMT FOR SHORT REQS
  831. *
  832. * /--- BLOCK GETECS 00 000 78/05/14 18.51
  833. *
  834. * CHECK IF ADEQUATE FREE SPACE AT *EMPTR*
  835. *
  836. GET020 MX3 -24 X3 = MASK
  837. SX6 X5-5 (X6) = LESTAB POINTER
  838. NG X6,GET070
  839. SA2 APRETAB ADDRESS OF LESTAB TABLE
  840. IX0 X2+X6
  841. SA0 INFO
  842. + RE 10 READ AREA SURROUNDING *EMPTR*
  843. RJ =XECSPRTY
  844. MX7 0
  845. SA7 INFO+10 PLANT ZERO FOR END-TEST
  846. SA1 INFO-1 A1 = READ REGISTER
  847. *
  848. GET040 SA1 A1+1 LOAD NEXT *LESTAB* ENTRY
  849. ZR X1,GET070 JUMP IF END OF TABLE
  850. SX6 X6+1 ADVANCE INDEX
  851. AX1 24
  852. BX1 -X3*X1 MASK OFF FREE SPACE
  853. IX2 X1-X4
  854. NG X2,GET040 CHECK IF SUFFICIENT FREE SPACE
  855. EQ GET120 (A0,A1,X3,X6 SET)
  856. *
  857. * SEARCH *LESTAB* FOR SPECIFIED AMOUNT OF FREE SPACE
  858. *
  859. GET070 SA1 APRETAB ADDRESS OF PRE-LESTAB TABLE
  860. BX0 X1
  861. SA0 INFO
  862. SB3 LTABPZ LENGTH OF EACH READ
  863. SB4 -B3
  864. SA1 EMSTAT+13 COUNT COMPLETE LESTAB SCANS
  865. SX7 1
  866. IX7 X1+X7
  867. SA7 A1
  868. GET075 SB2 B0
  869. SB4 B4+B3
  870. RE LTABPZ
  871. RJ =XECSPRTY
  872. SA1 A0-1 INITIALIZE LOOP
  873. *
  874. * /--- BLOCK GETECS 00 000 80/11/03 10.20
  875. *
  876. GET100 SA1 A1+1 LOAD NEXT *LESTAB* ENTRY
  877. SB2 B2+1
  878. LE B2,B3,GET110 IF WITHIN PAGE
  879. SX1 B3
  880. IX0 X0+X1
  881. EQ GET075 READ NEXT PAGE
  882. *
  883. GET110 ZR X1,NOECS IF END OF TABLE
  884. AX1 24 POSITION FREE SPACE
  885. BX2 -X3*X1
  886. IX2 X2-X4 CHECK IF ENOUGH ROOM
  887. NG X2,GET100
  888. SX6 B4+B2 INDEX INTO LESTAB
  889. *
  890. GET120 SA6 A5 UPDATE FREE POINTER
  891. SX6 X6-2
  892. SA6 LINDEX RETURN INDEX TO FREE SPACE
  893. SA1 A1 RE-LOAD *LESTAB* ENTRY
  894. BX6 -X3*X1 ECS ADDRESS OF LESSON HEADER
  895. RX1 X6 (-RXX- 1 WD READ, MAY CHG *A1*)
  896. SX2 X1
  897. AX1 18
  898. SX1 X1
  899. IX6 X2+X6
  900. IX6 X1+X6 (X6) = ADDRESS OF FREE SPACE
  901. SA6 LESLOC RETURN ADDRESS OF FREE SPACE
  902. REPLAX EMPTRS
  903. REPLAX EMPTRL
  904. MX7 0 X7 = 0 = ECS FOUND
  905. SA7 EMGETF
  906. EQ GET900
  907. *
  908. *
  909. NOECS MX7 -1 X7 = -1 = ECS NOT FOUND
  910. SA7 EMREQ MARK REQUEST UNSATISFIED
  911. SA7 EMGETF
  912. SA7 EMPTRS CLEAR ECS FREE POINTERS
  913. SA7 EMPTRL
  914. REPLAX EMPTRS
  915. REPLAX EMPTRL
  916. SA1 ECSFLOW
  917. SX6 X1+1 INCREMENT ERROR COUNTER
  918. SA6 A1
  919. EQ GET900
  920. *
  921. GETECA DATA 0 TEMPORARY
  922.  
  923. GET900 BSS 0
  924. SA1 XSLCLOK
  925. SA2 GETECA COMPUTE TIME SPENT
  926. SX6 1
  927. SA3 EMSTAT+3
  928. SA4 EMSTAT+4+3
  929. IX6 X3+X6
  930. SA6 A3
  931. IX6 X1-X2
  932. IX6 X4+X6
  933. SA6 A4
  934. REPLAX EMSTAT,,EMSTATL
  935.  
  936. EQ GETECS1 -- RETURN
  937. *
  938. * /--- BLOCK END 00 000 79/06/27 17.26
  939. *
  940. END
plato/source/plaopl/ecsmgr.txt ยท Last modified: 2023/08/05 18:54 by Site Administrator