Rev 2288 | Rev 7121 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2288 | clevermous | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
||
5363 | yogev_ezra | 3 | ;; Copyright (C) KolibriOS team 2011-2015. All rights reserved. ;; |
2288 | clevermous | 4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
||
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
7 | |||
8 | $Revision: 5363 $ |
||
9 | |||
10 | ; All parsers are called with ds:si -> value of the variable, |
||
11 | ; possibly with spaces before, and dx = limit of config file. |
||
12 | |||
13 | ; Three subroutines parse_char, parse_number and parse_bool set CF |
||
14 | ; if something has failed, otherwise return the value in al/ax. |
||
15 | |||
16 | parse_timeout: |
||
17 | ; timeout is a number not greater than 9 |
||
18 | call parse_number |
||
19 | jc .nothing |
||
20 | cmp ax, 9 |
||
21 | jbe @f |
||
22 | mov ax, 9 |
||
23 | @@: |
||
24 | imul ax, 18 |
||
25 | mov [es:preboot_timeout], ax |
||
26 | .nothing: |
||
27 | ret |
||
28 | |||
29 | parse_resolution: |
||
30 | ; resolution is |
||
31 | ; parse width |
||
32 | call parse_number |
||
33 | jc .nothing |
||
34 | ; save width |
||
35 | xchg ax, bx |
||
36 | ; test for 'x' or '*' |
||
37 | call parse_char |
||
38 | cmp al, 'x' |
||
39 | jz @f |
||
40 | cmp al, '*' |
||
41 | jnz .nothing |
||
42 | @@: |
||
43 | ; parse height |
||
44 | call parse_number |
||
45 | jc .nothing |
||
46 | ; write width and height |
||
47 | mov [es:x_save], bx |
||
48 | mov [es:y_save], ax |
||
49 | .nothing: |
||
50 | ret |
||
51 | |||
52 | parse_vbemode: |
||
53 | ; vbemode is a number |
||
54 | call parse_number |
||
55 | jc .nothing |
||
56 | mov [es:number_vm], ax |
||
57 | .nothing: |
||
58 | ret |
||
59 | |||
60 | ;parse_vrr: |
||
61 | ;; vrr is a boolean setting |
||
62 | ; call parse_bool |
||
63 | ; jc .nothing |
||
64 | ;; convert 0 to 2, 1 to 1 |
||
65 | ; inc ax |
||
66 | ; xor al, 3 |
||
67 | ; mov [es:preboot_vrrm], al |
||
68 | ;.nothing: |
||
69 | ; ret |
||
70 | |||
71 | parse_biosdisks: |
||
72 | ; using biosdisks is a boolean setting |
||
73 | call parse_bool |
||
74 | jc .nothing |
||
75 | ; convert 0 to 2, 1 to 1 |
||
76 | inc ax |
||
77 | xor al, 3 |
||
78 | mov [es:preboot_biosdisk], al |
||
79 | .nothing: |
||
80 | ret |
||
81 | |||
82 | parse_imgfrom: |
||
83 | ; boot device (1-floppy 2-kolibri.img using primary loader) |
||
84 | call parse_number |
||
85 | jc .nothing |
||
86 | cmp al, 1 |
||
87 | jb .nothing |
||
88 | cmp al, 2 |
||
89 | ja .nothing |
||
90 | mov [es:preboot_device], al |
||
91 | .nothing: |
||
92 | ret |
||
93 | |||
94 | parse_char: |
||
95 | ; skip spaces and return the next character or CF if EOF. |
||
96 | cmp si, dx |
||
97 | jae .eof |
||
98 | lodsb |
||
99 | cmp al, ' ' |
||
100 | jbe parse_char |
||
101 | ret |
||
102 | .eof: |
||
103 | stc |
||
104 | ret |
||
105 | |||
106 | parse_number: |
||
107 | ; initialize high part of ax to zero |
||
108 | xor ax, ax |
||
109 | ; skip spaces |
||
110 | call parse_char |
||
111 | jc .bad |
||
112 | ; al should be a digit |
||
113 | sub al, '0' |
||
114 | cmp al, 9 |
||
115 | ja .bad |
||
116 | ; accumulate the value in cx |
||
117 | xchg cx, ax |
||
118 | @@: |
||
119 | cmp si, dx |
||
120 | jae .eof |
||
121 | lodsb |
||
122 | sub al, '0' |
||
123 | cmp al, 9 |
||
124 | ja .end |
||
125 | imul cx, 10 |
||
126 | add cx, ax |
||
127 | jmp @b |
||
128 | ; if the end is caused by non-digit, unwind the last character |
||
129 | .end: |
||
130 | dec si |
||
131 | .eof: |
||
132 | xchg cx, ax |
||
133 | clc |
||
134 | ret |
||
135 | .bad: |
||
136 | stc |
||
137 | ret |
||
138 | |||
139 | parse_bool: |
||
140 | ; skip spaces |
||
141 | call parse_char |
||
142 | jc .bad |
||
143 | ; Boolean false can be represented as 0=no=off, |
||
144 | ; boolean true can be represented as 1=yes=on. |
||
145 | cmp al, '0' |
||
146 | jz .false |
||
147 | cmp al, '1' |
||
148 | jz .true |
||
149 | mov ah, al |
||
150 | cmp si, dx |
||
151 | jae .bad |
||
152 | lodsb |
||
153 | cmp ax, 'n'*256 + 'o' |
||
154 | jz .false |
||
155 | cmp ax, 'o'*256 + 'f' |
||
156 | jz .false |
||
157 | cmp ax, 'y'*256 + 'e' |
||
158 | jz .true |
||
159 | cmp ax, 'o'*256 + 'n' |
||
160 | jz .true |
||
161 | .bad: |
||
162 | stc |
||
163 | ret |
||
164 | .true: |
||
165 | xor ax, ax |
||
166 | inc ax |
||
167 | ret |
||
168 | .false: |
||
169 | xor ax, ax |
||
170 | ret |