C2ASM - EXIT STOP#$2700 END START Var_A =(int 0x0F00 Var_B...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
C to ASM translation samples Result = (int*) 0x0F00; *Result = 0; for (i=1; i<100; 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 #100, D0 BNE LOOP STOP #$2700 END START Result = (int*) 0x0F00; *Result = 0; int i = 1; while (i<100) { *Result += i; i++; } ORG $0F00 Result DC.L 0 ORG $1000 START MOVE.L #1, D0 CLR.L Result LOOP CMP #100, D0 BEQ EXIT ADD.L D0, Result ADD.L #1, D0 BRA LOOP
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: EXIT STOP #$2700 END START Var_A = (int*) 0x0F00; Var_B = (int*) 0x0F04; Abs = (int*) 0x0F08; *Var_A = 0x40; *Var_B = 0x20; if (*Var_A<=*Var_B) *Abs = *Var_B – *Var_A; else *Abs = *Var_A – *Var_B; ORG $0F00 Var_A DC.L 0 Var_B DC.L 0 Abs DC.L 0 ORG $1000 START MOVE.L #$40, Var_A MOVE.L #$20, Var_B MOVE.L Var_A, D0 MOVE.L Var_B, D1 CMP.L D0, D1 BLE L0 SUB.L D0, D1 MOVE.L D1, Abs BRA EXIT L0 SUB.L D1, D0 MOVE.L D0, Abs EXIT STOP #$2700 END START...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern