enum

CPU::AddressModes

Inherits Enum < Comparable < Value < Object

The modes of addressing

Constants

Accumulator = 0

There are a number of "atomic read/modify/write" instructions which can address EITHER Memory OR the Accumulator (A)

Immediate = 1

A better name for this mode might be Immediate Value as no "addressing" actually takes place.

ZeroPage = 2

Much like Absolute Addressing, but can only address the first 256 (0..255) bytes of memory.

ZeroPageX = 3

In Zero-Page Addressing the destination address is fixed by the programmer (or assembler) at assembly time. By using the hard-coded address as a base, and CPU#x_index as an Index, a more dynamic addressing system can be implemented. With Zero-Page, only the first 256 (0..255) bytes of memory may be addressed. So if the result of Base+CPU#x_index is greater than $FF, wrapping will occur.

ZeroPageY = 4

In Zero-Page Addressing the destination address is fixed by the programmer (or assembler) at assembly time. By using the hard-coded address as a base, and CPU#y_index as an Index, a more dynamic addressing system can be implemented. With Zero-Page, only the first 256 (0..255) bytes of memory may be addressed. So if the result of Base+CPU#y_index is greater than $FF, wrapping will occur.

Absolute = 5

Read a value from a 16-bit address Remember without special external hardware for paging, the 6502 only has a maximum of 64K of address space available - so 16-bits is enough to address ANY byte of memory.

AbsoluteX = 6

In Absolute Addressing the destination address is fixed by the programmer (or assembler) at assembly time. By using the hard-coded address as a base, and CPU#x_index as an Index, a more dynamic addressing system can be implemented. If the result of Base+CPU#x_index is greater than $FFFF, wrapping will occur.

AbsoluteY = 7

In Absolute Addressing the destination address is fixed by the programmer (or assembler) at assembly time. By using the hard-coded address as a base, and CPU#y_index as an Index, a more dynamic addressing system can be implemented. If the result of Base+CPU#y_index is greater than $FFFF, wrapping will occur.

Indirect = 8

With this instruction, the 8-but address (location) supplied by the programmer is considered to be a Zero-Page address, that is, an address in the first 256 (0..255) bytes of memory. The content of this Zero-Page address must contain the low 8-bits of a memory address The following byte (the contents of address+1) must contain the upper 8-bits of a memory address Once this memory address has been read from the Zero-Page location (specified by the programmer), this calculated memory address is then examined, and it's contents are returned.

IndirectX = 9

This addressing mode is only available with X. Much like Indirect Addressing, but the contents of the index register is added to the Zero-Page address (location) If Base_Location+Index is greater than $FF, wrapping will occur.

IndirectY = 10

This addressing mode is only available with Y. Much like Indexed Addressing, but the contents of the index register is added to the Base_Location after it is read from Zero-Page memory. If Base_Location+Index is greater than $FFFF, wrapping will occur.

Instance methods

absolute?

Returns true if this enum value equals Absolute

absolute_x?

Returns true if this enum value equals AbsoluteX

absolute_y?

Returns true if this enum value equals AbsoluteY

accumulator?

Returns true if this enum value equals Accumulator

immediate?

Returns true if this enum value equals Immediate

indirect?

Returns true if this enum value equals Indirect

indirect_x?

Returns true if this enum value equals IndirectX

indirect_y?

Returns true if this enum value equals IndirectY

zero_page?

Returns true if this enum value equals ZeroPage

zero_page_x?

Returns true if this enum value equals ZeroPageX

zero_page_y?

Returns true if this enum value equals ZeroPageY