关于实验7
各位鱼油,鱼神(鱼油大神的意思)你们好,有个问题弄了很久都没弄明白,求助于大家,麻烦帮帮忙,谢谢。王爽汇编实验7:
assume cs:codesg,ds:data,es:table,ss:stack
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'
;以上是表示21年的21个字符串
dd 16,22,382,1356,2390,8000,16000,24486,50065,97479,140417,197514
dd 345980,590827,803530,1183000,184300,2759000,3753000,4649000,5937000
;以上是表示21年公司总收入的21个DWORD型数据
dw 3,7,9,13,28,38,130,220,476,778,1001,1442,2258,2793,4037,5635,8226
dw 11542,14430,15257,17800
;以上表示21年公司雇员人数的21个WORD型数据
data ends
table segment
db 21 dup('year summ ne ?? ')
table ends
stack segment
dw 8 dup(0)
stack ends
codesg segment
start:mov ax,data
mov ds,ax ;把data和DS关联起来
mov ax,table
mov es,ax ;把table和ES关联起来
mov ax,stack
mov ss,ax ;设置栈
mov sp,16 ;栈顶指针
mov di,0
mov bx,0
mov bp,0
mov cx,21
s1:push cx
mov si,0
mov cx,4
s:mov al,byte ptr ds:
mov byte ptr es:,al ;替换目标存入年份
mov al,byte ptr ds:
mov byte ptr es:,al ;存入年收入
inc si ;si自增1
loop s
mov ax,es:
mov dx,es:
mov cx,ds:
mov es:,cx
div word ptr es:
mov es:,ax
pop cx
add bx,16
add di,4 ;di自增4
mov bp,di
loop s1
mov ax,4c00h
int 21h
codesg ends
end start
编译后,debug到了div word ptr es:这行的时候,出现了:divide overflow;不知道为什么?请大家帮忙,谢谢。
assume cs:codesg,ds:data,es:table,ss:stack
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'
;以上是表示21年的21个字符串
dd 16,22,382,1356,2390,8000,16000,24486,50065,97479,140417,197514
dd 345980,590827,803530,1183000,184300,2759000,3753000,4649000,5937000
;以上是表示21年公司总收入的21个DWORD型数据
dw 3,7,9,13,28,38,130,220,476,778,1001,1442,2258,2793,4037,5635,8226
dw 11542,14430,15257,17800
;以上表示21年公司雇员人数的21个WORD型数据
data ends
table segment
db 21 dup('year summ ne ?? ')
table ends
stack segment
dw 8 dup(0)
stack ends
codesg segment
start:mov ax,data
mov ds,ax ;把data和DS关联起来
mov ax,table
mov es,ax ;把table和ES关联起来
mov ax,stack
mov ss,ax ;设置栈
mov sp,16 ;栈顶指针
mov di,0
mov bx,0
mov bp,0
mov cx,21
s1:push cx
mov si,0
mov cx,4
s:mov al,byte ptr ds:
mov byte ptr es:,al ;替换目标存入年份
mov al,byte ptr ds:
mov byte ptr es:,al ;存入年收入
inc si ;si自增1
loop s
mov ax,es:
mov dx,es:
mov cx,ds:
mov es:,cx
div word ptr es:
mov es:,ax
pop cx
add bx,16
add di,2 ;di自增2
add bp,4
loop s1
mov ax,4c00h
int 21h
codesg ends
end start assume cs:code,ds:data,es:table
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 11452,14430,15257,17800
data ends
table segment
db 21 dup ('year summ ne ?? ')
table ends
code segment
start:mov ax,data
mov ds,ax
mov ax,table
mov es,ax
mov bx,0
mov si,0
mov di,0
mov cx,21
s: mov ax,
mov es:,ax
mov ax,.2
mov es:.2,ax
mov ax,.84
mov es:.5,ax
mov dx,.86
mov es:.7,dx
div word ptr ds:.168
mov es:.13,ax
mov ax,.168
mov es:.10,ax
add di,2
add bx,4
add si,16
loop s
mov ax,4c00h
int 21h
code ends
end start
这是源代码,你对比一下,看哪儿出错了! 青玄 发表于 2014-3-27 10:52 static/image/common/back.gif
assume cs:code,ds:data,es:table
data segment
谢谢青玄鱼油,问题已解决。非常感谢您的帮助。 呵呵!没事儿,小事一桩,以后还要多多交流呢! 请帮我看下 我的程序是哪里的问题?
谢谢各位了 kyod 发表于 2014-3-2 13:53
assume cs:codesg,ds:data,es:table,ss:stack
data segment
db '1975','1976','1977','1978','1979','1 ...
能帮我看看我的问题在哪吗 ?
谢谢
页:
[1]