home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c010 / 1.ddi / FLILIB3.ZIP / FLISRC3.ZIP / SYSINT.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-08-29  |  1.6 KB  |  97 lines

  1.  
  2.     TITLE    i86_sysint
  3.  
  4.     dosseg
  5.     .model    large
  6.     .code
  7.  
  8.  
  9.     PUBLIC _i86_sysint
  10.     ;i86_sysint(interrupt, inregs, outregs)
  11.     ;Does a software interrupt from C.
  12.     ;Returns flags in ax
  13.     ;interrupt is 16 bit saying which interrupt to generate.
  14.     ;inregs and outregs are the following structure:
  15.     ;struct i86_byte_regs 
  16.     ;    {
  17.     ;    unsigned char al, ah, bl, bh, cl, ch, dl, dh;
  18.     ;    unsigned int si, di, ds, es;
  19.     ;    };
  20.     ;Inregs and outregs may usually point to the same structure
  21.     ;This generates a warning during assembly but works ok.
  22. _i86_sysint PROC far
  23.     push bp
  24.     mov bp,sp
  25.     push bx
  26.     push si
  27.     push di
  28.     push es
  29.     push ds
  30.  
  31.     ;grab interrupt number and use it to modify intit code    (no ROM for me!)
  32.     mov ax,[bp+4+2]
  33.     mov byte ptr cs:intit+1,al
  34.  
  35.     ;point ds:di to input parameters
  36.     lds di,[bp+6+2]
  37.     mov ax,[di]
  38.     mov bx,[di+2]
  39.     mov cx,[di+4]
  40.     mov dx,[di+6]
  41.     mov si,[di+8]
  42.     push ax
  43.     mov ax,[di+14]
  44.     mov es,ax
  45.     mov ax,ss
  46.     mov cs:oss,ax
  47.     mov cs:osp,sp
  48.     pop ax
  49.     lds di,[di+10]
  50. intit:
  51.     int 0
  52.     cli
  53.     mov cs:oax,ax
  54.     mov ax,cs:oss
  55.     mov ss,ax
  56.     mov sp,cs:osp
  57.     sti
  58.     pop ax    ;
  59.     mov ax,cs:oax
  60.         ;save ds:di and point 'em to output parameters
  61.     push ds
  62.     push di
  63.     lds di,[bp+10+2]
  64.     mov [di],ax
  65.     mov [di+2],bx
  66.     mov [di+4],cx
  67.     mov [di+6],dx
  68.     mov [di+8],si
  69.         pop ax  ;'di' into ax
  70.     mov [di+10],ax
  71.         pop ax  ;'ds' into ax
  72.     mov [di+12],ax
  73.     mov ax,es
  74.     mov [di+14],ax
  75.  
  76.     ;move flags to ax (the return value...)
  77.     pushf    
  78.     pop ax
  79.  
  80.     pop ds
  81.     pop es
  82.     pop di
  83.     pop si
  84.     pop bx
  85.     pop bp
  86.     ret
  87. oax equ this word
  88.     dw 0
  89. oss equ this word
  90.     dw 0
  91. osp equ this word
  92.     dw 0
  93. _i86_sysint endp
  94.  
  95.  
  96. END
  97.