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