HW3_S10RevA Solutions - CmpE 102 HW#3 (Spring 2010)...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CmpE 102 – HW#3 (Spring 2010) – SOLUTIONS Rev. A Chapter 4 Problems 1. The four instructions shown at the bottom of p.83 use registers and the movsx instruction to load data into eax, edx and cx registers. Perform the same results using memory operands with the movsx instruction. .data byte1 BYTE 9Bh word1 WORD 0A69Bh .code movsx eax, word1 movsx edx, byte1 movsx cx, byte1 2. A data segment is listed below. Write a code segment to exchange var1 and var2 data, followed by exchanging var3 and var4 data. .data var1 WORD 00FFh var2 WORD 1234h var3 WORD 55AAh var4 WORD 0FEDCh .code mov ax, var1 xchg ax, var2 mov var1, ax mov ax, var3 xchg ax, var4 mov var3, ax 3. Write short program to meet the following requirements: a. Use the loop instruction b. Add the contents of a 6-byte data array (byteArray) in real-address mode c. Put the result in the word variable aSum .data byteArray BYTE 12h, 7Eh, 3Ah, 06h, 0C5h, 00h aSum WORD 0 .code main PROC mov ecx, LENGTHOF byteArray
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/08/2010 for the course CMPE 46 at San Jose State University .

Page1 / 4

HW3_S10RevA Solutions - CmpE 102 HW#3 (Spring 2010)...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online