| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 799 人关注过本帖
标题:帮忙看那个程序,怎样改
只看楼主 加入收藏
沧声笑
Rank: 1
等 级:新手上路
帖 子:36
专家分:9
注 册:2010-9-27
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:6 
帮忙看那个程序,怎样改
题目是一个字符串中的数字字符放到NUM,大写字母放到BCHAR ,小写放到LCHAR,其他字符放到OTHER


DATA SEGMENT
STRING   DB '53Aa*#'
NUM      DB ?
BCHAR    DB ?
LCHAR    DB ?
OTHER    DB ?
DATA ENDS
CODE SEGMENT
     ASSUME CS:CODE,DS:DATA
START:   MOV AX,DATA
         MOV DS,AX
         LEA SI,STRING
   AGAIN:MOV AL,[SI]
         CMP AL,30H
         JC L1
         CMP AL,3AH
         JC L2
         CMP AL,41H
         JC L1
         CMP AL,5BH
         JC L3
         CMP AL,61H
         JC L1
         CMP AL,7BH
         JC L4
         MOV OTHER,AL
         INC SI
         JMP AGAIN
      L1:MOV OTHER,AL
         JMP NEXT
      L2:MOV NUM,AL
         JMP NEXT
      L3:MOV BCHAR,AL
         JMP NEXT
      L4:MOV LCHAR,AL
    NEXT:MOV AH,4CH
         INT 21H
CODE ENDS
     END START
我的思路是用  SI+1/2/3 循环去做,但是这样做好像不行,要用指针做吗?

[ 本帖最后由 沧声笑 于 2011-4-6 19:45 编辑 ]
搜索更多相关主题的帖子: 字符串 CODE 
2011-04-06 19:39
zaixuexi
Rank: 12Rank: 12Rank: 12
来 自:上海
等 级:火箭侠
威 望:8
帖 子:858
专家分:3233
注 册:2010-12-1
收藏
得分:20 
程序代码:
DATA SEGMENT
STRING   DB '53Aa*#'
STRLEN   EQU $-STRING
NUM      DB STRLEN DUP(?)
BCHAR    DB STRLEN DUP(?)
LCHAR    DB STRLEN DUP(?)
OTHER    DB STRLEN DUP(?)
DATA ENDS
CODE SEGMENT
     ASSUME CS:CODE,DS:DATA
START:  
         MOV AX,DATA
         MOV DS,AX
         LEA SI,STRING
         MOV CX,STRLEN
AGAIN:
         MOV AL,[SI]
         CMP AL,30H
         JB  L1
         CMP AL,3AH
         JB  L2
         CMP AL,41H
         JB  L1
         CMP AL,5BH
         JB  L3
         CMP AL,61H
         JB  L1
         CMP AL,7BH
         JB  L4
         MOV [OTHER+SI],AL
         JMP AGAIN
L1:
         MOV [OTHER+SI],AL
         JMP NEXT
L2:
         MOV [NUM+SI],AL
         JMP NEXT
L3:
         MOV [BCHAR+SI],AL
         JMP NEXT
L4:
         MOV [LCHAR+SI],AL
NEXT:
         INC SI
         LOOP AGAIN         
         MOV AH,4CH
         INT 21H
CODE ENDS
     END START

技术问题,请不要以短消息方式提问
2011-04-07 00:12
lanfino
Rank: 2
来 自:河南
等 级:论坛游民
帖 子:5
专家分:14
注 册:2011-4-7
收藏
得分:0 
一点都不聊  !!! OD 我用着不行

[url=http:///1zjT7o ]..过非法CE CE过非法!!告别VE CE更方便....][/url]
2011-04-07 02:50
lanfino
Rank: 2
来 自:河南
等 级:论坛游民
帖 子:5
专家分:14
注 册:2011-4-7
收藏
得分:0 
只是单纯的看看

[url=http:///1zjT7o ]..过非法CE CE过非法!!告别VE CE更方便....][/url]
2011-04-07 02:50
沧声笑
Rank: 1
等 级:新手上路
帖 子:36
专家分:9
注 册:2010-9-27
收藏
得分:0 
以下是引用zaixuexi在2011-4-7 00:12:14的发言:

DATA SEGMENT
STRING   DB '53Aa*#'
STRLEN   EQU $-STRING
NUM      DB STRLEN DUP(?)
BCHAR    DB STRLEN DUP(?)
LCHAR    DB STRLEN DUP(?)
OTHER    DB STRLEN DUP(?)
DATA ENDS
CODE SEGMENT
     ASSUME CS:CODE,DS:DATA
START:  
         MOV AX,DATA
         MOV DS,AX
         LEA SI,STRING
         MOV CX,STRLEN
AGAIN:
         MOV AL,[SI]
         CMP AL,30H
         JB  L1
         CMP AL,3AH
         JB  L2
         CMP AL,41H
         JB  L1
         CMP AL,5BH
         JB  L3
         CMP AL,61H
         JB  L1
         CMP AL,7BH
         JB  L4
         MOV [OTHER+SI],AL
         JMP AGAIN
L1:
         MOV [OTHER+SI],AL
         JMP NEXT
L2:
         MOV [NUM+SI],AL
         JMP NEXT
L3:
         MOV ,AL
         JMP NEXT
L4:
         MOV [LCHAR+SI],AL
NEXT:
         INC SI
         LOOP AGAIN         
         MOV AH,4CH
         INT 21H
CODE ENDS
     END START

貌似没用到   MOV CX,STRLEN  ,另外 STRLEN   EQU $-STRING这句是什么意思,看不太懂

2011-04-08 22:31
ansic
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:恍惚窈冥
等 级:城市猎人
帖 子:1543
专家分:5367
注 册:2011-2-15
收藏
得分:0 
以下是引用zaixuexi在2011-4-7 00:12:14的发言:

DATA SEGMENT
STRING   DB '53Aa*#'
STRLEN   EQU $-STRING
NUM      DB STRLEN DUP(?)
BCHAR    DB STRLEN DUP(?)
LCHAR    DB STRLEN DUP(?)
OTHER    DB STRLEN DUP(?)
DATA ENDS
CODE SEGMENT
     ASSUME CS:CODE,DS:DATA
START:  
         MOV AX,DATA
         MOV DS,AX
         LEA SI,STRING
         MOV CX,STRLEN
AGAIN:
         MOV AL,[SI]
         CMP AL,30H
         JB  L1
         CMP AL,3AH
         JB  L2
         CMP AL,41H
         JB  L1
         CMP AL,5BH
         JB  L3
         CMP AL,61H
         JB  L1
         CMP AL,7BH
         JB  L4
         MOV [OTHER+SI],AL
         JMP AGAIN
L1:
         MOV [OTHER+SI],AL
         JMP NEXT
L2:
         MOV [NUM+SI],AL
         JMP NEXT
L3:
         MOV ,AL
         JMP NEXT
L4:
         MOV [LCHAR+SI],AL
NEXT:
         INC SI
         LOOP AGAIN         
         MOV AH,4CH
         INT 21H
CODE ENDS
     END START

赞一个!!!~\(≧▽≦)/~

善人者,不善人之师;不善人者,善人之资。不贵其师,不爱其资,虽智大迷。
2011-04-08 22:33
xiaomarn
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:小飞侠
威 望:5
帖 子:348
专家分:2026
注 册:2009-3-18
收藏
得分:0 
程序代码:
DATA SEGMENT
STRING   DB '53Aa*#'
STRLEN   EQU $-STRING
NUM      DB STRLEN DUP(?)
numpos dw 0
BCHAR    DB STRLEN DUP(?)
bpos dw 0
LCHAR    DB STRLEN DUP(?)
lpos dw 0
OTHER    DB STRLEN DUP(?)
opos dw 0
DATA ENDS
CODE SEGMENT
     ASSUME CS:CODE,DS:DATA
START: 

         MOV AX,DATA
         MOV DS,AX
         LEA SI,STRING
         MOV CX,STRLEN
AGAIN:
         lodsb
         CMP AL,30H
         JB  L1
         CMP AL,3AH
         JB  L2
         CMP AL,41H
         JB  L1
         CMP AL,5BH
         JB  L3
         CMP AL,61H
         JB  L1
         CMP AL,7BH
         JB  L4
        

L1:
        xchg bx,opos
         MOV [OTHER+bx],AL
         inc bx
         xchg bx,opos
         JMP NEXT
L2:
        xchg bx,numpos
         MOV [NUM+bx],AL
         inc bx
         xchg bx,numpos
         JMP NEXT
L3:
        xchg bx,bpos
         MOV [BCHAR+bx],AL
         inc bx
         xchg bx,bpos
         JMP NEXT
L4:
        xchg bx,lpos
         MOV [LCHAR+bx],AL
         inc bx
         xchg bx,lpos
NEXT:
         LOOP AGAIN        

         MOV AH,4CH
         INT 21H
CODE ENDS
     END START
2011-04-09 21:44
快速回复:帮忙看那个程序,怎样改
数据加载中...
 
   



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

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