[汇编] 将字符串里的一个'&'字符换成空格

 

 1 ; multi-segment executable file template.
 2 
 3 data segment
 4     ; add your data here!
 5     pkey db "press any key...$"  
 6     STRING  DB  'The date is FEB&03$'
 7 ends
 8 
 9 stack segment
10     dw   128  dup(0)
11 ends
12 
13 code segment
14 start:
15 ; set segment registers:
16     mov ax, data
17     mov ds, ax
18     mov es, ax
19 
20     ; add your code here
21     mov cx,19
22     mov si,-1
23     mov al,'&'
24     
25     NEXT:
26         inc si
27         cmp al,STRING[si]
28         loopne NEXT
29         je  FOUND
30     FOUND:
31         mov STRING[si],20H
32                 
33     lea dx, STRING
34     mov ah, 9
35     int 21h        ; output string at ds:dx
36     
37     ; wait for any key....    
38     mov ah, 1
39     int 21h
40     
41     mov ax, 4c00h ; exit to operating system.
42     int 21h    
43 ends
44 
45 end start ; set entry point and stop the assembler.
46   
47   
48   

 

posted @ 2014-04-03 14:54  beautifulzzzz  阅读(1348)  评论(0编辑  收藏  举报