Question

In: Computer Science

Assume that the state of the 8086 registers and memory just prior to the execution of...

Assume that the state of the 8086 registers and memory just prior to the execution of each instruction is given as below:
(AX) = 0000 H
(BX) = 0010 H

(CX) = 0105 H (DX) = 1111 H (SI) = 0100 H
(DI) = 0200 H (CF)= 0 (DS:100H) = 0F H (DS:200H) = 22 H (DS:220H) = AA H (DS:221H) = 55 H (DS:400H) = AA H (DS:401H) = 55 H

Examine the following instructions independently and calculate the result in each case: (28 points)

  1. a) SHLDX,CL

  2. b) SARBX,1

  3. c) SHLBYTEPTR[400H],1

  4. d) SAL BYTE PTR [DI], 1

  5. e) ROL DX, CL

  6. f) ROR BYTE PTR [DI], 1

  7. g) RCLBYTEPTR[400H],CL

Solutions

Expert Solution

a) SHL DX, CL

SHL instruction is used to shift the data towards left and stores the msb into the Carry flag (CF)

DX = 0h 1111

0b 0001 0001 0001 0001

CL = 0h 05
0b 0000 0101 = 0d 5
So, shifting the DX towards left 5 times and storing the shifted bit into CF.

C DX
0 0010001000100010
0 0100010001000100
0 1000100010001000
1 0001000100010000
0 0010001000100000

So, DX = 0b 0010 0010 0010 0000
0h 2220

CF = 0
DX = 0h 2220

CF = 0

b) SAR BX, 1

SAR instruction is used to shift the content of register to the right but the MSB is restored. And LSB is transferred to the CF.

BX = 0h 0010
0b 0000 0000 0001 0000

MSb is shifted to itself and LSB(Left- most bit is stored in CF)
Shifting the BX to right and restoring the MSB and LSB into CF
  
0000 0000 0001 0000--|
| |
0000 0000 0000 1000 0

CF = 0
BX = 0h 0008
ANS =
CF = 0
BX = 0h 0008

c) SHL BYTE PTR [400H], 1

Byte at the memory location pointed by pointer [400H] = AAH

Here address is calculated by DS(data segment) + Offset(in this case 400h)

0h AA
0b 1010 1010

Shifting AA 1 time and storing the MSB into cf

1010 1010
1 0101 0100

CF = 1
PTR[400H] = 0b 0101 0100 = 0h 54
ANS = CF = 1
PTR[400H] = 0b 0101 0100 = 0h 54

d) SAL BYTE PTR [DI], 1

DI = 0200H

BYTE PTR [DI] is equivalent to BYTE PTE [200H].

So, Byte at the memory location pointed by pointer [200H] = 22H

SAL is the same instruction as SHL.

0h 22
0b 0010 0010

Shifting AA 1 time and storing the MSB into cf

0010 0010
1 0100 0100

CF = 0
PTR[200H] = 0b 0100 0100 = 0h 44
ANS = CF = 0
PTR[200H] = 0b 0100 0100 = 0h 44

e) ROL DX, CL

ROL (rotate left) instruction is used to rotate the content of register towards left and MSB is put into the place of LSB as well as CF.

DX = 0h 2220

0b 0010 0010 0010 0000

CL = 0h 05
0b 0000 0101 = 0d 5
So, shifting the DX towards left 5 times and storing the shifted bit into CF.

C DX
0 0100010001000000
0 1000100010000000
1 0001000100000001
0 0010001000000010
0 0100010000000100

So, DX = 0b 0100 0100 0000 0100
0h 4404

CF = 0
DX = 0h 4404

CF = 0

f) ROR BYTE PTR [DI], 1

DI = 0200H

BYTE PTR [DI] is equivalent to BYTE PTE [200H].

So, Byte at the memory location pointed by pointer [200H] = 44H

ROR (rotate right) instruction is used to rotate the content of register towards right and LSB is put into the place of MSB as well as CF.

0h 44
0b 0100 0100

Shifting AA 1 time to right and rotating the LSB into MSB and cf

0100 0100__
________| |
| |
0010 0010 0

CF = 0
PTR[200H] = 0b 0010 0010 = 0h 22
ANS = CF = 0
PTR[200H] = 0b 0010 0010 = 0h 22

g) RCL BYTE PTR [400H], CL

RCL (Rotate left with carry), in this the MSB is stored into the CF and CF is stored as LSB.

Byte at PTR[400H] = 54H

54 = 0101 0100
CL = 0h 05
0b 0000 0005 = 0d 5

Shifting the MSB into CF and CF into LSB 5 times

CF PTR[400H]
0 10101000
1 01010000
0 10100001
1 01000010
0 10000101

CF = 0
PTR[400h] = 0b 1000 0101 = 0h 85
ANS =CF = 0

PTR[400h] = 0b 1000 0101 = 0h 85


Related Solutions

1- Assume that the state of the 8086 registers and memory just prior to the execution...
1- Assume that the state of the 8086 registers and memory just prior to the execution of each instruction is given as below: (AX) = 0010 H (BX) = 0020 H (CX) = 0030 H (DX) = 0040 H (SI) = 0100 H (DI) = 0200 H (CF) = 1 (DS:100H) = 10 H (DS:101H) = 00 H (DS:120H) = FF H (DS:121H) = FF H (DS:130H) = 08 H (DS:131H) = 00 H (DS:150H) = 02 H (DS:151H) =...
A) Name and explain the flag registers of 8086?                                  &nbs
A) Name and explain the flag registers of 8086?                                                                                                  B) Explain the Shift instruction? Name it’s types and explain only one of them?    C) Explain addressing decoding using 3- to 8- line decoder ? NOTE: In part C give the reason why we do address decoding and then explain the processes.
Example: A 3-address computer has 40 instructions, 16 Registers, and 256KB memory. Assume each instruction has...
Example: A 3-address computer has 40 instructions, 16 Registers, and 256KB memory. Assume each instruction has three operands. Two registers and the third operand is a direct address location of a memory. Find minimum size of PC, MAR, MDR, IR. Solution: OPCODE R1, R2, address OPCODE is 6 bits since 2^6>40 Register field is 4 bits since 2^4 =16 Memory field is 18 bits since 2^18=256K Instruction length =6+4+4+18=32 bits MDR=32 bits IR=32 bits MAR=18 PC=18 Please explain
Design a 8086 microprocessor base system that manage 1Mbyte of memory and can handle serial and...
Design a 8086 microprocessor base system that manage 1Mbyte of memory and can handle serial and parallel communication, a keyboard, a screen, a printer and a USB connection that handle high capacity secondary memory. Show all the connections needed and use all the necessary family chips needed to handle the I/O Systems. Show the memory map needed and the necessary I/O drivers. Use an interrupt manage chip to handle the I/O devices to be connected.
In the PIC18F452 Programming Model, list 2 registers that are used to access the Program Memory....
In the PIC18F452 Programming Model, list 2 registers that are used to access the Program Memory. Indicate their sizes.
Draw the figure for memory segments with 8086 microprocessor software model. Explain the logical address structure...
Draw the figure for memory segments with 8086 microprocessor software model. Explain the logical address structure used for each segment (Explain which registers are used in logical address presentation of each segment; segment address : offset address).
Explain the bounds registers approach for partitioned memory management and also give the major disadvantage of...
Explain the bounds registers approach for partitioned memory management and also give the major disadvantage of the bounds registers approach
Question 3. Describe memory types used in the MIPS assembly. Explain registers used in the MIPS...
Question 3. Describe memory types used in the MIPS assembly. Explain registers used in the MIPS assembly. Differentiate between assembly source code and machine code. Write a note on MIPS instruction formats.
Assume Dover Auto Inc. acquires all of the stock of Dover Financial Corporation. Just prior to...
Assume Dover Auto Inc. acquires all of the stock of Dover Financial Corporation. Just prior to the acquisition, their separate balance sheets are as follows: Dover Auto Inc Dover Financial Corporation Total assets 227,339,000 51,933,000 Total Liabilities 184,562,000 40,933,000 Shareholders’ Equity 42,777,000 11,000,000 Total Liabilities and Equity 227,339,000 51,933,000 Assume Dover Financial Corporation’s assets and liabilities are reported at fair value. Dover Auto Inc. pays $11,000,000 in cash to Dover Financial Corporation’s shareholders for Dover Financial corporation’s assets and liabilities...
Assume a 222 byte memory: a. What are the lowest and highest addresses if memory is...
Assume a 222 byte memory: a. What are the lowest and highest addresses if memory is byte-addressable? b. What are the lowest and highest addresses if memory is word-addressable, assuming a 16-bit word? c. What are the lowest and highest addresses if memory is word-addressable, assuming a 32-bit word? Explain with Steps please
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT