Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
••<br />
Addrss Byte<br />
Da;a Syie<br />
Mexacledmi !.ledm;;I rlexadedmal !lledmal<br />
0300 768 - - MASK Byte Goes Here<br />
0301<br />
- - DATA Byte Goes Here<br />
0302 770 - - ANSWER Found Here<br />
0303 771 48 72 PHA Push Reg A<br />
.. . 0304<br />
0305<br />
772<br />
773<br />
AD<br />
00<br />
173<br />
0<br />
LDA Load Reg A from<br />
MASK location<br />
I<br />
0306<br />
03 3<br />
0307 775 2D<br />
AND Reg A with DATA *<br />
0308 776 01 1<br />
0309<br />
03 3<br />
.. 030A 778 SD 141 STA Store result in<br />
I 0308<br />
02 2 ANSWER location<br />
030C 780 03 3<br />
030D 781 68 104 PLA Pul I Reg A back<br />
. 030E 782 60 96 RTS Return to BASIC<br />
769<br />
774<br />
777<br />
779<br />
*Substitute OOH, or 13 decimal, for an OR operation.<br />
45<br />
Three read/ write memory locations are used for the temporary<br />
of the various data bytes, called MASK, BYTE, and AN<br />
The MASK location is loaded with the mask byte, and the<br />
location is loaded with the byte that is to be operated on. After<br />
the logical operation has taken place, the ANSWER location contains<br />
result.<br />
To use this routine, you need to load the MASK information into<br />
768, and the DATA byte into address 769. You can use<br />
operations to do this. Once this is done, you simply need to<br />
the assembly-language subroutine, so that the operation is per<br />
·,,.,.. v. How do you do this<br />
Calling an assembly-language subroutine from BASIC is not very<br />
difficult. In the Apple computer, you simply need to put a three-byte<br />
instruction in three successive locations, addresses 10, 11, and<br />
or OB, and OC, in hexadecimal notation. Since our routine<br />
at address 771, or 0303H, you need to put the following infor<br />
,,,ucivu in these three locations: a 76 in address 10, a 3 in address 11,<br />
a 3 in address 12. Once you have loaded this ad.dress information<br />
these three locations, you can access the assembly-language subwith<br />
a USR function. In this case, you need to first load the<br />
and BYTE information, and then use the USR function. This<br />
shown in Example 4-3.<br />
In this case, the value 32 is the mask byte, and 129 is the value that<br />
to be ANDed with it. The Q fa a "dummy" variable that is required<br />
the use of the USR function, and the value 5 is a "dummy" value<br />
has no effect on the subroutine. You can use any variable for Q,