wok-current view linld/stuff/src/JUMP.ASM @ rev 24095

Add jpegoptim
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Sep 01 14:04:21 2021 +0000 (2021-09-01)
parents 06547d8cf241
children 530dacfd6585
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 ifdef NO386
13 p8086
14 else
15 p386
16 endif
18 group DGROUP _TEXT
19 assume cs:DGROUP,ds:DGROUP
21 segment _TEXT byte public use16 'CODE'
23 ;***************************************************************
24 ;void dos_shutdown()
25 ;***************************************************************
27 macro dos_shutdown
28 xor bx,bx
29 ifdef QUICK_BOOT
30 extrn _cmdnum:dword
31 ifdef CPUTYPE
32 quickboot = (byte _cmdnum+24)
33 else
34 quickboot = (byte _cmdnum+20)
35 endif
36 cmp bl,[quickboot]
37 mov ds,bx
38 jne skip_shutdown
39 else
40 mov ds,bx
41 endif
42 ifndef NO386
43 push [dword bx+4] ; save step
44 mov [word bx+4],offset step19
45 else
46 mov ax,offset step19
47 xchg ax,[word bx+4]
48 push [word bx+6]
49 push ax ; save step
50 endif
51 mov [word cs:sssp],sp
52 ;cmp [byte bx+7],0F0h
53 ;jnc notdos
54 mov [bx+6],cs
55 pushf
56 pushf
57 pop ax
58 inc ah ; set TF
59 push ax
60 popf
61 call [dword bx+4*19h]
62 notdos:
63 ifndef NO386
64 lss sp,[dword cs:sssp]
65 else
66 lds ax,[dword cs:sssp]
67 push ds
68 pop ss
69 xchg ax,sp
70 endif
71 xor si,si
72 mov ds,si
73 pop [dword si+4] ; restore step
74 skip_shutdown:
75 endm
76 macro step19code
77 step19:
78 push si
79 push ds
80 mov si,sp
81 lds si,[dword ss:si+4] ; read cs:ip
82 cmp [word si],19CDh ; int 19h ?
83 pop ds
84 pop si
85 je notdos
86 iret
87 endm
90 ;***************************************************************
91 ;void boot_kernel();
92 ;****** Never returns
93 ;***************************************************************
94 proc _boot_kernel near
96 ifdef NO386
97 p8086
98 else
99 p386
100 endif
101 ;cli ; we start doing destructive things to DOS
102 extrn sssp:word
103 mov ax,[sssp+2]
104 mov es,ax
105 extrn _cmdstr:word
106 _cmdline = _cmdstr+0
107 mov si,[_cmdline]
108 mov di,8000h
109 mov cx,1000h ; 4k for cmdline + 4k up to sp
110 rep
111 movsw
112 push es
113 pop ss
114 mov sp,di
116 ifdef LINUX001
117 mov dx,2000h
118 global _csip_hilo:word
119 org $-2
120 _csip_hilo dw ?
121 xchg al,dh ; 9020 / 9000
122 else
123 mov al,20h ; 9020:0
124 xor dx,dx
125 endif
126 push ax
127 push dx ; 0000 / 0042
129 mov cl,1 ; load high ?
130 org $-1
131 global _pm_low:byte
132 _pm_low db ?
133 push cx
134 ifdef IPXE
135 mov ax,[word ss:024Ch]
136 xor ax,2b30h ; ipxe ?
137 loopne @@notipxe
138 else
139 loop @@truebzimage
140 endif
142 ; finish loading
143 extrn @last_ditch$qv:near
144 push cs
145 call @last_ditch$qv
146 ifdef SHUTDOWN
147 dos_shutdown ; clear si; ds=0; kill VCPI
148 push cs
149 pop ds
150 else
151 xor si,si
152 endif
154 @@truebzimage:
155 @@notipxe:
156 pop cx
157 loop @@isbzimage
159 ; prepare memcpy32 size & srcofs param to move zImage pm
160 ifndef NO386
161 push 8 ; size hi
162 else
163 mov dx,8
164 push dx ; size hi
165 endif
166 push si ; size lo=up to 512k
168 include "himem.inc"
170 extrn _imgs:image_himem
171 ifdef NO386
172 les ax,[_imgs.fallback] ; src ofs = pm.fallback
173 push es
174 push ax
175 else
176 push [_imgs.fallback] ; src ofs = pm.fallback
177 endif
179 ;in al,70h
180 ;or al,80h ; disable NMI
181 ;out 70h,al
183 push si ; src seg=0
184 inc cx
185 push cx ; dst ofs hi
186 push si ; dst ofs lo : 64k = 0x10000
188 ; self move
189 extrn gdt_data
190 mov cx,offset gdt_data+8
191 ;xor di,di ; A000 -9000 -0800(>movedend)
193 ifdef NO386
194 mov ax,ss
195 add ax,800h+(4096/16)
196 push ax ; topseg()+0x0900
197 else
198 push 9800h+(4096/16) ; 4096 bytes for cmdline
199 endif
200 pop es
201 push es
203 ifdef ELKS
204 call near @@movsb@jmp ; movsb; pop cs ; ds=es=ss
205 elseifdef MOVE_SETUP
206 call near @@movsb@jmp ; movsb; pop cs ; ds=es=ss
207 else
208 xor di,di
209 rep
210 movsb
211 call near @@isbzimage ; pop cs ; ds=es=ss
212 endif
214 ;mov es,cx
215 ;mov [es:15*4+2],cs ; update int15/88h hook
217 extrn memcpy32:near
218 call memcpy32
220 ifdef MOVE_SETUP
221 mov si,0
222 global _rm_offset:word
223 org $-2
224 _rm_offset dw ?
225 ;xor di,di
226 ;mov cx,8000h
227 ;sub cx,si
228 ;rep
229 ; movsb
230 endif
232 ifdef ELKS
233 ifdef MOVE_SETUP
234 ifndef NO386
235 mov eax,[dword si+1E6h]
236 xor eax,'SKLE'
237 else
238 mov ax,[si+1E6h]
239 xor ax,'LE'
240 jne @@notelks
241 mov ax,[si+1E8h]
242 xor ax,'SK'
243 endif
244 else
245 ifndef NO386
246 mov eax,[dword 1E6h]
247 xor eax,'SKLE'
248 else
249 mov ax,[1E6h]
250 xor ax,'LE'
251 jne @@notelks
252 mov ax,[1E8h]
253 xor ax,'SK'
254 endif
255 endif
256 jne @@notelks
257 mov cx,100h ; DS=ES=SS=0100
258 mov ss,cx
259 push ss
260 pop es
261 mov cl,20h ; CS=0120
262 push cx
263 push ax ; IP=0000
264 endif
265 ifdef MOVE_SETUP
266 @@notelks:
267 mov ch,7Eh
268 @@movsb@jmp:
269 xor di,di
270 rep
271 movsb
272 else
273 ifdef ELKS
274 xchg ax,si
275 mov ch,7Eh ; 0Ah min, 7Eh max
276 @@movsb@jmp:
277 xor di,di
278 rep
279 movsb
280 @@notelks:
281 endif
282 endif
283 @@isbzimage:
284 push ss
285 pop ds
286 push ss
287 pop es
288 ifndef NO386
289 push ss
290 pop fs
291 push ss
292 pop gs
293 endif
294 assume nothing
295 assume cs:DGROUP
296 retf
298 ifdef SHUTDOWN
299 step19code
300 endif
302 endp _boot_kernel
304 ends _TEXT
306 end
308 ;###### END OF FILE ############################################