在 14423 Lab 05 COAL.exe 中0x001036CA抛出异常:0xC0000005:访问冲突读取位置0x000FFFFE

Exception thrown at 0x001036CA in 14423 Lab 05 COAL.exe: 0xC0000005: Access violation reading location 0x000FFFFE

提问人:Shareef Mughal 提问时间:11/17/2023 最后编辑:Michael PetchShareef Mughal 更新时间:11/17/2023 访问量:35

问:

INCLUDE Irvine32.inc
.data
    Message BYTE "Enter Number ",0
    Arr DWORD 5 DUP(0)
    Divi DWORD 4
    GreaterNum DWORD 0
    Outerloopholder DWORD 0
.code
main PROC
    mov ecx, 1
    mov eax, 0
    .while(ecx<6)
        mov edx, offset message
        call WriteString
        inc eax
        call WriteInt
        dec eax
        call crlf
        mov ebx, eax
        call ReadInt
        imul ebx, 4
        mov Arr[ebx], eax
        mov eax, ebx
        sub edx, edx
        div Divi
        inc ecx
        inc eax
    .endw
    
    mov ecx, 4
    Greater:
        imul ecx, 4
        mov ebx, Arr[ecx]
        mov eax, ecx
        sub edx, edx
        div Divi
        mov Outerloopholder, eax
        mov ecx, Outerloopholder
        dec ecx
        GreaterAgain:
            imul ecx, 4
            mov eax, Arr[ecx]
            CMP ebx, eax
            jl Changer
            mov eax, ecx
            sub edx, edx
            div Divi
            mov ecx, eax
            loop GreaterAgain
            
        Changer:
            mov eax, Arr[ecx]
            mov edx, eax
            mov GreaterNum, edx
            mov eax, ecx
            sub edx, edx
            div Divi
            mov ecx, eax
            loop GreaterAgain

        mov ecx, Outerloopholder
        loop Greater

        mov eax, GreaterNum
        call WriteInt

        
exit
main ENDP
END main

我被分配到一个任务,在数组中获取用户输入并找到最大值,但由于上述错误,我无法做到这一点,该错误显示读取地址的访问冲突

程序集 x86 MASM irvine32

评论

0赞 Paweł Łukasik 11/17/2023
请格式化代码,使其正确显示
0赞 Michael Petch 11/17/2023
您是否尝试过在调试器中运行它?Visual Studio Community 有一个运行良好的免费调试器。OllyDbg 也被很多人使用。

答: 暂无答案