Chinaunix首页 | 论坛 | 博客
  • 博客访问: 198237
  • 博文数量: 67
  • 博客积分: 2970
  • 博客等级: 少校
  • 技术积分: 685
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-23 11:36
文章分类

全部博文(67)

文章存档

2012年(2)

2011年(19)

2010年(46)

我的朋友

分类: 嵌入式

2011-07-23 11:10:18

用汇编在屏幕上开出了一个窗口,左上角(5,50),右下角(15,70,光标首先定位在窗口最下面行首,从键盘输入字符,显示在窗口,当按enter或一行显示满后,窗口自动向上滚动一行,输入的字符继续位于最低行,窗口最高一行上卷后消失,程序以esc键退出
 
  1. data segment
  2. num dw 0
  3. divisor dw 20
  4. point db 5,50,15,70
  5. data ends
  6. stack segment stack
  7. stk db 200h dup(?)
  8. stack ends
  9. code segment
  10. assume cs:code,ds:data,ss:stack
  11. main proc near
  12. mov ax,data
  13. mov ds,ax
  14. mov ax,600h
  15. mov bh,111b
  16. mov cx,0
  17. mov dh,25
  18. mov dl,80
  19. int 10h
  20. mov ah,2h
  21. mov bh,0
  22. mov dh,point[2]
  23. mov dl,point[1]
  24. int 10h
  25. show: mov ah,8h
  26. int 21h
  27. cmp al,1bh
  28. je exit
  29. cmp al,0dh
  30. je cr
  31. cmp al,8h
  32. je back
  33. cmp al,20h
  34. jb show
  35. mov dl,al
  36. mov ah,2h
  37. int 21h
  38. inc num
  39. mov ax,num
  40. mov dx,0
  41. div divisor
  42. mov num,dx
  43. cmp dx,0
  44. je cr
  45. jmp short show
  46. exit: mov ah,4ch
  47. int 21h
  48. cr: push ax
  49. push bx
  50. push cx
  51. push dx
  52. mov ax,601h
  53. mov bh,111b
  54. mov ch,point[0]
  55. mov cl,point[1]
  56. mov dh,point[2]
  57. mov dl,point[3]
  58. int 10h
  59. mov ah,3h
  60. mov bh,0
  61. int 10h
  62. mov ah,2h
  63. mov dl,point[1]
  64. int 10h
  65. pop dx
  66. pop cx
  67. pop bx
  68. pop ax
  69. jmp near ptr show
  70. back: push ax
  71. push bx
  72. push cx
  73. push dx
  74. hide: mov ah,3h
  75. mov bh,0
  76. int 10h
  77. dec dl
  78. cmp dl,point[1]
  79. jb line
  80. mov ah,2h
  81. int 10h
  82. sub dl,point[1]
  83. mov dh,0
  84. mov num,dx
  85. mov ah,9h
  86. mov al,' '
  87. mov bx,111b
  88. mov cx,1
  89. int 10h
  90. pop dx
  91. pop cx
  92. pop bx
  93. pop ax
  94. jmp near ptr show
  95. line: push ax
  96. push bx
  97. push cx
  98. push dx
  99. mov ax,701h
  100. mov bh,111b
  101. mov ch,point[0]
  102. mov cl,point[1]
  103. mov dh,point[2]
  104. mov dl,point[3]
  105. int 10h
  106. mov ah,2h
  107. mov bh,0
  108. mov dh,point[2]
  109. mov dl,point[3]
  110. int 10h
  111. pop dx
  112. pop cx
  113. pop bx
  114. pop ax
  115. jmp near ptr hide
  116. main endp
  117. code ends
  118. end main
阅读(2599) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~