home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / packet / p_aa4re / mbb35src / mbbinter.asm < prev    next >
Encoding:
Assembly Source File  |  1988-07-24  |  5.3 KB  |  139 lines

  1. ;==========================================================================;
  2. ; Interrupt handler                                                        ;
  3. ;                                                                          ;
  4. ;   Copyright 1986, 1987, 1988 by H. Roy Engehausen.  All rights reserved. ;
  5. ;   This software may be freely distributed and used, but it may not       ;
  6. ;   under any circumstances be sold by anyone other than the author.       ;
  7. ;   It may be distributed by a commercial company as long as it is         ;
  8. ;   for no cost.                                                           ;
  9. ;                                                                          ;
  10. ;   Permission is explicity granted to use this code as a model for        ;
  11. ;   other programs requiring interupt driven serial I/O as long as they    ;
  12. ;   carry this copyright notice.                                           ;
  13. ;==========================================================================;
  14.  
  15. serint_1:
  16.  
  17.         PUSH    SI                  ; Save SI so we can put
  18.         MOV     SI,interrupt_vector+0 ; Com block address in it
  19.         JMP     SHORT serint_comm   ; To common code
  20.  
  21. serint_2:
  22.  
  23.         PUSH    SI                  ; Save SI so we can put
  24.         MOV     SI,interrupt_vector+2 ; Com block address in it
  25.         JMP     SHORT serint_comm   ; To common code
  26.  
  27. serint_3:
  28.  
  29.         PUSH    SI                  ; Save SI so we can put
  30.         MOV     SI,interrupt_vector+4 ; Com block address in it
  31.         JMP     SHORT serint_comm   ; To common code
  32.  
  33. serint_4:
  34.  
  35.         PUSH    SI                  ; Save SI so we can put
  36.         MOV     SI,interrupt_vector+6 ; Com block address in it
  37.         JMP     SHORT serint_comm   ; To common code
  38.  
  39. serint_5:
  40.  
  41.         PUSH    SI                  ; Save SI so we can put
  42.         MOV     SI,interrupt_vector+8 ; Com block address in it
  43.         JMP     SHORT serint_comm   ; To common code
  44.  
  45. serint_6:
  46.  
  47.         PUSH    SI                  ; Save SI so we can put
  48.         MOV     SI,interrupt_vector+10 ; Com block address in it
  49. ;       JMP     SHORT serint_comm   ; To common code
  50.  
  51. ;==========================================================================;
  52. ; Interrupt handler - common code                                          ;
  53. ;==========================================================================;
  54.  
  55. serint_comm:
  56.  
  57.         PUSH    AX                  ; Save some registers
  58.         PUSH    CX                  ;
  59.         PUSH    DX                  ;
  60.         PUSH    DI                  ;
  61.         PUSH    DS                  ;
  62.  
  63.  
  64.         MOV     CX,CS               ; Transfer CS to DS
  65.         MOV     DS,CX               ; via CX
  66.       ASSUME DS: everything         ; We now have DS working
  67.  
  68.         MOV     DX,baseaddr[SI]     ; Get the base port address
  69.  
  70. ;==========================================================================;
  71. ; Handle 8250, QuadPort, or 4 Async Port interrupts                        ;
  72. ;==========================================================================;
  73.  
  74.  IF present_8250
  75.  
  76.         CMP     chip[SI],chip_8250  ; 8250?
  77.         JE      serint_8250         ;      Yep!
  78.         CMP     chip[SI],chip_qrqp  ; Quadram Quadport?
  79.         JE      serint_8250         ;      Yep!
  80.         CMP     chip[SI],chip_4apc  ; 4 Async Port Card?
  81.         JE      serint_8250         ;      Yep!
  82.  
  83.         JMP     serint_not_8250     ;      Nope
  84. serint_8250:
  85.  
  86.    INCLUDE 8250INT.ASM;             ; 8250 interrupt handler
  87.  
  88. serint_not_8250:                    ; Not an 8250
  89.  
  90.  ENDIF
  91.  
  92. ;==========================================================================;
  93. ; Handle 8530 interrupts                                                   ;
  94. ;==========================================================================;
  95.  
  96.  IF present_8530
  97.  
  98.         CMP     chip[SI],chip_8530  ; 8530?
  99.         JE      serint_8530         ;      Yep
  100.         JMP     serint_not_8530     ;      Nope
  101.  
  102. serint_8530:                        ;
  103.  
  104.    INCLUDE 8530INT.ASM              ; 8530 interrupt handler
  105.  
  106. serint_not_8530:                    ; Not an 8530
  107.  
  108.  ENDIF
  109.  
  110. ;==========================================================================;
  111. ; An interrupt exit to catch screwy thing                                  ;
  112. ;==========================================================================;
  113.  
  114.         MOV     AL,pic_clear        ; Tell 8259 we are done
  115.  
  116.         TEST    options[SI],opt_high_irq ; Slave 8259 involved?
  117.         JZ      serint_pic_master      ; Nope
  118.  
  119.         OUT     pic2_cmd_port,AL    ; Clear slave
  120.  
  121. serint_pic_master:
  122.         OUT     pic_cmd_port,AL     ; Clear master
  123.  
  124. ;==========================================================================;
  125. ; This is where everybody exits                                            ;
  126. ;==========================================================================;
  127.  
  128. serint_exit:                        ; Everyone exits here
  129.  
  130.       ASSUME DS: nothing            ; DS is bye bye
  131.         POP     DS                  ; Restore registers
  132.         POP     DI                  ;
  133.         POP     DX                  ;
  134.         POP     CX                  ;
  135.         POP     AX                  ;
  136.         POP     SI                  ;
  137.  
  138.         IRET                        ; Exit
  139.