Table of Contents

DMSEDC Source

References

Source Listing

DMSEDC.ASSEMBLE.txt
  1. EDC TITLE 'DMSEDC (CMS) VM/370 - RELEASE 6' 00001000
  2. SPACE 2 00002000
  3. *. 00003000
  4. * 00004000
  5. * MODULE NAME - 00005000
  6. * 00006000
  7. * DMSEDC (EDCANON) 00007000
  8. * 00008000
  9. * FUNCTION - 00009000
  10. * 00010000
  11. * TO ARRANGE COMPUND (OVERSTRUCK) CHARACTERS INTO 00011000
  12. * CANONICAL FORM, AND TO DISREGARD TAB CHARACTERS AS 00012000
  13. * SPECIAL CHARACTERS. 00013000
  14. * 00014000
  15. * ATTRIBUTES - 00015000
  16. * 00016000
  17. * DISK-RESIDENT: BALR'D TO BY DMSEDI 00017000
  18. * 00018000
  19. * ENTRY POINTS - 00019000
  20. * 00020000
  21. * DMSEDC, EDCANON - SEE FUNCTION DESCRIPTION 00021000
  22. * 00022000
  23. * ENTRY CONDITIONS - 00023000
  24. * 00024000
  25. * GPR0 - LENGTH OF STRING (LINE FROM DMSEDI) 00025000
  26. * GPR1 - ADDRESS OF STRING TO BE ORDERED 00026000
  27. * GPR13- EDCB ADDRESS 00026100
  28. * 00027000
  29. * EXIT CONDTIONS - 00028000
  30. * GPR0 - (NEW) LENGTH OF ORDERED STRING 00029000
  31. * 00030000
  32. * CALLS TO OTHER ROUTINES - 00031000
  33. * 00032000
  34. * NONE - 00033000
  35. * 00034000
  36. * EXTERNAL REFERENCES _ 00035000
  37. * 00036000
  38. * NONE 00037000
  39. * 00038000
  40. * TABLES/WORKAREAS - 00039000
  41. * 00040000
  42. * DUALNOS -AREA FOR DUAL NUMBERING SCHEME FOR ORDERING 00041000
  43. * 00042000
  44. * REGISTER USAGE - 00043000
  45. * 00044000
  46. * GPR1 - ADDRESS OF INPUT STRING 00045000
  47. * GPR10- ROUTINE ADDRESSABILITY 00046000
  48. * GPR13- EDCB ADDRESS 00046100
  49. * GPR14- RETURN ADDRESS IN DMSEDI 00047000
  50. * 00048000
  51. * NOTES - 00049000
  52. * 00050000
  53. * DMSEDC IS LOADED WITH DMSEDI AS FOLLOWS: 00051000
  54. * LOAD DMSEDI DMSEDA DMSEDF DMSEDC (TYPE 00052000
  55. * 00053000
  56. * 00054000
  57. * OPERATION - 00055000
  58. * 00056000
  59. * DMSEDC RECEIVES THE LENGTH OF THE 00057000
  60. * STRING TO BE ORDERED IN R0 AND THE ADDRESS OF 00058000
  61. * THE STRING IN R1. 00059000
  62. * AFTER INITIALIZING WORK REGISTERS. DMSEDC 00060000
  63. * ASSIGNS DUAL NUMBERS TO THE CHARACTERS IN THE CALLER'S 00061000
  64. * STRING, FORMING THE TEMPORARY STING BUFFER DUALNOS. 00062000
  65. * BACKSPACES ARE TREATED AS EXCEPTIONS TO THE 00063000
  66. * NORMAL SCHEMED, BEING GIVEN A NUMBER '0' TO SIGNIFY AN 00064000
  67. * OVERSTRUCK CHARACTER LATER IN PROCESSING. 00065000
  68. * CHARACTERS ARE SORTED TO GET CHARS. WITH BACKPSACES 00066000
  69. * IN EBCDIC ORDER AND THE NEW CANONICALIZED STRING IS ARRAN 00067000
  70. * AND PADDED, IF NECESSARY. RETURN IS MADE TO DMSEDI VIA 00068000
  71. * R14. 00069000
  72. * 00070000
  73. *. 00071000
  74. SPACE 2 00072000
  75. SPACE 2 00073000
  76. DMSEDC START 00074000
  77. ENTRY EDCANON 00075000
  78. EDCANON EQU DMSEDC 00076000
  79. USING EDCB,R13 @V305614 00076100
  80. USING EDCANON,R15 00077000
  81. STM R0,R10,SAVEAR SAVE REGISTERS @V305614 00078100
  82. DROP R15 00079000
  83. LR R10,R15 SET UP PERMANENT BASE 00080000
  84. USING EDCANON,R10 00081000
  85. USING BUFFSECT,R1 00082000
  86. SPACE 00083000
  87. LTR R3,R0 LENGTH OF STRING 00084000
  88. BNH EXIT BRANCH IF <= 0 00085000
  89. SR R0,R0 KEEP ZERO IN R0 00086000
  90. LA R4,239 MAXIMUM 00087000
  91. CR R3,R4 COMPARE GIVEN LENGTH WITH THAT 00088000
  92. BNH *+6 SKIP IF <= 00089000
  93. LR R3,R4 SET LENGTH TO MAX. 00090000
  94. LR R2,R3 SET CHARACTER COUNT 00091000
  95. SPACE 00092000
  96. LA R4,64 INITIALIZE DUAL NUMBER 00093000
  97. SR R5,R5 INDEX = 0 00094000
  98. B DUALP2 BRANCH INTO LOOP 00095000
  99. EJECT 00096000
  100. *********************************************************************** 00097000
  101. * 00098000
  102. * ASSIGN DUAL NUMBERS IN THE STRING 'DUALNOS' 00099000
  103. * 00100000
  104. *********************************************************************** 00101000
  105. SPACE 00102000
  106. DUALP1 EQU * 00103000
  107. LA R4,1(R4) INCREMENT DUAL NUMBER 00104000
  108. DUALP3 EQU * 00105000
  109. LA R5,1(R5) AND INDEX 00106000
  110. DUALP2 EQU * 00107000
  111. LA R7,BUFF(R5) POINT TO CHARACTER IN BUFFER 00108000
  112. CLI 0(R7),X'16' BACKSPACE? 00109000
  113. BE DUALP4 BRANCH IF SO 00110000
  114. STC R4,DUALNOS(R5) STORE DUAL NUMBER 00111000
  115. BCT R3,DUALP1 DECREMENT LENGTH AND LOOP 00112000
  116. B SORT1 00113000
  117. SPACE 00114000
  118. DUALP4 EQU * 00115000
  119. BCTR R4,0 DECREMENT DUAL NUMBER 00116000
  120. BCTR R2,0 AND CHARACTER COUNT 00117000
  121. STC R0,DUALNOS(R5) STORE DUAL FOR BACKSPACE (0) 00118000
  122. BCT R3,DUALP3 AND LOOP 00119000
  123. EJECT 00120000
  124. *********************************************************************** 00121000
  125. * 00122000
  126. * SORT CHARACTERS IN BUFFER 00123000
  127. * 00124000
  128. *********************************************************************** 00125000
  129. SPACE 00126000
  130. SORT1 EQU * 00127000
  131. SR R6,R6 USE R6 AND R7 AS TEMPS. 00128000
  132. SR R7,R7 00129000
  133. L R3,SAVEAR GET GIVEN LENGTH @V305614 00130100
  134. BCTR R3,0 DECREASE BY 1 00131000
  135. LTR R3,R3 ZERO? 00132000
  136. BZ ARRANGE1 BRANCH IF SO (SKIP THE SORT) 00133000
  137. SORT2 EQU * 00134000
  138. SR R5,R5 INITIALIZE INDEX = 0 00135000
  139. LA R9,ARRANGE1 SET TRANSFER ADDRESS 00136000
  140. B SORT4 00137000
  141. SPACE 00138000
  142. SORT3 EQU * 00139000
  143. LA R5,1(R5) INCREMENT INDEX 00140000
  144. CR R5,R3 COMPARE WITH LENGTH TO SORT 00141000
  145. BE ARRANGE BRANCH IF = 00142000
  146. SORT4 EQU * 00143000
  147. IC R6,DUALNOS(R5) PICK UP DUAL NUMBERS 00144000
  148. IC R7,DUALNOS+1(R5) 00145000
  149. CR R6,R7 COMPARE THIS ONE WITH NEXT 00146000
  150. BE SORT3A BRANCH IF EQUAL (COMPARE EBCDIC-WISE) 00147000
  151. BL SORT3 BRANCH IF < (ALREADY CORRECT) 00148000
  152. SORT4B EQU * INTERCHANGE THIS AND NEXT 00149000
  153. STC R6,DUALNOS+1(R5) 00150000
  154. STC R7,DUALNOS(R5) 00151000
  155. IC R6,BUFF(R5) 00152000
  156. IC R7,BUFF+1(R5) 00153000
  157. STC R6,BUFF+1(R5) 00154000
  158. STC R7,BUFF(R5) 00155000
  159. LA R9,SORT2 RESET TRANSFER ADDRESS 00156000
  160. B SORT3 AND CARRY ON WITH SORT 00157000
  161. SPACE 00158000
  162. ARRANGE EQU * 00159000
  163. BCTR R3,R9 DECREMENT LENGTH AND REPEAT SORT 00160000
  164. B ARRANGE1 OR ARRANGE IF THROUGH HERE 00161000
  165. SPACE 00162000
  166. SORT3A EQU * 00163000
  167. LA R8,BUFF(R5) LOOK AT THIS CHARACTER 00164000
  168. CLC 0(1,R8),1(R8) COMPARE ITS EBCDIC VALUE WITH THE NEXT 00165000
  169. BNH SORT3 BRANCH IF WRONG WAY ROUND (THIS WAS BUG) 00166000
  170. B SORT4B 00167000
  171. EJECT 00168000
  172. *********************************************************************** 00169000
  173. * 00170000
  174. * ARRANGE THE NEW CANONICALIZED STRING 00171000
  175. * 00172000
  176. *********************************************************************** 00173000
  177. SPACE 00174000
  178. ARRANGE1 EQU * 00175000
  179. L R5,SAVEAR GIVEN LENGTH @V305614 00176100
  180. STC R0,DUALNOS(R5) PUT A ZERO AT END 00177000
  181. SR R5,R2 NO OF BACKSPACES 00178000
  182. LTR R3,R2 NO OF NON-BACKSPACES 00179000
  183. LR R8,R1 POINT R8 TO BUFF 00180000
  184. BZ PAD BRANCH IF NO NON-BACKSPACES 00181000
  185. ARRANGE2 EQU * 00182000
  186. IC R6,BUFF(R5) GET CHARACTER (NOT BACKSPACE) 00183000
  187. STC R6,0(R8) AND PUT IT IN PLACE 00184000
  188. LA R7,DUALNOS(R5) GET DUAL NUMBER 00185000
  189. CLC 0(1,R7),1(R7) COMPARE WITH NEXT 00186000
  190. BNE ARRANGE3 BRANCH IF NOT 00187000
  191. LA R7,BUFF(R5) LOOK AT CHARACTER 00188000
  192. CLI 0(R7),C' ' BLANK? 00189000
  193. BE ARRANGE4 BRANCH IF SO (IGNORE) 00190000
  194. LA R8,1(R8) MOVE TO NEXT SPOT 00191000
  195. MVI 0(R8),X'16' AND MOVE IN A BACKSPACE 00192000
  196. ARRANGE3 EQU * 00193000
  197. LA R8,1(R8) MOVE TO NEXT SPOT 00194000
  198. ARRANGE4 EQU * 00195000
  199. LA R5,1(R5) LOOK AT NEXT CHARACTER 00196000
  200. BCT R3,ARRANGE2 AND LOOP UNTIL FINISHED 00197000
  201. EJECT 00198000
  202. *********************************************************************** 00199000
  203. * 00200000
  204. * PAD ANY REMAINDER AND SET LENGTH 00201000
  205. * 00202000
  206. *********************************************************************** 00203000
  207. SPACE 00204000
  208. PAD EQU * 00205000
  209. L R7,SAVEAR GIVEN LENGTH @V305614 00206100
  210. LR R6,R8 LAST BYTE NOW USED 00207000
  211. SR R6,R1 CONVERT TO LENGTH 00208000
  212. CR R6,R7 COMPARE WITH ORIGINAL 00209000
  213. BNL SETL BRANCH IF = 00210000
  214. MVI 0(R8),C' ' BLANK OUT NEXT BYTE 00211000
  215. LA R3,1(R6) INCREMENT LENGTH 00212000
  216. CR R3,R7 STILL SHORT? 00213000
  217. BNL SETL BRANCH IF NOW = 00214000
  218. SR R7,R3 CONVERT TO LENGTH 00215000
  219. BCTR R7,0 DECREASE FOR EXEC 00216000
  220. EX R7,BLANKPAD PAD REMAINDER 00217000
  221. SETL EQU * 00218000
  222. ST R6,SAVEAR SAVE NEW LEBGTH @V305614 00219100
  223. SPACE 00220000
  224. EXIT EQU * 00221000
  225. LM R0,R10,SAVEAR RESTORE REGISTERS @V305614 00222100
  226. BR R14 RETURN 00223000
  227. EJECT 00224000
  228. *********************************************************************** 00225000
  229. * 00226000
  230. * EXECUTE INSTRUCTIONS, DATA AND DSECTS 00227000
  231. * 00228000
  232. *********************************************************************** 00229000
  233. SPACE 00230000
  234. BLANKPAD MVC 1(0,R8),0(R8) 00231000
  235. SPACE 00238000
  236. LTORG 00239000
  237. SPACE 2 00240000
  238. BUFFSECT DSECT 00241000
  239. BUFF DS CL240 00242000
  240. SPACE 3 00243000
  241. EDCB , @V305614 00243100
  242. EJECT 00243200
  243. REGEQU 00244000
  244. SPACE 3 00245000
  245. END 00246000