OBJNAM OCTPCH.LIT ; Created 21-Nov-84, Last modified 16-Apr-86
; by Irv Bromberg, Medic/OS Consultants, 78 Wildginger Way, Toronto,
; CANADA M3H 5X1
RADIX 10
VEDIT=14
VMINOR=0
VMAJOR=4
VSUB=0
IF EQ,1
Edit history:
16-Apr-86 4.0(14) change J.DEC to most significant bit of JOBTYP(JCB) for
compatability with AMOS/L 1.3C and later, require J.DEC
to be defined in MAC:SYS.M68 & reassemble SYS.M68
4-Dec-85 3.3A(13)
Syntax: OCTPCH
Installs OCVT patch into SVCA table. Must be used before any
SYSTEM commands are used in AMOSL.INI file, preferably as early
as possible (e.g. after first TRMDEF statement).
ENDC
SEARCH SYS
; Must add to MAC:SYS.M68: J.DEC=^H8000 (belongs in the JOBTYP section)
; then reassemble file to create updated MAC:SYS.UNV
SEARCH SYSSYM
; bypass patch if already installed - test by attempted DEC output
MOV JOBCUR,JCB ; save existing OCT/DEC/HEX mode bits
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" ?
BNE ChkUP ; no, check if system is up yet
TYPECR <%OCVT patch already installed>
EXIT
ChkUP: MOV SYSTEM,D7 ; has final SYSTEM command been given?
AND #SY$UP,D7
BEQ ChkSYS ; if so abort with error message
Before: TYPECR <?OCVT patch must be installed before any SYSTEM commands>
EXIT
ChkSYS: TST SYSBAS ; any SYSTEM commands executed?
BNE Before ; yes, abort with error message
ChkRNG: MOV MEMBAS,Block ; are we within range to install patch?
CMP Block,#^H0FFFF
BLO DoPCH
TYPECR <?Too late to install OCVT patch - out of addressing range>
EXIT
DoPCH: MOV MEMBAS,Block ; index available memory
LEA Patch,PRGBAS ; index OCVT patch routine
MOVW #<PRGEND-PRGBAS-2>,Size ; get size of block (-2/2 for DBF loop)
LSRW Size ; /2 for 16-bit word block move
MOV ^O50,Table ; get address of EM1010 routine
Search: CMPW (Table)+,#^O47165 ; search for RTN instruction, leaving
BNE Search ; Table register -->base of SVCA table
ADD #2*^O12,Table ; add offset to DCVT/OCVT SVCA
; install original TRMOCP SVCA address
LEA Atemp,OrigCvt+4
MOVW @Table,@Atemp ; save original SVCA 12 address
BlkMov: MOVW (Patch)+,(Block)+ ; copy OCVT patch onto end of monitor
DBF Size,BlkMov
MOV MEMBAS,Atemp ; get address of new SVCA 12 entry point
MOVW Atemp,@Table ; set new SVCA 12 entry point
MOV Block,MEMBAS ; update MEMBAS
TYPECR <OCVT patched> ; successfull!
EXIT
IF EQ,1
Patch for OCVT monitor call. Tests J.DEC bit in JOBTYP(JCB). If
set then interprets all OCVT as DCVT. To install into monitor must
add OCTPCH statement to AMOSL.INI bootup file. Because the patch
must be within 64K addressing range of the SVCA table the OCTPCH
statement should be executed early in the AMOSL.INI file - after the
first TRMDEF statement is a convenient location. OCTPCH must be
executed prior to any SYSTEM command.
ENDC
; OCTPCH.LIT changes SVCA 12 entry in monitor-call table to point here:
PRGBAS: PUSH JCB ; new destination of SVCA 12
MOV JOBCUR,JCB ; index JCB
BTST #4,JOBTYP(JCB) ; check J.HEX bit
BEQ OrigCvt ; octal base, do normal OCTAL output
TSTW JOBTYP(JCB) ; check J.DEC bit
BPL OrigCvt ; J.DEC not set, do normal HEX output
ANDW #^C<^O40000>,D6 ; switch to DCVT
OrigCvt:POP JCB
JMP 0 ; original OCVT address put here by OCTPCH.LIT
PRGEND: NOP