| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 788 人关注过本帖
标题:完成程序段(转换为对应的ASCII)
只看楼主 加入收藏
hyfeng
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2004-11-15
收藏
 问题点数:0 回复次数:2 
完成程序段(转换为对应的ASCII)

 下面程序段的功能是把DA1数据区的数转换为对应的ASCII码。试完善成本程序。

DA1 DB 00H,01H,02H,03H,04H,05H,06H,07H,08H,09H

ASCI DB  10DUP(?)

    CUNT=ASCI-DAI

    LEA SI,DAI

    LEA DI,ASCI

  ————————————

LOOP:MOV AL,[SI]

  ——————————————

MOV [DI],AL

INC DI

LOOP LOOP1

搜索更多相关主题的帖子: ASCII 
2004-12-13 22:41
meng136138
Rank: 1
等 级:新手上路
帖 子:50
专家分:0
注 册:2006-2-15
收藏
得分:0 
LOOP1 这个去那里找啊!!
2006-05-19 23:34
公子吕
Rank: 1
等 级:新手上路
帖 子:79
专家分:0
注 册:2006-5-4
收藏
得分:0 
integer数转ascii串子程序。
调用前将数字放在ax中,存放转换后字符串的地址放bx,然后将bx,ax先后压入堆栈。过程如下:

itoaproc proc near
push bp
mov bp,sp
push ax
push bx
push cx
push dx
push di
pushf

mov ax,[bp+6]
mov di,[bp+4]

ifSpecial:
cmp ax,8000h
jne EndIfSpecial
mov BYTE PTR [di],'-'
mov BYTE PTR [di+1],'3'
mov BYTE PTR [di+2],'2'
mov BYTE PTR [di+3],'7'
mov BYTE PTR [di+4],'6'
mov BYTE PTR [di+5],'8'
jmp ExitIToA
EndIfSpecial:

mov dx, ax

mov al,' '
mov cx,5 ; first five
cld ; bytes of
rep stosb ; destination field

mov ax, dx ; copy source number
mov cl,' ' ; default sign (blank for +)
IfNeg: cmp ax,0 ; check sign of number
jge EndIfNeg ; skip if not negative
mov cl,'-' ; sign for negative number
neg ax ; number in AX now >= 0
EndIfNeg:

mov bx,10 ; divisor

WhileMore: mov dx,0 ; extend number to doubleword
div bx ; divide by 10
add dl,30h ; convert remainder to character
mov [di],dl ; put character in string
dec di ; move forward to next position
cmp ax,0 ; check quotient
jnz WhileMore ; continue if quotient not zero

mov [di],cl ; insert blank or "-" for sign

ExitIToA: popf ; restore flags and registers
pop di
pop dx
pop cx
pop bx
pop ax
pop bp
ret 3 ;exit, discarding parameters
itoaproc ENDP

2006-05-20 11:40
快速回复:完成程序段(转换为对应的ASCII)
数据加载中...
 
   



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

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