{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture06

# lecture06 - 0306-250 Assembly Language Programming Lecture...

This preview shows pages 1–8. Sign up to view the full content.

0306-250 Assembly Language Programming Lecture Six: Loop Constructs Operands

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
WHILE Statement 2 while (Predicate) { Loop Body } Control Flow Graph Loop Body Predicate ? T F Branch ¬ Predicate LABEL Predicate ? Loop Body WHILE Branch WHILE
WHILE Statement Example 3 while (Predicate) { Loop Body } X = VarA; while (X>0) { Y += X; X--; } HCS12 ; X: B ; Y: A ; VarA: memory VarA ldab VarA While: ble EndWhile LoopBody: aba decb bra While EndWhile:

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
DO Statement 4 do { Loop Body } while (Predicate); Branch Predicate DO Predicate ? Loop Body Control Flow Graph Loop Body Predicate ? T F
; X: B ; Y: A ; A: memory VarA ldab VarA Do: aba decb bgt Do EndDo: DO Statement Example 5 do { Loop Body } while (Predicate); X = VarA; do { Y += X; X--; } while (X>0); HCS12

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
FOR Statement 6 for (Init; Test; Step) { Loop Body } Control Flow Graph Loop Body Test ? T F Init. Step Branch ¬ Predicate LABEL Test ? Loop Body FOR Branch Test? Init. Step
FOR Statement Example 7 for (X=A; X>0;X--) { Y += X; } for (Init; Test; Step) { Loop Body } HCS12 ; X: B ; Y: A ; VarA: memory VarA ForInit: ldab VarA ForTest: ble EndFor ForLoop: aba ForStep: decb bra ForTest EndFor:

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 13

lecture06 - 0306-250 Assembly Language Programming Lecture...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online