User Tools

Site Tools


cdc:nos2.source:nam5871:dldis

Table of Contents

DLDIS

Table Of Contents

  • [00005] PROC DLDIS (AWORD,RETRNH,RETRNO,RETRND,RETRNA)
  • [00075] PROC DLDISO

Source Code

DLDIS.txt
  1. *DECK DLDIS
  2. USETEXT DLFPDEF
  3. USETEXT DEQCOM
  4. USETEXT WRDPAIR
  5. PROC DLDIS (AWORD,RETRNH,RETRNO,RETRND,RETRNA);
  6. BEGIN
  7. #
  8. *1DC DLDIS
  9. *
  10. * 1. PROC NAME AUTHOR DATE
  11. * DLDIS KRULEVITCH 78/10/10
  12. *
  13. * 2. FUNCTIONAL DESCRIPTION
  14. * CONVERTS DATA INTO HEX,OCTAL,DISPLAY CODE CHARACTERS AND ASCII
  15. * CODE CHARACTERS.
  16. *
  17. * 3. METHOD USED
  18. * A CHARACTER WORD ITEM CONTAINS A DISPLAY CODE CONVERSION TABLE
  19. * FOR EACH HEX, OCTAL, AND ASCII CODES.
  20. * FOR DISPLAY CODE ZERO BYTES ARE CONVERTED TO BLANKS.
  21. * FOR ASCII CODE THE CONVERSION TABLE IS ADJUSTED FOR 63 OR 64
  22. * CHARACTER SET.
  23. * THE ASCII CHARACTER IS RETRIEVED FROM AWORD. IF THIS IS THE
  24. * SECOND WORD OF A WORD PAIR THE UPPER HEX DIGIT IS IN COMMON IN
  25. * ACHAR. IF CT = CT12ASC OR CT12ASZ,THEN THE ASCII CHARACTER
  26. * IS RIGHT JUSTIFIED IN 12 BIT BYTES.
  27. * THE ASCII CHARACTER IS STORED IN THE OUTPUT WORD. 7 CHARACTERS
  28. * AND 1 BLANK ARE STORED IN ODD WORDS. 8 CHARACTERS ARE STORED IN
  29. * EVEN WORDS (PAIR=TRUE). LOWER CASE CHARACTERS ARE MAPPED INTO
  30. * UPPER CASE CHARACTERS. FOR CT = CT12ASC/CT12ASZ
  31. * 5 CHARACTERS ARE STORED WITH BLANK FILL.
  32. *
  33. * 4. ENTRY CONDITIONS
  34. * AWORD - CONTAINS MESSAGE TEXT TO BE CONVERTED
  35. * PAIR - FALSE,IF AWORD IS THE FIRST WORD OF ASCII WORD PAIR
  36. * ASKICHAR - CONTAINS THE UPPER HEX DIGIT IF PAIR IS TRUE
  37. * CT - CT8ASCII, 7.5 CHARACTERS PER WORD (ACT=2)
  38. * CT12ASC, 5 ASCII CHARACTERS PER WORD (ACT=3)
  39. * CT12ASZ, 5 ASCII CHARACTERS PER WORD,NULL CHARACTER
  40. * HAS HIGH BIT SET (ACT=5)
  41. *
  42. * 5. EXIT CONDITIONS
  43. * RETRNH - HEX OUTPUT
  44. * RETRNO - OCTAL OUTPUT
  45. * RETRND - DISPLAY CODE CHARACTERS
  46. * RETRNA - ASCII CODE CHARACTERS
  47. *
  48. * 6. COMDECKS CALLED AND SYMPL TEXTS USED.
  49. * DEQCOM DLFPDEF WRDPAIR
  50. *
  51. * 7. PROCEDURES/FUNCTIONS CALLED
  52. * DLDISO CONVERT OCTAL TO DISPLAY
  53. *
  54. * 8. DAYFILE/DIAGNOSTIC MESSAGES
  55. * NONE
  56. *
  57.  #
  58. #
  59.   INPUT PARAMETERS
  60. #
  61. ITEM AWORD U; # WORD TO BE CONVERTED #
  62. CONTROL PRESET;
  63. #
  64.   OUTPUT PARAMETERS
  65. #
  66. ITEM RETRNH C(15); # HEXIDECIMAL CONVERSION #
  67. ITEM RETRNO C(20); # OCTAL CONVERSION #
  68. ITEM RETRND C(10); # DISPLAY CONVERSION #
  69. ITEM RETRNA C(8); # ASCII OUTPUT #
  70. #
  71.   EXTERNAL REFERENCES
  72. #
  73. XREF
  74. BEGIN
  75. PROC DLDISO; # CONVERTS OCTAL TO DISPLAY CODE #
  76. END
  77.  
  78. #
  79.   LOCAL VARIABLES
  80. #
  81.  
  82. DEF HEXL # 4 #; # HEXIDECIMAL DIGIT LENGTH IN BITS #
  83. DEF ASCL # 8 #; # ASCII CHARACTER LENGTH #
  84. DEF ASCL12 # 12 #; # ASCII CHARACTER IN 12 BIT BYTE #
  85. DEF CT12ASZ # 3 #; # CHARACTER TYPE OF ASCII, 5 PER WORD #
  86. DEF LCPOS # 52 #; # LAST POSSIBLE FULL ASCII CHARACTER POS #
  87.  
  88. ARRAY MSGTEXT [0:0] S(1);
  89. BEGIN
  90. ITEM DCWORD C(0,0,10); # DISPLAY CODE CHARACTERS #
  91. ITEM TXTWORD I(0,0,WL); # WORD TO BE CONVERTED #
  92. END
  93.  
  94. BASED ARRAY IPCSET [0:0] S(1);
  95. ITEM CSET B(0,0,1); # 1 IF 64CSET,0 IF 63CSET #
  96.  
  97. # HEXIDECIMAL TO DISPLAY CONVERSION #
  98. ITEM HEXC C(16) = "0123456789ABCDEF";
  99. # ASCII TO DISPLAY CONVERSION TABLE #
  100. ITEM DC C(64) =
  101. " !""#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"
  102. ;
  103.  
  104. ITEM ASC12BYT B=FALSE; # TRUE IF ACT=CT12ASC/CT12ASZ #
  105. ITEM ASKIPOS; # ASCII CHARACTER BIT POSITION #
  106. ITEM DCPOS; # DISPLAY CHARACTER POSITION #
  107. ITEM HEX; # 4 BIT HEXIDECIMAL DIGIT #
  108. ITEM I; # DO LOOP INDUCTION VARIABLE #
  109. ITEM J; # DO LOOP INDUCTION VARIABLE #
  110. #**********************************************************************#
  111. #
  112.   DLDIS EXECUTION BEGINS HERE
  113. #
  114. #
  115.   HEXIDECIMAL TO DISPLAY CONVERSION
  116. #
  117. FOR I = 0 STEP 1 UNTIL 14 DO
  118. BEGIN
  119. HEX = B<I*HEXL,HEXL> AWORD;
  120. C<I,1> RETRNH = C<HEX> HEXC;
  121. END
  122. #
  123.   OCTAL TO DISPLAY CODE CONVERSION
  124. #
  125. DLDISO(AWORD,20,RETRNO);
  126. #
  127.   DISPLAY CODE CONVERSION OF ZERO BYTES FOR 64 CHARACTER SET
  128. #
  129. TXTWORD[0] = AWORD;
  130. RETRND = DCWORD[0]; # ASSUME TEXT WORD DISPLAY CODE #
  131. FOR I = 0 STEP 1 UNTIL 9 DO
  132. BEGIN
  133. IF C<I,1>RETRND EQ 0
  134. THEN # CONVERT ZERO BYTES TO BLANKS #
  135. C<I,1>RETRND = " ";
  136. END
  137.  
  138. #
  139.   ASCII TO DISPLAY CODE CONVERSION
  140. #
  141. # CHECK INSTALLATION"S CHARACTER SET #
  142. P<IPCSET> = CSMRLOC; # POSITION AT MACHINE CHARACTERISTIC WORD #
  143. IF NOT CSET
  144. THEN # 63 CSET #
  145. C<5>DC = " "; # % SHOULD YIELD A BLANK #
  146. ELSE # 64 CSET #
  147. C<26>DC = " "; # : SHOULD YIELD A BLANK #
  148. # INITIALIZE BEGINNING WORD-BIT POSITIONS #
  149. DCPOS = 0; # DISPLAY CHARACTER WORD POSITION #
  150. ASC12BYT = CT EQ CT12ASC OR CT EQ CT12ASZ;
  151. IF ASC12BYT # 8 BIT CODE IN 12 BIT BYTES #
  152. THEN
  153. ASKIPOS = 4; # FIRST TEXT BIT #
  154. ELSE # 8 BIT ASCII CODE, 7.5 CHAR PER WORD #
  155. ASKIPOS = 0; # FIRST TEXT BIT #
  156. FOR J = 1 STEP 1 UNTIL 8
  157. DO # CONVERT ASCII TO DISPLAY #
  158. BEGIN
  159. #
  160.   GET ASCII CHARACTER
  161. #
  162. IF ASKIPOS LQ LCPOS
  163. THEN # ASCII CHAR DOES NOT CROSS WORD BOUND #
  164. BEGIN
  165. IF PAIR AND ASKIPOS EQ 0
  166. THEN
  167. BEGIN
  168. B<4,4>ACHAR[0] = B<0,4>AWORD;
  169. ASKIPOS = 4; # START BIT OF NEXT CHARACTER #
  170. END # LAST HALF OF ASCII CHAR #
  171. ELSE
  172. BEGIN
  173. ACHAR[0] = B<ASKIPOS,ASCL>AWORD;
  174. IF ASKIPOS NQ LCPOS
  175. THEN # NEXT CHARACTER IN CURRENT WORD #
  176. BEGIN
  177. IF ASC12BYT
  178. THEN
  179. ASKIPOS = ASKIPOS + ASCL12;
  180. ELSE
  181. ASKIPOS = ASKIPOS + ASCL;
  182. END
  183. ELSE # NEXT CHAR. AT START OF NEXT WORD #
  184. ASKIPOS = 0;
  185. END
  186. END
  187. ELSE # ASCII CHAR WILL CROSS WORD BOUNDARY #
  188. BEGIN
  189. IF NOT PAIR
  190. THEN
  191. B<0,4>ACHAR[0] = B<ASKIPOS,4>AWORD;
  192. END
  193.  
  194. ACHARPB[0] = 0; # ZERO PARITY BIT. #
  195.  
  196. #
  197.   CONVERT AND STORE DISPLAY CHARACTER
  198. #
  199. IF ACHAR[0] LQ X"20"
  200. OR (DCPOS EQ 7 AND NOT PAIR)
  201. OR (DCPOS GQ 5 AND ASC12BYT)
  202. THEN # BLANK OR NO CORRESPONDING DISPLAY CHAR #
  203. C<DCPOS>DCWORD[0] = " "; # STORE A BLANK #
  204. ELSE # GET CORRESPONDING DISPLAY CHAR #
  205. BEGIN
  206. IF ACHAR[0] GR X"5F"
  207. THEN # MAP LOWER CASE INTO UPPER CASE #
  208. ACHAR[0] = ACHAR[0] - X"40";
  209. ELSE
  210. ACHAR[0] = ACHAR[0] - X"20";
  211. C<DCPOS>DCWORD[0] = C<ACHAR[0]>DC; # STORE DISPLAY CHAR #
  212. END
  213. IF J NQ 8
  214. THEN # SET CHAR POS FOR NEXT LOOP ITERATION #
  215. IF DCPOS NQ 7
  216. THEN # MORE ROOM LEFT IN CURRENT WORD #
  217. DCPOS = DCPOS + 1;
  218. ELSE # SET POINTERS FOR NEXT WORD #
  219. DCPOS = 0; # FIRST CHARACTER #
  220. END
  221. PAIR = NOT PAIR;
  222. RETRNA = DCWORD[0];
  223. RETURN;
  224. END # DLDIS #
  225. TERM
cdc/nos2.source/nam5871/dldis.txt ยท Last modified: 2023/08/05 17:22 by Site Administrator