第七章 实验6 实践课程中的程序

问题7.9

  编程,将datasg段中每个单词的前4个字母改为大写字母。

程序如下:

 1 ;编程,将datasg段中每个单词的前4个字母改为大写字母
 2 
 3 assume cs:codesg,ss:stacksg,ds:datasg
 4 ;定义栈,但这次不用
 5 stacksg segment
 6     dw 0,0,0,0,0,0,0,0
 7 stacksg ends
 8 
 9 datasg segment
10     db '1. display      '
11     db '2. brows        '
12     db '3. replace      '
13     db '4. modify       '
14 datasg ends
15 
16 codesg segment
17 start:
18     mov ax,stacksg
19     mov ss,ax
20     mov sp,16
21     mov ax,datasg
22     mov ds,ax
23     mov bx,0
24     mov cx,4
25 s:
26     mov si,3
27     mov dx,cx
28     mov cx,4
29 s0:    
30     mov al,[bx+si]
31     and al,11011111b
32     mov [bx+si],al
33     inc si
34     loop s0
35     
36     add bx,16
37     mov cx,dx
38     loop s
39     
40     mov ax,4c00h
41     int 21h
42 
43 codesg ends
44 
45 end start

加载到debug中,程序如图:

  执行一次循环后,再次用d指令查看:

  全部执行完毕后,再次用d指令查看:

 

over.

posted @ 2016-05-21 01:32  JimAmadeus  阅读(289)  评论(0)    收藏  举报