Page 2 of 2

Re: int size for C compilers for the 65816

Posted: Fri Feb 03, 2023 1:24 am
by tmr4
litwr wrote:
Let's work with an example

Code: Select all

zpptr1  byte 1,2,3
zpptr2  byte 4,5,6
We can use these pointers, for instance in instruction LDA [zpptr1]. I need to write exactly 3 bytes (not 4!) if I want to change the value of pointer zpptr1. I also hardly call the normal 65816 access to a 3-byte value as trimming.
Normally you'd use 32-bit pointers with the 4th byte unused.

Code: Select all

zpptr1  byte 1,2,3,4
zpptr2  byte 5,6,7,8
To change the pointers, you have two 16-bit writes with 16-bit registers. And you only need a single 16-bit write when the bank byte isn't changing.

Re: int size for C compilers for the 65816

Posted: Fri Feb 03, 2023 6:04 am
by BigDumbDinosaur
tmr4 wrote:
litwr wrote:
Let's work with an example

Code: Select all

zpptr1  byte 1,2,3
zpptr2  byte 4,5,6
We can use these pointers, for instance in instruction LDA [zpptr1]. I need to write exactly 3 bytes (not 4!) if I want to change the value of pointer zpptr1. I also hardly call the normal 65816 access to a 3-byte value as trimming.
Normally you'd use 32-bit pointers with the 4th byte unused.

Code: Select all

zpptr1  byte 1,2,3,4
zpptr2  byte 5,6,7,8
To change the pointers, you have two 16-bit writes with 16-bit registers. And you only need a single 16-bit write when the bank byte isn't changing.

You’re repeating what Alarm Siren and I had already posted. The OP has himself convinced with this 24-bit stuff.

Re: int size for C compilers for the 65816

Posted: Sun Feb 05, 2023 6:31 pm
by tmr4
BigDumbDinosaur wrote:
You’re repeating what Alarm Siren and I had already posted.
Yup. I thought using the OP's own example might help get the point across.