实验6 实践课程中的程序

(2)编程,完成问题 7.9 中的程序。

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

  1. assume cs:codesg,ss:stacksg,ds:datasg
  2. stacksg segment
  3. dw 0,0,0,0,0,0,0,0 ;定义8个字符,占用16字节
  4. stacksg ends
  5. datasg segment
  6. db '1. display '
  7. db '2. brows '
  8. db '3. replace '
  9. db '4. modify '
  10. datasg ends
  11. codesg segment
  12. start: mov ax,stacksg
  13. mov ss,ax
  14. mov sp,16
  15. mov ax,datasg
  16. mov ds,ax
  17. mov bx,0
  18. mov cx,4
  19. s0:push cx ;保存外层循环次数
  20. mov si,0
  21. mov cx,4
  22. s1:mov al,[bx+3+si]
  23. and al,11011111b
  24. mov [bx+3+si],al
  25. inc si
  26. loop s1
  27. add bx,16 ;切换到下一行
  28. pop cx ;恢复外层循环次数
  29. loop s0
  30. mov ax,4c00H
  31. int 21H
  32. codesg ends
  33. end start