Add logo by Abi Rasheed
[profile/ivi/syslinux.git] / core / cmdline.inc
1 ;; -----------------------------------------------------------------------
2 ;;
3 ;;   Copyright 2003-2009 H. Peter Anvin - All Rights Reserved
4 ;;   Copyright 2009 Intel Corporation; author: H. Peter Anvin
5 ;;
6 ;;   This program is free software; you can redistribute it and/or modify
7 ;;   it under the terms of the GNU General Public License as published by
8 ;;   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
9 ;;   Boston MA 02111-1307, USA; either version 2 of the License, or
10 ;;   (at your option) any later version; incorporated herein by reference.
11 ;;
12 ;; -----------------------------------------------------------------------
13
14 ;;
15 ;; cmdline.inc
16 ;;
17 ;; Common routine to assemble [null-terminated] command line into
18 ;; real_mode_seg:cmd_line_here.
19 ;; Not used by plain kernel due to BOOT_IMAGE= etc.
20 ;;
21
22                 section .text16
23
24 ;
25 ; Assumes DS == CS
26 ;
27 make_plain_cmdline:
28                 push es
29                 ; ui.inc has already copied any APPEND options
30                 mov ax,real_mode_seg
31                 mov es,ax
32
33                 mov di,[CmdLinePtr]
34                 call do_ip_append
35
36                 mov si,[CmdOptPtr]
37
38                 call strcpy
39
40                 dec di
41                 mov [CmdLinePtr],di
42                 mov byte [es:di],0              ; Null-terminate
43
44                 pop es
45                 ret
46
47 ;
48 ; Actual IPAppend strings...
49 ;
50 %if IS_PXELINUX
51                 extern IPOption, BOOTIFStr, SYSUUIDStr
52                 global IPAppends, numIPAppends
53
54                 section .data16
55                 alignz 2
56 IPAppends       dw IPOption
57                 dw BOOTIFStr
58                 dw SYSUUIDStr
59 numIPAppends    equ ($-IPAppends)/2
60 %else
61 IPAppends       equ 0
62 numIPAppends    equ 0
63 %endif
64
65 ;
66 ; Handle "ipappend" strings, if applicable
67 ;
68 ; Assumes DS == CS; pushes output to ES:DI
69 ;
70                 section .text16
71
72 do_ip_append:
73 %ifndef DEPEND
74  %if numIPAppends > 0
75                 push cx
76                 push bx
77                 push si
78
79                 mov bx,IPAppends
80                 mov cx,[IPAppend]
81                 and cx,(1 << numIPAppends)-1
82 .loop:
83                 jcxz .done
84                 mov si,[bx]
85                 inc bx
86                 inc bx
87                 test cl,1
88                 jz .not_this
89
90                 call strcpy
91                 mov byte [es:di-1],' '  ; Replace final null with space
92 .not_this:
93                 shr cx,1
94                 jmp .loop
95 .done:
96                 pop si
97                 pop bx
98                 pop cx
99  %endif
100 %endif
101                 ret