wok-6.x view linld/stuff/src/XMM.ASM @ rev 21998

sylpheed: update $WGET_URL
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Oct 17 10:59:42 2019 +0200 (2019-10-17)
parents 04ffefac5707
children 5b6c86ca3faa
line source
1 ;***************************************************************
2 ;****** This file is distributed under GPL
3 ;***************************************************************
4 ideal
5 %PAGESIZE 1000
6 %crefref
7 %noincl
8 %nomacs
9 ifdef NO386
10 p8086
11 else
12 p386
13 endif
15 group DGROUP _TEXT,_BSS
16 assume cs:DGROUP,ds:DGROUP
18 segment _BSS byte public use16 'BSS'
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 proc xmm_driver near
45 push si
46 mov si,offset xmm_handler
47 ifndef NO386
48 cmp [dword si],0
49 else
50 mov cx,[word si]
51 or cx,[word si+2]
52 endif
53 jne @@gotit
55 push ax ; save cmd
56 mov ax,4300h ; installation check in al
57 int 2fh
58 mov bx,offset xmm_fail
59 push ds
60 pop es
61 cmp al,80h
62 jne @@err
63 mov ax,4310h ; get driver address in es:bx
64 int 2fh
65 @@err:
66 pop ax ; restore cmd
67 mov [si],bx
68 mov [si+2],es
69 @@gotit:
70 call [dword si] ; far ptr [si]
71 dec ax ; Z=1=OK
72 pop si
73 ret
74 xmm_fail:
75 xor ax,ax
76 cwd
77 retf
79 endp xmm_driver
82 struc image_himem ;struct image_himem {
83 fd dw ? ; 0 int fd;
84 fallback dd ? ; 2 u32 fallback;
85 size dd ? ; 6 u32 size;
86 remaining dd ? ;10 u32 remaining;
87 buf dd ? ;14 u32 buf;
88 bufv dw ? ;18 u32 *bufv;
89 errmsg dw ? ;20 char *errmsg;
90 chunk_size dd ? ;22 u32 chunk_size;
91 next_chunk dw ? ;26 void (*next_chunk)(struct image_himem *);
92 state dw ? ;28 u16 state;
93 fd2close dw ? ;30 u16 fd2close;
94 ends ;};
96 ;***************************************************************
97 ;_fastcall void xmm_alloc(struct image_himem *m)
98 ;***************************************************************
99 global @xmm_alloc$qp11image_himem:near
100 proc @xmm_alloc$qp11image_himem near
102 ifndef NO386
103 mov edx,[(image_himem bx).size] ; m->size
104 ;dec edx
105 shr edx,10 ; to Kb
106 inc edx
107 mov ah,89h ;allocate blk of EDX kilobytes
108 else
109 ;mov ax,-1
110 ;cwd
111 ;add ax,[word (image_himem bx).size] ; lo m->size
112 ;adc dx,[word (image_himem bx+2).size] ; hi m->size
113 les ax,[dword (image_himem bx).size] ; m->size
114 mov cl,16-10
115 extrn N_LXLSH@ES:near
116 call N_LXLSH@ES
117 inc dx
118 mov ah,9h ;allocate blk of DX kilobytes (<64Mb)
119 endif
120 push bx
121 call xmm_driver ;
122 jnz @@goerr
123 ;now: dx=handle of the blk
124 mov ah,0Ch ;lock blk
125 call xmm_driver ;
126 ;now: dx:bx=addr of blk
127 xchg ax,bx
128 @@goerr:
129 pop bx
130 jnz @@err
131 mov [word (image_himem bx).buf],ax ; lo m->buf
132 mov [word (image_himem bx+2).buf],dx ; hi m->buf
133 @@err:
134 ret
136 endp @xmm_alloc$qp11image_himem
138 ends _TEXT
140 end
142 ;###### END OF FILE ############################################