[Coco] os9/drivewire driver problems

Boisy G. Pitre boisy at tee-boy.com
Sun Nov 8 08:37:57 EST 2009


On Nov 8, 2009, at 5:58 AM, Aaron Wolfe wrote:

> 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 think it's awesome that someone is taking the reigns and doing  
something like this.  Good going.

> 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.

Good so far.

> 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.

This all sounds correct.

> 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.. ?

the jsr 6,u says: "save the address of the next instruction on the  
stack, then obtain the two byte location 6 bytes from the U register  
and jump to that location."   The 6 jumps into the WRITE section of  
the DWSUB routine, and the 3 jumps into the READ routine.

> 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.

Your last line needs to read:  puls d,pc

You don't want to pull A off the stack because you haven't pushed it  
on prior to the call.  I think you will find that it works after that.

Note that you should be checking for a timeout error after the jsr 3,u  
and load B with an error if so, but get this working first.

> 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.

Error #208 is an illegal service request.  I suspect you aren't  
implementing something in your getstat or setstat routine; I don't  
remember the exact issue here, and I'm not at my CoCo at the moment to  
test this out and remember.

Try the fix above with your shell test and see if something happens.   
Let us know.


> 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
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco




More information about the Coco mailing list