Article View: comp.sys.atari.st
Article #32436Re: Bomb list
From: Alexander Hinds
Date: Sat, 07 May 1988 19:55
Date: Sat, 07 May 1988 19:55
84 lines
3694 bytes
3694 bytes
In article <12463@tut.cis.ohio-state.edu>, weaver@tut.cis.ohio-state.edu (Andrew Weaver) writes:
>
> Here is a question I don't think I have ever heard hashed around
> on here before. Is there a way to intercept the 'bombs' that come onto
> the screen with some sort of dialog like on the Mac: "Sorry,
> a system error has occureed [Restart|Resume]" or on the Amiga: "System
> Error: Guru Meditiation xxx:xxxxxxx [Continue]" so that one can better
> diagnose problems with one's own (or someone else's) program? It seems
> to me that having a number of non-descript cherry bombs (or mushroom clouds,
> which I am told appeared on earlier STs) is not a very good way of represent-
> ing an error, but I guess that's just me.
>
> --
> Andrew Weaver weaver@tut.cis.ohio-state.edu
> Soon to be a 'Zip' at the University of Akron ...ihnp4!cbosgd!osu-cis!weaver
What follows is somewhat long and technical in nature...
Well, I hacked up something in 'C' on my Amiga, similar to what you're
attempting. I didn't like my machine going down on things like divide by
zero, opcode A emulation, and things like that. So, I wrote a little (
actually not that little) that runs in the background to catch cpu traps like
those mentioned above. I don't know if you'll be able to do it, since
you don't have a multitasking environment. Maybe a desk top accessory?
I'm not too familiar with the ST, so I can tell you what I did on my
Amiga as generically as possible, and maybe you can go from there. This
discussion presumes some knowledge of 68000 assembly and 'C'.
O.k. What I did was get a list of the 68000 trap vectors, and I
reset them to point to my code. It went something like this:
void (*ptr()); /*For a pointer to a function that returns void.
I actually just used an unsigned long*/
void MyTrapCode()
{
/*Stuff. See below*/
}
main()
{
ptr = 0000014; /*Some thing like this for divide by zero.
I don't have my source in front of me right
now!*/
*ptr = &MyTrapCode;
}
Voila! Now any program that would divide by zero executed my
function! Unfortunately, where you want to go from there can get very
tricky indeed. For me, I didn't want the machine to pop up a task failed
requester and crash.
Do accomplish that, (This is greatly simplified, but communicates the
essence of what I did), MyTrapCode() looked like:
void MyTrapCode()
{
#asm /*This will differ for your compiler!*/
move -(sp),d2/d4
unlk a5;
#endasm
/*The above lines undo the default startup code for a function*/
#asm
/*Here's where I removed all the things pushed onto the stack
because of a trap*/
#endasm
Wait(-1); /*Stupid, but effective. Task was held until
I pressed ctrl-c in it's window*/
}
I know this was kind of general, but if you use your imagination, I
think you can take it from there. You can learn alot about your compiler and
machine in so doing. There are alot of subtelties to watch out for, some I
didn't really discuss. So, be careful, and happy hacking!
Well, I hope this helps. If you have any specific questions, I'd
be glad to try and help you out. Just send me mail...
Alexander Hinds
ahinds@hvrford
Technical Details
Message-ID:
<424@hvrunix.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!cbmvax!vu-vlsi!hvrunix!ahindsReferences:
<2905@saturn.ucsc.edu> <1773@netmbx.UUCP> <477@philmds.UUCP> <12463@tut.cis.ohio-state.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!cbmvax!vu-vlsi!hvrunix!ahinds From: ahinds@hvrunix.UUCP (Alexander Hinds) Newsgroups: comp.sys.atari.st Subject: Re: Bomb list Message-ID: <424@hvrunix.UUCP> Date: 7 May 88 19:55:18 GMT References: <2905@saturn.ucsc.edu> <1773@netmbx.UUCP> <477@philmds.UUCP> <12463@tut.cis.ohio-state.edu> Organization: Haverford College, Haverford, PA Lines: 84 Summary: Yes, it can be done