Unformatted text preview:

1. Pseudo-Code to Assembly Rewrite the following assembly routine into pseudo-code: 2. Pseudo-Code to Assembly Rewrite the following pseudo-code into assembly code: for ( i = 0; i < 7; i++ ) { x = x + 2; } 3. The Condition Code Register and Branch Instructions Consider these three instructions when answering the following three questions. 3a. What are the contents of D0 after the above instructions have been executed (decimal or hex)? 3b. The CMP instruction sets the N, Z, V, and C bits in the CCR. What are the values of those bits after the following instruction (1/2 point per bit)? CEG 320/520: Computer Organization and Assembly Language ProgrammingFall, 2004In Class : Flow Control - General updated: 29-sep-041 ORG $001000 2 MOVE.L #10, D03 CLR.L D14 LOOP SUB.L #2, D05 BLT REST6 ADD.W #1, D17 BRA LOOP8REST END1 CLR.L D0 2 TARGET ADDQ.L #6, D0 3 CMP.L #8, D0 D0:N Z V C3c. For each of the following branch instructions, indicate whether or not the branch would be taken. 4. Flow Control Consider the following code segment: 4a. What is the value in D0 after execution of the code (decimal or hex)? 4b. What is the value in D1 after execution of the code (decimal or hex)? 4c. The following pseudo-code represents the above assembly instructions. Which comparison operator should be placed in the for loop comparison instead of the word COMPARE to make the pseudo-code perform exactly the same functionality? D1 = 0; for ( D0 = 6; D0 COMPARE 0; D0 = D0 - 2) { D1 = D1 + 1; } Instruction Branch Taken? BRA TARGET BGT TARGET BLE TARGET 1 MOVE.L #6, D0 2 CLR.L D1 3 TARGET ADDQ.L #1, D1 4 SUBQ.L #2, D0 5 BLT REST 6 BRA TARGET 7REST END


View Full Document

Wright CEG 320 - Flow Control - General

Download Flow Control - General
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Flow Control - General and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Flow Control - General 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?