鱼C论坛

 找回密码
 立即注册
查看: 1771|回复: 2

关于实验7 我写的汇编代码 出现Divide overflow

[复制链接]
发表于 2013-1-24 22:22:28 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
本帖最后由 pro-serv 于 2013-1-25 00:22 编辑
assume cs:codesg
data segment
db '1975','1976','1977','1978','1979','1980','1981','1982','1983'
db '1984','1985','1986','1987','1988','1989','1990','1991','1992'
db '1993','1994','1995'
dd 16,22,382,1356,2390,8000,24486,50065,97479,140417,197514
dd 345980,590827,803530,1183000,1843000,2759000,3753000,4649000,5937000
dw 3,7,9,13,28,38,130,220,476,778,1001,1442,2258,2793,4037,5635,8226
dw 11542,14430,15257,17800
data ends
table segment
db 21 dup ('year summ ne ?? ')
table ends
stack segment
dw 0,0,0,0,0,0,0,0
stack ends
codesg segment
start:
mov ax,stack
mov ss,ax
mov sp,16
mov ax,table
mov ds,ax
mov bx,0
mov ax,data
mov es,ax
mov bp,0
mov si,168
mov cx,21
s: push cx
mov di,0
mov cx,4
s1: mov al,es:[bp+di]
mov [bx+di],al
inc di
loop s1

mov byte ptr [bx+4],' '
mov ax,es:[bp+84]
mov dx,es:[bp+86]
mov [bx+5],ax
mov [bx+7],dx

mov byte ptr [bx+9],' '
mov ax,es:[bp+si]
mov [bx+10],ax

mov byte ptr [bx+12],' '
mov ax,[bx+5]
mov dx,[bx+7]
div word ptr [bx+10]
mov [bx+13],ax
mov byte ptr [bx+15],' '

add bx,16
add bp,4
add si,2
pop cx
loop s
mov ax,4c00h
int 21h
codesg ends
end start
一次次手动T单步执行循环过后也没事, 但用G命令跳出 MOV AX,4C00H时,就出现Divide overflow .
特来求助,不知道错在哪里了?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
 楼主| 发表于 2013-1-25 00:27:10 | 显示全部楼层
assume cs:codesg
data segment
db '1975','1976','1977','1978','1979','1980','1981','1982','1983'
db '1984','1985','1986','1987','1988','1989','1990','1991','1992'
db '1993','1994','1995'
dd 16,22,382,1356,2390,8000,16000,24486,50065,97479,140417,197514
dd 345980,590827,803530,1183000,1843000,2759000,3753000,4649000,5937000
dw 3,7,9,13,28,38,130,220,476,778,1001,1442,2258,2793,4037,5635,8226
dw 11542,14430,15257,17800
data ends
table segment
db 21 dup ('year summ ne ?? ')
table ends
stack segment
dw 0,0,0,0,0,0,0,0
stack ends
codesg segment
start:
mov ax,stack
mov ss,ax
mov sp,16
mov ax,table
mov ds,ax
mov bx,0
mov ax,data
mov es,ax
mov bp,0
mov si,168
mov cx,21
s: push cx
mov di,0
mov cx,4
s1: mov al,es:[bp+di]
mov [bx+di],al
inc di
loop s1

mov byte ptr [bx+4],' '
mov ax,es:[bp+84]
mov dx,es:[bp+86]
mov [bx+5],ax
mov [bx+7],dx

mov byte ptr [bx+9],' '
mov ax,es:[si]
mov [bx+10],ax

mov byte ptr [bx+12],' '
mov ax,[bx+5]
mov dx,[bx+7]
div word ptr [bx+10]
mov [bx+13],ax
mov byte ptr [bx+15],' '

add bx,16
add bp,4
add si,2
pop cx
loop s
mov ax,4c00h
int 21h
codesg ends
end start
DB 总收入时入个了 ‘16000 ’
经过多次DEBUG之后,发现第45行错了,mov ax,es:[bp+si]应该改为 mov ax,es:[si]
我已经定义了SI初始值为168,再加BP就错了


想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
发表于 2013-1-25 10:35:05 | 显示全部楼层

是什么溢出了。具体的我也不知道。我也碰到过这情况。等高手
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-11-18 02:50

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表