Firmware updated to v1.0.9b7:
http://www.spinpoint.org/cpc/M4FIRM_v109b7.zipNow added host (passive) functions, bind, listen, accept.
[youtube]cPNONrogPaM[/youtube]
The newly created sockinfo structure in rom that works as read only hardware registers have changed.
The table is read by, taking the addr of 0xFF06, which points to the structure:
; 5 socket status structures (0 is used for gethostbyname*, 1-4 returned by socket function) of 16 bytes
; structure layout
; status 1 - current status 0=idle, 1=connect in progress, 2=send in progress, 3=remote closed connectoion, 4=wait incoming (accept), 240-255 = error code
; lastcmd 1 - last command updating sock status 0=none, 1=send, 2=dnslookup, 3=connect, 4=accept, 5=recv, 6=error handler
; received 2 - data received in internal buffer (ready to get with C_NETRECV)
; ip_addr 4 - ip addr of connected client in passive mode
; port 2 - port of the same..
; reserved 6 - not used yet (alignment!).
; *for socket 0, gethostbyname, status will be set to 5 when in progress and back to 0, when done.
I made a tcp echo server for running on the cpc as example (as seen in video above) to show how it works. Get the source code on the github repo:
GitHub - M4Duke/tcpecho: TCP echo server for PC and client for CPC M4 boardM4 rom code was updated too:
GitHub - M4Duke/m4rom: M4 Board, z80 rom partAswell as:
http://www.spinpoint.org/cpc/m4info.txt (ctrl+r to refresh!)
Let me know if any bugs, questions etc.