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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

y-language programming will also be required. Since this is bend<br />

the scope of this book, we refer you to Programming & lntering<br />

the 6502, With Experiments and 6502 Soware Design,<br />

ward W. Sams & Co., Inc., Indianapolis, IN 46268. Both books<br />

uss the use of interrupts in detail, providing examples and assem-<br />

-language programs for the control of interrupts.<br />

he Apple interrupts IRQ and NMI use specific memory locations<br />

ro which the 6502 processor "fetches" the address of the subroue<br />

that is to be used as the service routine for each interrupt. The<br />

uses locations FFFEH and FFFFH, and the NMI uses locations<br />

F AH and FFFBH. Since these locations are actually within the<br />

d-only memory chips that contain the BASIC interpreter and the<br />

nitor, the addresses in these four locations are fixed and you canchange<br />

them. However, these fixed addresses are simply used to<br />

t to other locations in read/write memory where you can aclly<br />

change the pointers for the interrupt service subroutines. We<br />

er you to the Apple II Reference Manual for the details of how to<br />

these "vector" locations.<br />

FINAL WORDS<br />

few final words are necessary before you leave this chapter. We<br />

e chosen to introduce you to a simple assembly-language subroufor<br />

performing the logical AND or OR manipulation on two 8-bit<br />

es, along with the use of the assembly-language subroutine calloperation,<br />

USR. Actually, the Apple computer has a flag-checkcommand<br />

in its instruction set: WAIT. This instruction can be<br />

to check individual flags, or groups of flags, and it can detect<br />

'c one and logic zero flags, too. However, there is a limitation to<br />

se. If the proper flag pattern is not detected, then there is no way<br />

you to ever leave the flag-checking operation, and you must reset<br />

computer to get back control. Likewise, you cannot decide to<br />

ch to one portion of a program if the flag or flags are set, and to<br />

nch in another direction if they are not set. If the WAIT comd<br />

is used, you will simply continue to WAIT until the condition<br />

et. This is fairly inflexible, and we have chosen to avoid the use<br />

he WAIT command for this purpose.<br />

e have introduced you to the USR command for calling assemlanguage<br />

subroutines, and if you expand your horizons and cone<br />

to learn more about assembly-language programming, you will<br />

that this instruction is quite valuable. However, if you simply<br />

t to access an assembly-language subroutine, such as the logical<br />

subroutine, you can use the CALL command, followed by the<br />

l address of the start of the subroutine. A CALL 771 operacan<br />

be used to call the logical AND subroutine. Of course, you<br />

67

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

Saved successfully!

Ooh no, something went wrong!