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

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