Question

Write a sequence of two instructions that copies bits 0-5 from AL to bits 0-5 in...

Write a sequence of two instructions that copies bits 0-5 from AL to bits 0-5 in BL. Bits 6-7 in BL should be cleared, and AL should be unchanged

     

      Mov al, bl

      And 00111111, bl

     

Write a sequence of two instructions that copies the integer in bits 4-7 from AL register into bits 0-3 of the BL register. Upper 4 bits of AL and BL will be cleared

     

      Shr al, 4

      Mov bl, al

     

Code instructions that jump to the label L1 when either bit 2 or 3 is set in DL register

      Test dl, 00001100

      Jnz L1

     

      L1

     

Write instructions that implement following pseudo code by conditional jump.

If (eax>ecx)

Mov dl, +7

Else

Mov dl, -2

     

      Cmp eax, ecx

      Jg L1

      Mov dl, -2

     

      Jmp L2

     

      L1:

      Mov dl, 7

     

What will be final values of xc and dx when following code executes

.data

Array SWORD 4,-2,5,8,-3,7,1,0

.code

Mov cx,1

Mov esi,2

Mov ax,array[esi]

Mov bx,array[esi+4]

Cmp ax, 3

Jae L2

Cmp bx,4

Jb L1

Jmp L3

L1: mov xc,4

L2: mov dx,5

Jmp L4

L3: mov dx,6

      Cx = 1

      Dx =5

     

What is the decimal representation of ollowing binary number?

1010011.101

     

      83.625

     

In the following code sequence, show the value of AL after each shift or rotate instruction

Mov al, 8Ch

Sar al,1

      8C: 10001100

      Sar 1: 11000110 (C6)

Mov al, 6Bh

Ror al,1

      6B: 01101011

      Ror 1: 10110101 (B5)

Stc

Mov al, 0D4h

Rcl al,1

      D4: 11010100

      Rcl: 10101001 (A9)

     

Please indicate whether each statement is T or F

      Test instruction always alters destination operand: F

      JBE instruction is used when comparing unsigned integers: T

      JECXZ instruction jumps to target label when the CX register is equal to zero: F

      OR instruction canbe used to find intersection of two bit mapped sets: F

      Following code will jump to label named Target: T

            Mov eax, -72

            Cmp eax, 30

            Ja Target

Suppose in a system the datae field packs the year,month, and day into 16 bits as following

      DH    DL

      00100110    01101010

      Year: bits 9-15

      Month bits 5-8

      Day bits 0-4

     

A) Write a code to extract day field from register DX and save it in day label

      Mov al,dl

      And dl, 0001111

      Mov day,al

     

B) Write code to extract month field from DX and save it in month label

     

      Mov ax, dx

      Shr ax, 5

      And 00001111h, ax

      Mov month, al

     

Which statement is true about what will happne when the example code runs, draw the stack frame and explain the reason.

1: main PROC
2:   push 10

3:   push 20

4:   call Ex2sub5:   pop eax

6:   INVOKE ExitProcess,0

7: main ENDP

9: EX2Sub PROC

10:   popeax

11:   ret

12:

Write a program that jumps to a label if any of the bits 0,1,7 are set in AL, without changing the value

      Test al, 10000011

      Jnz L1

     

In the following instruction sequence, show resulting value of AL where indicated in hexadecimal

      Mov al, 3Dh

      And al,74h

            3D: 00111101

            74: 01110100

            AL=00110100 (34h)

     

      Mov al,9Bh

      Or al, 35h

            9B:10011011

            35:00110101

            AL=10111111 (BFh)

           

Implement the following pseudocode in assembly.

      If (val1>ecx) AND (ecx>edx)

      X=1

      Else

      X=2

     

            Cmp val1,ecx

            Jna fail

            Cmp ecx,edx

            Jna fail

            Mov x,1

            jmp L2

            Fail: mov x,2

            L2

What will be the final value in EDX after code executes?

      Mov edx,1

      Mov eax,7FFFh

      Cmp eax,8000h

      Jl L1

      Mov edx,0

      L1

     

      Edx = 0

     

Use following variable definitions for following question

      .data

      Var1 SBYTE -4,-2,3,1

      Var2 WORD 1000h, 2000h, 3000h, 4000h

      Var 3 SWORD -16,-42

What will be hex value of destination operand after each of following instructions execute in sequence?

      Mov al, var1

            -4 (FCh)

      Mov ah,[var1+3]

           

      Movsx ebx,var1

Homework Answers

Answer #1

I assume that a brief explanation is asked in the questions. and I have answered some parts.

but it should be clearly mentioned in question what is required  

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
In assembly masm use the code below! Write a program that reverse a string using indirect...
In assembly masm use the code below! Write a program that reverse a string using indirect addressing (may not use the stack - push/pop). The string will be given by the user and be up to 64 characters long INCLUDE Irvine32.inc INCLUDE macros.inc MAX = 64 .data source BYTE MAX DUP('#'),0 destination BYTE LENGTHOF source DUP('*'),0 actual_length DWORD ? ask BYTE "Enter a String: ",0 .code main proc ; ask user for input mov edx, OFFSET ask call WriteString ;...
A) Is the code below secure? Explain your rationale. ExitProcess PROTO .data firstval qword 20002000h secondval...
A) Is the code below secure? Explain your rationale. ExitProcess PROTO .data firstval qword 20002000h secondval qword 11111111h thirdval qword 22222222h sum qword 0 .code main proc      mov rax,firstval                         add rax,secondval             add    rax,thirdval      mov    sum,rax      mov    ecx,0      invoke ExitProcess main endp end main b) Transmitted messages often include a parity bit, whose value is combined with a data byte to produce an even number of 1 bits. Suppose a message byte in the AL...
. Write a sequence of instructions to compute the following arithmetic expression and store the result...
. Write a sequence of instructions to compute the following arithmetic expression and store the result in register DX: 7 + (-20) * 14 - (-10) * 8– 9 Trace the contents of registers, assume initial contents are 0000 Instruction AX BX CX DX Remark initial 0000 0000 0000 0000
0x00000000004010cc <+0>:   push %r13 0x00000000004010ce <+2>:   push %r12 0x00000000004010d0 <+4>:   push %rbp 0x00000000004010d1 <+5>:   push %rbx...
0x00000000004010cc <+0>:   push %r13 0x00000000004010ce <+2>:   push %r12 0x00000000004010d0 <+4>:   push %rbp 0x00000000004010d1 <+5>:   push %rbx 0x00000000004010d2 <+6>:   sub $0x68,%rsp 0x00000000004010d6 <+10>:   mov %fs:0x28,%rax 0x00000000004010df <+19>:   mov %rax,0x58(%rsp) 0x00000000004010e4 <+24>:   xor %eax,%eax 0x00000000004010e6 <+26>:   mov %rsp,%rsi 0x00000000004010e9 <+29>:   callq 0x40159a <read_six_numbers> 0x00000000004010ee <+34>:   mov %rsp,%r12 0x00000000004010f1 <+37>:   mov $0x0,%r13d 0x00000000004010f7 <+43>:   mov %r12,%rbp 0x00000000004010fa <+46>:   mov (%r12),%eax 0x00000000004010fe <+50>:   sub $0x1,%eax 0x0000000000401101 <+53>:   cmp $0x5,%eax 0x0000000000401104 <+56>:   jbe 0x40110b <phase_6+63> 0x0000000000401106 <+58>:   callq 0x401564 <explode_bomb> 0x000000000040110b <+63>:   add $0x1,%r13d 0x000000000040110f...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT