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

Up zstd (1.3.6)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Oct 06 15:17:20 2018 +0200 (2018-10-06)
parents 04feaffdc0d9
children 049ced0bd387
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(ah)
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 [dword si],0
50 else
51 mov cx,[word si]
52 or cx,[word si+2]
53 endif
54 jne @@gotit
56 xchg ax,cx ; save cmd
57 mov ax,4300h ; installation check in al
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 ; get driver address in es:bx
65 int 2fh
66 @@err:
67 xchg ax,cx ; restore cmd
68 mov [si],bx
69 mov [si+2],es
70 @@gotit:
71 call [dword si] ; far ptr [si]
72 dec ax ; Z=1=OK
73 pop si
74 ret
75 xmm_fail:
76 xor ax,ax
77 cwd
78 retf
80 endp xmm_driver
83 struc image_himem ;struct image_himem {
84 fd dw ? ; 0 int fd;
85 fallback dd ? ; 2 u32 fallback;
86 size dd ? ; 6 u32 size;
87 remaining dd ? ;10 u32 remaining;
88 buf dd ? ;14 u32 buf;
89 bufv dw ? ;18 u32 *bufv;
90 errmsg dw ? ;20 char *errmsg;
91 chunk_size dd ? ;22 u32 chunk_size;
92 next_chunk dw ? ;26 void (*next_chunk)(struct image_himem *);
93 state dw ? ;28 u16 state;
94 fd2close dw ? ;30 u16 fd2close;
95 ends ;};
97 ;***************************************************************
98 ;void xmm_alloc(struct image_himem *m)
99 ;***************************************************************
100 global _xmm_alloc:near
101 proc _xmm_alloc near
103 pop ax
104 pop bx
105 push bx
106 push ax
107 ifndef NO386
108 mov edx,[(image_himem bx).size] ; m->size
109 ;dec edx
110 shr edx,10 ; to Kb
111 else
112 ;mov ax,-1
113 ;cwd
114 ;add ax,[word (image_himem bx).size] ; lo m->size
115 ;adc dx,[word (image_himem bx+2).size] ; hi m->size
116 mov ax,[word (image_himem bx).size] ; lo m->size
117 mov dx,[word (image_himem bx+2).size] ; hi m->size
118 mov cl,16-10
119 extrn N_LXLSH@:near
120 call N_LXLSH@
121 endif
122 inc dx
123 push bx
124 mov ah,09h ;allocate blk of DX kilobytes
125 call xmm_driver ;
126 jnz @@goerr
127 ;now: dx=handle of the blk
128 mov ah,0Ch ;lock blk
129 call xmm_driver ;
130 ;now: dx:bx=addr of blk
131 xchg ax,bx
132 @@goerr:
133 pop bx
134 jnz @@err
135 mov [word (image_himem bx).buf],ax ; lo m->buf
136 mov [word (image_himem bx+2).buf],dx ; hi m->buf
137 @@err:
138 ret
140 endp _xmm_alloc
142 ends _TEXT
144 end
146 ;###### END OF FILE ############################################