. : : Assembly Language : : .  |  首页  |  我提出的问题  |  我参与的问题  |  我的收藏  |  消息中心   |  游客  登录  | 
刷新 | 提问 | 未解决 | 已解决 | 精华区 | 搜索 |
  《汇编语言》论坛 ->第一个程序
  管理员: assembly   [回复本贴] [收藏本贴] [管理本贴] [关闭窗口]
主题 : :  不用串操作指令,把字符串sting1的内容传送到字符串string2,字符长度为count.  [待解决] 回复[ 3次 ]   点击[ 275次 ]  
escaping
[帖 主]   [ 发表时间:2012-05-03 17:35 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:0
注册日期:2012-05-03 09:03
DATAS ENDS

STACKS SEGMENT
    ;此处输入堆栈段代码
STACKS ENDS

CODES SEGMENT
    ;ASSUME CS:CODES,DS:DATAS,SS:STACKS,es:datas
    assume cs:codes,ds:datas,es:datas
START:
    push ds
    sub ax,ax
    push ax
    MOV AX,DATAS
    MOV DS,AX
    mov es,ax
    mov cx,20
    lea si,string1
    lea di,string2
again:
    mov ax,[si]
    mov [di],ax
    inc si
    inc di
    loop again
    lea cx,string2
    mov ah,09
    int 21h
    
    ;此处输入代码段代码
    MOV AH,4CH
    INT 21H
CODES ENDS
    END START


怎么运行后还有这么多的乱码呢??这是第一个程序,,大家帮忙看看。。。。
chinatree
[第1楼]   [ 回复时间:2012-05-03 20:22 ]   [引用]   [回复]   [ top ] 
荣誉值:118
信誉值:0
注册日期:2011-07-07 22:59
ah=9/int21h的字符串结束标志是"$",它起边界作用。
escaping
[第2楼]   [ 回复时间:2012-05-04 12:21 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:0
注册日期:2012-05-03 09:03
DATAS SEGMENT
    ;此处输入数据段代码 
    string1 db 'move the cursor backword',"$";这里我用了“%”还是不对,还是然有乱码
    string2 db  ? 
DATAS ENDS

STACKS SEGMENT
    ;此处输入堆栈段代码
STACKS ENDS

CODES SEGMENT
    ;ASSUME CS:CODES,DS:DATAS,SS:STACKS,es:datas
    assume cs:codes,ds:datas,es:datas
START:
    push ds
    sub ax,ax
    push ax
    MOV AX,DATAS
    MOV DS,AX
    mov es,ax
    mov cx,25;这里应该是什么呢???应该是把字符串的长度保存在cx中啊!!怎么不对呢??
    lea si,string1
    lea di,string2
again:
    mov ax,[si]
    mov [di],ax
    inc si
    inc di
    loop again
    lea cx,string2
    mov ah,09
    int 21h
    
    ;此处输入代码段代码
    MOV AH,4CH
    INT 21H
CODES ENDS
    END START
wwt406
[第3楼]   [ 回复时间:2012-06-21 08:45 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:1
注册日期:2012-04-23 22:44
START: 
    push ds 
    sub ax,ax 我经常看到这条和下面一条配合用,为什么 要这么用,楼主指点下,清零干嘛要进栈?
    push ax
需要登录后才能回帖 -->> 请单击此处登录
    Copyright © 2006-2024   ASMEDU.NET  All Rights Reserved