Language:EN
Pages: 2
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
the carry added well the add operation automatical

The carry added well the add operation automatically adds the carry

166 Programming the 65816

The comparison operation—is VALUEl equal to VALUE2, for exam­ple—is implemented on the 65x, as on most processors, as an implied subtraction. In order to compare VALUEl to VALUE2, one of the val­ues is subtracted from the other. Clearly, if the result is zero, then the numbers are equal.

This kind of comparison can be made using the instructions you already know, as Fragment 9.5 illustrates. In this fragment, you can see that the branch to TRUE will be taken, and the INC VAL instruction never executed, because $1234 minus $1234 equals zero. Since the results of subtractions condition the z flag, the BEQ instruction (which literally means "branch if result equal to zero"), in this case, means "branch if the compared values are equal."

REP 9
167
#$30 16-bit registers
LONGA ON

0 0 0 2

LONGI ON

0 0 0 2

0002 9C1200 TRUE STZ
0005 A93412 LDA
0008 38 SEC

#$1234

subtract another

0009 E93412 SBC
OOOC F003 BEQ
INC
OOOE EE1200
0 0 1 1 60 RTS
0 0 1 20 0 0 0

VAL

DS

2

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : Dawn Tucker

PageId: DOCEA35B72