汇编语言 - 异常抛出错误

时间:2017-09-23 11:47:58

标签: visual-studio assembly runtime-error masm

我刚开始用汇编语言开课,我们在课堂上有了第一个项目,我似乎无法理解这段代码有什么问题。我已经尝试了书中的所有内容但无济于事

include C:\Irvine\Irvine32.inc

.data
;Variables are listed in following order VAR DATATYPE DIGITS[RADIX] with 
comments showing binary version of listed digits
left DWORD 321                                      ;101000001b
right DWORD 4247                                    ;1000010010111b 
total DWORD ?                                   ;uninitialized
diff DWORD ?                                    ;uninitialized

;Calculate length of Array and move to var ArrayLength
Array WORD 1,2,4,8,16,32,64                         ;Array 
ArrayLength = ($ - Array) / 2

.code
main PROC

;Move left and right to respective registers
MOV eax,left
MOV ebx,right

;Add left var and right var and store in new var called total and move to 
ecx

MOV total,eax
ADD total,ebx
MOV ecx,total

;Subtract left var and right var and store in new var called diff and move 
to edx  

MOV diff,eax
SUB diff,ebx
MOV edx,diff

;Define a string called message containing HELLO WORLD!
message BYTE '"Hello world!"'

;Move Array to esi
MOV esi,ArrayLength

CALL DumpRegs

exit

main ENDP
END main

当我尝试运行它时,我得到了

  

ASM_Proj1.exe中0x002A368D抛出异常:0xC0000005:访问冲突读取位置0x000001A6。

第36行是MOV edx,diff

任何想法可能会发生什么? 我正在使用Visual Studio 2017的记录

0 个答案:

没有答案