程序集整数溢出

时间:2017-09-07 18:40:39

标签: assembly x86 overflow masm

执行div命令时,它会给出一个错误:整数溢出。首先我想知道这是整数溢出,那么显然如何纠正呢?提前谢谢。

TITLE My First Program (Test.asm)
INCLUDE Irvine32.inc
.data
cr1grade WORD 5
cr2grade WORD 10
cr3grade WORD 4
cr4grade WORD 8
cr5grade WORD 5
totalcredit WORD 16

.code
main PROC
mov ax,cr1grade
add ax,cr2grade
add ax,cr3grade
add ax,cr4grade
add ax,cr5grade     ;total grade points => 32
mov bx,totalcredit  ;total credit hrs => 16
div bx              ;divide grade points by credit hrs =>2

call DumpRegs
exit
main ENDP
END main

0 个答案:

没有答案