Question

Assembly language

Q#1 AX contains a numberbetween 0-15. Write code to complement the corresponding bit in BX.For example if AX contains 6; complement the 6th bit of BX. (Note:First bitin BX is at 0th position and last bit is at 15thposition)
Marks10
Q#2 Suppose that AX=0x3412, BX=0x7856, CX= 0x1CAB, and SP=0x100.Given the contents of AX, BX, CX, and SP after executing thefollowing instructions:
PUSH AX
PUSH BX
XCHG AX, CX
POP CX
PUSH AX
POP BX
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Q#1 AX contains a number between 0-15. Writecode to complement the corresponding bit in BX. For example if AXcontains 6; complementthe 6th bit of BX.(Note: First bit in BX is at 0thposition and last bit is at15thposition)Marks10

Solution:

[org 0x0100]

mov ax,3 ;suppose axcontain 3

movdx,1 ;initial value for complement with bx

cmpax,0;if ax contain 0

jecomplement; go for complement ist bit

movcx,ax ;other wisemove the value in cx

shldx,cl; shift 1 to left for number value in ax

complement:

xorbx,dx;perform comlement operation

mov ax,4ch

int 21h

Q#2 Suppose that AX=0x3412, BX=0x7856, CX=0x1CAB, and SP=0x100. Given the contents of AX, BX, CX, and SPafter executing the followinginstructions:

PUSH AX

PUSH BX

XCHG AX, CX

POP CX

PUSH AX

POP BX

Marks10

SOLUTION:

AX

BX

CX

SP

PUSH AX

0x3412

0x7856

0x1CAB

0xFE

PUSH BX

0x3412

0x7856

0x1CAB

0XFC

XCHG AX,CX

0x1CAB

0x7856

0x3412

0XFC

POP CX

0x1CAB

0x7856

0x7856

0xFE

PUSH AX

0x1CAB

0x7856

0x7856

0XFC

POP BX

0x1CAB

0x1CAB

0x7856

0xFE

answered by: Alemnesh
Add a comment
Know the answer?
Add Answer to:
Assembly language
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Need help on Assembly language 1.Solve the following conditions: A. Suppose AL contains 11001011 and CF...

    Need help on Assembly language 1.Solve the following conditions: A. Suppose AL contains 11001011 and CF = 1.    Give the new contents of AL after each of the following instructions is executed.    Assume the above initial conditions for each part of this question. a. SHL AL,1 b. SHR AL,1 c. ROL AL,2 d. ROR AL,3 e. SAR AL,2 f. RCL AL,1 g. RCR AL,3 B. Suppose EAX contain ABCDH.    Show the contents of BX and CX after...

  • Write an assembly intel 8088 16 bit code MASM,(The 8088 includes has four 16-bit data registers...

    Write an assembly intel 8088 16 bit code MASM,(The 8088 includes has four 16-bit data registers (AX, BX, CX and DX). BX can also be used as an address register for indirect addressing. The most/least significant byte of each register can also be addressed directly) using push, pop, and stack print the array 8,9,10,1,2,3,4,5,6,7 please provide the full assembly code.

  • Answer based on microprocessor 8086 (10) LEA BX, CX 7. Suppose that (AX)-4AOBH, the content of...

    Answer based on microprocessor 8086 (10) LEA BX, CX 7. Suppose that (AX)-4AOBH, the content of [1020H] storage unit is 260FH. Try to determine the results of the following instructions. (1) MOV AX, 1020H (AX) (2) XCHG AX, [1020H) ; (AX) (3) MOV AX, [1020H) ;(AX)=- (4) LEA AX, [1020H) ; (AX) 10. Suppose the size of the stack segment is 256 bytes. The starting address of the stack is 1250: 0000H, assuming there are 5 word-sized data in the...

  • 1. Registry conditions:         A. Show how the decimal integer          * -120 would be stored...

    1. Registry conditions:         A. Show how the decimal integer          * -120 would be stored in 16 bits          * -120 would be stored in 8 bits          * -32456 would be stored in 32 bits          * -32456 would be stored in 16 bits         B. For each of the following decimal numbers, tell whether it could be         stored (1) as a 16-bit number (2) as an 8-bit number.          * 32768          * -40000          *...

  • Any help with this computer Organization and Architecture question It's on assembly language procedure Please use...

    Any help with this computer Organization and Architecture question It's on assembly language procedure Please use TASM 3. Write a procedure called divides that takes two parameters in BX and CX. Assume unsigned integers. It should print to the screen "EVENLY" if CX divides BX evenly. Otherwise, it should print "NOT EVENLY." DO NOT USE THE DIV OR IDIV COMMANDS. Use repeated subtraction to determine whether BX is divided evenly (no remainder.) Before printing clear entire screen with red background...

  • This is a question from Assembly Language for x86 7th Edition by Kip Irvine, but the...

    This is a question from Assembly Language for x86 7th Edition by Kip Irvine, but the solution is not there. Programming exercise 12.7 #2. The code must be in assembly language for Intel using Kip Irvine library. An example of the source code would be: INCLUDE Irvine32.inc .code main PROC mov ax,4000h mov bx,1000h mov cx,1500h sub ax,bx sub ax,cx call DumpRegs exit main ENDP END main Question: Write a procedure that receives a single-precision floating-point binary value and displays...

  • All solutions must have both code and data segments Write a sequence of assembly language instructions...

    All solutions must have both code and data segments Write a sequence of assembly language instructions to subtract each entry of an array B of five two’s complement 16-bit binary integers from the corresponding entry of an array A of five two’s complement 16-bit binary integers and construct a third array C of two’s complement 16-bit binary integers. i.e. C[i] = A[i] - B[i]. Use the following data for the arrays A and B.             A: 10, -15, 20, 4,...

  • Implement the following statements using MS430 assembly instructions. You may use more than one, ...

    Implement the following statements using MS430 assembly instructions. You may use more than one, but you should minimize the number of instructions required. You can use both native and emulated instructions. Use hex notation for all numbers 1. (a) Move the word located in register R14 to R15 (b) Increment the word in R6 by 2. (c) Perform a bitwise ANDing of the word located at address 0x0240 with the datum in R15, placing the results in R15. (d) Rotate...

  • Create a complete Assembly Language program implementation for the following application with a) 32-bit and b)...

    Create a complete Assembly Language program implementation for the following application with a) 32-bit and b) 64-bit version (If Possible) App1: Geometric Shape Calculator Companion. The program details (design, implementation, code, runs) should show evidence of technical proficiency with the following technological aspects: 1. a) Implementation using 32-bit programming. b) Re-implement using 64-bit programming. 2. Test plan; test cases implementing the test plan and screen shots displaying the executing the test cases. Note: a test plan should include various Normal,...

  • Section B - ARM Assembly Language (25 marks) An ARM instruction set summary is provided at...

    Section B - ARM Assembly Language (25 marks) An ARM instruction set summary is provided at the end of this paper 1. (5 marks) Consider the following assembly instruction STMFD r13!, (r5-6} Before executing this instruction, registers hold the following values: Register Value Register r9 Value r4 0x00400040 0x00000000 r5 r10 0x11223344 0x00800080 r6 0x55667788 r11 0x10001000 r7 0x99aabbcc r12 0x20002000 r8 exddeeff00 r13 ex40004000 What memory locations are affected after executing the above instruction? In a table, with a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT