* added compilers lcc and bcc (linux86)
[mascara-docs.git] / compilers / linux86-0.16.17 / libc / msdos / intr.c
blob22de04239da24e6df6a96701f985691c72a9eaa7
2 struct REGPACK
4 unsigned r_ax, r_bx, r_cx, r_dx;
5 unsigned r_bp, r_si, r_di, r_ds, r_es, r_flags;
6 };
8 /* DANGER DANGER -- Self modifying code! */
10 #asm
11 .text
12 save_sp:
13 dw 0
14 #endasm
16 intr(intr, regs)
17 int intr;
18 struct REGPACK * regs;
20 #asm
21 mov bx,sp
22 push bp
23 push si
24 push di
25 push es
26 push ds
28 mov ax,[bx+2]
29 seg cs
30 mov [intr_inst+1],al
31 seg cs
32 mov [save_sp],sp
34 mov bx,[bx+4]
36 mov ah,[bx+18] ! Flags low byte
37 sahf
39 mov ax,[bx]
40 push [bx+2]
41 mov cx,[bx+4]
42 mov dx,[bx+6]
43 mov bp,[bx+8]
44 mov si,[bx+10]
45 mov di,[bx+12]
46 mov es,[bx+16]
47 mov ds,[bx+14]
48 pop bx
50 intr_inst:
51 int $FF ! Must be a real int .. consider protected mode.
53 seg cs ! Could be SS as DS==SS
54 mov sp,[save_sp]
55 seg cs
56 mov [save_sp],ds
57 pop ds
58 push [save_sp]
60 push bx
61 mov bx,sp
62 mov bx,[bx+12]
64 mov [bx],ax
65 pop [bx+2]
66 mov [bx+4],cx
67 mov [bx+6],dx
68 mov [bx+8],bp
69 mov [bx+10],si
70 mov [bx+12],di
71 pop [bx+14]
72 mov [bx+16],es
73 pushf
74 pop [bx+18]
76 pop es
77 pop di
78 pop si
79 pop bp
81 #endasm