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

linld: check asm instructions again processor type
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jan 20 09:55:25 2017 +0100 (2017-01-20)
parents 7f92b23984dc
children 96b6a30a3f9a
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 global xmm_handler:dword
20 xmm_handler dd ?
22 ends _BSS
24 segment _TEXT byte public use16 'CODE'
26 ;***************************************************************
27 ;void enable_a20_xmm();
28 ;***************************************************************
29 global _enable_a20_xmm:near
30 proc _enable_a20_xmm near
32 mov ah,03h ;global enable a20
33 call xmm_driver ;
34 mov ah,05h ;local enable a20
35 ;jmp xmm_driver ;
37 endp _enable_a20_xmm
39 ;***************************************************************
40 ;Call xmm driver addr or 0 if no xmm
41 ;void xmm_driver()
42 ;***************************************************************
43 global xmm_driver:near
44 proc xmm_driver near
46 ifndef NO386
47 cmp [xmm_handler],0
48 else
49 mov ax,[word xmm_handler]
50 or ax,[word xmm_handler+2]
51 endif
52 jne @@gotit
54 xchg ax,cx ; save cmd
55 mov ax,4300h
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
63 int 2fh
64 @@err:
65 xchg ax,cx ; restore cmd
66 push es
67 push bx
68 pop [xmm_handler]
69 @@gotit:
70 call [xmm_handler]
71 ret
72 xmm_fail:
73 xor ax,ax
74 cwd
75 retf
77 endp xmm_driver
80 ;***************************************************************
81 ;void xmm_alloc(struct image_himem *m)
82 ;struct image_himem {
83 ; 0 int fd;
84 ; 2 u32 fallback;
85 ; 6 u32 size;
86 ;10 u32 remaining;
87 ;14 u32 buf;
88 ;18 u32 *bufv;
89 ;20 char *errmsg;
90 ;22 u32 chunk_size;
91 ;26 void (*next_chunk)(struct image_himem *);
92 ;28 u16 state;
93 ;30 u16 fd2close;
94 ;};
95 ;***************************************************************
96 global _xmm_alloc:near
97 proc _xmm_alloc near
99 pop ax
100 pop bx
101 push bx
102 push ax
103 ifndef NO386
104 mov edx,[bx+6] ; m->size
105 dec edx
106 shr edx,10 ; to Kb
107 else
108 mov ax,[bx+6] ; lo m->size
109 mov dx,[bx+8] ; hi m->size
110 sub ax,1
111 sbb dx,0
112 mov cx,10
113 @@tokblp:
114 shr dx,1
115 rcr ax,1
116 loop @@tokblp
117 endif
118 inc dx
119 push bx
120 mov ah,09h ;allocate blk
121 call xmm_driver ;
122 dec ax
123 jnz @@goerr
124 ;now: dx=handle of the blk
125 mov ah,0Ch ;lock blk
126 call xmm_driver ;
127 dec ax
128 ;now: dx:bx=addr of blk
129 xchg ax,bx
130 @@goerr:
131 pop bx
132 jnz @@err
133 mov [bx+14],ax ; lo m->buf
134 mov [bx+16],dx ; hi m->buf
135 @@err:
136 ret
138 endp _xmm_alloc
140 ends _TEXT
142 end
144 ;###### END OF FILE ############################################