3 ; Copyright 2000-2005 John Coffman
4 ; Copyright 2009-2011 Joachim Wiedorn
7 ; Licensed under the terms contained in the file 'COPYING'
8 ; in the source directory.
11 XPITCH = MAX_IMAGE_NAME+6
19 ; main setup menu for LILO boot selection process
24 push dx ; save cursor position
28 cmp byte [abs_cx+1],#0
29 jne findl0 ; skip clearing screen on second time thru
37 xor si,si ; number of names
38 xor di,di ; max. name length
39 mov cx,#IMAGES ; get max number to search
40 mov bx,#DESCR0 ; get address to start at
41 findl1: call strlen ; get length in ax
45 test word ptr (bx+id_flags),#FLAG_VMDEFAULT
53 test word ptr (bx+id_flags),#FLAG_NOKBDEFAULT
63 findl2: add bx,#id_size
67 findl3: mov [nimage],si
71 mov bl,[mn_max_row_col]
78 mov bl,#2 ;set for 2 columns
92 add ax,#MAXTITLE+1 +MAXCOMMENT+1 +1
94 mov al,#XPITCH ; standard width
97 mov cl,[mn_max_row_col]
107 add dx,cx ; absolute location
109 mov [timer_dx],dx ; save location of timer
111 add ch,#2 ; title height
140 test byte ptr par2_flag2,#FLAG2_UNATTENDED
142 mov bx,#str_com1u ; unattended
160 mov si,#DESCR0 ; get start pointer
186 test word [id_flags](si),#FLAG_TOOBIG ; test for unbootable
187 mov al,#0x55 ; 'U' for possibly unbootable
189 mov al,#0x46 ; 'F' for fallback
190 test byte [id_flags](si),#FLAG_FALLBACK
192 mov al,#0x4C ; 'L' for lock
193 test byte [id_flags](si),#FLAG_LOCK
196 mov al,#0x57 ; 'W' for vmWarn
197 test word [id_flags](si),#FLAG_VMWARN
203 test byte [id_flags](si),#FLAG_PASSWORD ; test for password
205 mov al,#0x50 ; 'P' for password
206 test byte [id_flags](si),#FLAG_RESTR
208 mov al,#0x52 ; 'R' for restricted options
228 mov ax,[dimage] ; usually zero
229 #if defined(LCF_VIRTUAL) || defined(LCF_NOKEYBOARD)
230 test byte ptr [cmdline],#0xFF
237 pop dx ; get saved cursor position
238 cmp byte [abs_cx+1],#0
245 mov [abs_cx],dx ; set home cursor position
251 ; end of menu_setup subroutine
255 ; if there is something on the command line
256 ; return the image number it selects
261 ; If nothing selected:
264 ; If an image is selected:
267 ; BX==pointer to descriptor
271 ; The selected image is hi-lited if the menu is displayed
278 mov cx,#IMAGES ! test all names
284 mov al,(si) ! get next character in descr
286 #ifdef LCF_IGNORECASE
290 mov al,(di) ! get next char in cmdline
291 #ifdef LCF_IGNORECASE
294 or ah,ah ! NUL in descriptor name
296 cmp al,ah ! character equal ?
297 jne fi_skipn ! no -> try next one
298 inc si ! test next character
302 cmp al,#32 ! space or NUL -> equal
309 add si,#id_size ! test next name
314 xor ax,ax ; clears the carry
322 pop bx ! BX is matched descriptor
332 cmp byte [abs_cx+1],#0 ! see if menu is displayed
344 ; delete the current command line
345 ; common code from original second.S
348 ; BX = command line pointer
351 ; BX = updated command line pointer
355 cmp bx,#cmdline ! done ?
356 je mdel9 ! yes -> done
357 push bx ! display BS,SPC,BS
361 dec bx ! move the pointer
362 jmp menu_delline ! next one
367 ; set currently selected image to be the command line
370 ; AX = image# to select
371 ; BX = cmdline pointer
382 call menu_delline ; delete the current line
384 pop si ; get image# back
405 ; Code that handles the arrow keys: left, up, down, right
408 arrow: cbw ; signed delta vector in AL
410 add dx,ax ; new position
413 arr0: xor dx,dx ; set to zero if neg.
414 arr1: mov ax,[nimage]
415 cmp dx,ax ; compare to max.
419 arr2: ; we know the one to hi-lite is in range
424 call lowlite ; un-hilite the old
428 call menu_setcmd ; set new command line
434 cmp ah,#0x50 ; down arrow
438 cmp ah,#0x48 ; up arrow
452 xchg ax,dx ; DL = cur col.
454 cmp ah,#0x4d ; right arrow
456 inc dx ; similar to dec al
457 cmp dl,[ncol] ; cmp (CUR COL + 1) : (NCOL)
464 neg dh ; remainder [0..(nrow-1)]
477 cmp ah,#0x4b ; left arrow
485 br delch ; treat as 0177 (rubout)
488 br input ; ignore the rest
491 ; erase the menu box to black
504 ; simulate a FF on the console
511 mov cx,[abs_cx] ! get home position
512 mov dx,[mn_max_row_col]
523 ; check the timer 'cntdown' and display changes
528 cmp word [timer_dx],#0 ; see if not initialized
531 mov dx,#0x2d2d ; get "--" means disabled
534 mov ax,[cntdown] ; get timer countdown location
537 mov [tim_tick],ax ; save last tick count
541 mul c55 ; get time remaining in ms.
542 div c1000 ; convert to seconds
544 div c60 ; minutes in AX, seconds in DX
548 mov [tim_min],ax ; put characters in buffer
553 mov [tim_sec],ax ; put characters in buffer
583 tim_old: .ascii "*****"
584 tim_tick: dw 0 ; last timer tick value examined
586 c55: .word 2197 ;was 55, now 54.925*40
587 c1000: .word 40000 ;was 1000, now 40*1000
593 ; AX = number [0..(nimage-1)] of entry to hilite
596 mov [dimage],ax ; remember the latest
597 mov bh,[mn_at_hilite]
608 push dx ;save current cursor position
620 add dl,#XPITCH ; index by column
624 pop bx ; restore attribute in BH
626 ll3: call mn_rdcha ; read char and attribute
628 call mn_wrcha ; write back with new attribute
632 pop dx ; restore cursor
646 cmp dword (bx),#0x554e454d ; "MENU"
651 add bx,#9 ; point at possible title
652 mov al,(bx-1) ; get length stored by installer
654 jz notitle ; no title if supplied length is 0
656 xchg ax,cx ; supplied length to CX
660 cmp ax,#str_title_len
677 dimage: dw 0 ; default image
678 #if defined(LCF_VIRTUAL) || defined(LCF_NOKEYBOARD)
679 vimage: dw 0 ; vmdefault image
681 norigin: dw 0 ; row/col origin of names on screen
682 nimage: dw 0 ; number of images
683 limage: dw 0 ; longest length of image name
684 nrow: dw 0 ; number of rows of selections
685 ncol: dw 0 ; number of columns (default=2)
686 ;wcol: db 0 ; width of each column (default=XPITCH=21)
687 area_cx: dw 0 ; area of interaction
688 area_dx: dw 0 ; area of interaction
689 abs_cx: dw 0 ; upper left of scrolling area
690 ;abs_dx: dw 0 ; lower right of scrolling area
691 ; mn_max_row_col is the same as the above (abs_dx)
692 timer_dx: dw 0 ; timer location
696 .ascii "GNU/Linux - "
699 .ascii SA(VERSION_MAJOR)
704 .org str_title+MAX_MENU_TITLE+1
710 str_title_len = str_timer-str_title-1
713 .ascii "Hit any key to cancel timeout"
714 ; "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 00:00"
717 .ascii "Hit any key to restart timeout"
723 db 24,25 ; up-arrow, down-arrow
725 .ascii " arrow keys to make selection"
728 .ascii "Enter choice & options, hit CR to boot"