实验九 根据材料编程

1. 补全程序t1.asm,完成在屏幕上输出内存单元中的十进制两位数 。

程序及实验截图如下:

 

调试发现,最后结果是1和2

2. 补全程序t2.asm,完成在屏幕上输出data段定义的5个十进制两位数,数据和数据 之间以空格间隔。 

补充程序:

      mov ax, data
      mov ds, ax
      mov cx, 5h
      mov di, 0h

s:   mov ah,0
      mov al,ds:[di]
      mov bl,10
      div bl
      mov  ds:[5],al
      mov  ds:[6],ah 

      mov ah,2
      mov dl,ds:[5]    
      add dl,30h   
      int 21h

      mov ah,2
      mov dl,ds:[6]   
      add dl,30h int 21h

      mov ah,2  
      mov dl,32      
      int 21h

      add di,1h
      loop s

 

 3. 教材实验9(P187)

补充程序:


 mov bx,0
     mov si,0
     mov cx,16

s0:  mov ax,[bx]
     mov es:[bx+720h][si],ax
     mov al,2               ;存放颜色属性值绿色
     mov es:[bx+721h][si],al
     inc bx
     inc si
    loop s0
 

     mov bx,0
     mov cx,16
     mov si,160

s1:  mov ax,[bx]
     mov es:[bx+720h][si],ax
     mov al,36            ;绿底红色
     mov es:[bx+721h][si],al
     inc bx
     inc si
     loop s1

     mov bx,0
     mov cx,16
     mov si,320

s2:  mov ax,[bx]
     mov es:[bx+720h][si],ax
     mov al,113            ;白底蓝色
     mov es:[bx+721h][si],al
     inc bx
     inc si
     loop s2

截图如下:

经验证,正确

实验结论:在这次的实验中,通过完善填补程序,了解了loop指令更多的用法,收获了很多,还有很多不足之处,希望更加努力。

原文地址:https://www.cnblogs.com/jasonIL/p/10119341.html