Tuesday 15 March 2011

pseudocode - assembly code confusion? stock at these two problems -


  1. Add value of status flag bits (0 or 1) after the execution of instructions. Explain

      mov bx, add 8000h bx, should be 8000 hc because the laser flag is not changed? 0 should be zero because it should be 1? Should not this be signed? Z?  
  2. Convert pseudo code to assembly, value value integer is signed and short circuit evaluation is used. The code should be compact.

      if (eax> ecx) and (ebx! = Edx) {mov edi, esi; Add ebacks, ex; }  

Do I really want to give some guidance to anyone on this?

Ah, a homework, in my nerves, Jack Daniels says that I should help you :)

1 0x8000 + 0x8000 = 0x10000 results are 17 bits, thus your register is only 16 bits. Therefore, only will be stored in 0x0000 bx. With this you will set the following flags:
- Off set (more than register register);
- CF set (highest bit result 1)
- PF is set (number is also)
- ZF is set (bx = 0)
- SF is not set (not signed number )

2 (Crop syntax)

  cmp eax, ecx jge short @f cmp ebx, edx jz short @f mov esi, edi add eax, ebx @@:  

No comments:

Post a Comment