3 Copyright 2000-2005 John Coffman.
6 Licensed under the terms contained in the file 'COPYING' in the
12 XPITCH = MAX_IMAGE_NAME+6
20 ; main setup menu for LILO boot selection process
25 push dx ; save cursor position
29 cmp byte [abs_cx+1],#0
30 jne findl0 ; skip clearing screen on second time thru
38 xor si,si ; number of names
39 xor di,di ; max. name length
40 mov cx,#IMAGES ; get max number to search
41 mov bx,#DESCR0 ; get address to start at
42 findl1: call strlen ; get length in ax
46 test word ptr (bx+id_flags),#FLAG_VMDEFAULT
54 test word ptr (bx+id_flags),#FLAG_NOKBDEFAULT
64 findl2: add bx,#id_size
68 findl3: mov [nimage],si
72 mov bl,[mn_max_row_col]
79 mov bl,#2 ;set for 2 columns
93 add ax,#MAXTITLE+1 +MAXCOMMENT+1 +1
95 mov al,#XPITCH ; standard width
98 mov cl,[mn_max_row_col]
108 add dx,cx ; absolute location
110 mov [timer_dx],dx ; save location of timer
112 add ch,#2 ; title height
141 test byte ptr par2_flag2,#FLAG2_UNATTENDED
143 mov bx,#str_com1u ; unattended
161 mov si,#DESCR0 ; get start pointer
187 test word [id_flags](si),#FLAG_TOOBIG ; test for unbootable
188 mov al,#0x55 ; 'U' for possibly unbootable
190 mov al,#0x46 ; 'F' for fallback
191 test byte [id_flags](si),#FLAG_FALLBACK
193 mov al,#0x4C ; 'L' for lock
194 test byte [id_flags](si),#FLAG_LOCK
197 mov al,#0x57 ; 'W' for vmWarn
198 test word [id_flags](si),#FLAG_VMWARN
204 test byte [id_flags](si),#FLAG_PASSWORD ; test for password
206 mov al,#0x50 ; 'P' for password
207 test byte [id_flags](si),#FLAG_RESTR
209 mov al,#0x52 ; 'R' for restricted options
229 mov ax,[dimage] ; usually zero
230 #if defined(LCF_VIRTUAL) || defined(LCF_NOKEYBOARD)
231 test byte ptr [cmdline],#0xFF
238 pop dx ; get saved cursor position
239 cmp byte [abs_cx+1],#0
246 mov [abs_cx],dx ; set home cursor position
252 ; end of menu_setup subroutine
256 ; if there is something on the command line
257 ; return the image number it selects
262 ; If nothing selected:
265 ; If an image is selected:
268 ; BX==pointer to descriptor
272 ; The selected image is hi-lited if the menu is displayed
279 mov cx,#IMAGES ! test all names
285 mov al,(si) ! get next character in descr
287 #ifdef LCF_IGNORECASE
291 mov al,(di) ! get next char in cmdline
292 #ifdef LCF_IGNORECASE
295 or ah,ah ! NUL in descriptor name
297 cmp al,ah ! character equal ?
298 jne fi_skipn ! no -> try next one
299 inc si ! test next character
303 cmp al,#32 ! space or NUL -> equal
310 add si,#id_size ! test next name
315 xor ax,ax ; clears the carry
323 pop bx ! BX is matched descriptor
333 cmp byte [abs_cx+1],#0 ! see if menu is displayed
345 ; delete the current command line
346 ; common code from original second.S
349 ; BX = command line pointer
352 ; BX = updated command line pointer
356 cmp bx,#cmdline ! done ?
357 je mdel9 ! yes -> done
358 push bx ! display BS,SPC,BS
362 dec bx ! move the pointer
363 jmp menu_delline ! next one
368 ; set currently selected image to be the command line
371 ; AX = image# to select
372 ; BX = cmdline pointer
383 call menu_delline ; delete the current line
385 pop si ; get image# back
406 ; Code that handles the arrow keys: left, up, down, right
409 arrow: cbw ; signed delta vector in AL
411 add dx,ax ; new position
414 arr0: xor dx,dx ; set to zero if neg.
415 arr1: mov ax,[nimage]
416 cmp dx,ax ; compare to max.
420 arr2: ; we know the one to hi-lite is in range
425 call lowlite ; un-hilite the old
429 call menu_setcmd ; set new command line
435 cmp ah,#0x50 ; down arrow
439 cmp ah,#0x48 ; up arrow
453 xchg ax,dx ; DL = cur col.
455 cmp ah,#0x4d ; right arrow
457 inc dx ; similar to dec al
458 cmp dl,[ncol] ; cmp (CUR COL + 1) : (NCOL)
465 neg dh ; remainder [0..(nrow-1)]
478 cmp ah,#0x4b ; left arrow
486 br delch ; treat as 0177 (rubout)
489 br input ; ignore the rest
492 ; erase the menu box to black
505 ; simulate a FF on the console
512 mov cx,[abs_cx] ! get home position
513 mov dx,[mn_max_row_col]
524 ; check the timer 'cntdown' and display changes
529 cmp word [timer_dx],#0 ; see if not initialized
532 mov dx,#0x2d2d ; get "--" means disabled
535 mov ax,[cntdown] ; get timer countdown location
538 mov [tim_tick],ax ; save last tick count
542 mul c55 ; get time remaining in ms.
543 div c1000 ; convert to seconds
545 div c60 ; minutes in AX, seconds in DX
549 mov [tim_min],ax ; put characters in buffer
554 mov [tim_sec],ax ; put characters in buffer
584 tim_old: .ascii "*****"
585 tim_tick: dw 0 ; last timer tick value examined
587 c55: .word 2197 ;was 55, now 54.925*40
588 c1000: .word 40000 ;was 1000, now 40*1000
594 ; AX = number [0..(nimage-1)] of entry to hilite
597 mov [dimage],ax ; remember the latest
598 mov bh,[mn_at_hilite]
609 push dx ;save current cursor position
621 add dl,#XPITCH ; index by column
625 pop bx ; restore attribute in BH
627 ll3: call mn_rdcha ; read char and attribute
629 call mn_wrcha ; write back with new attribute
633 pop dx ; restore cursor
647 cmp dword (bx),#0x554e454d ; "MENU"
652 add bx,#9 ; point at possible title
653 mov al,(bx-1) ; get length stored by installer
655 jz notitle ; no title if supplied length is 0
657 xchg ax,cx ; supplied length to CX
661 cmp ax,#str_title_len
678 dimage: dw 0 ; default image
679 #if defined(LCF_VIRTUAL) || defined(LCF_NOKEYBOARD)
680 vimage: dw 0 ; vmdefault image
682 norigin: dw 0 ; row/col origin of names on screen
683 nimage: dw 0 ; number of images
684 limage: dw 0 ; longest length of image name
685 nrow: dw 0 ; number of rows of selections
686 ncol: dw 0 ; number of columns (default=2)
687 ;wcol: db 0 ; width of each column (default=XPITCH=21)
688 area_cx: dw 0 ; area of interaction
689 area_dx: dw 0 ; area of interaction
690 abs_cx: dw 0 ; upper left of scrolling area
691 ;abs_dx: dw 0 ; lower right of scrolling area
692 ; mn_max_row_col is the same as the above (abs_dx)
693 timer_dx: dw 0 ; timer location
697 .ascii "GNU/Linux - "
700 .ascii SA(VERSION_MAJOR)
705 .org str_title+MAX_MENU_TITLE+1
711 str_title_len = str_timer-str_title-1
714 .ascii "Hit any key to cancel timeout"
715 ; "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 00:00"
718 .ascii "Hit any key to restart timeout"
724 db 24,25 ; up-arrow, down-arrow
726 .ascii " arrow keys to make selection"
729 .ascii "Enter choice & options, hit CR to boot"