home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c185 / 2.ddi / OWLSRC.EXE / CSCAPE / SOURCE / PCOINT86.ASM < prev    next >
Encoding:
Assembly Source File  |  1989-06-30  |  2.1 KB  |  101 lines

  1. ; pcoint86.asm
  2. ;
  3. ; 12/13/88 by Ted
  4. ;
  5. ; Dos/Bios interrupt function.
  6. ;
  7. ; Copyright (c) 1988, 1989 Oakland Group Inc.
  8. ; ALL RIGHTS RESERVED
  9. ;
  10. ;------------------------REVISION HISTORY--------------------------------------;
  11. ;------------------------------------------------------------------------------;
  12. include    PCDECL.MAC
  13.  
  14. regstruc struc
  15.     rax dw 0
  16.     rbx dw 0
  17.     rcx dw 0
  18.     rdx dw 0
  19.     res dw 0
  20.     rds dw 0
  21.     rsi dw 0
  22.     rdi dw 0
  23. regstruc ends
  24.  
  25.     PSEG
  26. ;------------------------------------------------------------------------------;
  27. ; unsigned _oakint86(unsigned intno, regstruc *regs, boolean esin);
  28. ;    Puts the values from regstruc into the registers and executes the specified
  29. ;    interrupt. Fills the structure up again with the outgoing register values.
  30. ; NOTE: Ignores es and ds unless esin is TRUE, in which case es is used as input
  31. ;    and es and ds are returned in the regs structure.
  32.  
  33. pubproc DIGPRIV    _oakint86 <intno, regs, dptr, esin>
  34.     push bp
  35.     mov bp,sp
  36.     pushm <ds, es, si, di>
  37.  
  38.     mov    ax,[bp].intno    ;get interrupt #
  39.     mov bx, offset do_int
  40.     mov cs:[bx+1], al    ;poke it into do_int function
  41.  
  42.     mov    bx,[bp].regs    ;get source registers
  43. IF FAR_DATA
  44.     mov ds, [bp].regs+2    ;get regs segment
  45. ELSE
  46.     mov [bp].intno, ds    ; intno is already in ax; save ds in intno
  47. ENDIF
  48.  
  49.     mov si, [bx].rsi
  50.     mov di, [bx].rdi
  51.     mov dx, [bx].rdx
  52.     mov cx, [bx].rcx
  53. cmp word ptr [bp].esin, 0
  54. je noes
  55.     mov es, [bx].res
  56. noes:
  57. ;;    mov ax, [bx].rds
  58. ;;    push ax
  59.     mov ax, [bx].rax
  60.     mov bx, [bx].rbx
  61. ;;    pop ds
  62.  
  63.     push bp
  64.     call near ptr do_int
  65.     pop bp
  66.  
  67.     pushf
  68.     push ds
  69.     push bx
  70.     mov    bx,[bp].regs    ;get source registers
  71. IF FAR_DATA
  72.     mov ds, [bp].regs+2    ;get regs segment
  73. ELSE
  74.     mov ds, [bp].intno
  75. ENDIF
  76.     pop [bx].rbx
  77.     pop [bx].rds
  78.     mov [bx].rax, ax
  79.     mov [bx].res, es
  80.     pop ax                ; get flags into ax for return
  81.  
  82.     mov [bx].rcx, cx
  83.     mov [bx].rdx, dx
  84.     mov [bx].rdi, di
  85.     mov [bx].rsi, si
  86.  
  87.     popm <di, si, es, ds>
  88.     pop    bp
  89.     ret
  90. endproc _oakint86
  91.  
  92. do_int proc near
  93.     int 10h
  94.     ret
  95. do_int endp
  96. ; ---------------------------------------------------------------- ;
  97.     ENDPS
  98.     end
  99. ; ---------------------------------------------------------------- ;
  100.  
  101.