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.

MUSIC SYNTHESIS SOFTWARE 653<br />

1. Double-word load accumulator<br />

2. Double-word store accumulator<br />

3. Double-word addition to accumulator<br />

4. Double-word subtraction from accumulator<br />

5. Double-word negation <strong>of</strong> accumulator<br />

6. Double-word left shifting <strong>of</strong> accumulator<br />

7. Double-word signed and unsigned right shifting <strong>of</strong> accumulator<br />

8. Unsigned multiplication 8 X 8 = 16<br />

9. Signed multiplication (uses unsigned multiplication as a subroutine)<br />

8 X 8= 15<br />

10. Unsigned division 16/8=8<br />

11. Signed division (uses unsigned division as a subroutine) 15/8=8<br />

Double-word addition is necessary for forming sums <strong>of</strong> products that will in<br />

general be double-word values. Shifting operations are needed for scaling. Of<br />

course, single-word addition, subtraction, negation, and shifting are also<br />

necessary. It is <strong>of</strong>ten helpful to have a "load with sign extend" operation,<br />

which is used to translate a single-word signed value into a double-word one.<br />

It is surprising how many computers, both micro and mini, that claim to<br />

have complete hardware arithmetic capability fail to include all <strong>of</strong> these<br />

necessary operations.<br />

A Fixed-Point Arithmetic Package<br />

for the 6502<br />

Here we will briefly describe the 8-bit arithmetic package for the 6502<br />

shown in Fig. 18-3. A pseudo-16-bit accumulator is assumed to exist in<br />

page zero memory at location ACCH for the high order half and ACCL for<br />

the low order half. All subroutines that require a double-byte second operand<br />

expect the address <strong>of</strong> the high-order half <strong>of</strong> the operand, which must be in<br />

page zero, to be in the X index register. Single-byte second operands are<br />

expected to be in the hardware accumulator.<br />

Load and store are trivially simple. Although they can be easily done by<br />

in-line code in the calling program, using the subroutines will make a<br />

signal-processing program easier to read and later convert to a machine with<br />

hardware to replace this package.<br />

Double-precision addition and subtraction are equally straightforward.<br />

Both process the low bytes first and then use the carry flag to transmit carry<br />

information to the high bytes. Note that the 6502 does not have add and<br />

subtract in which the carry flag is ignored. Therefore, it is frequently necessary<br />

to clear or set the carry before an addition or subtraction, respectively.<br />

Negation is performed by subtracting the pseudoaccumulator from zero,<br />

which turns out to be faster than complementing all <strong>of</strong> the bits and then<br />

incrementing.

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

Saved successfully!

Ooh no, something went wrong!