《微机原理与应用》第5章中断系统..ppt

  1. 1、本文档共154页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
《微机原理与应用》第5章中断系统.

设置中断向量 cli push ds mov dx,offset new08h mov ax,seg new08h mov ds,ax mov ax,2508h int 21h pop ds 例5.16 设置中断寄存器 in al,21h push ax and al,0feh ;允许IRQ0 out 21h,al mov counter,0 ;设置中断次数初值 sti ;开中断 例5.16 循环等待中断 start1: cmp counter,10 jb start1 ;中断10次退出 例5.16 中断就在主程序循环当中 进入中断服务程序 new08h proc sti ;开中断 push ax ;保护寄存器 push bx push ds mov ax,@data mov ds,ax ;设置数据段DS 例5.16 中断处理 inc counter mov si,offset intmsg ;显示信息 call dpstri 例5.16 显示字符串 dpstri proc ;显示字符串子程序 push ax push bx dps1: lodsb cmp al,0 jz dps2 例5.16 显示字符串(续) mov bx,0 mov ah,0eh int 10h jmp dps1 dps2: pop bx pop ax ret dpstri endp 例5.16 退出中断服务程序 mov al,20h out 20h,al pop ds ;恢复寄存器 pop bx pop ax iret ;中断返回 new08h endp 例5.16 主程序结束 cli pop ax out 21h,al pop dx pop ds mov ax,2508h int 21h sti mov ax,4c00h int 21h 例5.16 A 8259A Interrupt ! A 8259A Interrupt ! A 8259A Interrupt ! A 8259A Interrupt ! A 8259A Interrupt ! A 8259A Interrupt ! A 8259A Interrupt ! A 8259A Interrupt ! A 8259A Interrupt ! A 8259A Interrupt ! 5.3.5 驻留中断服务程序 驻留TSR(Terminate and Stay Resident)程序 用户程序运行后仍然保存在主存中,可以让其他程序使用 利用DOS功能调用31H代替4CH终止程序 小型驻留程序常编写成COM程序 驻留程序也可以编写成EXE程序 需要驻留内存的程序段要写在前面 例5.17 报时中断驻留服务程序 系统08H号中断服务程序调用1CH中断 每隔55ms调用这个报时中断,中断65543次就是时间过了一个小时 本例编写一个驻留内存的1CH内部中断服务程序,实现每过一小时就显示信息 执行此程序后,报时中断服务程序将驻留内存 进入中断服务程序 new1ch proc sti ;开中断 push si ;保护寄存器 push ds mov si,cs mov ds,si ;设置数据段DS add countl,1 adc counth,1 例5.17 中断处理 cmp countl,hourl jnz n1ch1 cmp counth,hourh jnz n1ch1 mov countl,0 mov counth,0 mov si,offset intmsg call dpstri 例5.17 退出中断服务程序 n1ch1: pop ds ;恢复寄存器 pop si iret ;中断返回 countl dw 0 counth dw 0 intmsg db ‘One Hour Has Passed ! ’ db 0dh,0ah,0 new1ch endp 例5.17 One Hour Has Passed ! 显示字符串 dpstri proc ;显示字符串子程序 push ax push bx dps1: lodsb cmp al,0 jz dps2 例5.17 显示字符串(续) mov bx,0 mov ah,0eh int 10h jmp dps1 dps2: pop bx pop ax ret dpstri endp 例5

您可能关注的文档

文档评论(0)

叮当文档 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档