home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / amiga / programm / 11560 < prev    next >
Encoding:
Internet Message Format  |  1992-07-23  |  2.4 KB

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