⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interupt.txt

📁 该程序首先访问中断向量表
💻 TXT
字号:
设计题目:中断向量表操作
设计要求:该程序首先访问中断向量表,然后能自动建立一文件,将中断向量表的内容保存到文件中(文件名为INTHAND.TXT),并将中断向量表的各入口以十六进制的形式显示在屏幕上(如:01#___每行显示4个)。
设计应用:根据显示内容与参考资料,分析内存中是否有病毒,更改向量。
设计思路:由中断向量表位于存储器的低1K地址中,共256个中断向量,循环取中断向量,依次将中断向量的地址放入一已定义的缓冲区中,然后建立文件,把缓冲区的内容写入文件,随后关闭文件。而后,置一标志为1,循环取中断向量,将其地址入口显示在屏幕上,每次标志加1,当标志为4时,再将其置为1。
;代码续
TITLE INTTAB.EXE
;*********************************************************************
.model small
.stack 64
.data
endcde   dw ?
handle   dw ?
dubword  dw 2 dup(?)
key      dw ?
pathnam  db 'D:\masm\inthand.txt',00
temp     db 1024 dup(?),'$'
openmsg  db '*****Open Error*****',0ah,0dh,'$'
writmsg  db '*****Write Error*****',0ah,0dh,'$'
ctlf     db 13,10,'$'
quotmsg  db ':','$'
middmsg  db '#:','$'
spacmsg  db ' ','$'
;**********************************************************************
.code
disp  macro  msgaddr                    ;define macro
           push ax
           push dx
           mov  ah,09h
           lea  dx,msgaddr
           int  21h
           pop  dx
           pop  ax
           endm 
main  proc  far
           mov  ax,@data
           mov  ds,ax
           mov  si,1                          ;save int tab to temp 
           mov  cx,256                        
           lea  di,temp
loop1:
           call getint
           mov  ax,[dubword]
           mov  [di],ax
           add  di,2
           mov  ax,[dubword+2]
           mov  [di],ax
           add  di,2
           inc  si  
           loop loop1    
           call creath
           cmp  endcde,0
           jz   follow
           jmp  exit
follow: 
           call writh
           call closh
           call disply
exit:
           mov  ax,4c00h
           int  21h     
main  endp 
;**********************************************************************
;create disk file 
creath  proc near
          mov  ah,3ch                              ;request create
          mov  cx,0                                ;nomal attribute
          lea  dx,pathnam 
          int  21h
          jc   at                                  ;error?
          mov  handle,ax                           ;no,save handle
          ret
at:
          disp openmsg     
          mov  endcde,1
          ret
creath  endp
;**********************************************************************
writh  proc  near
          disp temp
          mov  ah,40h                              ;request write
          mov  bx,handle
          mov  cx,1024
          lea  dx,temp
          int  21h
          jnc  wrterr                              ;valid write?
          disp writmsg                             ;no
wrterr:                                       ;error
          ret
writh  endp
;**********************************************************************
;close disk file
closh  proc near
          mov  ah,3eh                               ;request close
          mov  bx,handle
          int  21h
          ret
closh  endp
;**********************************************************************
;display int tab 
disply  proc near
          push  ax
          push  cx
          push  si
          mov  cx,256
          mov   si,1
contin:
          cmp   ax,4                                 ;cmp,CR&LF?
          jnz   contin1                              ;ax=!4,contin1
          disp  ctlf                                 ;ax=4,CR&LF
          sub   ax,ax    
contin1:     
          call  getint
          mov   bx,[dubword]
          call  disltr
          disp  middmsg
          mov   bx,[dubword+2]
          call  disltr
          disp  spacmsg
          inc   si
          inc   ax
          loop  contin
          pop   si
          pop   cx
          pop   ax
          ret    
disply  endp
;**********************************************************************
;display letter
disltr  proc near
          push  cx
          mov   ch,4                           ;number of digits 
rotate:
          mov   cl,4                           ;set count to 4 bits
          rol   bx,cl                          ;left digits to right
          mov   al,bl                          ;move to AL
          and   al,0fh                         ;mask off left digit
          add   al,30h                         ;convert hex to ASCII
          cmp   al,3ah                         ;is it>9?
          jl    print                          ;jump if digit=0 to 9
          add   al,7h                          ;digit is A to F
print:
          mov   dl,al                             ;put ASCII char in DL
          mov   ah,2                              ;display out funct
          int   21h
          dec   ch
          jnz   rotate                     
          pop   cx
          ret
disltr   endp         
;********************************************************************** 
;get int 
getint  proc  near
           push ax
           push dx
           mov  ah,35h
           mov  dx,si                             ;int number
           mov  al,dl
           int  21h
           mov  dubword,es                        ;int register NUM.
           mov  dubword+2,bx                       ;int offset addr.
           pop  dx
           pop  ax 
getint  endp
;***********************************************************************      
          end main  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -