Table of Contents

DMKCVT Source

References

Source Listing

DMKCVT.ASSEMBLE.txt
  1. CVT TITLE 'DMKCVT (CP) VM/370 - RELEASE 6' 00001000
  2. ISEQ 73,80 00002000
  3. *. 00003000
  4. * MODULE NAME - 00004000
  5. * 00005000
  6. * DMKCVT 00006000
  7. * 00007000
  8. * CONTENTS - 00008000
  9. * 00009000
  10. * DMKCVTBH - BINARY TO EBCDIC HEX 00010000
  11. * DMKCVTHB - EBCDIC HEX TO BINARY 00011000
  12. * DMKCVTFP - FLOATING POINT HEX TO EBCDIC DECIMAL 00012000
  13. * DMKCVTDB - EBCDIC DECIMAL TO BINARY 00013000
  14. * DMKCVTBD - BINARY TO EBCDIC DECIMAL 00014000
  15. * DMKCVTDT - DATE AND TIME 00015000
  16. * 00016000
  17. *. 00017000
  18. EJECT 00018000
  19. COPY OPTIONS 00019000
  20. EJECT 00020000
  21. COPY LOCAL OPTIONS 00021000
  22. EJECT 00022000
  23. DMKCVT CSECT 00023000
  24. SPACE 2 00024000
  25. ENTRY DMKCVTBH 00025000
  26. ENTRY DMKCVTHB 00026000
  27. ENTRY DMKCVTBD 00027000
  28. ENTRY DMKCVTDB 00028000
  29. ENTRY DMKCVTFP 00029000
  30. ENTRY DMKCVTDT 00030000
  31. ENTRY DMKCVTAB @VA04301 00030100
  32. SPACE 3 00031000
  33. USING PSA,R0 00032000
  34. EJECT 00033000
  35. *. 00034000
  36. * SUBROUTINE NAME - 00035000
  37. * 00036000
  38. * DMKCVTBH 00037000
  39. * 00038000
  40. * FUNCTION - 00039000
  41. * 00040000
  42. * CONVERTS A WORD OF BINARY INFORMATION INTO A DOUBLE- 00041000
  43. * WORD OF EBCDIC HEX DIGITS 00042000
  44. * 00043000
  45. * ATTRIBUTES - 00044000
  46. * 00045000
  47. * SERIALLY REUSABLE, RESIDENT, CALLED VIA BALR 00046000
  48. * 00047000
  49. * ENTRY POINT - 00048000
  50. * 00049000
  51. * DMKCVTBH - CONVERT BINARY TO EBCDIC HEX 00050000
  52. * 00051000
  53. * ENTRY CONDITIONS - 00052000
  54. * 00053000
  55. * GPR1 = WORD OF BINARY INFORMATION TO BE CONVERTED 00054000
  56. * GPR15 = BASE ADDRESS 00055000
  57. * 00056000
  58. * EXIT CONDITIONS - 00057000
  59. * 00058000
  60. * GPR0, GPR1 = DOUBLEWORD OF EBCDIC HEX DIGITS 00059000
  61. * 00060000
  62. * CALLS TO OTHER ROUTINES - 00061000
  63. * 00062000
  64. * NONE 00063000
  65. * 00064000
  66. * EXTERNAL REFERENCES - 00065000
  67. * 00066000
  68. * NONE 00067000
  69. * 00068000
  70. * TABLES / WORK AREAS - 00069000
  71. * 00070000
  72. * TEMPSAVE 00071000
  73. * 00072000
  74. * REGISTER USAGE - 00073000
  75. * 00074000
  76. * GPR14 = RETURN REGISTER 00075000
  77. * GPR15 = BASE REGISTER 00076000
  78. * 00077000
  79. * GPR0, GPR1 = WORK REGISTERS 00078000
  80. * 00079000
  81. * ALL OTHER REGISTERS ARE NOT USED 00080000
  82. * 00081000
  83. * NOTES - 00082000
  84. * 00083000
  85. * NONE 00084000
  86. * 00085000
  87. EJECT 00086000
  88. * OPERATION - 00087000
  89. * 00088000
  90. * 1. UNPACK BINARY INFORMATION. 00089000
  91. * 2. TRANSLATE TO HEX EBCDIC DIGITS. 00090000
  92. * 00091000
  93. *. 00092000
  94. SPACE 3 00093000
  95. DMKCVTBH DS 0H 00094000
  96. USING *,R15 00095000
  97. ST R1,TEMPSAVE BINARY 00096000
  98. UNPK TEMPSAVE+8(9),TEMPSAVE(5) UNPACK 00097000
  99. TR TEMPSAVE+8(8),DMPTAB-C'0' TRANSLATE 00098000
  100. LM R0,R1,TEMPSAVE+8 RETURN VALUE IN R0 AND R1 00099000
  101. BR R14 RETURN 00100000
  102. DROP R15 00101000
  103. EJECT 00102000
  104. *. 00103000
  105. * SUBROUTINE NAME - 00104000
  106. * 00105000
  107. * DMKCVTHB 00106000
  108. * 00107000
  109. * FUNCTION - 00108000
  110. * 00109000
  111. * CONVERTS THE EBCDIC HEX FIELD DESIGNATED TO A FULL WORD 00110000
  112. * OF BINARY 00111000
  113. * 00112000
  114. * ATTRIBUTES - 00113000
  115. * 00114000
  116. * SERIALLY REUSABLE, RESIDENT, CALLED VIA BALR 00115000
  117. * 00116000
  118. * ENTRY POINTS - 00117000
  119. * 00118000
  120. * DMKCVTHB - CONVERT EBCDIC HEX TO BINARY 00119000
  121. * 00120000
  122. * ENTRY CONDITIONS - 00121000
  123. * 00122000
  124. * GPR0 = LENGTH OF FIELD 00123000
  125. * GPR1 = ADDRESS OF THE FIRST BYTE OF THE FIELD 00124000
  126. * 00125000
  127. * EXIT CONDITIONS - 00126000
  128. * 00127000
  129. * GPR1 = FULL WORD OF BINARY; IF ERROR GPR1 = 0 00128000
  130. * 00129000
  131. * CC = 0; IF ERROR CC ¬= 0 00130000
  132. * 00131000
  133. * CALLS TO OTHER ROUTINES - 00132000
  134. * 00133000
  135. * NONE 00134000
  136. * 00135000
  137. * EXTERNAL REFERENCES - 00136000
  138. * 00137000
  139. * NONE 00138000
  140. * 00139000
  141. * TABLES / WORK AREAS - 00140000
  142. * 00141000
  143. * BALRSAVE 00142000
  144. * 00143000
  145. * REGISTER USAGE - 00144000
  146. * 00145000
  147. * GPR14 = RETURN REGISTER 00146000
  148. * GPR15 = BASE REGISTER 00147000
  149. * 00148000
  150. * GPR0, GPR1, GPR2, GPR3 = WORK REGISTERS 00149000
  151. * 00150000
  152. * ALL OTHER REGISTERS ARE NOT USED 00151000
  153. * 00152000
  154. * NOTES - 00153000
  155. * 00154000
  156. * NONE 00155000
  157. * 00156000
  158. EJECT 00157000
  159. * OPERATION - 00158000
  160. * 00159000
  161. * 1. SAVE REGISTERS. 00160000
  162. * 2. GET NEXT EBCDIC HEX DIGIT. 00161000
  163. * 3. IF DIGIT GREATER THAN "0" AND LESS THAN "9" SUBTRACT X'F0'; 00162000
  164. * OTHERWISE IF GREATER THAN "A" SUBTRACT X'B7'; 00163000
  165. * OTHERWISE INDICATE CHARACTER ERROR IN FIELD. 00164000
  166. * 4. ACCUMULATE BINARY DIGITS IN GPR0. 00165000
  167. * 5. LOOP THROUGH ENTIRE FIELD. 00166000
  168. * 6. RESTORE REGISTERS. 00167000
  169. * 00168000
  170. *. 00169000
  171. SPACE 3 00170000
  172. DMKCVTHB DS 0H 00171000
  173. USING *,R15 00172000
  174. STM R0,R3,BALRSAVE SAVE REGISTERS 00173000
  175. LR R3,R0 SAVE FIELD LENGTH 00174000
  176. SR R2,R2 CLEAR REG 00175000
  177. LR R0,R2 ... 00176000
  178. L1 IC R2,0(,R1) GET DIGIT 00177000
  179. CLI 0(R1),C'0' GREATER THAN ZERO? 00178000
  180. BL L3 NO TRY A-F 00179000
  181. CLI 0(R1),C'9' GREATER THAN NINE? 00180000
  182. BH ERR2 YES ERROR 00181000
  183. S R2,F240 (=A(C'0')) MAKE DIGIT A HEX NUMBER 00182000
  184. B L2 CONTINUE 00183000
  185. L3 CLI 0(R1),C'A' LESS THAN "A"? 00184000
  186. BL ERR2 YES ERROR 00185000
  187. CLI 0(R1),C'F' GREATER THAN "F"? 00186000
  188. BH ERR2 YES ERROR 00187000
  189. SH R2,=AL2(C'A'-10) MAKE CHAR A HEX NUMBER 00188000
  190. L2 SLL R0,4 ASSEMBLE NEXT DIGIT 00189000
  191. AR R0,R2 ... 00190000
  192. LA R1,1(,R1) BUMP PTR 00191000
  193. BCT R3,L1 LOOP THROUGH ENTIRE FIELD 00192000
  194. ST R0,BALR1 RETURN RESULT IN R1 00193000
  195. SR R0,R0 SET CC=0 00194000
  196. LM R0,R3,BALRSAVE RESTORE REGISTERS 00195000
  197. BR R14 RETURN 00196000
  198. * 00197000
  199. ERR2 DS 0H 00198000
  200. LM R0,R3,BALRSAVE RESTORE REGISTERS 00199000
  201. LA R1,0 RETURN ZERO WITHOUT DISTURBING CC 00200000
  202. BR R14 00201000
  203. DROP R15 00202000
  204. EJECT 00203000
  205. *. 00204000
  206. * SUBROUTINE NAME - 00205000
  207. * 00206000
  208. * DMKCVTFP 00207000
  209. * 00208000
  210. * FUNCTION - 00209000
  211. * 00210000
  212. * CONVERT FLOATING HEX TO 17 BYTES OF EBCDIC DECIMAL 00211000
  213. * 00212000
  214. * ATTRIBUTES - 00213000
  215. * 00214000
  216. * SERIALLY REUSABLE, RESIDENT, CALLED VIA BALR 00215000
  217. * 00216000
  218. * ENTRY POINTS - 00217000
  219. * 00218000
  220. * DMKCVTFP - CONVERT FLOATING HEX TO EBCDIC DECIMAL 00219000
  221. * 00220000
  222. * ENTRY CONDITIONS - 00221000
  223. * 00222000
  224. * GPR1 = ADDRESS OF RESULT LOCATION 00223000
  225. * GPR2 = ADDRESS OF FLOATING HEX DOUBLEWORD 00224000
  226. * 00225000
  227. * EXIT CONDITIONS - 00226000
  228. * 00227000
  229. * SAME AS FOR ENTRY CONDITIONS 00228000
  230. * 00229000
  231. * CALLS TO OTHER ROUTINES - 00230000
  232. * 00231000
  233. * NONE 00232000
  234. * 00233000
  235. * EXTERNAL REFERENCES - 00234000
  236. * 00235000
  237. * NONE 00236000
  238. * 00237000
  239. * TABLES / WORK AREAS - 00238000
  240. * 00239000
  241. * BALRSAVE 00240000
  242. * 00241000
  243. * REGISTER USAGE - 00242000
  244. * 00243000
  245. * GPR1 = ADDRESS OF RESULT LOCATION 00244000
  246. * GPR2 = ADDRESS OF FLOATING HEX DOUBLEWORD 00245000
  247. * GPR14 = RETURN REGISTER 00246000
  248. * GPR15 = BASE REGISTER 00247000
  249. * 00248000
  250. * GPR5, GPR6, GPR7, GPR8, GPR9, GPR10 = WORK REGISTERS 00249000
  251. * 00250000
  252. * ALL OTHER REGISTERS ARE NOT USED 00251000
  253. * 00252000
  254. * 00253000
  255. * NOTES - 00254000
  256. * 00255000
  257. * NONE 00256000
  258. * 00257000
  259. EJECT 00258000
  260. * OPERATION - 00259000
  261. * 00260000
  262. * 1. SAVE REGISTERS 00261000
  263. * 2. SET FRACTION SIGN. 00262000
  264. * 3. NORMALIZE & ADJUST FRACTION SO THAT ALL DIGITS ARE TO 00263000
  265. * THE RIGHT OF THE DECIMAL POINT. 00264000
  266. * 4. SET EXPONENT SIGN. 00265000
  267. * 5. CONVERT EXPONENT TO EBCDIC DECIMAL. 00266000
  268. * 6. CONVERT FRACTION TO EBCDIC DECIMAL. 00267000
  269. * 7. RESTORE REGISTERS. 00268000
  270. * 00269000
  271. *. 00270000
  272. SPACE 00271000
  273. DMKCVTFP DS 0H 00272000
  274. USING *,R15 00273000
  275. STM R5,R10,BALRSAVE 00274000
  276. LM R6,R7,0(R2) GET FLOATING POINT NUMBER 00275000
  277. SLR R9,R9 CLEAR 00276000
  278. LR R8,R7 ISOLATE FRACTION IN GPR 7 & 8 00277000
  279. SRDA R6,24 ISOLATE EXPONENT IN GPR 6 00278000
  280. SRL R7,4 ... 00279000
  281. STM R7,R9,HIGH STORE FRACTION 00280000
  282. MVC DMPPST(2,R1),K2 SET FRACTION SIGN & POINT 00281000
  283. LA R7,X'40' LOAD EXPONENT CORRECTION FACTOR 00282000
  284. BM CVT3 BRANCH IF NEGATIVE FRACTION 00283000
  285. MVI DMPPST(R1),C' ' CORRECT FRACTION SIGN TO POSITIVE 00284000
  286. LCR R7,R7 COMPLEMENT EXPONENT CORRECTION 00285000
  287. CVT3 EQU * 00286000
  288. AR R6,R7 SET FRACTION SIGN POSITIVE 00287000
  289. STH R6,HEXEXP STORE HEX. EXPONENT. 00288000
  290. STH R9,DECEXP INITIAL DEC. EXPONENT. 00289000
  291. NI HIGH+4,X'0F' CORRECT FRACTION 00290000
  292. LA R5,1 SET BASE PT. TO DECIMAL 00291000
  293. CLC HIGH(8),HIGH+1 IS FRACTION ZERO? 00292000
  294. BNE CVT1B NO 00293000
  295. SLR R6,R6 SET EXPONENT .EQ. 0 00294000
  296. SLR R7,R7 ... 00295000
  297. MVI DMPPST(R1),C' ' SET FRACTION SIGN POSITIVE 00296000
  298. B STOREZ 00297000
  299. CVT1B EQU * 00298000
  300. BALR R8,0 SET RETURN VECTOR HERE 00299000
  301. SLR R6,R6 CLEAR 00300000
  302. LPR R5,R5 SET BASE TO DECIMAL 00301000
  303. CH R9,HEXEXP TEST HEX. EXPONENT. 00302000
  304. BE NORMAL ZERO -- NORMALIZED 00303000
  305. BH *+6 00304000
  306. LCR R5,R5 SWITCH BASE TO HEX 00305000
  307. CLI HIGH,0 TEST FRACTION 00306000
  308. ADJUST EQU * 00307000
  309. LA R9,12 SET LOOP INDEX 00308000
  310. BH DIV BRANCH IF DIVIDE NEEDED 00309000
  311. MULT EQU * 00310000
  312. L R7,HIGH-4(R9) MULTIPLY FRACTION. 00311000
  313. USING DMKCVTFP+1,R15 TO PREVENT ASSEMBLY ALIGNMENT ERRORS 00312000
  314. MH R7,BASE+2(R5) USE SELECTED BASE 00313000
  315. USING DMKCVTFP,R15 00314000
  316. AR R6,R7 CATCH OVERFLOW HERE 00315000
  317. SRDL R6,28 ... 00316000
  318. SRL R7,4 ... 00317000
  319. ST R7,HIGH-4(R9) ... 00318000
  320. S R9,F4 00319000
  321. BH MULT REPEAT FOR 3 WORDS 00320000
  322. SLR R7,R7 SET R7 .EQ. -1 00321000
  323. BCTR R7,0 ... 00322000
  324. B ADJEXP 00323000
  325. DIV EQU * 00324000
  326. LCR R5,R5 SWITCH BASES 00325000
  327. USING DMKCVTFP+1,R15 TO PREVENT ASSEMBLY ALIGNMENT ERRORS 00326000
  328. LH R10,BASE+2(R5) LOAD PROPER DIVISOR 00327000
  329. USING DMKCVTFP,R15 00328000
  330. LCR R9,R9 NEGATE LOOP INDEX 00329000
  331. DIV2 EQU * 00330000
  332. L R7,LOW+4(R9) DIVIDE FRACTION BY SELECTED BASE 00331000
  333. SLL R7,4 AND DECREMENT EXPONENT COUNT 00332000
  334. SRDL R6,4 ... 00333000
  335. DR R6,R10 ... 00334000
  336. ST R7,LOW+4(R9) ... 00335000
  337. A R9,F4 00336000
  338. BM DIV2 REPEAT FOR 3 WORDS 00337000
  339. LA R7,1 GET CONSTANT OF 1 00338000
  340. ADJEXP EQU * 00339000
  341. USING PSA+1,R5 TO PREVENT ASSEMBLY ALIGNMENT ERRORS 00340000
  342. AH R7,HEXEXP+2 CHANGE SELECTED EXPONENT 00341000
  343. STH R7,HEXEXP+2 ... 00342000
  344. DROP R5 00343000
  345. BR R8 00344000
  346. NORMAL EQU * 00345000
  347. BALR R8,0 SET RETURN VECTOR HERE 00346000
  348. LTR R6,R6 ANY OVERFLOW ? 00347000
  349. BZ ADJUST NO -- FORCE OVERFLOW TO OBTAIN FIRST *00348000
  350. DECIMAL DIGIT 00349000
  351. A R7,F1 NO - CORRECT DECIMAL EXPONENT 00350000
  352. STOREZ EQU * 00351000
  353. MVC DMPPST+19(3,R1),K1 SET E- IN OUTPUT 00352000
  354. BM CVT2 BRANCH IF EXPONENT IS NEGATIVE 00353000
  355. MVI DMPPST+21(R1),C' ' SET EXPONENT SIGN POSITIVE 00354000
  356. CVT2 EQU * 00355000
  357. CVD R7,DMPCOT .. 00356000
  358. UNPK DMPPST+22(2,R1),DMPCOT+6(2) 00357000
  359. MVZ DMPPST+23(1,R1),DMPPST+22(R1) 00358000
  360. LA R7,16 INITIALIZE DIGIT INDEX 00359000
  361. STH R7,DECEXP .. 00360000
  362. BALR R8,0 SET RETURN VECTOR HERE 00361000
  363. IC R9,F240+3 (=C'0') GET ZONE BITS 00362000
  364. AR R6,R9 COMBINE WITH DIGIT 00363000
  365. LCR R7,R7 COMPLEMENT DIGIT INDEX 00364000
  366. STC R6,DMPPST+18(R7,R1) STORE DIGIT IN OUTPUT 00365000
  367. BM ADJUST BRANCH IF INDEX .LT. 0 00366000
  368. LM R5,R10,BALRSAVE RESTORE REG. 00367000
  369. BR R14 RETURN 00368000
  370. DROP R15 00369000
  371. SPACE 3 00370000
  372. DMPPST EQU 0 WORK AREA AND AREA FOR ANSWER 00371000
  373. SPACE 1 00372000
  374. BASE DC H'16' 00373000
  375. DC H'10' 00374000
  376. K1 DC C' E' 00375000
  377. K2 DC C'-.' 00376000
  378. EJECT 00377000
  379. *. 00378000
  380. * SUBROUTINE NAME - 00379000
  381. * 00380000
  382. * DMKCVTDB 00381000
  383. * 00382000
  384. * FUNCTION - 00383000
  385. * 00384000
  386. * CONVERTS THE EBCDIC DECIMAL FIELD DESIGNATED TO A FULL WORD 00385000
  387. * OF BINARY 00386000
  388. * 00387000
  389. * ATTRIBUTES - 00388000
  390. * 00389000
  391. * SERIALLY REUSABLE, RESIDENT, CALLED VIA BALR 00390000
  392. * 00391000
  393. * ENTRY POINTS - 00392000
  394. * 00393000
  395. * DMKCVTDB - CONVERT EBCDIC DECIMAL TO BINARY 00394000
  396. * 00395000
  397. * ENTRY CONDITIONS - 00396000
  398. * 00397000
  399. * GPR0 = LENGTH OF FIELD 00398000
  400. * GPR1 = ADDRESS OF THE FIRST BYTE OF THE FIELD 00399000
  401. * 00400000
  402. * EXIT CONDITIONS - 00401000
  403. * 00402000
  404. * GPR1 = FULL WORD OF BINARY; IF ERROR GPR1 = 0 00403000
  405. * 00404000
  406. * CC = 0; IF ERROR CC ¬= 0 00405000
  407. * 00406000
  408. * CALLS TO OTHER ROUTINES - 00407000
  409. * 00408000
  410. * NONE 00409000
  411. * 00410000
  412. * EXTERNAL REFERENCES - 00411000
  413. * 00412000
  414. * NONE 00413000
  415. * 00414000
  416. * TABLES / WORK AREAS - 00415000
  417. * 00416000
  418. * TEMPSAVE 00417000
  419. * 00418000
  420. * REGISTER USAGE - 00419000
  421. * 00420000
  422. * GPR14 = RETURN REGISTER 00421000
  423. * GPR15 = BASE REGISTER 00422000
  424. * 00423000
  425. * GPR0, GPR1, GPR2 = WORK REGISTERS 00424000
  426. * 00425000
  427. EJECT 00426000
  428. * ALL OTHER REGISTERS ARE NOT USED 00427000
  429. * 00428000
  430. * NOTES - 00429000
  431. * 00430000
  432. * NONE 00431000
  433. * 00432000
  434. * OPERATION - 00433000
  435. * 00434000
  436. * 1. SAVE REGISTERS. 00435000
  437. * 2. IF GPR0 GREATER THAN 10 DIGITS INDICATE ERROR. 00436000
  438. * 3. VALIDITY CHECK ALL EBCDIC DECIMAL DIGITS. 00437000
  439. * 4. PACK FIELD. 00438000
  440. * 5. IF RESULT IS GREATER THAN 2**31-1 INDICATE ERROR. 00439000
  441. * 6. CONVERT RESULT TO BINARY. 00440000
  442. * 7. RESTORE REGISTERS. 00441000
  443. * 00442000
  444. *. 00443000
  445. SPACE 3 00444000
  446. DMKCVTDB DS 0H 00445000
  447. USING *,R15 00446000
  448. STM R1,R2,BALR1 SAVE REGS R1 AND R2 00447000
  449. C R0,F10 GREATER THAN 10 DIGITS ? 00448000
  450. BH ERR3 00449000
  451. LR R2,R0 GET LENGTH OF FIELD 00450000
  452. BCTR R2,0 DECREMENT FOR EX 00451000
  453. DECCHK CLI 0(1),C'0' 00452000
  454. BL ERR3 00453000
  455. CLI 0(1),C'9' 00454000
  456. BH ERR3 00455000
  457. LA R1,1(,R1) 00456000
  458. BCT R0,DECCHK 00457000
  459. L R1,BALR1 RESTORE R1 00458000
  460. EX R2,PACK ... 00459000
  461. CP TEMPSAVE(8),=PL8'2147483647' GREATER THAN 2**31-1 ? 00460000
  462. BH ERR3 BRANCH IF YES 00461000
  463. CVB R1,TEMPSAVE CONVERT TO BINARY 00462000
  464. SR R2,R2 SET CONDITION CODE 0 00463000
  465. ERR3 EQU * 00464000
  466. L R2,BALR2 RESTORE R2 00465000
  467. BR R14 RETURN 00466000
  468. DROP R15 00467000
  469. SPACE 1 00468000
  470. PACK PACK TEMPSAVE(8),0(0,R1) EXECUTED PACK INSTRUCTION 00469000
  471. EJECT 00470000
  472. *. 00471000
  473. * SUBROUTINE NAME - 00472000
  474. * 00473000
  475. * DMKCVTBD 00474000
  476. * 00475000
  477. * FUNCTION - 00476000
  478. * 00477000
  479. * CONVERT A WORD OF BINARY INFORMATION INTO A DOUBLE- 00478000
  480. * WORD OF EBCDIC DECIMAL DIGITS 00479000
  481. * 00480000
  482. * ATTRIBUTES - 00481000
  483. * 00482000
  484. * SERIALLY REUSABLE, RESIDENT, CALLED VIA BALR 00483000
  485. * 00484000
  486. * ENTRY POINT - 00485000
  487. * 00486000
  488. * DMKCVTBD - CONVERT BINARY TO EBCDIC DECIMAL 00487000
  489. * 00488000
  490. * ENTRY CONDITIONS - 00489000
  491. * 00490000
  492. * GPR1 = WORD OF BINARY INFORMATION TO BE CONVERTED 00491000
  493. * 00492000
  494. * EXIT CONDITIONS - 00493000
  495. * 00494000
  496. * GPR0, GPR1 = DOUBLEWORD OF EBCDIC DECIMAL DIGITS 00495000
  497. * 00496000
  498. * CALLS TO OTHER ROUTINES - 00497000
  499. * 00498000
  500. * NONE 00499000
  501. * 00500000
  502. * EXTERNAL REFERENCES - 00501000
  503. * 00502000
  504. * NONE 00503000
  505. * 00504000
  506. * TABLES / WORK AREAS - 00505000
  507. * 00506000
  508. * TEMPSAVE 00507000
  509. * 00508000
  510. * REGISTER USAGE - 00509000
  511. * 00510000
  512. * GPR14 = RETURN REGISTER 00511000
  513. * GPR15 = BASE REGISTER 00512000
  514. * 00513000
  515. * GPR0, GPR1 = WORK REGISTERS 00514000
  516. * 00515000
  517. * ALL OTHER REGISTERS ARE NOT USED 00516000
  518. * 00517000
  519. * NOTES - 00518000
  520. * 00519000
  521. * NONE 00520000
  522. * 00521000
  523. EJECT 00522000
  524. * OPERATION - 00523000
  525. * 00524000
  526. * 1. CONVERT BINARY INFORMATION TO DECIMAL. 00525000
  527. * 2. UNPACK DECIMAL INFORMATION. 00526000
  528. * 3. SET SIGN TO POSITIVE. 00527000
  529. * 00528000
  530. *. 00529000
  531. SPACE 3 00530000
  532. DMKCVTBD DS 0H 00531000
  533. USING *,R15 00532000
  534. CVD R1,TEMPSAVE BINARY TO PACKED DECIMAL 00533000
  535. UNPK TEMPSAVE+8(8),TEMPSAVE+3(5) UNPACK 00534000
  536. OI TEMPSAVE+15,X'F0' MAKE UP FOR HARDWARE DEFICIENCIES 00535000
  537. LM R0,R1,TEMPSAVE+8 RETURN VALUE IN R0 AND R1 00536000
  538. BR R14 RETURN 00537000
  539. DROP R15 00538000
  540. EJECT 00539000
  541. *. 00540000
  542. * SUBROUTINE NAME - 00541000
  543. * 00542000
  544. * DMKCVTDT 00543000
  545. * 00544000
  546. * FUNCTION - 00545000
  547. * 00546000
  548. * SETS TIME AND DATE IN EBCDIC 00547000
  549. * 00548000
  550. * ATTRIBUTES - 00549000
  551. * 00550000
  552. * SERIALLY REUSABLE, RESIDENT, CALLED VIA BALR 00551000
  553. * 00552000
  554. * ENTRY POINTS - 00553000
  555. * 00554000
  556. * DMKCVTDT - SET TIME AND DATE IN EBCDIC 00555000
  557. * DMKCVTAB - EXTERNAL ENTRY TO FORCE CVT001 ABEND 00555100
  558. * 00556000
  559. * ENTRY CONDITIONS - 00557000
  560. * 00558000
  561. * GPR1 = ADDRESS WHERE DOUBLEWORD DATE SHOULD BE STORED 00559000
  562. * GPR2 = ADDRESS WHERE DOUBLEWORD TIME SHOULD BE STORED 00560000
  563. * IF EITHER GPR1 OR GPR2 IS NON-POSITIVE, THE CORRESPONDING 00561000
  564. * DATA IS NOT STORED. 00562000
  565. * 00563000
  566. * EXIT CONDITIONS - 00564000
  567. * 00565000
  568. * SAME AS FOR ENTRY CONDITIONS 00566000
  569. * 00567000
  570. * CALLS TO OTHER ROUTINES - NONE 00568000
  571. * 00569000
  572. * EXTERNAL REFERENCES - NONE 00570000
  573. * 00571000
  574. * TABLES / WORK AREAS - 00572000
  575. * 00573000
  576. * BALRSAVE 00574000
  577. * TEMPSAVE 00575000
  578. * 00576000
  579. * REGISTER USAGE - 00577000
  580. * 00578000
  581. * GPR1 = PTR TO OUTPUT AREA FOR DATE (IF WANTED) 00579000
  582. * GPR2 = PTR TO OUTPUT AREA FOR TIME (IF WANTED) 00580000
  583. * GPR14 = RETURN REGISTER 00581000
  584. * GPR15 = BASE REGISTER 00582000
  585. * 00583000
  586. * GPR0, GPR1 = WORK REGISTERS 00584000
  587. * 00585000
  588. * ALL OTHER REGISTERS ARE NOT USED 00586000
  589. * 00587000
  590. * NOTES - NONE 00588000
  591. * 00589000
  592. EJECT 00590000
  593. * OPERATION - 00591000
  594. * 00592000
  595. * 1. TEST IF DATE WANTED AND MOVE DATE FROM PSA TO OUTPUT 00593000
  596. * LOCATION IF IT IS. 00594000
  597. * 2. TEST IF TIME WANTED; IF NOT EXIT. 00595000
  598. * 3. SAVE REGISTERS. 00596000
  599. * 4. STORE TIME OF DAY CLOCK INTO TEMPSAVE. 00597000
  600. * 5. SUBTRACT NUMBER OF MICROSECONDS FROM JAN 1, 1900 00598000
  601. * 0000 HOURS TILL MIDNIGHT THIS MORNING PLUS 00599000
  602. * TIME ZONE CORRECTION CONSTANT. 00600000
  603. * 6. GET NUMBER OF MICROSECONDS PAST MIDNIGHT. 00601000
  604. * 7. GET NUMBER OF SECONDS PAST MIDNIGHT. 00602000
  605. * 8. GET NUMBER OF HOURS, MINUTES, AND SECONDS PAST 00603000
  606. * MIDNIGHT PLACING THE RESULTS IN THE LOCATION SPECIFIED 00604000
  607. * BY GPR2. 00605000
  608. * 9. RESTORE REGISTERS AND EXIT. 00606000
  609. *. 00607000
  610. SPACE 3 00608000
  611. DMKCVTDT DS 0H 00609000
  612. USING *,R15 00610000
  613. LTR 1,1 00611000
  614. BNP DATENO 00612000
  615. MVC 0(8,R1),DATE MOVE DATE TO OUTPUT LOCATION 00613000
  616. DATENO LTR 2,2 00614000
  617. BNP DATEXIT 00615000
  618. STM R0,R1,BALRSAVE SAVE REGS R0 AND R1 00616000
  619. MIDWAIT EQU * HERE TO SPIN TILL MIDNIGHT @VA07949 00616500
  620. STCK TEMPSAVE STORE TOD CLOCK 00617000
  621. BNZ CHKCLOK CLOCK IS NOT RUNNING RIGHT @VA02553 00618000
  622. LM R0,R1,TEMPSAVE TOD CLOCK VALUE TO GR0,GR1 @VA02553 00619000
  623. SL R1,TODATE+4 SUBTRACT CORRECT TIME AT MIDNIGHT 00620000
  624. BC 11,*+8 ... 00621000
  625. SL R0,F1 ... 00622000
  626. SL R0,TODATE ... 00623000
  627. LTR R0,R0 IS IT REALLY PAST MIDNIGHT @VA07949 00623100
  628. BM MIDWAIT NO-NOT QUITE MIDNIGHT,LOOP @VA07949 00623200
  629. SRDL R0,12 GET NUMBER OF MICROSECONDS PAST MIDNIGHT 00624000
  630. D R0,=F'1000000' GET NUMBER OF SECONDS PAST MIDNIGHT 00625000
  631. SR R0,R0 IGNORE REMAINDER 00626000
  632. D R0,=F'3600' GET NUMBER OF HOURS PAST MIDNIGHT 00627000
  633. CVD R1,TEMPSAVE CONVERT NUMBER OF HOURS TO DECIMAL 00628000
  634. UNPK 0(4,R2),TEMPSAVE+6(3) UNPACK 00629000
  635. MVI 2(R2),C':' NEATEN UP 00630000
  636. LR R1,R0 GET REMAINDER FROM LAST DEVIDE 00631000
  637. SR R0,R0 CLEAR 00632000
  638. D R0,F60 GET NUMBER OF MINUTES PAST THIS HOUR 00633000
  639. CVD R1,TEMPSAVE CONVERT NUMBER OF MINUTES TO DECIMAL 00634000
  640. UNPK 3(4,R2),TEMPSAVE+6(3) UNPACK 00635000
  641. MVI 5(R2),C':' NEATEN UP 00636000
  642. CVD R0,TEMPSAVE CONVERT NUMBER OF SECONDS TO DECIMAL 00637000
  643. UNPK 6(2,R2),TEMPSAVE+6(2) UNPACK 00638000
  644. OI 7(R2),X'F0' MAKE UP FOR HARDWARE DEFICIENCIES 00639000
  645. LM R0,R1,BALRSAVE RESTORE REGS R0 AND R1 00640000
  646. DATEXIT DS 0H 00641000
  647. BR R14 RETURN 00642000
  648. SPACE 2 00643000
  649. CHKCLOK EQU * CLOCK NOT SET OR DAMAGED @VA02553 00644000
  650. CLC CPID(4),=C'CPCP' HAVE WE FINISHED IPL YET ? @VA02553 00645000
  651. BE CVT1 YES - TAKE THE SYSTEM DOWN @VA02553 00646000
  652. MVC 0(8,R2),=C'00:00:00' HARMLESS NON-TIME @VA02553 00647000
  653. BR R14 EXIT TO CALLER (REGS UNCHANGED) @VA02553 00648000
  654. SPACE 00649000
  655. DMKCVTAB DS 0D ENTRY TO FORCE CVT001 ABEND @VA04301 00649500
  656. ABEND 1 ANYBODY KNOW WHAT TIME IT IS ? @VA02553 00650000
  657. DROP R15 00651000
  658. DMPTAB DC C'0123456789ABCDEF' TRANSLATE TABLE 00652000
  659. * 00653000
  660. EJECT 00654000
  661. LTORG 00655000
  662. EJECT 00656000
  663. PSA , @V306638 00657000
  664. COPY EQU @V306638 00658000
  665. HIGH EQU TEMPSAVE+4 00659000
  666. LOW EQU HIGH+8 00660000
  667. DMPCOT EQU LOW+4 00661000
  668. HEXEXP EQU TEMPSAVE 00662000
  669. DECEXP EQU HEXEXP+2 00663000
  670. END 00664000