.NLIST TOC,SYM .TITLE $R50ASC .SBTTL ULBLIB 014 - RAD50 to ASCII conversion routine .IDENT \V01.02\ .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. ;+ ; $R50ASC ; The RAD50 to ASCII routine converts one RAD50 word contained in R0 ; to ASCII and stores it in the area pointed to by R1. ; The unused RAD50 code (35) is converted to '*'. ; The RAD50 code for '.' is converted to '%'. ; ; R0 = The word to be converted ; R1 => The area to store the ASCII ; ; CALL $R50ASC ; ; R0 is destroyed ; R1 is updated past the end of the ASCII characters ;- .WORD 0,1,50,50*50 DIVTAB: $R50ASC:: JSR R5,$SAVRG ;Save the non-volatile registers MOV #DIVTAB,R3 ;Point to divisor table 2$: TST -(R3) ;Backup through table - at end? BEQ 9$ ;If equal - yes. Done MOV #-1,R4 ;Init quotient register CMP #174777,R0 ;RAD50 value too large? BLO 5$ ;Yes - output "???" 3$: INC R4 ;Divide by power of 50(8) SUB @R3,R0 ; BCC 3$ ; ADD @R3,R0 ;Restore dividend TST R4 ;Character a blank? BEQ 6$ ;Yes CMP #35,R4 ;Digit? BLO 7$ ;Branch if so BNE 4$ ;Branch if alpha, $, or % ADD #4,R4 ;Correction for * 4$: CMP #33,R4 ;$ or % or *? BLOS 8$ ;Branch if so 5$: ADD #40,R4 ;Else alpha or "?" 6$: ADD #16,R4 ; 7$: ADD #11,R4 ; 8$: ADD #11,R4 ; MOVB R4,(R1)+ ;Store converted character BR 2$ ;Yes, continue 9$: RETURN ;And return to caller .END