Author Topic: Albireo - USB/SD/Serial interface for CPC  (Read 61783 times)

0 Members and 1 Guest are viewing this topic.

Offline PulkoMandy

  • 464 Plus
  • *****
  • Posts: 347
  • Country: fr
  • Liked: 281
  • Likes Given: 1
Re: Albireo - USB/SD/Serial interface for CPC
« Reply #425 on: 15:27, 18 February 20 »
I still don't understand what you mean by "the bits". There are command numbers, which are just, well, arbitrary numbers decided by the chip manufacturer. The page lists the ones used.


There is a status register with a single bit to check, which is documented in the page (it is bit 7).


There are commands which take parameters, the parameters are documented.


And there is the report from the mouse, which is documented in that page: bit 0 is button 0, bit 1 is button 1, and so on, and the next two bytes are the signed offset for X and Y coordinates since the last report was read.


I still don't see what else I could add to this page. And translating the code from BASIC to assembler wouldn't be very hard? I can surely do it, but I don't think assembler is a better way to document these things?

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 1.620
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
  • Liked: 723
  • Likes Given: 1894
Re: Albireo - USB/SD/Serial interface for CPC
« Reply #426 on: 22:47, 19 February 20 »
Example: The status port has 8 bits. What is the meaning of every single bit? Not only the status bit. Stuff like that.  :)


... And translating the code from BASIC to assembler wouldn't be very hard? I can surely do it, but I don't think assembler is a better way to document these things?
Then please do provide an working Z80 example code to read the mouse! If you can. And yes, I know it works for SymbOS. But that's not the point. It doesn't work for me, because at some point I have to wait for something and I don't know what.
« Last Edit: 22:51, 19 February 20 by GUNHED »
http://futureos.de --> Get the revolutionary FutureOS (Recent update: 2019.08.07)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2019.08.14)

Offline pelrun

  • Supporter
  • 6128 Plus
  • *
  • Posts: 590
  • Country: au
    • index.php?action=treasury
  • Liked: 298
  • Likes Given: 172
Re: Albireo - USB/SD/Serial interface for CPC
« Reply #427 on: 03:41, 20 February 20 »
If PulkoMandy's documentation is insufficient, then one can always go direct to the CH376 datasheet which is readily available and explains every register and return value in detail.

Offline PulkoMandy

  • 464 Plus
  • *****
  • Posts: 347
  • Country: fr
  • Liked: 281
  • Likes Given: 1
Re: Albireo - USB/SD/Serial interface for CPC
« Reply #428 on: 10:02, 20 February 20 »
There is only ever one thing to wait for: bit 7 of the status register to be cleared after sending a command with its parameters. The code for this is in the documentation:


Code: [Select]
WAIT:
v = INP(CMD)
IF v > 127 THEN GOTO WAIT


Do I really need to convert it to ASM for you? Looks simple enough to me.
When do you need to wait? Right after any command where the result is documented as "interrupt". For a mouse driver these commands will be documented here:
https://pulkomandy.github.io/shinra.github.io/CH376_ext.html (translated from part 2 of the datasheet which is only available in chinese).


In the BASIC code this is at "GOSUB 510" and very easy to see after each command that needs it.


I am not aware of any specific use for the other bits in the status register. They are not used in any of my examples and not referenced in the documentation of the chip as far as I can tell. So I assume there is nothing useful there.

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 1.620
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
  • Liked: 723
  • Likes Given: 1894
Re: Albireo - USB/SD/Serial interface for CPC
« Reply #429 on: 10:11, 20 February 20 »
If PulkoMandy's documentation is insufficient, then one can always go direct to the CH376 datasheet which is readily available and explains every register and return value in detail.

See, his docs are better of course. The CH376 docs are minimal though. So nice idea, but bad luck.
http://futureos.de --> Get the revolutionary FutureOS (Recent update: 2019.08.07)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2019.08.14)

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 1.620
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
  • Liked: 723
  • Likes Given: 1894
Re: Albireo - USB/SD/Serial interface for CPC
« Reply #430 on: 10:13, 20 February 20 »
There is only ever one thing to wait for: bit 7 of the status register to be cleared after sending a command with its parameters. The code for this is in the documentation:


Code: [Select]
WAIT:
v = INP(CMD)
IF v > 127 THEN GOTO WAIT


Do I really need to convert it to ASM for you? Looks simple enough to me.
When do you need to wait? Right after any command where the result is documented as "interrupt". For a mouse driver these commands will be documented here:
https://pulkomandy.github.io/shinra.github.io/CH376_ext.html (translated from part 2 of the datasheet which is only available in chinese).


In the BASIC code this is at "GOSUB 510" and very easy to see after each command that needs it.


I am not aware of any specific use for the other bits in the status register. They are not used in any of my examples and not referenced in the documentation of the chip as far as I can tell. So I assume there is nothing useful there.


You don't have that running. Because it doesn't work. Proove me wrong.
http://futureos.de --> Get the revolutionary FutureOS (Recent update: 2019.08.07)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2019.08.14)

Offline PulkoMandy

  • 464 Plus
  • *****
  • Posts: 347
  • Country: fr
  • Liked: 281
  • Likes Given: 1
Re: Albireo - USB/SD/Serial interface for CPC
« Reply #431 on: 12:11, 20 February 20 »
I can prove you wrong easily: the driver in SymbOS exists and work for several owners of Albireo. I helped Prodatron debug it and I wrote the page while doing that. But he asked me precise questions about my BASIC code (which indeed was incorrect at the time, it was missing the TOKEN variable to generate alternating DATA0 and DATA1 frames), so I could help him and investigate the precise problems he was getting.


So, what do you think? That the SymbOS driver uses magic fairy dust and secret undocumented registers?

Offline SOS

  • Supporter
  • 464 Plus
  • *
  • Posts: 331
  • Country: de
  • Identity lost
    • index.php?action=treasury
  • Liked: 223
  • Likes Given: 217
Re: Albireo - USB/SD/Serial interface for CPC
« Reply #432 on: 12:31, 20 February 20 »
If you need more than that, I can improve it, but I need specific questions, because it seems quite complete to me.
An "Read-An-LBA-Sector" Function in Basic, which works on every try (100%-Success-Rate)  :D

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 1.620
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
  • Liked: 723
  • Likes Given: 1894
Re: Albireo - USB/SD/Serial interface for CPC
« Reply #433 on: 13:45, 20 February 20 »
I can prove you wrong easily: the driver in SymbOS exists and work for several owners of Albireo. I helped Prodatron debug it and I wrote the page while doing that. But he asked me precise questions about my BASIC code (which indeed was incorrect at the time, it was missing the TOKEN variable to generate alternating DATA0 and DATA1 frames), so I could help him and investigate the precise problems he was getting.


So, what do you think? That the SymbOS driver uses magic fairy dust and secret undocumented registers?

Just provide example code if you can.
http://futureos.de --> Get the revolutionary FutureOS (Recent update: 2019.08.07)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2019.08.14)

Offline pelrun

  • Supporter
  • 6128 Plus
  • *
  • Posts: 590
  • Country: au
    • index.php?action=treasury
  • Liked: 298
  • Likes Given: 172
Re: Albireo - USB/SD/Serial interface for CPC
« Reply #434 on: 01:52, 21 February 20 »
See, his docs are better of course. The CH376 docs are minimal though. So nice idea, but bad luck.
Documenting every register and value is "minimal"? While WCH has produced some woefully abbreviated datasheets for other chips, the one for the CH376 is fairly decent.

So basically the only answer you'll accept is "somebody else should do all the work for me". Since I'm certainly not going to, I'll bow out here.
« Last Edit: 01:56, 21 February 20 by pelrun »

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 1.620
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
  • Liked: 723
  • Likes Given: 1894
Re: Albireo - USB/SD/Serial interface for CPC
« Reply #435 on: 20:41, 21 February 20 »
Sure.  :)
« Last Edit: 02:07, 22 February 20 by GUNHED »
http://futureos.de --> Get the revolutionary FutureOS (Recent update: 2019.08.07)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2019.08.14)