A92: Divide by Zero Trap
[Prev][Next][Index][Thread]
A92: Divide by Zero Trap
Hey all,
I have some code that forces a divide by zero, apparently to allow you to
fix the denominator. Here is the best I can come up with to change the
vector for the Divide By Zero error:
...
move.l $14,olddivbyzero ; Store old vector
bclr.b #2,$600001 ; Unprotect memory
move.l #_divbyzero,$14 ; Change vector
bset.b #2,$600001 ; Protect memory
...
...
bclr.b #2,$600001 ; Unprotect memory
move.l olddivbyzero(pc),$14 ; Restore old vector
bset.b #2,$600001 ; Protect memory
...
...
_divbyzero:
; ERROR HANDLE
rte
...
...
olddivbyzero dc.l 0
...
This code produces an Illegal Instruction (along with other stuff around
it). What am I doing wrong?
====
Aaron Hill (mozart@inlink.com)
IRC Nickname on EF-Net: SeracOhw
http://www.inlink.com/~mozart/i3/
Follow-Ups: