home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / t / twindv21.zip / TWINVEC.ASM < prev   
Assembly Source File  |  1992-08-13  |  2KB  |  113 lines

  1. ;
  2. ; PackeTwin 8530 interrupt handler routine
  3. ;
  4.     .MODEL    MEMMOD,C
  5.     LOCALS
  6.     %MACS
  7.     .LALL
  8.  
  9.     extrn    Stktop,Spsave,Sssave,tsync_entpt:proc,eoi:proc
  10.  
  11.     .DATA
  12.  
  13.     .CODE
  14. dbase    dw    @Data        ; save loc for ds (must be in code segment)
  15.     
  16.     public    twinvec;
  17.  
  18.     label    twinvec far
  19. ;    cli
  20.     push    ds        ; save on user stack
  21.     mov    ds,cs:dbase    ; establish interrupt data segment
  22.  
  23.     mov    Sssave,ss    ; stash user stack context
  24.     mov    Spsave,sp
  25.  
  26.     mov    ss,cs:dbase
  27.     lea    sp,Stktop
  28.  
  29.     push    ax        ; save user regs on interrupt stack
  30.     push    bx
  31.     push    cx
  32.     push    dx
  33.     push    bp
  34.     push    si
  35.     push    di
  36.     push    es
  37.     call    eoi
  38.     mov    ax,0        ; arg for service routine
  39.     push    ax
  40.     call    tsync_entpt
  41.     pop    ax
  42.     pop    es
  43.     pop    di
  44.     pop    si
  45.     pop    bp
  46.     pop    dx
  47.     pop    cx
  48.     pop    bx
  49.     pop    ax
  50.     mov    ss,Sssave
  51.     mov    sp,Spsave    ; restore original stack context
  52.     pop    ds
  53. ;    sti
  54.     iret
  55.  
  56. ; Write an 8530 register. Called from C as
  57. ; Twin_write_scc(int ctl,char reg,char val);
  58.     public    Twin_write_scc
  59. Twin_write_scc    proc
  60.     arg    ctl:word,reg:byte,val:byte
  61.     pushf
  62.     mov    dx,ctl
  63.     mov    al,reg
  64.     cmp    al,0
  65.     jz    @@doit        ; no need to set register 0
  66.  
  67. ;    cli            ;9/22/91 DGL... don't do this... APPLICATIONS code MUST
  68. ;                ;                make sure they have ints disabled before
  69. ;                ;                calling us.
  70.  
  71.     out    dx,al    ; select the appropriate write register.
  72.  
  73.                 ;This code fixes a tiny race in the SCC Recovery Time Pal
  74.                 ;on the Twin
  75.     jmp @@doit    ;flush execution pipeline on 286/386    9/22/91 DGL
  76.     nop            ;NOP is NECCESSARY so the jmp actually does the pipeline!!!!!
  77. @@doit:    mov    al,val
  78.     out    dx,al
  79.     popf
  80.     ret
  81. Twin_write_scc    endp
  82.  
  83. ; Read an 8530 register. Called from C as
  84. ; Twin_read_scc(int ctl,char reg);
  85.     public    Twin_read_scc
  86. Twin_read_scc    proc
  87.     arg    ctl:word,reg:byte
  88.     pushf
  89.     mov    dx,ctl
  90.     mov    al,reg
  91.     cmp    al,0
  92.     jz    @@doit    ; no need to set reg if R0
  93.  
  94. ;    cli            ;9/22/91 DGL... don't do this... APPLICATIONS code MUST
  95. ;                ;                make sure they have ints disabled before
  96. ;                ;                calling us.
  97.  
  98.     out    dx,al    ; select the appropriate write register.
  99.  
  100.                 ;This code fixes a tiny race in the SCC Recovery Time Pal
  101.                 ;on the Twin
  102.     jmp @@doit    ;flush execution pipeline on 286/386    9/22/91 DGL
  103.     nop            ;NOP is NECCESSARY so the jmp actually does the pipeline!!!!!
  104. @@doit:    in    al,dx
  105.     mov    ah,0
  106.     popf
  107.     ret
  108. Twin_read_scc    endp
  109.  
  110.     end
  111.  
  112.  
  113.