Click to See Complete Forum and Search --> : questions problems


aamir55
October 25th, 2008, 12:34 AM
can any body tell me whether i have solved these questions correctly,if not then what are mistakes??

11. Give the value of the zero flag, the carry flag, the sign flag, and the overflow flag after each of the following instructions if AX is initialized with 0x1254 and BX is initialized with 0x0FFF.
a. add ax, 0xEDAB
b. add ax, bx
c. add bx, 0xF001

a. FFFF
sign flag=0, carry flag=0 , zero flag=0 , overflow flag=0
b.2253
sign flag=0, carry flag=0 , zero flag=0 , overflow flag=0
c.10000
sign flag=1, carry flag=1 , zero flag=0 , overflow flag=0



13. For each of the following words identify the byte that is stored at lower memory address and the byte that is stored at higher memory address in a little endian computer.
a. 1234
b. ABFC
c. B100
d. B800

a.1234
1 and 2 are stored at lower memory address and 34 are stored at higher memory address
b.
ABFC
A and B are stored at lower memory address and FC are stored at higher memory address
c.
B100
B and 1 are stored at lower memory address and 00 are stored at higher memory address
d.
B800
B and8 are stored at lower memory address and 00 are stored at higher memory address

ishaypeled
November 1st, 2008, 09:31 PM
Use NASM/MASM and insight/whatever windows debugger you prefer to check your answers, the little endian part is correct, about the first part, you'll have to use the debugger.
Hope this helps,
Ishay Peled.

S_M_A
November 2nd, 2008, 05:16 PM
No, the little endian part is not correct. A little endian machine always does every operation starting from the lower part. I.e. when a 16 bit value like 0x1234 is written (or read) to memory first 0x34 is written then at next address 0x12 is written so the memory layout would be:
0x...0 0x...1
0x34 0x12

Some flags are also wrong but as ishaypeled suggested, do a debugger run for those.