News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Joseman

CPChessNet [developing]

Started by Joseman, 00:36, 03 March 18

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Joseman

Hi @Duke 

I'm having a problem with understanding your sourcecode on the cmdsend command

on tcp.s you write this on the code:

cmdsend: db 0 ; we can ignore this byte (part of early design)
dw C_NETSEND
sendsock: db 0
sendsize: dw 0 ;size
sendtext: ds 255

But the code do this after send the cmdsend command:

ld hl,5
add hl,bc (bc, data length)
ex de,hl
ld hl,cmdsend
ld (hl),e
call sendcmd

you are writing a calculated value on the " db 0 ; we can ignore this byte (part of early design) "

If i ignore this write (as you say on the comment) the command doesn't work, and i have to do it as you do.

What is this value you're writing there? I really don't understand how it works.

Thankyou!!

Duke

Quote from: Joseman on 12:40, 01 April 23Hi @Duke

i see this annotation on your source code

" ld bc,250 ; max size, prevent overflow because I am too lazy to re-write the sendcmd... "

what's supposed to mean this annotation?

any problem with the buffer if >250?


It only means that the function called sendcmd fetches the first byte of the prepared buffer pointed to by HL and uses it as counter value in the outi loop.

Duke

Quote from: Joseman on 08:24, 05 April 23you are writing a calculated value on the " db 0 ; we can ignore this byte (part of early design) "

If i ignore this write (as you say on the comment) the command doesn't work, and i have to do it as you do.

What is this value you're writing there? I really don't understand how it works.

Thankyou!!
Yes the value is ignored by the M4 board itself, but its not ignored by the sendcmd function, hence I was too lazy to rewrite it at that time, so re-write the send cmd (I probably did that later in some of the other sources, I dont remember) if you dont want to be stuck with the 8 bit value.

Joseman

Quote from: Duke on 10:37, 09 April 23
Quote from: Joseman on 08:24, 05 April 23you are writing a calculated value on the " db 0 ; we can ignore this byte (part of early design) "

If i ignore this write (as you say on the comment) the command doesn't work, and i have to do it as you do.

What is this value you're writing there? I really don't understand how it works.

Thankyou!!
Yes the value is ignored by the M4 board itself, but its not ignored by the sendcmd function, hence I was too lazy to rewrite it at that time, so re-write the send cmd (I probably did that later in some of the other sources, I dont remember) if you dont want to be stuck with the 8 bit value.

Hi @Duke 

Thanks for the kind answers, i'll look to the sendcmd and try to rewrite it.

CPChessNET is actualy working with interrups (one to see if something new, another to read it, another to apply it)

And works like a charm!! Realtime chat, no board lost in any case, no chat lost in any case.

I'm very very happy!!

Joseman

mode 1, 22 colours at the same time for credits menu.

It was necessary? no.

It's cool? Hell yeah!


Joseman

Hi @Duke 

I've been testing chessnet with Xenomorph.

There is one thing that failed on my code (because there is some things that i still don't understand)

we were connected, playing. Then xeno closed the game.

On my side noting happens, but if i send a chat msg (xeno closed) then chessnet goes for a routine where i stop the code.

the part of the code involucrate (i think is part of the code that i don't understand):

ld hl,cmdrecv
call sendcmd

ld bc,0
ld a,(iy+3) ;IY response_bufferM4
cp 0 ; all good ?
jr z,msg_OK

the question what are you asking on (iy+3) with the cmdrecv and comparing with 0?

what other values can return (iy+3) on cmdrecv?

thankyou!!

Duke

#131
Quote from: Joseman on 11:14, 11 April 23the question what are you asking on (iy+3) with the cmdrecv and comparing with 0?

what other values can return (iy+3) on cmdrecv?
It's a bit of a dummy as my documentation say it is = 0 and you have to refer to the socket status structure to read the status.
However it can return -1 if the socket is out of range (ie. not 1-4).

EDIT:
You should read and see the socket info structure status == 3 -> remote closed connection in your tests.

Socket info structure (ptr read from 0xFF06), there is a total of 4 sockets for use and "socket 0" reserved C_NETHOSTIP. User sockets are 1-4.
offset:
(socket*16)+0   status  : current status 0=idle, 1=connect in progress, 2=send in progress, 3=remote closed connection,
               4=wait incoming (accept), 5=dnslookup in progress, 240-255 = error code
(socket*16)+1   lastcmd : last command updating sock status 0=none, 1=send, 2=dnslookup, 3=connect, 4=accept, 5=recv, 6=error handler
(socket*16)+2   received: (2 bytes)   - data received in internal buffer (ready to get with C_NETRECV)
(socket*16)+4   ip_addr :   (4 bytes)   - ip addr of connected client in passive mode
(socket*16)+8   port    :   (2 bytes)   - port of the same..
(socket*16)+10   reserved: (6 bytes)   - not used yet (alignment!).

Joseman

Quote from: Duke on 18:35, 11 April 23
Quote from: Joseman on 11:14, 11 April 23the question what are you asking on (iy+3) with the cmdrecv and comparing with 0?

what other values can return (iy+3) on cmdrecv?
It's a bit of a dummy as my documentation say it is = 0 and you have to refer to the socket status structure to read the status.
However it can return -1 if the socket is out of range (ie. not 1-4).

EDIT:
You should read and see the socket info structure status == 3 -> remote closed connection in your tests.

Socket info structure (ptr read from 0xFF06), there is a total of 4 sockets for use and "socket 0" reserved C_NETHOSTIP. User sockets are 1-4.
offset:
(socket*16)+0 status  : current status 0=idle, 1=connect in progress, 2=send in progress, 3=remote closed connection,
 4=wait incoming (accept), 5=dnslookup in progress, 240-255 = error code
(socket*16)+1 lastcmd : last command updating sock status 0=none, 1=send, 2=dnslookup, 3=connect, 4=accept, 5=recv, 6=error handler
(socket*16)+2 received: (2 bytes) - data received in internal buffer (ready to get with C_NETRECV)
(socket*16)+4 ip_addr : (4 bytes) - ip addr of connected client in passive mode
(socket*16)+8 port    : (2 bytes) - port of the same..
(socket*16)+10 reserved: (6 bytes) - not used yet (alignment!).

one question, when i do a cmdclose, the other cpc receive somekind of data? or only the socket status is actualized?

if it's this way (only socket status)

should I read the socket status always before send any command?

thankyou for your help!

Joseman

Forget my last question

I'm a little retarded

I was modifying the client/server connect routines (not the game routines, now on int)

now the remote closed is correctly detected!

thankyou for your patience!

Powered by SMFPacks Menu Editor Mod