*DECK KPUT
IDENT KPUT
ENTRY KPUT
KPUT BSSZ 1
SB1 1
SA1 A1
SA2 X1 X2 HAS FIRST PARAM(KADR)
SA3 A1+B1 ADDRESS NEXT PARAM
SA4 A3+B1 AND THE NEXT ONE
SA3 X3 X3 HAS 2ND PARAM(KINDEX)
SA5 A4+1 LAST PARAM
SA4 X4 X4 HAS THE *SYMBOL* VALUE
SA1 X5 X1 HAS THE VALUE TO BE CONVERTED
*
* ANALIZE THE *SYMBOL* WORD
*
MX6 54
BX6 -X6*X4
SA5 SIX
IX5 X5*X6
SB6 X5 B6 HAS NUMBER OF BITS
MX6 54
AX4 6
BX6 -X6*X4
SA5 SIX
IX5 X5*X6
SB7 X5 B7 HAS THE STARTING BIT
AX4 6
MX6 57
BX5 -X6*X4 GET NEXT 3 BITS
SB2 X5 B2 HAS VALUE OF WORD NUMBER IN ENTRY
AX4 3
BX4 -X6*X4 X4 NOW HAS FUNCTION CODE
*
* COMPUTE THE ADDRESS OF WORD TO BE MODIFIED
*
SA5 SIX
IX5 X3*X5
IX5 X5+X2
SX5 X5+B2
SX5 X5+B1 SKIP OVER HEADER (2 WORDS)
SX5 X5+B1 X5 HAS THE CORRECT ADDRESS
SA5 X5 NOW X5=WORD TO BE MODIFIED,A5=ADDRESS
*
* CONVERT TO DESIRED VALUE FROM X1 TO LEFT JUST IN X4
*
ZR X4,CONV CONVERT FROM BINARY TO DISPLAY CODE DECIMAL
SX4 X4-1
ZR X4,COPY THIS IS TO CONVERT TO DISPLAY-CODE OCTAL
MX3 3
MX4 0 TO HOLD THE RESULT
SB2 10 MAXIMUM 10 DIGITS ARE CONSIDERED
LX1 30
LOOP LT B2,B1,OCT2
BX7 X3*X1 GET ONE DIGIT
LX7 3
SX7 X7+33B CONVERT TO OCTAL DISPLAY
LX4 6
BX4 X4+X7 AND PUT IN PLACE
LX1 3 GET ANOTHER DIGIT
SB2 B2-1 LOOP INCREMENT
JP LOOP
* LEFT JUSTIFY THE VALUE
OCT2 SB3 60
SB3 B3-B6
LX4 B3
JP INSERT
*
COPY BX4 X1 JUST GET THE (CHARACTER) VALUE...
JP INSERT
CONV RJ =XCDD=
*
* AND PLUG IT IN THE RIGHT BIT POSITIONS
*
INSERT MX7 1
SB6 B6-B1
AX7 B6 FORM MASK WITH PROPER BITS NO. IN X7
BX4 X4*X7 MASK THE VALUE TO BE INSERTED
SB3 60
SB7 B3-B7
LX7 B7 TAKE MASK TO STARTING BIT
LX4 B7 AND SO WITH THE VALUE INSERTED
BX5 -X7*X5 CLEAN FIELD FROM FORMER DATA
BX6 X5+X4
SA6 A5
EQ KPUT
SIX VFD 60/6
END