Question: Please help!!! The other 2 same questions on Chegg are wrong hopefully someone can answer them correctly. Modify the sample program to subtract 1000 from

Please help!!! The other 2 same questions on Chegg are wrong hopefully someone can answer them correctly.

Modify the sample program to subtract 1000 from the number stored at number. Hint: Copy number to EAX, and then use sub eax,1000 to subtract 1000. Store the difference in memory at diff. Assemble, link, and execute the program. Explain the changes that are displayed in registers and memory after execution of each instruction.

Please help!!! The other 2 same questions on Chegg are wrong hopefully

adds 158 to number in memory Program.asm ; Example assembly language program Author: R. Detmer ; Date: 6/2013 ; Page 40 Figure 3.1 | .586 a 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ; symbols that start with a dot (.) are assembly directives ; Assembly directives direct the assembly process. ; .586 instructs MASM (ml.exe) to generate 32-bit machine instructions ; Instructs MASM to ignore segments (data segments, stack segment, code segment) ; No longer have to be concerned with the "SEGMENTED MEMORY MODEL" .MODEL FLAT STACK 4096 ; Directs reserve 4096-byte stack ; Directs MASM to insert instructions that tell the operating system how ; much stack space to reserve when the operating system loads the executable file. ; reserve storage for data ; Assembly time directive. Tells MASM that the following statement defines ; variables .DATA 20 number DWORD sum DWORD 1 ? 21 22 23 .CODE 24 main PROC 25 26 27 28 29 30 31 32 33 mov eax, number ; start of main program code This segment contains ALL THE MACHINE INSTRUCTIONS ; Must have a procedure named main. The operating system loads the ; executable and then the operating system looks for the main ; procedure, and starts program execution at the first machine ; instruction in the main procedure ; The mov instruction reads the value in the second operand, in this ; case number, and writes the value into the first operand, in this case ; the eax register. The add instruction reads the immediate value 158 and adds the value ; to the value stored in the eax register ; sum to memory ; exit with return code 0 add eax, 2 34 mov sum, eax eax, o 35 36 37 38 39 40 41 mov ret ENDP main END ; end of source code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!