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.

MICROPROCESSORS 157<br />

A close examination <strong>of</strong> a detailed instruction set listing immediately<br />

reveals that no instruction is legal in all <strong>of</strong> these modes and that most can use<br />

half or fewer <strong>of</strong> them. In particular, instructions using one index register for<br />

an operand cannot use the same register in forming rhe address <strong>of</strong> the other<br />

operand. Also, the unqualified indirect mode would be very useful generally,<br />

but the same effect can be achieved with either <strong>of</strong> the other indirect forms if<br />

the index register contains zero. 5 Other than these, the selection seems to be<br />

well thought out, since the need for an unavailable combination is not<br />

frequent. Note that the base page must be used to perform variable addressing<br />

<strong>of</strong> any possible memory location; the indexed modes only have a range <strong>of</strong> 256<br />

bytes due to the 8-bit size <strong>of</strong> the index registers.<br />

A full instruction set listing is shown in Table 5-1 along with the<br />

allowable addressing modes and execution time. One unique feature is that<br />

shift and rotate instructions can work directly in memory and with indexed<br />

addressing to boot! Note that the condition codes are set even when something<br />

is merely loaded. Both the LSI-II style bit test and compare any<br />

register instructions are also included, although the immediate form <strong>of</strong> bit<br />

test is mysteriously absent. 5<br />

There are some weak points too. For example, the arithmetic instructions<br />

always include the carry in the calculation. For the more common<br />

single-byte or subtract, it is necessary to first clear or set the carry flag,<br />

respectively (if its current state is unknown). Conditional branches are<br />

limited to true and complement testing <strong>of</strong> individual condition flags,<br />

although the inclusion <strong>of</strong> an overflow indicator makes it easy to simulate all<br />

<strong>of</strong> the combination forms also. One perennial headache is that index registers<br />

must pass through the accumulator on the way to or from the stack. 5<br />

Interfacing Tricks<br />

Although not obvious from the foregoing description, the 6502 lends<br />

itself well to individual bit control functions. For individual testing <strong>of</strong><br />

external conditions such as key closures, a standard digital multiplexor can<br />

be connected ro respond to a range <strong>of</strong> addresses and gate the addressed input<br />

onto the most significant bit <strong>of</strong> the data bus. A shift or rotate memory left<br />

instruction can then copy the addressed condition into the carry flag for<br />

testing without disturbing any <strong>of</strong> the registers. Inexpensive addressable<br />

latches can be used for individual control <strong>of</strong> output bits, again without<br />

disturbing any registers. If the addressable latches are wired to respond to a<br />

group <strong>of</strong> addresses and take their data from the least significant bit <strong>of</strong> the<br />

data bus, then a shift memory left will clear the addressed bit and a shift<br />

5 The CMOS 6502 mentioned earlier does have an unindexed indirect addressing mode<br />

added as well as several new instructions including bit tesr immediate and direct push<br />

and pop <strong>of</strong> the index registers.

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

Saved successfully!

Ooh no, something went wrong!