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@19636
|
8 ifdef NO386
|
pascal@19636
|
9 p8086
|
pascal@19636
|
10 else
|
pascal@19515
|
11 p386
|
pascal@19636
|
12 endif
|
pascal@19515
|
13
|
pascal@19515
|
14 group DGROUP _TEXT,_DATA,_BSS
|
pascal@19515
|
15 assume cs:DGROUP,ds:DGROUP
|
pascal@19515
|
16
|
pascal@19515
|
17 segment _DATA byte public use16 'DATA'
|
pascal@19515
|
18
|
pascal@20451
|
19 global _heap_top
|
pascal@20451
|
20 extrn _bss_end
|
pascal@19546
|
21 _heap_top dw _bss_end
|
pascal@19546
|
22 msg_hang db "High mem corrupted - not exiting to DOS"
|
pascal@19546
|
23 msg_crlf db 13,10,0
|
pascal@20451
|
24 vcpi_alloc_err db "VCPI "
|
pascal@20451
|
25 msg_malloc db "malloc error",0
|
pascal@19825
|
26 ifdef EXTRA
|
pascal@19825
|
27 tazboot_cmd db "tazboot.cmd",0
|
pascal@19825
|
28 endif
|
pascal@19515
|
29
|
pascal@19515
|
30 ends _DATA
|
pascal@19515
|
31
|
pascal@19515
|
32 segment _BSS byte public use16 'BSS'
|
pascal@19515
|
33
|
pascal@19515
|
34 global _no_exit:byte
|
pascal@19515
|
35 _no_exit db ?
|
pascal@19515
|
36 filecnt db ? ; in fact 0 minus file count...
|
pascal@19515
|
37 nextfilename dw ?
|
pascal@19571
|
38 ifdef LARGE_IMAGES
|
pascal@19571
|
39 curdata dw ?
|
pascal@19571
|
40 endif
|
pascal@19825
|
41 ifdef EXTRA
|
pascal@19825
|
42 ultoabuf db 12 dup (?)
|
pascal@19825
|
43 endif
|
pascal@19515
|
44
|
pascal@19515
|
45 ends _BSS
|
pascal@19515
|
46
|
pascal@19515
|
47 segment _TEXT byte public use16 'CODE'
|
pascal@19515
|
48
|
pascal@19515
|
49 ;***************************************************************
|
pascal@19538
|
50 ;char* strcpy(const char* a, const char* b);
|
pascal@19580
|
51 ;char* strcat(const char* a, const char* b);
|
pascal@19634
|
52 ;char* strcatb(const char* a, const char* b);
|
pascal@19538
|
53 ;***************************************************************
|
pascal@19826
|
54 global _strcatb:near
|
pascal@19826
|
55 proc _strcatb near
|
pascal@19538
|
56
|
pascal@19826
|
57 ifdef EXTRA
|
pascal@20142
|
58 mov cl,7Fh
|
pascal@19580
|
59 db 0bbh ; mov bx,imm opcode
|
pascal@19580
|
60 global _strcat:near
|
pascal@19580
|
61 _strcat:
|
pascal@20142
|
62 mov cl,80h
|
pascal@19634
|
63 db 0bbh ; mov bx,imm opcode
|
pascal@19826
|
64 global _strcpy:near
|
pascal@19826
|
65 _strcpy:
|
pascal@20142
|
66 xor cx,cx
|
pascal@19826
|
67 endif
|
pascal@19538
|
68 pop ax ;caller return address
|
pascal@20142
|
69 pop dx ; a
|
pascal@19538
|
70 pop bx ; b
|
pascal@19538
|
71 push bx
|
pascal@20142
|
72 push dx
|
pascal@19538
|
73 push ax
|
pascal@19538
|
74 push si
|
pascal@20142
|
75 mov si,dx
|
pascal@19826
|
76 ifdef EXTRA
|
pascal@20142
|
77 jcxz @@nocat
|
pascal@19826
|
78 endif
|
pascal@19538
|
79 @@catlp:
|
pascal@19538
|
80 lodsb
|
pascal@19538
|
81 cmp al,0
|
pascal@19538
|
82 jne @@catlp
|
pascal@19538
|
83 dec si
|
pascal@19826
|
84 ifdef EXTRA
|
pascal@20142
|
85 cmp dx,si
|
pascal@20142
|
86 adc al,cl ; set S when dx != si or cl = 80
|
pascal@20142
|
87 mov al,20h
|
pascal@20142
|
88 jns @@cpyhead
|
pascal@19826
|
89 endif
|
pascal@19538
|
90 @@nocat:
|
pascal@19538
|
91 @@cpylp:
|
pascal@20142
|
92 mov al,[bx]
|
pascal@20142
|
93 inc bx
|
pascal@20142
|
94 @@cpyhead:
|
pascal@19538
|
95 mov [si],al
|
pascal@19538
|
96 inc si
|
pascal@19538
|
97 cmp al,0
|
pascal@19538
|
98 jne @@cpylp
|
pascal@20142
|
99 strfound:
|
pascal@20142
|
100 xchg ax,dx
|
pascal@20142
|
101 strend:
|
pascal@19538
|
102 pop si
|
pascal@20142
|
103 ret
|
pascal@19538
|
104
|
pascal@19826
|
105 endp _strcatb
|
pascal@19538
|
106
|
pascal@19538
|
107
|
pascal@20146
|
108 ifdef EXTRA
|
pascal@20146
|
109 p8086
|
pascal@20146
|
110 ;***************************************************************
|
pascal@20146
|
111 ;char strstr(const char* a,const char* b);
|
pascal@20146
|
112 ;***************************************************************
|
pascal@20146
|
113 global _strstr:near
|
pascal@20146
|
114 proc _strstr near
|
pascal@20146
|
115
|
pascal@20146
|
116 pop ax ;caller return address
|
pascal@20146
|
117 pop dx ; a
|
pascal@20146
|
118 pop cx ; b
|
pascal@20146
|
119 push cx
|
pascal@20146
|
120 push dx
|
pascal@20146
|
121 push ax
|
pascal@20146
|
122 push si
|
pascal@20146
|
123 @@loop:
|
pascal@20146
|
124 xor ax,ax
|
pascal@20146
|
125 mov si,dx
|
pascal@20146
|
126 cmp [si],al ; *a
|
pascal@20146
|
127 jz strend ; return ax = NULL
|
pascal@20146
|
128 mov bx,cx
|
pascal@20146
|
129 @@match:
|
pascal@20146
|
130 or ah,[bx] ; *b
|
pascal@20146
|
131 jz strfound
|
pascal@20146
|
132 inc bx
|
pascal@20146
|
133 lodsb
|
pascal@20146
|
134 sub ah,al
|
pascal@20146
|
135 jz @@match
|
pascal@20146
|
136 inc dx
|
pascal@20146
|
137 jmp @@loop
|
pascal@20146
|
138
|
pascal@20146
|
139 endp _strstr
|
pascal@20146
|
140
|
pascal@20146
|
141
|
pascal@20146
|
142 ;***************************************************************
|
pascal@20146
|
143 ;int strcmp(const char* a,const char* b);
|
pascal@20146
|
144 ;***************************************************************
|
pascal@20146
|
145 global _strcmp:near
|
pascal@20146
|
146 proc _strcmp near
|
pascal@20146
|
147
|
pascal@20146
|
148 pop cx ;caller return address
|
pascal@20146
|
149 pop bx ; a
|
pascal@20146
|
150 pop ax ; b
|
pascal@20146
|
151 push ax
|
pascal@20146
|
152 push bx
|
pascal@20146
|
153 push cx
|
pascal@20146
|
154 push si
|
pascal@20146
|
155 xchg ax,si
|
pascal@20146
|
156 dec bx
|
pascal@20146
|
157 @@lp:
|
pascal@20146
|
158 inc bx
|
pascal@20146
|
159 lodsb
|
pascal@20146
|
160 sub al,[bx]
|
pascal@20146
|
161 jnz @@out
|
pascal@20451
|
162 sub al,al
|
pascal@20146
|
163 jnz @@lp
|
pascal@20146
|
164 @@out:
|
pascal@20146
|
165 cbw
|
pascal@20146
|
166 pop si
|
pascal@20146
|
167 ret
|
pascal@20146
|
168
|
pascal@20146
|
169 endp _strcmp
|
pascal@20146
|
170 endif
|
pascal@20146
|
171
|
pascal@20146
|
172
|
pascal@19538
|
173 ;***************************************************************
|
pascal@19515
|
174 ;void puts(const char* s):
|
pascal@19515
|
175 ;***************************************************************
|
pascal@19515
|
176 global _puts:near
|
pascal@19515
|
177 proc _puts near
|
pascal@19515
|
178
|
pascal@19515
|
179 pop ax ;caller return address
|
pascal@19515
|
180 pop bx ; s
|
pascal@19515
|
181 push bx
|
pascal@19515
|
182 push ax
|
pascal@19515
|
183 global puts:near ; puts(bx)
|
pascal@19515
|
184 puts:
|
pascal@19515
|
185 call putsz
|
pascal@19515
|
186 mov bx,offset msg_crlf
|
pascal@20146
|
187 jmp putsz
|
pascal@20146
|
188 putcz:
|
pascal@20160
|
189 mov ah,2
|
pascal@20146
|
190 int 21h
|
pascal@19515
|
191 global putsz:near ; putsz(bx)
|
pascal@19515
|
192 putsz:
|
pascal@20160
|
193 mov dl,[bx]
|
pascal@20146
|
194 inc bx
|
pascal@20160
|
195 or dl,dl
|
pascal@20146
|
196 jne putcz ; ZF=1 (for malloc failure)
|
pascal@19538
|
197 ret
|
pascal@19515
|
198
|
pascal@19515
|
199 endp _puts
|
pascal@19515
|
200
|
pascal@19515
|
201
|
pascal@19515
|
202 ;***************************************************************
|
pascal@19538
|
203 ;int fileattr(const char* name);
|
pascal@19538
|
204 ;***************************************************************
|
pascal@19538
|
205 global _fileattr:near
|
pascal@19538
|
206 proc _fileattr near
|
pascal@19538
|
207
|
pascal@19538
|
208 pop ax ;caller return address
|
pascal@19538
|
209 pop dx ; name
|
pascal@19538
|
210 push dx
|
pascal@19538
|
211 push ax
|
pascal@19538
|
212 mov ax,4300h
|
pascal@19538
|
213 int 21h
|
pascal@19538
|
214 xchg ax,cx
|
pascal@19538
|
215 jmp chkc
|
pascal@19538
|
216
|
pascal@19538
|
217 endp _fileattr
|
pascal@19538
|
218
|
pascal@19538
|
219
|
pascal@19538
|
220 ;***************************************************************
|
pascal@19546
|
221 ;int open(const char* name, int flags=O_RDONLY);
|
pascal@19515
|
222 ;***************************************************************
|
pascal@19515
|
223 global _open:near
|
pascal@19515
|
224 proc _open near
|
pascal@19515
|
225
|
pascal@19546
|
226 pop ax ;caller return address
|
pascal@19515
|
227 pop bx ; name
|
pascal@19546
|
228 push bx
|
pascal@19515
|
229 push ax
|
pascal@19546
|
230 global open:near ; open(bx)
|
pascal@19515
|
231 open:
|
pascal@19515
|
232 mov dx,bx
|
pascal@20146
|
233 ;mov cl,0 ; attribute mask
|
pascal@20146
|
234 mov ax,3d00h ; read-only+compatibility
|
pascal@19515
|
235 dos:
|
pascal@19515
|
236 int 21h
|
pascal@19538
|
237 chkc:
|
pascal@19515
|
238 jnc doret
|
pascal@19515
|
239 fail:
|
pascal@19515
|
240 sbb ax,ax ; ax=-1 CF
|
pascal@19515
|
241 cwd
|
pascal@19515
|
242 doret:
|
pascal@19515
|
243 ifndef NO386
|
pascal@19538
|
244 push dx ; see next_chunk:lseek
|
pascal@19538
|
245 push ax
|
pascal@19538
|
246 pop eax
|
pascal@19515
|
247 endif
|
pascal@19515
|
248 ret
|
pascal@19515
|
249
|
pascal@19515
|
250 endp _open
|
pascal@19515
|
251
|
pascal@19515
|
252
|
pascal@19515
|
253 ;***************************************************************
|
pascal@19515
|
254 ;int close(int fd);
|
pascal@19515
|
255 ;***************************************************************
|
pascal@19515
|
256 global _close:near
|
pascal@19515
|
257 proc _close near
|
pascal@19515
|
258
|
pascal@19515
|
259 pop ax ;caller return address
|
pascal@19515
|
260 pop bx ; fd
|
pascal@19515
|
261 push bx
|
pascal@19515
|
262 push ax
|
pascal@19515
|
263 global close:near ; close(bx)
|
pascal@19515
|
264 close:
|
pascal@19515
|
265 mov ah,3Eh
|
pascal@19515
|
266 or bx,bx
|
pascal@19515
|
267 jnz dos
|
pascal@19515
|
268 ret
|
pascal@19515
|
269
|
pascal@19515
|
270 endp _close
|
pascal@19515
|
271
|
pascal@19515
|
272
|
pascal@19515
|
273 ;***************************************************************
|
pascal@19515
|
274 ;int read(int fd, void* data, int sz);
|
pascal@19580
|
275 ;int write(int fd, const void* data, int sz);
|
pascal@19515
|
276 ;***************************************************************
|
pascal@19515
|
277 global _read:near
|
pascal@19515
|
278 proc _read near
|
pascal@19515
|
279
|
pascal@20146
|
280 ifdef WRITE
|
pascal@19580
|
281 stc
|
pascal@19634
|
282 db 0B0h ; mov al,im
|
pascal@19580
|
283 global _write:near
|
pascal@19580
|
284 clc
|
pascal@20146
|
285 endif
|
pascal@19580
|
286 pop ax ;caller return address
|
pascal@19580
|
287 pop bx ; fd
|
pascal@19580
|
288 pop dx ; data
|
pascal@19515
|
289 pop cx ; sz
|
pascal@19515
|
290 push cx
|
pascal@19515
|
291 push dx
|
pascal@19580
|
292 push bx
|
pascal@19580
|
293 push ax
|
pascal@20146
|
294 ifdef WRITE
|
pascal@19580
|
295 mov ah,40h
|
pascal@19580
|
296 sbb ah,0
|
pascal@20146
|
297 else
|
pascal@20146
|
298 mov ah,3Fh
|
pascal@20146
|
299 endif
|
pascal@19515
|
300 jcxz fail
|
pascal@19515
|
301 jmp dos
|
pascal@19515
|
302
|
pascal@19515
|
303 endp _read
|
pascal@19515
|
304
|
pascal@20146
|
305 proc _lseekset near
|
pascal@20147
|
306 ;ifdef EXTRA
|
pascal@19515
|
307 ;***************************************************************
|
pascal@19825
|
308 ;long lseekset(int fd, unsigned long sz);
|
pascal@19515
|
309 ;***************************************************************
|
pascal@19899
|
310
|
pascal@19571
|
311 global _lseekset:near
|
pascal@19515
|
312
|
pascal@19515
|
313 pop ax ;caller return address
|
pascal@19515
|
314 pop bx ; fd
|
pascal@19571
|
315 pop dx ; sz lo
|
pascal@19571
|
316 pop cx ; sz hi
|
pascal@19571
|
317 push cx
|
pascal@20146
|
318 push dx
|
pascal@19515
|
319 push bx
|
pascal@19515
|
320 push ax
|
pascal@20147
|
321 ;endif
|
pascal@19571
|
322 global lseekset:near
|
pascal@19571
|
323 lseekset:
|
pascal@19571
|
324 clc
|
pascal@19634
|
325 db 0B0h ; mov al,im
|
pascal@19571
|
326 global rewind:near
|
pascal@19634
|
327 rewind: ; rewind(bx)
|
pascal@19634
|
328 stc
|
pascal@19571
|
329 mov ax,4200h
|
pascal@19571
|
330 jnc dos
|
pascal@19571
|
331 lseek0: ; lseek0(bx,ax=dir)
|
pascal@19571
|
332 cwd
|
pascal@19571
|
333 xor cx,cx
|
pascal@19515
|
334 jmp dos
|
pascal@19515
|
335
|
pascal@19571
|
336 endp _lseekset
|
pascal@19825
|
337
|
pascal@19825
|
338 ifdef EXTRA
|
pascal@19825
|
339 struc isostate ; struct isostate {
|
pascal@19825
|
340 fd dw ? ; 0 int fd;
|
pascal@19825
|
341 fileofs dd ? ; 2 unsigned long fileofs;
|
pascal@19825
|
342 filesize dd ? ; 6 unsigned long filesize;
|
pascal@19825
|
343 filemod dw ? ;10 unsigned short filemod;
|
pascal@19825
|
344 filename dw ? ;12 char *filename;
|
pascal@19825
|
345 dirofs dd ? ;14 unsigned long dirofs;
|
pascal@19825
|
346 dirsize dd ? ;16 unsigned long dirsize;
|
pascal@19825
|
347 curdirofs dd ? ;20 unsigned long curdirofs;
|
pascal@19825
|
348 curdirsize dd ? ;24 unsigned long curdirsize;
|
pascal@19825
|
349 curpos dd ? ;28 unsigned long curpos;
|
pascal@19825
|
350 ends ; } isostate;
|
pascal@19825
|
351 ;***************************************************************
|
pascal@19825
|
352 ;unsigned long isolseek(const unsigned long *offset);
|
pascal@19825
|
353 ;***************************************************************
|
pascal@19825
|
354 global _isolseek:near
|
pascal@19825
|
355 proc _isolseek near
|
pascal@19825
|
356
|
pascal@19825
|
357 pop ax
|
pascal@19825
|
358 pop bx
|
pascal@19825
|
359 push bx
|
pascal@19825
|
360 push ax
|
pascal@19825
|
361 mov dx,[bx]
|
pascal@19825
|
362 mov cx,[bx+2]
|
pascal@19825
|
363 extrn _isostate:isostate
|
pascal@19825
|
364 mov bx,[_isostate.fd]
|
pascal@19825
|
365 jmp lseekset ; (bx=fd, sz=cx:dx)
|
pascal@19825
|
366
|
pascal@19825
|
367 endp _isolseek
|
pascal@19825
|
368 endif
|
pascal@19515
|
369
|
pascal@19515
|
370
|
pascal@19515
|
371 ;***************************************************************
|
pascal@19515
|
372 ;int strhead(const char* a,const char* b);
|
pascal@19515
|
373 ;***************************************************************
|
pascal@19515
|
374 global _strhead:near
|
pascal@19515
|
375 proc _strhead near
|
pascal@19515
|
376
|
pascal@19515
|
377 pop cx ;caller return address
|
pascal@19634
|
378 pop bx ; a
|
pascal@19634
|
379 pop ax ; b
|
pascal@19634
|
380 push ax
|
pascal@19515
|
381 push bx
|
pascal@19515
|
382 push cx
|
pascal@19515
|
383 @@loop:
|
pascal@19634
|
384 xchg ax,bx
|
pascal@19515
|
385 mov cl,[bx] ; cl = *b++
|
pascal@19515
|
386 inc bx
|
pascal@19515
|
387 or cl,cl ; clear C
|
pascal@19515
|
388 jz fail ; return 0
|
pascal@19515
|
389 xchg ax,bx
|
pascal@19515
|
390 xor cl,[bx] ; cl -= *a++
|
pascal@19634
|
391 inc bx
|
pascal@19515
|
392 and cl,0dfh ; case insensitive
|
pascal@19634
|
393 jz @@loop
|
pascal@19634
|
394 ret ; return b (is not 0)
|
pascal@19515
|
395
|
pascal@19515
|
396 endp _strhead
|
pascal@19515
|
397
|
pascal@19515
|
398
|
pascal@19515
|
399 ;***************************************************************
|
pascal@19515
|
400 ;char* malloc_or_die(unsigned size);
|
pascal@19515
|
401 ;***************************************************************
|
pascal@19515
|
402 global _malloc_or_die:near
|
pascal@19515
|
403 proc _malloc_or_die near
|
pascal@19515
|
404
|
pascal@19515
|
405 pop ax ;caller return address
|
pascal@19515
|
406 pop cx ; size
|
pascal@19515
|
407 push cx
|
pascal@19515
|
408 push ax
|
pascal@19515
|
409 global malloc_or_die:near ; malloc_or_die(cx)
|
pascal@19515
|
410 malloc_or_die:
|
pascal@20456
|
411 mov ax,[_heap_top] ; return value
|
pascal@20456
|
412 mov bx,sp
|
pascal@20456
|
413 add bh,-14h ; MIN_STACK=_1k+PAGE_SIZE
|
pascal@20456
|
414 sub bx,ax ; can't overflow
|
pascal@20456
|
415 cmp bx,cx
|
pascal@20456
|
416 mov bx,offset msg_malloc
|
pascal@20456
|
417 jb die
|
pascal@20456
|
418 add [_heap_top],cx ; _BEG has zero'd heap
|
pascal@19515
|
419 ret
|
pascal@19515
|
420
|
pascal@19515
|
421 endp _malloc_or_die
|
pascal@19515
|
422
|
pascal@19515
|
423
|
pascal@19515
|
424 ;***************************************************************
|
pascal@19515
|
425 ;int die(const char* msg);
|
pascal@19538
|
426 ;int exit();
|
pascal@19515
|
427 ;int abort();
|
pascal@19515
|
428 ;***************************************************************
|
pascal@19515
|
429 global _die:near
|
pascal@19515
|
430 proc _die near
|
pascal@19515
|
431
|
pascal@19515
|
432 pop ax ;caller return address
|
pascal@19515
|
433 pop bx ; s
|
pascal@19515
|
434 push bx
|
pascal@19515
|
435 push ax
|
pascal@19515
|
436 global die:near ; die(bx)
|
pascal@19515
|
437 die:
|
pascal@19515
|
438 call puts
|
pascal@19538
|
439 global _exit:near
|
pascal@19538
|
440 _exit:
|
pascal@19515
|
441 mov al,[_no_exit]
|
pascal@19515
|
442 cmp al,0
|
pascal@19515
|
443 jne @@hang
|
pascal@19515
|
444 extrn exit:near
|
pascal@19515
|
445 inc ax
|
pascal@19515
|
446 jmp near exit
|
pascal@19515
|
447 @@hang:
|
pascal@19515
|
448 mov bx, offset msg_hang
|
pascal@19515
|
449 call puts
|
pascal@19515
|
450 global _abort:near
|
pascal@19515
|
451 _abort:
|
pascal@19515
|
452 cli
|
pascal@19515
|
453 @@stop:
|
pascal@19515
|
454 hlt
|
pascal@19515
|
455 jmp @@stop
|
pascal@19515
|
456
|
pascal@19515
|
457 endp _die
|
pascal@19515
|
458
|
pascal@19546
|
459 struc image_himem ;struct image_himem {
|
pascal@19546
|
460 fd dw ? ; 0 int fd;
|
pascal@19546
|
461 fallback dd ? ; 2 u32 fallback;
|
pascal@19546
|
462 size dd ? ; 6 u32 size;
|
pascal@19546
|
463 remaining dd ? ;10 u32 remaining;
|
pascal@19546
|
464 buf dd ? ;14 u32 buf;
|
pascal@19546
|
465 bufv dw ? ;18 u32 *bufv;
|
pascal@19546
|
466 errmsg dw ? ;20 char *errmsg;
|
pascal@19546
|
467 chunk_size dd ? ;22 u32 chunk_size;
|
pascal@19546
|
468 next_chunk dw ? ;26 void (*next_chunk)(struct image_himem *);
|
pascal@19546
|
469 state dw ? ;28 u16 state;
|
pascal@19546
|
470 fd2close dw ? ;30 u16 fd2close;
|
pascal@19546
|
471 ends ;};
|
pascal@19515
|
472
|
pascal@19636
|
473 ;***************************************************************
|
pascal@19636
|
474 ;void next_chunk(struct image_himem *di);
|
pascal@19636
|
475 ;***************************************************************
|
pascal@19636
|
476 proc next_chunk near
|
pascal@19636
|
477
|
pascal@19636
|
478 push si
|
pascal@19636
|
479 mov bx,[(image_himem di).fd]
|
pascal@19636
|
480 call close
|
pascal@19636
|
481 ifndef NO386
|
pascal@19636
|
482 xor eax,eax
|
pascal@19636
|
483 else
|
pascal@19636
|
484 xor ax,ax
|
pascal@19636
|
485 endif
|
pascal@19636
|
486 cwd
|
pascal@19636
|
487 mov [(image_himem di).fd],ax
|
pascal@19636
|
488 mov bx,[(image_himem di).state]
|
pascal@19636
|
489 cmp al,[bx] ; ""
|
pascal@19636
|
490 jz @@end
|
pascal@19636
|
491 mov si,bx
|
pascal@19636
|
492 @@scan:
|
pascal@19636
|
493 lodsb
|
pascal@19636
|
494 mov cx,si
|
pascal@19636
|
495 cmp al,','
|
pascal@19636
|
496 jz @@eos
|
pascal@19636
|
497 cmp al,0
|
pascal@19636
|
498 jnz @@scan
|
pascal@19636
|
499 dec cx
|
pascal@19636
|
500 @@eos:
|
pascal@19636
|
501 mov [(image_himem di).state],cx
|
pascal@19636
|
502 dec si
|
pascal@19636
|
503 push [word si]
|
pascal@19636
|
504 mov [byte si],dl ; set temp eos
|
pascal@19636
|
505 call open
|
pascal@19636
|
506 pop [word si] ; restore string
|
pascal@19636
|
507 jc @@die
|
pascal@19636
|
508 mov [(image_himem di).fd],ax
|
pascal@19636
|
509 mov [(image_himem di).fd2close],ax
|
pascal@19636
|
510 xchg ax,bx
|
pascal@19636
|
511 mov ax,4202h ; SEEK_END
|
pascal@19636
|
512 call lseek0
|
pascal@19636
|
513 @@die:
|
pascal@19636
|
514 mov bx,[(image_himem di).errmsg]
|
pascal@19636
|
515 jc die
|
pascal@19636
|
516 mov bx,[(image_himem di).fd]
|
pascal@19636
|
517 ifndef NO386
|
pascal@19636
|
518 push eax
|
pascal@19636
|
519 call rewind
|
pascal@19636
|
520 pop eax
|
pascal@19636
|
521 @@end:
|
pascal@19636
|
522 mov [(image_himem di).chunk_size],eax
|
pascal@19636
|
523 else
|
pascal@19636
|
524 push ax
|
pascal@19636
|
525 push dx
|
pascal@19636
|
526 call rewind
|
pascal@19636
|
527 pop dx
|
pascal@19636
|
528 pop ax
|
pascal@19636
|
529 @@end:
|
pascal@19636
|
530 mov [word (image_himem di).chunk_size],ax
|
pascal@19636
|
531 mov [word ((image_himem di).chunk_size)+2],dx
|
pascal@19636
|
532 endif
|
pascal@19636
|
533 pop si
|
pascal@19636
|
534 ret
|
pascal@19636
|
535
|
pascal@19636
|
536 endp next_chunk
|
pascal@19636
|
537
|
pascal@19636
|
538
|
pascal@19571
|
539 ifdef LARGE_IMAGES
|
pascal@19571
|
540 struc data_himem ;struct data_himem {
|
pascal@19571
|
541 first dd ? ; 0 u32 first;
|
pascal@19571
|
542 cacheidx dw ? ; 4 int cacheidx;
|
pascal@19571
|
543 pageidx dw ? ; 6 int pageidx;
|
pascal@19571
|
544 cache dd 1024 dup(?) ; 8 int cache;
|
pascal@19571
|
545 page dd 1024 dup(?) ;4104 int page;
|
pascal@19571
|
546 ends ;}; // size=8200
|
pascal@19571
|
547 endif
|
pascal@19571
|
548
|
pascal@19515
|
549 ;***************************************************************
|
pascal@19538
|
550 ;u32* malloc_bufv_or_die(struct image_himem *m);
|
pascal@19538
|
551 ;***************************************************************
|
pascal@19538
|
552 global _malloc_bufv_or_die:near
|
pascal@19538
|
553 proc _malloc_bufv_or_die near
|
pascal@19538
|
554
|
pascal@19636
|
555 p386
|
pascal@19538
|
556 pop bx ;caller return address
|
pascal@19538
|
557 pop ax
|
pascal@19538
|
558 push ax
|
pascal@19538
|
559 push bx
|
pascal@19538
|
560 push si
|
pascal@19538
|
561 xchg ax,si
|
pascal@19571
|
562 ifdef LARGE_IMAGES
|
pascal@19571
|
563 mov cx,[word ((image_himem si).size) + 2]
|
pascal@19571
|
564 shr cx,4 ; pages index size = size >> 20
|
pascal@19571
|
565 add cx,8+4096+8
|
pascal@19571
|
566 call malloc_or_die
|
pascal@19571
|
567 mov ecx,4096+4095 ; cnt = 1+(m->size+PAGE_MASK)/PAGE_SIZE;
|
pascal@19571
|
568 add ecx,[(image_himem si).size]
|
pascal@19571
|
569 shr ecx,12
|
pascal@19571
|
570 mov [curdata],ax
|
pascal@19571
|
571 else
|
pascal@19546
|
572 mov ecx,[(image_himem si).size]
|
pascal@19538
|
573 dec ecx
|
pascal@19538
|
574 shr ecx,12
|
pascal@19538
|
575 inc cx ; cnt = (m->size+PAGE_MASK)/PAGE_SIZE;
|
pascal@19538
|
576 push cx
|
pascal@19538
|
577 inc cx ; cnt+1
|
pascal@19538
|
578 shl cx,2 ; bufv => vcpi => vm86
|
pascal@19538
|
579 ; our malloc zeroes allocated mem: bufv[cnt]=0;
|
pascal@19538
|
580 ; Allocate pages, storing addrs in addrbuf
|
pascal@19538
|
581 call malloc_or_die
|
pascal@19571
|
582 pop cx
|
pascal@19571
|
583 push ax
|
pascal@19571
|
584 endif
|
pascal@19546
|
585 mov [(image_himem si).bufv],ax
|
pascal@19571
|
586 xchg ax,si
|
pascal@19538
|
587 @@vcpi_alloc:
|
pascal@19538
|
588 xor edx,edx
|
pascal@19538
|
589 mov ax,0DE04h
|
pascal@19538
|
590 int 67h
|
pascal@19538
|
591 or ah,ah
|
pascal@19538
|
592 mov bx,offset vcpi_alloc_err
|
pascal@19571
|
593 jnz die
|
pascal@19571
|
594 ; for (i = cnt-1; i >= 0; i--)
|
pascal@19571
|
595 ifdef LARGE_IMAGES
|
pascal@19571
|
596 mov eax,ecx
|
pascal@19571
|
597 dec eax
|
pascal@19571
|
598 else
|
pascal@19571
|
599 mov ax,cx
|
pascal@19571
|
600 dec ax
|
pascal@19571
|
601 cwde
|
pascal@19571
|
602 endif
|
pascal@19571
|
603 shl eax,12 ; i*_4k
|
pascal@19571
|
604 ; if (edx < pm.fallback+i*_4k && edx >= pm.fallback) again
|
pascal@19899
|
605 extrn _imgs
|
pascal@19899
|
606 mov bx,offset _imgs+2
|
pascal@19571
|
607 push eax
|
pascal@19571
|
608 add eax,[bx-2+2]
|
pascal@19571
|
609 cmp eax,edx ; pm.fallback+i*_4k <= edx ?
|
pascal@19571
|
610 pop eax ; i*_4k
|
pascal@19571
|
611 jbe @@pmok
|
pascal@19571
|
612 cmp edx,[bx-2+2] ; edx >= pm.fallback ?
|
pascal@19571
|
613 jae @@vcpi_alloc
|
pascal@19571
|
614 @@pmok:
|
pascal@19571
|
615 ; if (edx >= initrd.fallback+i*_4k && edx < initrd.fallback+initrd.size) again
|
pascal@19899
|
616 extrn _imgs
|
pascal@19899
|
617 mov bx,offset _imgs+32+2
|
pascal@19571
|
618 add eax,[bx-2+2] ; +initrd.fallback
|
pascal@19571
|
619 cmp eax,edx ; initrd.fallback+i*_4k > edx ?
|
pascal@19571
|
620 ja @@initrdok
|
pascal@19571
|
621 mov eax,[bx-2+6] ; initrd.size
|
pascal@19571
|
622 add eax,[bx-2+2] ; +initrd.fallback
|
pascal@19571
|
623 cmp eax,edx ; initrd.fallback+initrd.size > edx ?
|
pascal@19571
|
624 @@jnc_vcpi_alloc:
|
pascal@19571
|
625 ja @@vcpi_alloc
|
pascal@19571
|
626 @@initrdok:
|
pascal@19571
|
627 ifdef LARGE_IMAGES
|
pascal@19571
|
628 cmp [(data_himem si).first],0
|
pascal@19571
|
629 jne @@notfirst
|
pascal@19571
|
630 mov [(data_himem si).first],edx
|
pascal@19571
|
631 @@notfirst:
|
pascal@19571
|
632 mov bx,[(data_himem si).cacheidx]
|
pascal@19571
|
633 cmp bh,4
|
pascal@19571
|
634 jae @@nextpage
|
pascal@19571
|
635 shl bx,2
|
pascal@19571
|
636 inc [(data_himem si).cacheidx]
|
pascal@19571
|
637 mov [(data_himem bx+si).cache],edx
|
pascal@19571
|
638 loopd @@vcpi_alloc
|
pascal@19571
|
639 mov [(data_himem bx+si).cache],ecx ; last is 0
|
pascal@19571
|
640 @@nextpage:
|
pascal@19571
|
641 and [(data_himem si).cacheidx],0
|
pascal@19571
|
642 mov bx,[(data_himem si).pageidx]
|
pascal@19571
|
643 mov [(data_himem bx+si).page],edx
|
pascal@19571
|
644 add [(data_himem si).pageidx],4
|
pascal@19571
|
645 push cx
|
pascal@19571
|
646 lea cx,[(data_himem si).cache]
|
pascal@19571
|
647 ifdef NO386
|
pascal@19571
|
648 push edx
|
pascal@19571
|
649 pop dx
|
pascal@19571
|
650 pop ax
|
pascal@19571
|
651 endif
|
pascal@19571
|
652 call storepage ; storepage(edx,cx)
|
pascal@19571
|
653 pop cx
|
pascal@19571
|
654 or ecx,ecx ; clear C
|
pascal@19571
|
655 jnz @@jnc_vcpi_alloc
|
pascal@19571
|
656 mov [dword (data_himem si).cacheidx],ecx
|
pascal@19571
|
657 xchg ax,si
|
pascal@19571
|
658 else
|
pascal@19571
|
659 mov [si],edx
|
pascal@19571
|
660 lodsd ; si=+4
|
pascal@19538
|
661 loop @@vcpi_alloc
|
pascal@19538
|
662 pop ax
|
pascal@19571
|
663 endif
|
pascal@19538
|
664 pop si
|
pascal@19538
|
665 ret
|
pascal@19636
|
666 ifdef NO386
|
pascal@19636
|
667 p8086
|
pascal@19636
|
668 endif
|
pascal@19538
|
669
|
pascal@19538
|
670 endp _malloc_bufv_or_die
|
pascal@19538
|
671
|
pascal@19538
|
672
|
pascal@19538
|
673 ;***************************************************************
|
pascal@19571
|
674 ; void memcpy_image(struct image_himem *m);
|
pascal@19515
|
675 ;***************************************************************
|
pascal@19571
|
676 global _memcpy_image:near
|
pascal@19571
|
677 proc _memcpy_image near
|
pascal@19515
|
678
|
pascal@19571
|
679 pop ax ;caller return address
|
pascal@19515
|
680 pop bx
|
pascal@19571
|
681 push bx
|
pascal@19571
|
682 push ax
|
pascal@19571
|
683 ifndef NO386
|
pascal@19571
|
684 mov edx,[(image_himem bx).fallback]
|
pascal@19571
|
685 mov eax,[(image_himem bx).buf]
|
pascal@19571
|
686 cmp eax,edx ; if (m->fallback != m->buf)
|
pascal@19571
|
687 jz @@skip ; memcpy32(m->fallback,0,m->buf,m->size)
|
pascal@19571
|
688 ifdef LARGE_IMAGES
|
pascal@19571
|
689 mov ecx,[(image_himem bx).size]
|
pascal@20146
|
690 memcpy_imagez: ; memcpy_imagez(edx,eax,ecx)
|
pascal@19571
|
691 push ecx
|
pascal@19571
|
692 else
|
pascal@19571
|
693 push [(image_himem bx).size]
|
pascal@19571
|
694 endif
|
pascal@19571
|
695 push eax
|
pascal@19571
|
696 push 0
|
pascal@19571
|
697 call_memcpy32:
|
pascal@19571
|
698 push edx
|
pascal@19571
|
699 else
|
pascal@19571
|
700 mov ax,[word ((image_himem bx).fallback)]
|
pascal@19571
|
701 mov dx,[word ((image_himem bx).fallback)+2]
|
pascal@19571
|
702 mov cx,[word ((image_himem bx).buf)]
|
pascal@19571
|
703 cmp ax,cx ; if (m->fallback != m->buf)
|
pascal@19571
|
704 jnz @@do
|
pascal@19571
|
705 cmp dx,[word ((image_himem bx).buf)+2]
|
pascal@19571
|
706 jz @@skip ; memcpy32(m->fallback,0,m->buf,m->size)
|
pascal@19571
|
707 @@do:
|
pascal@19571
|
708 push [word ((image_himem bx).size)+2]
|
pascal@19571
|
709 push [word ((image_himem bx).size)]
|
pascal@19571
|
710 push [word ((image_himem bx).buf)+2]
|
pascal@19571
|
711 push cx
|
pascal@19571
|
712 xor cx,cx
|
pascal@19571
|
713 push cx
|
pascal@19571
|
714 call_memcpy32:
|
pascal@19571
|
715 push dx
|
pascal@19571
|
716 push ax
|
pascal@19571
|
717 ifdef LARGE_IMAGES
|
pascal@19571
|
718 jmp @@memcpy
|
pascal@20146
|
719 memcpy_imagez: ; memcpy_imagez(edx,eax,ecx)
|
pascal@19636
|
720 p386
|
pascal@19571
|
721 push ecx
|
pascal@19571
|
722 push eax
|
pascal@19571
|
723 push 0
|
pascal@19571
|
724 push edx
|
pascal@19636
|
725 ifdef NO386
|
pascal@19636
|
726 p8086
|
pascal@19636
|
727 endif
|
pascal@19571
|
728 endif
|
pascal@19571
|
729 endif
|
pascal@19571
|
730 @@memcpy:
|
pascal@19571
|
731 extrn _memcpy32:near
|
pascal@19571
|
732 call near _memcpy32
|
pascal@19571
|
733 add sp,14
|
pascal@19571
|
734 @@skip:
|
pascal@19571
|
735 ret
|
pascal@19571
|
736
|
pascal@19571
|
737 endp _memcpy_image
|
pascal@19571
|
738
|
pascal@19571
|
739 ;***************************************************************
|
pascal@19571
|
740 ;void storepage(u32 *dst, u16 src);
|
pascal@19571
|
741 ;***************************************************************
|
pascal@19571
|
742 global _storepage:near
|
pascal@19571
|
743 proc _storepage near
|
pascal@19571
|
744
|
pascal@19571
|
745 pop ax ;caller return address
|
pascal@19571
|
746 pop bx
|
pascal@19571
|
747 pop cx
|
pascal@19571
|
748 push cx
|
pascal@19571
|
749 push bx
|
pascal@19571
|
750 push ax
|
pascal@19571
|
751 ifndef NO386
|
pascal@19571
|
752 mov edx,[bx]
|
pascal@19571
|
753 else
|
pascal@19571
|
754 mov ax,[bx]
|
pascal@19571
|
755 mov dx,[bx+2]
|
pascal@19571
|
756 endif
|
pascal@20146
|
757 storepage: ; storepage(edx,cx)
|
pascal@19571
|
758 ifndef NO386
|
pascal@19571
|
759 push 0
|
pascal@19571
|
760 push 4096
|
pascal@19571
|
761 push 0
|
pascal@19571
|
762 else
|
pascal@19571
|
763 xor bx,bx
|
pascal@19571
|
764 push bx
|
pascal@19571
|
765 mov bh,4096/256
|
pascal@19571
|
766 push bx
|
pascal@19571
|
767 xor bx,bx
|
pascal@19571
|
768 push bx
|
pascal@19571
|
769 endif
|
pascal@19571
|
770 push cx
|
pascal@19571
|
771 push ds
|
pascal@19571
|
772 jmp call_memcpy32
|
pascal@19571
|
773
|
pascal@19571
|
774 endp _storepage
|
pascal@19571
|
775
|
pascal@19571
|
776
|
pascal@19571
|
777 ifdef LARGE_IMAGES
|
pascal@19636
|
778 p386
|
pascal@19571
|
779 ;***************************************************************
|
pascal@19571
|
780 ;void reset_bufv(u32 *p);
|
pascal@19571
|
781 ;***************************************************************
|
pascal@19571
|
782 global _reset_bufv:near
|
pascal@19571
|
783 proc _reset_bufv near
|
pascal@19571
|
784
|
pascal@19634
|
785 pop ax ;caller return address
|
pascal@19634
|
786 pop bx
|
pascal@19634
|
787 push bx
|
pascal@19515
|
788 push ax
|
pascal@19634
|
789 mov [curdata],bx
|
pascal@19571
|
790 and [dword (data_himem bx).cacheidx],0
|
pascal@19571
|
791 ret
|
pascal@19571
|
792
|
pascal@19571
|
793 endp _reset_bufv
|
pascal@19571
|
794
|
pascal@19571
|
795 ;***************************************************************
|
pascal@19571
|
796 ;u32* prev_bufv();
|
pascal@19571
|
797 ;u32* prev_bufv();
|
pascal@19571
|
798 ;***************************************************************
|
pascal@19571
|
799 global _prev_bufv:near
|
pascal@19571
|
800 global _next_bufv:near
|
pascal@19571
|
801 proc _prev_bufv near
|
pascal@19571
|
802
|
pascal@19571
|
803 stc
|
pascal@19571
|
804 db 73h ; jnc
|
pascal@19571
|
805 _next_bufv:
|
pascal@19571
|
806 clc
|
pascal@19571
|
807 sbb ax,ax
|
pascal@19571
|
808 stc
|
pascal@19571
|
809 rcl ax,1 ; -1/+1
|
pascal@19571
|
810 xor ecx,ecx
|
pascal@19571
|
811 push si
|
pascal@19571
|
812 mov si,[curdata]
|
pascal@19571
|
813 add ax,[(data_himem si).cacheidx]
|
pascal@19571
|
814 test ax,0fc00h
|
pascal@19571
|
815 jz @@gotpage
|
pascal@19571
|
816 push ax ; FFFF / 0400
|
pascal@19571
|
817 sar ax,8 ; FFFC / 0004
|
pascal@19571
|
818 and al,0fch
|
pascal@19571
|
819 add [(data_himem si).pageidx],ax
|
pascal@19571
|
820 mov bx,[(data_himem si).pageidx]
|
pascal@19571
|
821 lea bx,[(data_himem bx+si).page]
|
pascal@19571
|
822 mov edx,ds
|
pascal@19571
|
823 shl edx,4
|
pascal@19571
|
824 lea cx,[(data_himem si).cache]
|
pascal@19571
|
825 add edx,ecx
|
pascal@19571
|
826 mov eax,[bx]
|
pascal@19571
|
827 or eax,eax
|
pascal@19571
|
828 jnz @@pageok
|
pascal@19571
|
829 pop ax
|
pascal@19571
|
830 xchg ax,bx
|
pascal@19571
|
831 pop si
|
pascal@19571
|
832 ret
|
pascal@19571
|
833 @@pageok:
|
pascal@19571
|
834 mov cx,4096
|
pascal@19571
|
835 call memcpy_imagez ; get page
|
pascal@19571
|
836 pop ax ; FFFF / 0400
|
pascal@19571
|
837 cbw
|
pascal@19571
|
838 shr ax,6 ; 03FF / 0000
|
pascal@19571
|
839 @@gotpage:
|
pascal@19571
|
840 mov [(data_himem si).cacheidx],ax
|
pascal@19571
|
841 shl ax,2
|
pascal@19571
|
842 xchg ax,bx
|
pascal@19571
|
843 lea ax,[(data_himem bx+si).cache]
|
pascal@19571
|
844 or bx,[(data_himem si).pageidx] ; !pageidx && !cacheidx
|
pascal@19571
|
845 jnz @@notfirst2
|
pascal@19571
|
846 xchg ax,si ; &first
|
pascal@19571
|
847 @@notfirst2:
|
pascal@19571
|
848 pop si
|
pascal@19571
|
849 ret
|
pascal@19571
|
850
|
pascal@19571
|
851 endp _prev_bufv
|
pascal@19571
|
852 endif
|
pascal@19571
|
853
|
pascal@20146
|
854 ifdef NO386
|
pascal@20146
|
855 p8086
|
pascal@20146
|
856 endif
|
pascal@19571
|
857
|
pascal@19571
|
858 ;***************************************************************
|
pascal@19515
|
859 ;void open_image(const char *name, struct image_himem *m);
|
pascal@19515
|
860 ;***************************************************************
|
pascal@19515
|
861 global _open_image:near
|
pascal@19515
|
862 proc _open_image near
|
pascal@19515
|
863
|
pascal@19515
|
864 arg fname :word, \
|
pascal@19515
|
865 m :word = PARAM_SIZE
|
pascal@19515
|
866
|
pascal@19515
|
867 push bp
|
pascal@19515
|
868 mov bp,sp
|
pascal@19515
|
869 push si di
|
pascal@19515
|
870 ifndef NO386
|
pascal@19515
|
871 xor eax,eax ; 1st loop flag + eos
|
pascal@19515
|
872 else
|
pascal@19515
|
873 xor ax,ax ; 1st loop flag + eos
|
pascal@19515
|
874 endif
|
pascal@19515
|
875 mov di,[m]
|
pascal@19546
|
876 cmp [(image_himem di).fd],ax
|
pascal@19515
|
877 jnz @@alreadydone
|
pascal@19515
|
878 ifndef NO386
|
pascal@19546
|
879 mov [(image_himem di).size],eax ; m->size = 0L
|
pascal@19515
|
880 else
|
pascal@19546
|
881 mov [word (image_himem di).size],ax ; m->size = 0L
|
pascal@19546
|
882 mov [word ((image_himem di).size)+2],ax
|
pascal@19515
|
883 endif
|
pascal@19571
|
884 mov [(image_himem di).next_chunk],offset next_chunk
|
pascal@19515
|
885 mov si,[fname]
|
pascal@19546
|
886 mov [(image_himem di).state],si
|
pascal@19515
|
887 @@next:
|
pascal@19515
|
888 push di
|
pascal@19546
|
889 call [(image_himem di).next_chunk] ; m->next_chunk()
|
pascal@19515
|
890 pop di
|
pascal@19515
|
891 ifndef NO386
|
pascal@19515
|
892 add eax,3
|
pascal@19515
|
893 and al,0FCh
|
pascal@19546
|
894 add [(image_himem di).size],eax ; m->size += m->chunk_size
|
pascal@19515
|
895 or eax,eax
|
pascal@19515
|
896 jnz @@next
|
pascal@19515
|
897 else
|
pascal@19515
|
898 mov cx,ax
|
pascal@19515
|
899 or cx,dx
|
pascal@19515
|
900 add ax,3
|
pascal@19515
|
901 adc dx,0
|
pascal@19515
|
902 and al,0FCh
|
pascal@19546
|
903 add [word (image_himem di).size],ax ; m->size += m->chunk_size
|
pascal@19546
|
904 adc [word ((image_himem di).size)+2],dx
|
pascal@19538
|
905 inc cx ; jcxnz
|
pascal@19515
|
906 loop @@next
|
pascal@19515
|
907 endif
|
pascal@19546
|
908 mov [(image_himem di).state],si
|
pascal@19515
|
909 push di
|
pascal@19546
|
910 call [(image_himem di).next_chunk] ; m->next_chunk()
|
pascal@19515
|
911 pop di
|
pascal@19515
|
912 @@alreadydone:
|
pascal@19515
|
913 push ax
|
pascal@19515
|
914 image_done:
|
pascal@19515
|
915 pop ax
|
pascal@19515
|
916 pop di si bp
|
pascal@19515
|
917 ret
|
pascal@19515
|
918
|
pascal@19515
|
919 endp _open_image
|
pascal@19515
|
920
|
pascal@19515
|
921
|
pascal@19515
|
922 ;***************************************************************
|
pascal@19515
|
923 ;int read_image(struct image_himem *m, void* data, int sz);
|
pascal@19515
|
924 ;***************************************************************
|
pascal@19515
|
925 global _read_image:near
|
pascal@19515
|
926 proc _read_image near
|
pascal@19515
|
927
|
pascal@19515
|
928 arg m :word, \
|
pascal@19515
|
929 data :word, \
|
pascal@19515
|
930 sz :word = PARAM_SIZE
|
pascal@19515
|
931
|
pascal@19515
|
932 push bp
|
pascal@19515
|
933 mov bp,sp
|
pascal@19515
|
934 push si di
|
pascal@19515
|
935 ifndef NO386
|
pascal@19515
|
936 push 0 ; return value
|
pascal@19515
|
937 else
|
pascal@19515
|
938 xor ax,ax
|
pascal@19515
|
939 push ax
|
pascal@19515
|
940 endif
|
pascal@19515
|
941 mov di,[m]
|
pascal@19515
|
942 @@loop:
|
pascal@19538
|
943 ifndef NO386
|
pascal@19538
|
944 xor ecx,ecx
|
pascal@19538
|
945 mov cx,[word sz]
|
pascal@19538
|
946 @@chksz:
|
pascal@19546
|
947 mov eax,[(image_himem di).chunk_size]
|
pascal@19538
|
948 cmp ecx,eax
|
pascal@19538
|
949 jb @@szok
|
pascal@19538
|
950 xchg eax,ecx
|
pascal@19538
|
951 else
|
pascal@19538
|
952 mov cx,[word sz]
|
pascal@19538
|
953 @@chksz:
|
pascal@19546
|
954 mov ax,[word (image_himem di).chunk_size]
|
pascal@19538
|
955 cmp cx,ax
|
pascal@19515
|
956 jb @@szok
|
pascal@19546
|
957 cmp [word ((image_himem di).chunk_size)+2],0 ; hi m->chunk_size
|
pascal@19515
|
958 jne @@szok
|
pascal@19515
|
959 xchg ax,cx
|
pascal@19538
|
960 endif
|
pascal@19515
|
961 @@szok:
|
pascal@19538
|
962 jcxz image_done
|
pascal@19538
|
963 push cx
|
pascal@19515
|
964 push [word data]
|
pascal@19515
|
965 push [word di]
|
pascal@19515
|
966 call _read
|
pascal@19538
|
967 pop dx
|
pascal@19515
|
968 pop bx
|
pascal@19538
|
969 pop dx
|
pascal@19538
|
970 jc image_done
|
pascal@19515
|
971 add bx,ax
|
pascal@19515
|
972 xor cx,cx
|
pascal@19538
|
973 ifndef NO386
|
pascal@19538
|
974 cwde ; ax < 8000h
|
pascal@19546
|
975 sub [(image_himem di).chunk_size],eax
|
pascal@19538
|
976 else
|
pascal@19538
|
977 cwd ; ax < 8000h
|
pascal@19546
|
978 sub [word (image_himem di).chunk_size],ax
|
pascal@19546
|
979 sbb [word ((image_himem di).chunk_size)+2],dx
|
pascal@19538
|
980 jnz @@fill
|
pascal@19546
|
981 cmp [word (image_himem di).chunk_size],dx
|
pascal@19538
|
982 endif
|
pascal@19538
|
983 jnz @@fill
|
pascal@19538
|
984 dec cx
|
pascal@19515
|
985 @@fill:
|
pascal@19515
|
986 test al,3
|
pascal@19515
|
987 je @@filled
|
pascal@19538
|
988 mov [bx],dl
|
pascal@19515
|
989 inc bx
|
pascal@19515
|
990 inc ax
|
pascal@19515
|
991 jmp @@fill
|
pascal@19515
|
992 @@filled:
|
pascal@19538
|
993 ifndef NO386
|
pascal@19546
|
994 sub [(image_himem di).remaining],eax
|
pascal@19538
|
995 else
|
pascal@19546
|
996 sub [word (image_himem di).remaining],ax
|
pascal@19546
|
997 sbb [word ((image_himem di).remaining)+2],dx
|
pascal@19538
|
998 endif
|
pascal@19515
|
999 add [bp-4-2],ax
|
pascal@19515
|
1000 add [word data],ax
|
pascal@19515
|
1001 sub [word sz],ax
|
pascal@19538
|
1002 pushf
|
pascal@19546
|
1003 and cx,[(image_himem di).next_chunk]
|
pascal@19538
|
1004 jz @@same_chunk
|
pascal@19515
|
1005 push di
|
pascal@19515
|
1006 call cx ; m->next_chunk()
|
pascal@19515
|
1007 pop di
|
pascal@19538
|
1008 @@same_chunk:
|
pascal@19538
|
1009 popf
|
pascal@19538
|
1010 jnz @@loop
|
pascal@19538
|
1011 jmp image_done
|
pascal@19515
|
1012
|
pascal@19515
|
1013 endp _read_image
|
pascal@19515
|
1014
|
pascal@19515
|
1015
|
pascal@19515
|
1016 ;***************************************************************
|
pascal@19515
|
1017 ;unsigned long strtol(const char *s);
|
pascal@19515
|
1018 ;***************************************************************
|
pascal@19515
|
1019 global _strtol:near
|
pascal@19515
|
1020 proc _strtol near
|
pascal@19515
|
1021
|
pascal@19515
|
1022 ifndef NO386
|
pascal@19515
|
1023 pop ax ;caller return address
|
pascal@19515
|
1024 pop cx ; s
|
pascal@19515
|
1025 push cx
|
pascal@19515
|
1026 push ax
|
pascal@19515
|
1027 xor ebx,ebx
|
pascal@19515
|
1028 push si
|
pascal@19634
|
1029 jcxz @@end
|
pascal@19515
|
1030 mov si,cx
|
pascal@19515
|
1031 xor ecx,ecx
|
pascal@19515
|
1032 xor eax,eax
|
pascal@19515
|
1033 lodsb
|
pascal@19634
|
1034 mov dx,ax
|
pascal@19634
|
1035 or al,20h
|
pascal@19634
|
1036 cmp al,'n' ; vga=normal
|
pascal@19538
|
1037 je @@vga
|
pascal@19538
|
1038 dec cx
|
pascal@19634
|
1039 cmp al,'e' ; vga=extended
|
pascal@19538
|
1040 je @@vga
|
pascal@19538
|
1041 dec cx
|
pascal@19634
|
1042 cmp al,'a' ; vga=ask
|
pascal@19538
|
1043 jne @@notvga
|
pascal@19538
|
1044 @@vga:
|
pascal@19538
|
1045 dec cx
|
pascal@19538
|
1046 xchg ax,cx
|
pascal@19538
|
1047 cwd
|
pascal@19634
|
1048 jmp @@popsiret
|
pascal@19538
|
1049 @@notvga:
|
pascal@19538
|
1050 mov cx,10 ; radix
|
pascal@19634
|
1051 xchg ax,dx
|
pascal@19515
|
1052 cmp al,'+'
|
pascal@19515
|
1053 je @@radixskip
|
pascal@19515
|
1054 cmp al,'-'
|
pascal@19515
|
1055 clc
|
pascal@19515
|
1056 jne @@radixkeep
|
pascal@19515
|
1057 stc
|
pascal@19515
|
1058 @@radixskip:
|
pascal@19515
|
1059 lodsb
|
pascal@19515
|
1060 @@radixkeep:
|
pascal@19515
|
1061 pushf
|
pascal@19515
|
1062 cmp al,'0'
|
pascal@19515
|
1063 jne @@radixok
|
pascal@19515
|
1064 mov cl,8
|
pascal@19515
|
1065 lodsb
|
pascal@19634
|
1066 or al,20h
|
pascal@19634
|
1067 cmp al,'x'
|
pascal@19515
|
1068 jne @@radixok
|
pascal@19515
|
1069 mov cl,16
|
pascal@19515
|
1070 @@strtollp:
|
pascal@19515
|
1071 lodsb
|
pascal@19515
|
1072 @@radixok:
|
pascal@19634
|
1073 or al,20h
|
pascal@19515
|
1074 sub al,'0'
|
pascal@19515
|
1075 jb @@endstrtol
|
pascal@19515
|
1076 cmp al,9
|
pascal@19515
|
1077 jbe @@digitok
|
pascal@19515
|
1078 cmp al,'a'-'0'
|
pascal@19515
|
1079 jb @@endstrtol
|
pascal@19515
|
1080 sub al,'a'-'0'-10
|
pascal@19515
|
1081 @@digitok:
|
pascal@19515
|
1082 cmp al,cl
|
pascal@19515
|
1083 jae @@endstrtol
|
pascal@19515
|
1084 xchg eax,ebx
|
pascal@19515
|
1085 mul ecx
|
pascal@19515
|
1086 add eax,ebx
|
pascal@19515
|
1087 xchg eax,ebx
|
pascal@19515
|
1088 jmp @@strtollp
|
pascal@19515
|
1089 @@endstrtol:
|
pascal@19515
|
1090 mov cl,10
|
pascal@19515
|
1091 cmp al,'k'-'a'+10
|
pascal@19515
|
1092 je @@shift
|
pascal@19515
|
1093 mov cl,20
|
pascal@19515
|
1094 cmp al,'m'-'a'+10
|
pascal@19515
|
1095 je @@shift
|
pascal@19515
|
1096 mov cl,30
|
pascal@19515
|
1097 cmp al,'g'-'a'+10
|
pascal@19515
|
1098 jne @@noshift
|
pascal@19515
|
1099 @@shift:
|
pascal@19515
|
1100 shl ebx,cl
|
pascal@19515
|
1101 @@noshift:
|
pascal@19515
|
1102 popf
|
pascal@19515
|
1103 jnc @@end
|
pascal@19515
|
1104 neg ebx
|
pascal@19515
|
1105 @@end:
|
pascal@19515
|
1106 push ebx
|
pascal@19515
|
1107 pop ax
|
pascal@19515
|
1108 pop dx
|
pascal@19634
|
1109 @@popsiret:
|
pascal@19515
|
1110 pop si
|
pascal@19515
|
1111 else
|
pascal@19515
|
1112 pop ax ;caller return address
|
pascal@19515
|
1113 pop cx ; s
|
pascal@19515
|
1114 push cx
|
pascal@19515
|
1115 push ax
|
pascal@19515
|
1116 push si
|
pascal@19515
|
1117 push di
|
pascal@19515
|
1118 xor ax,ax
|
pascal@19515
|
1119 cwd
|
pascal@19634
|
1120 jcxz @@goend
|
pascal@19515
|
1121 xchg ax,di
|
pascal@19515
|
1122 mov si,cx
|
pascal@19538
|
1123 lodsb
|
pascal@19634
|
1124 mov bx,ax
|
pascal@19634
|
1125 or al,20h
|
pascal@19538
|
1126 mov cx,-1
|
pascal@19634
|
1127 cmp al,'n' ; vga=normal
|
pascal@19538
|
1128 je @@vga
|
pascal@19538
|
1129 dec cx
|
pascal@19634
|
1130 cmp al,'e' ; vga=extended
|
pascal@19538
|
1131 je @@vga
|
pascal@19538
|
1132 dec cx
|
pascal@19634
|
1133 cmp al,'a' ; vga=ask
|
pascal@19538
|
1134 jne @@notvga
|
pascal@19538
|
1135 @@vga:
|
pascal@19538
|
1136 xchg ax,cx
|
pascal@19538
|
1137 @@goend:
|
pascal@19634
|
1138 jmp @@popdisiret
|
pascal@19538
|
1139 @@notvga:
|
pascal@19515
|
1140 mov cx,10 ; radix
|
pascal@19634
|
1141 xchg ax,bx
|
pascal@19515
|
1142 cmp al,'+'
|
pascal@19515
|
1143 je @@radixskip
|
pascal@19515
|
1144 cmp al,'-'
|
pascal@19515
|
1145 clc
|
pascal@19515
|
1146 jne @@radixkeep
|
pascal@19515
|
1147 stc
|
pascal@19515
|
1148 @@radixskip:
|
pascal@19515
|
1149 lodsb
|
pascal@19515
|
1150 @@radixkeep:
|
pascal@19515
|
1151 pushf
|
pascal@19515
|
1152 cmp al,'0'
|
pascal@19515
|
1153 jne @@radixok
|
pascal@19515
|
1154 mov cl,8
|
pascal@19515
|
1155 lodsb
|
pascal@20146
|
1156 or al,20h
|
pascal@19634
|
1157 cmp al,'x'
|
pascal@19515
|
1158 jne @@radixok
|
pascal@19515
|
1159 mov cl,16
|
pascal@19515
|
1160 @@strtollp:
|
pascal@19515
|
1161 lodsb
|
pascal@19515
|
1162 @@radixok:
|
pascal@19634
|
1163 or al,20h
|
pascal@19515
|
1164 sub al,'0'
|
pascal@19515
|
1165 jb @@endstrtol
|
pascal@19515
|
1166 cmp al,9
|
pascal@19515
|
1167 jbe @@digitok
|
pascal@19515
|
1168 cmp al,'a'-'0'
|
pascal@19515
|
1169 jb @@endstrtol
|
pascal@19515
|
1170 sub al,'a'-'0'-10
|
pascal@19515
|
1171 @@digitok:
|
pascal@19515
|
1172 cmp al,cl
|
pascal@19515
|
1173 jae @@endstrtol
|
pascal@19515
|
1174
|
pascal@19515
|
1175 push ax
|
pascal@19515
|
1176 push si
|
pascal@19515
|
1177 push dx
|
pascal@19515
|
1178 xchg ax,di
|
pascal@19515
|
1179 mul cx
|
pascal@19515
|
1180 xchg ax,di
|
pascal@19515
|
1181 xchg ax,dx
|
pascal@19515
|
1182 xchg ax,si
|
pascal@19515
|
1183 pop ax
|
pascal@19515
|
1184 mul cx
|
pascal@19515
|
1185 add ax,si
|
pascal@19515
|
1186 pop si
|
pascal@19515
|
1187 xchg ax,dx
|
pascal@19515
|
1188 pop ax
|
pascal@19515
|
1189 mov ah,0
|
pascal@19515
|
1190 add di,ax
|
pascal@19515
|
1191 adc dx,0
|
pascal@19515
|
1192
|
pascal@19515
|
1193 jmp @@strtollp
|
pascal@19515
|
1194 @@endstrtol:
|
pascal@19515
|
1195 mov cl,10
|
pascal@19515
|
1196 cmp al,'k'-'a'+10
|
pascal@19515
|
1197 je @@shift
|
pascal@19515
|
1198 mov cl,20
|
pascal@19515
|
1199 cmp al,'m'-'a'+10
|
pascal@19515
|
1200 je @@shift
|
pascal@19515
|
1201 mov cl,30
|
pascal@19515
|
1202 cmp al,'g'-'a'+10
|
pascal@19515
|
1203 jne @@noshift
|
pascal@19515
|
1204 @@shift:
|
pascal@19515
|
1205 rcl di,1
|
pascal@19515
|
1206 shl dx,1
|
pascal@19515
|
1207 loop @@shift
|
pascal@19515
|
1208 @@noshift:
|
pascal@19515
|
1209 popf
|
pascal@19515
|
1210 jnc @@end
|
pascal@19515
|
1211 not dx
|
pascal@19515
|
1212 neg di
|
pascal@19515
|
1213 jne @@end
|
pascal@19515
|
1214 inc dx
|
pascal@19515
|
1215 @@end:
|
pascal@19515
|
1216 xchg ax,di
|
pascal@19634
|
1217 @@popdisiret:
|
pascal@19515
|
1218 pop di
|
pascal@19515
|
1219 pop si
|
pascal@19515
|
1220 endif
|
pascal@19515
|
1221 ret
|
pascal@19515
|
1222
|
pascal@19515
|
1223 endp _strtol
|
pascal@19515
|
1224
|
pascal@19515
|
1225
|
pascal@19515
|
1226 ifdef NO386
|
pascal@19515
|
1227 ;***************************************************************
|
pascal@19515
|
1228 ;u16 topseg();
|
pascal@19515
|
1229 ;***************************************************************
|
pascal@19515
|
1230 global _topseg:near
|
pascal@19515
|
1231 proc _topseg near
|
pascal@19515
|
1232
|
pascal@19515
|
1233 int 12h
|
pascal@19515
|
1234 jnc @@max640k
|
pascal@19515
|
1235 mov ax,640 ; 9000
|
pascal@19515
|
1236 @@max640k:
|
pascal@19634
|
1237 dec ax
|
pascal@19515
|
1238 and al,0C0h
|
pascal@19515
|
1239 mov cl,6
|
pascal@19515
|
1240 shl ax,cl
|
pascal@19515
|
1241 ret
|
pascal@19515
|
1242
|
pascal@19515
|
1243 endp _topseg
|
pascal@19515
|
1244 endif
|
pascal@19515
|
1245
|
pascal@19825
|
1246 ifdef EXTRA
|
pascal@19825
|
1247 p8086
|
pascal@19825
|
1248 ;***************************************************************
|
pascal@19825
|
1249 ;char *progname(void)
|
pascal@19825
|
1250 ;***************************************************************
|
pascal@19825
|
1251 global _progname:near
|
pascal@19825
|
1252 proc _progname near
|
pascal@19825
|
1253
|
pascal@19825
|
1254 push si di es
|
pascal@19825
|
1255 mov ah,30h
|
pascal@19825
|
1256 int 21h
|
pascal@19875
|
1257 xor di,di
|
pascal@19825
|
1258 cmp al,3
|
pascal@19874
|
1259 mov ax,di
|
pascal@19825
|
1260 jb @@skip
|
pascal@19873
|
1261 ;mov es,[cs:2Ch]
|
pascal@19874
|
1262 mov es,[di+2Ch]
|
pascal@20146
|
1263 mov cx,sp ; big enough
|
pascal@19870
|
1264 @@loop:
|
pascal@19825
|
1265 repne
|
pascal@19825
|
1266 scasb
|
pascal@19825
|
1267 scasb
|
pascal@19870
|
1268 jne @@loop
|
pascal@19870
|
1269 inc di
|
pascal@19870
|
1270 inc di
|
pascal@19870
|
1271 mov si,di ; progname @es:di
|
pascal@19870
|
1272 repne
|
pascal@19870
|
1273 scasb
|
pascal@19870
|
1274 mov cx,di
|
pascal@19874
|
1275 sub cx,si ; progname len
|
pascal@19870
|
1276 call malloc_or_die ; keep cx
|
pascal@19870
|
1277 mov di,ax
|
pascal@19825
|
1278 push ds
|
pascal@19825
|
1279 push es
|
pascal@19825
|
1280 pop ds
|
pascal@19825
|
1281 pop es
|
pascal@19870
|
1282 rep
|
pascal@19870
|
1283 movsb
|
pascal@19870
|
1284 push es
|
pascal@19825
|
1285 pop ds
|
pascal@19825
|
1286 @@skip:
|
pascal@19825
|
1287 pop es di si
|
pascal@19825
|
1288 ret
|
pascal@19825
|
1289
|
pascal@19825
|
1290 endp _progname
|
pascal@19825
|
1291
|
pascal@19825
|
1292
|
pascal@19825
|
1293 ;***************************************************************
|
pascal@19875
|
1294 ;void chdirname(char *path)
|
pascal@19825
|
1295 ;***************************************************************
|
pascal@19825
|
1296 global _chdirname:near
|
pascal@19825
|
1297 proc _chdirname near
|
pascal@19825
|
1298
|
pascal@19825
|
1299 pop ax
|
pascal@19825
|
1300 pop bx
|
pascal@19825
|
1301 push bx
|
pascal@19825
|
1302 push ax
|
pascal@19825
|
1303
|
pascal@20146
|
1304 cmp [byte bx+1],3Ah ; ':'
|
pascal@19825
|
1305 jne @@nodisk
|
pascal@19875
|
1306 mov dl,20h
|
pascal@19875
|
1307 or dl,[bx]
|
pascal@19825
|
1308 sub dl,61h
|
pascal@19825
|
1309 mov ah,0Eh
|
pascal@19825
|
1310 int 21h
|
pascal@19825
|
1311 inc bx
|
pascal@19825
|
1312 inc bx
|
pascal@19825
|
1313 @@nodisk:
|
pascal@19825
|
1314 xor cx,cx
|
pascal@19825
|
1315 @@next:
|
pascal@19825
|
1316 mov al,[bx]
|
pascal@19825
|
1317 cmp al,5Ch
|
pascal@19825
|
1318 jne @@tsteos
|
pascal@19875
|
1319 mov dx,bx
|
pascal@19875
|
1320 inc cx
|
pascal@19825
|
1321 @@tsteos:
|
pascal@19825
|
1322 inc bx
|
pascal@19825
|
1323 or al,al
|
pascal@19825
|
1324 jnz @@next
|
pascal@19825
|
1325 jcxz @@end
|
pascal@19875
|
1326 mov bx,dx
|
pascal@19825
|
1327 push [word bx]
|
pascal@19825
|
1328 mov [bx],al
|
pascal@19875
|
1329 stc
|
pascal@20146
|
1330 mov ax,713Bh ; chdir long filename (ds:dx)
|
pascal@19875
|
1331 int 21h
|
pascal@20146
|
1332 mov ah,3Bh ; chdir(ds:dx)
|
pascal@19875
|
1333 jnc chdirdone
|
pascal@19875
|
1334 int 21h
|
pascal@19875
|
1335 chdirdone:
|
pascal@19825
|
1336 pop [word bx]
|
pascal@19825
|
1337 @@end:
|
pascal@19825
|
1338 ret
|
pascal@19825
|
1339
|
pascal@19825
|
1340 endp _chdirname
|
pascal@19825
|
1341
|
pascal@19825
|
1342
|
pascal@19825
|
1343 ;***************************************************************
|
pascal@19825
|
1344 ;char *ultoa(unsigned long n);
|
pascal@19825
|
1345 ;***************************************************************
|
pascal@19825
|
1346 global _ultoa:near
|
pascal@19825
|
1347 proc _ultoa near
|
pascal@19825
|
1348
|
pascal@19825
|
1349 pop ax
|
pascal@19825
|
1350 pop cx
|
pascal@19825
|
1351 pop dx
|
pascal@19825
|
1352 push dx
|
pascal@19825
|
1353 push cx
|
pascal@19825
|
1354 push ax ; DX:CX = n
|
pascal@19825
|
1355 push si
|
pascal@19825
|
1356 mov si,10
|
pascal@19825
|
1357 mov bx,offset ultoabuf+11
|
pascal@19825
|
1358 @@loop:
|
pascal@19825
|
1359 dec bx
|
pascal@19825
|
1360 xchg ax,dx
|
pascal@19825
|
1361 xor dx,dx
|
pascal@19825
|
1362 div si ; DX:AX = 0000:hi(n)
|
pascal@19825
|
1363 xchg ax,cx ; CX = hi(n)/10
|
pascal@19825
|
1364 div si ; DX:AX = hi(n)%10:lo(n)
|
pascal@19825
|
1365 xchg ax,cx ; CX = lo(n/10)
|
pascal@19825
|
1366 xchg ax,dx ; DX = hi(n)/10 = hi(n/10)
|
pascal@19825
|
1367 add al,'0'
|
pascal@19825
|
1368 mov [bx],al
|
pascal@19825
|
1369 mov ax,cx
|
pascal@19825
|
1370 or ax,dx
|
pascal@19825
|
1371 jnz @@loop
|
pascal@19825
|
1372 xchg ax,bx
|
pascal@19825
|
1373 pop si
|
pascal@19825
|
1374 ret
|
pascal@19825
|
1375
|
pascal@19825
|
1376 endp _ultoa
|
pascal@19825
|
1377
|
pascal@19825
|
1378
|
pascal@19825
|
1379 ;***************************************************************
|
pascal@19825
|
1380 ;unsigned long kver2ul(char *kernel_version);
|
pascal@19825
|
1381 ;***************************************************************
|
pascal@19825
|
1382 global _kver2ul:near
|
pascal@19825
|
1383 proc _kver2ul near
|
pascal@19825
|
1384
|
pascal@19825
|
1385 pop bx
|
pascal@19825
|
1386 pop ax
|
pascal@19825
|
1387 push ax
|
pascal@19825
|
1388 push bx
|
pascal@20146
|
1389 push si
|
pascal@19825
|
1390 xchg ax,si
|
pascal@20146
|
1391 xor bx,bx
|
pascal@20146
|
1392 mov cx,304h
|
pascal@19825
|
1393 @@number:
|
pascal@19825
|
1394 xor ax,ax
|
pascal@20146
|
1395 cwd
|
pascal@19825
|
1396 @@digit:
|
pascal@19825
|
1397 shl al,cl
|
pascal@19825
|
1398 shl ax,cl
|
pascal@19825
|
1399 lodsb
|
pascal@19825
|
1400 sub al,30h
|
pascal@19825
|
1401 cmp al,9
|
pascal@19825
|
1402 jbe @@digit
|
pascal@20146
|
1403 mov dl,bh
|
pascal@20146
|
1404 mov bh,bl
|
pascal@20146
|
1405 mov bl,ah
|
pascal@20146
|
1406 dec ch
|
pascal@20146
|
1407 jnz @@number
|
pascal@20146
|
1408 xchg ax,bx
|
pascal@20146
|
1409 pop si
|
pascal@19825
|
1410 kver2ulret:
|
pascal@19825
|
1411 ret
|
pascal@19825
|
1412
|
pascal@19825
|
1413 endp _kver2ul
|
pascal@19825
|
1414
|
pascal@19825
|
1415
|
pascal@19825
|
1416 ;***************************************************************
|
pascal@19825
|
1417 ;void try_default_args();
|
pascal@19825
|
1418 ;***************************************************************
|
pascal@19825
|
1419 global _try_default_args:near
|
pascal@19825
|
1420 proc _try_default_args near
|
pascal@19825
|
1421
|
pascal@19825
|
1422 mov bx,offset tazboot_cmd
|
pascal@19825
|
1423 call open
|
pascal@19825
|
1424 jc kver2ulret
|
pascal@19825
|
1425 mov cx,4096
|
pascal@19825
|
1426 mov di,[_heap_top]
|
pascal@19825
|
1427 push cx
|
pascal@19825
|
1428 extrn read_cmdline:near
|
pascal@19825
|
1429 jmp near read_cmdline ; read_cmdline(ax,di,cx)
|
pascal@19825
|
1430
|
pascal@19825
|
1431 endp _try_default_args
|
pascal@19825
|
1432
|
pascal@19825
|
1433 endif
|
pascal@19825
|
1434
|
pascal@19515
|
1435 ends _TEXT
|
pascal@19515
|
1436
|
pascal@19515
|
1437 end
|
pascal@19515
|
1438
|
pascal@19515
|
1439 ;###### END OF FILE ############################################
|
pascal@19825
|
1440
|