Ask your own question, for FREE!
Computer Science 15 Online
OpenStudy (anonymous):

a. What will be the result of the following code if executed? Comment the assembler instructions. Show the memory result after execution. MOV BX, 200 MOV AX, [BX] PUSH AX MOV AX, [BX+1] PUSH AX MOV AX, [BX+2] PUSH AX POP AX MOV [BX], AX POP AX MOV [BX+1], AX POP AX

OpenStudy (anonymous):

OpenStudy (anonymous):

I have no idea Im Sorry :(

OpenStudy (anonymous):

The best way to solve this is by writing down a table to keep track of the memory contents(like in the assignment) and a table to keep track of what's on the stack. Then start moving through the ASM instructions and update your tables accordingly. There are two blocks, which are repeated. Try to identify what those blocks do. If you're really stuck, just ask here and I can help you.

OpenStudy (anonymous):

I have no idea what to do in the second part of the question b). Please write it in the paper and send me the picture if you can. Thanks.

OpenStudy (anonymous):

What you'll need to do for b) is reading to values from memory, checking which one is greater and storing the largest of the two back into another memory location. There are some steps you'll have to take: 1) Read the value of memory address 200 2) Read the value of memory address 202 3a) Compare the two values 3b) Determine which one is the largest 4) Write the results of 3 back into memory at address 204

OpenStudy (anonymous):

Is this correct?! I don't know which value to take on adress 200, 12 or 3412, which value is correct?!

OpenStudy (anonymous):

Well done! Your code looks fine to me. is you move something into the ax register, two bytes are moved, so you would compare 3412 with 7856. If you only want to compare 34 with 78, you will need to move the memory locations into the al/bl register (the lower half of the a/b registers).

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!