| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1144 人关注过本帖
标题:出现问题,求助!
取消只看楼主 加入收藏
冰_山
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2007-6-28
收藏
 问题点数:0 回复次数:6 
出现问题,求助!
功能:实现数组A输入15个不等数,B输入20个不等的数,求出A,B相同的数并输出
调试时当输完数组AB后就 <<编译框>>消失了.
data segment
a db 30 dup(?),'$'
b db 40 dup(?),'$'
c db 30 dup(?),'$'
p db 'please input 15(00-99) in A:$'
q db 'please input 20(00-99) in B:$'
r db 'the same in the A and B is:$'
data ends
code segment
assume ds:data,cs:code
CRLF macro
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
endm
start: mov ax,data
mov ds,ax
lea dx,p
mov ah,9
int 21h
CRLF
mov si,0
lea bx,a
mov cx,30
a1: mov ah,1
int 21h
mov [bx][si],al
inc si
mov ax,si
mov dl,2
div dl
cmp ah,0
jnz a2
mov dl,' '
mov ah,2
int 21h
a2: loop a1
CRLF
lea dx,q
mov ah,9
int 21h
CRLF
mov si,0
lea bx,b
mov cx,40
a3: mov ah,1
int 21h
mov [bx][si],al
inc si
mov ax,si
mov dl,2
div dl
cmp ah,0
jnz a4
mov dl,' '
mov ah,2
int 21h
a4: loop a3

CRLF
mov si,0
mov dh,0
lea bx,a

a6: mov dl,0
mov ah,[bx][si]
inc si
mov al,[bx][si]
lea di,b

a7: SCASW
jz a5
inc dl
cmp dl,20
inc si
jz a6
jmp a7
a5: add dh,2
mov c,ah
inc c
mov c,al
inc c
inc si
cmp si,30
jz a8
jmp a6

a8: mov cl,dh
mov ch,0
lea bx,c
mov si,0
a9: mov dl,[bx][si]
inc si
mov ax,si
mov dl,2
div dl
cmp ah,0
jnz a10
mov dl,' '
mov ah,2
int 21h
a10: loop a9
mov ah,4ch
int 21h
code ends
end start
搜索更多相关主题的帖子: 消失 please 
2007-06-28 23:46
冰_山
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2007-6-28
收藏
得分:0 
回复:又找出点小毛病,但还是不行!急
data segment
a db 30 dup(?),'$'
b db 40 dup(?),'$'
c db 30 dup(?),'$'
p db 'please input 15(00-99) in A:$'
q db 'please input 20(00-99) in B:$'
r db 'the same in the A and B is:$'
data ends
code segment
assume ds:data,cs:code
CRLF macro
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
endm
start: mov ax,data
mov ds,ax
lea dx,p
mov ah,9
int 21h
CRLF
mov si,0
lea bx,a
mov cx,30
a1: mov ah,1
int 21h
mov [bx][si],al
inc si
mov ax,si
mov dl,2
div dl
cmp ah,0
jnz a2
mov dl,' '
mov ah,2
int 21h
a2: loop a1
CRLF
lea dx,q
mov ah,9
int 21h
CRLF
mov si,0
lea bx,b
mov cx,40
a3: mov ah,1
int 21h
mov [bx][si],al
inc si
mov ax,si
mov dl,2
div dl
cmp ah,0
jnz a4
mov dl,' '
mov ah,2
int 21h
a4: loop a3

CRLF
mov si,0
mov dh,0
lea bx,a

a6: mov dl,0
cmp si,30
jz a8
mov ah,[bx][si]
inc si
mov al,[bx][si]
lea di,b
CLD
a7: SCASW
jz a5
inc dl
inc si
cmp dl,20
jz a6
jmp a7
a5: add dh,2
mov c,ah
inc c
mov c,al
inc c
inc si
jmp a6

a8: mov cl,dh
mov ch,0
sub c,dh
lea bx,c
mov si,0
a9: mov dl,[bx][si]
mov ah,2
int 21h
inc si
mov ax,si
mov dl,2
div dl
cmp ah,0
jnz a10
mov dl,' '
mov ah,2
int 21h
a10: loop a9
mov ah,4ch
int 21h
code ends
end start

2007-06-29 08:59
冰_山
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2007-6-28
收藏
得分:0 
版主!麻烦帮忙解决一下

2007-06-29 09:05
冰_山
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2007-6-28
收藏
得分:0 
我的没提示!编译就没错

2007-06-29 11:48
冰_山
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2007-6-28
收藏
得分:0 
data segment ;目的是将A的15个不等的整数,B的20个整数,比较AB相同

的数输出
a db 30 dup(?),'$'
b db 40 dup(?),'$'
c db 30 dup(?),'$'
p db 'please input 15(00-99)different in A:$'
q db 'please input 20(00-99)different in B:$'
r db 'the same in the A and B is:$'
data ends
code segment
assume ds:data,cs:code
CRLF macro ;宏 目的回车
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
endm
start: mov ax,data
mov ds,ax
lea dx,p
mov ah,9
int 21h
CRLF
mov si,0
lea bx,a
mov cx,30
a1: mov ah,1 ;输入15个数到A中
int 21h
mov [bx][si],al
inc si
mov ax,si
mov dl,2
div dl
cmp ah,0
jnz a2
mov dl,' ' ;每两个数中间输出一空格
mov ah,2
int 21h
a2: loop a1
CRLF
lea dx,q
mov ah,9
int 21h
CRLF
mov si,0
lea bx,b
mov cx,40
a3: mov ah,1 ;输入20个数到B中
int 21h
mov [bx][si],al
inc si
mov ax,si
mov dl,2
div dl
cmp ah,0
jnz a4
mov dl,' '
mov ah,2
int 21h
a4: loop a3

CRLF
mov si,0
mov dh,0
lea bx,a

a6: mov dl,0
cmp si,30
jz a8
mov ah,[bx][si] ;去A的第一个数放入AX中
inc si
mov al,[bx][si]
lea di,b ;放B的首地址放入B中
CLD
a7: SCASW ;比较A中第一个数与B中的所有数比较
jz a5
inc dl
inc si
cmp dl,20
jz a6
jmp a7
a5: add dh,2 ;比较结果放入C中
mov c,ah
inc c
mov c,al
inc c
inc si
jmp a6

a8: cmp dh,0
jz a11
mov cl,dh
mov ch,0
sub c,dh
lea bx,c
mov si,0
a9: mov dl,[bx][si] ;输出C
mov ah,2
int 21h
inc si
mov ax,si
mov dl,2
div dl
cmp ah,0
jnz a10
mov dl,' '
mov ah,2
int 21h
a10: loop a9
a11: mov ah,4ch
int 21h
code ends
end start

2007-06-29 19:03
冰_山
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2007-6-28
收藏
得分:0 
一:sub c,dh 是当c的值加了好多次以后就变了,所以要剪掉那边了的几个。
二:cmp dl,20
jz a6
jmp a7
是想知道比较完20次没有 完了的话就a++, 没完的话就继续往后找。
三: 哦对 我那个输出提示没写不过也不影响大局
( a9: mov dl,[bx][si]上面应该有:

lea dx,r ;输出提示 the same in the A and B is:
mov ah,9
int 21h )
四:你那个重复前缀是什么意思 (SCASW前面的重复前缀怎么没有?)
不是di自动加吗 di<-di-2
五:那个是寄存器不够用了 我也不知道能不能
mov c,ah
inc c
mov c,al
inc c
补充:就是那个编译执行的现象是CPU占用99% 可能是进入了死循环!

2007-06-30 00:51
冰_山
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2007-6-28
收藏
得分:0 
好了!这下看看
data segment
a db 30 dup(?),'$'
b db 40 dup(?),'$'
c db 30 dup(?),'$'
p db 'please input 15(00-99)different in A:$'
q db 'please input 20(00-99)different in B:$'

data ends
code segment
assume ds:data,cs:code,es:data
CRLF macro
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
endm
start: mov ax,data
mov ds,ax
mov es,ax
lea dx,p
mov ah,9
int 21h
CRLF
mov si,0
lea bx,a
mov cx,30
a1: mov ah,1
int 21h
mov [bx][si],al
inc si
mov ax,si
mov dl,2
div dl
cmp ah,0
jnz a2
mov dl,' '
mov ah,2
int 21h
a2: loop a1
CRLF
lea dx,q
mov ah,9
int 21h
CRLF
mov si,0
lea bx,b
mov cx,40
a3: mov ah,1
int 21h
mov [bx][si],al
inc si
mov ax,si
mov dl,2
div dl
cmp ah,0
jnz a4
mov dl,' '
mov ah,2
int 21h
a4: loop a3

CRLF
mov si,0
mov dh,0
lea bx,a
mov bp,0
a6: mov dl,0
cmp si,30
jz a8
mov ah,[bx][si]
inc si
mov al,[bx][si]
lea di,b
CLD
a7: SCASW
jz a5
inc dl
inc si
cmp dl,20
jz a6
jmp a7
a5: add dh,2

mov ds:c[bp],ah

inc bp

mov ds:c[bp],al

inc bp
inc si
jmp a6

a8: cmp dh,0
jz a11
mov cl,dh
mov ch,0

lea bx,c
mov si,0
a9: mov dl,[bx][si]
mov ah,2
int 21h
inc si
mov ax,si
mov dl,2
div dl
cmp ah,0
jnz a10
mov dl,' '
mov ah,2
int 21h
a10: loop a9
a11: mov ah,4ch
int 21h
code ends
end start

2007-06-30 17:27
快速回复:出现问题,求助!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.035103 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved