ack/mach/z8000/libem/trp.s

61 lines
890 B
ArmAsm
Raw Permalink Normal View History

1985-01-08 11:48:43 +00:00
.define trp, fatal
1987-01-19 10:51:50 +00:00
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
1985-01-08 11:48:43 +00:00
fatal:
push *RR14, R1
inc R15, $2
popl saveret, *RR14
pop R1, *RR14 !trap number in R1
push *RR14, R1
push *RR14, R1
dec R15, $4
pop R1, *RR14 !restore R1
inc R15, $2
pushl *RR14, saveret
1985-01-08 11:48:43 +00:00
calr trp
push *RR14, $1
1992-06-30 17:43:24 +00:00
jr EXIT
!NOTREACHED
1985-01-08 11:48:43 +00:00
trp:
push *RR14, R1
inc R15, $2
popl saveret, *RR14
pop R1, *RR14 !trap number in R1
pushl *RR14, saveret
push *RR14, R0
dec R15, $2
cp R1, $16
jr UGE, 1f
ld R0, trpim
bit R0, R1
jr NE, 2f !ignore
1: sub R15, $24
ldm *RR14, R2, $12
push *RR14, R1
ld R1, trppc
cp R1, $0
jr EQ, 3f
clr trppc
call 0(R1)
inc R15, $2
ldm R2, *RR14, $12
add R15, $24
2: pop R1, *RR14
pop R0, *RR14
ret
3: pop R1, *RR14
push *RR14, R1
push *RR14, R1
push *RR14, $err
1985-01-08 11:48:43 +00:00
calr printf
push *RR14, $1
1992-06-30 17:43:24 +00:00
jr EXIT
!NOTREACHED
1987-01-19 10:51:50 +00:00
.sect .data
1985-01-08 11:48:43 +00:00
err: .asciz "trap error %d\n"