User Tools

Site Tools


cdc:nos2.source:nam5871:exretsb

EXRETSB

Table Of Contents

Source Code

EXRETSB.txt
  1. *DECK EXRETSB
  2. PROC RETTSB ( (TSBN) );
  3. BEGIN # RETTSB #
  4. *IF DEF,IMS
  5. #
  6. **
  7. *
  8. * 1. PROC NAME AUTHOR DATE
  9. * RETTSB M. D. PICKARD 76/12/2
  10. *
  11. * 2. FUNCTIONAL DESCRIPTION
  12. * RETTSB WILL RETURN AN ASSIGNED TSB TO THE FREE SPACE OF
  13. * THE TSB AREA.
  14. *
  15. * 3. METHOD USED
  16. * IF THE TSBN IS VALID THE BLOCK IS RETURNED TO THE FREE
  17. * SPACE BY CALLING GIVETSB AND THE TSBN IS RETURNED
  18. * BY CALLING GIVTSBN.
  19. *
  20. * 4. ENTRY PARAMETERS
  21. * TSBN (FORMAL) TSB NUMBER OF TSB THAT IS TO BE RETURNED
  22. *
  23. * 5. EXIT PARAMETERS
  24. * NONE.
  25. *
  26. * 6. COMDECKS CALLED
  27. * TSBBASE TSB MANAGER BASED ARRAY DEFINITIONS
  28. * TSBDEFS TSB MANAGER SYMPL DEFS
  29. * TSBDATA TSB MANAGER DATA AREA DEFINITIONS
  30. *
  31. * 7. ROUTINES CALLED
  32. * GIVETSB GIVE TSB BACK TO FREE SPACE
  33. * GIVTSBN RETURNS A TSBN TO THE FREE TSBN CHAIN
  34. *
  35. * 8. DAYFILE MESSAGES
  36. * NONE.
  37. *
  38. #
  39. *ENDIF
  40. CONTROL NOLIST; # STOPS LIST TSBDEFS,TSBDATA,TSBBASE #
  41. *CALL CYBERDEFS
  42. *CALL TSBDEFS
  43. *CALL TSBBASE
  44. *CALL TSBDATA
  45. CONTROL LIST;
  46. ITEM
  47. TSBN U; # TSBN OF TSB TO BE RETURNED #
  48. XREF
  49. BEGIN
  50. PROC GIVETSB;
  51. END
  52. ITEM
  53. TEMP U, # TEMPORARY UNSIGNED INTEGER #
  54. TEMPB B; # TEMPORARY BOOLEAN #
  55. CONTROL EJECT;
  56. PROC GIVTSBN ( (TSBN) );
  57. BEGIN # GIVTSBN #
  58. *IF DEF,IMS
  59. #
  60. **
  61. *
  62. * 1. PROC NAME AUTHOR DATE
  63. * GIVTSBN M. D. PICKARD 76/12/13
  64. *
  65. * 2. FUNCTIONAL DESCRIPTION
  66. * GIVTSBN WILL RETURN AN ASSIGNED TSBN TO THE CHAIN OF
  67. * UNASSIGNED TSBN"S IN THE TSB INFORMATION TABLE ( TSBIT ).
  68. *
  69. * 3. METHOD USED
  70. * THE CHAIN OF UNASSIGNED (FREE) TSBN"S IS SEARCHED FINDING
  71. * THE APPROPRIATE SPOT, TSBN IS LINKED INTO THE CHAIN.
  72. *
  73. * 4. ENTRY PARAMETERS
  74. * TSBN TSBN ( TSB NUMBER ) THAT IS TO BE RETURNED
  75. *
  76. * 5. EXIT PARAMETERS
  77. * NONE.
  78. *
  79. * 6. COMDECKS CALLED
  80. * NONE.
  81. *
  82. * 7. ROUTINES CALLED
  83. * GETTSB
  84. * GIVETSB
  85. * MOVEI MOVES BLOCK OF CENTRAL MEMORY WORDS
  86. *
  87. * 8. DAYFILE MESSAGES
  88. * NONE.
  89. *
  90. #
  91. *ENDIF
  92. ITEM
  93. TSBN U; # TSB NUMBER TO BE RETURNED #
  94.  
  95. NUMFREE[0] = NUMFREE[0] + 1; # BUMP NUMBER OF FREE TSBN"S #
  96. IF LOWFREE[0] EQ 0
  97. THEN # THIS IS THE ONLY FREE TSBN #
  98. BEGIN
  99. FWDPTR[TSBN] = 0; # END OF FREE CHAIN POINTER #
  100. LOWFREE[0] = TSBN; #SET LOWFREE TO THIS TSBN #
  101. END
  102. ELSE # FIND THE TSBN"S PLACE IN THE FREE CHAIN #
  103. BEGIN
  104. IF TSBN LS LOWFREE[0]
  105. THEN # TSBN WILL BE NEW LOWFREE #
  106. BEGIN
  107. FWDPTR[TSBN] = LOWFREE[0]; # POINT TO OLD LOWFREE #
  108. LOWFREE[0] = TSBN; # SET NEW LOWFREE AT RETURNED TSBN #
  109. END
  110. ELSE
  111. BEGIN # SEARCH FOR ITS SPOT IN FREE CHAIN #
  112. TEMPB = FALSE; # END OF LOOP INDICATOR #
  113. FOR TEMP = LOWFREE[0] WHILE NOT TEMPB DO
  114. BEGIN # SEARCH TIL HIT #
  115. FWDPTR[TSBN] = FWDPTR[TEMP]; # SET FWDPTR TO NEXT ONE #
  116. IF TSBN LS FWDPTR[TSBN]
  117. THEN # PLACE IS FOUND #
  118. BEGIN
  119. TEMPB = TRUE; # SET END OF LOOP #
  120. FWDPTR[TEMP] = TSBN; # SET NEW FWDPTR FOR PREVIOUS TSBN #
  121. END
  122. ELSE # SEE IF END OF CHAIN #
  123. BEGIN
  124. IF FWDPTR[TSBN] EQ 0
  125. THEN # THIS IS THE END OF CHAIN #
  126. BEGIN
  127. TEMPB = TRUE; # SET END OF LOOP #
  128. FWDPTR[TEMP] = TSBN; # POINT OLD END OF CHAIN TO TSBN #
  129. END
  130. ELSE # CONTINUE SEARCH #
  131. TEMP = FWDPTR[TEMP]; # BUMP TO NEXT IN CHAIN #
  132. END
  133. END
  134. END
  135. END
  136. RETURN;
  137. END # GIVTSBN #
  138. CONTROL EJECT; # RETTSB CODE STARTS HERE #
  139. IF ( TBUSY[TSBN] ) AND ( TSBN LS LENGTH[0] ) AND ( TSBN GR 0 )
  140. THEN # TSBN IS VALID #
  141. BEGIN
  142. GIVETSB(TTSBFWA[TSBN]); # GIVE BACK THE TSB TO FREE SPACE #
  143. TBUSY[TSBN] = FALSE; # CLEAR BUSY FLAG #
  144. TTSBFWA[TSBN] = 0; # CLEAR TSB FWA #
  145. GIVTSBN(TSBN); # RETURN THIS TSBN TO FREE CHAIN #
  146. END
  147. RETURN;
  148. END TERM # RETTSB #
cdc/nos2.source/nam5871/exretsb.txt ยท Last modified: 2023/08/05 17:22 by Site Administrator