wok view linld/stuff/src/XMM.ASM @ rev 19883

Add openct
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Apr 03 15:12:17 2017 +0200 (2017-04-03)
parents 96b6a30a3f9a
children 04feaffdc0d9
line source
1 ;***************************************************************
2 ;****** This file is distributed under GPL
3 ;***************************************************************
4 ideal
5 %crefref
6 %noincl
7 %nomacs
8 ifdef NO386
9 p8086
10 else
11 p386
12 endif
14 group DGROUP _TEXT,_BSS
15 assume cs:DGROUP,ds:DGROUP
17 segment _BSS byte public use16 'BSS'
19 global xmm_handler:dword
20 xmm_handler dd ?
22 ends _BSS
24 segment _TEXT byte public use16 'CODE'
26 ;***************************************************************
27 ;void enable_a20_xmm();
28 ;***************************************************************
29 global _enable_a20_xmm:near
30 proc _enable_a20_xmm near
32 mov ah,03h ;global enable a20
33 call xmm_driver ;
34 mov ah,05h ;local enable a20
35 ;jmp xmm_driver ;
37 endp _enable_a20_xmm
39 ;***************************************************************
40 ;Call xmm driver addr or 0 if no xmm
41 ;void xmm_driver()
42 ;***************************************************************
43 global xmm_driver:near
44 proc xmm_driver near
46 push si
47 mov si,offset xmm_handler
48 ifndef NO386
49 cmp [si],0
50 else
51 mov ax,[word si]
52 or ax,[word si+2]
53 endif
54 jne @@gotit
56 xchg ax,cx ; save cmd
57 mov ax,4300h
58 int 2fh
59 mov bx,offset xmm_fail
60 push cs
61 pop es
62 cmp al,80h
63 jne @@err
64 mov ax,4310h
65 int 2fh
66 @@err:
67 xchg ax,cx ; restore cmd
68 push es
69 push bx
70 pop [dword si]
71 @@gotit:
72 call [dword si]
73 pop si
74 ret
75 xmm_fail:
76 xor ax,ax
77 cwd
78 retf
80 endp xmm_driver
83 ;***************************************************************
84 ;void xmm_alloc(struct image_himem *m)
85 ;struct image_himem {
86 ; 0 int fd;
87 ; 2 u32 fallback;
88 ; 6 u32 size;
89 ;10 u32 remaining;
90 ;14 u32 buf;
91 ;18 u32 *bufv;
92 ;20 char *errmsg;
93 ;22 u32 chunk_size;
94 ;26 void (*next_chunk)(struct image_himem *);
95 ;28 u16 state;
96 ;30 u16 fd2close;
97 ;};
98 ;***************************************************************
99 global _xmm_alloc:near
100 proc _xmm_alloc near
102 pop ax
103 pop bx
104 push bx
105 push ax
106 ifndef NO386
107 mov edx,[bx+6] ; m->size
108 dec edx
109 shr edx,10 ; to Kb
110 else
111 mov ax,[bx+6] ; lo m->size
112 mov dx,[bx+8] ; hi m->size
113 sub ax,1
114 sbb dx,0
115 mov cl,10
116 extrn N_LXURSH@:near
117 call N_LXURSH@
118 endif
119 inc dx
120 push bx
121 mov ah,09h ;allocate blk
122 call xmm_driver ;
123 dec ax
124 jnz @@goerr
125 ;now: dx=handle of the blk
126 mov ah,0Ch ;lock blk
127 call xmm_driver ;
128 dec ax
129 ;now: dx:bx=addr of blk
130 xchg ax,bx
131 @@goerr:
132 pop bx
133 jnz @@err
134 mov [bx+14],ax ; lo m->buf
135 mov [bx+16],dx ; hi m->buf
136 @@err:
137 ret
139 endp _xmm_alloc
141 ends _TEXT
143 end
145 ;###### END OF FILE ############################################