wok-6.x view linld/stuff/src/XMM.ASM @ rev 20528
linld: pascal convention calls
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Nov 09 16:37:55 2018 +0100 (2018-11-09) |
parents | 049ced0bd387 |
children | 65366955881f |
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 xmm_handler dd ?
21 ends _BSS
23 segment _TEXT byte public use16 'CODE'
25 ;***************************************************************
26 ;void enable_a20_xmm();
27 ;***************************************************************
28 global _enable_a20_xmm:near
29 proc _enable_a20_xmm near
31 mov ah,03h ;global enable a20
32 call xmm_driver ;
33 mov ah,05h ;local enable a20
34 ;jmp xmm_driver ;
36 endp _enable_a20_xmm
38 ;***************************************************************
39 ;Call xmm driver addr or 0 if no xmm
40 ;void xmm_driver(ah)
41 ;***************************************************************
42 proc xmm_driver near
44 push si
45 mov si,offset xmm_handler
46 ifndef NO386
47 cmp [dword si],0
48 else
49 mov cx,[word si]
50 or cx,[word si+2]
51 endif
52 jne @@gotit
54 xchg ax,cx ; save cmd
55 mov ax,4300h ; installation check in al
56 int 2fh
57 mov bx,offset xmm_fail
58 push cs
59 pop es
60 cmp al,80h
61 jne @@err
62 mov ax,4310h ; get driver address in es:bx
63 int 2fh
64 @@err:
65 xchg ax,cx ; restore cmd
66 mov [si],bx
67 mov [si+2],es
68 @@gotit:
69 call [dword si] ; far ptr [si]
70 dec ax ; Z=1=OK
71 pop si
72 ret
73 xmm_fail:
74 xor ax,ax
75 cwd
76 retf
78 endp xmm_driver
81 struc image_himem ;struct image_himem {
82 fd dw ? ; 0 int fd;
83 fallback dd ? ; 2 u32 fallback;
84 size dd ? ; 6 u32 size;
85 remaining dd ? ;10 u32 remaining;
86 buf dd ? ;14 u32 buf;
87 bufv dw ? ;18 u32 *bufv;
88 errmsg dw ? ;20 char *errmsg;
89 chunk_size dd ? ;22 u32 chunk_size;
90 next_chunk dw ? ;26 void (*next_chunk)(struct image_himem *);
91 state dw ? ;28 u16 state;
92 fd2close dw ? ;30 u16 fd2close;
93 ends ;};
95 ;***************************************************************
96 ;pascal void xmm_alloc(struct image_himem *m)
97 ;***************************************************************
98 global @xmm_alloc$qp11image_himem:near
99 proc @xmm_alloc$qp11image_himem near
101 pop ax
102 pop bx
103 push ax
104 ret ; TO BE FIXED
105 ifndef NO386
106 mov edx,[(image_himem bx).size] ; m->size
107 ;dec edx
108 shr edx,10 ; to Kb
109 inc edx
110 mov ah,89h ;allocate blk of EDX kilobytes
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 inc dx
122 mov ah,9h ;allocate blk of DX kilobytes (<64Mb)
123 endif
124 push bx
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$qp11image_himem
142 ends _TEXT
144 end
146 ;###### END OF FILE ############################################