OBJNAM RADIX.LIT ; Created 28-Nov-86, Last modified 16-Apr-87
; by Irv Bromberg, Medic/OS Consultants
; 78 Wildginger Way, Toronto, Ontario, CANADA M3H 5X1
VEDIT=2.
VMINOR=1
VMAJOR=1
VSUB=0
IF EQ,1
Edit history:
1.1(2) 16-Apr-87 change to use J.DEC defined externally in MAC:SYS.UNV
1.0(1) 28-Nov-86 created
Function: Sets or displays the current OCT/DEC/HEX radix. Must be
used instead of SET OCT or SET HEX if the OCTPCH has been installed.
Syntax: RADIX 8 for octal
RADIX 10 for decimal
RADIX 16 for hexadecimal
RADIX <return> shows current RADIX
The syntax format RADIX=n is also allowed.
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
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,#'= ; bypass "=" if present
BNE 10$
INCW Buffer ; skip "="
BYP ; skip any whitespace after it
10$: GTDEC ; get radix value
CMPB Number,#8.
JNE TryDec
ANDW #^C<J.DEC!J.HEX>,JOBTYP(JCB)
EXIT
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 RADIX=>
ANDW #J.DEC!J.HEX,Mode ; select relevant bits
BEQ Octal
CMPW Mode,#J.HEX ; is it hex only?
BEQ Hex
Dec: TYPECR <10>
EXIT
Hex: TYPECR <16>
EXIT
Octal: TYPECR <8>
CALL ChkPCH
BEQ Exit
TYPE <%WARNING -- >
NotIn: TYPECR <OCVT patch has not been installed>
Exit: EXIT