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.

would you program the computer so that the logic state at<br />

of the input port could be monitored Assume that there are<br />

ossible conditions:( a ) the other bits are grounded ( logic zero ) ,<br />

) the other bits may be used for other Hag inputs.<br />

e other bits are grounded, then the value from the input port<br />

e zero when the flag is cleared, and nonzero when it is set.<br />

other bits are used for flag inputs, then the "unwanted" bits<br />

'be masked. The masking operation uses the logical AND operaso<br />

an assembly-language subroutine would nave to be used.<br />

this case, you will enter the assembly-language program that<br />

d to perform the AND operation on two data bytes. Follow these<br />

to enter the program:<br />

Press the RESET key and type CALL -151 and press the RE­<br />

TURN key. The Apple should respond with an asterisk ( 0 )<br />

when it is in the Monitor mode.<br />

Type 0300: 00 00 00 48 AD 00 03 2D 01 03 8D 02 03 68 60 Leave<br />

a space between the two-digit groups as shown. Use 00 for the<br />

first three values in the program.<br />

Press the RETURN key, type 02FF and press the RETURN<br />

key three times. Now, check the data shown on the display<br />

with the information that you entered.<br />

test this assembly-language routine, you may use the followprogram.<br />

Since the AND operation will use binary numbers, you<br />

have to convert your test numbers into binary so that you can<br />

k the results.<br />

POKE 10,76: POKE 11,03: POKE 12,03<br />

INPUT " MASK BYTE ";M: POKE 768,M<br />

0 INPUT " DATA BYTE ";D: POKE 769,D<br />

Q = USR(O): PRINT "ANSWER "; PEEK(770)<br />

0 GOTO 1010<br />

e program does not provide the proper results, re-enter the<br />

pitor mode and check the data bytes that you have entered.<br />

151

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

Saved successfully!

Ooh no, something went wrong!