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;
10 map_add(&geo,0,((st.st_size)+SECTOR_SIZE-1)/SECTOR_SIZE);
14 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
18 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
20 +; != 0 -> everything is fine
23 +; we need it at some point
26 +; the memory area we are working with
27 +gfx_mem: .long 0 ; linear address
29 +; interface to loadable gfx extension (seg:ofs values)
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)
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
64 +gfx_archive_start: .long 0
65 +gfx_archive_end: .long 0
66 +gfx_mem0_start: .long 0
67 +gfx_mem0_end: .long 0
70 +; menu entry descriptor
72 +menu_default equ 2 ; seg:ofs
73 +menu_ent_list equ 6 ; seg:ofs
75 +menu_arg_list equ 12 ; seg:ofs
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: "
87 +gfx_msg_wrong_password: .ascii "Sorry, incorrect password."
90 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
92 +; I really have no idea how to get as86 to do this properly
100 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
106 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
111 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
113 +; Initialize graphics code. Load and display graphics data.
117 +; return: [gfx_ok] = 0/1
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
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
143 + cmp edi,#0x1000 ; we need some minimum space
144 + jc near gfx_init_80
147 + mov eax,gfx_mem0_start
150 + mov gfx_mem0_start,eax
154 + jz near gfx_init_80
164 + mov ecx,gfx_archive_start
167 + add gfx_archive_end,ecx
178 + mov gfx_bc_init+2,es
183 + mov gfx_bc_done+2,es
187 + mov gfx_bc_input,ax
188 + mov gfx_bc_input+2,es
192 + mov gfx_bc_menu_init,ax
193 + mov gfx_bc_menu_init+2,es
197 + mov gfx_bc_infobox_init,ax
198 + mov gfx_bc_infobox_init+2,es
202 + mov gfx_bc_infobox_done,ax
203 + mov gfx_bc_infobox_done+2,es
207 + mov gfx_bc_progress_init,ax
208 + mov gfx_bc_progress_init+2,es
212 + mov gfx_bc_progress_done,ax
213 + mov gfx_bc_progress_done+2,es
217 + mov gfx_bc_progress_update,ax
218 + mov gfx_bc_progress_update+2,es
222 + mov gfx_bc_progress_limit,ax
223 + mov gfx_bc_progress_limit+2,es
227 + mov gfx_bc_password_init,ax
228 + mov gfx_bc_password_init+2,es
232 + mov gfx_bc_password_done,ax
233 + mov gfx_bc_password_done+2,es
235 + ; esi sysconfig data
237 + mov si,ds ; mov esi,ds
239 + add esi,#gfx_sysconfig
241 + farcall(gfx_bc_init)
256 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
258 +; Back to text mode.
260 +; return: [gfx_ok] = 0
265 + farcall(gfx_bc_done)
267 + call gfx_set_sysconfig
272 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
277 + call gfx_get_sysconfig
280 + xchg ax,par2_timeout
289 + mov di,ds ; mov edi,ds
295 + ; edi buffer (0: no buffer)
297 + ; eax timeout value (0: no timeout)
299 + farcall(gfx_bc_input)
302 + call gfx_set_sysconfig
310 + call find_boot_image
314 + mov cx,ds ; mov ecx,ds
316 + lea esi,(ecx+gfx_msg_wrong_image)
317 + lea edi,(ecx+cmdline)
332 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
336 + jz gfx_setup_menu_90
344 + jz gfx_setup_menu_30
347 + loop gfx_setup_menu_20
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
366 + mov ax,ds ; mov eax,ds
370 + farcall(gfx_bc_menu_init)
375 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
381 + farcall(gfx_bc_infobox_init)
384 + farcall(gfx_bc_input)
385 + farcall(gfx_bc_infobox_done)
391 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
396 + jz gfx_progress_init_90
398 + farcall(gfx_bc_progress_init)
399 +gfx_progress_init_90:
404 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
409 + jz gfx_progress_done_90
410 + farcall(gfx_bc_progress_done)
411 +gfx_progress_done_90:
416 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
418 +gfx_progress_update:
421 + jz gfx_progress_update_90
423 + farcall(gfx_bc_progress_update)
424 +gfx_progress_update_90:
429 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
434 + jz gfx_progress_limit_90
436 + farcall(gfx_bc_progress_limit)
437 +gfx_progress_limit_90:
442 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
454 + mov cx,ds ; mov ecx,ds
456 + lea esi,(ecx+gfx_password_buf) ; not used
459 + farcall(gfx_bc_password_init)
461 + mov di,ds ; mov edi,ds
463 + add edi,#gfx_password_buf
466 + farcall(gfx_bc_input)
468 + mov si,ds ; mov esi,ds
470 + add esi,#gfx_password_buf
471 + farcall(gfx_bc_password_done)
473 + call check_password
474 + jnc gfx_password_90
476 + mov si,ds ; mov esi,ds
478 + add esi,#gfx_msg_wrong_password
481 + farcall(gfx_bc_infobox_init)
484 + farcall(gfx_bc_input)
485 + farcall(gfx_bc_infobox_done)
493 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
495 +; Convert 32bit linear address to seg:ofs.
497 +; dword [esp + 2]: linear address
500 +; dword [esp + 2]: seg:ofs
510 + and word (esp + 6),#0xf
514 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
516 +; locate the boot image
519 +; bx boot image index
520 +; CF error (image not found)
534 + jz find_boot_image_60
536 + jnz find_boot_image_30
539 + jmp find_boot_image_20
544 + jb find_boot_image_10
545 + ; not found, strip options for fancy error message
548 + mov cx,#MAX_IMAGE_NAME+1
550 + cmp byte (si),#0x20+1
552 + jb find_boot_image_50
553 + loop find_boot_image_40
556 + jmp find_boot_image_80
560 + ja find_boot_image_30
561 + imul bx,bx,#id_size
563 + jmp find_boot_image_90
570 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
574 +; CF = 0: password valid
577 +#if defined(SHS_PASSWORDS)
579 + mov di,#gfx_password_buf
603 + push si ; ss:si password
612 + add di,#id_password_crc
614 + mov cx,#MAX_PW_CRC*4
623 + pushad ; clear password buffer
624 + mov di,#gfx_password_buf
636 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
638 +; locate graphics file
640 +; return: eax: code offset (0 -> no file found)
641 +; edi: gfx file start
653 + ; ok, maybe it's a cpio archive
655 + ; note: edi must be properly aligned (2)!
658 + mov ecx,gfx_mem0_start
659 + sub ecx,#26 + 12 ; min cpio header + gfx header
668 + cmp word (bx),#0x71c7
669 + jnz find_file_90 ; no cpio record
672 + movzx esi,word (bx+20) ; file name size
678 + mov ecx,(bx+22) ; data size
679 + rol ecx,#16 ; get word order right
682 + and ecx,#~1 ; align
684 + add si,#26 ; skip header
699 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
703 +; return: eax: offset to code entry
706 +; - changes no regs except eax
711 + cmp dword (bx),#0x0b2d97f00 ; header.magic_id
715 + cmp byte (bx+4),#8 ; header.version
718 + cmp byte (bx+4),#8 ; header.version
726 +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
728 +; eax address to be aligned
732 + pop dword gfx_archive_start
736 + add gfx_archive_start,eax
738 + mov ebx,gfx_mem0_start
761 + sub word (esp),#0x8000 >> 4
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 */
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
814 cmp byte ptr (si),#0 ! empty ?
815 je iloop ! yes -> enter interactive mode
816 - jmp niloop ! enter non-interactive mode
818 + br niloop ! enter non-interactive mode
820 ! No external parameters after timeout -> boot first image
824 mov si,#DFLCMD+2 ! default command line ?
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
835 -#if defined(MENU) || defined(BITMAP)
844 + ; load message before doing anything else
845 + ; the graphics/text stuff is mixed in a rather messy way...
848 ;; SEG_FS ! message disabled ?
849 cmp word ptr par2_msg_len,#0 ;MSG_OFF+SSDIFF,#0
851 - je nomsg ! yes -> skip this
853 + jz iloop_20 ! yes -> skip this
856 ;SEG_FS ! load the message file
857 @@ -657,13 +665,96 @@
861 + ; es:bx points to file end
867 + sub edi,#SYSSEG * 16
869 + ; edi -> message file size
871 xor bx,bx ! set the terminating NUL and disable further
873 xchg bx,par2_msg_len ;MSG_OFF+SSDIFF
877 - mov byte ptr (bx),#0
879 + cmp word ptr 0,#0x71c7 ; cpio header
882 + cmp dword ptr 0,#0x0b2d97f00 ; magic header
891 + ; graphical message
898 + call gfx_setup_menu
904 + jz iloop ; text mode
906 + jmp near scan_cmdline
908 + ; normal text message
910 + ; keep the zero flag!
911 + mov byte ptr (bx),#0
952 xor bx,bx ! display the message
967 mov cx,#brto ! get a key
970 je todelch ! yes -> erase one character
972 - je cr ! yes -> go on
973 + je near cr ! yes -> go on
975 je todelch ! yes -> erase one character
976 ja input ! non-printable -> ignore it
979 todelch:br delch ! ...
980 todell: br delline ! ...
987 ! End of input, process the command line
991 jnz cpsav ! no -> go on
995 cmp bx,#cmdline ! empty line ?
996 je notrspc ! yes -> boot first image
997 cmp byte ptr (bx-1),#32 ! trailing space ?
999 je chkvga ! yes -> look for options again
1001 jnz vsknb ! no -> go on
1004 + cmp byte gfx_ok,#0
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 @@
1012 mov word ptr par2_timeout,#0xffff ; cancel timeout
1015 + cmp byte gfx_ok,#0
1024 mov bx,#msg_pw ! display a prompt
1027 @@ -1450,7 +1557,9 @@
1029 ! Boot the image BX points to
1031 -doboot: mov byte ptr prechr,#61 ! switch to equal sign
1034 + mov byte ptr prechr,#61 ! switch to equal sign
1035 push bx ! save image descr
1036 mov bx,#msg_l ! say hi
1038 @@ -3274,6 +3383,8 @@
1042 +#include "gfxlogo.S"
1044 #ifdef SHS_PASSWORDS
1047 @@ -3421,6 +3532,8 @@
1052 + mov bl,#10 ; bx: base (_not_ bl!)
1054 test byte ptr (si),#0xff ! no value ?
1055 jz vgaerr ! yes -> error
1056 @@ -3429,17 +3542,47 @@
1057 jz vgaput ! yes -> done
1060 - cmp al,#48 ! is it a digit ? (0x30=48="0")
1061 - jb vgaerr ! no -> error
1062 - cmp al,#57 ! 57=0x39="9"
1064 - sub al,#48 ! cx = cx*10+al-'0'
1068 + sub al,#0x20 ; upper case
1082 + jb vgaerr ; not a digit
1084 + jae vgaerr ; larger than current base
1087 jnc vgadig ! next one
1090 -vgaerr: mov bx,#msg_v ! display an error message
1092 + mov bx,#msg_v ! display an error message
1093 + cmp byte gfx_ok,#0
1095 + lea esi,(bx+1) ; skip initial NL
1097 + mov di,ds ; mov edi,ds
1102 + mov msg_v1,al ; drop final NL
1104 + mov byte msg_v1,#10 ; put it back
1109 /* ifdef HIGHMEM_MAX */
1111 @@ -3583,8 +3726,10 @@
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'?
1120 jb s2lbad ! error if < '0'
1123 @@ -3890,8 +4035,8 @@
1126 .ascii "Valid vga values are ASK, NORMAL, EXTENDED or a "
1127 - .ascii "decimal number."
1133 .ascii "Invalid hexadecimal number. - Ignoring remaining items."