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 Fall 2001 1. (a) Write a complete data segment DATA6 that creates: a word variable GREEN, initialized to 4; a byte variable YELLOW, initialized to 36; a byte variable RED, initializing six bytes there as 101011 (binary), 4E (hex), 50 (decimal), 50 (decimal), 50 (hex), and 1100 (binary). (b) Write a complete stack segment STACK6, allowing 15 words for the stack. (c) Write a complete code segment MAIN6 that will subtract YELLOW from each of the first GREEN elements of RED — push each of these differences onto the stack, do not overwrite elements of RED. Use the LOOP instruction. Be sure to include the necessary ASSUME statements and instructions for loading segment registers as needed. (a) DATA6 SEGMENT GREEN DW 4 YELLOW DB 36 RED DB 101011B, 4EH, 50, -50, 50H, 1100B DATA6 ENDS (b) STACK6 SEGMENT DW 15 DUP (?) TOP_OF_STACK LABEL WORD STACK6 ENDS (c) MAIN6 SEGMENT ASSUME CS: MAIN6, DS: DATA6, SS: STACK6 START: MOV AX, DATA6 ; initialize DS, SS, SP MOV DS, AX MOV AX, STACK6 MOV SS, AX MOV SP, OFFSET TOP_OF_STACK MOV CX, GREEN ; initialize loop counter MOV DI, 0 ; pointer into RED TOP: MOV AL, RED[DI] SUB AL, YELLOW ; subtract in register so as not to change elements of RED PUSH AX ; difference is a byte, can only push words INC DI LOOP TOP HLT MAIN6 ENDS END START
Background image of page 1

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

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

{[ snackBarMessage ]}

Page1 / 4

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