home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: alt.sys.amiga.demos
- 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
- From: gothic@yoyo.cc.monash.edu.au (Toby Sargeant)
- Subject: Re: Interrupt vectors.. still.
- Message-ID: <1992Aug20.224836.27974@monu6.cc.monash.edu.au>
- Sender: news@monu6.cc.monash.edu.au (Usenet system)
- Organization: Monash University General Access Unix
- X-Newsreader: Tin 1.1 PL5
- References: <2331@forty2.physik.unizh.ch>
- Date: Thu, 20 Aug 1992 22:48:36 GMT
- Lines: 37
-
- Christian Schneider (cschneid@amiga.physik.unizh.ch) wrote:
- : >Also i found a cool trick for when you write a routine that returns success
- : >or failure.. I used to stick the return code in d0 or someplace, but it's
- : >just a easy to stick em in the ccr ! That way, you can do:
- :
- : Nope! Don't do this! You'd have to to a move d0,sr on mc68000 and a
- : move d0,ccr on mc68010+ ! (move d0,sr is priviledged on 68010+)
-
- How about popping the return address off the stack if you get an
- error, and replacing it with the error handler address? Of course this is
- limited, and the best way is stlii a tst.b d0, but it works if you dont
- intend to write multipurpose routines.
- The advantage is multiple error conditions. With a tst.b/w/l you
- only get 3, one of which has to be the error free case, but say with a
- diskloading routine, or a similar non system, single purpose routine,
- you want to check wether your read was from the right track, wether the
- checksum was wrong, wehter the track was read at all, and wether a
- number of other conditions were fulfilled. You cant do this if you use a
- tst.b d0.
- Yet another idea is:
-
- Bsr myroutine
- add.w d0,d0
- add.w d0,d0
- move.l jumptab(pc,d0.w),a0
- jmp (a0)
- ;-------------------------------------
- jumptab: dc.l no_error
- dc.l error1
- dc.l error2
- dc.l error3
-
- +-----
- |
- | Gothic@yoyo.cc.monash.edu.au
-
- Remember. Trees were made green for a purpose!
-