Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
Are the memory addresses of the send/receive buffers in reverse endian as well?


And, let me just verify my understanding of the whitepaper.

I must first store the data I wish to send into the Send Buffer, using Axe's storing protocol, then set the size byte to indicate the size of the data i am sending. Once that is done, Cn2.2 will recognize that frame to be pending transmission and will send it.

I must have the program manually check for a full receive buffer. Once the data is copied to userland memory, I can clear the buffer.

Can you elaborate a bit on how I would find another player, in a point-to-point fashion. I seem to not understand the whitepaper.
What is "reverse endian"?
merthsoft wrote:
What is "reverse endian"?


I believe it's actually called little endian. It means that the high byte actually comes first in memory. Am I saying that right?
ACagliano wrote:
Are the memory addresses of the send/receive buffers in reverse endian as well?
*little-endian. For what it's worth, the alternative is big-endian (not forward-endian).

Quote:
And, let me just verify my understanding of the whitepaper.

I must first store the data I wish to send into the Send Buffer, using Axe's storing protocol, then set the size byte to indicate the size of the data i am sending. Once that is done, Cn2.2 will recognize that frame to be pending transmission and will send it.
Correct. Size *word, actually, with the high bit of the high byte set.

Quote:
I must have the program manually check for a full receive buffer. Once the data is copied to userland memory, I can clear the buffer.
Correct again.

Quote:
Can you elaborate a bit on how I would find another player, in a point-to-point fashion. I seem to not understand the whitepaper.
You don't find them in a point-to-point fashion, because that would require knowing their SID ahead of time. I use this method:

1) Calculator A broadcasts a message to the network, a short frame saying "hey, I'm here"
2) Calculators B and C receive it. They respond to A, "hey, I hear you, and am also here"
3) A now knows about B and C, and B and C know about A.
4) B will be broadcasting too, and C will as well, so eventually B and C will know about each other

Makes sense?
Quote:

Quote:
And, let me just verify my understanding of the whitepaper.

I must first store the data I wish to send into the Send Buffer, using Axe's storing protocol, then set the size byte to indicate the size of the data i am sending. Once that is done, Cn2.2 will recognize that frame to be pending transmission and will send it.

Correct. Size *word, actually, with the high bit of the high byte set.




How do you just set the high bit of the high byte? What would that storage look like, in assembly?
It would look like:


Code:
ld hl,size   ;somewhere between 1 and 255, so actually h=0
ld a,h
and %10000000
ld h,a
ld (Cn2_Int_SendBuf+5),hl
Because h is always zero, this is a better way:
Code:
 ld l,size
ld h,%10000000
ld (Cn2_Int_SendBuf+5)
Or even easier (NOTE the order! It's important that the set bit be last!):
Code:
ld a,size
ld (Cn2_Int_SendBuf+5),a
ld a,%10000000
ld (Cn2_Int_SendBuf+6),a
I don't think that Axe can edit by bits. Anyone here good with Axe who can confirm or deny?
ACagliano wrote:
I don't think that Axe can edit by bits. Anyone here good with Axe who can confirm or deny?
I bet it can, but notice that for that last version, you just need to load hex value $80 = binary value %10000000 = decimal value 128.
oh, wait, so its

size-->{SendBuffer+5}
$80-->{SendBuffer+6}

or, should it be the other way around?
ACagliano wrote:
oh, wait, so its

size-->{SendBuffer+5}
$80-->{SendBuffer+6}

or, should it be the other way around?
You got it. Remember, it's little-endian, so even though the $80 is the more significant byte, it goes second.
ACagliano wrote:
I don't think that Axe can edit by bits. Anyone here good with Axe who can confirm or deny?

Axe *can* edit bits through bitmasking.
souvik1997 wrote:
ACagliano wrote:
I don't think that Axe can edit by bits. Anyone here good with Axe who can confirm or deny?

Axe *can* edit bits through bitmasking.
Good, I hoped so. It would be somewhat crippled as a z80 language if it couldn't. Smile
I get what you are saying Kerm, so we are clear on that.

I'm just confused. I don't believe Axe uses little endian, so in Axe, it may be 0x80[size]. Maybe you can tell me Kerm,

if I had to flip the memory high and low bytes of the Cn2 calls and the memory areas from the standard z80 conventions in order to use them in Axe, I should have to flip this as well, correct.
Standard z80 convention does indeed have them flipped. Calling address $1234 would be $CD3412 in standard z80. You will definitely not have to flip this, especially if you're setting it byte-wise like that.
Oh. Ok, I see what you are saying. If I was saving it as a two byte word, then they would need to be flipped, but I'm actually putting each byte individually, right where it needs to be.
ACagliano wrote:
Oh. Ok, I see what you are saying. If I was saving it as a two byte word, then they would need to be flipped, but I'm actually putting each byte individually, right where it needs to be.
Now you've got it. Did the high-level view of detecting other calculators that I mentioned make sense to you?
Yes.
ACagliano wrote:
Yes.
Excellent, then go to it! I hope that you can help inspire more Axe users to use CALCnet in their games, and of course I would appreciate if you would direct any Axe coders with Cn2.2 questions in this direction.
ACagliano wrote:
I'm just confused. I don't believe Axe uses little endian, so in Axe, it may be 0x80[size].


Axe uses little-endian. Nobody ever uses big-endian in Z80 programming except in very special circumstances. To save 7 or 8 bytes (I forget what) just store the full two-byte value.
Deep Thought wrote:
ACagliano wrote:
I'm just confused. I don't believe Axe uses little endian, so in Axe, it may be 0x80[size].


Axe uses little-endian. Nobody ever uses big-endian in Z80 programming except in very special circumstances. To save 7 or 8 bytes (I forget what) just store the full two-byte value.


as

80[size]h

or

[size]80h
  
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
Page 1 of 4
» All times are GMT - 5 Hours
 
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

 

Advertisement