Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 84 users online: 7 members, 61 guests and 16 bots. Members: critor, legodude. Bots: VoilaBot (1), Spinn3r (1), Magpie Crawler (3), Googlebot (11).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
|
| Author |
Message |
|
BrandonW
Calculator Über-Deity

Joined: 20 Sep 2006 Posts: 390
|
Posted: 31 Jul 2011 11:47:15 pm Post subject: DoorsCS Direct USB gCn Implementation |
|
|
How does DoorsCS implement direct USB functionality? I'm especially interested in any OS calls you make, any direct USB hardware ports you access or poll directly, OS flags you look at, etc.
If I recall correctly, you use _SendUSBData (BCALL 50F2h), check the OS' 5,(iy+41h) flag for bulk data ready to be received, as well as a routine to receive bytes to RAM. Does this routine handle both host and peripheral mode? (Meaning, does it take a different path depending on bit 2 of port 8Fh?)
I would like to see about using the USB link activity hook to hook into DoorsCS' functionality and allow DUSB gCn functionality using other cable configurations, such as tethering with an Android phone's internet connection. In such a situation, the calculator is host, not peripheral, so DoorsCS' routines might have to be modified.
Ideally, I'd like to just tweak DoorsCS' USB routines so that everything continues to work as-is as well as supporting this new configuration.
But I think the more flexible solution would be to allow hooking into this functionality from an assembly program or Flash application.
I think that the BCALL _RunAppLib (http://wikiti.brandonw.net/index.php?title=83Plus:BCALLs:50EC) would be good to use for this.
You could simply call this, passing in a predetermined function name as a string to determine whether a "USB extension" exists oncalc, and if so, use its routines instead of the ones you have built in.
For example:
HasgCnSp [Has gCn Support?], which returns whether this application supports and wants to hook into DoorsCS gCn support.
IsDatRdy [Is Data Ready?], which returns whether incoming data is ready to be received.
RecvData [Receive Data], which actually receives USB data.
SendData [Send Data], which actually sends USB data.
IsConnRd [Is Connection ready?], which returns whether USB is ready to be used right now.
The above is just off the top of my head and certainly not set in stone, I just want to see what you think of this -- or if nothing else, if you could post/attach the relevant DUSB gCn source code, that would be helpful. _________________
 |
|
| Back to top |
|
|
elfprince13

OVER NINE THOUSAND!

Joined: 23 May 2005 Posts: 10225 Location: A galaxy far far away......
|
|
| Back to top |
|
|
graphmastur
Power User

Joined: 27 Jul 2010 Posts: 464
|
Posted: 17 Aug 2011 08:32:02 pm Post subject: |
|
|
| Indeed he should, I want to know the answer as well. |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55736 Location: Earth, Sol, Milky Way
|
Posted: 20 Aug 2011 10:50:40 pm Post subject: Re: DoorsCS Direct USB gCn Implementation |
|
|
| BrandonW wrote: | | How does DoorsCS implement direct USB functionality? I'm especially interested in any OS calls you make, any direct USB hardware ports you access or poll directly, OS flags you look at, etc. | Let me show you abbreviated code to answer this:
Code: Cn2_Int_ReceiveFrame_USB:
bit 5,(iy+41h)
jp z,Cn2_Int_CheckPendSend
;receive code here:
;play with $8E, $94, $96, $A2, $8B, and other fun things
;if the Cn2.2 frame is complete, great. Otherwise:
;sets im1 from inside the Cn2.2 interrupt, ei, halt, di
;to let more data fill the USB buffer
;repeats while bit 5,(iy+41h) is reset
;skips to fail if turned off
;repeat receiving processing
Code: Cn2_Int_SendFrame_USB:
ex af, af'
exx ;swap to normal registers
;push all the registers
in a,($05) ;$C000 port
ld b,a
ld a,3
out ($05),a
;copy ALL the data out of the buffer!
out ($05),a
xor a
out ($33),a
ld a,$43
out ($33),a
ld a,$3
out ($34),a
ld hl,$0014
ld ($90AA),hl ;timeout counter
ld l,a
out ($35),a
res 0,(iy+43h) ;timeout flag
set 3,(iy+41h) ;force it not to kill the USB connection??
ld hl,Cn2_RAMPage3_Buffer+$4000
im 1
ei
bcall(50F2h) ;SendUSBData
di
rlc a ;rotate carry into bit 0
ld (Cn2_SafeRAM_7b),a
xor a
out ($33),a ;Turn off Timer 2
out ($34),a
res 3,(iy+41h) ;let it resolve issues with the host again
;restore all the registers!
ex af, af' ;save to shadow registers
exx
res 0,(iy+41h)
res 5,(iy+41h)
ld a,(Cn2_SafeRAM_7b)
rr a ;roll bit 0 back to carry
jp c,Cn2_Int_Done_QuitOK
jp Cn2_Int_SendSuccess
| Quote: | | If I recall correctly, you use _SendUSBData (BCALL 50F2h), check the OS' 5,(iy+41h) flag for bulk data ready to be received, as well as a routine to receive bytes to RAM. Does this routine handle both host and peripheral mode? (Meaning, does it take a different path depending on bit 2 of port 8Fh?) | It does not, as far as I can tell.
| Quote: | | I would like to see about using the USB link activity hook to hook into DoorsCS' functionality and allow DUSB gCn functionality using other cable configurations, such as tethering with an Android phone's internet connection. In such a situation, the calculator is host, not peripheral, so DoorsCS' routines might have to be modified. | I could certainly live with that.
| Quote: | | Ideally, I'd like to just tweak DoorsCS' USB routines so that everything continues to work as-is as well as supporting this new configuration. | The biggest problem would be lack of space inside Doors CS, at this point. I'm up to probably having to clip features to fit more stuff.
| Quote: | But I think the more flexible solution would be to allow hooking into this functionality from an assembly program or Flash application.
I think that the BCALL _RunAppLib (http://wikiti.brandonw.net/index.php?title=83Plus:BCALLs:50EC) would be good to use for this.
You could simply call this, passing in a predetermined function name as a string to determine whether a "USB extension" exists oncalc, and if so, use its routines instead of the ones you have built in.
For example:
HasgCnSp [Has gCn Support?], which returns whether this application supports and wants to hook into DoorsCS gCn support.
IsDatRdy [Is Data Ready?], which returns whether incoming data is ready to be received.
RecvData [Receive Data], which actually receives USB data.
SendData [Send Data], which actually sends USB data.
IsConnRd [Is Connection ready?], which returns whether USB is ready to be used right now.
The above is just off the top of my head and certainly not set in stone, I just want to see what you think of this -- or if nothing else, if you could post/attach the relevant DUSB gCn source code, that would be helpful. | I think that it would definitely be cool, but again, space constraints (and backwards-compatibility) are my main concerns. _________________
 |
|
| Back to top |
|
|
ordelore
Newbie

Joined: 21 Jan 2013 Posts: 25
|
Posted: 21 Jan 2013 11:08:09 am Post subject: |
|
|
How can I use the direct usb link. I have tried it by using the gcn client that comes with DCS 7.2b but i can't get anything to work, because the window won't stay open. I have windows 7 home premium. _________________
Beat that! |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55736 Location: Earth, Sol, Milky Way
|
Posted: 21 Jan 2013 11:26:24 am Post subject: |
|
|
| ordelore wrote: | | How can I use the direct usb link. I have tried it by using the gcn client that comes with DCS 7.2b but i can't get anything to work, because the window won't stay open. I have windows 7 home premium. | You need to open the command prompt and run the gCn client executable with certain arguments. The gCn readme explains how this works. If you would prefer a GUI tool, try giving the gCnClient GUI a spin. _________________
 |
|
| Back to top |
|
|
geekboy1011

Expert

Joined: 19 Jul 2009 Posts: 593
|
Posted: 24 Jan 2013 03:18:04 pm Post subject: |
|
|
Kerm I can look for more space to clip once we have Cn2 basic complete. I am sure we can clip a bit more out of CIII and maybe xlib or something.
Edit: I need to proof read more _________________ Cadan: CD : My (first?!?) mod of the cadan engine for a not so demoified version of the game :HOLD
Cn2.2 Wireless Bridge : Still in the design phase.
Contest #9 Cn2.2 Ika Shmup |
|
| Back to top |
|
|
ordelore
Newbie

Joined: 21 Jan 2013 Posts: 25
|
Posted: 07 Feb 2013 06:50:44 pm Post subject: |
|
|
| Kerm, I tried all of the options you had given me and yet, the only thing my mom (Who is much more tech-savy than I) and I could figure out is that our computer is possibly too fast. |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55736 Location: Earth, Sol, Milky Way
|
Posted: 07 Feb 2013 06:54:51 pm Post subject: |
|
|
| ordelore wrote: | | Kerm, I tried all of the options you had given me and yet, the only thing my mom (Who is much more tech-savy than I) and I could figure out is that our computer is possibly too fast. | Which arguments specifically? Do you have the filter drivre installed? It's definitely not a computer speed issue. _________________
 |
|
| Back to top |
|
|
ordelore
Newbie

Joined: 21 Jan 2013 Posts: 25
|
Posted: 09 Feb 2013 10:01:49 am Post subject: |
|
|
| I had installed the filter drivers, but when I open up the gcn client, the window pops up for a split second and then closes. When i try and connect with the GUI it always says "Exited with code FFFFFF" |
|
| Back to top |
|
|
Lionel Debroux
Power User

Joined: 16 Nov 2009 Posts: 412
|
|
| Back to top |
|
|
ordelore
Newbie

Joined: 21 Jan 2013 Posts: 25
|
Posted: 12 Feb 2013 07:32:09 pm Post subject: |
|
|
I am unable to use command-line for some reason and instead am using the GUI client Kerm suggested. _________________
Beat that! |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55736 Location: Earth, Sol, Milky Way
|
Posted: 12 Feb 2013 08:46:10 pm Post subject: |
|
|
| ordelore wrote: | | I am unable to use command-line for some reason and instead am using the GUI client Kerm suggested. | Well, you need to open up a command window and then run the command-line program. If you just double-click it, it will indeed immediately close. _________________
 |
|
| Back to top |
|
|
Tari

Systems Integrator

Joined: 03 Jul 2006 Posts: 2106 Location: Always-winter, Michigan
|
Posted: 13 Feb 2013 11:45:21 am Post subject: |
|
|
Sounds like you're running an old variant of the GUI. Grab the newest (final-ish) version, which allows you to see diagnostic output from the client itself. _________________
Ask questions the smart way · タリ |
|
| Back to top |
|
|
ordelore
Newbie

Joined: 21 Jan 2013 Posts: 25
|
Posted: 01 May 2013 04:51:33 pm Post subject: |
|
|
I do apologize for my continuous problems but I have a new problem. Again, by using direct USB, the GUI says
"Info: Using default port 4295
Failed to open Direct USB connection to calculator.
>Process exited."
I thought this port argument was only for Arduino or USBHID _________________
Beat that! |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55736 Location: Earth, Sol, Milky Way
|
Posted: 01 May 2013 06:13:52 pm Post subject: |
|
|
The default port is the IP port number the client uses to connect to the Cemetech server. That's the correct port number; don't worry about it, as it has nothing to do with the USB port. You should try the newest gCnClient with Doors CS 7.2 Beta 3, both of which will be released within the week. _________________
 |
|
| Back to top |
|
|
ordelore
Newbie

Joined: 21 Jan 2013 Posts: 25
|
Posted: 08 May 2013 03:54:04 pm Post subject: |
|
|
Dont worry Kerm, I finally ffixed the problem. I just used command line _________________
Beat that! |
|
| Back to top |
|
|
|
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
» Go to Registration page
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.044621 seconds.
|