[Coco] os9/drivewire driver problems

Aaron Wolfe aawolfe at gmail.com
Sun Nov 8 06:58:32 EST 2009


First, please don't laugh, I am new and surely making many simple mistakes here.
Second, I cannot say thank you enough to everyone who has made
NitrOS9, the toolshed and drivewire possible.  I'm very impressed by
how well the tools work.

I am trying to add to drivewire the ability to act as a serial port
under NitrOS9.  I've managed to setup a build environment and create a
device descriptor and driver for the new device.  I added the op codes
and handling routines on the server side, etc.   I have write working,
but that's the easy part since the dw printer driver already did that
and I mostly just copied it.

So, I can do things like:  LIST STARTUP > /T2
and everything works great.

However, read is another story.  I can't seem to get anything working
properly and after several hours I am stumped.

Here's what I think I've figured out about how dw works, I might have
some things wrong.
To read a character, I think I am supposed to put my opcode in A,
pointer for the incoming data in X (usually my stack, i think?), the
number of bytes to read in Y.
Then, jsr to the DWSUB and let the magic happen?  At least this is
what I think I've gleaned from the source of other modules.
According to the OS9 dev manual, the Read routine should return a
character in reg A.

So, my first attempt was:

Read
        lda   #OP_SERREAD
        pshs  d
        leax  ,s
        ldy   #$0001
        ldu   >D.DWSUB
        jsr   6,u
       ldy   #$0001
       leax  ,s
       jsr   3,u
       puls  d,a,pc

I may be doing stupid things here, I haven't done 6809 assembler in
many years.  I'm not sure what the 6, and 3, in the JSRs is for, it
seems like every write uses 6 and read uses 3 in the other modules.. ?

This "works" in the sense that the server sees the call and sends back
a byte.  However, I've botched something because the process calling
read always gets a null character.  If I spawn a shell on /T2, it
reads and writes bytes constantly (I think it's echoing the character
it thinks I typed) but its all null chars.

So, I thought to test I would just:

Read
        lda   #OP_SERREAD
        clrb

(#OP_SERREAD is the character 'C').  I was hoping then that something
like LIST /T2 would give me a stream of Cs.  But instead I get Error
208,  Illegal service request.

Hopefully this makes some kind of sense, I'm sure I've done something
silly but if I make Read just put a constant in A and clear B (no
errors), shouldn't I get a character every time I call Read?

Thanks for any pointers
-Aaron



More information about the Coco mailing list