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