*DECK BCONV
IDENT BCONV
ENTRY BCONV
EXT XTRACE
SST
*#
*1DC BCONV
* 1. PROC NAME AUTHOR DATE
* BCONV J. C. LEE 76/07/28
* Y. HSIEH 77/06/06
*
* 2. FUNCTIONAL DESCRIPTION.
* THIS ROUTINE IS RESPONSIBLE FOR CHARACTER CONVERSION. IT TAKES
* CHARACTER STRINGS IN 8-BIT BYTES ASCII AND CONVERTS IT TO
* THE CHARACTER TYPE REQUESTED - 12-BIT BYTES ASCII OR
* 6-BIT BYTES DISPLAY CODE (63 OR 64 CHARACTER TYPE).
*
* 3. METHOD USED.
* ENTRY AND EXIT PARAMETERS ARE PASSED VIA COMMON FORDEQ
* GET CHARACTER STRING FROM DATA RING
* STORE PROCESSED CHARACTER STRING INTO BUFFER
*
* 4. ENTRY PARAMETERS.
* ACT CHARACTER TYPE TO CONVERT TO 12 BIT ASCII
* DRPTR FWA OF BUFFER BEFORE CONVERSION
* CHARCNT NUMBER OF CHARACTERS TO CONVERT
*
* 5. EXIT PARAMETERS.
* BUFFIN FWA OF BUFFER AFTER CONVERSION
*
* 6. COMDECKS CALLED.
* MACDEF INPARU DEQCOM(FORDEQ)
*
* 7. ROUTINES CALLED.
* XTRACE TRACE CALLS
*
* 7. DAYFILE MESSAGES. NONE
*
*#
**
*CALL MACDEF
*CALL INPARU
*CALL DEQCOM
** TABLE FOR CHARACTER CONVERSION
* DISPLAY CODE FOR CORRESPONDING ASCII VALUE
* THIS COMMON BLOCK IS ALSO USED BY ISCP AT NIP INIT. TIME
* TO ADJUST THE TABLE FOR 63 OR 64 CHAR. SET
USE /COMVERT/
CTABLE VFD 6/55B,6/55B,6/55B,6/55B,6/55B,6/55B,6/55B,6/55B,12/0
VFD 6/55B,6/55B,6/55B,6/55B,6/55B,6/55B,6/55B,6/55B,12/0
VFD 6/55B,6/55B,6/55B,6/55B,6/55B,6/55B,6/55B,6/55B,12/0
VFD 6/55B,6/55B,6/55B,6/55B,6/55B,6/55B,6/55B,6/55B,12/0
VFD 6/55B,6/54D,6/52D,6/48D,6/43D,6/51D,6/55D,6/56D,12/0
VFD 6/41D,6/42D,6/39D,6/37D,6/46D,6/38D,6/47D,6/40D,12/0
VFD 6/27D,6/28D,6/29D,6/30D,6/31D,6/32D,6/33D,6/34D,12/0
SET63A VFD 6/35D,6/36D,6/55B,6/63D,6/58D,6/44D,6/59D,6/57D,12/0
VFD 6/60D,6/01D,6/02D,6/03D,6/04D,6/05D,6/06D,6/07D,12/0
VFD 6/08D,6/09D,6/10D,6/11D,6/12D,6/13D,6/14D,6/15D,12/0
VFD 6/16D,6/17D,6/18D,6/19D,6/20D,6/21D,6/22D,6/23D,12/0
VFD 6/24D,6/25D,6/26D,6/49D,6/61D,6/50D,6/62D,6/53D,12/0
SET63B VFD 6/60D,6/01D,6/02D,6/03D,6/04D,6/05D,6/06D,6/07D,12/0
VFD 6/08D,6/09D,6/10D,6/11D,6/12D,6/13D,6/14D,6/15D,12/0
VFD 6/16D,6/17D,6/18D,6/19D,6/20D,6/21D,6/22D,6/23D,12/0
VFD 6/24D,6/25D,6/26D,6/49D,6/61D,6/50D,6/62D,6/53D,12/0
USE *
SPACE 5
** BCONV - ENTRY POINT CALLED BY BDELINK
* TO CONVERT INBOUND DATA FROM 8-BIT ASCII
* TO 12-BIT ASCII OR 6-BIT DISPLAY CODE
*
* REGISTER USAGE
*
* X0 = MASK FOR 8-BIT BYTES (52 OR 53-WITH NO PARITY BIT)
* X1 = SCRATCH
* X2 = INPUT WORD
* X3 = SCRATCH
* X4 = SCRATCH
* X5 = SCRATCH
* X6 = OUTPUT WORD
* X7 = 0 IF 12-BIT ASCII, 54 FOR 6-BIT DISPLAY CODE BYTES
*
* B0 = 0
* B1 = TOTAL CHARACTER COUNT
* B2 = INPUT BUFFER INDEX
* B3 = OUTPUT BUFFER INDEX
* B4 = 64, USED TO CHECK IF HALF CHAR. EXIST AT WORD BOUND.
* B5 = OUTPUT DATA SHIFT COUNT
* B6 = INPUT DATA SHIFT COUNT
* B7 = SCRATCH
BCONV DATA 0
IFEQ DEBUG,1,6
SX6 A1
SA6 TEMP
SX1 XBCONV
RJ XTRACE
SA1 TEMP
SA1 X1
* INITIALIZE REGISTERS
SA1 CHARCNT LOCATION HOLD CHARACTER COUNT
SB4 12 SHIFT COUNT FOR 12 BIT ASCII CHAR.
SB5 48 INIT. OUTPUT DATA SHIFT COUNT
SA2 DRPTR FWA OF INPUT BUFFER
SB1 X1 TOTAL CHARACTER COUNT
SA3 BUFFIN FWA OF OUTPUT BUFFER
SB2 X2 INPUT BUFFER POINTER
SB3 X3 OUTPUT BUFFER POINTER
SA4 ACT OUTPUT CHAR TYPE(12-BIT ASCII/DISPLY)
MX0 52 MASK FOR 8-BIT ASCII CODE
SB6 8 INIT. INPUT DATA SHIFT COUNT
SX7 X4-CT12ASC CHECK CHAR-TYPE IS 12-BIT ASCII
MX6 0 INIT. OUTPUT WORD TO ZERO
ZR X7,BCONVA SIGNAL 12-BIT ASCII CONVERSION
MX0 53 MASK FOR 8 BIT ASCII WITH NO PARITY
SB4 6 SHIFT COUNT FOR 6 BIT DISPLAY CHAR.
MX7 54 MASK FOR 6-BIT DISPLAY CODE
SB5 B4+B5 INIT. OUTPUT DATA SHIFT COUNT = 54
* READ IN NEXT WORD FROM INPUT BUFFER AND
* HANDLE HALF CHARACTER CASE
BCONVA BSS 0
BX3 X2 PREVIOUS INPUT WORD
SB7 B6-64 CHECK FOR HALF CHARACTER CONDITION
SA2 B2 READ NEXT WORD FROM INPUT BUFFER
SB6 8 INIT. INPUT DATA SHIFT COUNT
SB2 B2+1 INCREMENT INPUT BUFFER INDEX
NZ B7,BCONVB NO HALF CHARACTER AT WORD BOUNDARY
MX5 4 MASK FOR HALF CHARACTER
BX1 X5*X2 SECOND HALF OF CHARACTER
MX5 56 MASK FOR HALF CHAR. AT LOW BITS
BX3 -X5*X3 FIRST HALF OF CHARACTER
BX4 X1+X3
LX4 4 CHARACTER AT RIGHTMOST POSITION
SB6 4 INIT. INPUT DATA SHIFT COUNT
EQ BCONVC GO PROCESS CHAR. AT WORD BOUNDARY
* CHECK END-OF-DATA. IF NOT, PROCESS NEXT CHARACTER
BCONVB BSS 0
ZR B1,BCONVE ALL DONE
SB7 B6-64 CHECK FOR WORD BOUNDARY
PL B7,BCONVA HIT WORD BOUNDARY, GO READ NEXT WORD
LX3 X2,B6 SHIFT CHAR. TO RIGHTMOST POSITION
BX4 -X0*X3
BCONVC BSS 0
ZR X7,BCONVD TYPE IS 12-BIT ASCII
* CONVERT 8-BIT ASCII TO 6-BIT DISPLAY CODE
BX3 -X0*X4 THE CURRENT CHARACTER
AX3 3 X = CHAR. / 8
BX1 X3 INDEX TO CONVERSION TABLE
LX3 3 Y = X * 8
IX5 X4-X3 Z = CHAR - Y (REMAINDER OF CHAR/8)
IX3 X5+X5 Z * 2
LX5 2 Z * 4
IX4 X3+X5 Z*6 = SHIFT COUNT TO SHIFT CORRESP.
SB7 X4+6 DISPLAY CODE TO RIGHTMOST POSITION
SA5 X1+CTABLE INDEX TO CONVERSION TABLE
LX3 X5,B7 DISPLAY CODE TO RIGHTMOST POSITION
BX4 -X7*X3
* APPEND NEW CHARACTER TO OUTPUT WORD AND UPDATE POINTERS
BCONVD BSS 0
LX4 X4,B5 SHIFT NEW CHAR TO PROPER POSITION
BX6 X4+X6 FOR OUTPUT WORD
SB1 B1-1 DECREMENT TOTAL CHAR COUNT
SB5 B5-B4 OUTPUT CHAR POINTER
SB6 B6+8 INPUT CHAR POINTER
PL B5,BCONVB OUTPUT WORD NOT FILLED YET
* WRITE CONVERTED WORD TO OUTPUT BUFFER
BCONVE BSS 0
SA6 B3
MX6 0 INIT. OUTPUT WORD TO ZERO
ZR B1,BCONV ALL DONE
SB7 60
SB5 B7-B4 INIT. OUTPUT DATA SHIFT COUNT
SB3 B3+1 INCREMENT OUTPUT BUFFER INDEX
EQ BCONVB CONTINUE TO CONVERT NEXT CHARACTER
XBCONV DATA L*BCONV*
TEMP BSS 1
END