home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / alt / sys / amiga / demos / 1082 < prev    next >
Encoding:
Text File  |  1992-08-20  |  1.9 KB  |  50 lines

  1. Newsgroups: alt.sys.amiga.demos
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!mips!mips!munnari.oz.au!bruce.cs.monash.edu.au!monu6!yoyo.cc.monash.edu.au!gothic
  3. From: gothic@yoyo.cc.monash.edu.au (Toby Sargeant)
  4. Subject: Re: Interrupt vectors.. still.
  5. Message-ID: <1992Aug20.224836.27974@monu6.cc.monash.edu.au>
  6. Sender: news@monu6.cc.monash.edu.au (Usenet system)
  7. Organization: Monash University General Access Unix
  8. X-Newsreader: Tin 1.1 PL5
  9. References: <2331@forty2.physik.unizh.ch>
  10. Date: Thu, 20 Aug 1992 22:48:36 GMT
  11. Lines: 37
  12.  
  13. Christian Schneider (cschneid@amiga.physik.unizh.ch) wrote:
  14. : >Also i found a cool trick for when you write a routine that returns success
  15. : >or failure..  I used to stick the return code in d0 or someplace, but it's
  16. : >just a easy to stick em in the ccr !  That way, you can do:
  17. : Nope! Don't do this! You'd have to to a move d0,sr on mc68000 and a
  18. : move d0,ccr on mc68010+ ! (move d0,sr is priviledged on 68010+)
  19.  
  20.     How about popping the return address off the stack if you get an
  21. error, and replacing it with the error handler address? Of course this is
  22. limited, and the best way is stlii a tst.b d0, but it works if you dont
  23. intend to write multipurpose routines.
  24.     The advantage is multiple error conditions. With a tst.b/w/l you
  25. only get 3, one of which has to be the error free case, but say with a
  26. diskloading routine, or a similar non system, single purpose routine,
  27. you want to check wether your read was from the right track, wether the
  28. checksum was wrong, wehter the track was read at all, and wether a
  29. number of other conditions were fulfilled. You cant do this if you use a
  30. tst.b d0.
  31.     Yet another idea is:
  32.  
  33.         Bsr    myroutine
  34.         add.w    d0,d0
  35.         add.w    d0,d0
  36.         move.l    jumptab(pc,d0.w),a0
  37.         jmp    (a0)
  38. ;-------------------------------------
  39. jumptab:    dc.l    no_error
  40.         dc.l    error1
  41.         dc.l    error2
  42.         dc.l    error3
  43.  
  44. +-----
  45. |
  46. |    Gothic@yoyo.cc.monash.edu.au
  47.  
  48.     Remember. Trees were made green for a purpose!
  49.