0
  1. the value of status flag bits (0 or 1) after execution of the add instruction. explain

     mov bx, 8000h
     add bx, 8000h
     c  this should be 0 because carry flag is not changed?
     0  this should be 1 because the sum is not zero?
     s  this should be not signed?
     z  ?
    
  2. convert the pseudo-code into assembly, assumes value are signed integers and short circuited evaluation is used. the code should be compact.

    if(eax<ecx) AND (ebx != edx) {
     mov edi, esi;
     add ebx, eax;
    }
    

I'm really lost at this anyone want give some guidance?

1
  • 3
    This is basic assembly, what exactly you don't understand? If you don't understand anything, you should read your course again and/or ask your tutor.
    – m0skit0
    Mar 17, 2015 at 19:04

1 Answer 1

1

Ah, a homework. Jack Daniels in my veins says I should help you :)

1 0x8000 + 0x8000 = 0x10000. Result is 17 bits, thus but your register is only 16 bits. So, only 0x0000 will be stored in BX.
With this you will get the following flags set:
- OF is set (sum is greater than register can hold);
- CF is set (highest bit of the result is 1)
- PF is set (number is even)
- ZF is set (BX = 0)
- SF is not set (not a signed number)

2 (fasm syntax)

cmp eax, ecx
jge short @f
cmp ebx, edx
jz short @f
mov esi, edi
add eax, ebx
@@:
2
  • Thank so much sir, also sir can I email you, I just few minor problem to ask since you are the assembly expert? thank you!
    – user4682291
    Mar 18, 2015 at 20:03
  • also it's for midterm practice not HW
    – user4682291
    Mar 18, 2015 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.