Subversion Repositories Kolibri OS

Rev

Rev 485 | Go to most recent revision | Details | 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:
18
	    mov eax,10
19
	    int 0x40
20
 
21
	    cmp eax,1
22
	    je exit_cycle
23
 
24
	    cmp eax,2
25
	    jne opros
26
 
27
	    mov eax,2
28
	    int 0x40
29
	    shr eax,8
30
 
31
	    cmp eax,13
32
	    je exit_cycle
33
	    cmp eax,8
34
	    je backspace
35
	    cmp eax,176
36
	    je left
37
	    cmp eax,179
38
	    je right
39
	    cmp eax,32
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:
102
	     mov eax,13
103
	     mov ebx,[string_x]
104
	     mov ecx,[string_y]
105
	     mov edx,[MaxSizeString]
106
	     shl ebx,16
107
	     shl ecx,16
108
	     imul edx,6
109
	     add ebx,edx
110
	     add ebx,2
111
	     add ecx,10
112
	     mov edx,0xffffff
113
	     int 0x40
114
	     mov eax,4
115
	     mov ebx,[string_x]
116
	     shl ebx,16
117
	     add ebx,[string_y]
118
	     mov ecx,0
119
	     mov edx,string_
120
	     mov esi,[MaxSizeString]
121
	     int 0x40
122
	     ret
123
 
124
print_cursor:
125
	     mov eax,13
126
	     mov ebx,[position]
127
	     mov ecx,[string_y]
128
	     imul ebx,6
129
	     add ebx,[string_x]
130
	     shl ebx,16
131
	     shl ecx,16
132
	     add ebx,2
133
	     add ecx,8
134
	     mov edx,0xff6c58
135
	     int 0x40
136
	     ret
137
;----------------------------------------------------------
138
MinMaxCorrect:
139
	    mov ebx,[MaxSizeString]
140
	    xor ecx,ecx
141
 
142
	    cmp [position],ebx
143
	    jl no_maximum_length_string
144
	    mov [position],ebx
145
	    mov ecx,1	 ;maximul position
146
	    no_maximum_length_string:
147
 
148
	    cmp [position],0
149
	    jns no_minimum_length_string
150
	    and [position],0
151
	    no_minimum_length_string:
152
 
153
	    ret
154
;----------------------------------------------------------
155
string_       rb 65
156
position      dd 0
157
MaxSizeString dd 0
158
string_x      dd 0
159
string_y      dd 0
160
;**********************************************************
161
;----------------------------------------------------------
162
  value:
163
	xor edx,edx
164
  cycle_value_:
165
	xor ebx,ebx
166
	mov bl,byte[eax]
167
 
168
	cmp bl,'0'
169
	jne no_0
170
	mov ebx,0
171
	jmp exit_v
172
	no_0:
173
	cmp bl,'1'
174
	jne no_1
175
	mov ebx,1
176
	jmp exit_v
177
	no_1:
178
	cmp bl,'2'
179
	jne no_2
180
	mov ebx,2
181
	jmp exit_v
182
	no_2:
183
	cmp bl,'3'
184
	jne no_3
185
	mov ebx,3
186
	jmp exit_v
187
	no_3:
188
	cmp bl,'4'
189
	jne no_4
190
	mov ebx,4
191
	jmp exit_v
192
	no_4:
193
	cmp bl,'5'
194
	jne no_5
195
	mov ebx,5
196
	jmp exit_v
197
	no_5:
198
	cmp bl,'6'
199
	jne no_6
200
	mov ebx,6
201
	jmp exit_v
202
	no_6:
203
	cmp bl,'7'
204
	jne no_7
205
	mov ebx,7
206
	jmp exit_v
207
	no_7:
208
	cmp bl,'8'
209
	jne no_8
210
	mov ebx,8
211
	jmp exit_v
212
	no_8:
213
	cmp bl,'9'
214
	jne no_9
215
	mov ebx,9
216
	jmp exit_v
217
	no_9:
218
	xor edx,edx
219
	jmp error
220
	exit_v:
221
	mov ecx,[length_number]
222
	dec ecx
223
	test ecx,ecx
224
	jz no_stepen
225
 
226
    next_mul:
227
	imul ebx,10
228
	dec ecx
229
	jne next_mul
230
 
231
	no_stepen:
232
	add edx,ebx
233
 
234
	inc eax
235
	dec [length_number]
236
	jnz cycle_value_
237
	error:
238
	mov eax,edx
239
	ret
240
;----------------------------------------------------------
241
length_number	dd 0