3 ; Copyright 2001-2005 John Coffman.
6 ; Licensed under the terms contained in the file 'COPYING' in the
10 #define ncol KEYTABLE+256+mt_ncol
14 ; main setup menu for LILO boot selection process
16 ; replaces code to load & display the message in second.S
24 ;; SEG_FS ! message disabled ?
25 cmp word ptr par2_msg_len+SSDIFF,#0 ;MSG_OFF+SSDIFF,#0
27 je ms_do_find ! yes -> skip this
31 ;SEG_FS ! load the message file
32 mov cx,mt_msg+KEYTABLE+256 ;MSG_OFF+SSDIFF+2
34 mov dx,mt_msg+2+KEYTABLE+256
36 mov al,mt_msg+4+KEYTABLE+256
45 push es ; save for later
48 call _display4 ; ES:BX points to the Message or BITMAP
54 xchg bx,par2_msg_len+SSDIFF ;MSG_OFF+SSDIFF
58 jb good_bitmap ; AX==0, bitmap was displayed
61 ja ms_do_find ; AX==2, 3, or 4; "BM" sig found, but
62 ; wrong bitmap or no VGA adapter
63 ; or no VESA support (4)
65 ; AX==1, no "BM" signature, assume "message"
69 xor bx,bx ! display the message
72 ;--------------------------------------------
77 mov word [abs_cx],#0x101 ; mark screen in use
82 pop ds ; make sure DS is good
83 xor si,si ; number of names
84 xor di,di ; max. name length
85 mov cx,#IMAGES ; get max number to search
86 mov bx,#DESCR0 ; get address to start at
87 findl1: call strlen ; get length in ax
91 test word ptr (bx+id_flags),#FLAG_VMDEFAULT
99 test word ptr (bx+id_flags),#FLAG_NOKBDEFAULT
109 findl2: add bx,#id_size
113 findl3: mov [nimage],si
116 mov ax,si ; number of images
122 cmp al,[KEYTABLE+256+mt_mincol]
124 mov al,[KEYTABLE+256+mt_mincol]
126 mov bx,[KEYTABLE+256+mt_maxcol] ;
133 xor ax,ax ;display the list of names
138 mov ax,[dimage] ; bug fix
139 #if defined(LCF_VIRTUAL) || defined(LCF_NOKEYBOARD)
140 test byte ptr [cmdline],#0xFF
148 pop es ; make sure ES is good on exit
152 ; end of menu_setup subroutine
154 no_bmp: .ascii " = AL; NOT a bitmap file\n"
161 ; if there is something on the command line
162 ; return the image number it selects
167 ; If nothing selected:
170 ; If an image is selected:
173 ; BX==pointer to descriptor
177 ; The selected image is hi-lited if the menu is displayed
184 mov cx,#IMAGES ! test all names
190 mov al,(si) ! get next character in descr
192 #ifdef LCF_IGNORECASE
196 mov al,(di) ! get next char in cmdline
197 #ifdef LCF_IGNORECASE
200 or ah,ah ! NUL in descriptor name
202 cmp al,ah ! character equal ?
203 jne fi_skipn ! no -> try next one
204 inc si ! test next character
208 cmp al,#32 ! space or NUL -> equal
215 add si,#id_size ! test next name
220 xor ax,ax ; clears the carry
228 pop bx ! BX is matched descriptor
238 cmp byte [abs_cx+1],#0 ! see if menu is displayed
251 ; delete the current command line
252 ; common code from original second.S
255 ; BX = command line pointer
258 ; BX = updated command line pointer
262 cmp bx,#cmdline ! done ?
263 je mdel9 ! yes -> done
264 push bx ! display BS,SPC,BS
268 dec bx ! move the pointer
269 jmp menu_delline ! next one
274 ; set currently selected image to be the command line
277 ; AX = image# to select
278 ; BX = cmdline pointer
289 call menu_delline ; delete the current line
291 pop si ; get image# back
312 ; Code that handles the arrow keys: left, up, down, right
315 arrow: cbw ; signed delta vector in AL
317 add dx,ax ; new position
320 arr0: xor dx,dx ; set to zero if neg.
321 arr1: mov ax,[nimage]
322 cmp dx,ax ; compare to max.
326 arr2: ; we know the one to hi-lite is in range
331 call lowlite ; un-hilite the old
335 call menu_setcmd ; set new command line
341 cmp ah,#0x50 ; down arrow
345 cmp ah,#0x48 ; up arrow
359 xchg ax,dx ; DL = cur col.
361 cmp ah,#0x4d ; right arrow
363 inc dx ; similar to dec al
364 cmp dl,[ncol] ; cmp (CUR COL + 1) : (NCOL)
371 neg dh ; remainder [0..(nrow-1)]
384 cmp ah,#0x4b ; left arrow
392 br delch ; treat as 0177 (rubout)
395 br input ; ignore the rest
398 ; erase the menu box to black
405 .ascii "menu_exit entered"
413 mov word [suppress],ax
419 .ascii "called done4"
428 .ascii "exit from menu_exit"
440 ; simulate a FF on the console
447 ; check the timer 'cntdown' and display changes
453 test byte [KEYTABLE+256+mt_t_row+1],#0xff ; see if not initialized
456 mov dx,#0x2d2d ; get "--" means disabled
459 mov ax,[cntdown] ; get timer countdown location
462 mov [tim_tick],ax ; save last tick count
466 mul c55 ; get time remaining in ms.
467 div c1000 ; convert to seconds
470 mov [tim_old],ax ; save seconds remaining
472 div c60 ; minutes in AX, seconds in DX
476 mov [tim_min],ax ; put characters in buffer
481 mov [tim_sec],ax ; put characters in buffer
485 push #KEYTABLE+256+mt_t_fg
489 push word [KEYTABLE+256+mt_t_row]
490 push word [KEYTABLE+256+mt_t_col]
502 tim_old: dw 0 ; last # seconds
503 tim_tick: dw 0 ; last timer tick value examined
505 c55: .word 2197 ;was 55, now 54.925*40
506 c1000: .word 40000 ;was 1000, now 40*1000
513 ; AX = number [0..(nimage-1)] of entry to hilite
518 mov [dimage],ax ;remember one hilited
520 push #KEYTABLE+256+mt_h_fg
527 push #KEYTABLE+256+mt_fg ; sch low
530 cmp BYTE [abs_cx+1],#0
533 mov bx,ax ;save argument in BX
558 mov cx,[KEYTABLE+256+mt_col]
559 mov ax,[KEYTABLE+256+mt_row]
564 add cx,[KEYTABLE+256+mt_xpitch]
569 shl bx,#4 ;use pixel addressing
583 im_name: .blkb MAX_IMAGE_NAME+3
586 dimage: dw 0 ; default image
587 #if defined(LCF_VIRTUAL) || defined(LCF_NOKEYBOARD)
588 vimage: dw 0 ; vmdefault image
590 nimage: dw 0 ; number of images
591 limage: dw 0 ; longest length of image name
592 nrow: dw 0 ; number of rows of selections
593 ;nrow equ KEYTABLE+256+mt_maxcol
594 ;ncol: dw 0 ; number of columns (default=2)
595 ;ncol equ KEYTABLE+256+mt_ncol
596 abs_cx: dw 0 ; upper left of scrolling area