ECSMGR * /--- FILE TYPE = E * /--- BLOCK ECSMGR 00 000 78/05/03 01.44 IDENT ECSMGR TITLE ECSMGR ECS LESSON BUFFER MANAGEMENT * * CST * EXT LSNADDR * * * PARAMETERS FROM -IPTEXT- VIA -INSTALP- * * EMPRM1 MAX SHORT REQUEST SIZE * EMPRM2 MIN ECS FREE FOR LONG REQUEST * EMPRM3 *EMAVL* SCAN THRESHOLD * EMPRM4 NORMAL AMOUNT FREE ECS DESIRED LTABPZ EQU WORKLTH+INFOLTH PAGE SIZE FOR LESTAB READ * * * /--- BLOCK ENTRY 00 000 80/04/22 01.38 TITLE ENTRY * * * * -EMANAG- LESSON BUFFER MANAGER * * THIS ROUTINE MAINTAINS FREE SPACE WITHIN THE * LESSON BUFFER BY DELETING UNUSED LESSONS AND BY * RE-LOCATING LESSONS TO COMBINE FREE SPACES * * ENTRY EMANAG EMANAG EQ * ENTRY/EXIT SA1 XSLCLOK SA2 EMMODE BX6 X1 SAVE TIME OF ENTRY BX7 X2 SA7 EMEMOD SAVE ENTRY MODE SA6 EMENTIM * DETERMINE THE AMOUNT OF EM TO SEARCH FOR. IF A * REQUEST IS HANGING, THEN SEARCH FOR EITHER THE * MAXIMUM STORAGE BUFFER OR 1/8 OF THE LESSON BUFFER * (WHICHEVER IS LARGER). IF THERE IS NO REQUEST * HANGING, THEN JUST USE THE CONFIG PARAMETER TO * DETERMINE HOW MUCH TO SEARCH FOR. SX6 =XEMPRM4 AMOUNT OF FREE ECS REQUIRED SA1 EMREQ ZR X1,EMR1 CHECK IF A REQUEST IS HANGING SA2 ILESBF4 AX2 1 COMPUTE BUFF LENGTH/8 BX6 X2 SX2 100000 MINIMUM REQUEST = MAX STORAGE SIZE IX7 X6-X2 PL X7,EMR1 BX6 X2 * EMR1 SA6 ECREQ SA1 EMMODE SB1 X1 JUMP BY CURRENT MANAGEMENT MODE JP B1+*+1 * + EQ EM1000 SEARCH FOR ADEQUATE FREE SPACE + EQ EM2000 DELETE UNUSED LESSONS + EQ EM3000 RE-LOCATE TO COLLECT SPACE * * * /--- BLOCK SCAN 00 000 78/05/14 17.54 TITLE SEARCH FOR ADEQUATE FREE SPACE * * * CHECK IF ENOUGH FREE SPACE LEFT FROM LAST TIME * EM1000 CALL EMSET SET UP INTERLOCKS / VARIABLES SA3 NLESSIN (X3) = ENTRIES IN *LESTAB* SX1 LESSNS-5 CHECK IF *LESTAB* TABLE FILLING IX1 X3-X1 PL X1,EM1910 * SA4 ECREQ X4 = AMOUNT FREE SPACE REQUIRED SX5 =XEMPRM1 (X5) = SHORT REQUEST SIZE SA1 APRETAB X1 = ADDR OF PRE-LESTAB TABLE SA2 EMINDX INDEX TO POSSIBLE FREE SPACE IX0 X1+X2 RX2 X0 (-RXX- 1 WD READ, MAY CHG *A2*) MX0 -24 AX2 24 BX2 -X0*X2 IX2 X2-X4 SA0 INFO REQUIRED - *RX2* MAY ZAPPED IT NG X2,EM1140 JUMP IF NOT ENOUGH FREE SPACE SA2 EMREQ NZ X2,EM1300 CHECK IF REQUEST HANGING SA1 EMAVL SX2 =XEMPRM3 CHECK REASONABLE AMOUNT FREE IX2 X1-X2 NG X2,EM1300 EQ EMEXIT * * SEARCH *LESTAB* FOR AN ADEQUATE FREE SPACE * EM1140 SB3 LTABPZ SIZE OF READ *LESTAB* READ SB4 -B3 (B4) = INDEX INTO LESTAB BX0 X1 EM1150 SB2 B0 INDEX INTO THIS PAGE SB4 B4+B3 RE LTABPZ RJ =XECSPRTY MX3 -24 MASK FOR FREE SPACE SA1 INFO-1 INITIALIZE FOR SEARCH * /--- BLOCK SCAN 00 000 78/05/14 17.56 * EM1200 SA1 A1+1 LOAD NEXT *LESTAB* ENTRY SB2 B2+1 CHECK IF WITHIN PAGE LE B2,B3,EM1210 IF WITHIN PAGE SX1 B3 READ NEXT PAGE IX0 X0+X1 EQ EM1150 EM1210 ZR X1,EM1910 IF END OF TABLE AX1 24 BX1 -X3*X1 IX2 X1-X4 CHECK FOR A BIG HOLE IX1 X1-X5 CHECK FOR SHORT REQUEST HOLE PL X2,EM1220 IF A BIG HOLE NG X1,EM1200 IF NOT A SMALL HOLE SX6 B2+B4 SAVE INDEX INTO *LESTAB* SX6 X6-1 SA6 EMPTRS EQ EM1200 CONTINUE SEARCH EM1220 SX6 B2+B4 COMPUTE INDEX INTO *LESTAB* SX6 X6-1 SA6 EMINDX SA6 EMPTRL SET FREE POINTER FOR LONG REQ * SA1 EMREQ CHECK IF REQUEST WAS HANGING ZR X1,EMEXIT * EM1300 MX6 0 SA6 EMREQ CLEAR REQUEST HANGING FLAG SA1 APRETAB BX0 X1 ECS ADDRESS OF TABLE SA0 INFO SB3 LTABPZ PAGE SIZE OF *LESTAB* BX6 X6-X6 X6 = TOTAL FREE SPACE MX7 0 X7 = CURRENT ECS ADDRESS * EM1306 RE LTABPZ READ *LESTAB* TABLE TO CM RJ =XECSPRTY SB2 B0 B2 = INDEX WITHIN PAGE * * SCAN TO FIND TOTAL ECS FREE * MX3 -24 MASK FOR FREE SPACE SA1 INFO-1 INITIALIZE FOR SEARCH * EM1310 SA1 A1+1 LOAD NEXT *LESTAB* ENTRY SB2 B2+1 INCREMENT INDEX INTO THIS PAGE LE B2,B3,EM1314 IF WITHIN PAGE SX1 B3 IX0 X0+X1 EQ EM1306 READ NEXT PAGE * EM1314 ZR X1,EM1320 IF END OF TABLE BX2 -X3*X1 GET ECS ADDRESS IX2 X2-X7 NG X2,"CRASH" CHECK IF ADDRESSES IN ORDER BX7 -X3*X1 AX1 24 POSITION FREE SPACE BX2 -X3*X1 IX6 X2+X6 INCREMENT FREE SPACE TOTAL EQ EM1310 * EM1320 SA6 EMAVL SET FREE SPACE TOTAL EQ EMEXIT EXIT * EM1910 SX6 1 SA6 EMINDX INITIALIZE INDEX SA6 EMMODE RE-SET MANAGEMENT MODE CALL EMCLR CLEAR INTERLOCKS EQ EM2100 * * * * /--- BLOCK DELETE 00 000 80/04/22 01.38 TITLE DELETE UNUSED LESSONS * * * DELETE UNUSED LESSONS TO PROVIDE MORE SPACE * EM2000 SA1 EMINDX SX6 X1-5 BACK-UP INDEX AFTER INTERRUPT + PL X6,*+1 IN CASE LESSONS WERE DELETED SX6 1 + SA6 A1 * EM2100 INTLOK X,I.SIGN,W CALL EMSET SET INTERLOCKS EM2110 SA1 XSLCLOK COMPUTE ELASPED TIME SA2 EMENTIM IX1 X1-X2 SA2 EMTIME CHECK IF TAKING TOO MUCH TIME IX1 X1-X2 PL X1,EM2600 IF OUT OF TIME SA1 APRETAB ADDRESS OF PRE-LESTAB TABLE BX6 X1 * SA1 EMINDX LOAD INDEX IN *LESTAB* SA2 NLESSIN IX0 X1-X2 CHECK IF INDEX TOO BIG + NG X0,*+1 SX1 X2-1 RE-SET INDEX + PL X1,*+1 CHECK IF INDEX TOO SMALL SX1 1 + NZ X1,*+1 CHECK IF INDEX TOO SMALL SX1 1 + SX1 X1-1 IX6 X6+X1 MX4 -2*18 MASK FOR USER COUNTS MX5 -24 MASK FOR ECS ADDRESS * * /--- BLOCK DELETE 00 000 81/07/21 03.37 * * SEARCH FOR UNUSED LESSONS TO DELETE * EM2200 SX0 1 IX6 X0+X6 READ NEXT LESTAB ENTRY RX1 X6 (-RXX- 1 WD READ, MAY CHG *A1*) ZR X1,EM2500 BX0 -X5*X1 MASK OFF ECS ADDRESS OF LESSON SA0 LHBUFF RESET BECAUSE OF -RXX- + RE 2 READ LESSON HEADER RJ =XECSPRTY SA1 LHBUFF+1 BX7 -X4*X1 MASK OFF STUDENT COUNTS NZ X7,EM2200 EXIT IF LESSON IN USE MX2 12 BX7 X2*X1 MASK I/O AND DELETE BITS NZ X7,EM2200 EXIT IF CANNOT BE DELETED SA1 LHBUFF ZR X1,"CRASH" BAD LESSON NUMBER BX7 X2*X1 MASK OFF LESSON TYPE CODE LX7 12 MX2 -12 LX1 24 POSITION LESSON NUMBER BX1 -X2*X1 ZR X7,EM2210 JUMP IF TUTOR LESSON SX2 X7-2 ZR X2,EM2215 JUMP IF COMMON SX2 X7-4 ZR X2,EM2220 JUMP IF CHARSET SX2 X7-8 ZR X2,EM2220 JUMP IF LINESET EQ EM2300 * * SPECIAL CHECKS FOR TUTOR LESSON * EM2210 RE LESHEAD READ ENTIRE LESSON HEADER RJ =XECSPRTY CALL SYSLES,LHBUFF+LACCNAM SX3 X3-1 CHECK FOR SPECIAL SYSTEM LESSON ZR X3,EM2200 DO NOT DELETE SPECIAL LESSON EQ EM2300 * * ALLOW DELAY BEFORE DELETING COMMON * EM2215 RE COMHEAD READ ENTIRE COMMON HEADER RJ ECSPRTY SA2 A0+LCOMTIM SA3 SYSCLOK CHECK IF TIME TO DELETE COMMON IX2 X3-X2 PL X2,EM2300 DELETE COMMON IF TIME ELAPSED EQ EM2200 * * ALLOW DELAY BEFORE DELETING CHARSETS AND LINESETS * EM2220 RE CHRHEAD READ ENTIRE CHARSET HEADER RJ =XECSPRTY SA2 A0+LCHRTIM SA3 SYSCLOK CHECK IF TIME TO DELETE CHARSET IX2 X3-X2 PL X2,EM2300 DELETE CHARSET IF TIME ELAPSED EQ EM2200 * * /--- BLOCK DELETE 00 000 78/05/14 17.58 * * DELETE UNUSED LESSON * EM2300 SA3 APRETAB SAVE INDEX IN *LESTAB* IX6 X6-X3 SA6 EMINDX SA3 EMSTAT+8 COUNT NUMBER OF DELETES SX6 1 IX6 X3+X6 SA6 A3 SA3 A0 COUNT WORDS RECLAIMED SX6 X3 AX3 18 SX3 X3 IX6 X6+X3 SA3 EMSTAT+9 IX6 X6+X3 SA6 A3 * DELETE THE LESSON WITHOUT CLEARING I.ADDL CALL DELLES DELETE LESSON (X1 = LESSON NO) EQ EM2110 EM2500 CALL EMCLR INTCLR X,I.SIGN CALL EMSET * * SEARCH FOR MAXIMUM FREE SPACE * SA1 APRETAB SA0 INFO SB3 LTABPZ PAGE SIZE FOR EACH LESTAB READ SB4 -B3 (B4) = PAGE INDEX INTO LESTAB BX3 X3-X3 BX6 X6-X6 SX5 =XEMPRM1 (X5) = SHORT REQUEST SIZE BX0 X1 EM2506 SB2 0 READ NEXT PAGE MX4 -24 SB4 B4+B3 RE LTABPZ RJ =XECSPRTY SA1 A0-1 * EM2510 SA1 A1+1 LOAD NEXT *LESTAB* ENTRY SB2 B2+1 LE B2,B3,EM2514 IF WITHIN PAGE SX1 B3 IX0 X0+X1 EQ EM2506 EM2514 ZR X1,EM2520 IF END OF TABLE AX1 24 POSITION FREE SPACE BX2 -X4*X1 IX6 X6+X2 ADD TO TOTAL FREE SPACE IX1 X3-X2 PL X1,EM2516 IF NOT MAXIMUM SO FAR BX3 X2 RE-SET MAXIMUM FOUND SB1 B4+B2 SAVE INDEX OF MAXIMUM EQ EM2510 EM2516 IX1 X2-X5 NG X1,EM2510 IF NOT A SMALL HOLE SX7 B4+B2 SAVE INDEX OF SMALL HOLE SX7 X7-1 SA7 EMPTRS EQ EM2510 CONTINUE SEARCH * EM2520 SA6 EMFREE SAVE TOTAL AMOUNT OF ECS FREE SA6 EMAVL SA4 ECREQ GET SIZE OF FREE SPACE REQUIRED IX2 X3-X4 NG X2,EM2900 JUMP IF MAXIMUM NOT BIG ENOUGH SB1 B1-1 SX6 B1 INDEX INTO LESTAB SA6 EMINDX SA6 EMPTRL SET LONG FREE POINTER MX6 0 RE-SET ECS MANAGEMENT MODE SA6 EMMODE SA6 EMREQ CLEAR REQUEST HANGING FLAG EQ EMEXIT EXIT * /--- BLOCK DELETE 00 000 78/05/14 17.58 EM2600 INTCLR X,I.SIGN EQ EMEXIT * EM2900 MX7 0 RE-SET INDEX IN *LESTAB* SA7 EMINDX SA1 GECSLIM MINIMUM ECS FREE REQUIRED IX2 X6-X1 NG X2,EMEXIT EXIT IF NOT ENOUGH ECS SX6 2 SA6 EMMODE RE-SET ECS MANAGEMENT MODE SA6 EMKICK FORCE ECS MANAGER TO BE CALLED EQ EMEXIT * * /--- BLOCK COLLECT 00 000 78/11/12 18.42 TITLE COLLECT FREE SPACE * * * SEARCH TO FIND STARTING INDEX FOR MOVE LOOP * EM3000 CALL EMSET SA1 EMINDX BACK-UP IN CASE OF INTERRUPT SX6 X1-10 IN CASE LESSONS WERE DELETED + PL X6,*+1 SX6 0 + SA6 A1 SA1 EMAVL CHECK AMOUNT APROX TOTAL FREE SX2 EMPRM2 LX2 1 IX2 X1-X2 NG X2,EM3910 TRY TO DELETE LESSONS * EM3100 SA1 EMINDX INITIALIZE INDEX FOR SEARCH SA2 NLESSIN IX0 X1-X2 CHECK IF INDEX TOO BIG + NG X0,*+1 SX1 X2-1 RE-SET INDEX + PL X1,*+1 SX1 0 RE-SET INDEX + SA5 APRETAB SX4 2000 MX2 -24 IX0 X5+X1 SA0 INFO SB3 LTABPZ SB4 X1 INITIALIZE INDEX IN TABLE SB4 B4-B3 EM3110 RE LTABPZ READ A PAGE OF LESTAB RJ ECSPRTY SA1 INFO-1 SB2 B0 SB4 B4+B3 EM3120 SA1 A1+1 LOAD NEXT LESTAB ENTRY SB2 B2+1 LE B2,B3,EM3130 IF WITHIN A PAGE SX1 B3 IX0 X0+X1 EQ EM3110 READ NEXT PAGE * EM3130 ZR X1,EM3910 IF END OF TABLE AX1 24 IX1 X1-X4 NG X1,EM3120 IF NOT ENOUGH FREE SPACE SX6 B4+B2 SX6 X6-1 SET INDEX TO START COMPRESSION SA6 EMINDX * * /--- BLOCK COLLECT 00 000 80/04/22 01.38 * * BEGIN COLLECTION OF FREE SPACE * EM3300 SA1 EMINDX LOAD INDEX FOR START OF SEARCH SA2 APRETAB IX0 X1+X2 INDEX TO NEXT LESSON RX1 X0 (-RXX- 1 WD READ, MAY CHG *A1*) BX6 X1 SA6 OLESTAB INITIALIZE MX7 -24 ZR X1,EM3910 EXIT IF END OF TABLE SA6 XLESTAB PRE-SET CURRENT ENTRY WORD BX0 -X7*X1 ECS ADDRESS OF LESSON RX2 X0 (-RXX- 1 WD READ, MAY CHG *A2*) BX6 X2 SA6 XLHEAD SAVE LENGTH SX3 X2 AX2 18 IX6 X0+X3 SX2 X2 IX6 X6+X2 SA6 RLOCADD INITIALIZE RELOCATION ADDRESS LX1 -24 POSITION FREE SPACE LENGTH BX0 -X7*X1 SA1 ECREQ AMOUNT OF ECS REQUESTED IX1 X0-X1 PL X1,EM3900 EXIT IF FOUND ENOUGH ECS * * LOOP TO CONTINUE COLLECTION OF FREE SPACE * EM3400 SA1 XSLCLOK COMPUTE ELAPSED TIME SA2 EMENTIM IX1 X1-X2 SA2 EMTIME CHECK IF TAKING TOO MUCH TIME IX1 X1-X2 PL X1,EMEXIT SA1 EMINDX SX6 X1+1 ADVANCE INDEX SA6 A1 SA2 APRETAB IX0 X6+X2 INDEX TO NEXT LESSON RX1 X0 (-RXX- 1 WD READ, MAY CHG *A1*) BX6 X1 SA6 XLESTAB SAVE *LESTAB* ENTRY ZR X1,EM3910 EXIT IF END OF TABLE MX7 -24 BX0 -X7*X1 ECS ADDRESS OF LESSON LX1 -24 BX1 -X7*X1 MASK OFF FREE SPACE LENGTH SA2 ECREQ AMOUNT OF ECS REQUESTED IX2 X1-X2 PL X2,EM3900 EXIT IF FOUND ENOUGH ECS * * /--- BLOCK COLLECT 00 000 78/05/03 00.05 * * CHECK IF LESSON CAN BE RELOCATED * SA0 XLHEAD + RE 2 READ FIRST 2 WORDS OF HEADER RJ =XECSPRTY SA1 XLHEAD+1 SECOND WORD OF LESSON HEADER SA2 NORELOC BITS TO SUPPRESS RELOCATION BX2 X2*X1 NZ X2,EM3300 EXIT IF CANT RELOCATE LESSON * CHECK IF LESSON ALREADY IN DESIRED SPOT SA1 RLOCADD ADDRESS TO MOVE TO SA3 XLESTAB BX2 -X7*X3 ADDRESS TO MOVE FROM SA4 XLHEAD SX3 X4 AX4 18 SX4 X4 IX3 X3+X4 LENGTH TO MOVE IX6 X1-X2 ZR X6,EM3450 JUMP IF *FROM* = *TO* = NO MOVE BX6 X3 SAVE LESSON LENGTH SA6 TEMP TSLNK IFNE 0,0 * DECKERS ALGORITHM, READ UP LESNAM ENTRY MX0 -12 SA1 XLHEAD 1ST WORD OF LESSON HEADER LX1 12 BX2 -X0*X1 (X0) = LESSON TYPE SX2 X2-1 CHECK FOR STORAGE LESSON NZ X2,EM3430 IF NOT STORAGE OK TO MOVE LX1 12 BX1 -X0*X1 (X1) = LESSON NUMBER CALL LSNADDR GET *LESNAM* ECS ADDR SX1 2 IX0 X0+X1 READ PLATO*S NEED WORD RX1 X0 READ OLD WORD MX2 1 BX6 X1+X2 SET FLAG WX6 X0 RETURN WORD FOR PPU TO READ * IF (NOS NEED FLAG=0) CONTINUE, YOU HAVE THE BUFFER MX1 59 -1 IX0 X0+X1 RX2 X0 FETCH NOS NEED PL X2,EM3430 NOS NEED =0, YOU HAVE BUFFER * OTHERWISE CLEAR YOUR FLAG AND EXIT. SX2 1 SET BACK TO PLATO NEED IX0 X0+X2 RX1 X0 READ UP OLD WORD MX6 1 BX6 -X6*X1 CLEAR PLATO NEED BIT WX6 X0 SX2 2 IX0 X0-X2 (X0) = ADDR. OF NOS/PLATO TURN RX1 X0 (X1) = NEG. IF PLATO TURN PL X1,EM3300 IF ALREADY NOS TURN MX6 1 BX6 -X6*X1 SET TURN = NOS WX6 X0 UPDATE NOS/PLATO TURN FLAG EQ EM3300 EXIT IF CAN NOT MOVE LESSON TSLNK ENDIF * * RELOCATE LESSON TO COLLECT FREE SPACE AND ADJUST * *LESNAM* AND *LESTAB* TABLES ACCORDINGLY * * /--- BLOCK COLLECT 00 000 79/06/27 17.28 TSLNK IFNE 0,0 EM3430 SA1 RLOCADD ADDRESS TO MOVE TO SA3 TEMP RETRIEVE LENGTH TO MOVE SA2 XLESTAB BX2 -X7*X2 ADDRESS TO MOVE FROM TSLNK ENDIF SA5 EMSTAT+10 COUNT MOVES SX7 1 IX7 X5+X7 SA7 A5 SA5 A5+1 COUNT WORDS MOVED IX7 X5+X3 SA7 A5 MX7 -1 MARK NO ECS ERROR RECOVERY CALL MVECS * * * ADJUST *LESNAM* AND *LESTAB* TABLES * MX7 -24 SA1 OLESTAB PREVIOUS *LESTAB* ENTRY LX1 -24 POSITION FREE SPACE BX6 X7*X1 LX6 24 SA6 A1 CLEAR OUT FREE SPACE SA2 EMSTAT+12 COUNT WORDS RECLAIMED BX6 -X7*X1 IX6 X2+X6 SA6 A2 SA2 EMINDX SX0 X2-1 INDEX TO PREVIOUS LESSON SA3 A1 GET *OLESTAB* SA2 APRETAB IX0 X0+X2 PREVIOUS *LESTAB* ENTRY WX3 X0 (-WXX- 1 WD WRITE, MAY CHG *A6*) BX6 -X7*X1 MASK OFF FREE SPACE LENGTH SA1 XLESTAB LESSONS *LESTAB* ENTRY BX1 X7*X1 CLEAR OUT ECS ADDRESS SA3 TEMP LX1 -24 IX1 X1+X6 ADD TO FREE SPACE BX5 -X7*X1 TOTAL NOW FREE LX1 24 BACK TO ORIGINAL POSITION SA2 RLOCADD IX6 X2+X3 UPDATE RELOCATION ADDRESS SA6 A2 BX6 X1+X2 ATTACH NEW ADDRESS SA6 XLESTAB SA6 OLESTAB UPDATE OLD COPY ALSO SA1 EMINDX INDEX TO THIS LESSON SA3 APRETAB IX0 X1+X3 ADDRESS OF *LESTAB* ENTRY WX6 X0 (-WXX- 1 WD WRITE, MAY CHG *A6*) * /--- BLOCK COLLECT 00 000 80/11/10 00.29 * MX0 -12 SA1 XLHEAD 1ST WORD OF LESSON HEADER LX1 12+12 BX1 -X0*X1 INDEX IN *LESNAM* BX6 X2 *LSNADDR* WIPES *X2* OUT CALL LSNADDR BX2 X6 RESTORE *X2* SA0 ITEMP RE 4 READ LESNAM ENTRY RJ ECSPRTY SA1 A0+3 (X1) = ECS ADDRESS BX6 X7*X1 BX6 X6+X2 ATTACH NEW ECS ADDRESS SA6 A1 TSLNK IFNE 0,0 SA1 A0+3 GET 4TH WORD OF LESNAM ENTRY LX1 12 MX2 -12 BX1 -X2*X1 (X1) = LESSON TYPE SX1 X1-1 CHECK FOR STORAGE LESSON NZ X1,EM3440 IF NOT STORAGE TYPE SA1 A0+2 GET PLATO NEED WORD (TSLINK) MX2 1 BX6 -X2*X1 SA6 A1 CLEAR PLATO NEED FLAG SA1 A0 (X1) = NEG. IF PLATO TURN BX6 -X2*X1 SET TURN = NOS (POSITIVE) SA6 A1 UPDATE NOS/PLATO TURN FLAG TSLNK ENDIF EM3440 WE 4 RE-WRITE LESNAM ENTRY RJ =XECSPRTY SA1 ECREQ AMOUNT OF ECS REQUESTED IX1 X5-X1 PL X1,EM3900 JUMP IF FOUND ENOUGH ECS EQ EM3400 * EM3450 IX6 X2+X3 UPDATE RELOCATION ADDRESS SA6 RLOCADD SA1 XLESTAB BX6 X1 UPDATE *OLESTAB* SA6 OLESTAB EQ EM3400 CONTINUE LOOP * * EM3900 MX6 0 RE-SET MANAGEMENT MODE SA6 EMMODE SA6 EMREQ CLEAR REQUEST HANGING FLAG EQ EMEXIT EXIT * EM3910 SX6 1 RE-SET MANAGEMENT MODE SA6 EMMODE MX6 0 RE-SET INDEX IN *LESTAB* SA6 EMINDX CALL EMCLR EQ EM2100 PROCEED TO DELETION LOOP * * ECREQ BSS 1 OLESTAB BSS 1 XLESTAB BSS 1 RLOCADD BSS 1 XLHEAD BSS 2 TEMP BSS 1 NORELOC VFD 12/LRBITS,48/0 EMEMOD DATA 0 ENTRY MODE FOR STATISTICS * * EMEXIT SA1 XSLCLOK COMPUTE TIME SPENT SA2 EMENTIM SA3 EMEMOD SA4 EMSTAT+X3 UPDATE ENTRY COUNT SA5 EMSTAT+4+X3 UPDATE CPU TIME IN THIS MODE IX1 X1-X2 IX6 X5+X1 SX7 1 IX7 X4+X7 SA6 A5 SA7 A4 CALL EMCLR CLEAR INTERLOCK / SAVE VARIABLE EQ EMANAG -- RETURN * * /--- BLOCK EMSET 00 000 79/06/27 17.12 EMSET SPACE 5,11 ** EMSET - SET UP INTERLOCKS / VARIABLES EMSET PS INTLOK X,I.ADDL,W GETX NLESSIN GETX LCIRC1 GETX EMAVL GETX EMSTAT,,EMSTATL GETX EMPTRS GETX EMPTRL GETX EMFREE EQ EMSET EXIT EMCLR SPACE 5,11 ** EMCLR - CLEAR INTERLOCKS / SAVE VARIABLES EMCLR PS REPLAX NLESSIN REPLAX LCIRC1 REPLAX EMAVL REPLAX EMSTAT,,EMSTATL REPLAX EMPTRS REPLAX EMPTRL REPLAX EMFREE INTCLR X,I.ADDL EQ EMCLR EXIT * * /--- BLOCK GETECS 00 000 79/06/27 17.31 TITLE -GETECS- OBTAIN ECS FROM LESSON BUFFER * * * -GETECS- * FINDS FREE SPACE FOR ECS STORAGE REQUESTS * * ON ENTRY - *LESINF* = AMOUNT OF ECS REQUESTED * * ON RETURN - X7 = 0 IF FOUND ENOUGH ECS * X7 = -1 IF NOT ENOUGH ECS * * RETURNS *LESLOC* WITH THE ADDRESS OF THE STORAGE * AND *LINDEX* WITH THE INDEX IN *LESTAB* * * ENTRY GETECS GETECS EQ * INTLOK X,I.ADDL,W GETLES/ADDLES/DELETE INTERLOCK CALL GETECS1 PL X7,GETECS EXIT IF FOUND THE SPACE INTCLR X,I.ADDL EQ GETECS * * /--- BLOCK GETECS 00 000 79/06/27 21.49 TITLE -GETECS1- OBTAIN ECS FROM LESSON BUFFER * * * * -GETECS1- * ATTEMPTS TO LOCATE SPECIFIED AMOUNT OF FREE ECS * * ON ENTRY - *LESINF* = AMOUNT OF ECS REQUESTED * * ON RETURN - X7 = *EMGETF* = 0 IF ECS FOUND * -1 IF ECS COULD NOT BE FOUND * * *LINDEX* = INDEX IN *LESTAB* OF FREE SPACE * *LESLOC* = ECS ADDRESS OF FREE SPACE * * ENTRY GETECS1 GETECS1 EQ * ENTRY/EXIT GETX NLESSIN GET ECS-RESIDENT VARIABLES GETX LCIRC1 GETX EMFREE GETX EMAVL GETX EMPTRS GETX EMPTRL GETX EMSTAT,,EMSTATL SA1 XSLCLOK BX6 X1 SA6 GETECA SAVE ENTRY TIME SA1 NLESSIN NUMBER OF ENTRIES IN *LESTAB* SB1 X1+2 SX2 LESSNS-3 CHECK FOR *LESTAB* OVERFLOW IX1 X1-X2 NG X1,GET010 IF *LESTAB* NOT FULL CALL S=MSG,LTFULL EQ NOECS LTFULL DIS ,*LESSON TABLE FULL.* GET010 SA1 LESINF AMOUNT(S) OF EM REQUESTED SX4 X1 AX1 18 IX4 X4+X1 X4 = TOTAL ECS REQUESTED SX7 500 COUNT GROUP OF REQUESTS BY SIZE PX5 X4 NX5 X5 PX7 X7 NX7 X7 FX7 X5/X7 UX7 X7,B2 LX7 X7,B2 SX5 X7+14-EMSTATL + NG X5,*+1 CHECK WITHIN STATS BUFFER LTH SX7 EMSTATL-1-14 RE-SET TO MAXIMUM + SA5 EMSTAT+14+X7 SX7 1 IX7 X7+X5 SA7 A5 SX1 =XEMPRM1 IX1 X4-X1 SA5 EMPTRS GET POINTER FOR SHORT REQUESTS NG X1,GET020 CHECK FOR SHORT REQUEST SA1 EMAVL SX2 =XEMPRM2 CHECK MINIMUM AMOUNT FREE SA5 EMPTRL GET POINTER FOR LONG REQUESTS IX1 X1-X2 NG X1,NOECS RESERVE MIN AMT FOR SHORT REQS * * /--- BLOCK GETECS 00 000 78/05/14 18.51 * * CHECK IF ADEQUATE FREE SPACE AT *EMPTR* * GET020 MX3 -24 X3 = MASK SX6 X5-5 (X6) = LESTAB POINTER NG X6,GET070 SA2 APRETAB ADDRESS OF LESTAB TABLE IX0 X2+X6 SA0 INFO + RE 10 READ AREA SURROUNDING *EMPTR* RJ =XECSPRTY MX7 0 SA7 INFO+10 PLANT ZERO FOR END-TEST SA1 INFO-1 A1 = READ REGISTER * GET040 SA1 A1+1 LOAD NEXT *LESTAB* ENTRY ZR X1,GET070 JUMP IF END OF TABLE SX6 X6+1 ADVANCE INDEX AX1 24 BX1 -X3*X1 MASK OFF FREE SPACE IX2 X1-X4 NG X2,GET040 CHECK IF SUFFICIENT FREE SPACE EQ GET120 (A0,A1,X3,X6 SET) * * SEARCH *LESTAB* FOR SPECIFIED AMOUNT OF FREE SPACE * GET070 SA1 APRETAB ADDRESS OF PRE-LESTAB TABLE BX0 X1 SA0 INFO SB3 LTABPZ LENGTH OF EACH READ SB4 -B3 SA1 EMSTAT+13 COUNT COMPLETE LESTAB SCANS SX7 1 IX7 X1+X7 SA7 A1 GET075 SB2 B0 SB4 B4+B3 RE LTABPZ RJ =XECSPRTY SA1 A0-1 INITIALIZE LOOP * * /--- BLOCK GETECS 00 000 80/11/03 10.20 * GET100 SA1 A1+1 LOAD NEXT *LESTAB* ENTRY SB2 B2+1 LE B2,B3,GET110 IF WITHIN PAGE SX1 B3 IX0 X0+X1 EQ GET075 READ NEXT PAGE * GET110 ZR X1,NOECS IF END OF TABLE AX1 24 POSITION FREE SPACE BX2 -X3*X1 IX2 X2-X4 CHECK IF ENOUGH ROOM NG X2,GET100 SX6 B4+B2 INDEX INTO LESTAB * GET120 SA6 A5 UPDATE FREE POINTER SX6 X6-2 SA6 LINDEX RETURN INDEX TO FREE SPACE SA1 A1 RE-LOAD *LESTAB* ENTRY BX6 -X3*X1 ECS ADDRESS OF LESSON HEADER RX1 X6 (-RXX- 1 WD READ, MAY CHG *A1*) SX2 X1 AX1 18 SX1 X1 IX6 X2+X6 IX6 X1+X6 (X6) = ADDRESS OF FREE SPACE SA6 LESLOC RETURN ADDRESS OF FREE SPACE REPLAX EMPTRS REPLAX EMPTRL MX7 0 X7 = 0 = ECS FOUND SA7 EMGETF EQ GET900 * * NOECS MX7 -1 X7 = -1 = ECS NOT FOUND SA7 EMREQ MARK REQUEST UNSATISFIED SA7 EMGETF SA7 EMPTRS CLEAR ECS FREE POINTERS SA7 EMPTRL REPLAX EMPTRS REPLAX EMPTRL SA1 ECSFLOW SX6 X1+1 INCREMENT ERROR COUNTER SA6 A1 EQ GET900 * GETECA DATA 0 TEMPORARY GET900 BSS 0 SA1 XSLCLOK SA2 GETECA COMPUTE TIME SPENT SX6 1 SA3 EMSTAT+3 SA4 EMSTAT+4+3 IX6 X3+X6 SA6 A3 IX6 X1-X2 IX6 X4+X6 SA6 A4 REPLAX EMSTAT,,EMSTATL EQ GETECS1 -- RETURN * * /--- BLOCK END 00 000 79/06/27 17.26 * END