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

Up glza (0.11.4)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat May 21 21:38:29 2022 +0000 (2022-05-21)
parents 6b6d14c9f7e9
children
line source
1 ;***************************************************************
2 ;****** This file is distributed under GPL
3 ;***************************************************************
4 ideal
5 %PAGESIZE 255
6 %crefref
7 %noincl
8 %nomacs
10 include "common.inc"
12 p8086
14 group DGROUP _TEXT
15 assume cs:DGROUP,ds:DGROUP
17 segment _TEXT byte public use16 'CODE'
19 ;***************************************************************
20 ;void enable_a20_xmm();
21 ;***************************************************************
22 global _enable_a20_xmm:near
23 proc _enable_a20_xmm near
25 mov ch,03h ;global enable a20
26 call xmm_driver ;
27 mov ch,05h ;local enable a20
28 ;jmp xmm_driver ;
30 endp _enable_a20_xmm
32 ;***************************************************************
33 ;Call xmm driver addr (success: ax=1)
34 ;void xmm_driver(ah)
35 ;***************************************************************
36 proc xmm_driver near
38 pop bx ; \
39 push cs ; fake far call
40 push bx ; /
41 mov ax,4300h ; installation check in al
42 int 2fh
43 cmp al,80h
44 jne @@xmm_fail
45 mov ax,4310h ; get driver address in es:bx
46 int 2fh
47 xchg ax,cx ; restore cmd
49 push es ; jmp far es:bx
50 push bx ; avoid 08h 0Fh 12h and 8Fh functions using bx
51 @@xmm_fail:
52 retf
54 endp xmm_driver
56 ifdef WITH_XMM_ALLOC
57 include "himem.inc"
59 ;***************************************************************
60 ;_fastcall void xmm_alloc(si:struct image_himem *m)
61 ;***************************************************************
62 global @xmm_alloc$qp11image_himem:near
63 proc @xmm_alloc$qp11image_himem near
65 extrn _cmdnum:dword
66 ifdef CPUTYPE
67 skip_alloc = (byte _cmdnum+20)
68 else
69 skip_alloc = (byte _cmdnum+16)
70 endif
71 LARGE_XMM_ALLOC = 1
72 ifdef LARGE_XMM_ALLOC
73 mov ch,89h ;allocate blk of EDX kilobytes
74 test [skip_alloc],ch
75 jne @@err
76 extrn _cpu386:byte
77 test [_cpu386],ch
78 je @@not386
79 p386
80 mov edx,[(image_himem si).size] ; m->size
81 ;dec edx
82 shr edx,10 ; to Kb
83 inc edx
84 call xmm_driver ;
85 dec ax ; Z=OK
86 jz @@gotit
87 @@not386:
88 mov cl,16-10
89 else
90 mov cl,16-10
91 test [skip_alloc],cl ; 06h & ('*'=2Ah) = 02h
92 jne @@err
93 endif
94 p8086
95 ;mov ax,-1
96 ;cwd
97 ;add ax,[word (image_himem si).size] ; lo m->size
98 ;adc dx,[word (image_himem si+2).size] ; hi m->size
99 les ax,[dword (image_himem si).size] ; m->size
100 extrn N_LXLSH@ES:near
101 call N_LXLSH@ES
102 inc dx
103 mov ch,9h ;allocate blk of DX kilobytes (<64Mb)
104 call xmm_driver ;
105 dec ax ; Z=OK
106 jnz @@err
107 @@gotit:
108 ;now: dx=handle of the blk
109 mov ch,0Ch ;lock blk
110 call xmm_driver ;
111 ;now: dx:bx=addr of blk
112 ;dec ax ; Z=OK
113 ;jnz @@err
114 mov [word (image_himem si).buf],bx ; lo m->buf
115 mov [word (image_himem si+2).buf],dx ; hi m->buf
116 @@err:
117 ret
119 endp @xmm_alloc$qp11image_himem
120 endif
122 ends _TEXT
124 end
126 ;###### END OF FILE ############################################