22.09.2015 Views

of Microprocessors

Musical-Applications-of-Microprocessors-2ed-Chamberlin-H-1987

Musical-Applications-of-Microprocessors-2ed-Chamberlin-H-1987

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

156 MUSICAL ApPLICATIONS OF MICROPROCESSORS<br />

6502 instructions may be either one, two, or three bytes in length. The<br />

first byte is always the op code and the second and third bytes, ifpresent, are<br />

either immediate operands or addresses. The first 256 bytes <strong>of</strong> memory<br />

(OOOO-OOFF) are termed the base page and can be addressed by many instructions<br />

with a single address byte. However, the base page is indispensable for<br />

most programming and is not merely a convenient way to save on memory.<br />

The 6502 CPU is unusually efficient in executing instructions. Many<br />

require only as many machine cycles as memory cycles and nearly all <strong>of</strong> the<br />

remainder require only one extra cycle. Average execution speed may <strong>of</strong>ten<br />

exceed 350,000 instructions/sec due in part to extremely fast conditional<br />

jumps (2.5 f.Lsec average) and immediate mode instructions (2 f.Lsec). For<br />

even higher speed, selected CPUs wi th clock frequencies as high as 4.°MHz<br />

are available, which can approach speeds <strong>of</strong> 1.5 million instructions/sec<br />

(MIPS) when combined with bipolar memory.<br />

Addressing Modes<br />

Like most minicomputers, the strength <strong>of</strong> the 6502 is its memoryaddressing<br />

modes. Easy access to memory and a number <strong>of</strong> in-memory<br />

operations reduce the need for registers. Although the manufacturer boasts<br />

13 addressing modes, only 10 are sufficiently differentiated to be listed here:<br />

1. Register, the operand is the designated register.<br />

2. Immediate, the operand is the byte following the instruction.<br />

3. Relative, the operand address is formed by adding the following byte to<br />

the location counter (signed add). Used only by conditional branch<br />

instructions.<br />

4. Zero page, the address <strong>of</strong> the operand is contained in the single following<br />

byte.<br />

5. Absolute, the address <strong>of</strong> the operand is contained in the two following<br />

bytes.<br />

6. Zero page indexed, the address <strong>of</strong> the operand is formed by adding the<br />

following byte to the specified index register discarding the carry if<br />

any.<br />

7. Absolute indexed, the address <strong>of</strong> the operand is formed by adding the<br />

following two bytes to the specified index register (unsigned add).<br />

8. Indirect, the address <strong>of</strong> a byte pair containing the address <strong>of</strong> the<br />

operand is in the following two bytes. Used only by the unconditional<br />

branch instruction.<br />

9. Indexed indirect, the zero page indexed sequence is used to locate a<br />

byte pair on the base page containing the address <strong>of</strong> the operand.<br />

10. Indirect indexed, the second byte <strong>of</strong> the instruction points to a byte<br />

pair on the base page, which is added to the Y index register (unsigned<br />

add) to form the address <strong>of</strong> the operand.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!