27.01.2015 Views

titus-larsen-titus-1981-apple-interfacing

titus-larsen-titus-1981-apple-interfacing

titus-larsen-titus-1981-apple-interfacing

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

·<br />

numbers would have to be "split" into an 8-bit MSBY and an<br />

8-bit LSBY. Can you suggest how this might be done<br />

number could be divided by 256 to get the MSBY as the integer<br />

of the answer. For example, if we start with the number<br />

integer portion of the result, 42, when converted into an 8-bit<br />

number, would be the MSBY of the value. The LSBY can<br />

calculated:<br />

- (42 * 256) = 171<br />

the 171 must also be converted into its 8-bit binary equivalent<br />

be the LSBY.<br />

A BASIC program can be written for the Apple to perform these<br />

Could you write it<br />

We developed the following program to make the "conversion:"<br />

INPUT "VALUE "; V<br />

M = V/256<br />

l = V - INT(M) * 256<br />

PRINT INT(M), l<br />

INPUT A$<br />

POKE 49318,M<br />

INPUT A$<br />

POKE 49318,l<br />

GOTO 10<br />

MSBY and the LSBY will be displayed on the video monitor i:n<br />

decimal form. The INT command has been used to "strip" the<br />

""""'""' fraction from the value for M, for clarity. This is not refor<br />

the POKE operation, since the decimal fraction will be

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

Saved successfully!

Ooh no, something went wrong!