.MCALL .MODULE .MODULE CAT5,VERSION=01,COMMENT= ; 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. .ENABL GBL,LC .SBTTL Macro and data definitions .MCALL DEFIN$ DEFIN$ ;Definitions for IND files .PSECT $CAT5 .SBTTL DATA - Local data area CNTRL: .BYTE 'Z,'A,'9,'0,'$,' ,'. ;Control byte string .EVEN CVTBL: .WORD 50*50 ;Conversion table .WORD 50 .WORD 1 .SBTTL CAT5 - ASCII to RAD50 conversion ;+ ;$CAT5 ;Convert ASCII to RAD50 ; ; Input: R0 = Address of next character in input buffer. ; R1 = Period disposition flag. ; If R1 EQ 0, then period is a terminator. ; If R1 NE 0, then period is a RAD50 character. ; ; Output: R0 = Address of next character in input buffer. ; R1 = Packed RAD50 characters. ; R2 = Terminal character. ; C-bit set if scan was terminated by a non-RAD50 character. ; C-bit clear if three RAD50 characters were converted. ;- .ENABL LSB $CAT5:: JSR R5,$SAVRG ;Save non-volatile registers MOV R1,-(SP) ;Save period disposition flag CLR R1 ;Clear accumulator MOV #CVTBL,R3 ;Get coversion table 1$: MOVB (R0)+,R5 ;Get next character MOV #CNTRL,R4 ;Get control string CMPB (R4)+,R5 ;RAD50 character? BLO 6$ ;Branch if no CMPB (R4)+,R5 ;Alphabetic? BLOS 5$ ;Branch if yes CMPB (R4)+,R5 ;RAD50 character? BLO 6$ ;Branch if no CMPB (R4)+,R5 ;Numeric? BLOS 4$ ;Branch if yes CMPB (R4)+,R5 ;"$"? BEQ 3$ ;Branch if yes CMPB (R4)+,R5 ;"SPACE"? BEQ 6$ ;Branch if yes TST @SP ;Period a RAD50 character? BEQ 6$ ;Branch to exit if no CMPB @R4,R5 ;"."? BEQ 4$ ;Branch if yes BR 6$ ;Must be a non-RAD50 2$: SUB #' -11,R5 3$: SUB #11-22,R5 4$: SUB #22-100,R5 5$: SUB #100,R5 SAVE ;Save next byte address and accumulator MOV (R3)+,R0 MOV R5,R1 CALL $MUL MOV R1,R5 ;Result to R5 RESTOR ADD R5,R1 ;Update accumulator CMP R3,#CVTBL+6 ;End of table? BLO 1$ ;No - get next character TST (SP)+ ;Clean stack BR 7$ 6$: TST (SP)+ ;Clean stack SEC 7$: MOVB -1(R0),R2 ;Return terminating character RETURN .DSABL LSB .END