Changes

Jump to: navigation, search

MOS 6502

253 bytes added, 20:19, 4 September 2024
* bit0 - CF - Carry Flag
|| Flags are affected by most operations.
When Decimal Mode is on, the ADC and SBC instructions update NF, VF and ZF based on the binary result before the decimal correction is applied and only CF is updated correctly. The CMOS chips update all the flags correctly.
 
DF is unchanged following an interrupt of any kind. This can cause unexpected bugs in the interrupt handler if Decimal Mode is on when an interrupt occurs.
 
Also, DF is not defined after RESET.
|-
| S (Stack Pointer) || 8-bit || Points to the current location in the stack || Stack is located in page 1 ($0100-$01FF), 8-bit S is offset to this base
<br>
 
== Decimal Mode ==
 
On NMOS, when Decimal Mode is on, the ADC and SBC instructions update NF, VF and ZF based on the binary result before the decimal correction is applied. Only CF is updated correctly. On CMOS, all the flags are updated correctly.
 
On NMOS, DF is not defined after RESET. On CMOS, DF is automatically cleared on RESET.
 
On NMOS, DF is unchanged when entering an interrupt of any kind. This can cause unexpected bugs in the interrupt handler if Decimal Mode is on when an interrupt occurs. On CMOS, DF is automatically cleared on interrupt. Upon returning from an interrupt, the processor restores the status register from the stack, including DF.
== Memory Access ==
== Oddities ==
* The On NMOS, the simultaneous assertion of a hardware interrupt line and execution of BRK was not accounted for in the design — the BRK instruction will be ignored in such a case. The On CMOS chips correctly handles , this situation is correctly handled by servicing the interrupt and then executing BRK.
* Some instructions, particularly those involving branches or indexed addressing modes, incur an extra cycle if the processor has to cross a memory page boundary. This is problematic for time-sensitive code.
13,173
edits