doc@crash.cts.com (Mitch Evans) (09/13/89)
HOWDY! I am having NO luck with the following Assembly language program! If there is anyone out there who is willing to help me out, I would REALLY appreciate it. All the program does is to open a channel to the serial device, and send two strings to the device. The first string should put the modem in command mode, and the second string should have the sucker ring my home phone. It writes to the modem the first time (I can see the lights on the modem going), but does not get to the second write. It just sits there. What did I do wrong? Is there some piece of information that I have forgotten in the structures? Thanks in advance for any help you may have. Also, all my startup code does (BRA _START) is to determine which libraries need to be opened. The exec and intuition libs have been opened before the main part of the program is run. The macro SYSLIB does the following: jsr LVO.<name>(a6) where A6 contains the exec base. I have header files listing all of the exec offsets that I need, renamed to avoid the awkward _LVO prefix... but easy to change if need be. Sorry this is such a long posting! ; SERIAL.ASM -- SHOULD OPEN THE SERIAL CHANNEL, AND WRITE 2 STRINGS BRA _START ;BRANCH TO STARTUP CODE (NOT INCL.) INT EQU 1 INCLUDE "HEADER.ASM" MAIN SUB.L A1,A1 SYSLIB FINDTASK ;FIND TASK ADDRESS MOVE.L D0,REPLY + 16 ;SET UP MESSAGE PORT LEA REPLY,A1 SYSLIB ADDPORT LEA DEVIO,A1 ;PTR TO IOREQ STRUCT CLR.L D0 CLR.L D1 LEA DEVICENAME,A0 ;PTR TO DEVICE NAME SYSLIB OPENDEVICE ;OPEN IT TST.L D0 ;TEST FOR ERROR IN OPEN BNE ERROR LEA DEVIO,A1 ;PTR TO IOREQUEST STRUCT MOVE.L #11,28(A1) ;SET PARAMETERS COMMAND MOVE.L #REPLY,14(A1) ;SET REPLY PORT MOVE.L #1,IOEXTD ;CONTROL CHARACTER MOVE.L #$200,4+IOEXTD ;INPUT BUFFER LENGTH MOVE.L #$200,8+IOEXTD ;OUTPUT BUFFER LENGTH MOVE.L #2400,12+IOEXTD ;BAUD RATE MOVE.L #250000,16+IOEXTD ;BREAK TIME MOVE.W #$0808,28+IOEXTD ;8 BIT READS AND WRITES MOVE.W #$0120,30+IOEXTD ;ONE STOP BIT, SHARED MODE SYSLIB DOIO JSR DELAY ;GIVE IT TIME MOVE #3,28(A1) ;WRITE COMMAND MOVE.L #TTEXT1,40(A1) ;POINTER TO TEXT IN IOREQUEST STRUCT MOVE.L #TEXT1,36(A1) ;POINTER TO TEXT LENGTH SYSLIB DOIO JSR DELAY ;WAIT FOR FINISH MOVE #3,28(A1) ;CMD_WRITE MOVE.L #TTEXT2,40(A1) ;PTR TO TEXT MOVE.L #TEXT2,36(A1) ;PTR TO LENGTH SYSLIB DOIO JSR DELAY ;WAIT A WHILE ERROR LEA REPLY,A1 ;ERROR OUT SYSLIB REMPORT LEA DEVIO,A1 SYSLIB CLOSEDEVICE RTS DELAY ;SORRY ABOUT THIS PART -- MOVE.L #$0000,D5 ;BUSY LOOP FOR DEBUGGING LOOP1 ;PURPOSES ONLY. WHY DOESN'T ADD.L #01,D5 ;THE SILLY THING WORK? CMP.L #$07FFFF,D5 BNE LOOP1 RTS DEVICENAME DC.B 'serial.device',0 TTEXT1 DC.B '+++',13,0 TEXT1 EQU 4 TTEXT2 DC.B '~~ATDT6709524',13,0 TEXT2 EQU 14 EVENPC DEVIO MESSAGE DS.W 10 IO DS.W 6 IOREQ DS.W 8 IOEXTD DS.W 17 REPLY DS.L 8 END -- ***************************************************************************** ARPA: crash!doc@nosc.mil INET: doc@crash.CTS.COM Just because I'm paranoid doesn't mean everyone isn't out to get me... *****************************************************************************
ckp@grebyn.com (Checkpoint Technologies) (09/13/89)
In article <353@crash.cts.com> doc@crash.cts.com (Mitch Evans) writes: >HOWDY! > > I am having NO luck with the following Assembly language program! > [stuff deleted] > > > MOVE.L D0,REPLY + 16 ;SET UP MESSAGE PORT Apologies, but I do *not* memorize the structure offsets and I don't have docs nearby. So I can't guess whether this is correct. I gather you don't have the Commodore developers' kit, or you would have structure labels here. (Aside: a personal pet peeve of mine is the Abacus Assembler, and various Abacus books. The assembler does not include the Amiga include files, so they promote hard-coding of constants such as library offsets, structure definitions, etc. This smacks of MS-DOS mentality. I therefore do not reccommend the Abacus assembler to anyone.) > MOVE.L #11,28(A1) ;SET PARAMETERS COMMAND > MOVE.L #REPLY,14(A1) ;SET REPLY PORT > MOVE.L #1,IOEXTD ;CONTROL CHARACTER > MOVE.L #$200,4+IOEXTD ;INPUT BUFFER LENGTH Why switch to IOEXTD from (A1) here? I didn't see anything obvious. But I could be missing a LOT because I can't confirm that you're writing the correct values into the correct offsets in the structures.
11tstark@gallux.gallaudet.edu (Timothy Stark) (09/14/89)
Hello, I found a bug in your assembly language. At end of your program: BNE LOOP1 should be BEQ LOOP1. Remember that 68000 do reserved conditions operations. :) -- Tim Stark Timothy Stark Bitnet: 11tstark@gallua.bitnet People/Link: OCS130 Gallaudet University Internet: 11tstark@gallux.gallaudet.edu GEnie: T.STARK1 P.O. Box 1453, 800 Florida Ave., N.E., Washington, DC 20002 "Gallaudet University is the only university for the deaf in the world."
sie@fulcrum.bt.co.uk (Simon Raybould) (09/15/89)
> I am having NO luck with the following Assembly language program! >If there is anyone out there who is willing to help me out, I would REALLY >appreciate it. All the program does is to open a channel to the serial >device, and send two strings to the device. It appears from you code that you were brought up on Daniel Wolf e.t.c. I have some Wolf include files but don't seem to have the equates for OPENDEVICE, CLOSEDEVICE and DOIO. You don't need to use the serial.device, you can use the dos file 'SER:'. I have included some source to do the same as yours, using the 'SER:' device supplied by dos. If this is not what you require then please mail the values for the equates you use in you syslib calls and I will be happy to get it working. The supplied source should assemble first time on the set up you used for your source. Cheers, S.J.R. -------------- cut here ------------- ;Write two lines of text to serial port. S.J.Raybould 14 Sept 1989. BRA _START INCLUDE "HEADER.ASM" MAIN MOVE.L #SERDEV,D1 ;Open Serial Channel MOVE.L #MODE_NEWFILE,D2 DOSLIB OPEN TST.L D0 ;Check if Open failed. BEQ QUIT MOVE.L D0,SERFP ;Store File pointer. ;Write text1 to serial channel MOVE.L SERFP,D1 ;File pointer for serial device MOVE.L #TTEXT1,D2 ;Pointer to text MOVE.L #TEXT1,D3 ;Length of text DOSLIB WRITE JSR DELAY ;Arbitary time delay ? ;Write text2 to serial channel MOVE.L SERFP,D1 ;File pointer for serial device MOVE.L #TTEXT2,D2 ;Pointer to text MOVE.L #TEXT2,D3 ;Length of text DOSLIB WRITE JSR DELAY ;Arbitary time delay ? DONE ;Close Serial Channel MOVE.L SERFP,D1 DOSLIB CLOSE QUIT ZERO D0 ;Reset return value RTS DELAY MOVE.L #$0000,D5 LOOP1 ADD.L #1,D5 CMP.L #$07FFFF,D5 BNE LOOP1 RTS SERDEV DC.B 'SER:',0 EVENPC SERFP DC.L 0 ;Storage for file pointer. TTEXT1 DC.B '+++',13,0 TEXT1 EQU *-TTEXT1 ;Calculate the length of the string. TTEXT2 DC.B '~~ATDT6709524',13,0 TEXT2 EQU *-TTEXT2 END -------------- cut here ------------- +---------------------------------------------------------------------------+ | # Simon Raybould | | # # # # # #### ## | | # # ## ## # # # # # B.T.Fulcrum | | # # # ## # # # # # CS4.2 | | ####### # # # # ### ###### Birmingham | | # # # # # # # # # | | # # # # # #### # # path: sie@fulcrum.bt.co.uk | | | +---------------------------------------------------------------------------+
sie@fulcrum.bt.co.uk (Simon Raybould) (09/15/89)
> > I found a bug in your assembly language. At end of your program: > > BNE LOOP1 should be BEQ LOOP1. Remember that 68000 do reserved >conditions operations. :) Rubbish !! the BNE LOOP1 should in fact be BNE LOOP1. The count is going from zero up. If the count is Not Equal to the final value then reloop. ^ ^ +---------------------------------------------------------------------------+ | # Simon Raybould | | # # # # # #### ## | | # # ## ## # # # # # B.T.Fulcrum | | # # # ## # # # # # CS4.2 | | ####### # # # # ### ###### Birmingham | | # # # # # # # # # | | # # # # # #### # # path: sie@fulcrum.bt.co.uk | | | +---------------------------------------------------------------------------+