OBJNAM BASE.LIT ; Created 22-Nov-84, Last modified 3-Mar-85 ; by Irv Bromberg, Medic/OS Consultants ; 78 Wildginger Way, Toronto, Ontario, CANADA M3H 5X1 VEDIT=11. VMINOR=2 VMAJOR=3 VSUB=0 IF EQ,1 Syntax: BASE O for octal BASE D for decimal BASE H for hexadecimal BASE <return> shows current base For decimal mode to work the OCVT patch must have been installed during bootup, using the OCTPCH command near the beginning of AMOSL.INI file. ENDC SEARCH SYS SEARCH SYSSYM JCB =A0 Buffer =A2 Mode =D0 Number =D1 J.DEC=^O10000 Header: PHDR -1,0,PH$REE!PH$REU ; check if OCVT patch active, warn user if it has not been installed MOV JOBCUR,JCB ; save existing OCT/DEC/HEX mode bits BYP ; OCVT is active, check for Base code LIN BEQ ShowBase CMPB @Buffer,#'O JNE TryDec TYPE <Octal> ANDW #^C<J.DEC!J.HEX>,JOBTYP(JCB) JMP Done ChkPCH: PUSH Buffer ; save pointer to input line PUSHW JOBTYP(JCB) ORW #<J.DEC!J.HEX>,JOBTYP(JCB) ; set DEC mode PUSHW ; get some workspace MOV SP,Buffer MOV #11.,Number ; output the number 11 - if DEC patch OCVT 0,OT$MEM ; not active result will be "B" POPW Number POPW JOBTYP(JCB) ; restore original OCT/DEC/HEX mode POP Buffer CMPW Number,#<'1_8.+'1> ; did we get "11" ? RTN ShowBase:MOVW JOBTYP(JCB),Mode TYPE <Current OCVT base is > ANDW #J.DEC!J.HEX,Mode ; select relevant bits BEQ Octal CMPW Mode,#J.HEX ; is it hex only? BEQ Hex Dec: TYPECR <Decimal> EXIT Hex: TYPECR <Hexadecimal> EXIT Octal: TYPECR <Octal> CALL ChkPCH BEQ Exit TYPE <%WARNING -- > NotIn: TYPECR <OCVT patch has not been installed> Exit: EXIT TryDec: CMPB @Buffer,#'D BNE TryHex CALL ChkPCH BEQ 10$ TYPE <?> BR NotIn 10$: TYPE <Decimal> ORW #<J.HEX!J.DEC>,JOBTYP(JCB) BR Done TryHex: CMPB @Buffer,#'H BEQ SetHex TYPECR <?Illegal base code: O=Octal D=Decimal H=Hexadecimal> EXIT SetHex: ANDW #^C<J.DEC>,JOBTYP(JCB) ORW #J.HEX,JOBTYP(JCB) TYPE <Hexadecimal> Done: TYPECR < mode set> EXIT END