OBJNAM BASE.FXO ; Created 22-Nov-84, Last modified 3-Mar-85
; by Irv Bromberg, Medic/OS Consultants
; 78 Wildginger Way, Toronto, Ontario, CANADA   M3H 5X1
VEDIT=15.
VMINOR=2
VMAJOR=4
VSUB=0

IF EQ,1

AlphaFIX overlay equivalent to monitor-level BASE.LIT command

Syntax: BASE O  for octal
       BASE D  for decimal
       BASE H  for hexadecimal

When base 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).

ENDC

SEARCH SYS
SEARCH SYSSYM

Header:  PHDR -1,0,PH$REE!PH$REU

Impure  =A0
JCB     =A1
Buffer  =A2
Mode    =D0
Number  =D1
CrtCmd  =D1

Base    =1240   ; offset in IMPURE.FIX where current number base stored
J.DEC=^O10000
Cmd=^H0FF00

       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
       BEQ     Syntax
       CMPB    @Buffer,#'O
       BNE     TryDec
       ANDW    #^C<J.DEC!J.HEX>,JOBTYP(JCB)
       MOVB    #8.,Base(Impure)
       JMP     Done
TryDec: CMPB    @Buffer,#'D
       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    @Buffer,#'H
       BEQ     SetHex
Syntax: TYPESP  <?Illegal BASE code:  O=Octal  D=Decimal  H=Hexadecimal>
       RTN
SetHex: ANDW    #^C<J.DEC>,JOBTYP(JCB)
       ORW     #J.HEX,JOBTYP(JCB)
       MOVB    #16.,Base(Impure)
Done:   CMPW    Mode,JOBTYP(JCB)        ; has base been changed?
       BNE     ReDisp                  ; yes, redisplay screen
       TYPE    <BASE unchanged>
       LCC     #PS.Z   ; do not redisplay screen
       RTN
ReDisp: LCC     #PS.V   ; yes, return V-bit set so screen redisplayed
       RTN
       END