intmac.inc
上传用户:xiaoan1112
上传日期:2013-04-11
资源大小:19621k
文件大小:2k
源码类别:

操作系统开发

开发平台:

Visual C++

  1. ;***
  2. ;intmac.inc - 20-Mar-86
  3. ;***
  4. .XLIST
  5. ;***
  6. ;
  7. ; Copyright <C> 1986, Microsoft Corporation
  8. ;
  9. ;Purpose:
  10. ;
  11. ;******************************************************************************
  12. ;       8086 Interrupt Handling Macros
  13. ;       MS-DOS 1.0 does not have INT 21 to GET a vector
  14. ;       hence SAVINT just moves interrupts around.
  15. SVINT MACRO   savloc,intloc,reg
  16. IFB <reg>
  17. SVINT savloc,intloc,AX
  18. ELSE
  19. MOV reg,intloc
  20. MOV savloc,reg
  21. MOV reg,intloc+2
  22. MOV savloc+2,reg
  23. ENDIF
  24. ENDM
  25. savint macro savloc,intvec 
  26. MOV AX,3500H+INTVEC/4 ;;AH=get int - AL=interrupt number
  27. int 21h
  28. mov word ptr savloc,bx ;;savloc = offset
  29. mov word ptr savloc+2,es ;;savloc+2 = segment
  30. endm
  31. ; The following macros use the MS-DOS INT 21 call to change
  32. ; interrupt vectors.
  33. setvec macro interrupt,offset_adr ;;set interrupt vector function call
  34. mov dx,offset offset_adr
  35. MOV AX,2500H+INTERRUPT ;;AH=set int call - AL=interrupt
  36. int 21h
  37. endm
  38. rstvec macro interrupt,save_adr ;;restore interrupt from saved
  39. lds dx,dword ptr save_adr
  40. MOV AX,2500H+INTERRUPT ;;AH=set int call - AL=interrupt
  41. int 21h
  42. endm
  43. XFRINT MACRO TOINT,FROMINT ;;move FROMINT to TOINT
  44. PUSH ES ;;save register...
  45. MOV AX,3500H+FROMINT ;;want to get FROMINT
  46. INT 21H ;;vector now in ES:BX
  47. MOV AX,ES ;;keep segment around
  48. POP ES ;;restore register...
  49. MOV DX,BX ;;move offset for put
  50. PUSH DS ;;save register...
  51. MOV DS,AX ;;segment for put
  52. MOV AX,2500H+TOINT ;;want to put TOINT
  53. INT 21H ;;vector now in DS:DX
  54. POP DS ;;restore register
  55. ENDM
  56. .LIST