User Tools

Site Tools


cdc:nos2.source:nam5871:mgetc

Table of Contents

MGETC

Table Of Contents

Source Code

MGETC.txt
  1. *DECK MGETC
  2. IDENT MGETS
  3. SST
  4. ENTRY MGETS
  5.  
  6. ENTRY MEM
  7. ENTRY CFOFLG
  8. ENTRY CFOWD
  9. ENTRY LDPM
  10. ENTRY PGNAME
  11. ENTRY RASSC
  12.  
  13. EXT ABORT
  14. EXT MRELS
  15. EXT MSEIZE
  16. EXT OCFL
  17. EXT OMSG
  18. EXT XTRACE
  19. SYSCOM
  20. MEM EQU 0
  21. LIST F
  22. *IF DEF,IMS
  23. *#
  24. *1DC MGETS
  25. *
  26. * 1. PROC NAME AUTHOR DATE
  27. * MGETS P. C. TAM 77/09/27
  28. *
  29. * 2. FUNCTIONAL DESCRIPTION.
  30. * THIS ROUTINE IS RESPONSIBLE FOR GETTING A LARGE ENOUGH BUFFER
  31. * FROM FREE CHAIN FOR THE CALLING ROUTINE AND RETURN THE EXTRA
  32. * WORDS TO THE FREE CHAIN.
  33. *
  34. * 3. METHOD USED.
  35. * SCAN FREE CHAIN FOR A BUFFER FIT THE REQUESTED SIZE BEST.
  36. * IF CAN NOT FIND A BIG ENOUGH BUFFER THEN CALL OCFL TO ISSUE
  37. * MEMORY REQUEST TO THE OPERATING SYSTEM FOR ADDITIONAL SPACE
  38. * OF REQUESTED SIZE + 300 WORDS. (IF NIP MAXFL NOT REACHED YET)
  39. * DELINK THE BUFFER FOUND FROM FREE CHAIN.
  40. * RELEASE EXTRA WORDS FROM BUFFER FOUND.
  41. * ZERO OUT THE BUFFER AND SET BLOCK SIZE.
  42. *
  43. * 4. ENTRY PARAMETERS.
  44. * (X1) = ADDRESS OF THE REQUIRED SIZE OF BUFFER
  45. *
  46. * 5. EXIT PARAMETERS.
  47. * (A1)+1 = ADDRESS OF THE ADDRESS OF THE BUFFER ADDRESS
  48. * (A1)+2 = ADDRESS OF THE ADDRESS OF ZERO FLAG
  49. *
  50. * 6. COMDECKS CALLED.
  51. * CYBERDEFS FREETAB INPARU MACDEF
  52. * STATTAB2 SYSTIME
  53. *
  54. * 7. ROUTINES CALLED.
  55. * MSEIZE RELEASE BUFFER SPACE
  56. * OCFL MAKE MEMORY REQUEST TO OPERATING SYSTEM
  57. * OMSG LOG ERROR MESSAGE
  58. * XTRACE RECORD CALL
  59. *
  60. * 8. DAYFILE MESSAGES.
  61. * *MAX FL REACHED
  62. *
  63. *#
  64. *ENDIF
  65. *CALL SYSCOMD
  66. *CALL MACDEF
  67. *CALL CYBERDEFS
  68. *CALL INPARU
  69. *CALL FREETAB
  70. *CALL STATTAB2
  71. *CALL SYSTIME
  72.  
  73.  
  74. MGETS SUBR = ENTRY/EXIT
  75.  
  76. * (A0)=ADDRESS OF PARM BLOCK
  77.  
  78. SX6 A1 (X6)=ADDR OF PARM BLOCK
  79. SA6 PARMA (PARMA)=ADDR OF PARM BLOCK
  80. SA0 A1 (X0)=ADDR OF PARM BLOCK
  81.  
  82. IFEQ DEBUG,1,6
  83. SX6 A1
  84. SA6 TEMP
  85. SX1 XMGETC
  86. RJ XTRACE
  87. SA1 TEMP
  88. SA1 X1
  89.  
  90.  
  91.  
  92. *
  93. * STEP 1 SCAN FREE CHAIN FOR BEST FIT SPACE
  94. * FOLLOWING REGISTERS ARE SET IN THIS STEP:
  95. * (X1)=REQUIRED BUFFER SIZE (RQSIZE)
  96. * (X2)=FRESFB (TOTAL SIZE OF ALL FREE BUFFERS)
  97. * (X3)=FRENOFB (TOTAL NUMBER OF FREE BUFFERS)
  98.  
  99. SA1 X1 (X1)=RQSIZE VALUE
  100. SB7 X1 (B7)=RQSIZE VALUE
  101. SA2 FRETAB+FRESFB# (X2)=FRESFB VALUE
  102. SB6 X2 (B6)=FRESFB VALUE
  103. SA4 MAXFL
  104. SB2 X4 (B2)=MAXFL
  105.  
  106. B1 IFNE BESTFIT,1
  107. LT B6,B7,MGTS8 BRANCH IF FRESFB LS RQSIZE
  108. MX0 -1 (X0)=-1
  109. SA3 FRETAB+FRENOFB# (X3)=FRENOFB
  110. SA4 FRETAB+FREFBFP# (X4)=FREFBFP WORD
  111. BX7 X3
  112.  
  113. * (A4)=ADR OF BUFFER EXAMINED CURRENTLY
  114. * (B4)=A4 AFTER LOOP TERMINATED
  115.  
  116. MGTS1 ZR X7,MGTS7 CHECK FOR LOOP TERMINATION
  117. SA4 X4 (X4)=FRBFBFP OR FREFBFP WORD
  118. BX5 X4
  119. LX5 -FRBBS?+FRBBS$-1 (X5)=FRBBS FIELD RIGHT JUSTIFIED
  120. SX5 X5
  121. IX5 X5-X1 (X5)=FRBBS[0]-RQSIZE
  122. ZR X5,MGTS7 BRANCH IF FRBBS[0]-RQSIZE ZERO
  123. PL X5,MGTS7 BRANCH IF FRBBS[0]-RQSIZE GR ZERO
  124. IX7 X7+X0 (X7)=X7-1
  125. EQ MGTS1 LOOP BACK
  126.  
  127. MGTS7 BSS 0
  128. SB4 A4 SAVE CHOSEN BUFFER ADR
  129.  
  130. S1 IFEQ STAT,1
  131. IX7 X3-X7 UPDATE ST$GNB
  132. SA4 ST$GNB
  133. IX7 X4+X7
  134. SA7 A4
  135. S1 ENDIF
  136.  
  137. ZR X5,MGTSZ FOUND BUFFER
  138. PL X5,MGTSZ FOUND BUFFER
  139.  
  140. B1 ELSE
  141. SB5 X4 MAX FL
  142.  
  143. LT B6,B7,MGTS8 BRANCH IF FRESFB LS RQSIZE
  144. MX0 -1 (X0)=-1
  145. SA3 FRETAB+FRENOFB#
  146. SA4 FRETAB+FREFBFP#
  147. BX7 X3
  148.  
  149. * (A4)=ADDR OF CURRENT BUFFER EXAMINED
  150. * (B4)=SET TO A4 AT LOOP END
  151.  
  152. MGTS1 ZR X7,MGTS7 CHECK FOR EXIT FROM LOOP
  153. SA4 X4 (X4)=FRBFBFP OR FREFBFP WORD
  154. BX5 X4
  155. LX5 -FRBBS?+FRBBS$-1 (X5)=FRBBS FIELD RIGHT JUSTIFIED
  156. SX5 X5
  157. IX5 X5-X1 (X5)=FRBBS-RQSIZE
  158. SB7 X5
  159. LT B7,B0,MGTS2 BRANCH IF B7 LS ZERO
  160. GE B7,B5,MGTS2 BRANCH IF FRBBS-RQSIZE GR B5
  161. SB5 B7 NEW MIN FRBBS-RQSIZE
  162. SB4 A4 CORRESPONDING BUFFER
  163. EQ B7,B0,MGTS7 BRANCH IF FRBBS-RQSIZE ZERO
  164.  
  165. MGTS2 BSS 0
  166. IX7 X7+X0 (X7)=X7-1
  167. EQ MGTS1 LOOP BACK
  168.  
  169. MGTS7 BSS 0
  170.  
  171. S1 IFEQ STAT,1
  172. IX7 X3-X7 UPDATE ST$GNB
  173. SA5 ST$GNB
  174. IX7 X7+X5
  175. SA7 A5
  176. S1 ENDIF
  177.  
  178. LT B5,B2,MGTSZ BRANCH IF FRBBS-RQSIZE IS SET
  179. B1 ENDIF
  180.  
  181. ***
  182. *
  183. * CANNOT FIND BIG ENOUGH BUF
  184. * ASK SYSTEM FOR MORE SPACE IF NIP HAS NOT REACH MAX FL
  185. *
  186. MGTS8 BSS 0
  187. RJ MSTAVF CALL INTERNAL PROC TO EXTEND PROGRAM LEN
  188. SA1 PARMA (X1)=ADDR OF PARM BLOCK
  189. SA0 X1 (A0)=ADDR OF PARM BLOCK
  190. SA1 X1 (X1)=RQSIZE ADDR
  191. SA1 X1 (X1)=RQSIZE VALUE (RESTORE X1)
  192. SA5 CTLSLWA (X5)=(CTLSLWA)
  193. SB7 X5 (B7)=(CTLSLWA)
  194. SA4 TEMP2 (X4)=(TEMP2)
  195. BX7 X4 (X7)=(TEMP2)
  196. SA7 A5 CTLSLWA=(TEMP2)
  197. IX4 X4-X5 (X4)=NEW CTLSLWA - OLD CTLSLWA
  198. SA2 FRETAB+FRESFB# (X2)=(FRESFB)
  199. IX7 X2+X4 (X7)=(FRESFB)+(TEMP1)
  200. SA7 A2
  201. SA5 FRETAB+FREFBBP# (X5)=(FREFBBP WORD)
  202. MX0 -FRBBS$ (X0)=MASK FOR FRBBS FD
  203. LX5 -FREFBBP?+FREFBBP$-1 RIGHT JUSTIFY (FREFBBP)
  204. SB6 X5 (B6)=(FREFBBP)
  205. LX0 FRBBS?-FRBBS$+1 SHIFT TO APP POS IN WORD
  206. LOAD A5,B6,FRBBS# (X5)=(FRBBS[FREFBBP] WORD)
  207. BX6 -X0*X5 (X6)=(FRBBS[FREFBBP] FD)
  208. LX6 -FRBBS?+FRBBS$-1 RIGHT JUSTIFY (FRBBS[FREFBBP] FD)
  209. SB5 B6+X6 (B5)=(FRBBS[FREFBBP])+(FREFBBP)
  210. EQ B7,B5,MGTSR5 BRANCH IF CTLSLWA EQ (B5)
  211.  
  212. * LAST FREE BUFFER NOT AT CTLSLWA
  213.  
  214. SA3 FRETAB+FRENOFB# SET NEW FRENOFB
  215. MX7 -1 (X7)=-1
  216. SB4 B7 BUFWA=(CTLSLWA ORIGINAL)
  217. IX7 X3-X7 (X7)=X3+1
  218. SA7 A3
  219. LX4 FRBBS?-FRBBS$+1 SHIFT TO APPP POS IN WORD
  220. SX7 FRETAB+FREFBFP# (X7)=FRETAB+FREFBFP
  221. BX7 X7+X4 (X7)=NEW BUFWA HEADER BS, FP SET
  222. SX6 B6 (X6)=(FREFBBP)
  223. LX6 FREFBBP?-FREFBBP$+1 SHIFT TO APP POS IN WORD
  224. BX7 X7+X6 (X7)=NEW BUFWA HEADER
  225. SA7 B4 WRITE TO CM
  226. EQ MGTSZ
  227.  
  228. * LAST BUFFER AT CTLSLWA
  229.  
  230. MGTSR5 SB4 B6 BUFWA=(FREFBBP)
  231. IX6 X6+X4 (X6)=FRBBS[FREFBBP]+TEMP1
  232. LX6 FRBBS?-FRBBS$+1 SHIFT TO APP POS IN WORD
  233. BX7 X0*X5 (X7)=(FRBBS[FREFBBP] WORD MINUS BS FD)
  234. BX7 X7+X6 (X7)=NEW BUFFER HEADER
  235. SA7 B4 WRITE TO CM
  236.  
  237.  
  238. ***
  239. * FOUND, CALL MSEIZE TO DELINK FROM FREE CHAIN
  240. *
  241.  
  242. MGTSZ BSS 0
  243. SA4 A0+1 (BUFWA)=ADDR OF SELECTED BUFFER
  244. SX6 B4
  245. SA6 X4
  246. RJ MSEIZE
  247. EQ MGETSX EXIT
  248.  
  249.  
  250. * INTERNAL PROCEDURE USED IN TWO PLACES IN MGETC
  251.  
  252. *IF DEF,IMS
  253. *#
  254. *1DC MSTAVF
  255. * 1. PROC NAME AUTHOR DATE
  256. * MSTAVF P.C.TAM 78/08/25
  257. *
  258. * 2. FUNCTION DESCRIPTION.
  259. * INTERNAL PROCEDURE FOR MGETS.
  260. *
  261. * 3. METHOD USED.
  262. * UPDATE STATISTICS VARIABLES ST$FL, ST$FLW, ST$FLT.
  263. * CALL OCFL TO EXTEND PROGRAM LENGTH.
  264. *
  265. * 4. ENTRY PARAMETERS.
  266. * X7 NO OF WORDS PROGRAM LENGTH IS INCREASED
  267. * B7 NEW PROGRAM LENGTH
  268. *
  269. * 5. EXIT PARAMETERS.
  270. * NONE
  271. *
  272. * 6. COMMON DECKS CALLED.
  273. * NONE.
  274. *
  275. * 7. ROUTINES CALLED.
  276. * OCFL INCREASE PROGRAM LENGTH
  277. *
  278. * 8. DAYFILE MESSAGES.
  279. * NONE.
  280. *
  281. *#
  282. *ENDIF
  283.  
  284. MSTAVF SUBR = ENTRY/EXIT
  285.  
  286. S3 IFEQ STAT,1
  287. MX6 -1 (X6)=-1
  288. SA4 ST$FL INCR NO OF FL INCREASE
  289. IX6 X4-X6 (X6)=X4+1
  290. SA6 A4
  291. SA4 ST$FLW INCR NO OF WORD INCREASED
  292. IX6 X4+X7
  293. SA6 A4
  294. S3 ENDIF
  295.  
  296. SA5 CTLSLWA
  297. SB7 X5 CURRENT LWA
  298. LT B7,B2,MSTAVF0 MAX FL NOT YET REACHED
  299. SA1 MSGERR MAXFL REACHED, NO BUFFER TO ALLOCATE
  300. RJ ABORT *----- ABORT -----*
  301.  
  302. MSTAVF0 BSS 0 REQUEST OS FOR MORE MEMORY
  303. SX7 X1+577B (X7)=RQSIZE+320+63
  304. AX7 6
  305. LX7 6 (X7) ROUNDED TO NEAREST 100B
  306. SA5 CTLSLWA LWA OF FL
  307. IX6 X5+X7
  308.  
  309. * CHECK IF REACHED MAXIMUM FIELD LENGTH
  310.  
  311. SA4 MAXFL MAX FIELD LENGTH FOR NIP
  312. IX7 X4-X6 COMPARE TO NEW LWA
  313. ZR X7,MSTAVF1 EXIT IF REACHED MAX FL
  314. PL X7,MSTAVF2 EXIT IF NOT EXCEEDED MAX FL
  315. MSTAVF1 SX6 X4 LWA SET TO MAX FL
  316. MX0 FREMFL$ SIZE OF FIELD OF MAX-FIELD-LENGTH FLAG
  317. SA4 FRETAB+FREMFL# WORD CONTAINING MAX-FIELD-LENGTH FLAG
  318. BX7 X4+X0 CLEAR MAX-FIELD-LENGTH FIELD
  319. SA7 A4 SET MAX-FIELD-LENGTH FLAG
  320. MSTAVF2 SA6 TEMP2 SAVE NEW LWA
  321. SA1 TMP2A
  322. RJ OCFL
  323.  
  324. S4 IFEQ STAT,1
  325. SA5 THETIME+RTSECS# SYSTEM TIME
  326. MX0 RTSECS$ MASK FOR RTSECS FD
  327. IFNE RTSECS?,WL-1,1 IF SEC FD NOT LEFT JUST.
  328. LX5 WL-1-RTSECS? LEFT JUST.
  329. BX5 X0*X5 SECOND FD ONLY
  330. SA4 TIMECFL TIME OF LAST OCFL CALL
  331. SA3 CTLSLWA OLD FL
  332. LX5 RTSECS$ RJ SECOND FD
  333. LX3 -6 OLD FL IN 100B MULTIPLE
  334. SA1 ST$FLT
  335. IX2 X5-X4
  336. BX7 X5
  337. DX6 X3*X2 (X6)=NIP OLD FL * ELAPSED TIME
  338. SA7 A4 UPDATE TIME OF LAST OCFL CALL
  339. IX6 X6+X1 ACC ST$FLT
  340. SA6 A1 UPDATE ST$FLT
  341. S4 ENDIF
  342.  
  343. EQ MSTAVFX
  344.  
  345. MSGERR VFD 60/MSGMFL
  346. BSSZ 1
  347. MSGMFL DATA L*MGETC/MAXFL REACHED. *
  348. XMGETC DATA L*MGETC*
  349. TEMP BSS 1
  350. TEMP2 BSSZ 1
  351. PARMA BSSZ 1
  352. TMP2A VFD 60/TEMP2
  353. END
cdc/nos2.source/nam5871/mgetc.txt ยท Last modified: 2023/08/05 17:22 by Site Administrator