nvalue : 8 bits

Code: Select all

```
if (nvalue == 0)
z = 1 ;
else
z = 0;
if (nvalue & 0x80)
n = 1;
else
n = 0;
```

**Moderator:** Moderators

When the 65816 is in mem/reg 8 bits and a LDA is done, does the processor change the n and z flags? i mean:

nvalue : 8 bits

thxs.

nvalue : 8 bits

Code: Select all

```
if (nvalue == 0)
z = 1 ;
else
z = 0;
if (nvalue & 0x80)
n = 1;
else
n = 0;
```

ANes

It's not always based on bit 7; more generally, it's based on the most significant bit of the result. On the 65c816, this can be bit 7 of an 8-bit result or bit 15 of a 16-bit result depending on the mode bits (M, X, E). On the ARM architecture (a 32-bit RISC CPU based on design principles and opcode mnemonics similar to those of 6502), it's bit 31.Anes wrote:but when m == 1 (8 bits), the N flag is based on bit 7?.. i think is the racional thing.

As I understand it, the newbie forum is for NES, which doesn't have a 16-bit mode.Sorry i dont know if this post goes in the newbie forum.

ok, thanks. Last question:

if x == 1 (8 bits index registers) and m == 0, when doing an instruction that uses indirect addressing does it uses the low 8 bit of register x/y?

And viceversa i mean if (x == 0) and (m == 1) does it uses the full 16 bit index registers and load an 8 bit value into the accumulator/write to memory?

thanks again.

if x == 1 (8 bits index registers) and m == 0, when doing an instruction that uses indirect addressing does it uses the low 8 bit of register x/y?

And viceversa i mean if (x == 0) and (m == 1) does it uses the full 16 bit index registers and load an 8 bit value into the accumulator/write to memory?

thanks again.

ANes

As I understand, yes, since the index registers are 16-bit, the indexed instruction are adressed on 16-bits regardless of the acumulator's size.

By my own, I ask what happen what happens if tax or tay is met on the exact same situation. tya or txa won't cause problems, becuase only the low 8-bit will be copied. But in the other way arround, I just imagine the 8 high bit of the destination register are zeros, or they come from the phantom B register ?

By my own, I ask what happen what happens if tax or tay is met on the exact same situation. tya or txa won't cause problems, becuase only the low 8-bit will be copied. But in the other way arround, I just imagine the 8 high bit of the destination register are zeros, or they come from the phantom B register ?

Life is complex: it has both real and imaginary components.