Newsgroups: comp.sys.apple2.programmer Path: news.weeg.uiowa.edu!news.uiowa.edu!uunet!wupost!waikato!comp.vuw.ac.nz!actrix.gen.nz!dempson From: dempson@swell.actrix.gen.nz (David Empson) Subject: Re: init to trap resets?? Organization: Actrix Information Exchange Date: Mon, 27 Sep 1993 10:31:05 GMT Message-ID: References: <1993Sep26.204542.10307@msuvx1> Sender: dempson@actrix.gen.nz (David Empson) Lines: 48 In article <1993Sep26.204542.10307@msuvx1> ustai@msuvx1.memst.edu writes: > Hi, > I would like to know if it's possible to write inits in Orca/C 2.0 > (reading the manual, haven't got that far yet) for a beginner programmer. It shouldn't be very hard. I haven't done an INIT myself, but the basic principle is easy. All you need to do is put the following line anywhere before the first function in your program: #pragma rtl This tells ORCA/C that your program will exit using an RTL (return long) instruction instead of a GS/OS QUIT call. This is one of the main requirements of an INIT. You should declare your mainline using: int main(void) { /* code goes here */ return 0; } After compiling and linking the program, use the 'filetype' command to change the filetype to PIF for a permanent INIT or TIF for a temporary INIT. > What I would like to do is to trap Ctrl-Reset and then point it towards something > (Debug, perhaps?). I know Ctrl-Reset messes up some registers and such, is it > possible to "clean up" after a reset? Not under GS/OS, no. If any of the "desktop" toolsets are started up, you will always go to the "sliding apple" screen (System Failure) if you press Ctrl-Reset. You can't even get control before this point. GS/OS also prevents you from using Ctrl-Reset. You can try to trap Ctrl-Reset, but I doubt it would achieve anything. You certainly can't tell anything about where the computer might have hung before you reset it, and I can't think of any other practical use. You'd have to reboot after using Ctrl-Reset. The only moderately safe place to do a reset is while in the 8-bit environment (ProDOS-8 or DOS 3.3). -- David Empson dempson@swell.actrix.gen.nz Snail mail: P.O. Box 27-103, Wellington, New Zealand