home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / assemblr / library / sampler1 / comint.asm < prev    next >
Assembly Source File  |  1985-02-28  |  2KB  |  99 lines

  1. ;
  2. ;    Serial communications port interupt intercepter        AHA 8502.27
  3. ;
  4. ;    Functions:
  5. ;    al=0 then Disable communications interupt vector
  6. ;    al=1 then Enable communications interupt vector
  7. ;    Issue and int 44h
  8. ;
  9. progseg segment para public 'CODE'
  10.     public    setcom
  11.     assume    cs:progseg, ds:progseg, es:progseg
  12.     org    100h
  13. doscall equ    21h
  14. ;
  15. startup proc    far
  16.     jmp    setup
  17. ;
  18. setcom    proc    far
  19.     push    ds
  20.     push    es
  21.     push    dx
  22.     push    ax
  23.     mov    ax,cs
  24.     mov    ds,ax
  25.     mov    es,ax
  26.     pop    ax
  27.     cmp    al,1        ;is function 1
  28.     jz    enable        ;then enable
  29. ;
  30. disable:
  31.     mov    dx,offset interupt ;get new vector address
  32.     mov    ax,cs
  33.     mov    ds,ax        ;set segment
  34.     mov    ah,25h        ;set interupt vector address function
  35.     mov    al,14h        ;communications interupt vector
  36.     int    doscall     ;set the interupt
  37.     jmp    exit        ;exit
  38. enable:
  39.     mov    dx,word ptr vector     ;set old segment
  40.     mov    ds,vector+2    ;set old communications vector
  41.     mov    ah,25h        ;set interupt vector address function
  42.     mov    al,14h        ;communications interupt vector
  43.     int    doscall
  44. exit:
  45.     pop    dx
  46.     pop    es
  47.     pop    ds
  48. ;
  49. interupt       proc    far
  50.     sub    ax,ax        ;zero return status
  51.     iret
  52. interupt       endp
  53. setcom    endp
  54. ;
  55. msg    db    'Serial communications intercepter installed',0ah,0dh,'$'
  56. msg1    db    'Serial communications intercepter is already installed',0ah,0dh,'$'
  57. vector    db    8 dup(0)    ;only 4 needed 4 more for safety
  58. ;
  59. setup:
  60.     mov    ah,35h        ;get interupt vector address function
  61.     mov    al,44h        ;communications interupt vector
  62.     int    doscall     ;go get it
  63.     cmp    bx,0        ;check if vector used
  64.     jnz    lderr        ;if used then exit
  65.     mov    ax,es        ;check segment
  66.     cmp    ax,0
  67.     jnz    lderr
  68. ;
  69.     mov    dx,offset msg
  70.     mov    ah,9
  71.     int    doscall
  72. ;
  73.     mov    ah,35h        ;get interupt vector address function
  74.     mov    al,14h        ;communications interupt vector
  75.     int    doscall     ;go get it
  76. ;
  77.     mov    word ptr vector,bx     ;save offset
  78.     mov    bx,es        ;get segment address
  79.     mov    word ptr vector+2,bx     ;save segment
  80. ;
  81.     mov    dx,offset setcom ;get new vector address
  82.     mov    ax,cs
  83.     mov    ds,ax        ;set segment
  84.     mov    ah,25h        ;set interupt vector address function
  85.     mov    al,44h        ;set to our new interupt vector
  86.     int    doscall     ;set the interupt
  87. ;
  88.     mov    dx,offset setup ;terminate and stay resident
  89.     int    27h
  90. lderr:
  91.     mov    dx,offset msg1
  92.     mov    ah,9
  93.     int    doscall
  94.     int    20h
  95. startup endp
  96. progseg ends
  97. ;
  98.     end    startup
  99.