home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!hal.com!decwrl!sdd.hp.com!swrinde!elroy.jpl.nasa.gov!jato!jdickson
- From: jdickson@jato.jpl.nasa.gov (Jeff Dickson)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: **HELP** Whats wrong with this program?
- Keywords: GURU 81000009
- Message-ID: <1992Jul23.171754.19319@jato.jpl.nasa.gov>
- Date: 23 Jul 92 17:17:54 GMT
- References: <sims.711806545@sauron.msfc.nasa.gov>
- Organization: Jet Propulsion Laboratory
- Lines: 46
-
- In article <sims.711806545@sauron.msfc.nasa.gov> sims@sauron.msfc.nasa.gov (Herb Sims) writes:
- >The following is a short serial open/read a little/close program and I
- >cannot figure out why the program crashes. Can someone **PLEASE** help
- >me on this...I am about ready to rip the wings of my pet bird!!!!!
- >
- >The GURU error is 81000009. Which is Free Twice error - What the #$&^(*&@^#
- >does that mean?
-
- I see a few things that are wrong. For one, you do not explicitly check
- the result of calls. Instead, you assume that the condition codes as set by
- the routine itself accurately reflect the success/failure. Another, is
- that you're stuffing some rather important values into scratch registers (name-
- ly A1) and then expecting those values to survive accross system calls.
-
- >PreCloseSerial:
- > lea PacketIO,a1 ;Serial IOrequest structure address
- > move.l ExecBase,a6 ;The usual
- > jsr _LVOCheckIO(a6) ;See if any outstanding IO requests
-
- I would put a tst.l d0 right here
-
- > bne SerialClose ;Nope, so just close it
- > jsr _LVOAbortIO(a6) ;Yeap, so stop any IO requests before
- > ;closing
- >SerialClose:
-
- CloseDevice expects the IO Request block to be in A1. However you called
- CheckIO first. Unless CheckIO preserves A1, you're handing a trashed pointer
- to CloseDevice.
-
- > jsr _LVOCloseDevice(a6) ;Go close serial.device
-
- Finally, all the assemblers I'm familiar with assume a default size of word
- when the size specification is not appended onto the end of an mneumonic.
-
- >;Allocate memory for and intialize IO request block
- > move.l #82,-(sp) ;How big the Message Port is
- > pea SerialMPortAddr ;Where is the serial port
- > jsr _CreateExtIO ;Allocate/intialze IO request block
- > addq.l #8,sp
- > tst d0 ;Allocate/intialize ok?
- ^^^^^^^^
- \_______Does this test all 32 bits or just 16?
-
-
- jeff
-