3 ; Copyright 2001-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 #define ncol KEYTABLE+256+mt_ncol
15 ; main setup menu for LILO boot selection process
17 ; replaces code to load & display the message in second.S
25 ;; SEG_FS ! message disabled ?
26 cmp word ptr par2_msg_len+SSDIFF,#0 ;MSG_OFF+SSDIFF,#0
28 je ms_do_find ! yes -> skip this
32 ;SEG_FS ! load the message file
33 mov cx,mt_msg+KEYTABLE+256 ;MSG_OFF+SSDIFF+2
35 mov dx,mt_msg+2+KEYTABLE+256
37 mov al,mt_msg+4+KEYTABLE+256
46 push es ; save for later
49 call _display4 ; ES:BX points to the Message or BITMAP
55 xchg bx,par2_msg_len+SSDIFF ;MSG_OFF+SSDIFF
59 jb good_bitmap ; AX==0, bitmap was displayed
62 ja ms_do_find ; AX==2, 3, or 4; "BM" sig found, but
63 ; wrong bitmap or no VGA adapter
64 ; or no VESA support (4)
66 ; AX==1, no "BM" signature, assume "message"
70 xor bx,bx ! display the message
73 ;--------------------------------------------
78 mov word [abs_cx],#0x101 ; mark screen in use
83 pop ds ; make sure DS is good
84 xor si,si ; number of names
85 xor di,di ; max. name length
86 mov cx,#IMAGES ; get max number to search
87 mov bx,#DESCR0 ; get address to start at
88 findl1: call strlen ; get length in ax
92 test word ptr (bx+id_flags),#FLAG_VMDEFAULT
100 test word ptr (bx+id_flags),#FLAG_NOKBDEFAULT
110 findl2: add bx,#id_size
114 findl3: mov [nimage],si
117 mov ax,si ; number of images
123 cmp al,[KEYTABLE+256+mt_mincol]
125 mov al,[KEYTABLE+256+mt_mincol]
127 mov bx,[KEYTABLE+256+mt_maxcol] ;
134 xor ax,ax ;display the list of names
139 mov ax,[dimage] ; bug fix
140 #if defined(LCF_VIRTUAL) || defined(LCF_NOKEYBOARD)
141 test byte ptr [cmdline],#0xFF
149 pop es ; make sure ES is good on exit
153 ; end of menu_setup subroutine
155 no_bmp: .ascii " = AL; NOT a bitmap file\n"
162 ; if there is something on the command line
163 ; return the image number it selects
168 ; If nothing selected:
171 ; If an image is selected:
174 ; BX==pointer to descriptor
178 ; The selected image is hi-lited if the menu is displayed
185 mov cx,#IMAGES ! test all names
191 mov al,(si) ! get next character in descr
193 #ifdef LCF_IGNORECASE
197 mov al,(di) ! get next char in cmdline
198 #ifdef LCF_IGNORECASE
201 or ah,ah ! NUL in descriptor name
203 cmp al,ah ! character equal ?
204 jne fi_skipn ! no -> try next one
205 inc si ! test next character
209 cmp al,#32 ! space or NUL -> equal
216 add si,#id_size ! test next name
221 xor ax,ax ; clears the carry
229 pop bx ! BX is matched descriptor
239 cmp byte [abs_cx+1],#0 ! see if menu is displayed
252 ; delete the current command line
253 ; common code from original second.S
256 ; BX = command line pointer
259 ; BX = updated command line pointer
263 cmp bx,#cmdline ! done ?
264 je mdel9 ! yes -> done
265 push bx ! display BS,SPC,BS
269 dec bx ! move the pointer
270 jmp menu_delline ! next one
275 ; set currently selected image to be the command line
278 ; AX = image# to select
279 ; BX = cmdline pointer
290 call menu_delline ; delete the current line
292 pop si ; get image# back
313 ; Code that handles the arrow keys: left, up, down, right
316 arrow: cbw ; signed delta vector in AL
318 add dx,ax ; new position
321 arr0: xor dx,dx ; set to zero if neg.
322 arr1: mov ax,[nimage]
323 cmp dx,ax ; compare to max.
327 arr2: ; we know the one to hi-lite is in range
332 call lowlite ; un-hilite the old
336 call menu_setcmd ; set new command line
342 cmp ah,#0x50 ; down arrow
346 cmp ah,#0x48 ; up arrow
360 xchg ax,dx ; DL = cur col.
362 cmp ah,#0x4d ; right arrow
364 inc dx ; similar to dec al
365 cmp dl,[ncol] ; cmp (CUR COL + 1) : (NCOL)
372 neg dh ; remainder [0..(nrow-1)]
385 cmp ah,#0x4b ; left arrow
393 br delch ; treat as 0177 (rubout)
396 br input ; ignore the rest
399 ; erase the menu box to black
406 .ascii "menu_exit entered"
414 mov word [suppress],ax
420 .ascii "called done4"
429 .ascii "exit from menu_exit"
441 ; simulate a FF on the console
448 ; check the timer 'cntdown' and display changes
454 test byte [KEYTABLE+256+mt_t_row+1],#0xff ; see if not initialized
457 mov dx,#0x2d2d ; get "--" means disabled
460 mov ax,[cntdown] ; get timer countdown location
463 mov [tim_tick],ax ; save last tick count
467 mul c55 ; get time remaining in ms.
468 div c1000 ; convert to seconds
471 mov [tim_old],ax ; save seconds remaining
473 div c60 ; minutes in AX, seconds in DX
477 mov [tim_min],ax ; put characters in buffer
482 mov [tim_sec],ax ; put characters in buffer
486 push #KEYTABLE+256+mt_t_fg
490 push word [KEYTABLE+256+mt_t_row]
491 push word [KEYTABLE+256+mt_t_col]
503 tim_old: dw 0 ; last # seconds
504 tim_tick: dw 0 ; last timer tick value examined
506 c55: .word 2197 ;was 55, now 54.925*40
507 c1000: .word 40000 ;was 1000, now 40*1000
514 ; AX = number [0..(nimage-1)] of entry to hilite
519 mov [dimage],ax ;remember one hilited
521 push #KEYTABLE+256+mt_h_fg
528 push #KEYTABLE+256+mt_fg ; sch low
531 cmp BYTE [abs_cx+1],#0
534 mov bx,ax ;save argument in BX
559 mov cx,[KEYTABLE+256+mt_col]
560 mov ax,[KEYTABLE+256+mt_row]
565 add cx,[KEYTABLE+256+mt_xpitch]
570 shl bx,#4 ;use pixel addressing
584 im_name: .blkb MAX_IMAGE_NAME+3
587 dimage: dw 0 ; default image
588 #if defined(LCF_VIRTUAL) || defined(LCF_NOKEYBOARD)
589 vimage: dw 0 ; vmdefault image
591 nimage: dw 0 ; number of images
592 limage: dw 0 ; longest length of image name
593 nrow: dw 0 ; number of rows of selections
594 ;nrow equ KEYTABLE+256+mt_maxcol
595 ;ncol: dw 0 ; number of columns (default=2)
596 ;ncol equ KEYTABLE+256+mt_ncol
597 abs_cx: dw 0 ; upper left of scrolling area