HW3soln-3750-F09

# HW3soln-3750-F09 - EE 3750 HW 3 solutions 1 EE 3750...

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

EE 3750 — HW 3 solutions 1 EE 3750 — Homework 3 solutions Fall 2009 1. Given byte variable peach , force bits 0, 2, and 3 to 0, complement bits 6 and 7, then do the following. If bit 5 = 0, then shift peach to the right by the distance specified in byte variable move ; if bit 5 = 1, then rotate peach to the right by the distance specified in byte variable move . AND PEACH, 11110010B ; forces bits 3, 2, 0 to 0 XOR PEACH, 11000000B ; complements bits 7, 6 MOV CL, MOVE ; put shift/rotate distance into CL TEST PEACH, 100000B ; check bit 5 of peach JZ SHIFT ROR PEACH, CL ; bit 5 = 1, so rotate JMP DONE SHIFT: SHR PEACH, CL ; bit 5 = 0, so shift DONE: 2. Write a complete data segment DATA3 that creates: a byte variable silver , allocating 150 bytes of uninitialized space; a byte variable bronze , initializing two bytes to 37 (decimal) and 5A (hexadecimal); and a word variable gold , initializing 75 words in a repeating sequence of 9, 2009, 127. DATA3 SEGMENT SILVER DB 150 DUP (?) BRONZE DB 37, 5AH GOLD DW 25 DUP (9, 2009, 127) DATA3 ENDS 3. Write an 8086 instruction sequence to search a given string (byte array) text for the first occurrence of letter ‘L’ then the first occurrence after that of letter ‘S’ then the first occurrence after that of letter ‘U’. Use string comparison instructions. Let length hold the number of bytes in text . Assume that text is in the data segment to which DS points. Let word

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern