.TITLE ASCBIN .IDENT /V01/ .ENABLE LC ; ; This module converts a numeric ASCII string in any radix from 2 to 36 into ; a binary (doubleword) number ; ; ; Supplied by:- ; ; Phil Stephensen-Payne, ; c/o Systime Ltd., ; Concourse Computer Centre, ; 432 Dewsbury Road, ; LEEDS LS11 7DF, ; England. ; ; Author: V01 25-Jan-80 Phil Stephensen-Payne ; ; Calling Sequence: ; ; This subroutine is called via the standard FORTRAN calling sequence as: ; ; CALL ASCBIN (NUMCHR,ASCSTR,RADIX,NUMBER [,STATUS]) ; or ; STATUS = ASCBIN (NUMCHR,ASCSTR,RADIX,NUMBER) ; ; Where: ; NUMCHR = Number of ASCII characters to convert ; RADIX = Radix in which the number is held (2-36) ; ASCSTR = Address of input ASCII string ; NUMBER = Output Doubleword Number ; STATUS = Optional error return ; ; Errors returned: ; ; STATUS = 0 if the operation was successful ; = -1 if a parameter error was detected ; = -2 if the converted value overflowed a doubleword ; = number of characters not converted if a non-numeric (in the ; sense of the radix) character was encountered ; ; External references: ; ; This module calls the subroutines PRMCHK ; ; ; ASCBIN:: ; ; Specify number of parameters including error return. R5 is not affected. ; MOV #5,R0 ; Check Number of Parameters CALL PRMCHK ; BCC 10$ ; If CC parameters OK - carry on JMP END ; Else error - exit immediately ; 10$: ; END: RETURN .END