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