HW3soln-3750

HW3soln-3750 - EE 3750 HW 3 solutions 1 EE 3750 Homework 3...

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

View Full Document Right Arrow Icon
EE 3750 — HW 3 solutions 1 EE 3750 — Homework 3 solutions Spring 2006 1. Write a complete data segment DATA0 that creates: a byte variable GRAY, initializing four bytes there to 10110 (binary), 101 (decimal), 10 (hex), and 3E (hex); a word variable BLUE, initializing 30 words there in a repeating sequence of 3750, 2006, 2007 values (that is, 3750, 2006, 2007, 3750, 2006, 2007, 3750, etc.); a word variable GOLD, allocating 350 words of uninitialized space; and • a byte variable SILVER, initialized to 56. DATA0 SEGMENT GRAY DB 10110B,101, 10H, 3EH BLUE DW 10 DUP (3750, 2006, 2007) GOLD DW 350 DUP (?) SILVER DB -56 DATA0 ENDS 2. Write an 8086 instruction sequence to search a given string for the first occurrence of each of the following letters: ‘S’, ‘P’, ‘I’, and ‘N’. Use string comparison instructions. Let byte array TEXT hold the input string to be searched, and let LENGTH hold the number of elements in TEXT. Let byte array SPIN with four elements hold the ASCII codes for each of the letters ‘S’, ‘P’, ‘I’, and ‘N’. Let word array LOC hold the locations in TEXT of each of the letters (that is, LOC[0] holds the index of the first ‘S’ in array TEXT, LOC[2] holds the index of the first ‘P’ in array TEXT, etc.). If some searched letter does not appear in TEXT, then write 1 in the appropriate entry of LOC. MOV AX, DS MOV ES, AX ; set ES for SCASB MOV SI, 0 ; pointer into SPIN MOV BX, 0 ; pointer into LOC CLD TOP: MOV DI, OFFSET TEXT ; reset DI for each letter search with SCASB MOV CX, LENGTH
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 01/25/2012 for the course EE 3750 taught by Professor Desouza during the Fall '08 term at LSU.

Page1 / 3

HW3soln-3750 - EE 3750 HW 3 solutions 1 EE 3750 Homework 3...

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