Jump to content

Loop structures: Difference between revisions

No edit summary
Line 22:
=={{header|68000 Assembly}}==
'''NOT COVERED IN LOOP PAGES'''
 
The 68000 uses <code>DBxx Dn, label</code> for loop counting. "Dn" refers to a chosen data register. The "xx" is replaced with the condition code of your choice (<code>DBRA</code> stands for Decrement, Branch Always which is most commonly used). Execution will jump to the labeled line of code unless Dn's lower two bytes equal #$FFFF or the specified condition code is true, whichever occurs first. Keep in mind that the condition code has nothing to do with the value stored in Dn; rather, it represents the outcome of the operation just before the branch. This is similar to a "repeat until" construct in some other languages.
 
Line 30 ⟶ 31:
MOVE.W (A0)+,D0
CMP.W #3501,D0 ;COMPARE TO #3501
DBCC D1,LOOP ;DECREMENT, BRANCH UNTIL CARRY CLEAR OR D1 = #$FFFF</lang>
 
=={{header|AmbientTalk}}==
1,489

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.