[comp.sys.atari.st] Want pseudo-trap handler examples

saj@chinet.chi.il.us (Stephen Jacobs) (01/31/90)

I could really use examples of handlers for the software trap vectors.  Let's
just say that the documentation I have available isn't entirely clear or
consistent.  Specifically, if anyone would care to post fragments in C or
assembler that did the following 2 functions, I probably wouldn't be the
only person grateful to see them:

1) Attempts to read from a floppy disk.  If there is no disk in the drive,
   writes a message to the screen and waits for a keypress, then retries the
   original read (etc until satisfied).  The built-in 'drive not responding'
   alert is never activated.
2) Accepts input into a string with Cconrs  (do I have the name right?  I
   never remember such things, and my manuals are elsewhere).  If control
   C is pressed it intercepts the terminate vector and does something
   sensible (like clearing the input string and starting over).

Thanks.
                                     Steve J.

kbad@atari.UUCP (Ken Badertscher) (02/02/90)

saj@chinet.chi.il.us (Stephen Jacobs) asks about critical error and
terminate handlers.

Intercepting the critical error handler is simply a matter of grabbing
logical vector 0x101 using Setexc(), and doing the appropriate thing
with the arguments sent to your error handler by the bios.  This is
documented in the GEMDOS manual in the "extended vectors" section.

Grabbing the terminate vector to "recover" from a ^C is not the way
to avoid having ^C terminate your application.  Use GEMDOS raw
i/o (Crawcin() and/or Crawio()) and roll your own string reading routine.

-- 
   |||   Ken Badertscher  (ames!atari!kbad)
   |||   Atari R&D System Software Engine
  / | \  #include <disclaimer>