Why does the 6502 have the bit instruction?

Why does the 6502 have the bit instruction?

Bit 6/7 of a flag byte can be tested right away. Likewise (counting) semaphores/locks. In addition bit can be used to test for a numbers sign, again without touching anything but the flags. And curiously, it’s missing any indexed or indirect addressing modes, and so can only be used absolutely or in the zero page.

When to set the Z flag in the 6502?

Neither. In the 6502, the Z flag is set if there’s an all-zero pattern on the internal data bus in the last instruction cycle and cleared if it isn’t. This means specifically instructions as PLA or TAX affect the Z flag.

Why does the 6502 have zero page opcodes?

The use of zero or zero page values will result in assembled code with zero page opcodes when you wanted absolute codes. With $FFFF, the problem is in addresses+1 as you wrap around to page 0. When the 6502 is ready for the next instruction it increments the program counter before fetching the instruction.

Are there any register operations on the 6502?

There are no register/register operations on the 6502 (except for transfer). The 6502 follows a strict accumulator/memory scheme (with a few extensions for index-register/memory). Your example is a bit useless, as comparing two constants doesn’t make sense – one needs to be a variable at least, right?

When does the 6502 increment the program counter?

When the 6502 is ready for the next instruction it increments the program counter before fetching the instruction. Once it has the op code, it increments the program counter by the length of the operand, if any.

How is the 6502 instruction table laid out?

The 6502 instruction table is laid out according to a pattern a-b-c, where. a and b are an octal number each, followed by a group of two binary digits c, as in the bit-vector “aaabbbcc”.

What does the interrupt flag do on the 6502?

The Interrupt flag is used to prevent (SEI) or enable (CLI) maskable interrupts (aka IRQ’s). It does not signal the presence or absence of an interrupt condition. The 6502 will set this flag automatically in response to an interrupt and restore it to its prior status on completion of the interrupt service routine.