User Tools

Site Tools


cdc:nos2.source:nam5871:exsquez

EXSQUEZ

Table Of Contents

Source Code

EXSQUEZ.txt
  1. *DECK EXSQUEZ
  2. PROC SQUEEZE ( (REQSIZE), RETFWA );
  3. BEGIN # SQUEEZE #
  4. *IF DEF,IMS
  5. #
  6. **
  7. *
  8. * 1. PROC NAME AUTHOR DATE
  9. * SQUEEZE M. D. PICKARD 76/11/17
  10. *
  11. * 2. FUNCTIONAL DESCRIPTION
  12. * SQUEEZE WILL MOVE ASSIGNED BLOCKS THAT ARE NOT FIXED POSITION
  13. * UNTIL A FREE BLOCK LARGE ENOUGH TO SATISFY THE REQUEST EXISTS.
  14. * MORE FIELD LENGTH WILL BE REQUESTED IF THIS CANT BE DONE.
  15. * ALSO, IF THE REQUEST SIZE IS ZERO, SQUEEZE WILL MOVE AS
  16. * MUCH AS POSSIBLE AND RETURN THE ADDRESS OF THE LAST FREE
  17. * BLOCK.
  18. *
  19. * 3. METHOD USED
  20. * STARTING AT TSBFWA, ALL ASSIGNED BLOCKS THAT ARE NOT FIXED
  21. * POSITION ARE MOVED TO LOWER CORE ADDRESSES AND FREE BLOCKS
  22. * ARE ACCUMULATED TO MAKE LARGER FREE BLOCK. WHEN A FREE
  23. * BLOCK EXISTS THAT SATISFIES THE REQUEST SIZE, THE FUNCTION
  24. * IS COMPLETE. IF WHEN CTSBLWA IS REACHED AND THE REQUEST
  25. * IS NOT SATISFIED, MORE FIELD LENGTH IS REQUESTED TO SATISFY
  26. * THE REQUEST. (IF THE REQUEST SIZE WAS ZERO, WHEN CTSBLWA
  27. * IS REACHED, THE ADDRESS OF THE LAST FREE BLOCK IS RETURNED
  28. * AND NO FIELD LENGTH REQUEST TAKES PLACE.) THE ADDRESS OF
  29. * THE BLOCK SATISFYING THE REQUEST IS RETURNED.
  30. *
  31. * 4. ENTRY PARAMETERS
  32. * A. FORMAL PARAMETERS
  33. * REQSIZE SIZE OF FREE BLOCK NEEDED, REQSIZE
  34. * MUST BE GQ ZERO, AND LQ MAXTSBL
  35. *
  36. * B. TSB MANAGER GLOBAL PARAMETERS
  37. * TSBFWA FIRST WORD ADDRESS OF TSB"S
  38. * CTSBLWA CURRENT LAST WORD ADDRESS OF TSB"S
  39. * TSBAREA ARRAY THAT DEFINES DYNAMIC MEMORY
  40. * TSBIT TASK SEQUENCE BLOCK IDENT TABLE
  41. * THIS BASED ARRAY IS SET ON ENTRY
  42. *
  43. * 5. EXIT PARAMETERS
  44. * A. FORMAL PARAMETERS
  45. * RETFWA ADDRESS OF TSB THAT SATISFIES REQUEST
  46. * LAST FREE TSB ADDRESS IF REQUEST SIZE
  47. * WAS ZERO
  48. * B. TSBMGR GLOBAL PARAMETERS
  49. * TTSBFWA FIELD IN TSBIT THAT IS MODIFIED EACH TIME
  50. * TSBIT THIS BASED ARRAY GETS RESET IF TSB
  51. * CONTAINING TSBIT IS MOVED
  52. *
  53. * 6. COMDECKS CALLED
  54. * TSBBASE TSB MANAGER BASED ARRAY DEFINITIONS
  55. * TSBDATA TSB MANAGER DATA AREA DEFINITIONS
  56. * TSBDEFS TSB MANAGER SYMPL DEFS
  57. *
  58. * 7. ROUTINES CALLED
  59. * MEMREQ REQUESTS MEMORY
  60. * MOVEI MOVES BLOCK OF CENTRAL MEMORY WORDS
  61. *
  62. * 8. DAYFILE MESSAGE
  63. * NONE.
  64. *
  65. #
  66. *ENDIF
  67. CONTROL NOLIST; # STOPS LIST TSBDEFS,TSBDATA,TSBBASE #
  68. *CALL CYBERDEFS
  69. *CALL TSBDEFS
  70. *CALL TSBBASE
  71. *CALL TSBDATA
  72. CONTROL LIST;
  73. ITEM
  74. REQSIZE U, # SIZE OF TSB WANTED #
  75. RETFWA U; # ADDRESS OF TSB LARGE ENOUGH FOR REQUEST #
  76. # OR LAST FREE TSB ADDRESS #
  77. XREF
  78. BEGIN
  79. PROC FIRSTF;
  80. PROC GETBIG;
  81. PROC MOVEI;
  82. PROC MEMREQ;
  83. END
  84. ITEM
  85. CFREE U, # CURRENT ACCUMULATED FREE SPACE #
  86. CSPOT U, # CURRENT SPOT IN SEARCH #
  87. FSPOT U, # FREE SPACE STARTING SPOT #
  88. LPTSBL U, # LAST PREVIOUS TSB LENGTH #
  89. MRSIZE U, # USED TO HOLD MEMORY REQUEST VALUE #
  90. NMEMREQ B, # NO MEMORY REQUEST INDICATOR #
  91. SQSIZE U; # TEMPORY HOLDER FOR REQUEST SIZE #
  92. CSPOT = 0;
  93. FSPOT = 0;
  94. LPTSBL = 0;
  95. IF REQSIZE EQ 0
  96. THEN # NO FIELD LENGTH IS REQUESTED #
  97. BEGIN
  98. NMEMREQ = TRUE; # SET NO MEMORY REQUEST #
  99. SQSIZE = MAXTSBA + 1; # FORCE NO MATCH ON REQUEST SIZE #
  100. END
  101. ELSE # FIELD LENGTH WILL BE REQUESTED IF #
  102. BEGIN # NEEDED #
  103. SQSIZE = REQSIZE; # SET SEARCH SIZE TO REQUEST SIZE #
  104. NMEMREQ = FALSE; # SET TO ALLOW MEMORY REQUEST #
  105. END
  106. FOR CFREE = 0 WHILE CFREE LS SQSIZE DO
  107. BEGIN # CONSOLIDATE TSB AREA WHERE POSSIBLE #
  108. # UNTIL REQUEST IS SATISFIED #
  109. IF LOC(TSBAREA[CSPOT]) GQ CTSBLWA
  110. THEN # AT THE END OF THE TSB AREA #
  111. BEGIN
  112. IF NOT NMEMREQ
  113. THEN # MORE FIELD LENGTH IS WANTED #
  114. BEGIN
  115. MRSIZE = ( SQSIZE - CFREE + ( MRU - 1 )) / MRU; # AMOUNT #
  116. MEMREQ(MRSIZE); # REQUEST MRSIZE MEMORY REQUEST UNITS #
  117. CFREE = CTSBLWA - LOC(TSBAREA[FSPOT]); # AMOUNT OF FREE NOW#
  118. P<FTSBHDR> = LOC(TSBAREA[FSPOT]); # SET HDR. AT LAST FREE #
  119. FTSBL[0] = CFREE; # SET THIS BLOCKS NEW LENGTH #
  120. P<FTSBHDR> = CTSBLWA; # BUILD ZERO LENGTH TSB AT CTSBLWA #
  121. FBUSY[0] = FALSE; # SET NOT BUSY #
  122. FNOTMOV[0] = FALSE; # SET OK TO MOVE #
  123. FHDRRSV[0] = 0; # CLEAR RESERVED AREA #
  124. FIDENT[0] = 0; # CLEAR IDENT FIELD #
  125. FPTSBL[0] = CFREE; # SET PREVIOUS TSB LENGTH #
  126. FTSBL[0] = 0; # SET TSB LENGTH TO ZERO #
  127. END
  128. ELSE # NO MORE FIELD LENGTH #
  129. BEGIN
  130. SQSIZE = 0; # SET TO INSURE END OF FOR LOOP #
  131. IF CFREE NQ 0
  132. THEN # LAST TSB IS A FREE ONE #
  133. BEGIN
  134. P<FTSBHDR> = CTSBLWA; # SET FREE FORMAT ON ZERO LEN. TSB #
  135. FPTSBL[0] = CFREE; # PREVIOUS LEN. IS CFREE #
  136. END
  137. END
  138. END
  139. ELSE # CONTINUE CONSOLIDATION #
  140. BEGIN
  141. P<BTSBHDR> = LOC(TSBAREA[CSPOT]); # SET HEADER AT CURR. SPOT #
  142. IF BBUSY[0]
  143. THEN # THIS TSB IS ASSIGNED #
  144. BEGIN # SEE IF THERE IS ANYWHERE TO MOVE IT #
  145. IF CSPOT NQ FSPOT
  146. THEN # WE CAN MOVE IT IF IT IS NOT FIXED #
  147. IF NOT BNOTMOV[0]
  148. THEN # IT CAN BE MOVED, SO MOVE IT #
  149. BEGIN
  150. BPTSBL[0] = LPTSBL; # NEW PREVIOUS TSB LENGTH #
  151. LPTSBL = BTSBL[0]; # NEW LAST PREVIOUS TSB LENGTH #
  152. TTSBFWA[BIDENT[0]] = LOC(TSBAREA[FSPOT]); # NEW FWA TO #
  153. # TSBIT #
  154. IF BIDENT[0] EQ 1
  155. THEN # THIS IS THE TSBIT, RESET BASED ARRAY #
  156. P<TSBIT> = LOC(TSBAREA[FSPOT]) + TSBHDRL; # SET ARRAY#
  157. MOVEI(LPTSBL,LOC(TSBAREA[CSPOT]),LOC(TSBAREA[FSPOT]));
  158. # MOVE TSB TO NEW LOCATION #
  159. CSPOT = CSPOT + LPTSBL;
  160. P<FTSBHDR> = LOC(TSBAREA[FSPOT]) + LPTSBL;
  161. FBUSY[0] = FALSE; # BUILD FREE HEADER AT END OF MOVED #
  162. FNOTMOV[0] = FALSE; # ITS MOVEABLE TSB #
  163. FHDRRSV[0] = 0; # CLEAR RESERVED AREA #
  164. FIDENT[0] = 0; # CLEAR IDENT FIELD #
  165. FPTSBL[0] = LPTSBL; # SET PREVIOUS LENGTH TO MOVED TSB #
  166. FTSBL[0] = CFREE; # SET LENGTH TO CURRENT FREE SPACE #
  167. FSPOT = FSPOT + LPTSBL; # RESET FREE SPOT #
  168. P<BTSBHDR> = LOC(TSBAREA[CSPOT]); #POINT AT NEXTTSB#
  169. BPTSBL[0] = CFREE ; # SET NEW PREV TSB LENGTH#
  170. END
  171. ELSE # CANT MOVE IT #
  172. BEGIN
  173. LPTSBL = BTSBL[0]; # NEW LAST PREVIOUS LENGTH #
  174. BPTSBL[0] = CFREE; # NEW PREVIOUS TSB LENGTH FOR BLOCK #
  175. CFREE = 0;
  176. CSPOT = CSPOT + BTSBL[0]; # NEW CURRENT SPOT #
  177. FSPOT = CSPOT; # NEW FREE SPOT, SAME A CURRENT SPOT #
  178. END
  179. ELSE # NOWHERE TO MOVE IT, RESET POINTERS #
  180. BEGIN
  181. CSPOT = CSPOT + BTSBL[0]; # NEW CURRENT SPOT #
  182. FSPOT = CSPOT; # NEW FREE SPOT #
  183. LPTSBL = BTSBL[0]; # NEW LAST PREVIOUS TSB LENGTH #
  184. END
  185. END
  186. ELSE # THIS IS A FREE TSB, ADD IT TO CFREE #
  187. BEGIN
  188. CFREE = CFREE + BTSBL[0]; # ADD TO ACCUMULATED FREE SPACE #
  189. P<FTSBHDR> = LOC(TSBAREA[FSPOT]); # SET ON LAST FREE #
  190. FTSBL[0] = CFREE; # UPDATE LENGTH OF FREE TSB #
  191. CSPOT = CSPOT + BTSBL[0]; # NEW CURRENT SPOT #
  192. P<BTSBHDR>= LOC(TSBAREA[CSPOT]); #POINT TO NEXT TSB#
  193. BPTSBL[0] = CFREE ; #SET NEW PREV. TSB LENGTH #
  194. IF LOC(TSBAREA[CSPOT]) EQ CTSBLWA
  195. THEN # RESET PREV. TSB LEN. ON LAST TSB #
  196. BEGIN
  197. P<BTSBHDR> = LOC(TSBAREA[CSPOT]); # FORMAT LAST TSB #
  198. BPTSBL[0] = CFREE; # PREVIOUS TSB LENGTH #
  199. END
  200. END
  201. END
  202. END
  203. FIRSTF; # RESET FFFWA #
  204. GETBIG; # RE-ESTABLISH BIGGEST FREE TSB SIZE #
  205. RETFWA = LOC(TSBAREA[FSPOT]); # SET RETURN FWA FOR TSB #
  206. RETURN;
  207. END TERM # SQUEEZE #
cdc/nos2.source/nam5871/exsquez.txt ยท Last modified: 2023/08/05 17:22 by Site Administrator