.NLIST TOC,SYM .TITLE $CAT5B .SBTTL ULBLIB 040 - ASCII to RAD50 conversion routine .IDENT \V03.00\ .PSECT .LIBC. .ENABL LC,GBL ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only with the ; inclusion of the above copyright notice. This software, or ; any other copies thereof, may not be provided or otherwise ; made available to any other person except for use on such ; system and to one who agrees to these license terms. Title ; to and ownership of the software shall at all times remain ; in Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. ; Edit History: ; ; 001 16-Jan-80 22:16 Guldenschuh, Chuck cpg [240,148] ; Fix undefined symbol "SPACE" ; (001) ; ;+ ; $CAT5B ; This routine converts ASCII to RAD50 with blanks. ; ; R0 -> Next character in input buffer ; R1 = 0 => "." is a terminator ; <> 0 => "." is a RAD50 character ; ; CALL $CAT5B ; ; C-bit = 1 => scan was terminated by a non-RAD50 character ; C-bit = 0 => three RAD50 characters were converted ; R0 -> next character in input buffer ; R1 = packed RAD50 characters ; R2 = terminal character ;- .MACRO JOL ADDR CMPB (R4)+,R5 BEQ ADDR .ENDM .PSECT .LIBD. SPACE = 40 ;ASCII ' ' ;001 ;001 CNTRL: .BYTE 'Z, 'A ;Control byte string .BYTE '9, '0 .BYTE '$, SPACE ;001 .BYTE '. ;**-1 .EVEN CVTBL: .WORD 50*50 ;RAD50 pack multiplication .WORD 50 ; .WORD 1 ; .PSECT .LIBC. $CAT5B:: JSR R5,$SAVRG ;Save non-volatile registers MOV R1,-(SP) ;Save period disposition flag CLR R1 ;Clear accumulation MOV #CVTBL,R3 ;Get address of conversion table 1$: MOVB (R0)+,R5 ;Get next character MOV #CNTRL,R4 ;Get address of control string CMPB (R4)+,R5 ;RAD50 character? BLO 6$ ;If LO, no CMPB (R4)+,R5 ;Alphabetic? BLOS 5$ ;If LOS, yes CMPB (R4)+,R5 ;RAD50 character? BLO 6$ ;If LO, no CMPB (R4)+,R5 ;Numeric? BLOS 4$ ;If LOS, yes JOL 3$ ;"$" ? JOL 2$ ;" "? TST @SP ;Is "." RAD50 character? BEQ 6$ ;If EQ, no JOL 4$ ;"."? BR 6$ ; 2$: SUB #SPACE-11,R5 ;" " 3$: SUB #11-22,R5 ;"$" 4$: SUB #22-100,R5 ;"." or digit 5$: SUB #100,R5 ;Alphabetic MOV R0,-(SP) ;Save address of next byte MOV (R3)+,R0 ;Get conversion constant MOV R1,-(SP) ;Save accumulation MOV R5,R1 ;Set multiplier CALL $MUL ;Scale RAD50 character MOV R1,R5 ;Result to R5 MOV (SP)+,R1 ;Retrieve previous accumulation MOV (SP)+,R0 ;Retrieve address of next byte ADD R5,R1 ;Accumulate result CMP R3,#CVTBL+6 ;Converted three yet? BLO 1$ ;If LO, no TST (SP)+ ;Clean stack and clear C-bit BR 7$ ; 6$: TST (SP)+ ;Clean stack SEC ;Set C-bit 7$: MOVB -1(R0),R2 ;Get terminal character RETURN .END