#CreatePort() in ASM
20 messages in this thread
Well, I hate to look stupid, but it's better than actually being stupid. I
want to use CreatePort() from assembly, and the RKM volume 2 book says that
function is in the exec_support library. Where is the exec_support library
documented (i.e., which registers should be used)?
Thanx! —Mike
Mike…
If you are using the Addison Wesley books, go back to your dealer and ask him
to supply you with appendix F of the RKM as published by Commodore.
Unfortunately, it doesn't help much in this case, as it is still documented
in C. There is code in Amiga.lib that might help though, so I'll see if I can
give you enough clues to get you going.
The Exec support docs say…
struct MsgPort *CreatePort (name, pri)
char *name
BYTE pri; /* oops… missed ; on prev line */ {
UBYTE sigBit;
struct MsgPort *port;
if ((sigBit = AllocSignal (-1)) == 1)
return ((struct MsgPort *) 0);
port = AllocMem ((ULONG) sizeof (*port), MEMF_CLEAR | MEMF_PUBLIC);
if (port == 0)
{
FreeSignal (sigBit);
return ((struct MsgPort *) (0));
}
port->mp_Node.ln_name = name;
port->mp_Node.ln_Pri = pri;
port->mp_Node.ln_Type = NT_MSGPORT;
port->mp_Flags = PA_SIGNAL;
port->mp_SigBit = sigBit;
port->mp_SigTask = FindTask;
/* correction to above line ….
port->mp_SigTask = FindTask (0);
*/
if (name != 0)
AddPort (port);
else
NewList (&(port->mp_MsgList));
return (port); }
————-CreatePort in Amiga.lib says….
move.l 32(A7),D4
move.b 39(A7),D3
so I would imagine that D4 is the name and D3 is the priority.
If you want the rest of the assembly stuff from Amiga.lib, let me know.
Hope this helps. We straight talking assembler types need to stick together.
Regards, Larry.
Larry,
I'm trying to read data from the serial port using assembly. I've translated
the C code in "Opening the Serial Device", and am using DoIO() to grab four
characters. DoIO returns an error of -3. Can you tell me what that error
means? Thanx! —Mike
I'm afraid I can't help you much right now Mike, as I have none of my books
with me. I am calling from a Holiday Inn in Toronto.
As a first thought, could it be invalid baud rate? The baud settings are a bit
strange I think. I gather you got the CreatePort running?
Regards, Larry.
Yes, I think I have CreatePort running, at least I get no errors
and I recover the resources when I use my DeletePort.
The sample program in the RKM says you can set the flags to
NULL to get the default settings, including baud rate, but maybe
it isn't so. The error I get from DoIO() is -3, and 3 (Don tells
me) is the error for invalid baud rate. Something tells me I should
try setting the baud rate myself!
I'll let you know what I find. Thanx! —Mike
P.S. Pretty cold up there I hear!
Good luck with the program Mike.
Yes it is cold here. My room is colder than the outdoors in Vancouver, and I
am _not_ amused.
Regards, Larry.
Larry:
You should not be so 'tight' and stay in those cheap, cold, damp
places. Its not good for your computing equipment <grin>!
73s,
bill
heh heh Welcome to the East Coast Larry.. <chuckle>. ….. Rick
Aw, shucks Larry, is it really cold in TO?
Bri
P.S. Shuda seen how cold it was in Vegas!
Another thought Mike… by default do they really mean some default (9600?) or
do they mean Preferences? If you want to check Preferences, it is really quite
easy, and Aterm 7.3 does it (I wrote that part, so it must be easy). The source
code for Aterm 7.3 is in DL 10, in C, but of course reasonably translatable.
Regards, Larry.
I have the source code for an earlier version of Aterm (thanx!), my problem
is converting it to assembly! I get the error on the DoIO() call no matter
what, even if I'm trying to set the baud rate (so i don't think it's that!).
It's very frustrating, but that's nothing new! —Mike
I know the feeling exactly Mike, and I wish I had dragged more books out with
me.
I did just remember though, there is an assembly language program in DL4 by Jez
San of Firebird Software. I forget the exact name, but it is Argoterm
(ARGO.SRC? ARGO.???). Anyway, he used assembler to open the serial port.
Regards, Larry.
Thanx, Larry……I'm off hunting…..—Mike
Larry,
How long are you going to stay in TO this time? There is a Amiga
group meeting next monday. Aegis rep will be there demoing Sonix,
new draw and a 3d package
If you are around you might like to attend.
dwj
DAvid,
Unfortunately (or fortunately, depending on whether I am thinking of the
weather or the meeting) I will be flying back Friday evening.
Regards, Larry.
Larry,
Too bad. You might want to try the largest Amiga BBS in TO at 445-2169.
Leave a msg for Wayne to give you quick validation. You might be pleased
at what is there etc.
dwj
I'd like to try it David, but I am quite busy while I am here. Maybe next trip.
Regards, Larry.
Okay,
no problem
dwj
Larry,
DoIO() always returns an error of -3 even when I am setting the baud rate to
1200!
If I just open "ser:" for input as a DOS file, is there anyway to detect
that no more data is being sent, and "jump out" of the Read()? (It's
desperation time!) Thanx! —Mike
Mike, I don't know of any way to detect end of data from SER:, but you can do
it with the DoIO/SendIO/Command_Query (pick one or more… lack of docs here).
The idea is to ask for a certsin number of characters within a set length of
time, and to terminate when you get a timeout.
Regards, Larry.