take an argument.
; 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)
+ rep stosb
+
; Patch the writechr routine to point to the full code
mov word [writechr+1], writechr_full-(writechr+3)
jmp short show_help
func_key:
+ ; AL = 0 if we get here
push di
cmp ah,68 ; F10
ja get_char_2
sub ah,59 ; F1
jb get_char_2
- shr ax,8
+ xchg al,ah
show_help: ; AX = func key # (0 = F1, 9 = F10)
- mov cl,al
- shl ax,FILENAME_MAX_LG2 ; Convert to offset
- mov bx,1
- shl bx,cl
- and bx,[FKeyMap]
- jz get_char_2 ; Undefined F-key
- mov di,ax
+ shl ax,FILENAME_MAX_LG2 ; Convert to pointer
+ xchg di,ax
add di,FKeyName
+ cmp byte [di],NULLFILE
+ je get_char_2 ; Undefined F-key
call searchdir
jz fk_nofile
push si
; Config file keyword table
;
%include "keywords.inc"
- align 2, db 0
-
-keywd_table:
- keyword append, pc_append
- keyword default, pc_default
- keyword timeout, pc_timeout
- keyword font, pc_font
- keyword kbdmap, pc_kbd
- keyword display, pc_display
- keyword prompt, pc_prompt
- keyword label, pc_label
- keyword implicit, pc_implicit
- keyword kernel, pc_kernel
- keyword serial, pc_serial
- keyword say, pc_say
- keyword f1, pc_f1
- keyword f2, pc_f2
- keyword f3, pc_f3
- keyword f4, pc_f4
- keyword f5, pc_f5
- keyword f6, pc_f6
- keyword f7, pc_f7
- keyword f8, pc_f8
- keyword f9, pc_f9
- keyword f10, pc_f10
- keyword f0, pc_f10
- keyword localboot, pc_localboot
-
-keywd_count equ ($-keywd_table)/keywd_size
;
; Extensions to search for (in *forward* order).
;
AppendLen dw 0 ; Bytes in append= command
KbdTimeOut dw 0 ; Keyboard timeout (if any)
-FKeyMap dw 0 ; Bitmap for F-keys loaded
CmdLinePtr dw cmd_line_here ; Command line advancing pointer
initrd_flag equ $
initrd_ptr dw 0 ; Initial ramdisk pointer/flag
%macro keyword 2
dd hash_%1 ; Hash value
+ dw 0 ; No argument
dw %2 ; Entrypoint
%endmacro
-keywd_size equ 6 ; Bytes per keyword
+%macro keyword 3
+ dd hash_%1 ; Hash value
+ dw %3 ; 16-bit argument
+ dw %2 ; Entrypoint
+%endmacro
+
+%macro keyword 4
+ dd hash_%1 ; Hash value
+ db %3, %4 ; 2 8-bit arguments
+ dw %2 ; Entrypoint
+%endmacro
+
+keywd_size equ 8 ; Bytes per keyword
+
+ align 4, db 0
+
+keywd_table:
+ keyword append, pc_append
+ keyword default, pc_default
+ keyword display, pc_filecmd, get_msg_file
+ keyword font, pc_filecmd, loadfont
+ keyword implicit, pc_setint16, AllowImplicit
+ keyword kbdmap, pc_filecmd, loadkeys
+ keyword kernel, pc_kernel
+ keyword label, pc_label
+ keyword prompt, pc_setint16, ForcePrompt
+ keyword say, pc_say
+ keyword serial, pc_serial
+ keyword timeout, pc_timeout
+ keyword f1, pc_fkey, FKeyName+(0<<FILENAME_MAX_LG2)
+ keyword f2, pc_fkey, FKeyName+(1<<FILENAME_MAX_LG2)
+ keyword f3, pc_fkey, FKeyName+(2<<FILENAME_MAX_LG2)
+ keyword f4, pc_fkey, FKeyName+(3<<FILENAME_MAX_LG2)
+ keyword f5, pc_fkey, FKeyName+(4<<FILENAME_MAX_LG2)
+ keyword f6, pc_fkey, FKeyName+(5<<FILENAME_MAX_LG2)
+ keyword f7, pc_fkey, FKeyName+(6<<FILENAME_MAX_LG2)
+ keyword f8, pc_fkey, FKeyName+(7<<FILENAME_MAX_LG2)
+ keyword f9, pc_fkey, FKeyName+(8<<FILENAME_MAX_LG2)
+ keyword f10, pc_fkey, FKeyName+(9<<FILENAME_MAX_LG2)
+ keyword f0, pc_fkey, FKeyName+(9<<FILENAME_MAX_LG2)
+%if IS_PXELINUX
+ keyword ipappend, pc_ipappend
+%endif
+%if IS_PXELINUX || IS_ISOLINUX
+ keyword localboot, pc_localboot
+%endif
+
+keywd_count equ ($-keywd_table)/keywd_size
+
;
; 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)
+ rep stosb
+
;
; Now, everything is "up and running"... patch kaboom for more
; verbosity and using the full screen system
jmp short show_help
func_key:
+ ; AL = 0 if we get here
push di
cmp ah,68 ; F10
ja get_char_2
sub ah,59 ; F1
jb get_char_2
- shr ax,8
+ xchg al,ah
show_help: ; AX = func key # (0 = F1, 9 = F10)
- mov cl,al
- shl ax,4 ; Convert to x16
- mov bx,1
- shl bx,cl
- and bx,[FKeyMap]
- jz get_char_2 ; Undefined F-key
- mov di,ax
+ shl ax,FILENAME_MAX_LG2 ; Convert to pointer
+ xchg di,ax
add di,FKeyName
+ cmp byte [di],NULLFILE
+ je get_char_2 ; Undefined F-key
call searchdir
jz fk_nofile
push si
; Config file keyword table
;
%include "keywords.inc"
- align 2, db 0
-
-keywd_table:
- keyword append, pc_append
- keyword default, pc_default
- keyword timeout, pc_timeout
- keyword font, pc_font
- keyword kbdmap, pc_kbd
- keyword display, pc_display
- keyword prompt, pc_prompt
- keyword label, pc_label
- keyword implicit, pc_implicit
- keyword kernel, pc_kernel
- keyword serial, pc_serial
- keyword say, pc_say
- keyword f1, pc_f1
- keyword f2, pc_f2
- keyword f3, pc_f3
- keyword f4, pc_f4
- keyword f5, pc_f5
- keyword f6, pc_f6
- keyword f7, pc_f7
- keyword f8, pc_f8
- keyword f9, pc_f9
- keyword f10, pc_f10
- keyword f0, pc_f10
-
-keywd_count equ ($-keywd_table)/keywd_size
-
;
; Extensions to search for (in *reverse* order). Note that the last
; (lexically first) entry in the table is a placeholder for the original
%endif
AppendLen dw 0 ; Bytes in append= command
KbdTimeOut dw 0 ; Keyboard timeout (if any)
-FKeyMap dw 0 ; Bitmap for F-keys loaded
CmdLinePtr dw cmd_line_here ; Command line advancing pointer
initrd_flag equ $
initrd_ptr dw 0 ; Initial ramdisk pointer/flag
lodsd
cmp ebx,eax
je .found_keywd
- lodsw ; Skip entrypoint
+ lodsd ; Skip entrypoint/argument
loop .table_search
; Otherwise unrecognized keyword
call cwritestr
jmp short .find
-.found_keywd: call near [si]
+.found_keywd: lodsw ; Load argument into ax
+ call near [si]
clc
ret
.err: ret
;
-; "display" command
+; Generic integer variable setting commands:
+; "prompt", "implicit"
;
-pc_display: call pc_getfile
- jz .err ; File not found?
- call get_msg_file ; Load and display file
-.err: ret
-
-;
-; "prompt" command
-;
-pc_prompt: call getint
+pc_setint16:
+ push ax
+ call getint
+ pop si
jc .err
- mov [ForcePrompt],bx
+ mov [si],bx
.err: ret
;
-; "implicit" command
+; Generic file-processing commands:
+; "display", "font", "kbdmap"
;
-pc_implicit: call getint
- jc .err
- mov [AllowImplicit],bx
-.err: ret
+pc_filecmd: push ax ; Function to tailcall
+ mov di,trackbuf
+ push di
+ call getline
+ pop si
+ mov di,MNameBuf
+ push di
+ call mangle_name
+ pop di
+ call searchdir ; tailcall
+ jnz .ok
+ pop ax ; Drop the successor function
+.ok: ret ; Tailcall if OK, error return
;
; "serial" command
;
; "F"-key command
;
-; This relies on the fact that [si] points to the address of the entrypoint
-;
-pc_f1: nop
-pc_f2: nop
-pc_f3: nop
-pc_f4: nop
-pc_f5: nop
-pc_f6: nop
-pc_f7: nop
-pc_f8: nop
-pc_f9: nop
-pc_f10:
- mov cx,[si]
- sub cx,pc_f1
- push cx
- mov ax,1
- shl ax,cl
- or [FKeyMap], ax ; Mark that we have this loaded
+pc_fkey: push ax
mov di,trackbuf
push di
call getline ; Get filename to display
pop si
pop di
- shl di,FILENAME_MAX_LG2 ; Convert to offset
- add di,FKeyName
call mangle_name ; Mangle file name
ret
ret
;
-; "font" command
-;
-pc_font: call pc_getfile ; "font" command
- jz .err ; File not found?
- call loadfont ; Load and install font
-.err: ret
-
-;
-; "kbd" command
-;
-pc_kbd: call pc_getfile ; "kbd" command
- jz .err
- call loadkeys
-.err: ret
-
-;
; "say" command
;
pc_say: mov di,trackbuf ; "say" command
jmp crlf ; tailcall
;
-; pc_getfile: For command line options that take file argument, this
-; routine decodes the file argument and runs it through searchdir
-;
-pc_getfile: mov di,trackbuf
- push di
- call getline
- pop si
- mov di,MNameBuf
- push di
- call mangle_name
- pop di
- jmp searchdir ; tailcall
-
-;
; Main loop for configuration file parsing
;
parse_config:
;
; 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)
+ rep stosb
+
;
; Tell the user we got this far
;
jmp short show_help
func_key:
+ ; AL = 0 if we get here
push di
cmp ah,68 ; F10
ja get_char_2
sub ah,59 ; F1
jb get_char_2
- shr ax,8
+ xchg al,ah
show_help: ; AX = func key # (0 = F1, 9 = F10)
- mov cl,al
- shl ax,FILENAME_MAX_LG2 ; Convert to offset
- mov bx,1
- shl bx,cl
- and bx,[FKeyMap]
- jz get_char_2 ; Undefined F-key
- mov di,ax
+ shl ax,FILENAME_MAX_LG2 ; Convert to pointer
+ xchg di,ax
add di,FKeyName
+ cmp byte [di],NULLFILE
+ je get_char_2 ; Undefined F-key
call searchdir
jz fk_nofile
push si
; Config file keyword table
;
%include "keywords.inc"
- align 2, db 0
-
-keywd_table:
- keyword append, pc_append
- keyword default, pc_default
- keyword timeout, pc_timeout
- keyword font, pc_font
- keyword kbdmap, pc_kbd
- keyword display, pc_display
- keyword prompt, pc_prompt
- keyword label, pc_label
- keyword implicit, pc_implicit
- keyword kernel, pc_kernel
- keyword serial, pc_serial
- keyword say, pc_say
- keyword f1, pc_f1
- keyword f2, pc_f2
- keyword f3, pc_f3
- keyword f4, pc_f4
- keyword f5, pc_f5
- keyword f6, pc_f6
- keyword f7, pc_f7
- keyword f8, pc_f8
- keyword f9, pc_f9
- keyword f10, pc_f10
- keyword f0, pc_f10
- keyword ipappend, pc_ipappend
- keyword localboot, pc_localboot
-
-keywd_count equ ($-keywd_table)/keywd_size
;
; Extensions to search for (in *forward* order).
;
AppendLen dw 0 ; Bytes in append= command
KbdTimeOut dw 0 ; Keyboard timeout (if any)
-FKeyMap dw 0 ; Bitmap for F-keys loaded
CmdLinePtr dw cmd_line_here ; Command line advancing pointer
initrd_flag equ $
initrd_ptr dw 0 ; Initial ramdisk pointer/flag