ICS312 - Spring 2009 - Homework #2 -

Work alone
You are expected to do your own work on all homework assignments. You may (and are encouraged to) engage in general discussions with your classmates regarding the assignments, but specific details of a solution, including the solution itself, must always be your own work. (See the statement of Academic Dishonesty on the course's syllabus.)

What to turn in?
You can turn your answers on paper on the day the assignment is due (during class or in my office). Alternately you can turn in an electronic copy via e-mail to henric@hawaii.edu with a subject line like "ICS312: HW#2" before midnight on the day the assignment is due.

Can I write programs?
It is ok to write assembly programs to check that your answers are correct and to understand where your mistakes were. But note that we will have such questions during in-class exams, so make sure you can actually do these by hand!
Exercise #1: Memory Layout

Consider the following .data segment:

A dw 011FAh
B times 4 dw 21
C db 043h, 0BBh
D db "a", 54, "b", 0
E dd 210
F dd 0
Question #1 [24pts] What are the contents of the 24 memory bytes starting at address A, in hex, on a machine that uses Little Endian?

Question #2 [5pts]: What if the machine uses Big Endian?

Exercise #2: Memory and Registers [26pts]

Consider the following .data segment:

L1 dw 435
L2 db "h","e","l","l","o",0
L3 db 0A1h, 0B2h, 0C3h
L4 dw 23o
Consider the following program fragment:
mov eax, [L3]
inc eax
mov [L2], eax
mov bx, [L1]
mov eax, L3
inc eax
mov [eax], bx
After the code finishes executing, what are the contents of the 13 memory bytes starting at address L1, on a machine using Little Endian? Show your work.


henric@hawaii.edu