rev |
line source |
pascal@19515
|
1 ;***************************************************************
|
pascal@19515
|
2 ;****** This file is distributed under GPL
|
pascal@19515
|
3 ;***************************************************************
|
pascal@19515
|
4 ideal
|
pascal@21984
|
5 %PAGESIZE 1000
|
pascal@19515
|
6 %crefref
|
pascal@19515
|
7 %noincl
|
pascal@19515
|
8 %nomacs
|
pascal@19636
|
9 ifdef NO386
|
pascal@19636
|
10 p8086
|
pascal@19636
|
11 else
|
pascal@19515
|
12 p386
|
pascal@19636
|
13 endif
|
pascal@19515
|
14
|
pascal@19515
|
15 group DGROUP _TEXT,_BSS
|
pascal@19515
|
16 assume cs:DGROUP,ds:DGROUP
|
pascal@19515
|
17
|
pascal@19515
|
18 segment _BSS byte public use16 'BSS'
|
pascal@19515
|
19
|
pascal@19515
|
20 xmm_handler dd ?
|
pascal@19515
|
21
|
pascal@19515
|
22 ends _BSS
|
pascal@19515
|
23
|
pascal@19515
|
24 segment _TEXT byte public use16 'CODE'
|
pascal@19515
|
25
|
pascal@19515
|
26 ;***************************************************************
|
pascal@19515
|
27 ;void enable_a20_xmm();
|
pascal@19515
|
28 ;***************************************************************
|
pascal@19515
|
29 global _enable_a20_xmm:near
|
pascal@19515
|
30 proc _enable_a20_xmm near
|
pascal@19515
|
31
|
pascal@19515
|
32 mov ah,03h ;global enable a20
|
pascal@19515
|
33 call xmm_driver ;
|
pascal@19515
|
34 mov ah,05h ;local enable a20
|
pascal@19515
|
35 ;jmp xmm_driver ;
|
pascal@19515
|
36
|
pascal@19515
|
37 endp _enable_a20_xmm
|
pascal@19515
|
38
|
pascal@19515
|
39 ;***************************************************************
|
pascal@19515
|
40 ;Call xmm driver addr or 0 if no xmm
|
pascal@20142
|
41 ;void xmm_driver(ah)
|
pascal@19515
|
42 ;***************************************************************
|
pascal@19515
|
43 proc xmm_driver near
|
pascal@19515
|
44
|
pascal@19876
|
45 push si
|
pascal@19876
|
46 mov si,offset xmm_handler
|
pascal@19636
|
47 ifndef NO386
|
pascal@20142
|
48 cmp [dword si],0
|
pascal@19515
|
49 jne @@gotit
|
pascal@21757
|
50 push ax ; save cmd
|
pascal@20142
|
51 mov ax,4300h ; installation check in al
|
pascal@22632
|
52 else
|
pascal@22632
|
53 push ax ; save cmd
|
pascal@22632
|
54 lodsw
|
pascal@22632
|
55 or ax,[word si]
|
pascal@22632
|
56 jne @@gotit
|
pascal@22632
|
57 mov ah,43h ; installation check in al
|
pascal@22632
|
58 endif
|
pascal@22632
|
59
|
pascal@19515
|
60 int 2fh
|
pascal@19515
|
61 mov bx,offset xmm_fail
|
pascal@21757
|
62 push ds
|
pascal@19515
|
63 pop es
|
pascal@19515
|
64 cmp al,80h
|
pascal@19515
|
65 jne @@err
|
pascal@20142
|
66 mov ax,4310h ; get driver address in es:bx
|
pascal@19515
|
67 int 2fh
|
pascal@19515
|
68 @@err:
|
pascal@22632
|
69 ifndef NO386
|
pascal@21757
|
70 pop ax ; restore cmd
|
pascal@20426
|
71 mov [si],bx
|
pascal@20426
|
72 mov [si+2],es
|
pascal@19515
|
73 @@gotit:
|
pascal@20426
|
74 call [dword si] ; far ptr [si]
|
pascal@22632
|
75 else
|
pascal@22632
|
76 mov [si-2],bx
|
pascal@22632
|
77 mov [si],es
|
pascal@22632
|
78 @@gotit:
|
pascal@22632
|
79 pop ax ; restore cmd
|
pascal@22632
|
80 call [dword si-2] ; far ptr [si-2]
|
pascal@22632
|
81 endif
|
pascal@20142
|
82 dec ax ; Z=1=OK
|
pascal@19876
|
83 pop si
|
pascal@19515
|
84 ret
|
pascal@19538
|
85 xmm_fail:
|
pascal@19538
|
86 xor ax,ax
|
pascal@19538
|
87 cwd
|
pascal@19538
|
88 retf
|
pascal@19538
|
89
|
pascal@19515
|
90 endp xmm_driver
|
pascal@19515
|
91
|
pascal@22007
|
92 include "himem.inc"
|
pascal@20142
|
93
|
pascal@19515
|
94 ;***************************************************************
|
pascal@20538
|
95 ;_fastcall void xmm_alloc(struct image_himem *m)
|
pascal@19515
|
96 ;***************************************************************
|
pascal@20528
|
97 global @xmm_alloc$qp11image_himem:near
|
pascal@20528
|
98 proc @xmm_alloc$qp11image_himem near
|
pascal@19515
|
99
|
pascal@19515
|
100 ifndef NO386
|
pascal@20142
|
101 mov edx,[(image_himem bx).size] ; m->size
|
pascal@20142
|
102 ;dec edx
|
pascal@19515
|
103 shr edx,10 ; to Kb
|
pascal@20486
|
104 inc edx
|
pascal@20486
|
105 mov ah,89h ;allocate blk of EDX kilobytes
|
pascal@19515
|
106 else
|
pascal@20142
|
107 ;mov ax,-1
|
pascal@20142
|
108 ;cwd
|
pascal@20142
|
109 ;add ax,[word (image_himem bx).size] ; lo m->size
|
pascal@20142
|
110 ;adc dx,[word (image_himem bx+2).size] ; hi m->size
|
pascal@21791
|
111 les ax,[dword (image_himem bx).size] ; m->size
|
pascal@20142
|
112 mov cl,16-10
|
pascal@21791
|
113 extrn N_LXLSH@ES:near
|
pascal@21791
|
114 call N_LXLSH@ES
|
pascal@20486
|
115 inc dx
|
pascal@20486
|
116 mov ah,9h ;allocate blk of DX kilobytes (<64Mb)
|
pascal@19515
|
117 endif
|
pascal@19538
|
118 push bx
|
pascal@19515
|
119 call xmm_driver ;
|
pascal@19538
|
120 jnz @@goerr
|
pascal@19515
|
121 ;now: dx=handle of the blk
|
pascal@19515
|
122 mov ah,0Ch ;lock blk
|
pascal@19515
|
123 call xmm_driver ;
|
pascal@19515
|
124 ;now: dx:bx=addr of blk
|
pascal@19515
|
125 xchg ax,bx
|
pascal@19538
|
126 @@goerr:
|
pascal@19538
|
127 pop bx
|
pascal@19538
|
128 jnz @@err
|
pascal@20142
|
129 mov [word (image_himem bx).buf],ax ; lo m->buf
|
pascal@20142
|
130 mov [word (image_himem bx+2).buf],dx ; hi m->buf
|
pascal@19515
|
131 @@err:
|
pascal@19538
|
132 ret
|
pascal@19538
|
133
|
pascal@20528
|
134 endp @xmm_alloc$qp11image_himem
|
pascal@19515
|
135
|
pascal@19515
|
136 ends _TEXT
|
pascal@19515
|
137
|
pascal@19515
|
138 end
|
pascal@19515
|
139
|
pascal@19515
|
140 ;###### END OF FILE ############################################
|