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.

648 MUSICAL ApPLICATIONS OF MICROPROCESSORS<br />

rule in which raw numbers are fed in and raw answers come out. It is the<br />

operator's responsibility to place the decimal point. Binary integers have the<br />

binary point to the right <strong>of</strong> the magnitude bits. Binary fractions have the<br />

binary point to the left <strong>of</strong> the magnitude bits. For unsigned numbers, this<br />

means to the left <strong>of</strong> all bits, while signed numbers have the point between<br />

the sign bit and the rest <strong>of</strong> the bits. Mixed numbers can have the binary point<br />

anywhere in between.<br />

A good way to think <strong>of</strong> mixed binary numbers is to consider their<br />

resolution, which is the weight <strong>of</strong> the least significant bit, and their range,<br />

which is the largest number that can be represented. We will also be referring<br />

to their integer part, which is the string <strong>of</strong> bits to the left <strong>of</strong> the point, and<br />

their fractional part, which is the string to the right. Thus, a signed number<br />

with the binary points between bits 3 and 4 as illustrated in Fig. 18-2 has a<br />

resolution <strong>of</strong> 1/16 or 0.0625 and a range <strong>of</strong> 127/16 or 7.9375 (which can be<br />

called 8 for convenience). The integer part is bits 4-6 and the fractional part<br />

is bits 0-3. Integers, <strong>of</strong> course, have a resolution <strong>of</strong> unity and a range<br />

dependent on word size, while fractions have a range just short <strong>of</strong> unity and a<br />

resolution determined by word size.<br />

The last property <strong>of</strong> binary numbers is word size or simply the number<br />

<strong>of</strong> bits allocated to the representation <strong>of</strong> the number. Arithmetic word sizes<br />

are usually chosen to be integer multiples <strong>of</strong> the computer's word size, or in<br />

the case <strong>of</strong> a sophisticated machine, a multiple <strong>of</strong> the smallest directly<br />

addressable dara element, usually an 8-bit byte. When the word size <strong>of</strong> a<br />

number is greater than the word size <strong>of</strong> the machine, the number is said to be<br />

a double-precision or multiple-precision number. Thus, with the 6502 example<br />

machine, 16-bit numbers are double-precision quantities, 24 birs is tripleprecision,<br />

etc.<br />

Before the advent <strong>of</strong> microprocessors, visualization <strong>of</strong> multiple precision<br />

numbers on paper and in memory was a simple, unambiguous task. A<br />

double-precision number, for example, would be visualized as consisting <strong>of</strong> a<br />

high order, more significant parr and a low order, less significant parr. When<br />

written on paper, it is natural and even necessary to write the high order parr<br />

to the left <strong>of</strong> the low order part. If one listed a portion <strong>of</strong> memory containing<br />

the number, it would be reasonable to expect it to look the same as it did on<br />

the notepad. However, many <strong>of</strong> the most popular microprocessors (6502<br />

included) handle double-precision unsigned numbers (namely memory addresses)<br />

low byte first! Thus, the address bytes <strong>of</strong> instructions and indirect<br />

address pointers all appear on a memory dump backward. Furrhermore, since<br />

address arithmetic is done one byte at a time, the programmer must be aware<br />

<strong>of</strong> this to get these operations done right.<br />

The question, then, is: Should all numbers be stored and manipulated<br />

backward or just addresses) The author has tried it both ways and found<br />

neither to be completely satisfactory on the 6502. However, in signalprocessing<br />

work, it is recommended that all numbers except addresses be

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

Saved successfully!

Ooh no, something went wrong!