|System Specification for C65||Fred Bowen||March 1, 1991|
Processor status P register
The Processor status register is an 8-bit register which is used to indicate the status of the microprocessor. It contains 8 processor "flags". Some of the flags are set or reset based on the results of various types of operations. Others are more specific. The flags are ...
|Negative||result of operation is negative|
|Overflow||result of add or subtract causes signed overflow|
|Extend||disables stack pointer extension|
|Break||interrupt was caused by BRK opcode|
|Decimal||perform add/subtract using BCD math|
|Interrupt||disable IRQ interrupts|
|Zero||result of operation is zero|
|Carry||operation caused a carry|
Stack Pointer SP
The stack pointer is a 16 bit register that has two modes. It can be programmed to be either an 8-bit page Programmable pointer, or a full 16-bit pointer. The processor status E bit selects which mode will be used. When set, the E bit selects the 8-bit mode. When reset, the E bit selects the 16-bit mode.
Upon reset, the CSG 4502 will come up in the 8-bit page-programmable mode, with the stack page set to 1. This makes it compatible with earlier 6502 products. The programmer can quickly change the default stack page by loading the Y register with the desired page and transferring its contents to the stack pointer high byte, using the TYS,opcode. The 8-bit stack pointer can be set by loading the X register with the desired value, and transferring its contents to the stack pointer low byte, using the TXS opcode.
To select the 16-bit stack poinler mode, the user must execute a CLE (for CLear Extend disable) opcode. Setting the 16-bit pointer is done by loading the X and Y registers with the desired stack pointer low and high bytes, respectively, and then transferring their contents to the stack pointer using TXS and TYS. To return to 8-bit page mode, simple execute a SEE (SEt Extend disable) opcode.
If you are using Non-Maskable-Interrupts, or Interrupt Request is enabled, and you want to change BOTH stack pointer bytes, do not put any code between the TXSsand TYS opcodes Taking this precaution will prevent any interrupt s irom occuring between the setting of the two stack pointer bytes, causing a potential for writing stack data to an unwanted area.
Program Counter PC
The program counter is a 16-bit up-only counter that determines what area of memory that program information will be fetched from. The user generally only modifies it using jumps, branches, subroutine calls, or returns. it is set initially, and by interrupts, from vectors at memory addresses FFFA through FFFF (hex). See "Interrupts" below.
|This page has been created by Sami Rautiainen.|
|Read the small print.||Last updated July 29, 2002.|