| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 602 人关注过本帖
标题:这个程序错在哪里啊!!
取消只看楼主 加入收藏
vash19
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-4-25
收藏
 问题点数:0 回复次数:1 
这个程序错在哪里啊!!
删除字符串里字符的程序:

da segment
str1 db 'abcdefghijk','$'
str2 db 0ah,0dh,'input the place that you want to delete words:','$'
str3 db 0ah,0dh,'input the amount :','$'
num1 dw ?
num2 dw ?
da ends
cd segment
assume ds:da,cs:cd
start: mov ax,da
mov ds,ax
mov es,ax
lea dx,str1 ;输出字符串
mov ah,09h
int 21h
lea dx,str2 ;输出第一句话
mov ah,09h
int 21h
mov ah,01h ;输入地址
int 21h
and ax,0fh
dec ax
mov [num1],ax

lea dx,str3 ;输出第三句话
mov ah,09h
int 21h
mov ah,01h ;输入个数
int 21h
and ax,0fh
mov [num2],ax
mov dl,byte ptr [num2]
mov ah,02h
int 21h
lea si,str1
mov di,si
add si,[num1]
mov di,si
add si,[num2]
clc
mov cx,[num2]
cld
rep movsb
mov dl,0ah
mov ah,2
int 21h
mov dl,0dh
mov ah,2
int 21h
lea dx,str1
mov ah,09h
int 21h
mov ah,4ch
int 21h
cd ends
end start


为什么输出的字符串不正确啊???
搜索更多相关主题的帖子: start 字符串 amount 
2007-06-25 14:02
vash19
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-4-25
收藏
得分:0 
回复:(vash19)这个程序错在哪里啊!!

有问题的啊!
当输入在1处删除5个字符之类的就没问题,
但是如果输入的是在3的位置删除3个字符就有问题了,
字符串就不移动了。
真奇怪啊!!

2007-06-25 23:30
快速回复:这个程序错在哪里啊!!
数据加载中...
 
   



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

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