cdc:nos2.source:nam5871:np_bto8
Table of Contents
NP$BTO8
Table Of Contents
- [00003] PROC NP$BTO8((NPINUM),NPOUTAS)
Source Code
- NP$BTO8.txt
- *DECK,NP$BTO8
- *IF,DEF,XFR
- PROC NP$BTO8((NPINUM),NPOUTAS);
- BEGIN
- #
- *1DC NP$BTO8
- *
- * 1. PROC NAME AUTHOR DATE
- *
- * NP$BTO8 Y. C. YIP 06/03/1983
- *
- * 2. FUNCTIONAL DESCRIPTION.
- * THIS PROCEDURE WHEN CALLED RETURNS THE ASCII REPRESENTATION
- * OF THE FIRST PARAMETER PASSED IN THE SECOND PARAMETER.
- *
- * 3. METHOD USED.
- * AN INTERNAL ARRAY IS USED TO MAP THE VALUE OF EACH DECIMAL
- * DIGIT INTO ITS ASCII REPRESENTATION. THE ONLY LIMITATIONS
- * ARE SUCH THAT IT ONLY CONVERTS BINARY VALUE OF 1-4 DIGITS.
- *
- * 4. ENTRY CONDITIONS.
- * NPINUM - VALUE TO BE CONVERTED INTO ASCII REPRESENTATION.
- * NPOUTAS - RETURN PARAMETER HOLDING THE ASCII REPRESENTATION.
- *
- * EXIT CONDITIONS.
- * NPINUM - UNCHANGED.
- * NPOUTAS - RETURN VALUE OF THE ASCII REPRESENTATION OF NPINUM.
- *
- * 6. COMDECKS CALLED AND SYMPL TEXTS USED.
- * NX$ACBX
- *
- * 7. ROUTINES CALLED
- * NONE
- *
- * 8. DAYFILE MESSAGES
- * NONE
- *
- #
- DEF STBIT # 28 #; # START BIT OF ASCII VALUE #
- DEF LOWB # 0 #; # LOWER BOUND OF INTERNAL ARRAY #
- DEF UPPB # 9 #; # UPPER BOUND OF INTERNAL ARRAY #
- DEF DECVALUE # 10 #; # DECIMAL 10 #
- DEF ENTY1 # 1 #; # ENTRY SIZE OF ONE WORD #
- DEF MULTIPLE # 1000 #; # INITIAL FACTOR OF CONVERSION #
- DEF LASTDD # 4 #; # NUMBER OF ASCII IN DD FIELD #
- DEF BYTS # 8 #; # NUMBER OF BITS PER ASCII BYTE #
- ITEM NPINUM ; # VALUE TO BE CONVERTED #
- ITEM NPOUTAS; # RETURN PARAMETER #
- ITEM INDEX; # LOOP INDEX #
- ITEM STARTBIT; # START BIT OF THE ASCII VALUE #
- ITEM TEMP; # TEMPORARY VARIABLE #
- ITEM FACTOR; # FACTOR OF DIVISION #
- ARRAY ASCMAP[LOWB : UPPB] S(ENTY1); # INTERNAL MAP FOR ASCII #
- BEGIN # CONVERSION #
- ITEM ASCIIV U(00,00,08) =[X"30", # 0 #
- X"31", # 1 #
- X"32", # 2 #
- X"33", # 3 #
- X"34", # 4 #
- X"35", # 5 #
- X"36", # 6 #
- X"37", # 7 #
- X"38", # 8 #
- X"39" # 9 #
- ];
- END
- CONTROL EJECT;
- #**********************************************************************#
- # #
- # CODE OF NP$BTO8 BEGINS HERE #
- # #
- #**********************************************************************#
- FACTOR = MULTIPLE; # ASSIGN INITAL VALUE OF #
- # FACTOR #
- STARTBIT = STBIT; # ASSIGN INITIAL VALUE OF #
- # START BIT #
- NPOUTAS = 0; # CLEAR RETURN PARAMETER #
- FOR INDEX = 1 STEP 1 UNTIL LASTDD # START CONVERTING #
- DO
- BEGIN
- TEMP = NPINUM/FACTOR; # FETCH MOST SIGNIFICANT DITIT#
- B<STARTBIT,BYTS>NPOUTAS = ASCIIV[TEMP]; # GET MAPPED VALUE #
- NPINUM = NPINUM - TEMP*FACTOR; # GET NEXT MOST SIGNIFICANT #
- # DIGIT #
- FACTOR = FACTOR/DECVALUE; # DECREASE MAGNITUDE OF FACTOR#
- # BY 10 #
- STARTBIT = STARTBIT + BYTS; # ASSIGN TO NEXT BYTE #
- END
- RETURN; # RETURN TO CALLER #
- END # END OF PROC NP$BTO8 #
- TERM
- *ENDIF
cdc/nos2.source/nam5871/np_bto8.txt ยท Last modified: 2023/08/05 17:22 by Site Administrator