Computer Science I get an error in my code: Exception thrown at 0x00000001 in Project4.exe: 0xC0000005: Access violation executing location 0x00000001. I'm confident that the Irvine32 libraries are properly implemented and I'm using MASM x86 Assembly language in C++ Please fix the code! INCLUDE Irvine32.inc .data msg_system_params db "System Parameters on Stack", 0 msg_separator db "___________________________________________", 0 msg_format db "Address: %08Xh => Content: %08Xh", 0 newline db 0Ah, 0 .code main PROC ; Set up stack frame push ebp mov ebp, esp ; Push variables onto the stack push 1 push 2 push 3 push 4 push 5 ; Call runLevelOne procedure call runLevelOne ; Clean up the stack mov esp, ebp ; Restore stack frame and return pop ebp mov eax, 0 ret main ENDP runLevelOne PROC ; Set up stack frame push ebp mov ebp, esp ; Display text "System Parameters on Stack" lea eax, msg_system_params call displayText ; Display separator line lea eax, msg_separator call displayText ; Display stack addresses and contents mov ecx, 5 ; Number of variables lea esi, [ebp + 8] ; Start address of the variables displayLoop: ; Get current address and content mov eax, esi mov ebx, [esi] ; Display address and content push ebx push eax lea eax, msg_format call displayText ; Increment address for the next variable add esi, 4 loop displayLoop ; Display separator line lea eax, msg_separator call displayText ; Restore stack frame and return pop ebp ret runLevelOne ENDP displayText PROC ; Save registers push ebx ; Print string mov edx, eax call WriteString ; Check if new line required cmp byte ptr [esp + 4], 1 jne displayTextExit ; Print new line call Crlf displayTextExit: ; Restore registers and return pop ebx ret displayText ENDP END main The output should be like this:
Computer Science
I get an error in my code:
Exception thrown at 0x00000001 in Project4.exe: 0xC0000005: Access violation executing location 0x00000001.
I'm confident that the Irvine32 libraries are properly implemented and I'm using MASM x86 Assembly language in C++
Please fix the code!
INCLUDE Irvine32.inc .data msg_system_params db "System Parameters on Stack", 0 msg_separator db "___________________________________________", 0 msg_format db "Address: %08Xh => Content: %08Xh", 0 newline db 0Ah, 0 .code main PROC ; Set up stack frame push ebp mov ebp, esp ; Push variables onto the stack push 1 push 2 push 3 push 4 push 5 ; Call runLevelOne procedure call runLevelOne ; Clean up the stack mov esp, ebp ; Restore stack frame and return pop ebp mov eax, 0 ret main ENDP runLevelOne PROC ; Set up stack frame push ebp mov ebp, esp ; Display text "System Parameters on Stack" lea eax, msg_system_params call displayText ; Display separator line lea eax, msg_separator call displayText ; Display stack addresses and contents mov ecx, 5 ; Number of variables lea esi, [ebp + 8] ; Start address of the variables displayLoop: ; Get current address and content mov eax, esi mov ebx, [esi] ; Display address and content push ebx push eax lea eax, msg_format call displayText ; Increment address for the next variable add esi, 4 loop displayLoop ; Display separator line lea eax, msg_separator call displayText ; Restore stack frame and return pop ebp ret runLevelOne ENDP displayText PROC ; Save registers push ebx ; Print string mov edx, eax call WriteString ; Check if new line required cmp byte ptr [esp + 4], 1 jne displayTextExit ; Print new line call Crlf displayTextExit: ; Restore registers and return pop ebx ret displayText ENDP END main
The output should be like this:
Step by step
Solved in 3 steps with 1 images