User Tools

Site Tools


cdc:nos2.source:nam5871:np_bto8

NP$BTO8

Table Of Contents

  • [00003] PROC NP$BTO8((NPINUM),NPOUTAS)

Source Code

NP$BTO8.txt
  1. *DECK,NP$BTO8
  2. *IF,DEF,XFR
  3. PROC NP$BTO8((NPINUM),NPOUTAS);
  4. BEGIN
  5. #
  6. *1DC NP$BTO8
  7. *
  8. * 1. PROC NAME AUTHOR DATE
  9. *
  10. * NP$BTO8 Y. C. YIP 06/03/1983
  11. *
  12. * 2. FUNCTIONAL DESCRIPTION.
  13. * THIS PROCEDURE WHEN CALLED RETURNS THE ASCII REPRESENTATION
  14. * OF THE FIRST PARAMETER PASSED IN THE SECOND PARAMETER.
  15. *
  16. * 3. METHOD USED.
  17. * AN INTERNAL ARRAY IS USED TO MAP THE VALUE OF EACH DECIMAL
  18. * DIGIT INTO ITS ASCII REPRESENTATION. THE ONLY LIMITATIONS
  19. * ARE SUCH THAT IT ONLY CONVERTS BINARY VALUE OF 1-4 DIGITS.
  20. *
  21. * 4. ENTRY CONDITIONS.
  22. * NPINUM - VALUE TO BE CONVERTED INTO ASCII REPRESENTATION.
  23. * NPOUTAS - RETURN PARAMETER HOLDING THE ASCII REPRESENTATION.
  24. *
  25. * EXIT CONDITIONS.
  26. * NPINUM - UNCHANGED.
  27. * NPOUTAS - RETURN VALUE OF THE ASCII REPRESENTATION OF NPINUM.
  28. *
  29. * 6. COMDECKS CALLED AND SYMPL TEXTS USED.
  30. * NX$ACBX
  31. *
  32. * 7. ROUTINES CALLED
  33. * NONE
  34. *
  35. * 8. DAYFILE MESSAGES
  36. * NONE
  37. *
  38. #
  39. DEF STBIT # 28 #; # START BIT OF ASCII VALUE #
  40. DEF LOWB # 0 #; # LOWER BOUND OF INTERNAL ARRAY #
  41. DEF UPPB # 9 #; # UPPER BOUND OF INTERNAL ARRAY #
  42. DEF DECVALUE # 10 #; # DECIMAL 10 #
  43. DEF ENTY1 # 1 #; # ENTRY SIZE OF ONE WORD #
  44. DEF MULTIPLE # 1000 #; # INITIAL FACTOR OF CONVERSION #
  45. DEF LASTDD # 4 #; # NUMBER OF ASCII IN DD FIELD #
  46. DEF BYTS # 8 #; # NUMBER OF BITS PER ASCII BYTE #
  47. ITEM NPINUM ; # VALUE TO BE CONVERTED #
  48. ITEM NPOUTAS; # RETURN PARAMETER #
  49. ITEM INDEX; # LOOP INDEX #
  50. ITEM STARTBIT; # START BIT OF THE ASCII VALUE #
  51. ITEM TEMP; # TEMPORARY VARIABLE #
  52. ITEM FACTOR; # FACTOR OF DIVISION #
  53.  
  54. ARRAY ASCMAP[LOWB : UPPB] S(ENTY1); # INTERNAL MAP FOR ASCII #
  55. BEGIN # CONVERSION #
  56. ITEM ASCIIV U(00,00,08) =[X"30", # 0 #
  57. X"31", # 1 #
  58. X"32", # 2 #
  59. X"33", # 3 #
  60. X"34", # 4 #
  61. X"35", # 5 #
  62. X"36", # 6 #
  63. X"37", # 7 #
  64. X"38", # 8 #
  65. X"39" # 9 #
  66. ];
  67. END
  68. CONTROL EJECT;
  69. #**********************************************************************#
  70. # #
  71. # CODE OF NP$BTO8 BEGINS HERE #
  72. # #
  73. #**********************************************************************#
  74.  
  75. FACTOR = MULTIPLE; # ASSIGN INITAL VALUE OF #
  76. # FACTOR #
  77. STARTBIT = STBIT; # ASSIGN INITIAL VALUE OF #
  78. # START BIT #
  79. NPOUTAS = 0; # CLEAR RETURN PARAMETER #
  80. FOR INDEX = 1 STEP 1 UNTIL LASTDD # START CONVERTING #
  81. DO
  82. BEGIN
  83. TEMP = NPINUM/FACTOR; # FETCH MOST SIGNIFICANT DITIT#
  84. B<STARTBIT,BYTS>NPOUTAS = ASCIIV[TEMP]; # GET MAPPED VALUE #
  85. NPINUM = NPINUM - TEMP*FACTOR; # GET NEXT MOST SIGNIFICANT #
  86. # DIGIT #
  87. FACTOR = FACTOR/DECVALUE; # DECREASE MAGNITUDE OF FACTOR#
  88. # BY 10 #
  89. STARTBIT = STARTBIT + BYTS; # ASSIGN TO NEXT BYTE #
  90. END
  91. RETURN; # RETURN TO CALLER #
  92. END # END OF PROC NP$BTO8 #
  93. TERM
  94. *ENDIF
cdc/nos2.source/nam5871/np_bto8.txt ยท Last modified: 2023/08/05 17:22 by Site Administrator