ee357_hw3_sol

ee357_hw3_sol - EE 357 Homework 3 Fall 08 Dubois Name:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
EE 357 Homework 3 Fall ’08 ● Dubois Name: ___solutions_________________________ Due: Friday Sept 19 5.00 pm on blackboard Score: ________ Note: Attach all work to receive full credit HLL to Assembly Translation 1.) (30) Translate the following C code segment to an equivalent assembly language implementation. Add labels in front of instructions where needed . Result = (int*) 0x0F00; *Result = 0; for (i=1; i<50; i++) *Result += i; ORG $0F00 Result DC.L 0 ORG $1000 START MOVE.L #1, D0 CLR.L Result LOOP ADD.L D0, Result ADD.L #1, D0 CMP #50, D0 BNE LOOP STOP #$2700 END START Result = (int*) 0x0F00; *Result = 0; int i = 1; while (i<50) { *Result += i; i++; } ORG $0F00 Result DC.L 0 ORG $1000 START MOVE.L #1, D0 CLR.L Result LOOP CMP #50, D0 BEQ EXIT ADD.L D0, Result ADD.L #1, D0 BRA LOOP EXIT STOP #$2700 END START Var_A = (char*) 0x0F00; Var_B = (char*) 0x0F01; Abs = (char*) 0x0F02; *Var_A = 0x40; *Var_B = 0x20; if (*Var_B > *Var_A) *Abs = *Var_B – *Var_A; else *Abs = *Var_A – *Var_B;
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

ee357_hw3_sol - EE 357 Homework 3 Fall 08 Dubois Name:...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online