Rev 485 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
180 | heavyiron | 1 | dialog_line: |
2 | mov [string_x],eax |
||
3 | mov [string_y],ebx |
||
4 | mov [MaxSizeString],ecx |
||
5 | |||
6 | and [position],0 |
||
7 | mov eax,string_ |
||
8 | mov ebx,64/4 |
||
9 | next_byte_cleare: |
||
10 | mov [eax],dword 0 |
||
11 | add eax,4 |
||
12 | dec ebx |
||
13 | jnz next_byte_cleare |
||
14 | call print_line |
||
15 | call print_cursor |
||
16 | |||
17 | opros: |
||
6342 | IgorA | 18 | mcall SF_WAIT_EVENT |
180 | heavyiron | 19 | |
6342 | IgorA | 20 | cmp eax,1 ;redraw window |
180 | heavyiron | 21 | je exit_cycle |
6342 | IgorA | 22 | cmp eax,3 ;press button |
23 | je exit_cycle |
||
180 | heavyiron | 24 | |
6342 | IgorA | 25 | cmp eax,2 ;press key |
180 | heavyiron | 26 | jne opros |
27 | |||
6342 | IgorA | 28 | mcall SF_GET_KEY |
180 | heavyiron | 29 | shr eax,8 |
30 | |||
6342 | IgorA | 31 | cmp al,13 |
180 | heavyiron | 32 | je exit_cycle |
6342 | IgorA | 33 | cmp al,8 |
180 | heavyiron | 34 | je backspace |
6342 | IgorA | 35 | cmp al,176 |
180 | heavyiron | 36 | je left |
6342 | IgorA | 37 | cmp al,179 |
180 | heavyiron | 38 | je right |
6342 | IgorA | 39 | cmp al,32 |
180 | heavyiron | 40 | je probel |
41 | |||
42 | inc [position] |
||
43 | inc [MaxSizeString] |
||
44 | call MinMaxCorrect |
||
45 | dec [MaxSizeString] |
||
46 | test ecx,ecx |
||
47 | jz no_maximum_position |
||
48 | jmp opros |
||
49 | no_maximum_position: |
||
50 | |||
51 | |||
52 | mov ebx,[position] |
||
53 | dec ebx |
||
54 | mov [string_+ebx],al |
||
55 | |||
56 | call print_line |
||
57 | call print_cursor |
||
58 | jmp opros |
||
59 | backspace: |
||
60 | dec [position] |
||
61 | call MinMaxCorrect |
||
62 | mov ebx,[position] |
||
63 | mov [string_+ebx],byte ' ' |
||
64 | |||
65 | call print_line |
||
66 | call print_cursor |
||
67 | jmp opros |
||
68 | |||
69 | left: |
||
70 | dec [position] |
||
71 | call MinMaxCorrect |
||
72 | call print_line |
||
73 | call print_cursor |
||
74 | jmp opros |
||
75 | |||
76 | right: |
||
77 | inc [position] |
||
78 | call MinMaxCorrect |
||
79 | call print_line |
||
80 | call print_cursor |
||
81 | jmp opros |
||
82 | |||
83 | probel: |
||
84 | mov ebx,[position] |
||
85 | mov [string_+ebx],byte ' ' |
||
86 | inc [position] |
||
87 | call MinMaxCorrect |
||
88 | call print_line |
||
89 | call print_cursor |
||
90 | jmp opros |
||
91 | |||
92 | exit_cycle: |
||
93 | inc [position] |
||
94 | mov ebx,[position] |
||
95 | mov [string_+ebx],byte 13 |
||
96 | exit_opros: |
||
97 | |||
98 | call print_line |
||
99 | ret |
||
100 | ;--------------------------------------------------------------- |
||
101 | print_line: |
||
6342 | IgorA | 102 | mov ebx,[string_x] |
103 | mov ecx,[string_y] |
||
104 | mov edx,[MaxSizeString] |
||
105 | shl ebx,16 |
||
106 | shl ecx,16 |
||
107 | imul edx,6 |
||
108 | add ebx,edx |
||
109 | add ebx,2 |
||
110 | add ecx,10 |
||
111 | mov edx,0xffffff |
||
112 | mcall SF_DRAW_RECT |
||
113 | mov ebx,[string_x] |
||
114 | shl ebx,16 |
||
115 | add ebx,[string_y] |
||
116 | mov edx,string_ |
||
117 | mov esi,[MaxSizeString] |
||
118 | mcall SF_DRAW_TEXT,,0 |
||
119 | ret |
||
180 | heavyiron | 120 | |
121 | print_cursor: |
||
6342 | IgorA | 122 | mov ebx,[position] |
123 | mov ecx,[string_y] |
||
124 | imul ebx,6 |
||
125 | add ebx,[string_x] |
||
126 | shl ebx,16 |
||
127 | shl ecx,16 |
||
128 | add ebx,2 |
||
129 | add ecx,8 |
||
130 | mcall SF_DRAW_RECT,,,0xff6c58 |
||
131 | ret |
||
180 | heavyiron | 132 | ;---------------------------------------------------------- |
133 | MinMaxCorrect: |
||
134 | mov ebx,[MaxSizeString] |
||
135 | xor ecx,ecx |
||
136 | |||
137 | cmp [position],ebx |
||
138 | jl no_maximum_length_string |
||
139 | mov [position],ebx |
||
140 | mov ecx,1 ;maximul position |
||
141 | no_maximum_length_string: |
||
142 | |||
143 | cmp [position],0 |
||
144 | jns no_minimum_length_string |
||
145 | and [position],0 |
||
146 | no_minimum_length_string: |
||
147 | |||
148 | ret |
||
149 | ;---------------------------------------------------------- |
||
150 | string_ rb 65 |
||
151 | position dd 0 |
||
152 | MaxSizeString dd 0 |
||
153 | string_x dd 0 |
||
154 | string_y dd 0 |
||
155 | ;********************************************************** |
||
156 | ;---------------------------------------------------------- |
||
157 | value: |
||
158 | xor edx,edx |
||
159 | cycle_value_: |
||
160 | xor ebx,ebx |
||
161 | mov bl,byte[eax] |
||
162 | |||
163 | cmp bl,'0' |
||
164 | jne no_0 |
||
165 | mov ebx,0 |
||
166 | jmp exit_v |
||
167 | no_0: |
||
168 | cmp bl,'1' |
||
169 | jne no_1 |
||
170 | mov ebx,1 |
||
171 | jmp exit_v |
||
172 | no_1: |
||
173 | cmp bl,'2' |
||
174 | jne no_2 |
||
175 | mov ebx,2 |
||
176 | jmp exit_v |
||
177 | no_2: |
||
178 | cmp bl,'3' |
||
179 | jne no_3 |
||
180 | mov ebx,3 |
||
181 | jmp exit_v |
||
182 | no_3: |
||
183 | cmp bl,'4' |
||
184 | jne no_4 |
||
185 | mov ebx,4 |
||
186 | jmp exit_v |
||
187 | no_4: |
||
188 | cmp bl,'5' |
||
189 | jne no_5 |
||
190 | mov ebx,5 |
||
191 | jmp exit_v |
||
192 | no_5: |
||
193 | cmp bl,'6' |
||
194 | jne no_6 |
||
195 | mov ebx,6 |
||
196 | jmp exit_v |
||
197 | no_6: |
||
198 | cmp bl,'7' |
||
199 | jne no_7 |
||
200 | mov ebx,7 |
||
201 | jmp exit_v |
||
202 | no_7: |
||
203 | cmp bl,'8' |
||
204 | jne no_8 |
||
205 | mov ebx,8 |
||
206 | jmp exit_v |
||
207 | no_8: |
||
208 | cmp bl,'9' |
||
209 | jne no_9 |
||
210 | mov ebx,9 |
||
211 | jmp exit_v |
||
212 | no_9: |
||
213 | xor edx,edx |
||
214 | jmp error |
||
215 | exit_v: |
||
216 | mov ecx,[length_number] |
||
217 | dec ecx |
||
218 | test ecx,ecx |
||
219 | jz no_stepen |
||
220 | |||
221 | next_mul: |
||
222 | imul ebx,10 |
||
223 | dec ecx |
||
224 | jne next_mul |
||
225 | |||
226 | no_stepen: |
||
227 | add edx,ebx |
||
228 | |||
229 | inc eax |
||
230 | dec [length_number] |
||
231 | jnz cycle_value_ |
||
232 | error: |
||
233 | mov eax,edx |
||
234 | ret |
||
235 | ;---------------------------------------------------------- |
||
236 | length_number dd 0 |