-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatchtrace.asm
More file actions
66 lines (55 loc) · 1.56 KB
/
patchtrace.asm
File metadata and controls
66 lines (55 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
;
; patchtrace.a -- a little program to help with the problem of
; tracing trap-instructions (and chk & trapv & divide by zero).
; if a trace-exception happens in supervisor mode, just return from exception
; and the trace flag will be automatically cleared...
;
; created 1989-08-24 TR
;
; Modified 1990-07-13 --> Now works if the vector base register is
; nonzero on a 68010/20/30/40... system
; 1990-08-22 --> added includes, added this to makefile, uses
; new macros...
; 1991-10-27 --> changed includes & macros again...
;
include 'exec/types.i'
include 'exec/memory.i'
include 'exec/execbase.i'
include 'offsets.i'
trace_vector equ $24 ;offset from start of vector table
move.l 4,a6 ;get execbase
lea supercode(pc),a5
jsr _LVOSupervisor(a6) ;get VBR into a4
moveq #copylen+4,d0
moveq #MEMF_PUBLIC,d1
jsr _LVOAllocMem(a6)
tst.l d0
beq.s exit
move.l d0,a1
move.l d0,a2
lea copymod(pc),a0
moveq #copylen/2-1,d1
cploop move.w (a0)+,(a1)+
dbf d1,cploop
move.l trace_vector(a4),(a1)+
move.l a2,trace_vector(a4)
exit moveq #0,d0
rts
;
; this is executed in supervisor mode to get the start address of
; the processor vector table. this address is always zero on
; a 68000 prosessor, and the contents of the vbr-register with
; 68010/20 etc.
;
supercode
suba.l a4,a4
btst #AFB_68010,AttnFlags+1(a6)
beq.s 01$
dc.w $4e7a,$c801 ; movec vbr,a4
01$ rte
copymod btst #5,(sp) check supervisor mode bit in saved sr
beq.s nosup jump to old vector if not supervisor mode
rte just return
nosup dc.w $4ef9 jmp-instruction
copylen equ *-copymod
end