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:

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter12: Event-driven Gui Programming, Multithreading, And Animation
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Topic Video
Question

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:

Sample Run/Output
Microsoft Visual Studio Debug Console
System Parameters on Stack
Address: 00BBFB4CH => Content: 00000001H
Address: 00BBFB50H=> Content: 00000002H
Address: 00BBFB54H => Content: 00000003H
Address: 00BBFB58H => Content: 00000004H
Address: 00BBFB5CH => Content: 00000005H
I
0
X
Transcribed Image Text:Sample Run/Output Microsoft Visual Studio Debug Console System Parameters on Stack Address: 00BBFB4CH => Content: 00000001H Address: 00BBFB50H=> Content: 00000002H Address: 00BBFB54H => Content: 00000003H Address: 00BBFB58H => Content: 00000004H Address: 00BBFB5CH => Content: 00000005H I 0 X
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT