鱼C论坛

 找回密码
 立即注册
查看: 2852|回复: 1

[技术交流] 实验15,照书上小改动完成的

[复制链接]
发表于 2011-10-11 22:04:22 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
本帖最后由 Sabo 于 2011-10-11 22:06 编辑


  1. ;实验15
  2. assume cs:code
  3. stack segment
  4. db 128 dup (0)
  5. stack ends

  6. code segment
  7. start:
  8. mov ax,stack
  9. mov ss,ax
  10. mov sp,128

  11. push cs
  12. pop ds

  13. mov ax,0
  14. mov es,ax

  15. mov si,offset int9   ;安装新的int9
  16. mov di,204h
  17. mov cx,offset int9end - offset int9
  18. cld
  19. rep movsb

  20. push es:[9*4]     ;保存原int9
  21. pop es:[200h]
  22. push es:[9*4+2]
  23. pop es:[202h]

  24. cli

  25. mov WORD ptr es:[9*4],204h ;将新的int9送入中断向量表
  26. mov WORD ptr es:[9*4+2],0

  27. sti

  28. ;为了看到效果,加入以下代码
  29. ;begin
  30. mov dx,0ffffh
  31. mov ax,0ffffh
  32. kkk:
  33. sub ax,1
  34. sbb dx,0
  35. cmp dx,0
  36. jne kkk
  37. cmp ax,0
  38. jne kkk
  39. mov ah,1
  40. int 21h

  41. mov ax,4c00h
  42. int 21h
  43. ;end

  44. int9:
  45. push ax
  46. push bx
  47. push cx
  48. push es

  49. in al,60h

  50. pushf
  51. call DWORD ptr cs:[200h]

  52. cmp al,9eh  ;判断al是否为A的断码,既松开按键所产生的扫描码
  53. jne int9ret

  54. mov ax,0b800h
  55. mov es,ax
  56. mov bx,2
  57. mov cx,2000
  58. s:
  59. mov BYTE ptr es:[bx],'A'
  60. add bx,2
  61. loop s

  62. int9ret:
  63. pop es
  64. pop cx
  65. pop bx
  66. pop ax
  67. iret
  68. int9end:
  69. nop

  70. code ends
  71. end start
复制代码

:P
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
 楼主| 发表于 2011-10-11 22:07:50 | 显示全部楼层
为何第十五章最后的指令系统总结里有些代码王爽老师没有在书中讲过?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-5-27 00:14

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表