Chinaunix首页 | 论坛 | 博客
  • 博客访问: 459287
  • 博文数量: 62
  • 博客积分: 1742
  • 博客等级: 中尉
  • 技术积分: 859
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-06 00:13
个人简介

这是一句很长很长而且又很啰嗦并且很无聊的废话...

文章分类

全部博文(62)

文章存档

2013年(1)

2012年(13)

2011年(48)

分类: LINUX

2011-05-03 00:29:50

  1. assume cs:codesg,ss:stacksg
  2. stacksg segment
  3. db 128 dup(0)
  4. stacksg ends
  5. codesg segment
  6. int7ch_start:jmp int_main
  7. ;-----------------------------------------清空屏幕
  8. ck:push bx
  9. push cx
  10. push es
  11. mov bx,0b800h
  12. mov es,bx
  13. mov bx,0
  14. mov cx,2000
  15. ck_s:mov byte ptr es:[bx],' ';清空屏幕
  16. add bx,2
  17. loop ck_s
  18. pop es
  19. pop cx
  20. pop bx
  21. ret
  22. ;-----------------------------------------设置前景
  23. qj:push bp
  24. mov bp,sp
  25. push ax
  26. push cx
  27. push bx
  28. push es
  29. cmp byte ptr ss:4h[bp],7h;颜色值大于7就不干...
  30. ja qj_e
  31. mov ax,0b800h
  32. mov es,ax
  33. mov ax,ss:4h[bp]
  34. mov bx,1
  35. mov cx,2000
  36. qj_s:and byte ptr es:[bx],11111000b;前景色置0
  37. or byte ptr es:[bx],al;设置前景色
  38. add bx,2h
  39. loop qj_s
  40. qj_e:pop es
  41. pop bx
  42. pop cx
  43. pop ax
  44. pop bp
  45. ret
  46. ;-----------------------------------------设置背景
  47. bj:push bp
  48. mov bp,sp
  49. push ax
  50. push cx
  51. push bx
  52. push es
  53. cmp byte ptr ss:4h[bp],7h;颜色值大于7就不干...
  54. ja bj_e
  55. mov ax,0b800h
  56. mov es,ax
  57. mov ax,ss:4h[bp]
  58. mov cl,4
  59. shl al,cl;左移4位
  60. mov bx,1
  61. mov cx,2000
  62. bj_s:and byte ptr es:[bx],10001111b;背景色置0
  63. or byte ptr es:[bx],al;设置背景色
  64. add bx,2h
  65. loop bj_s
  66. bj_e:pop es
  67. pop bx
  68. pop cx
  69. pop ax
  70. pop bp
  71. ret
  72. ;-----------------------------------------滚动一行
  73. gd:push ds
  74. push es
  75. push si
  76. push di
  77. push cx
  78. push ax
  79. mov ax,0b800h
  80. mov es,ax
  81. mov di,0
  82. mov ds,ax
  83. mov si,160
  84. cld;递增
  85. mov cx,24
  86. gd_s:push cx
  87. push si
  88. push di
  89. mov cx,160
  90. rep movsb;复制
  91. pop di
  92. pop si
  93. add di,160
  94. add si,160
  95. pop cx
  96. loop gd_s
  97. pop ax
  98. pop cx
  99. pop di
  100. pop si
  101. pop es
  102. pop ds
  103. ret
  104. int_main:jmp codemain
  105. fun_table dw ck-int7ch_start,qj-int7ch_start,bj-int7ch_start,gd-int7ch_start;功能列表(数据标号,因为地址在编译时固定了,所以只能拿偏移了...)
  106. codemain:push di;ax是参数ah功能号al是颜色参数
  107. push bx
  108. push si
  109. cmp ah,3;检查非法操作
  110. ja int7ch_o
  111. mov bx,0
  112. mov bl,ah
  113. add bx,bx
  114. mov si,bx;获取功能号
  115. mov bx,fun_table-int7ch_start
  116. mov bx,cs:200h[bx][si];获取功能地址
  117. add bx,200h;
  118. push ax
  119. call bx
  120. pop ax
  121. int7ch_o:pop si
  122. pop bx
  123. pop di
  124. iret
  125. int7ch_end:nop
  126. start:mov ax,stacksg
  127. mov ss,ax
  128. mov sp,128
  129. mov ax,cs;复制代码
  130. mov ds,ax
  131. mov ax,0
  132. mov es,ax
  133. mov si,offset int7ch_start
  134. mov di,200h
  135. mov cx,offset int7ch_end-offset int7ch_start
  136. rep movsb
  137. mov ax,0;安装7ch中断例程
  138. mov es,ax
  139. mov word ptr es:[7ch*4],200h
  140. mov word ptr es:[7ch*4+2],0h
  141. mov ah,2;功能(0,1,2,3)
  142. mov al,2;颜色(0,1,2,3,4,5,6,7)
  143. int 7ch;调用
  144. mov ax,4c00h
  145. int 21h
  146. codesg ends
  147. end start
阅读(2276) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~