Table of Contents

DMSCIO Source

References

Source Listing

DMSCIO.ASSEMBLE.txt
  1. CIO TITLE 'DMSCIO (CMS) VM/370 - RELEASE 6' 00001000
  2. SPACE 2 00002000
  3. *. 00003000
  4. * MODULE NAME: DMSCIO (ALSO KNOWN AS CARDIO) 00004000
  5. * 00005000
  6. * FUNCTION: TO PERFORM READER/PUNCH I/O OPERATIONS 00006000
  7. * 00007000
  8. * ATTRIBUTES: NUCLEUS RESIDENT, REENTRANT 00008000
  9. * 00009000
  10. * ENTRY POINTS: DMSCIOR(CARDRD) - READ ONE CARD RECORD 00010000
  11. * DMSCIOP(CARDPH) - PUNCH ONE CARD RECORD 00011000
  12. * DMSCIOSI - PUNCH CALLER'S BUFFER 00012000
  13. * 00013000
  14. * ENTRY CONDITIONS: UPON ENTRY, R1 POINTS TO A PARAMETER LIST IN 00014000
  15. * THE FOLLOWING FORMAT: 00015000
  16. * DS 0F 00016000
  17. * PLIST DC CL8'ENTRYPOINTNAME' 00017000
  18. * DC XL1 - '00' = READ 80 BYTES 00018000
  19. * '80' = READ NUMBER OF BYTES SPECIFIED 00019000
  20. * (IF PUNCHING, FIELD IS IMMATERIAL) 00020000
  21. * DC AL3(BUFFER) 00021000
  22. * DC H'NUMBER OF BYTES TO READ' 00022000
  23. * DC H'NUMBER OF BYTES ACTUALLY READ' 00023000
  24. * 00024000
  25. * EXIT CONDITIONS: AT EXIT, R15 CONTAINS ONE OF THE FOLLOWING CODES: 00025000
  26. * CODE MEANING 00026000
  27. * 0 NO ERROR - NORMAL COMPLETION 00027000
  28. * 1 END-OF-FILE ON READER 00028000
  29. * 2 INTERVENTION REQUIRED ON READER (MAY MEAN RDR EMPTY) 00029000
  30. * 3 UNKNOWN ERROR 00030000
  31. * 5 INCORRECT LENGTH (IF READING OTHER THAN 80, ACTUAL 00031000
  32. * NUMBER READ SET IN PLIST) 00032000
  33. * 100 DEVICE NOT ATTACHED OR INTERVENTION REQUIRED ON PUNCH 00033000
  34. * 00034000
  35. * CALLS TO OTHER ROUTINES: DMSIOW - WAIT FOR INTERRUPT 00035000
  36. * DMSERR - PROCESS ERROR MESSAGES 00036000
  37. * 00037000
  38. * EXTERNAL REFERENCES: NUCON 00038000
  39. * 00039000
  40. * TABLES/WORKAREAS: R13 AREA PROVIDED BY DMSITS 00040000
  41. * (USED WITH CDSECT DSECT) 00041000
  42. * 00042000
  43. * REGISTER USAGE: 00043000
  44. * R1 PLIST POINTER AT ENTRY 00044000
  45. * R2 PLIST POINTER SAVE 00045000
  46. * R4 READ BYTE COUNT OR 0 (WHICH INDICATES PUNCHING) 00046000
  47. * R5 READER OR PUNCH DEVICE ADDRESS 00047000
  48. * R10 RETURN ADDRESS SAVE 00048000
  49. * R11 BASE IN CALLER'S BUFFER OR 0 (WHICH MEANS PUNCHING ONE 00049000
  50. * CARD RECORD) 00050000
  51. * R12 BASE REG IN CODE 00051000
  52. * R13 BASE REG IN CDSECT 00052000
  53. * R14 RETURN REG AT ENTRY 00053000
  54. * R15 A(WAIT) OR RETURN CODE 00054000
  55. * 00055000
  56. EJECT 00056000
  57. * NOTES: TO USE ENTRY POINT DMSCIOSI, THE CALLER MUST PROVIDE A 00057000
  58. * 4096-BYTE BUFFER ON A PAGE BOUNDARY. THE BUFFER MUST 00058000
  59. * BE IN THE FOLLOWING FORMAT: 00059000
  60. * 00060000
  61. * PAGE BOUNDARY +--------+--------+ 00061000
  62. * | BUFCTR | BATCTR | 00062000
  63. * +8 +--------+--------+ 00063000
  64. * | | | 00064000
  65. * +16 +--------+--------+ 00065000
  66. * | BUFDATA | 00066000
  67. * | | 00067000
  68. * | | 00068000
  69. * | (ETC.) | 00069000
  70. * 00070000
  71. * WHERE 'BUFCTR' IS A FULLWORD CONTAINING THE ADDRESS OF THE 00071000
  72. * NEXT AVAILABLE LOCATION IN THE BUFFER, AND 'BUFDATA' IS 00072000
  73. * THE FIRST DATA LOCATION, AND BATCTR IS A FULLWORD USED 00073000
  74. * FOR CMS BATCH ACCOUNTING. 00074000
  75. * 00075000
  76. * WHEN DMSCIOSI IS CALLED, THE DATA PORTION OF THE 00076000
  77. * BUFFER SHOULD CONTAIN CHAINED PUNCH CCWS, TIC CCWS, 00077000
  78. * AND THE DATA TO BE PUNCHED. FOR EFFICIENCY, THE 00078000
  79. * LAST ENTRY IN THE BUFFER SHOULD BE A NOP CCW. 00079000
  80. * 00080000
  81. * OPERATION: 00081000
  82. * 00082000
  83. * DMSCIOR(CARDRD) - 00083000
  84. * 1. IF NUMBER OF BYTES TO READ IS GIVEN, SET R4 WITH THIS 00084000
  85. * NUMBER. OTHERWISE, SET R4 TO 80. 00085000
  86. * 2. SET R5 TO READER DEVICE ADDRESS. 00086000
  87. * 3. GO TO 11. 00087000
  88. * 00088000
  89. * DMSCIOP(CARDPH) - 00089000
  90. * 4. ZERO R4 TO INDICATE WE ARE PUNCHING. 00090000
  91. * 5. SET R5 TO PUNCH DEVICE ADDRESS. 00091000
  92. * 6. GO TO 11. 00092000
  93. * 00093000
  94. * DMSCIOSI - 00094000
  95. * 7. ZERO R4 TO INDICATE WE ARE PUNCHING. 00095000
  96. * 8. SET R5 TO PUNCH DEVICE ADDRESS. 00096000
  97. * 9. SET R11 TO ADDRESS OF CALLER'S BUFFER. 00097000
  98. * 10. GO TO 13. 00098000
  99. * 00099000
  100. * SINGLE CARD SETUP ROUTINE - 00100000
  101. * 11. ZERO R11 TO INDICATE READING OR PUNCHING 1 CARD RECORD. 00101000
  102. * 12. BUILD CCWS IN R13 AREA TO READ OR PUNCH ONE CARD. 00102000
  103. * 00103000
  104. * I/O ROUTINE - 00104000
  105. * 13. ISSUE START I/O. 00105000
  106. * 14. CALL DMSIOW(WAIT) TO WAIT FOR INTERRUPT. 00106000
  107. * 15. ANALYZE STATUS AND, IF NECESSARY, SENSE INFORMATION. 00107000
  108. * 16. RETURN TO CALLER WITH APPROPRIATE RETURN CODE. 00108000
  109. *. 00109000
  110. ********************************************************************** 00110000
  111. EJECT 00111000
  112. ********************************************************************** 00112000
  113. * 00113000
  114. * ENTRY POINTS 00114000
  115. * 00115000
  116. ********************************************************************** 00116000
  117. SPACE 1 00117000
  118. DMSCIO START 0 00118000
  119. ENTRY DMSCIOR,CARDRD 00119000
  120. DMSCIOR EQU DMSCIO 00120000
  121. CARDRD EQU DMSCIO 00121000
  122. LR R12,R15 ESTABLISH ADDRESSABILITY 00122000
  123. USING DMSCIO,R12 ... 00123000
  124. USING NUCON,R0 00124000
  125. USING CDSECT,R13 00125000
  126. LA R5,12 ASSUME DEVICE '00C' FOR READER 00126000
  127. LA R4,80 SET DEFAULT FOR RDR BYTE COUNT 00127000
  128. TM 8(R1),X'80' EXTENDED PLIST GIVEN? 00128000
  129. BZ JOIN NO, READ 80 BYTES 00129000
  130. LH R4,12(,R1) YES, LOAD GIVEN BYTE COUNT 00130000
  131. LTR R4,R4 AND MAKE SURE IT IS NOT ZERO 00131000
  132. BZ NORMRET0 IF SO RETURN - ZERO BYTES ALREADY READ 00132000
  133. B JOIN 00133000
  134. SPACE 1 00134000
  135. ENTRY DMSCIOP,CARDPH 00135000
  136. DMSCIOP EQU * 00136000
  137. CARDPH EQU DMSCIOP 00137000
  138. LR R12,R15 GET SAME ADDRESSABILITY AS ABOVE 00138000
  139. LA R15,DMSCIOP-DMSCIO ... 00139000
  140. SR R12,R15 NOW IT IS CORRECT 00140000
  141. LA R5,13 ASSUME DEVICE '00D' FOR PUNCH 00141000
  142. SR R4,R4 ZERO R4 TO INDICATE PUNCHING 00142000
  143. B JOIN 00143000
  144. SPACE 1 00144000
  145. ENTRY DMSCIOSI 00145000
  146. DMSCIOSI EQU * 00146000
  147. LR R12,R15 GET SAME ADDRESSABILITY AS ABOVE 00147000
  148. LA R15,DMSCIOSI-DMSCIO 00148000
  149. SR R12,R15 NOW IT IS CORRECT 00149000
  150. LR R10,R14 SAVE RETURN ADDRESS 00150000
  151. LA R5,13 ASSUME DEVICE '00D' FOR PUNCH 00151000
  152. LR R2,R1 SAVE PLIST POINTER IN R2 00152000
  153. SR R4,R4 ZERO R4 TO INDICATE PUNCHING 00153000
  154. L R11,8(,R2) ADDRESS OF BUFFER IN R11 00154000
  155. USING BUFSECT,R11 00155000
  156. LA R3,BUFDATA ADDRESS OF START OF CCW CHAIN 00156000
  157. B IOGO GO START PUNCHING 00157000
  158. SPACE 1 00158000
  159. JOIN EQU * 00159000
  160. SR R11,R11 ZERO R11 TO INDICATE NONBUFFER OPERATION 00160000
  161. LR R10,R14 SAVE RETURN ADDRESS IN R10 00161000
  162. LR R2,R1 SAVE PLIST POINTER IN R2 00162000
  163. MVC CDCCWS(16),DUCCWS INITIALIZE CCWS IN WORK AREA 00163000
  164. LTR R4,R4 PUNCHING? 00164000
  165. BZ CCWOK IF SO, DEFAULT PUNCH CCW IS OK 00165000
  166. MVI CDCCWS,X'42' INSERT READ COMMAND 00166000
  167. STCM R4,7,CDCCWS+5 AND READ BYTE COUNT 00167000
  168. CCWOK MVC CDCCWS+1(3),9(R2) INSERT DATA ADDRESS INTO CCW 00168000
  169. LA R3,CDCCWS GET CCW ADDRESS IN R3 00169000
  170. B IOGO 00170000
  171. EJECT 00171000
  172. ********************************************************************** 00172000
  173. * 00173000
  174. * I/O ROUTINE. R3= CCW ADDRESS 00174000
  175. * R5= DEVICE ADDRESS 00175000
  176. * R11= ZERO MEANS PUNCHING 1 CARD OR READ 00176000
  177. * R11 NOT ZERO MEANS PUNCHING CALLER'S BUFFER 00177000
  178. * R4= ZERO MEANS PUNCHING 00178000
  179. * R4 NOT ZERO MEANS READING 00179000
  180. * 00180000
  181. * IF NOT ZERO, R11 IS BASE REG IN CALLER'S BUFFER 00181000
  182. * IF NOT ZERO, R4 CONTAINS THE READ BYTE COUNT 00182000
  183. * 00183000
  184. ********************************************************************** 00184000
  185. SPACE 1 00185000
  186. IOGO EQU * 00186000
  187. MVC CDWAITP(20),DUWAITP INITIALIZE WAIT PLIST IN WORK AREA 00187000
  188. LTR R4,R4 PUNCHING? 00188000
  189. BZ WPOK IF SO, WAIT PLIST OK 00189000
  190. MVC CDWAITP+8(4),WTRDR CHANGE PLIST FOR RDR1 00190000
  191. WPOK LA R1,CDWAITP ADDRESS OF WAIT PLIST IN R1 00191000
  192. SPACE 1 00192000
  193. SIO ST R3,CAW STORE ADDRESS OF CCWS IN CAW 00193000
  194. SIO 0(R5) ISSUE START I/O 00194000
  195. BC 8,IOWAIT BRANCH IF SUCCESSFULLY STARTED 00195000
  196. BC 4,CSWSTOR CC1 - CSW STORED 00196000
  197. BC 2,BUSY CC2 - BUSY 00197000
  198. B ERR113S CC3 - NOT OPERATIONAL 00198000
  199. SPACE 1 00199000
  200. IOWAIT EQU * 00200000
  201. L R15,=V(WAIT) ADDRESS OF WAIT ROUTINE 00201000
  202. BALR R14,R15 WAIT FOR INTERRUPT 00202000
  203. MVC CDCSW(8),CSW MOVE IT TO SAVE AREA 00203000
  204. TM CDSTAT,X'08' CHANNEL END? @VA13022 00203300
  205. BNO IOWAIT GO BACK AND WAIT FOR IT @VA13022 00203600
  206. TM CDSTAT+1,X'40' INCORRECT LENGTH? 00204000
  207. BZ NOWLR NO 00205000
  208. TM 8(R2),X'80' EXTENDED PLIST GIVEN? 00206000
  209. BZ ERROR5 NO, RETURN ERROR ONLY 00207000
  210. LH R7,CDCCWS+6 CCW BYTE COUNT... 00208000
  211. SH R7,CDCSW+6 ...LESS RESIDUAL COUNT... 00209000
  212. STH R7,14(,R2) ...EQUALS BYTES ACTUALLY READ 00210000
  213. ERROR5 TIO 0(R5) CLEAR ANY PENDING DE 00211000
  214. BNZ ERROR5 ... 00212000
  215. LA R15,5 RETURN CODE 5 - INCORRECT LENGTH 00213000
  216. B ERRET 00214000
  217. SPACE 1 00215000
  218. NOWLR TM CDSTAT,X'02' HAVE WE UNIT CHECK? 00216000
  219. BO FEEL CHECK SENSE INFO 00217000
  220. TM CDSTAT+1,X'3F' ANY UNEXPECTED ERROR? 00218000
  221. BZ NORMRET NO, ALL DONE 00219000
  222. SPACE 1 00220000
  223. ERROR3 LA R15,3 RETURN CODE 3 - UNKNOWN ERROR 00221000
  224. B ERRET 00222000
  225. SPACE 1 00223000
  226. CSWSTOR MVC CDSTAT(2),CSW+4 SAVE STORED CSW (BYTES 4,5 ONLY) 00224000
  227. TM CDSTAT,X'02' HAVE WE UNIT CHECK? 00225000
  228. BO FEEL CHECK SENSE INFO 00226000
  229. TM CDSTAT,X'0C' NICE CE+DE? (AS FROM NOP) 00227000
  230. BO NORMRET0 IF SO, WE ARE DONE, NO CARDS PUNCHED 00228000
  231. TM CDSTAT,X'01' HAVE WE END OF FILE? 00229000
  232. BZ MAYRETRY SEE IF WE CAN TRY IT AGAIN @VA03450 00230100
  233. SPACE 1 00231000
  234. ERROR1 LA R15,1 RETURN CODE 1 - END OF FILE 00232000
  235. B ERRET 00233000
  236. MAYRETRY TM CSW+4,BUSYBIT+DE @VA03450 00233300
  237. BO SIO TRY IT AGAIN @VA03450 00233600
  238. B ERROR3 UNKNOWN ERROR @VA03450 00233900
  239. SPACE 1 00234000
  240. BUSY LA R14,SIO SET RETURN ADDRESS TO RETRY SIO 00235000
  241. L R15,=V(WAIT) ADDRESS OF WAIT ROUTINE 00236000
  242. BR R15 WAIT FOR INTERRUPT 00237000
  243. SPACE 1 00238000
  244. FEEL LA R15,CDSNCCW INITIALIZE SENSE CCWS IN WORK AREA 00239000
  245. MVC 0(16,R15),DUSNCCW ... 00240000
  246. ST R15,CAW 00241000
  247. LA R15,CDSENFO ADDRESS FOR SENSE BYTES 00242000
  248. STCM R15,7,CDSNCCW+1 INSERT ADDRESS INTO CCW 00243000
  249. SENSIO SIO 0(R5) START THE SENSE OPERATION @VA02086 00244100
  250. BC 4,SENSNOGO CC=1, CSW STORED, CHECK BUSY @VA02086 00245100
  251. TIO 0(R5) 00246000
  252. BC 2,*-4 00247000
  253. TM CDSENFO,X'40' INTERVENTION REQUIRED? 00248000
  254. BZ ERROR3 IF NOT, GIVE UP 00249000
  255. LTR R4,R4 ARE WE PUNCHING? 00250000
  256. BZ ERR145S PROCESS ERROR MESSAGE 00251000
  257. ERROR2 LA R15,2 RETURN CODE 2 - INT REQ ON RDR 00252000
  258. B ERRET 00253000
  259. SENSNOGO TM CSW+4,BUSYBIT+DE BUSY, STATUS WAS PENDING @VA02086 00253050
  260. BO SIO WE MAY BE ABLE TO RESTART @VA02086 00253100
  261. B SENSIO @VA02086 00253150
  262. SPACE 3 @VA02086 00253200
  263. BUSYBIT EQU X'10' NEW OPERATION NOT STARTED @VA02086 00253250
  264. * BECAUSE THE CHANNEL HAD STATUS @VA02086 00253300
  265. * TO PRESENT @VA02086 00253350
  266. DE EQU X'04' DEVICE END @VA02086 00253400
  267. EJECT 00254000
  268. ********************************************************************** 00255000
  269. * 00256000
  270. * ERROR MESSAGES 00257000
  271. * 00258000
  272. ********************************************************************** 00259000
  273. SPACE 1 00260000
  274. ERR113S LA R7,113 ERROR MESSAGE NUMBER 00261000
  275. LA R3,NATT TEXT ADDRESS 00262000
  276. B ERRGO 00263000
  277. SPACE 1 00264000
  278. ERR145S LA R7,145 ERROR MESSAGE NUMBER 00265000
  279. LA R3,INT TEXT ADDRESS 00266000
  280. B ERRGO 00267000
  281. SPACE 1 00268000
  282. ERRGO LA R8,PUNCHMS SET FOR PUNCH MESSAGE 00269000
  283. LTR R4,R4 ...WHICH IS OK IF 00270000
  284. BZ ERRMSG ...WE ARE PUNCHING 00271000
  285. LA R8,READMS ...BUT IF NOT, CHANGE FOR RDR MESSAGE 00272000
  286. ERRMSG DMSERR MF=(E,'SYS'),LET=S,NUM=(7),TEXTA=(3),SUB=(CHARA,(8)) 00273000
  287. LA R15,100 RETURN CODE 100 - MESSAGE GIVEN BY CIO 00274000
  288. B ERRET0 00275000
  289. SPACE 1 00276000
  290. NATT DC AL1(L'NATTMS) 00277000
  291. NATTMS DC C'...... NOT ATTACHED' 00278000
  292. SPACE 1 00279000
  293. INT DC AL1(L'INTMS) 00280000
  294. INTMS DC C'INTERVENTION REQUIRED ON ......' 00281000
  295. SPACE 1 00282000
  296. READMS DC C'READER' 00283000
  297. PUNCHMS DC C'PUNCH ' 00284000
  298. DS 0H 00285000
  299. EJECT 00286000
  300. ********************************************************************** 00287000
  301. * 00288000
  302. * RETURNS 00289000
  303. * 00290000
  304. ********************************************************************** 00291000
  305. SPACE 1 00292000
  306. NORMRET0 LA R4,1 MAKE R4 NONZERO 00293000
  307. NORMRET SR R15,R15 RETURN CODE ZERO - NORMAL COMPLETION 00294000
  308. ERRET LTR R4,R4 PUNCHING? 00295000
  309. BNZ ERRET0 IF NOT, SKIP BATCH TEST 00296000
  310. TM BATFLAGS,BATRUN+BATNOEX IS BATCH RUNNING? 00297000
  311. BM BATTERUP BRANCH IF SO 00298000
  312. ERRET0 LR R14,R10 RESTORE RETURN ADDRESS 00299000
  313. BR R14 RETURN 00300000
  314. SPACE 1 00301000
  315. BATTERUP L R6,ABATLIMT ADDRESSABILITY IN BATCH LIMIT AREA 00302000
  316. USING BATLSECT,R6 ... 00303000
  317. LH R7,BATPUNC CURRENT PUNCH CARD COUNT 00304000
  318. LA R8,1 CARD COUNT THIS PUNCHING 00305000
  319. LTR R11,R11 ...IF NOT PUNCHING BUFFER 00306000
  320. BZ BATIK 00307000
  321. L R8,BATCTR CARD COUNT IF PUNCHING BUFFER 00308000
  322. BATIK AR R7,R8 UPDATE TOTAL CARD COUNT 00309000
  323. LH R8,BATPUNL GET LIMIT AS A FULLWORD 00310000
  324. CR R7,R8 ARE WE OVER THE LIMIT? 00311000
  325. BNH BATHOS NO, UPDATE BATCH'S TOTAL,RETURN 00312000
  326. OI BATFLAGS+1,BATXLIM+BATXPUN YES, SIGNAL TROUBLE 00313000
  327. L R15,ABATABND ...AND ABEND BATCH 00314000
  328. BR R15 ... 00315000
  329. BATHOS STH R7,BATPUNC UPDATE PUNCH COUNT 00316000
  330. LR R14,R10 RESTORE RETURN ADDRESS 00317000
  331. BR R14 RETURN 00318000
  332. EJECT 00319000
  333. ********************************************************************** 00320000
  334. * 00321000
  335. * DATA USED TO INITIALIZE FIELDS IN THE WORK AREA. 00322000
  336. * 'DU' PREFIX CORRESSPONDS TO ITEMS WITH 'CD' PREFIX 00323000
  337. * IN CDSECT DSECT. 00324000
  338. * 00325000
  339. ********************************************************************** 00326000
  340. SPACE 1 00327000
  341. DS 0D 00328000
  342. DUCCWS DS 0CL16 CCW PACKAGE 00329000
  343. CCW X'41',0,X'40',80 DEFAULT PUNCH COMMAND 00330000
  344. CCW X'03',0,X'20',1 NOP CCW 00331000
  345. DUWAITP DS 0CL20 WAIT PLIST 00332000
  346. DC CL8'WAIT' 00333000
  347. DC CL4'PCH1' DEFAULT FOR PUNCH 00334000
  348. DC 2F'0' 00335000
  349. DUSENFO DC F'0' 00336000
  350. DUSNCCW DS 0CL16 CCW PACKAGE FOR SENSE 00337000
  351. CCW X'04',0,X'60',1 SENSE CCW 00338000
  352. CCW X'03',0,X'20',1 NOP CCW 00339000
  353. SPACE 1 00340000
  354. WTRDR DC CL4'RDR1' 00341000
  355. LTORG 00342000
  356. EJECT 00343000
  357. ********************************************************************** 00344000
  358. * 00345000
  359. * DSECTS 00346000
  360. * 00347000
  361. ********************************************************************** 00348000
  362. SPACE 1 00349000
  363. CDSECT DSECT 00350000
  364. CDCCWS DS 2D LOCATION FOR CCW PACKAGE 00351000
  365. CDWAITP DS 5F AREA FOR WAIT PLIST 00352000
  366. CDSENFO DS 1F SENSE AREA 00353000
  367. CDSNCCW DS 2D SENSE CCW PACKAGE 00354000
  368. CDCSW DS 4B CSW SAVE AREA... 00355000
  369. CDSTAT DS 2B ...STATUS BYTES... 00356000
  370. CDCOUNT DS 2B ...COUNT 00357000
  371. CDMISC DS 2D 00358000
  372. SPACE 1 00359000
  373. BUFSECT DSECT 00360000
  374. BUFCTR DC A(*-*) 00361000
  375. BATCTR DC A(*-*) 00362000
  376. DS 2F 00363000
  377. BUFDATA DS 500D 00364000
  378. SPACE 1 00365000
  379. BATLIMIT 00366000
  380. EJECT 00367000
  381. NUCON 00368000
  382. REGEQU 00369000
  383. END 00370000