updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / lilo-gfxmenu / lilo-22.7-gfx.diff
blobe40f9005edb12671c39d7df68120f7fe42e17935
1 --- bsect.c
2 +++ bsect.c
3 @@ -774,6 +774,7 @@
4 if (st.st_size > i)
5 die("%s is too big (> %d bytes)",message,i);
6 param2.msg_len = bitmap ? (st.st_size+15)/16 : st.st_size;
7 + if(!bitmap) param2.msg_len = st.st_size > 0xffff ? 0xffff : st.st_size;
8 map_begin_section();
9 #ifndef LCF_UNIFY
10 map_add(&geo,0,((st.st_size)+SECTOR_SIZE-1)/SECTOR_SIZE);
11 --- gfxlogo.S
12 +++ gfxlogo.S
13 @@ -0,0 +1,764 @@
14 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
16 +; gfx stuff
18 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
20 +; != 0 -> everything is fine
21 +gfx_ok: .byte 0
23 +; we need it at some point
24 +gfx_tmp: .word 0
26 +; the memory area we are working with
27 +gfx_mem: .long 0 ; linear address
29 +; interface to loadable gfx extension (seg:ofs values)
30 +gfx_bc_jt: .long 0
32 +gfx_bc_init: .long 0
33 +gfx_bc_done: .long 0
34 +gfx_bc_input: .long 0
35 +gfx_bc_menu_init: .long 0
36 +gfx_bc_infobox_init: .long 0
37 +gfx_bc_infobox_done: .long 0
38 +gfx_bc_progress_init: .long 0
39 +gfx_bc_progress_done: .long 0
40 +gfx_bc_progress_update: .long 0
41 +gfx_bc_progress_limit: .long 0
42 +gfx_bc_password_init: .long 0
43 +gfx_bc_password_done: .long 0
45 +; system config data (52 bytes)
46 +gfx_sysconfig:
47 +gfx_bootloader: .byte 0
48 +gfx_sector_shift: .byte 0
49 +gfx_media_type: .byte 0
50 +gfx_failsafe: .byte 0
51 +gfx_sysconfig_size: .byte gfx_sysconfig_end-gfx_sysconfig
52 +gfx_boot_drive: .byte 0
53 +gfx_callback: .word 0
54 +gfx_bootloader_seg: .word 0
55 +gfx_reserved_1: .word 0
56 +gfx_user_info_0: .long 0
57 +gfx_user_info_1: .long 0
58 +gfx_bios_mem_size: .long 0
59 +gfx_xmem_0: .word 0x21 ; extended mem area 0 (start:size in MB; 12:4 bits)
60 +gfx_xmem_1: .word 0x41
61 +gfx_xmem_2: .word 0
62 +gfx_xmem_3: .word 0
63 +gfx_file: .long 0
64 +gfx_archive_start: .long 0
65 +gfx_archive_end: .long 0
66 +gfx_mem0_start: .long 0
67 +gfx_mem0_end: .long 0
68 +gfx_sysconfig_end:
70 +; menu entry descriptor
71 +menu_entries equ 0
72 +menu_default equ 2 ; seg:ofs
73 +menu_ent_list equ 6 ; seg:ofs
74 +menu_ent_size equ 10
75 +menu_arg_list equ 12 ; seg:ofs
76 +menu_arg_size equ 16
77 +sizeof_menu_desc equ 18
79 +menu_desc: .blkb sizeof_menu_desc
81 +; 64 dummy entries (all "")
82 +gfx_args_entry: .blkb 64
84 +gfx_password_buf: .blkb 32
85 +gfx_msg_wrong_image: .ascii "Could not find kernel image: "
86 + .byte 0
87 +gfx_msg_wrong_password: .ascii "Sorry, incorrect password."
88 + .byte 0
90 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
92 +; I really have no idea how to get as86 to do this properly
94 + macro farcall
95 + .byte 0xff
96 + .byte 0x1e
97 + .word ?1
98 + mend
100 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
102 +gfx_get_sysconfig:
103 + xor ax,ax
104 + ret
106 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
108 +gfx_set_sysconfig:
109 + ret
111 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
113 +; Initialize graphics code. Load and display graphics data.
115 +; edi file length
117 +; return: [gfx_ok] = 0/1
119 +gfx_init:
120 + push es
122 + cld
124 + mov byte gfx_ok,#0
126 + ; no gfx if we use a serial line
127 + cmp byte par2_port,#0
128 + jnz near gfx_init_90
130 + mov gfx_bootloader_seg,cs
131 + mov gfx_archive_end,edi
133 + ; define our memory area
134 + ; gfx_mem _must_ be 16-byte aligned
135 + mov dword gfx_mem,#0x10000
136 + add edi,gfx_mem
137 + add edi,#15 ; add space for alignment
138 + mov gfx_mem0_start,edi
139 + mov dword gfx_mem0_end,#0x80000
141 + sub edi,gfx_mem0_end
142 + neg edi
143 + cmp edi,#0x1000 ; we need some minimum space
144 + jc near gfx_init_80
146 + ; align 4
147 + mov eax,gfx_mem0_start
148 + add eax,#3
149 + and eax,#~3
150 + mov gfx_mem0_start,eax
152 + call find_file
153 + or eax,eax
154 + jz near gfx_init_80
156 + push edi
157 + push eax
158 + add eax,edi
159 + call align_it
160 + pop eax
161 + pop edi
163 + sub edi,gfx_mem
164 + mov ecx,gfx_archive_start
165 + add edi,ecx
166 + mov gfx_file,edi
167 + add gfx_archive_end,ecx
168 + add eax,edi
169 + shr eax,4
170 + mov gfx_bc_jt+2,ax
172 + ; setup jump table
173 + les bx,gfx_bc_jt
175 + seg es
176 + mov ax,(bx)
177 + mov gfx_bc_init,ax
178 + mov gfx_bc_init+2,es
180 + seg es
181 + mov ax,(bx+2)
182 + mov gfx_bc_done,ax
183 + mov gfx_bc_done+2,es
185 + seg es
186 + mov ax,(bx+4)
187 + mov gfx_bc_input,ax
188 + mov gfx_bc_input+2,es
190 + seg es
191 + mov ax,(bx+6)
192 + mov gfx_bc_menu_init,ax
193 + mov gfx_bc_menu_init+2,es
195 + seg es
196 + mov ax,(bx+8)
197 + mov gfx_bc_infobox_init,ax
198 + mov gfx_bc_infobox_init+2,es
200 + seg es
201 + mov ax,(bx+10)
202 + mov gfx_bc_infobox_done,ax
203 + mov gfx_bc_infobox_done+2,es
205 + seg es
206 + mov ax,(bx+12)
207 + mov gfx_bc_progress_init,ax
208 + mov gfx_bc_progress_init+2,es
210 + seg es
211 + mov ax,(bx+14)
212 + mov gfx_bc_progress_done,ax
213 + mov gfx_bc_progress_done+2,es
215 + seg es
216 + mov ax,(bx+16)
217 + mov gfx_bc_progress_update,ax
218 + mov gfx_bc_progress_update+2,es
220 + seg es
221 + mov ax,(bx+18)
222 + mov gfx_bc_progress_limit,ax
223 + mov gfx_bc_progress_limit+2,es
225 + seg es
226 + mov ax,(bx+20)
227 + mov gfx_bc_password_init,ax
228 + mov gfx_bc_password_init+2,es
230 + seg es
231 + mov ax,(bx+22)
232 + mov gfx_bc_password_done,ax
233 + mov gfx_bc_password_done+2,es
235 + ; esi sysconfig data
236 + .byte 0x66
237 + mov si,ds ; mov esi,ds
238 + shl esi,4
239 + add esi,#gfx_sysconfig
241 + farcall(gfx_bc_init)
243 + jc gfx_init_80
245 + mov byte gfx_ok,#1
247 + jmp gfx_init_90
249 +gfx_init_80:
250 + mov byte gfx_ok,#0
251 +gfx_init_90:
252 + pop es
253 + ret
256 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
258 +; Back to text mode.
260 +; return: [gfx_ok] = 0
262 +gfx_done:
263 + cmp byte gfx_ok,#0
264 + jz gfx_done_90
265 + farcall(gfx_bc_done)
266 + mov byte gfx_ok,#0
267 + call gfx_set_sysconfig
268 +gfx_done_90:
269 + ret
272 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
274 +gfx_input:
275 + cmp byte gfx_ok,#0
276 + jz gfx_input_90
277 + call gfx_get_sysconfig
279 + mov ax,#0xffff
280 + xchg ax,par2_timeout
282 + ; map 0xffff -> 0
283 + add ax,#1
284 + cmc
285 + sbb ax,#0
287 +gfx_input_20:
288 + .byte 0x66
289 + mov di,ds ; mov edi,ds
290 + shl edi,4
291 + add edi,#cmdline
292 + mov ecx,#CL_LENGTH
293 + movzx eax,ax
295 + ; edi buffer (0: no buffer)
296 + ; ecx buffer size
297 + ; eax timeout value (0: no timeout)
299 + farcall(gfx_bc_input)
301 + pushf
302 + call gfx_set_sysconfig
303 + popf
304 + jnc gfx_input_50
305 + mov ax,#1
306 +gfx_input_50:
307 + cmp ax,#1
308 + jz gfx_input_80
310 + call find_boot_image
311 + jnc gfx_input_90
313 + .byte 0x66
314 + mov cx,ds ; mov ecx,ds
315 + shl ecx,4
316 + lea esi,(ecx+gfx_msg_wrong_image)
317 + lea edi,(ecx+cmdline)
319 + mov al,#0
320 + call gfx_infobox
322 + xor ax,ax
323 + jmp gfx_input_20
324 +gfx_input_80:
325 + push ax
326 + call gfx_done
327 + pop ax
328 +gfx_input_90:
329 + ret
332 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
334 +gfx_setup_menu:
335 + cmp byte gfx_ok,#0
336 + jz gfx_setup_menu_90
338 + mov si,#DESCR0
339 + mov di,si
340 + xor ax,ax
341 + mov cx,#IMAGES
342 +gfx_setup_menu_20:
343 + cmp byte (si),#0
344 + jz gfx_setup_menu_30
345 + inc ax
346 + add si,#id_size
347 + loop gfx_setup_menu_20
348 +gfx_setup_menu_30:
349 + mov esi,#menu_desc
351 + xor ah,ah
352 + mov (si+menu_entries),ax
354 + mov (si+menu_default),di
355 + mov (si+menu_default+2),ds
357 + mov (si+menu_ent_list),di
358 + mov (si+menu_ent_list+2),ds
359 + mov word (si+menu_ent_size),#id_size
361 + mov word (si+menu_arg_list),#gfx_args_entry
362 + mov (si+menu_arg_list+2),ds
363 + mov word (si+menu_arg_size),#1
365 + .byte 0x66
366 + mov ax,ds ; mov eax,ds
367 + shl eax,4
368 + add esi,eax
370 + farcall(gfx_bc_menu_init)
371 +gfx_setup_menu_90:
372 + ret
375 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
377 +gfx_infobox:
378 + pushad
379 + cmp byte gfx_ok,#0
380 + jz gfx_infobox_90
381 + farcall(gfx_bc_infobox_init)
382 + xor edi,edi
383 + xor eax,eax
384 + farcall(gfx_bc_input)
385 + farcall(gfx_bc_infobox_done)
386 +gfx_infobox_90:
387 + popad
388 + ret
391 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
393 +gfx_progress_init:
394 + pushad
395 + cmp byte gfx_ok,#0
396 + jz gfx_progress_init_90
397 + movzx eax,ax
398 + farcall(gfx_bc_progress_init)
399 +gfx_progress_init_90:
400 + popad
401 + ret
404 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
406 +gfx_progress_done:
407 + pushad
408 + cmp byte gfx_ok,#0
409 + jz gfx_progress_done_90
410 + farcall(gfx_bc_progress_done)
411 +gfx_progress_done_90:
412 + popad
413 + ret
416 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
418 +gfx_progress_update:
419 + pushad
420 + cmp byte gfx_ok,#0
421 + jz gfx_progress_update_90
422 + movzx eax,cx
423 + farcall(gfx_bc_progress_update)
424 +gfx_progress_update_90:
425 + popad
426 + ret
429 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
431 +gfx_progress_limit:
432 + pushad
433 + cmp byte gfx_ok,#0
434 + jz gfx_progress_limit_90
435 + movzx eax,ax
436 + farcall(gfx_bc_progress_limit)
437 +gfx_progress_limit_90:
438 + popad
439 + ret
442 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
444 +; ds:di image descr
446 +gfx_password:
447 + push es
448 + pushad
449 + cmp byte gfx_ok,#0
450 + stc
451 + jz gfx_password_90
452 + push di
453 + .byte 0x66
454 + mov cx,ds ; mov ecx,ds
455 + shl ecx,4
456 + lea esi,(ecx+gfx_password_buf) ; not used
457 + movzx edi,di
458 + add edi,ecx
459 + farcall(gfx_bc_password_init)
460 + .byte 0x66
461 + mov di,ds ; mov edi,ds
462 + shl edi,4
463 + add edi,#gfx_password_buf
464 + mov ecx,#32
465 + xor eax,eax
466 + farcall(gfx_bc_input)
467 + .byte 0x66
468 + mov si,ds ; mov esi,ds
469 + shl esi,4
470 + add esi,#gfx_password_buf
471 + farcall(gfx_bc_password_done)
472 + pop di
473 + call check_password
474 + jnc gfx_password_90
475 + .byte 0x66
476 + mov si,ds ; mov esi,ds
477 + shl esi,4
478 + add esi,#gfx_msg_wrong_password
479 + xor edi,edi
480 + mov al,#0
481 + farcall(gfx_bc_infobox_init)
482 + xor edi,edi
483 + xor eax,eax
484 + farcall(gfx_bc_input)
485 + farcall(gfx_bc_infobox_done)
486 + stc
487 +gfx_password_90:
488 + popad
489 + pop es
490 + ret
493 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
495 +; Convert 32bit linear address to seg:ofs.
497 +; dword [esp + 2]: linear address
499 +; return:
500 +; dword [esp + 2]: seg:ofs
502 +; Notes:
503 +; - changes no regs
505 +gfx_l2so:
506 + push eax
507 + mov eax,(esp + 6)
508 + shr eax,4
509 + mov (esp + 8),ax
510 + and word (esp + 6),#0xf
511 + pop eax
512 + ret
514 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
516 +; locate the boot image
518 +; return:
519 +; bx boot image index
520 +; CF error (image not found)
522 +find_boot_image:
523 + mov dx,#DESCR0
524 + mov cx,#IMAGES
526 + xor bx,bx
528 +find_boot_image_10:
529 + mov si,dx
530 + mov di,#cmdline
531 +find_boot_image_20:
532 + mov al,(si)
533 + or al,al
534 + jz find_boot_image_60
535 + cmp al,(di)
536 + jnz find_boot_image_30
537 + inc si
538 + inc di
539 + jmp find_boot_image_20
540 +find_boot_image_30:
541 + inc bx
542 + add dx,#id_size
543 + cmp bx,cx
544 + jb find_boot_image_10
545 + ; not found, strip options for fancy error message
547 + mov si,#cmdline
548 + mov cx,#MAX_IMAGE_NAME+1
549 +find_boot_image_40:
550 + cmp byte (si),#0x20+1
551 + inc si
552 + jb find_boot_image_50
553 + loop find_boot_image_40
554 +find_boot_image_50:
555 + mov byte (si-1),#0
556 + jmp find_boot_image_80
557 +find_boot_image_60:
558 + mov al,(di)
559 + cmp al,#0x20
560 + ja find_boot_image_30
561 + imul bx,bx,#id_size
562 + add bx,#DESCR0
563 + jmp find_boot_image_90
564 +find_boot_image_80:
565 + stc
566 +find_boot_image_90:
567 + ret
570 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
572 +; ds:di image descr
574 +; CF = 0: password valid
576 +check_password:
577 +#if defined(SHS_PASSWORDS)
578 + mov bp,di
579 + mov di,#gfx_password_buf
580 + mov si,di
581 + push ds
582 + pop es
583 + mov cx,#32 - 1
584 + xor al,al
585 + repne
586 + scasb
587 + sub cx,#32 - 1
588 + not cx
589 + mov bx,cx
591 + push ss
592 + pop es
593 + mov cx,#32
594 + sub sp,cx
595 + mov di,sp
596 + rep
597 + movsb
598 + mov si,sp
600 + push bp
602 + push bx ; length
603 + push si ; ss:si password
604 + call _shsInit
605 + call _shsUpdate
606 + call _shsFinal
607 + pop si
608 + pop bx
610 + pop di
612 + add di,#id_password_crc
613 + mov si,#shs_digest
614 + mov cx,#MAX_PW_CRC*4
615 + push ds
616 + pop es
617 + repe
618 + cmpsb
619 + je check_pw_50
620 + inc cx
621 +check_pw_50:
622 + add sp,#32
623 + pushad ; clear password buffer
624 + mov di,#gfx_password_buf
625 + mov cx,#32
626 + xor al,al
627 + rep
628 + stosb
629 + popad
630 + cmp cx,#1
631 + cmc
632 +#endif
633 + ret
636 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
638 +; locate graphics file
640 +; return: eax: code offset (0 -> no file found)
641 +; edi: gfx file start
643 +find_file:
644 + mov edi,gfx_mem
645 + push edi
646 + call gfx_l2so
647 + pop bx
648 + pop es
649 + call magic_ok
650 + or eax,eax
651 + jnz find_file_90
653 + ; ok, maybe it's a cpio archive
655 + ; note: edi must be properly aligned (2)!
657 +find_file_20:
658 + mov ecx,gfx_mem0_start
659 + sub ecx,#26 + 12 ; min cpio header + gfx header
660 + cmp edi,ecx
661 + jae find_file_90
663 + push edi
664 + call gfx_l2so
665 + pop bx
666 + pop es
667 + seg es
668 + cmp word (bx),#0x71c7
669 + jnz find_file_90 ; no cpio record
671 + seg es
672 + movzx esi,word (bx+20) ; file name size
674 + inc si
675 + and si,#~1 ; align
677 + seg es
678 + mov ecx,(bx+22) ; data size
679 + rol ecx,#16 ; get word order right
681 + inc ecx
682 + and ecx,#~1 ; align
684 + add si,#26 ; skip header
686 + add edi,esi
687 + add bx,si
688 + call magic_ok
689 + or eax,eax
690 + jnz find_file_90
692 + add edi,ecx
693 + jmp find_file_20
695 +find_file_90:
696 + ret
699 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
701 +; es:bx file start
703 +; return: eax: offset to code entry
705 +; Notes:
706 +; - changes no regs except eax
708 +magic_ok:
709 + xor eax,eax
710 + seg es
711 + cmp dword (bx),#0x0b2d97f00 ; header.magic_id
712 + jnz magic_ok_90
713 + ; version 8
714 + seg es
715 + cmp byte (bx+4),#8 ; header.version
716 + jb magic_ok_90
717 + seg es
718 + cmp byte (bx+4),#8 ; header.version
719 + ja magic_ok_90
720 + seg es
721 + mov eax,(bx+8)
722 +magic_ok_90:
723 + ret
726 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
728 +; eax address to be aligned
730 +align_it:
731 + push dword gfx_mem
732 + pop dword gfx_archive_start
733 + neg al
734 + and eax,#0x0f
735 + jz align_it_90
736 + add gfx_archive_start,eax
737 + mov esi,gfx_mem
738 + mov ebx,gfx_mem0_start
739 + sub ebx,esi
740 + sub ebx,#0x0f
741 + add esi,ebx
742 + dec esi
744 + std
746 +align_it_30:
747 + or ebx,ebx
748 + jz align_it_60
749 + mov ecx,ebx
750 + cmp ebx,#0x8000
751 + jb align_it_40
752 + mov ecx,#0x8000
753 +align_it_40:
754 + push esi
755 + sub ebx,ecx
756 + sub (esp),ecx
757 + push esi
758 + call gfx_l2so
759 + pop si
760 + add si,#0x8000
761 + sub word (esp),#0x8000 >> 4
762 + pop es
763 + mov di,si
764 + add di,ax
765 + seg es
766 + rep
767 + movsb
768 + pop esi
769 + jmp align_it_30
770 +align_it_60:
772 + cld
774 +align_it_90:
775 + ret
778 --- lilo.h
779 +++ lilo.h
780 @@ -331,7 +331,7 @@
781 #define DC_MAGIC 0xf4f2 /* magic number of default cmd. line sector */
782 #define DC_MGOFF 0x6b6d /* magic number for disabled line */
784 -#define MAX_MESSAGE 65535 /* maximum message length */
785 +#define MAX_MESSAGE 8*64*1024-1 /* maximum message length (512k) */
786 #define MAX_MENU_TITLE 37 /* maximum MENU title length */
788 #define NEW_HDR_SIG "HdrS" /* setup header signature */
789 --- Makefile
790 +++ Makefile
791 @@ -330,15 +330,15 @@
792 first.s: first.S lilo.h version.h Makefile
793 $(CPP) $(PCONFIG) -DFIRST=0x199d1f05 -o first.s first.S
795 -second.s: second.S read.S volume.S mapper.S biosdata.S shs3.S bdata.h lilo.h version.h \
796 +second.s: second.S gfxlogo.S read.S volume.S mapper.S biosdata.S shs3.S bdata.h lilo.h version.h \
797 graph.S menu.S strlen.S bitmap.S crt.S display4.S Makefile
798 $(CPP) $(PCONFIG) -DTEXT=0x8bd7820b second.S -o second.s
800 -third.s: second.S read.S volume.S mapper.S biosdata.S shs3.S bdata.h lilo.h version.h \
801 +third.s: second.S gfxlogo.S read.S volume.S mapper.S biosdata.S shs3.S bdata.h lilo.h version.h \
802 graph.S menu.S strlen.S bitmap.S crt.S display4.S Makefile
803 $(CPP) $(PCONFIG) -DMENU=0x7920a7c2 second.S -o third.s
805 -bitmap.s: second.S read.S volume.S mapper.S biosdata.S shs3.S bdata.h lilo.h version.h \
806 +bitmap.s: second.S gfxlogo.S read.S volume.S mapper.S biosdata.S shs3.S bdata.h lilo.h version.h \
807 graph.S menu.S strlen.S bitmap.S crt.S display4.S Makefile
808 $(CPP) $(PCONFIG) -DBITMAP=0xf54f8b9d second.S -o bitmap.s
810 --- second.S
811 +++ second.S
812 @@ -618,7 +618,8 @@
813 seg es
814 cmp byte ptr (si),#0 ! empty ?
815 je iloop ! yes -> enter interactive mode
816 - jmp niloop ! enter non-interactive mode
817 +niloop0:
818 + br niloop ! enter non-interactive mode
820 ! No external parameters after timeout -> boot first image
822 @@ -626,7 +627,7 @@
823 pop es
824 mov si,#DFLCMD+2 ! default command line ?
825 cmp byte ptr (si),#0
826 - jne niloop ! yes -> use it
827 + jne niloop0 ! yes -> use it
828 mov ax,nodfl ! no idea how to tell as86 to do jmp (addr) :-(
829 jmp ax ! fall through
831 @@ -634,16 +635,23 @@
832 ! Command input processor
834 iloop:
835 -#if defined(MENU) || defined(BITMAP)
836 +#ifdef BITMAP
837 call menu_setup
838 #endif
840 #ifndef BITMAP
841 + cmp byte gfx_ok,#0
842 + jnz iloop_gfx
844 + ; load message before doing anything else
845 + ; the graphics/text stuff is mixed in a rather messy way...
847 ;; BEG_FS
848 ;; SEG_FS ! message disabled ?
849 cmp word ptr par2_msg_len,#0 ;MSG_OFF+SSDIFF,#0
850 ;; END_FS
851 - je nomsg ! yes -> skip this
852 + ; _must_ be 'jz'!
853 + jz iloop_20 ! yes -> skip this
854 call crlf
855 ;BEG_FS
856 ;SEG_FS ! load the message file
857 @@ -657,13 +665,96 @@
858 call sread
859 call loadfile
861 + ; es:bx points to file end
862 + movzx ebx,bx
863 + xor edi,edi
864 + mov di,es
865 + shl edi,4
866 + add edi,ebx
867 + sub edi,#SYSSEG * 16
869 + ; edi -> message file size
871 xor bx,bx ! set the terminating NUL and disable further
872 ! messages
873 xchg bx,par2_msg_len ;MSG_OFF+SSDIFF
875 push #SYSSEG
876 pop ds
877 - mov byte ptr (bx),#0
879 + cmp word ptr 0,#0x71c7 ; cpio header
880 + jz iloop_cpio
882 + cmp dword ptr 0,#0x0b2d97f00 ; magic header
883 + ; _must_ be 'jnz'!
884 + jnz iloop_10
886 +iloop_cpio:
888 + push cs
889 + pop ds
891 + ; graphical message
893 + call gfx_init
894 + push cs
895 + pop es
896 + cmp byte gfx_ok,#0
897 + jz iloop
898 + call gfx_setup_menu
899 +iloop_gfx:
900 + push cs
901 + pop es
902 + call gfx_input
903 + cmp ax,#1
904 + jz iloop ; text mode
905 + mov gfx_tmp,bx
906 + jmp near scan_cmdline
908 + ; normal text message
909 +iloop_10:
910 + ; keep the zero flag!
911 + mov byte ptr (bx),#0
912 + push cs
913 + pop ds
915 +iloop_20:
916 +#ifdef MENU
917 + pushf
918 + call menu_setup
919 + popf
920 +#endif
921 + jnz totxt
923 + mov ax,showit
924 + mov dx,showit+2
925 + mov bx,ax
926 + or bx,dx
927 + jz iloop_40
928 + push ds
929 + shl dx,12
930 + mov bx,ax
931 + and bx,#0xf
932 + shr ax,4
933 + add ax,dx
934 + add ax,#SYSSEG
935 + mov ds,ax
936 + call say
937 + pop ds
938 + xor ax,ax
939 + mov showit,ax
940 + mov showit+2,ax
941 +iloop_40:
943 + jmp nomsg
945 +showit:
946 + .long 0
948 +totxt:
949 + push #SYSSEG
950 + pop ds
952 xor bx,bx ! display the message
953 call say
955 @@ -699,12 +790,6 @@
956 mov al,(si)
957 inc si
958 jmp gotinp ! go on
960 -tolist:
961 -#ifdef BITMAP
962 - call menu_exit
963 -#endif
964 - br list ! ...
966 kbinp:
967 mov cx,#brto ! get a key
968 @@ -733,7 +818,7 @@
969 cmp al,#8 ! BS ?
970 je todelch ! yes -> erase one character
971 cmp al,#13 ! CR ?
972 - je cr ! yes -> go on
973 + je near cr ! yes -> go on
974 cmp al,#127 ! DEL ?
975 je todelch ! yes -> erase one character
976 ja input ! non-printable -> ignore it
977 @@ -783,6 +868,11 @@
979 todelch:br delch ! ...
980 todell: br delline ! ...
981 +tolist:
982 +#ifdef BITMAP
983 + call menu_exit
984 +#endif
985 + br list ! ...
987 ! End of input, process the command line
989 @@ -825,6 +915,8 @@
990 or al,al ! at end ?
991 jnz cpsav ! no -> go on
994 +scan_cmdline:
995 cmp bx,#cmdline ! empty line ?
996 je notrspc ! yes -> boot first image
997 cmp byte ptr (bx-1),#32 ! trailing space ?
998 @@ -882,6 +974,11 @@
999 je chkvga ! yes -> look for options again
1000 or al,al ! at end ?
1001 jnz vsknb ! no -> go on
1003 + mov bx,gfx_tmp
1004 + cmp byte gfx_ok,#0
1005 + jnz near boot
1007 call crlf ! write CR/LF
1008 cmp di,#cmdline+1 ! empty line ?
1009 emptyl: je bfirst ! yes -> boot first image
1010 @@ -1073,6 +1170,16 @@
1011 ;; SEG_FS
1012 mov word ptr par2_timeout,#0xffff ; cancel timeout
1013 ;; END_FS
1015 + cmp byte gfx_ok,#0
1016 + jz dopw_nogfx
1017 + mov di,bx
1018 + call gfx_password
1019 + pop bx
1020 + jnc toboot
1021 + jmp near iloop
1022 +dopw_nogfx:
1024 mov bx,#msg_pw ! display a prompt
1025 call say
1027 @@ -1450,7 +1557,9 @@
1029 ! Boot the image BX points to
1031 -doboot: mov byte ptr prechr,#61 ! switch to equal sign
1032 +doboot:
1033 + call gfx_done
1034 + mov byte ptr prechr,#61 ! switch to equal sign
1035 push bx ! save image descr
1036 mov bx,#msg_l ! say hi
1037 call say
1038 @@ -3274,6 +3383,8 @@
1042 +#include "gfxlogo.S"
1044 #ifdef SHS_PASSWORDS
1045 #include "shs3.S"
1046 #endif
1047 @@ -3421,6 +3532,8 @@
1048 jmp vgaput1
1049 #else
1050 xor cx,cx
1051 + mov bh,ch
1052 + mov bl,#10 ; bx: base (_not_ bl!)
1053 mov ah,cl
1054 test byte ptr (si),#0xff ! no value ?
1055 jz vgaerr ! yes -> error
1056 @@ -3429,17 +3542,47 @@
1057 jz vgaput ! yes -> done
1058 cmp al,#32
1059 je vgaput
1060 - cmp al,#48 ! is it a digit ? (0x30=48="0")
1061 - jb vgaerr ! no -> error
1062 - cmp al,#57 ! 57=0x39="9"
1063 - ja vgaerr
1064 - sub al,#48 ! cx = cx*10+al-'0'
1065 - imul cx,#10
1066 + cmp al,#0x61
1067 + jb vgadig_10
1068 + sub al,#0x20 ; upper case
1069 +vgadig_10:
1070 + or cx,cx
1071 + jnz vgadig_20
1072 + cmp al,#0x58
1073 + jnz vgadig_20
1074 + mov bl,#16 ; hex
1075 + jmp vgadig
1076 +vgadig_20:
1077 + cmp al,#0x3a
1078 + jb vgadig_30
1079 + sub al,#7
1080 +vgadig_30:
1081 + sub al,#0x30
1082 + jb vgaerr ; not a digit
1083 + cmp al,bl
1084 + jae vgaerr ; larger than current base
1085 + imul cx,bx
1086 add cx,ax
1087 jnc vgadig ! next one
1088 #endif
1090 -vgaerr: mov bx,#msg_v ! display an error message
1091 +vgaerr:
1092 + mov bx,#msg_v ! display an error message
1093 + cmp byte gfx_ok,#0
1094 + jz vgaerr_txt
1095 + lea esi,(bx+1) ; skip initial NL
1096 + .byte 0x66
1097 + mov di,ds ; mov edi,ds
1098 + shl edi,4
1099 + add esi,edi
1100 + xor edi,edi
1101 + mov al,#0
1102 + mov msg_v1,al ; drop final NL
1103 + call gfx_infobox
1104 + mov byte msg_v1,#10 ; put it back
1105 + stc
1106 + ret
1107 +vgaerr_txt:
1108 call say
1109 /* ifdef HIGHMEM_MAX */
1110 xor eax,eax
1111 @@ -3583,8 +3726,10 @@
1112 xor dx,dx
1113 mov cx,#10 ! default radix is decimal
1114 cmp byte ptr (si),#0x39
1115 - ja s2lbad ! error if > '9'
1116 + /* Those were changed to jna and previously */
1117 + ja s2lbad ! error if > '9'
1118 cmp byte ptr (si),#0x30 ! == '0'?
1119 + /* Likewise */
1120 jb s2lbad ! error if < '0'
1121 jne s2lnext
1122 inc si
1123 @@ -3890,8 +4035,8 @@
1125 msg_v: .byte 10
1126 .ascii "Valid vga values are ASK, NORMAL, EXTENDED or a "
1127 - .ascii "decimal number."
1128 - .byte 10,0
1129 + .ascii "number."
1130 +msg_v1: .byte 10,0
1132 msg_pks:.byte 10
1133 .ascii "Invalid hexadecimal number. - Ignoring remaining items."