Table of Contents

DMSTRK Source

References

Source Listing

DMSTRK.ASSEMBLE.txt
  1. TRK TITLE 'DMSTRK (CMS) VM/370 - RELEASE 6' 00001000
  2. SPACE 2 00002000
  3. *. 00003000
  4. * MODULE NAME: 00008000
  5. * 00009000
  6. * DMSTRK (TRKLKP) 00010000
  7. * 00011000
  8. * SUBROUTINE NAME: 00012000
  9. * 00013000
  10. * DMSTRK 00014000
  11. * 00015000
  12. * FUNCTION: 00016000
  13. * 00017000
  14. * TO ALLOCATE AN 800-BYTE DISK AREA TO A CALLING 00018000
  15. * PROGRAM. 00019000
  16. * 00020000
  17. * ATTRIBUTES: 00021000
  18. * 00022000
  19. * NUCLEUS RESIDENT, REENTRANT 00023000
  20. * 00024000
  21. * ENTRY POINTS: 00025000
  22. * 00026000
  23. * DMSTRKA 00027000
  24. * 00028000
  25. * ENTRY CONDITIONS: 00029000
  26. * 00030000
  27. * L R15, ADMSTRK WHERE ATRKLKP=V(DMSTRKA) 00031000
  28. * BALR R14, R15 00032000
  29. * 00033000
  30. * R1 MUST POINT TO ACTIVE DISK TABLE BLOCK 00034000
  31. * R13 MUST POINT TO A SAVE-AREA OF AT LEAST ELEVEN WORDS 00035000
  32. * 00036000
  33. * EXIT CONDITIONS: 00037000
  34. * 00038000
  35. * NORMAL RETURN 00039000
  36. * 00040000
  37. * R1 CONTAINS DISK-ADDRESS OF AVAILABLE 800-BYTE AREA 00041000
  38. * (SEE FIGURE 25 FOR FORMAT) 00042000
  39. * 00043000
  40. * R15 =0 (AND CONDITION-CODE =0) 00044000
  41. * 00045000
  42. * VERY FEW RECORDS LEFT (ERROR 4) -NONFATAL 00046000
  43. * 00047000
  44. * R1 CONTAINS DISK-ADDRESS OF AVAILABLE 800-BYTE AREA 00048000
  45. * (SAME AS ABOVE) 00049000
  46. * 00050000
  47. * R15=4 (AND CONDITION-CODE=2) 00051000
  48. * 00052000
  49. * ERROR BY CALLER (ERROR 2) 00053000
  50. * 00054000
  51. * R1 SAME AS AT ENTRY 00055000
  52. * R15=2 (AND CONDITION-CODE=2) 00056000
  53. * 00057000
  54. * CALLS TO OTHER ROUTINES: 00058000
  55. * 00059000
  56. * NONE 00060000
  57. * 00061000
  58. * EXTERNAL REFERENCES: 00062000
  59. * 00063000
  60. * ADTSECT 00064000
  61. * 00065000
  62. * TABLES/WORKAREAS: 00066000
  63. * 00067000
  64. * NONE. 00068000
  65. * 00069000
  66. * REGISTER USAGE: 00070000
  67. * 00071000
  68. * ADTSECT - R1 00072000
  69. * BASE - R11 00073000
  70. * REST - WORK 00074000
  71. * 00075000
  72. * OPERATION: 00076000
  73. * 00077000
  74. * NOTES: DMSTRKA CHECKS FOR ERRORS BY THE CALLER 00078000
  75. * AND AN ERROR 2 (WITH ERROR HALT FIRST) IS GIVEN IF 00079000
  76. * SUCH OCCURRED. 00080000
  77. * 00081000
  78. * DMSTRKA NOW REMEMEBERS (IN ADTIST) THE DISPLACEMENT 00082000
  79. * OF THE FIRST 00083000
  80. * FULLWORD IN THE QMSK THAT HAS A ZERO-BIT IN IT 00084000
  81. * ANYWHERE, TO 00085000
  82. * SPEED UP SEARCHES AFTER THE FIRST CALL TO DMSTRKA FOR 00086000
  83. * ANY DISK. (DMSTRKX OF COURSE MAINTAINS THIS WORD WHEN 00087000
  84. * RECORDS ARE 00088000
  85. * RETURNED.) 00089000
  86. * 00090000
  87. * WHEN THE NUMBER OF RECORDS REMAINING ON THE GIVEN 00091000
  88. * DISK NO LONGER EXCEEDS A RESERVE COUNT (ADTRES) THAT 00092000
  89. * IS MAINTAINED BY THE FILE SYSTEM, AN ERROR 4 00093000
  90. * (INDICATING VERY FEW RECORDS LEFT) IS RETURNED. 00094000
  91. * THIS FEATURE ENABLES DMSBWR OR DMSTQQ, ON THE ONE 00095000
  92. * HAND, TO RETURN THE RECORD VIA DMSTRKX AND INVOKE THE 00096000
  93. * DISK IS FULL LOGIC. WHILE DMSAUD, ON THE 00097000
  94. * OTHER HAND, CAN USE THE RECORD 00098000
  95. * FOR COMPLETING THE NEW USER FILE DIRECTORY. (THIS IS 00099000
  96. * PART OF CMS'S DOUBLE DIRECTORY SCHEME FOR MAXIMUM 00100000
  97. * FILE INTEGRITY.) 00101000
  98. * 00102000
  99. * MODULE NAME: 00103000
  100. * 00104000
  101. * DMSTRK 00105000
  102. * 00106000
  103. * SUBROUTINE NAME: 00107000
  104. * 00108000
  105. * DMSTRKX (TRKLKPX) 00109000
  106. * 00110000
  107. * FUNCTION: 00111000
  108. * 00112000
  109. * TO MAKE AN 800-BYTE DISK AREA THAT IS NO LONGER 00113000
  110. * NEEDED BY ONE PROGRAM AVAILABLE FOR ALLOCATION TO 00114000
  111. * ANOTHER. 00115000
  112. * 00116000
  113. * ATTRIBUTES: 00117000
  114. * 00118000
  115. * NUCLEUS RESIDENT, REENTRANT 00119000
  116. * 00120000
  117. * ENTRY POINTS: 00121000
  118. * 00122000
  119. * DMSTRKX 00123000
  120. * 00124000
  121. * ENTRY CONDITIONS: 00125000
  122. * 00126000
  123. * L R15, ADMSTRKX WHERE ATRKLKPX= V(DMSTRKX) 00127000
  124. * BALR R14, R15 00128000
  125. * 00129000
  126. * R0 (RIGHTMOST 16 BITS) MUST HOLD THE DISK ADDRESS 00130000
  127. * OF THE 00131000
  128. * 800-BYTE DISK AREA BEING RETURNED. (SEE FIGURE 00132000
  129. * 25 FOR FORMAT) 00133000
  130. * 00134000
  131. * R1 MUST POINT TO ACTIVE DISK TABLE BLOCK 00135000
  132. * R13 MUST POINT TO A SAVE-AREA OF AT LEAST ELEVEN 00136000
  133. * WORDS 00137000
  134. * 00138000
  135. * EXIT CONDITIONS: 00139000
  136. * 00140000
  137. * NORMAL RETURN 00141000
  138. * 00142000
  139. * R15=0 00143000
  140. * 00144000
  141. * ERROR BY CALLER _ERROR 2_ 00145000
  142. * 00146000
  143. * R15=2 (AND CONDITION-CODE = 2) 00147000
  144. * 00148000
  145. * OUT OF RANGE 800_BYTE AREA RETURNED _ERROR 5_ 00149000
  146. * 00150000
  147. * R15=5 (AND CONDITION-CODE=2) 00151000
  148. * 00152000
  149. * ALREADY CLEAR 800_BYTE AREA RETURNED _ERROR 6_ 00153000
  150. * 00154000
  151. * R15=6 (AND CONDITION-DOCE=2) 00155000
  152. * 00156000
  153. * CALLS TO OTHER ROUTINES: 00157000
  154. * 00158000
  155. * NONE 00159000
  156. * 00160000
  157. * EXTERNAL REFERENCES: 00161000
  158. * 00162000
  159. * ADTSECT 00163000
  160. * 00164000
  161. * TABLES WORKAREAS: 00165000
  162. * 00166000
  163. * NONE. 00167000
  164. * 00168000
  165. * REGISTER USAGE: 00169000
  166. * 00170000
  167. * R15 - BASE 00171000
  168. * R1 - ADTSECT 00172000
  169. * REST - WORK 00173000
  170. * 00174000
  171. * OPERATION: 00175000
  172. * 00176000
  173. * NOTES: DMSTRKX CHECKS, AS DOES DMSTRKA, FOR 00177000
  174. * ERRORS BY THE CALLER, AND AN ERROR 2 (WITH ERROR HALT 00178000
  175. * FIRST) IS GIVEN IF SUCH AN ERROR OCCURRED. 00179000
  176. * 00180000
  177. * DMSTRKX NOW MAINTAINS (IN ADTIST) THE DISPLACEMENT OF 00181000
  178. * THE 00182000
  179. * FIRST FULL WORD IN THE XMSK THAT HAS A ZERO-BIT IN IT 00183000
  180. * ANYWHWERE (THIS BEING USED BY DMSTRKX FOR SPEEDING UP 00184000
  181. * THE 00185000
  182. * SEARCH OF THE QMSK TABLE). 00186000
  183. * 00187000
  184. * DMSTRKX IS AN ENTRY-POINT IN THE DMSTRK ROUTINE. 00188000
  185. * 00189000
  186. *. 00190000
  187. EJECT 00191000
  188. TRKLKP START 0 00192000
  189. SPACE 00193000
  190. ENTRY DMSTRK P3035 00194000
  191. DMSTRK EQU TRKLKP P3035 00195000
  192. ENTRY DMSTRKX P3035 00196000
  193. ENTRY TRKLKPX 00197000
  194. SPACE 00198000
  195. * 00199000
  196. * ENTER 'TRKLKP' HERE ... 00200000
  197. USING TRKLKP,R11 00201000
  198. STM R2,R12,0(R13) SAVE 11 REGISTERS 00202000
  199. LR R11,R15 ADDRESSABILITY IN R11 NOW 00203000
  200. LA R15,TRKLKPX COMMON ADDRESSABILITY FOR SUBROUTINE, 00204000
  201. BAL R2,TRKSUB CALL INITIALIZING SUBROUTINE 00205000
  202. USING ADTSECT,R1 REFERENCE ALL QUANTITIES BY R1 NOW 00206000
  203. * NOTE ... 00207000
  204. * R3 AND R12 POINT TO BIT-MASK (PQMSK) 00208000
  205. * R6 = DISP. OF 1ST WORD WITH 'HOLE' IN IT 00209000
  206. * R7 = NUMTRKS = TOTAL NO. OF QTR-TRKS ON P- OR T-DISK 00210000
  207. * R8 = QTUSEDP = NO. OF QTR-TRKS IN USE 00211000
  208. * R9 = QTLEFTP = NO. OF QTR-TRKS LEFT 00212000
  209. * R10 = LASTRK = RELATIVE BYTE-ADDRESS OF LAST QTR-TRK 00213000
  210. * COMES HERE IF WE HAVE A BONA-FIDE READ-WRITE DISK: 00214000
  211. LA R4,4 BYTE INCREMENT (ONE FULL WORD) FOR LOOP 00215000
  212. LR R5,R7 OBTAIN TOTAL NUMBER OF BITS, 00216000
  213. LA R5,7(,R5) ROUND BEFORE CONVERTING ... @VA03452 00216100
  214. SRA R5,3 CHANGE TO BYTES, 00217000
  215. BCTR R5,0 SUBTRACT ONE FOR BXLE, NOW HAVE 'LENGTH' 00218000
  216. AR R5,R3 ADD STARTING-ADDRESS, 'LIMIT' ALL SET NOW 00219000
  217. LA R15,BLANK FOR BRANCHING 00220000
  218. SR R2,R2 WORD OF ALL ONES 00221000
  219. BCTR R2,0 (-1) INTO R2 00222000
  220. AR R3,R6 ADJUST R3 TO START WITH 1ST NONZERO WORD 00223000
  221. AGAIN CL R2,0(,R3) COMPARE G.P. 2 WITH NEXT MASK WORD 00224000
  222. BCR 7,R15 BLANK FOUND, GO TO BLANK 00225000
  223. BXLE R3,R4,AGAIN NO BLANK IN THAT WORD 00226000
  224. ERROR1 LM R2,R12,0(R13) RESTORE NECESSARY REGISTERS 00227000
  225. LA R15,1 ERROR NUMBER 1 00228000
  226. BR R14 AND RETURN (ERROR CODE 1) 00229000
  227. * 00230000
  228. BLANK LR R6,R3 COMPUTE NEW VALUE OF 'ADT1ST' 00231000
  229. SR R6,R12 (WILL STORE LATER) 00232000
  230. LA R4,1 BYTE INCREMENT OF ONE NOW, 00233000
  231. AGAINB TM 0(R3),X'FF' IS BLANK IN THIS BYTE 00234000
  232. BC 12,BLANKB G.P. 3 POINTS TO BYTE WITH BLANK 00235000
  233. BXLE R3,R4,AGAINB UPDATE G.P. 3, TRY AGAIN 00236000
  234. B ERROR1 ERROR IF DROPS THRU BXLE 00237000
  235. BLANKB LR R2,R3 LOAD 2 WITH ADDRESS OF BYTE 00238000
  236. SR R2,R12 GIVES NUMBER OF BYTES SCANNED 00239000
  237. * 00240000
  238. CR R2,R10 SEE IF THIS EXCEEDS OLD 'LASTRK' 00241000
  239. BNH UPD89 BNH IF NOT A 'NEW HIGH'. 00242000
  240. LR R10,R2 STORE NEW 'LASTRK' IF R2 WAS LARGER. 00243000
  241. UPD89 AR R8,R4 UPDATE R8 = NO. TRACKS IN USE (R4 WAS 1) 00244000
  242. LR R9,R7 COMPUTE HOW MANY 00245000
  243. SR R9,R8 TRACKS (IF ANY) ARE LEFT 00246000
  244. BM ERROR1 ERROR 1 IF NEGATIVE (NONE LEFT) @VA03452 00246100
  245. STM R6,R10,ADT1ST STORE ALL UPDATED DISK COUNTERS 00247000
  246. * 00248000
  247. SLL R2,3 LET R2 = BIT-COUNT (FROM BYTE-COUNT) 00249000
  248. IC R4,0(,R3) OBTAIN THE BYTE WITH THE 'BLANK' IN IT, 00250000
  249. TM 0(R3),X'F0' IS THE LEFT HALF ALL ONES ? 00251000
  250. BNO TRK01 BNO IF NOT (BLANK IS IN LEFT HALF) 00252000
  251. LA R5,4 IF BLANK IN RIGHT HALF, LET R5=4, 00253000
  252. N R4,=X'0000000F' ISOLATE RIGHTMOST FOUR BITS 00254000
  253. B TRK02 JOIN CODE BELOW. 00255000
  254. TRK01 SR R5,R5 IF BLANK IN LEFT HALF, CLEAR R5, 00256000
  255. SRL R4,4 POSITION R4 TO RIGHTMOST 4 BITS, 00257000
  256. TRK02 IC R4,TRKTBL(R4) PICK UP NUMBER FROM TABLE (0 TO 3) 00258000
  257. AR R4,R5 ADD 0 OR 4 FOR LEFT OR RIGHT HALF, 00259000
  258. AR R2,R4 R2 NOW HOLDS 'BLOCK NUMBER' FROM 0 UP. 00260000
  259. LA R5,X'80' SET R5 TO THE BIT WE 00261000
  260. SRL R5,0(R4) SHOULD 'OR' INTO THE BIT-TABLE, 00262000
  261. IC R4,0(,R3) OBTAIN THE OLD BYTE FROM THE TABLE, 00263000
  262. OR R4,R5 'OR' IN THE PROPER NEW BIT, 00264000
  263. STC R4,0(,R3) AND REPLACE THE BYTE. 00265000
  264. SR R15,R15 CLEAR ERROR CODE 00266000
  265. CH R9,ADTRES IS NO. LEFT > RESRVCNT ? 00267000
  266. BH ENUF BH IF ENOUGH LEFT, NO PROBLEM 00268000
  267. LA R15,4 SET ERROR CODE 4 IF 'FEW' LEFT 00269000
  268. ENUF LA R1,1(,R2) BLOCK NUMBER (FROM 1 UP) INTO R1 00270000
  269. LM R2,R12,0(R13) RESTORE NECESSARY REGISTERS 00271000
  270. LTR R15,R15 SET CONDITION-CODE FOR CONVENIENCE OF CALLER 00272000
  271. BR R14 RETURN 00273000
  272. * 00274000
  273. DROP R11 00275000
  274. DROP R1 00276000
  275. EJECT 00277000
  276. ********************************************************************** 00278000
  277. * 00279000
  278. * TRKLKPX - UNALLOCATE 1/4 TRACKS FROM DISK 00280000
  279. * 00281000
  280. ********************************************************************** 00282000
  281. * 00283000
  282. * 00284000
  283. USING *,R15 00285000
  284. TRKLKPX STM R2,R12,0(R13) SAVE 11 REGISTERS 00286000
  285. DMSTRKX EQU TRKLKPX P3035 00287000
  286. BAL R2,TRKSUB CALL INITIALIZING SUBROUTINE 00288000
  287. USING ADTSECT,R1 REFERENCE ALL QUANTITIES BY R1 NOW 00289000
  288. C R0,MINLEGAL BLK NO. MINUS, 0, OR BELOW MFD ? @VA01100 00289100
  289. BNH ERROR5 'OUT OF RANGE' IF NOT ABOVE MFD @VA01100 00289200
  290. LR R3,R0 SET UP R3 FOR 00290000
  291. BCTR R3,0 BLOCK-NUMBER-LESS-1. 00291000
  292. LR R4,R3 DETERMINE WORD 00292000
  293. SRA R4,3 AND BIT LOCATION WITHIN WORD 00293000
  294. LR R2,R4 SAVE R4 = RELATIVE BYTE-ADDRESS FOR LATER 00294000
  295. CR R2,R10 MAKE SURE WITHIN PQMSK RANGE 00295000
  296. BH ERROR5 BH IF 'OUT OF RANGE', ERROR NO. 5. 00296000
  297. N R4,=X'FFFFFFFC' LOCATION OF CORRECT WORD 00297000
  298. N R3,=X'0000001F' BIT LOCATION WITHIN WORD 00298000
  299. L R5,=X'80000000' BIT 0 00299000
  300. SRL R5,0(R3) SHIFT CORRECT NO. OF PLACES 00300000
  301. CR R4,R6 ARE WE BELOW OLD 'ADT1ST' ? 00301000
  302. BNL R6OK BNL IF NOT. 00302000
  303. LR R6,R4 NEW DISPLACEMENT 1ST WORD WITH HOLE 00303000
  304. R6OK N R5,0(R12,R4) SEE IF BIT IN PQMSK IS ALREADY 0 (ERROR) 00304000
  305. BZ ERROR6 BZ IF YES, ALREADY-CLEAR, ERROR 6. 00305000
  306. X R5,0(R12,R4) REMOVE BIT FROM MASK 00306000
  307. ST R5,0(R12,R4) STORE NEW WORD WITH BIT MASKED OUT. 00307000
  308. CR R2,R10 SEE IF THIS BYTE MATCHES 'LASTRK' 00308000
  309. BL R10OK FORGET IT IF LESS. 00309000
  310. AR R10,R12 IF =, ADD BASE-ADDRESS (FOR 'TM') 00310000
  311. LA R2,TMLOOP FOR 'BCTR' BELOW 00311000
  312. LA R3,SUB10 FOR 'BNZ' BELOW 00312000
  313. TMLOOP TM 0(R10),X'FF' CHECK BYTE AT HIGHEST ADDRESS 00313000
  314. BCR 7,R3 'BNZ TO SUB10' IF NOT ALL ZERO. 00314000
  315. BCTR R10,R2 DECREMENT R10 AND ITERATE TMLOOP. 00315000
  316. SUB10 SR R10,R12 MAKE R10 'RELATIVE' AGAIN (AFTER 'TM') 00316000
  317. R10OK BCTR R8,0 DECREMENT NO. QTR-TRKS IN USE, 00317000
  318. LR R9,R7 COMPUTE NEW 'NO. TRKS LEFT' 00318000
  319. SR R9,R8 ... 00319000
  320. STM R6,R10,ADT1ST STORE ALL UPDATED DISK COUNTERS 00320000
  321. LM R2,R12,0(R13) RESTORE NECESSARY REGISTERS 00321000
  322. SR R15,R15 INDICATE NO ERROR 00322000
  323. BR R14 RETURN TO CALLER 00323000
  324. EJECT 00324000
  325. TRKSUB LTR R1,R1 CHECK P-LIST 00325000
  326. BNP ERROR2 ERROR IF NOT PLUS AND NONZERO 00326000
  327. TM ADTFLG1,ADTFRW MUST BE A READ-WRITE DISK 00327000
  328. BZ ERROR2 ERROR IF NOT 00328000
  329. TM ADTFLG2,ADTFMFD AND MFD MUST BE IN CORE 00329000
  330. BZ ERROR2 ERROR IF NOT 00330000
  331. LM R6,R10,ADT1ST DISK COUNTERS INTO R6 THRU R10 00331000
  332. L R3,ADTMSK ADDRESS OF BIT-MASK INTO R3 00332000
  333. LTR R12,R3 ALSO INTO R12, AND CHECK IT 00333000
  334. BCR 7,R2 OK IF PRESENT, RETURN VIA R2 TO CALLER. 00334000
  335. * 00335000
  336. ERROR2 LM R2,R12,0(R13) ERROR 2 IF PARAMETER-LIST ERROR 00336000
  337. LA R15,2 OR DISK NOT THERE, ETC. 00337000
  338. LTR R15,R15 SET CONDITION-CODE FOR CONVENIENCE OF CALLER 00339000
  339. BR R14 00340000
  340. SPACE 2 00341000
  341. ERROR5 LM R2,R12,0(R13) 'OUT-OF-RANGE' QTR-TRACK RETURNED 00342000
  342. LA R15,5 ERROR NO. 5 00343000
  343. LTR R15,R15 SET CONDITION-CODE FOR CONVENIENCE OF CALLER 00344000
  344. BR R14 (NEW 7 NOVEMBER 1967 -- JAS) 00345000
  345. * 00346000
  346. ERROR6 LM R2,R12,0(R13) 'ALREADY CLEAR' QTR-TRACK RETURNED 00347000
  347. LA R15,6 ERROR NO. 6 00348000
  348. LTR R15,R15 SET CONDITION-CODE FOR CONVENIENCE OF CALLER 00349000
  349. BR R14 (NEW 7 NOVEMBER 1967 -- JAS) 00350000
  350. EJECT 00351000
  351. ********************************************************************** 00352000
  352. * 00353000
  353. * STORAGE AND DEFINITIONS 00354000
  354. * 00355000
  355. ********************************************************************** 00356000
  356. * 00357000
  357. PRINT DATA 00358000
  358. MINLEGAL DC F'4' BLOCK NUMBER OF "MFD" @VA01100 00358100
  359. TRKTBL DC 8AL1(0),4AL1(1),2AL1(2),1AL1(3) 00359000
  360. * 00360000
  361. * DEFINITIONS ... 00361000
  362. REGEQU 00362000
  363. EJECT 00363000
  364. ADT 00364000
  365. END 00365000