; FIXPCH.M68  1.9(11)  Created Nov/84, Last modified 26-Aug-85
; Patches to FIX.LIT[1,4]  version 1.1(120)  701-705-065-424
; by Mike Rosenberg & Irv Bromberg

COPY PATCH                              ; includes SEARCH SYS
OVER 1,1,0,120.,0
NVER 1,1,0,120.,7                       ; set #patches installed
OHASH 701,705,065,424
NHASH 340,362,450,101

IF EQ,1

List of Patches installed:
1.  up arrow/^K --> TCRT call
2.  backspace --> rubout
3.  single-step through floating point call
4.  "AlphaFIX/L"
5.  decimal mode display, support decimal input radix, preserve J.DEC bit
6.  preserve JOBEXI(JCB)
7.  Debugging {RES:}{MEM:}filespec {with SYM}

ENDC

SEARCH TRM

Atemp=A6
Dtemp=D6

J.DEC=J.HEX_8.

.=606
       CALL    EXsave                  ; save JOBEXI(JCB)

.=626
       ANDW    #<J.HEX!J.DEC>,D7       ; save J.DEC bit too

.=1226         ; was CLR JOBEXI(A6), should clear JOBBPT instead
               ; so FIX can be called by a monitor execution program
               ; such as AMOS.SBR.
       CALL    EXrest

.=1236
       ANDW    #^C<J.HEX!J.DEC>,D7     ; clear J.DEC bit too

; Patch to treat left arrow (backspace) like delete
.=1352
       JMP     Pat1
Ret:

.=1650
; was   TYPE    < AlphaFIX/L >
       TTYI
       ASCIZ   "AlphaFIX/L  "
       EVEN

; Patch to display Decimal mode properly
.=2272
CALL    ShowMode
BR      L2306
.=2306
L2306:

.=2340
       CALL RESMEM     ; patch to show whether PRG in RES: or MEM: area
       NOP             ; we clobbered the PFILE instruction

; Patch to use TCRT for cursor up output
.=12506
       JMP     Pat2
.=12514
Ret1:

; Patch to allow floating point oparations to take place in one step

.=13040
       JMP     Paddr
.=13046
Ret2:

.=33126
Paddr:  CMPW    D7,#47100
       JNE     Ret2

       MOV     A6,204(A0)
       MOVW    (A6),210(A0)
       MOVW    #47161,(A6)
       MOVW    -2(A6),A5
       SUBW    #<47100-40>,A5

       ORW     #32768.,74(SP)
       MOV     A6,76(SP)

       MOV     2064(A0),A6
       MOVW    2070(A0),D1
       ANDW    #31.,D1
       ANDW    #-32.,(A6)
       ORW     D1,(A6)

       ADD     A5,A5
       MOV     0(A5)[A5],A6
       REST    A0-A5,D0-D7
       MOV     (SP),-(SP)
       MOV     A6,4(SP)
       POP     A6
       RTN

; Patch for left arrow
Pat1:   CMPB    D1,#127.
       JEQ     Ret
       CMPB    D1,#8.
       JMP     Ret

; Patch for cursor up
Pat2:   MOVW    #^H0FF03,D1
       TCRT
       MOV     2012(A0),D0
       JMP     Ret1

ShowMode:MOVW   JOBTYP(Atemp),Dtemp
       ANDW    #J.DEC,Dtemp
       BEQ     Hex
       TYPE    <decimal >
       MOVB    #10.,1240(A0)   ; force base 10 for expression evaluations
       RTN
Hex:    TYPE    <hex     >
       RTN

EXsave: CLR     140(A6)         ; do the instruction that we clobbered
       LEA     A1,SAVEXI       ; with the patch's call, save the
       MOV     JOBEXI(A6),@A1  ; JOBEXI stack pointer
       RTN

EXrest: CLR     JOBBPT(A6)      ; clear breakpoint instead of JOBEXI!
       LEA     A1,SAVEXI
       MOV     @A1,JOBEXI(A6)  ; restore the JOBEXI
       RTN

SAVEXI: BLKL    1               ; save JOBEXI here

RESMEM: MOV     364(A0),A6      ; get PRGBAS
       CMP     A6,MEMBAS       ; is module in SYSTEM memory?
       BHI     10$
       TYPE    <RES:>          ; yes, show RES:
       BR      20$
10$:    TSTW    -10(A6)         ; any module flag bits set?
       BEQ     20$             ; no, not loaded/permanent/data
       TYPE    <MEM:>          ; yes, show MEM:
20$:    PFILE   214(A0)         ; replace the PFILE instruction we clobbered
       RTN

       END