Allow binding help text to F11 and F12.
authorH. Peter Anvin <hpa@zytor.com>
Thu, 31 May 2007 00:17:11 +0000 (17:17 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Thu, 31 May 2007 00:17:11 +0000 (17:17 -0700)
Fix the odd anomaly that one can't bind help text to F11 and F12.

NEWS
config.inc
configinit.inc
keywords.inc
parsecmd.inc
pxelinux.asm
syslinux.doc
ui.inc

diff --git a/NEWS b/NEWS
index bd57c03..023c1b5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,7 @@ Changes in 3.50:
        * Instead of the (non-existent) MAC, use the client identifier
          for networks like Infiniband and Firewire/1394.
        * Add a new INCLUDE command to the core syslinux parser.
+       * Allow binding help text to F11 and F12.
 
 Changes in 3.36:
        * MEMDISK: Disable EDD by default on floppy disks.  EDD can be
index 32bb62c..142848c 100644 (file)
@@ -23,6 +23,7 @@ max_cmd_len   equ 511                 ; Must be &3; 255 is the kernel limit
 HIGHMEM_MAX    equ 037FFFFFFh          ; DEFAULT highest address for an initrd
 DEFAULT_BAUD   equ 9600                ; Default baud rate for serial port
 BAUD_DIVISOR   equ 115200              ; Serial port parameter
+MAX_FKEYS      equ 12                  ; Number of F-key help files
 
 %assign        DO_WBINVD 0                     ; Should we use WBINVD or not?
 
index 1f080c7..6b5c521 100644 (file)
@@ -33,7 +33,7 @@ reset_config:
 %if NULLFILE != 0
                mov al,NULLFILE
                mov di,FKeyName
-               mov cx,10*(1 << FILENAME_MAX_LG2)
+               mov cx,MAX_FKEYS*(1 << FILENAME_MAX_LG2)
                rep stosb
 %endif
 %endif
index a97d360..c703551 100644 (file)
@@ -85,6 +85,8 @@ keywd_table:
                keyword f9,             pc_fkey,        FKeyN(9)
                keyword f10,            pc_fkey,        FKeyN(10)
                keyword f0,             pc_fkey,        FKeyN(10)
+               keyword f11,            pc_fkey,        FKeyN(11)
+               keyword f12,            pc_fkey,        FKeyN(12)
 %if IS_PXELINUX
                keyword ipappend,       pc_ipappend
 %endif
index ea7d0fc..e3e3734 100644 (file)
@@ -100,7 +100,7 @@ AppendBuf       resb max_cmd_len+1  ; append=
 Ontimeout      resb max_cmd_len+1      ; ontimeout
 Onerror                resb max_cmd_len+1      ; onerror
 KbdMap         resb 256                ; Keyboard map
-FKeyName       resb 10*FILENAME_MAX    ; File names for F-key help
+FKeyName       resb MAX_FKEYS*FILENAME_MAX     ; File names for F-key help
 KernelCNameLen resw 1                  ; Length of unmangled kernel name
 InitRDCNameLen resw 1                  ; Length of unmangled initrd name
 %if IS_SYSLINUX
index e8995eb..8056796 100644 (file)
@@ -308,18 +308,7 @@ _start1:
 ;
 ; Initialize screen (if we're using one)
 ;
-               ; Now set up screen parameters
-               call adjust_screen
-
-               ; Wipe the F-key area
-               mov al,NULLFILE
-               mov di,FKeyName
-               mov cx,10*(1 << FILENAME_MAX_LG2)
-               push es                 ; Save ES -> PXE structure
-               push ds                 ; ES <- DS
-               pop es
-               rep stosb
-               pop es                  ; Restore ES
+%include "init.inc"
 
 ;
 ; Tell the user we got this far
@@ -699,7 +688,6 @@ udp_init:
 ;
 ; Common initialization code
 ;
-%include "init.inc"
 %include "cpuinit.inc"
 
 ;
index 626b9ee..1737073 100644 (file)
@@ -384,18 +384,19 @@ F1 filename
 F2 filename
    ...etc...
 F9 filename
-F0 filename
+F10 filename
+F11 filename
+F11 filename
         Displays the indicated file on the screen when a function key is
         pressed at the boot: prompt.  This can be used to implement
         pre-boot online help (presumably for the kernel command line
-        options.)  Note that F10 MUST be entered in the config file as
-        "F0", not "F10", and that there is currently no way to bind
-        file names to F11 and F12.  Please see the section below on
-        DISPLAY files.
+        options.)  Please see the section below on DISPLAY files.
 
        When using the serial console, press <Ctrl-F><digit> to get to
-       the help screens, e.g. <Ctrl-F><2> to get to the F2 screen,
-       and <Ctrl-F><0> for the F10 one.
+       the help screens, e.g. <Ctrl-F><2> to get to the F2 screen.
+       For F10-F12, hit <Ctrl-F><A>, <Ctrl-F>B, <Ctrl-F>C.  For
+       compatiblity with earlier versions, F10 can also be entered as
+       <Ctrl-F>0.
 
 Blank lines are ignored.
 
diff --git a/ui.inc b/ui.inc
index 97d361e..bb34084 100644 (file)
--- a/ui.inc
+++ b/ui.inc
@@ -72,14 +72,8 @@ got_ascii:   cmp al,7Fh                      ; <DEL> == <BS>
                cmp di,command_line             ; Space must not be first
                je short get_char
 enter_char:    test byte [FuncFlag],1
-               jz .not_ctrl_f
-               mov byte [FuncFlag],0
-               cmp al,'0'
-               jb .not_ctrl_f
-               je ctrl_f_0
-               cmp al,'9'
-               jbe ctrl_f
-.not_ctrl_f:   cmp di,max_cmd_len+command_line ; Check there's space
+               je ctrl_f                       ; Keystroke after <Ctrl-F>
+               cmp di,max_cmd_len+command_line ; Check there's space
                jnb short get_char
                stosb                           ; Save it
                call writechr                   ; Echo to screen
@@ -121,19 +115,44 @@ set_func_flag:
                mov byte [FuncFlag],1
                jmp short get_char_2
 
-ctrl_f_0:      add al,10                       ; <Ctrl-F>0 == F10
-ctrl_f:                sub al,'1'
+ctrl_f:
                xor ah,ah
-               jmp short show_help
+               mov [FuncFlag],ah
+               cmp al,'0'
+               jb get_char_2
+               je .zero                        ; <Ctrl-F>0 = F10
+               or al,20h                       ; Lower case
+               cmp al,'9'
+               jna .digit
+               cmp al,'a'                      ; F10-F12 = <Ctrl-F>A, B, C
+               jb get_char_2
+               cmp al,'c'
+               ja get_char_2
+               sub al,'a'-10
+               jmp show_help
+.zero:
+               mov al,10
+               jmp show_help
+.digit:
+               sub al,'1'
+               jmp show_help
 
 func_key:
                ; AL = 0 if we get here
                xchg al,ah
                cmp al,68                       ; F10
-               ja short get_char_2
+               ja .f11_f12
                sub al,59                       ; F1
-               jb short get_char_2
-show_help:     ; AX = func key # (0 = F1, 9 = F10)
+               jb get_char_2
+               jmp show_help
+.f11_f12:
+               cmp al,87                       ; F11
+               jb get_char_2
+               cmp al,88                       ; F12
+               ja get_char_2
+               sub al,87-10
+
+show_help:     ; AX = func key # (0 = F1, 9 = F10, 11 = F12)
                push di                         ; Save end-of-cmdline pointer
                shl ax,FILENAME_MAX_LG2         ; Convert to pointer
                add ax,FKeyName
@@ -174,7 +193,7 @@ fk_wrcmd:
                mov si,command_line
                call cwritestr                  ; Write command line so far
 fk_nofile:     pop di
-               jmp short get_char_2
+               jmp get_char
 
 ;
 ; Show network info (in the form of the ipappend strings)