Add routine to initialize and test for the FPU.
[syslinux.git] / parsecmd.inc
blob564b592d637441bd60f00f4f0430bc2be4eea6e9
1 ;; -----------------------------------------------------------------------
2 ;;
3 ;;   Copyright 1994-2002 H. Peter Anvin - All Rights Reserved
4 ;;
5 ;;   This program is free software; you can redistribute it and/or modify
6 ;;   it under the terms of the GNU General Public License as published by
7 ;;   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 ;;   Boston MA 02111-1307, USA; either version 2 of the License, or
9 ;;   (at your option) any later version; incorporated herein by reference.
11 ;; -----------------------------------------------------------------------
14 ;; parsecmd.inc
16 ;; Command line parser code
19                 section .text
21 ; -------------------------------------------------------------------------
22 ;  getcommand:  Get a keyword from the current "getc" file and match it
23 ;               against a list of keywords (keywd_table).  Each entry in
24 ;               that table should have the following form:
25 ;               <32 bit hash value> <16 bit handler offset>
27 ;               The handler is called, and upon return this function
28 ;               returns with CF = 0.  On EOF, this function returns
29 ;               with CF = 1.
30 ; -------------------------------------------------------------------------
32 getcommand:
33 .find:
34                 call skipspace          ; Skip leading whitespace
35                 jz .eof                 ; End of file
36                 jc .find                ; End of line: try again
38                 ; Do this explicitly so #foo is treated as a comment
39                 cmp al,'#'              ; Leading hash mark -> comment
40                 je .skipline
42                 or al,20h               ; Convert to lower case
43                 movzx ebx,al            ; Hash for a one-char keyword
44 .read_loop:
45                 push ebx
46                 call getc
47                 pop ebx
48                 jc .eof
49                 cmp al,' '              ; Whitespace
50                 jbe .done
51                 or al,20h
52                 rol ebx,5
53                 xor bl,al
54                 jmp short .read_loop
55 .done:          call ungetc
56                 call skipspace
57                 jz .eof
58                 jc .noparm
59                 call ungetc             ; Return nonwhitespace char to buf
60                 mov si,keywd_table
61                 mov cx,keywd_count
62 .table_search:
63                 lodsd
64                 cmp ebx,eax
65                 je .found_keywd
66                 lodsd                   ; Skip entrypoint/argument
67                 loop .table_search
69                 ; Otherwise unrecognized keyword
70                 mov si,err_badcfg
71                 jmp short .error
73                 ; No parameter
74 .noparm:
75                 mov si,err_noparm
76                 mov al,10               ; Already at EOL
77 .error:
78                 call cwritestr
79                 jmp short .skipline
81 .found_keywd:   lodsw                   ; Load argument into ax
82                 call [si]
83                 clc
84                 ret
86 .eof:           stc
87                 ret
89 .skipline:      cmp al,10               ; Search for LF
90                 je .find
91                 call getc
92                 jc .eof
93                 jmp short .skipline
95                 section .latebss
96                 alignb 4
97 vk_size         equ (vk_end + 3) & ~3
98 VKernelBuf:     resb vk_size            ; "Current" vkernel
99 AppendBuf       resb max_cmd_len+1      ; append=
100 Ontimeout       resb max_cmd_len+1      ; ontimeout
101 Onerror         resb max_cmd_len+1      ; onerror
102 KbdMap          resb 256                ; Keyboard map
103 FKeyName        resb 10*FILENAME_MAX    ; File names for F-key help
104 KernelCNameLen  resw 1                  ; Length of unmangled kernel name
105 InitRDCNameLen  resw 1                  ; Length of unmangled initrd name
106 %if IS_SYSLINUX
107 KernelName      resb FILENAME_MAX+1     ; Mangled name for kernel
108 KernelCName     resb FILENAME_MAX+2     ; Unmangled kernel name
109 InitRDCName     resb FILENAME_MAX+2     ; Unmangled initrd name
110 %else
111 KernelName      resb FILENAME_MAX       ; Mangled name for kernel
112 KernelCName     resb FILENAME_MAX       ; Unmangled kernel name
113 InitRDCName     resb FILENAME_MAX       ; Unmangled initrd name
114 %endif
115 MNameBuf        resb FILENAME_MAX
116 InitRD          resb FILENAME_MAX