home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: sparky!uunet!elroy.jpl.nasa.gov!lambda.msfc.nasa.gov!sauron!sims
- From: sims@sauron.msfc.nasa.gov (Herb Sims)
- Subject: **HELP** Whats wrong with this program?
- Message-ID: <sims.711806545@sauron.msfc.nasa.gov>
- Summary: Program crashes - don't know why
- Keywords: GURU 81000009
- Sender: news@lambda.msfc.nasa.gov (Newsmaster)
- Nntp-Posting-Host: sauron.msfc.nasa.gov
- Organization: NASA/MSFC
- Date: 22 Jul 92 12:02:25 GMT
- Lines: 122
-
- 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?
-
- ;Serial program
-
- ;Inlcude Serial Stuff
- INCLUDE "exec/types.i"
- INCLUDE "exec/nodes.i"
- INCLUDE "exec/lists.i"
- INCLUDE "exec/ports.i"
- INCLUDE "exec/devices.i"
- INCLUDE "exec/io.i"
- INCLUDE "devices/serial.i"
- INCLUDE "intuition/preferences.i"
-
- ExecBase equ 4
- SECTION code,CODE
-
- xref _LVOOpenDevice
- xref _CreatePort
- xref _CreateExtIO
- xref _DeletePort
- xref _DeleteExtIO
- xref _LVOCloseDevice
- xref _LVODoIO
- xref _LVOSendIO
- xref _LVOGetDefPrefs
- xref _LVOAbortIO
- xref _LVOCheckIO
- xref _SysBase
- xdef SerialMPortAddr
- xdef SerialCreate
- xdef OpenSerial
- xdef SerialSetUp
-
-
- ;Find out where the libraries really are
- SerialPeriod equ $ba6 ;Set Serial BAUD rate to 1200
- SerPer equ $dff032 ;Where the Serial baud rate is
- SerDatr equ $dff018 ;Where the serial data is
- IntReq equ $dff09c ;Interupt Register
- InteruptEnable equ $dff09a ;Interupt Enable register
- InterOff equ $0800 ;Turns off serial interupts
- InterOn equ $8800 ;Turn on serial interupts
-
- SerialCreate:
- ;Create the serial port
- move.l #0,-(sp) ;What is the priority?
- pea SerialName ;Name of port to open (serial.device)
- jsr _CreatePort ;Go open the port
- addq.l #8,sp
- tst.l d0 ;Did it open?
- beq EndSerial ;No...
- lea SerialMPortAddr,a1 ;Where is the serial port?
- move.l d0,(a1) ;Save the serial port pointer
-
- ;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?
- beq DeleteSerialPort ;nope
- move.l d0,PacketIO ;Yea, so save it
- move.l d0,a1
- move.b #0,IO_SERFLAGS(a1) ;Set up the IO Flags
-
- OpenSerial: ;Open the serial port
- lea SerialName,a0 ;Get the device name
- lea PacketIO,a1 ;What type of request
- move.l ExecBase,a6
- move.l #0,d0 ;Which Serial device (but is ignored)
- move.l #0,d1 ;flags
- jsr _LVOOpenDevice(a6) ;Go open serial.device
- tst.b d0 ;Did it open?
- bne PreCloseSerial ;Nope, go shut it down
-
- ;this is to be the read/write code
-
- PreCloseSerial:
- lea PacketIO,a1 ;Serial IOrequest structure address
- move.l ExecBase,a6 ;The usual
- jsr _LVOCheckIO(a6) ;See if any outstanding IO requests
- bne SerialClose ;Nope, so just close it
- jsr _LVOAbortIO(a6) ;Yeap, so stop any IO requests before
- ;closing
- SerialClose:
- jsr _LVOCloseDevice(a6) ;Go close serial.device
-
- DeleteSerialPort:
- addq.l #4,sp
- pea SerialMPortAddr ;Message port address
- jsr _DeletePort ;Delete the message port to free RAM
-
- EndSerial:
- rts ;End of program
-
- SECTION data,DATA
- SerialName:
- dc.b 'serial.device',0 ;Serial device name
- dc.w 0
- DeviceName:
- dc.b 0
- dc.b 0
- dc.l SerialMPortAddr
- Preference_Params:
- dc.b 232
-
- SECTION mem,BSS
- SerialMPortAddr
- ds.l 1 ;Place to store the Serial Port
- PacketIO
- ds.l 1 ;Place to store the IO Request Block
- SerialData
- ds.b 1 ;Place to store Serial data
-
- END
-
-