Forum

8 bit vs 4 bit registers

More
#611 by ericleven
ericleven created the topic: 8 bit vs 4 bit registers
I'm writing a program with some 4 bit and some 8 bit registers. I was using registers M1 and X1 and I noticed some odd behavior with X1 until I changed M1 to M4. I understand that using an 8 bit register uses two 4 bit registers, but do I need to be careful about 8 bit register names stepping on 4 bit ones?

For example, if I use X0, does that mean I can't use M0 and M1?

-eric
The following user(s) said Thank You: foxonix

Please Log in or Create an account to join the conversation.

More
#613 by foxonix
foxonix replied the topic: 8 bit vs 4 bit registers
Yep! That's exactly right. If you use X0, the compiler creates this 8-bit register by combining M0 and M1. If you use X1, then the compiler creates it out of M2 and M3. So while you can have sixteen 4-bit registers (M0 - M15), you can only have eight 8-bit registers (X0-X7).

In the Data Format section of the reference page , we describe how 8-bit registers are created out of 4-bit registers, but we don't explicitly say which registers are involved when you use a particular 8-bit register. We could add that. Thanks!

Foxonix - make your ideas heard.
@foxonixdev
The following user(s) said Thank You: ericleven

Please Log in or Create an account to join the conversation.

Time to create page: 0.019 seconds