I want to trap the address where it happens and tried this code I found somewhere, but it doesn't return correct address, always 0x00000010
Code: Select all
Dim TrapAddr As LongWord
Sub procedure address() iv IVT_ADDR_ADDRESSERROR ics ICS_AUTO
asm
sub w15, #4, w0
mov [w0++], w1
mov w1, _trapaddr
mov [w0], w1
and #0x7f, w1
mov w1, _trapaddr+2
end asm
AddrErr_bit = 0
end sub
What am I doing wrong?
How many words are pushed on stack before a trap call?