User Tools

Site Tools


cdc:nos2.source:nam5871:ns_chd

NS$CHD

Table Of Contents

  • [00002] FUNC NS$CHD(NPUWORD) C(10)
  • [00004] NS$CHD - CONVERT NPU WORD TO DISPLAY CODED HEX.
  • [00008] CONVERT NPU WORD TO DISPLAY CODED HEX.

Source Code

NS$CHD.txt
  1. *DECK NS$CHD
  2. FUNC NS$CHD(NPUWORD) C(10); # CONVERT NPU WORD TO DISPLAY CODED HEX #
  3.  
  4. # TITLE NS$CHD - CONVERT NPU WORD TO DISPLAY CODED HEX. #
  5.  
  6. BEGIN # NS$CHD #
  7. #
  8. ** NS$CHD - CONVERT NPU WORD TO DISPLAY CODED HEX.
  9. *
  10. * J.C. LEE 1981
  11. *
  12. * THIS IS A UTILITY FUNCTION SUBPROGRAM.
  13. * ITS FUNCTION IS TO CONVERT NPU WORD TO DISPLAY CODED HEX.
  14. *
  15. * FUNC NS$CHD(NPUWORD)
  16. *
  17. * ENTRY:
  18. * NPUWORD = 16-BIT NPU WORD.
  19. *
  20. * EXIT:
  21. * NONE.
  22. *
  23. * METHOD:
  24. * USE HEX DISPLAY CODE TABLE TO CONVERT NPU WORD TO
  25. * DISPLAY CODED HEX.
  26. *
  27. #
  28.  
  29. ITEM NPUWORD U; # 16-BIT NPU WORD #
  30.  
  31. ITEM HDISCTAB C(16) = "0123456789ABCDEF"; # HEX DISPLAY CONVERT#
  32. ITEM HEXCHAR U; # HEX CHARACTER #
  33. ITEM HEXDISPLAY C(4); # 4 DISPLAY-CODED HEXADECIMALS #
  34. ITEM I I; # LOOP VARIABLE #
  35.  
  36. CONTROL EJECT;
  37.  
  38. FOR I = 0 STEP 1 UNTIL 3
  39. DO # CONVERT NPU WORD TO 4 DISPLAY-CODED HEX #
  40. BEGIN
  41. HEXCHAR = B<44+I*4,4>NPUWORD;
  42. C<I,1>HEXDISPLAY = C<HEXCHAR,1>HDISCTAB;
  43. END
  44.  
  45. NS$CHD = HEXDISPLAY; # RETURN DISPLAY-CODED HEX #
  46.  
  47. RETURN;
  48. END # NS$CHD #
  49. TERM
cdc/nos2.source/nam5871/ns_chd.txt ยท Last modified: 2023/08/05 17:22 by Site Administrator