OBJNAM RADIX.FXO ; Created 28-Nov-86, Last modified 16-Apr-86
; 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
1.1(2) 16-Apr-87 changed to use J.DEC defined externally in MAC:SYS.UNV
1.0(1) 28-Nov-86 created
AlphaFIX overlay equivalent to monitor-level RADIX.LIT command
Syntax: RADIX 8 for octal
RADIX 10 for decimal
RADIX 16 for hexadecimal
The syntax format RADIX=n is also allowed.
When RADIX is changed V-bit will be set to cause AlphaFIX to redisplay screen.
For decimal mode to work the OCVT patch must have been activated during
system bootup by placing the OCTPCH command near the beginning of the
AMOSL.INI file (prior to any SYSTEM commands).
BASE =1240 ; offset in IMPURE.FIX where current RADIX is stored
Cmd=^H0FF00
PHDR -1,0,PH$REE!PH$REU
MOVW #Cmd!9.,CrtCmd ; clear to end of line
TCRT
MOV JOBCUR,JCB ; save existing OCT/DEC/HEX mode bits
MOVW JOBTYP(JCB),Mode ; get current mode
BYP
TRM
JEQ Syntax
CMPB @Buffer,#'= ; skip "=" if present
BNE 10$
INCW Buffer
BYP ; and any whitespace after it
10$: GTDEC ; convert radix specifier to decimal
CMPB Number,#8.
BNE TryDec
ANDW #^C<J.DEC!J.HEX>,JOBTYP(JCB)
MOVB #8.,BASE(Impure)
JMP Done
TryDec: CMPB Number,#10.
BNE TryHex
; check if OCVT patch active, error if it has not been installed
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
CMPW Number,#<'1_8.+'1> ; did we get "11" ?
BEQ OK ; yes, all OK
TYPECR <?OCVT patch has not been installed>
LCC #PS.Z ; do not redisplay screen
RTN
OK: MOVB #10.,BASE(Impure)
ORW #<J.HEX!J.DEC>,JOBTYP(JCB)
BR Done
TryHex: CMPB Number,#16.
BEQ SetHex
Syntax: TYPESP <?Illegal RADIX (8=octal 10=decimal 16=hexadecimal)>
RTN
SetHex: ANDW #^C<J.DEC>,JOBTYP(JCB)
ORW #J.HEX,JOBTYP(JCB)
MOVB #16.,BASE(Impure)
Done: CMPW Mode,JOBTYP(JCB) ; has RADIX been changed?
BNE ReDisp ; yes, redisplay screen
LCC #PS.Z ; do not redisplay screen
RTN
ReDisp: LCC #PS.V ; yes, return V-bit set so screen redisplayed
RTN
END