bferrer@Bonnie.ICS.UCI.EDU (02/07/91)
Can somebody please show me or send email to me on how to write a terminate and stay resident program for the ST or/and STe. I am currently working (on my spare time) on a RayTracer and I want to render in the background while doing some other things in the foreground. Any Help will be appreciated, Bill Ferrer
rosenkra@convex.com (William Rosencranz) (02/08/91)
[ question about doing computationally intensive things in background with a TSR... ] first, do u really mean TSR? a TSR is a program, ususally started at boot time, which remains resident in memory, and runs under special circumstances, generally when another "forground" program tries to access the OS. these programs are generally used for things like ramdisks, and to modify how TOS works. i think you really want more a multitasking capability. here you have several choices. perhaps the easiest is to look into MiNT, a multitasking extension to TOS. it does not multitask GEM programs, only TOS programs (.ttp, .tos) as far as i know. what you can consider, however, is to build sort of a raytracing server which runs purely as a TOS program. it can be a TSR, but you will also need some form of interprocess communication between your main application and this server, probably. consider pipes or shared memory. at a minumum, you will need to tell the server to start/stop, and give it an image to render as well as whatever parameters are needed (light source, etc). another solution is to write the raytracer as a DA, and send it messages from your application after some prescribed time (evnt_timer) like an alarm clock. it will only run, however, when u tell it to, so u will have to tell it often. another solution, which i have used, is to multitask within an application itself. you can install things to be done in the background which take place at each vertical blank interrupt (VBL). this works well for things like disk formatters, and (in my case) doing lots of numerical calculations while you go off and do something else. i had written a program to generate and edit digital audio samples, and i used each VBL to do the sample generation. the tradeoff involves how much work to do during the VBL before things like mouse and keyboard start getting too sluggish. in your case, consider 1 ray/VBL as a start (or 1 pixel/VBL ?). the VBL technique works with GEM programs, too, but you are only multitasking within the application, so when u quit, the renderer goes away, too. you should be especially careful to clean up properly (de-install the VBL routine) when the application quits. i can't remember whether u can call XBIOS/BIOS/GEMDOS during a VBLANK. maybe someone can answer this (for me, too)? you will be rendering to memory and not to the screen, of course. you can find MiNT at atari.archive.umich.edu (terminator) as well as the library to roll your own VBL stuff. look for vbi*.arc or vbl*.arc for the latter. i think the VBL stuff is there, if not i can mail it. i think it was also posted some time ago. sounds like an interesting little project. i hope this helps... -bill rosenkra@convex.com -- Bill Rosenkranz |UUCP: {uunet,texsun}!convex!c1yankee!rosenkra Convex Computer Corp. |ARPA: rosenkra%c1yankee@convex.com