*DECK NS$CHD
FUNC NS$CHD(NPUWORD) C(10); # CONVERT NPU WORD TO DISPLAY CODED HEX #
# TITLE NS$CHD - CONVERT NPU WORD TO DISPLAY CODED HEX. #
BEGIN # NS$CHD #
#
** NS$CHD - CONVERT NPU WORD TO DISPLAY CODED HEX.
*
* J.C. LEE 1981
*
* THIS IS A UTILITY FUNCTION SUBPROGRAM.
* ITS FUNCTION IS TO CONVERT NPU WORD TO DISPLAY CODED HEX.
*
* FUNC NS$CHD(NPUWORD)
*
* ENTRY:
* NPUWORD = 16-BIT NPU WORD.
*
* EXIT:
* NONE.
*
* METHOD:
* USE HEX DISPLAY CODE TABLE TO CONVERT NPU WORD TO
* DISPLAY CODED HEX.
*
#
ITEM NPUWORD U; # 16-BIT NPU WORD #
ITEM HDISCTAB C(16) = "0123456789ABCDEF"; # HEX DISPLAY CONVERT#
ITEM HEXCHAR U; # HEX CHARACTER #
ITEM HEXDISPLAY C(4); # 4 DISPLAY-CODED HEXADECIMALS #
ITEM I I; # LOOP VARIABLE #
CONTROL EJECT;
FOR I = 0 STEP 1 UNTIL 3
DO # CONVERT NPU WORD TO 4 DISPLAY-CODED HEX #
BEGIN
HEXCHAR = B<44+I*4,4>NPUWORD;
C<I,1>HEXDISPLAY = C<HEXCHAR,1>HDISCTAB;
END
NS$CHD = HEXDISPLAY; # RETURN DISPLAY-CODED HEX #
RETURN;
END # NS$CHD #
TERM