Subversion Repositories Kolibri OS

Rev

Rev 6354 | Rev 6357 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6354 Rev 6355
1
macro square_width_put
1
macro square_width_put
2
{
2
{
3
local .no_put_to_screen
3
local .no_put_to_screen
4
local .next_color_put
4
local .next_color_put
5
local .vertical_width_put
5
local .vertical_width_put
6
local .horizontal_width_put
6
local .horizontal_width_put
7
 
7
 
8
	mov ebx,[ReserveArray]
8
	mov ebx,[ReserveArray]
9
	mov eax,[ebx]
9
	mov eax,[ebx]
10
	test eax,eax
10
	test eax,eax
11
	jz .no_put_to_screen
11
	jz .no_put_to_screen
12
	mov ecx,[ebx]
12
	mov ecx,[ebx]
13
	add ebx,4
13
	add ebx,4
14
	xor ebp,ebp
14
	xor ebp,ebp
15
 
15
 
16
	.next_color_put:
16
	.next_color_put:
17
	;put saved pixels in ReserveArray
17
	;put saved pixels in ReserveArray
18
	push ecx
18
	push ecx
19
	mov [counter2],5
19
	mov [counter2],5
20
	mov edi,[ebx]
20
	mov edi,[ebx]
21
	push edi
21
	push edi
22
	.vertical_width_put:
22
	.vertical_width_put:
23
		mov [counter],5
23
		mov [counter],5
24
 
24
 
25
		.horizontal_width_put:
25
		.horizontal_width_put:
26
			mov edx,[ebx+4807*4+ebp]
26
			mov edx,[ebx+4807*4+ebp]
27
			;and edx,0xffffff
27
			;and edx,0xffffff
28
			mov [edi],dx
28
			mov [edi],dx
29
			shr edx,16
29
			shr edx,16
30
			mov [edi+2],dl
30
			mov [edi+2],dl
31
 
31
 
32
		add edi,3
32
		add edi,3
33
		add ebp,4
33
		add ebp,4
34
		dec [counter]
34
		dec [counter]
35
		jnz .horizontal_width_put
35
		jnz .horizontal_width_put
36
 
36
 
37
		mov ecx,[Picture_SizeX]
37
		mov ecx,[Picture_SizeX]
38
		sub ecx,5
38
		sub ecx,5
39
		lea ecx,[ecx+ecx*2]
39
		lea ecx,[ecx+ecx*2]
40
		add edi,ecx
40
		add edi,ecx
41
	dec [counter2]
41
	dec [counter2]
42
	jnz .vertical_width_put
42
	jnz .vertical_width_put
43
	pop edi
43
	pop edi
44
	pop ecx
44
	pop ecx
45
 
45
 
46
	add ebx,4
46
	add ebx,4
47
	dec ecx
47
	dec ecx
48
	jnz .next_color_put
48
	jnz .next_color_put
49
 
49
 
50
	.no_put_to_screen:
50
	.no_put_to_screen:
51
}
51
}
52
 
52
 
53
macro square_width_save
53
macro square_width_save
54
{
54
{
55
local .next_color_save
55
local .next_color_save
56
local .vertical_width_save
56
local .vertical_width_save
57
local .horizontal_width_save
57
local .horizontal_width_save
58
	mov ebx,[ReserveArray]
58
	mov ebx,[ReserveArray]
59
	mov [ebx],eax
59
	mov [ebx],eax
60
	mov ecx,eax
60
	mov ecx,eax
61
	add ebx,4
61
	add ebx,4
62
	xor ebp,ebp
62
	xor ebp,ebp
63
 
63
 
64
	.next_color_save:
64
	.next_color_save:
65
	;save color of pixel in ReserveArray
65
	;save color of pixel in ReserveArray
66
	push ecx
66
	push ecx
67
	mov [counter2],5
67
	mov [counter2],5
68
	mov edi,[ebx]
68
	mov edi,[ebx]
69
	.vertical_width_save:
69
	.vertical_width_save:
70
		mov [counter],5
70
		mov [counter],5
71
 
71
 
72
		.horizontal_width_save:
72
		.horizontal_width_save:
73
			mov eax,edi
73
			mov eax,edi
74
			mov edx,[eax]
74
			mov edx,[eax]
75
			;and edx,0xffffff
75
			;and edx,0xffffff
76
			mov [ebx+4807*4+ebp],dx
76
			mov [ebx+4807*4+ebp],dx
77
			shr edx,16
77
			shr edx,16
78
			mov [ebx+4807*4+2+ebp],dl
78
			mov [ebx+4807*4+2+ebp],dl
79
 
79
 
80
		add edi,3
80
		add edi,3
81
		add ebp,4
81
		add ebp,4
82
		dec [counter]
82
		dec [counter]
83
		jnz .horizontal_width_save
83
		jnz .horizontal_width_save
84
 
84
 
85
		mov ecx,[Picture_SizeX]
85
		mov ecx,[Picture_SizeX]
86
		sub ecx,5
86
		sub ecx,5
87
		lea ecx,[ecx+ecx*2]
87
		lea ecx,[ecx+ecx*2]
88
		add edi,ecx
88
		add edi,ecx
89
	dec [counter2]
89
	dec [counter2]
90
	jnz .vertical_width_save
90
	jnz .vertical_width_save
91
	pop ecx
91
	pop ecx
92
 
92
 
93
	add ebx,4
93
	add ebx,4
94
	dec ecx
94
	dec ecx
95
	jnz .next_color_save
95
	jnz .next_color_save
96
}
96
}
-
 
97
 
-
 
98
macro draw_calc_pixels brush
-
 
99
{
-
 
100
local .next_pixel_put
-
 
101
local .vertical_width
-
 
102
local .horizontal_width
-
 
103
local .no_draw_pixel
-
 
104
 
-
 
105
	mov ebx,[ReserveArray]
-
 
106
	mov ecx,[ebx]
-
 
107
	mov edx,[Color]
-
 
108
	mov esi,[Color]
-
 
109
	shr edx,16
-
 
110
	add ebx,4
-
 
111
	mov edi,[line_width]
-
 
112
	dec edi
-
 
113
	imul edi,25
-
 
114
	add edi,brush
-
 
115
	.next_pixel_put:
-
 
116
 
-
 
117
	mov eax,[ebx]
-
 
118
	push eax
-
 
119
	push ecx
-
 
120
	xor ebp,ebp
-
 
121
	mov [counter2],5
-
 
122
 
-
 
123
	.vertical_width:
-
 
124
		mov [counter],5
-
 
125
 
-
 
126
		.horizontal_width:
-
 
127
		xor ecx,ecx
-
 
128
		mov cl,byte[edi+ebp]
-
 
129
		test cl,cl
-
 
130
		jz .no_draw_pixel
-
 
131
			mov [eax],si
-
 
132
			mov [eax+2],dl
-
 
133
		.no_draw_pixel:
-
 
134
		add eax,3
-
 
135
		inc ebp
-
 
136
		dec [counter]
-
 
137
		jnz .horizontal_width
-
 
138
 
-
 
139
		mov ecx,[Picture_SizeX]
-
 
140
		sub ecx,5
-
 
141
		lea ecx,[ecx+ecx*2]
-
 
142
		add eax,ecx
-
 
143
	dec [counter2]
-
 
144
	jnz .vertical_width
-
 
145
 
-
 
146
	pop ecx
-
 
147
	pop eax
-
 
148
	add ebx,4
-
 
149
	dec ecx
-
 
150
	jnz .next_pixel_put
-
 
151
}
97
 
152
 
98
;-----------------------------------------------------------
153
;-----------------------------------------------------------
99
;-----instruments of panel(icon's instruments)--------------
154
;-----instruments of panel(icon's instruments)--------------
100
;-----------------------------------------------------------
155
;-----------------------------------------------------------
101
TakeButtonInstruments:
156
TakeButtonInstruments:
102
 
157
 
103
	mov eax,[Current_instrument]
158
	mov eax,[Current_instrument]
104
 
159
 
105
	;*************************brush 1***********************
160
	;*************************brush 1***********************
106
	cmp eax,40
161
	cmp eax,40
107
	jne no_brush1
162
	jne no_brush1
108
 
163
 
109
	mov [Brush_SizeX],4
164
	mov [Brush_SizeX],4
110
	mov [Brush_SizeY],4
165
	mov [Brush_SizeY],4
111
	mov [Number_Brush],0
166
	mov [Number_Brush],0
112
	mov ebx,[Last_instrument]
167
	mov ebx,[Last_instrument]
113
	mov [Current_instrument],ebx
168
	mov [Current_instrument],ebx
114
 
169
 
115
	mov [line_width],1
170
	mov [line_width],1
116
 
171
 
117
	jmp still
172
	jmp still
118
	no_brush1:
173
	no_brush1:
119
 
174
 
120
	;*************************brush 2***********************
175
	;*************************brush 2***********************
121
	cmp eax,41
176
	cmp eax,41
122
	jne no_brush2
177
	jne no_brush2
123
 
178
 
124
	mov [Brush_SizeX],6
179
	mov [Brush_SizeX],6
125
	mov [Brush_SizeY],4
180
	mov [Brush_SizeY],4
126
	mov [Number_Brush],1
181
	mov [Number_Brush],1
127
	mov ebx,[Last_instrument]
182
	mov ebx,[Last_instrument]
128
	mov [Current_instrument],ebx
183
	mov [Current_instrument],ebx
129
 
184
 
130
	mov [line_width],2
185
	mov [line_width],2
131
 
186
 
132
	jmp still
187
	jmp still
133
	no_brush2:
188
	no_brush2:
134
 
189
 
135
	;*************************brush 3***********************
190
	;*************************brush 3***********************
136
	cmp eax,42
191
	cmp eax,42
137
	jne no_brush3
192
	jne no_brush3
138
 
193
 
139
	mov [Brush_SizeX],8
194
	mov [Brush_SizeX],8
140
	mov [Brush_SizeY],7
195
	mov [Brush_SizeY],7
141
	mov [Number_Brush],2
196
	mov [Number_Brush],2
142
	mov ebx,[Last_instrument]
197
	mov ebx,[Last_instrument]
143
	mov [Current_instrument],ebx
198
	mov [Current_instrument],ebx
144
 
199
 
145
	mov [line_width],3
200
	mov [line_width],3
146
 
201
 
147
	jmp still
202
	jmp still
148
	no_brush3:
203
	no_brush3:
149
 
204
 
150
	;*************************brush 4***********************
205
	;*************************brush 4***********************
151
	cmp eax,43
206
	cmp eax,43
152
	jne no_brush4
207
	jne no_brush4
153
 
208
 
154
	mov [Brush_SizeX],14
209
	mov [Brush_SizeX],14
155
	mov [Brush_SizeY],14
210
	mov [Brush_SizeY],14
156
	mov [Number_Brush],3
211
	mov [Number_Brush],3
157
	mov ebx,[Last_instrument]
212
	mov ebx,[Last_instrument]
158
	mov [Current_instrument],ebx
213
	mov [Current_instrument],ebx
159
 
214
 
160
	mov [line_width],4
215
	mov [line_width],4
161
 
216
 
162
	jmp still
217
	jmp still
163
	no_brush4:
218
	no_brush4:
164
 
219
 
165
	;*************************brush 5***********************
220
	;*************************brush 5***********************
166
	cmp eax,44
221
	cmp eax,44
167
	jne no_brush5
222
	jne no_brush5
168
 
223
 
169
	mov [Brush_SizeX],6
224
	mov [Brush_SizeX],6
170
	mov [Brush_SizeY],6
225
	mov [Brush_SizeY],6
171
	mov [Number_Brush],4
226
	mov [Number_Brush],4
172
	mov ebx,[Last_instrument]
227
	mov ebx,[Last_instrument]
173
	mov [Current_instrument],ebx
228
	mov [Current_instrument],ebx
174
 
229
 
175
	mov [line_width],5
230
	mov [line_width],5
176
 
231
 
177
	jmp still
232
	jmp still
178
	no_brush5:
233
	no_brush5:
179
 
234
 
180
	;*************************pensil************************
235
	;*************************pensil************************
181
	cmp eax,10
236
	cmp eax,10
182
	jne no_pensil
237
	jne no_pensil
183
 
238
 
184
	mov al,[exit_from_work_arrea]
239
	mov al,[exit_from_work_arrea]
185
 
240
 
186
	test al,al
241
	test al,al
187
	jz no_exit_from_work_arrea
242
	jz no_exit_from_work_arrea
188
 
243
 
189
	and [Activate_instrument],0
244
	and [Activate_instrument],0
190
	and [exit_from_work_arrea],0
245
	and [exit_from_work_arrea],0
191
 
246
 
192
	no_exit_from_work_arrea:
247
	no_exit_from_work_arrea:
193
 
248
 
194
	mov al,[Activate_instrument]
249
	mov al,[Activate_instrument]
195
 
250
 
196
	test al,al
251
	test al,al
197
	jnz no_activated_later
252
	jnz no_activated_later
198
 
253
 
199
	call GetScreenCordinats
254
	call GetScreenCordinats
200
	mov eax,[ScreenX]
255
	mov eax,[ScreenX]
201
	mov ebx,[ScreenY]
256
	mov ebx,[ScreenY]
202
	add eax,[PosX]
257
	add eax,[PosX]
203
	add ebx,[PosY]
258
	add ebx,[PosY]
204
	mov [OldX],eax
259
	mov [OldX],eax
205
	mov [OldY],ebx
260
	mov [OldY],ebx
206
 
261
 
207
	no_activated_later:
262
	no_activated_later:
208
 
263
 
209
;	mov eax,[MaxWorkScreen_SizeX] ???
264
;	mov eax,[MaxWorkScreen_SizeX] ???
210
;	mov ebx,[MaxWorkScreen_SizeY] ???
265
;	mov ebx,[MaxWorkScreen_SizeY] ???
211
 
266
 
212
	mov eax,[PointerToPicture]
267
	mov eax,[PointerToPicture]
213
	mov ebx,[ReserveArray]
268
	mov ebx,[ReserveArray]
214
	mov ecx,[Picture_SizeX]
269
	mov ecx,[Picture_SizeX]
215
	mov edx,[OldX]
270
	mov edx,[OldX]
216
	shl edx,16
271
	shl edx,16
217
	add edx,[OldY]
272
	add edx,[OldY]
218
	mov esi,[ScreenX]
273
	mov esi,[ScreenX]
219
	mov edi,[ScreenY]
274
	mov edi,[ScreenY]
220
	add esi,[PosX]
275
	add esi,[PosX]
221
	add edi,[PosY]
276
	add edi,[PosY]
222
	call calculate_line
277
	call calculate_line
223
 
278
 
224
	mov ecx,eax
279
	mov ecx,eax
225
	mov edx,[Color]
280
	mov edx,[Color]
226
	mov esi,[Color]
281
	mov esi,[Color]
227
	shr edx,16
282
	shr edx,16
228
	xor ebx,ebx
283
	xor ebx,ebx
229
	mov eax,[ReserveArray]
284
	mov eax,[ReserveArray]
230
 
285
 
231
	pensil_next_pixel_draw:
286
	pensil_next_pixel_draw:
232
 
287
 
233
	  mov ebx,[eax]
288
	  mov ebx,[eax]
234
	  mov [ebx],si
289
	  mov [ebx],si
235
	  mov [ebx+2],dl
290
	  mov [ebx+2],dl
236
	  add eax,4
291
	  add eax,4
237
 
292
 
238
	dec ecx
293
	dec ecx
239
	jnz pensil_next_pixel_draw
294
	jnz pensil_next_pixel_draw
240
 
295
 
241
	mov eax,[ScreenX]
296
	mov eax,[ScreenX]
242
	mov ebx,[ScreenY]
297
	mov ebx,[ScreenY]
243
	add eax,[PosX]
298
	add eax,[PosX]
244
	add ebx,[PosY]
299
	add ebx,[PosY]
245
	mov [OldX],eax
300
	mov [OldX],eax
246
	mov [OldY],ebx
301
	mov [OldY],ebx
247
 
302
 
248
	call MovePictureToWorkScreen
303
	call MovePictureToWorkScreen
249
	mov [Activate_instrument],1
304
	mov [Activate_instrument],1
250
	jmp still
305
	jmp still
251
	no_pensil:
306
	no_pensil:
252
 
307
 
253
	;*************************pipetka***********************
308
	;*************************pipetka***********************
254
	cmp eax,15
309
	cmp eax,15
255
	jne no_pipetka
310
	jne no_pipetka
256
 
311
 
257
	mov eax,[ScreenY]
312
	mov eax,[ScreenY]
258
	mov ebx,[Picture_SizeX]
313
	mov ebx,[Picture_SizeX]
259
	add eax,[PosY]
314
	add eax,[PosY]
260
	imul eax,ebx
315
	imul eax,ebx
261
	add eax,[ScreenX]
316
	add eax,[ScreenX]
262
	add eax,[PosX]
317
	add eax,[PosX]
263
	lea eax,[eax+eax*2]
318
	lea eax,[eax+eax*2]
264
	add eax,[PointerToPicture]
319
	add eax,[PointerToPicture]
265
	mov ebx,[eax]
320
	mov ebx,[eax]
266
	and ebx,0xffffff
321
	and ebx,0xffffff
267
	mov [Color],ebx
322
	mov [Color],ebx
268
 
323
 
269
	mcall SF_DRAW_RECT, 136*65536+20, 65*65536+21, [Color]
324
	mcall SF_DRAW_RECT, 136*65536+20, 65*65536+21, [Color]
270
 
325
 
271
	jmp still
326
	jmp still
272
	no_pipetka:
327
	no_pipetka:
273
 
328
 
274
	;*************************draw brush********************
329
	;*************************draw brush********************
275
	cmp eax,11
330
	cmp eax,11
276
	jne no_brush
331
	jne no_brush
277
 
332
 
278
	mov [Last_instrument],eax
333
	mov [Last_instrument],eax
279
 
334
 
280
	jmp no_lastik_
335
	jmp no_lastik_
281
 
336
 
282
	lastik_in:
337
	lastik_in:
283
	mov eax,[Color]
338
	mov eax,[Color]
284
	mov [SColor],eax
339
	mov [SColor],eax
285
	mov [Color],0xffffff
340
	mov [Color],0xffffff
286
	no_lastik_:
341
	no_lastik_:
287
 
342
 
288
	mov eax,[ScreenX]
343
	mov eax,[ScreenX]
289
	mov ebx,[ScreenY]
344
	mov ebx,[ScreenY]
290
	mov ecx,[Brush_SizeX]
345
	mov ecx,[Brush_SizeX]
291
	mov edx,[Brush_SizeY]
346
	mov edx,[Brush_SizeY]
292
	add eax,[PosX]
347
	add eax,[PosX]
293
	add ebx,[PosY]
348
	add ebx,[PosY]
294
	add eax,ecx
349
	add eax,ecx
295
	add ebx,edx
350
	add ebx,edx
296
 
351
 
297
	cmp eax,[Picture_SizeX]
352
	cmp eax,[Picture_SizeX]
298
	jl no_max_pos_x
353
	jl no_max_pos_x
299
	mov eax,[Picture_SizeX]
354
	mov eax,[Picture_SizeX]
300
	no_max_pos_x:
355
	no_max_pos_x:
301
 
356
 
302
	cmp ebx,[Picture_SizeY]
357
	cmp ebx,[Picture_SizeY]
303
	jl no_max_pos_y
358
	jl no_max_pos_y
304
	mov ebx,[Picture_SizeY]
359
	mov ebx,[Picture_SizeY]
305
	no_max_pos_y:
360
	no_max_pos_y:
306
 
361
 
307
	cmp eax,ecx
362
	cmp eax,ecx
308
	ja no_min_pos_x
363
	ja no_min_pos_x
309
	mov eax,[Brush_SizeX]
364
	mov eax,[Brush_SizeX]
310
	no_min_pos_x:
365
	no_min_pos_x:
311
 
366
 
312
	cmp ebx,edx
367
	cmp ebx,edx
313
	ja no_min_pos_y
368
	ja no_min_pos_y
314
	mov ebx,[Brush_SizeY]
369
	mov ebx,[Brush_SizeY]
315
	no_min_pos_y:
370
	no_min_pos_y:
316
 
371
 
317
	sub eax,[Brush_SizeX]
372
	sub eax,[Brush_SizeX]
318
	sub ebx,[Brush_SizeY]
373
	sub ebx,[Brush_SizeY]
319
 
374
 
320
	mov [x],eax
375
	mov [x],eax
321
	mov [y],ebx
376
	mov [y],ebx
322
 
377
 
323
	mov al,[exit_from_work_arrea]
378
	mov al,[exit_from_work_arrea]
324
	test al,al
379
	test al,al
325
	jz no_exit_from_work_arrea_brush
380
	jz no_exit_from_work_arrea_brush
326
	and [Activate_instrument],0
381
	and [Activate_instrument],0
327
	and [exit_from_work_arrea],0
382
	and [exit_from_work_arrea],0
328
	no_exit_from_work_arrea_brush:
383
	no_exit_from_work_arrea_brush:
329
 
384
 
330
	mov al,[Activate_instrument]
385
	mov al,[Activate_instrument]
331
	test al,al
386
	test al,al
332
	jnz no_new_brush_xy
387
	jnz no_new_brush_xy
333
	mov eax,[x]
388
	mov eax,[x]
334
	mov ebx,[y]
389
	mov ebx,[y]
335
	mov [OldX],eax
390
	mov [OldX],eax
336
	mov [OldY],ebx
391
	mov [OldY],ebx
337
	mov [Activate_instrument],1
392
	mov [Activate_instrument],1
338
	no_new_brush_xy:
393
	no_new_brush_xy:
339
 
394
 
340
	mov eax,[PointerToPicture]
395
	mov eax,[PointerToPicture]
341
	mov ebx,[ReserveArray]
396
	mov ebx,[ReserveArray]
342
	add ebx,4
397
	add ebx,4
343
	mov ecx,[Picture_SizeX]
398
	mov ecx,[Picture_SizeX]
344
	mov edx,[OldX]
399
	mov edx,[OldX]
345
	shl edx,16
400
	shl edx,16
346
	add edx,[OldY]
401
	add edx,[OldY]
347
	mov esi,[x]
402
	mov esi,[x]
348
	mov edi,[y]
403
	mov edi,[y]
349
 
404
 
350
	call calculate_line
405
	call calculate_line
351
 
406
 
352
	mov ebx,[ReserveArray]
407
	mov ebx,[ReserveArray]
353
	mov [ebx],eax
408
	mov [ebx],eax
354
 
409
 
355
	;procedure drawing of brush
410
	;procedure drawing of brush
356
	mov ebx,[ReserveArray]
411
	mov ebx,[ReserveArray]
357
	mov ecx,[ebx]
412
	mov ecx,[ebx]
358
	mov edx,[Color]
413
	mov edx,[Color]
359
	mov esi,[Color]
414
	mov esi,[Color]
360
	shr edx,16
415
	shr edx,16
361
	add ebx,4
416
	add ebx,4
362
	mov edi,[Number_Brush]
417
	mov edi,[Number_Brush]
363
	imul edi,20*20
418
	imul edi,20*20
364
 
419
 
365
	next_pixel_put_brush:
420
	next_pixel_put_brush:
366
 
421
 
367
	mov eax,[ebx]
422
	mov eax,[ebx]
368
	push eax
423
	push eax
369
	push ecx
424
	push ecx
370
	xor ebp,ebp
425
	xor ebp,ebp
371
	and [counter2],0
426
	and [counter2],0
372
 
427
 
373
	vertical_width_brush:
428
	vertical_width_brush:
374
	   and [counter],0
429
	   and [counter],0
375
 
430
 
376
	   horizontal_width_brush:
431
	   horizontal_width_brush:
377
	   xor ecx,ecx
432
	   xor ecx,ecx
378
	   mov cl,byte[Brush_color+edi+ebp]
433
	   mov cl,byte[Brush_color+edi+ebp]
379
	   test cl,cl
434
	   test cl,cl
380
	     jz no_draw_pixel_brush
435
	     jz no_draw_pixel_brush
381
	      mov [eax],si
436
	      mov [eax],si
382
	      mov [eax+2],dl
437
	      mov [eax+2],dl
383
	     no_draw_pixel_brush:
438
	     no_draw_pixel_brush:
384
	   add eax,3
439
	   add eax,3
385
	   inc ebp
440
	   inc ebp
386
	   inc [counter]
441
	   inc [counter]
387
	   cmp [counter],20
442
	   cmp [counter],20
388
	   jne horizontal_width_brush
443
	   jne horizontal_width_brush
389
 
444
 
390
	   mov ecx,[Picture_SizeX]
445
	   mov ecx,[Picture_SizeX]
391
	   sub ecx,20
446
	   sub ecx,20
392
	   lea ecx,[ecx+ecx*2]
447
	   lea ecx,[ecx+ecx*2]
393
	   add eax,ecx
448
	   add eax,ecx
394
	inc [counter2]
449
	inc [counter2]
395
	cmp [counter2],20
450
	cmp [counter2],20
396
	jne vertical_width_brush
451
	jne vertical_width_brush
397
 
452
 
398
	pop ecx
453
	pop ecx
399
	pop eax
454
	pop eax
400
	add ebx,4
455
	add ebx,4
401
	dec ecx
456
	dec ecx
402
	jnz next_pixel_put_brush
457
	jnz next_pixel_put_brush
403
 
458
 
404
	mov eax,[x]
459
	mov eax,[x]
405
	mov ebx,[y]
460
	mov ebx,[y]
406
	mov [OldX],eax
461
	mov [OldX],eax
407
	mov [OldY],ebx
462
	mov [OldY],ebx
408
 
463
 
409
	mov al,[lastik_is_active]
464
	mov al,[lastik_is_active]
410
	test al,al
465
	test al,al
411
	jz no_lastik_active
466
	jz no_lastik_active
412
 
467
 
413
	mov eax,[SColor]
468
	mov eax,[SColor]
414
	mov [Color],eax
469
	mov [Color],eax
415
	and [lastik_is_active],0
470
	and [lastik_is_active],0
416
	no_lastik_active:
471
	no_lastik_active:
417
 
472
 
418
	call MovePictureToWorkScreen
473
	call MovePictureToWorkScreen
419
	mov eax,[Current_instrument]
474
	mov eax,[Current_instrument]
420
	mov [Last_instrument],eax
475
	mov [Last_instrument],eax
421
 
476
 
422
	jmp still
477
	jmp still
423
	no_brush:
478
	no_brush:
424
 
479
 
425
	;************************Flood Fill*********************
480
	;************************Flood Fill*********************
426
	cmp eax,14
481
	cmp eax,14
427
	jne no_FloodFill
482
	jne no_FloodFill
428
 
483
 
429
	mov eax,[PointerToPicture]
484
	mov eax,[PointerToPicture]
430
	mov ebx,[PointerToEditBufer]
485
	mov ebx,[PointerToEditBufer]
431
 
486
 
432
	mov ecx,[Picture_SizeX]
487
	mov ecx,[Picture_SizeX]
433
	imul ecx,[Picture_SizeY]
488
	imul ecx,[Picture_SizeY]
434
	lea ecx,[ecx+ecx*2]
489
	lea ecx,[ecx+ecx*2]
435
	shl ecx,1
490
	shl ecx,1
436
 
491
 
437
	cmp ecx,mem_flood_f
492
	cmp ecx,mem_flood_f
438
	ja normal_size_of_bufer
493
	ja normal_size_of_bufer
439
 
494
 
440
	mov ebx,[ReserveArray]
495
	mov ebx,[ReserveArray]
441
 
496
 
442
	normal_size_of_bufer:
497
	normal_size_of_bufer:
443
 
498
 
444
	add ebx,4
499
	add ebx,4
445
	mov ecx,[Picture_SizeX]
500
	mov ecx,[Picture_SizeX]
446
	mov edx,[ScreenX]
501
	mov edx,[ScreenX]
447
	add edx,[PosX]
502
	add edx,[PosX]
448
	shl edx,16
503
	shl edx,16
449
	add edx,[ScreenY]
504
	add edx,[ScreenY]
450
	add edx,[PosY]
505
	add edx,[PosY]
451
	mov esi,[Picture_SizeX]
506
	mov esi,[Picture_SizeX]
452
	dec esi
507
	dec esi
453
	shl esi,16
508
	shl esi,16
454
	add esi,[Picture_SizeY]
509
	add esi,[Picture_SizeY]
455
	dec esi
510
	dec esi
456
	mov edi,[Color]
511
	mov edi,[Color]
457
 
512
 
458
	call flood_fill
513
	call flood_fill
459
	call MovePictureToWorkScreen
514
	call MovePictureToWorkScreen
460
 
515
 
461
	jmp still
516
	jmp still
462
	no_FloodFill:
517
	no_FloodFill:
463
 
518
 
464
	;************************lastik*************************
519
	;************************lastik*************************
465
	cmp eax,13
520
	cmp eax,13
466
	jne no_lastik
521
	jne no_lastik
467
 
522
 
468
	 mov [Last_instrument],eax
523
	 mov [Last_instrument],eax
469
	 mov [lastik_is_active],1
524
	 mov [lastik_is_active],1
470
	jmp lastik_in
525
	jmp lastik_in
471
 
526
 
472
	no_lastik:
527
	no_lastik:
473
 
528
 
474
	;*******************************************************
529
	;*******************************************************
475
	cmp eax,12
530
	cmp eax,12
476
	jne  no_spray
531
	jne  no_spray
477
 
532
 
478
	cmp [Activate_instrument],0
533
	cmp [Activate_instrument],0
479
	jne no_null_spray
534
	jne no_null_spray
480
	mov [Activate_instrument],1
535
	mov [Activate_instrument],1
481
	jmp still
536
	jmp still
482
	no_null_spray:
537
	no_null_spray:
483
 
538
 
484
	mov eax,[ScreenX]
539
	mov eax,[ScreenX]
485
	mov ebx,[ScreenY]
540
	mov ebx,[ScreenY]
486
	mov ecx,[Brush_SizeX]
541
	mov ecx,[Brush_SizeX]
487
	mov edx,[Brush_SizeY]
542
	mov edx,[Brush_SizeY]
488
	add eax,[PosX]
543
	add eax,[PosX]
489
	add ebx,[PosY]
544
	add ebx,[PosY]
490
	add eax,ecx
545
	add eax,ecx
491
	add ebx,edx
546
	add ebx,edx
492
 
547
 
493
	cmp eax,[Picture_SizeX]
548
	cmp eax,[Picture_SizeX]
494
	jl no_max_pos_x_spray
549
	jl no_max_pos_x_spray
495
	mov eax,[Picture_SizeX]
550
	mov eax,[Picture_SizeX]
496
	no_max_pos_x_spray:
551
	no_max_pos_x_spray:
497
 
552
 
498
	cmp ebx,[Picture_SizeY]
553
	cmp ebx,[Picture_SizeY]
499
	jl no_max_pos_y_spray
554
	jl no_max_pos_y_spray
500
	mov ebx,[Picture_SizeY]
555
	mov ebx,[Picture_SizeY]
501
	no_max_pos_y_spray:
556
	no_max_pos_y_spray:
502
 
557
 
503
	cmp eax,ecx
558
	cmp eax,ecx
504
	ja no_min_pos_x_spray
559
	ja no_min_pos_x_spray
505
	mov eax,[Brush_SizeX]
560
	mov eax,[Brush_SizeX]
506
	no_min_pos_x_spray:
561
	no_min_pos_x_spray:
507
 
562
 
508
	cmp ebx,edx
563
	cmp ebx,edx
509
	ja no_min_pos_y_spray
564
	ja no_min_pos_y_spray
510
	mov ebx,[Brush_SizeY]
565
	mov ebx,[Brush_SizeY]
511
	no_min_pos_y_spray:
566
	no_min_pos_y_spray:
512
 
567
 
513
	sub eax,[Brush_SizeX]
568
	sub eax,[Brush_SizeX]
514
	sub ebx,[Brush_SizeY]
569
	sub ebx,[Brush_SizeY]
515
	mov edi,0;[Number_Brush]
570
	mov edi,0;[Number_Brush]
516
	imul edi,20*20
571
	imul edi,20*20
517
 
572
 
518
	mov [x],eax
573
	mov [x],eax
519
	mov [y],ebx
574
	mov [y],ebx
520
	mov ebp,[Picture_SizeX]
575
	mov ebp,[Picture_SizeX]
521
	xor edx,edx
576
	xor edx,edx
522
	brush_y_spray:
577
	brush_y_spray:
523
	  xor ecx,ecx
578
	  xor ecx,ecx
524
	  brush_x_spray:
579
	  brush_x_spray:
525
	   ;calculate position in array of spray
580
	   ;calculate position in array of spray
526
	   mov esi,edx
581
	   mov esi,edx
527
	   lea esi,[esi+esi*4] ;esi=esi*5
582
	   lea esi,[esi+esi*4] ;esi=esi*5
528
	   shl esi,2	       ;esi=(esi*3)*4
583
	   shl esi,2	       ;esi=(esi*3)*4
529
	   add esi,ecx
584
	   add esi,ecx
530
	   add esi,edi
585
	   add esi,edi
531
	   ;read byte from array
586
	   ;read byte from array
532
	   xor eax,eax
587
	   xor eax,eax
533
	   mov al,[Spray_color+esi]
588
	   mov al,[Spray_color+esi]
534
	   test eax,eax
589
	   test eax,eax
535
	   jz no_color_spray
590
	   jz no_color_spray
536
	   mov eax,[x]
591
	   mov eax,[x]
537
	   mov ebx,[y]
592
	   mov ebx,[y]
538
	   add eax,ecx
593
	   add eax,ecx
539
	   add ebx,edx
594
	   add ebx,edx
540
	   imul ebx,ebp; ebp=[Picture_SizeX]
595
	   imul ebx,ebp; ebp=[Picture_SizeX]
541
	   add eax,ebx
596
	   add eax,ebx
542
	   lea eax,[eax+eax*2]
597
	   lea eax,[eax+eax*2]
543
	   add eax,[PointerToPicture]
598
	   add eax,[PointerToPicture]
544
	   mov ebx,[Color]
599
	   mov ebx,[Color]
545
	   mov [eax],bx
600
	   mov [eax],bx
546
	   shr ebx,16
601
	   shr ebx,16
547
	   mov [eax+2],bl
602
	   mov [eax+2],bl
548
	   no_color_spray:
603
	   no_color_spray:
549
	   inc ecx
604
	   inc ecx
550
	   cmp ecx,20
605
	   cmp ecx,20
551
	  jl brush_x_spray
606
	  jl brush_x_spray
552
	inc edx
607
	inc edx
553
	cmp edx,20
608
	cmp edx,20
554
	jl brush_y_spray
609
	jl brush_y_spray
555
 
610
 
556
	call MovePictureToWorkScreen
611
	call MovePictureToWorkScreen
557
	jmp still
612
	jmp still
558
 
613
 
559
	no_spray:
614
	no_spray:
560
 
615
 
561
	;************************palette************************
616
	;************************palette************************
562
	cmp eax,51
617
	cmp eax,51
563
	jne no_palette
618
	jne no_palette
564
 
619
 
565
	mov eax,20
620
	mov eax,20
566
	mov ebx,100
621
	mov ebx,100
567
	mov ecx,32*10+32*5+7
622
	mov ecx,32*10+32*5+7
568
	mov edx,8*10+7*10
623
	mov edx,8*10+7*10
569
	mov  esi,1
624
	mov  esi,1
570
	call draw_volume_rectangle
625
	call draw_volume_rectangle
571
	mov [x],20+5
626
	mov [x],20+5
572
	mov [y],100+10
627
	mov [y],100+10
573
	mov edi,256
628
	mov edi,256
574
	xor esi,esi
629
	xor esi,esi
575
	next_rectangle:
630
	next_rectangle:
576
	mov ebx,[x]
631
	mov ebx,[x]
577
	mov ecx,[y]
632
	mov ecx,[y]
578
	mov edx,[palitra+esi]
633
	mov edx,[palitra+esi]
579
	and edx,0xffffff
634
	and edx,0xffffff
580
	shl ebx,16
635
	shl ebx,16
581
	shl ecx,16
636
	shl ecx,16
582
	add ebx,13
637
	add ebx,13
583
	add ecx,13
638
	add ecx,13
584
	mcall SF_DRAW_RECT
639
	mcall SF_DRAW_RECT
585
	add [x],15
640
	add [x],15
586
	cmp [x],20+15*32
641
	cmp [x],20+15*32
587
	jl no_new_line
642
	jl no_new_line
588
	mov [x],20+5
643
	mov [x],20+5
589
	add [y],15
644
	add [y],15
590
	no_new_line:
645
	no_new_line:
591
	add esi,4
646
	add esi,4
592
	dec edi
647
	dec edi
593
	jnz next_rectangle
648
	jnz next_rectangle
594
 
649
 
595
	wait_events:
650
	wait_events:
596
	call event
651
	call event
597
 
652
 
598
	cmp eax,1
653
	cmp eax,1
599
	je still
654
	je still
600
 
655
 
601
	cmp eax,2
656
	cmp eax,2
602
	jne no_keys
657
	jne no_keys
603
 
658
 
604
	mcall SF_GET_KEY
659
	mcall SF_GET_KEY
605
 
660
 
606
	no_keys:
661
	no_keys:
607
 
662
 
608
	cmp eax,3
663
	cmp eax,3
609
	jne no_buttons
664
	jne no_buttons
610
	mcall SF_GET_BUTTON
665
	mcall SF_GET_BUTTON
611
 
666
 
612
	no_buttons:
667
	no_buttons:
613
 
668
 
614
	cmp eax,6
669
	cmp eax,6
615
	jne wait_events
670
	jne wait_events
616
 
671
 
617
	call GetMouseClick
672
	call GetMouseClick
618
 
673
 
619
	test eax,eax
674
	test eax,eax
620
	jz wait_events
675
	jz wait_events
621
	call GetMouseCoordinats
676
	call GetMouseCoordinats
622
	mov [x],20+5
677
	mov [x],20+5
623
	mov [y],100+10
678
	mov [y],100+10
624
	mov [counter],0
679
	mov [counter],0
625
	next_rectangle_column:
680
	next_rectangle_column:
626
	mov eax,[x]
681
	mov eax,[x]
627
	mov ebx,[y]
682
	mov ebx,[y]
628
	mov ecx,[MouseX]
683
	mov ecx,[MouseX]
629
	mov edx,[MouseY]
684
	mov edx,[MouseY]
630
	mov esi,13
685
	mov esi,13
631
	mov edi,13
686
	mov edi,13
632
	call columnus
687
	call columnus
633
	test eax,eax
688
	test eax,eax
634
	jz no_columnus_color
689
	jz no_columnus_color
635
 
690
 
636
	mov eax,[counter]
691
	mov eax,[counter]
637
	shl eax,2
692
	shl eax,2
638
	mov ebx,[palitra+eax]
693
	mov ebx,[palitra+eax]
639
	and ebx,0xffffff
694
	and ebx,0xffffff
640
	mov [Color],ebx
695
	mov [Color],ebx
641
	no_columnus_color:
696
	no_columnus_color:
642
 
697
 
643
	add [x],15
698
	add [x],15
644
 
699
 
645
	cmp [x],20+15*32
700
	cmp [x],20+15*32
646
	jl no_new_line_column
701
	jl no_new_line_column
647
 
702
 
648
	mov [x],20+5
703
	mov [x],20+5
649
	add [y],15
704
	add [y],15
650
	no_new_line_column:
705
	no_new_line_column:
651
 
706
 
652
	inc [counter]
707
	inc [counter]
653
 
708
 
654
	cmp [counter],257
709
	cmp [counter],257
655
	jne next_rectangle_column
710
	jne next_rectangle_column
656
 
711
 
657
	mcall SF_SLEEP,10
712
	mcall SF_SLEEP,10
658
 
713
 
659
	call drawwin
714
	call drawwin
660
 
715
 
661
	mov eax,[Last_instrument]
716
	mov eax,[Last_instrument]
662
	mov [Current_instrument],eax
717
	mov [Current_instrument],eax
663
 
718
 
664
	jmp still
719
	jmp still
665
	no_palette:
720
	no_palette:
666
 
721
 
667
	;************************draw line**********************
722
	;************************draw line**********************
668
	cmp eax,16
723
	cmp eax,16
669
	jne no_line
724
	jne no_line
670
 
725
 
671
	mov [Last_instrument],eax
726
	mov [Last_instrument],eax
672
 
727
 
673
	mov al,[Activate_instrument]
728
	mov al,[Activate_instrument]
674
	test al,al
729
	test al,al
675
	jnz no_new_line_xy
730
	jnz no_new_line_xy
676
	mov eax,[ScreenX]
731
	mov eax,[ScreenX]
677
	mov ebx,[ScreenY]
732
	mov ebx,[ScreenY]
678
	add eax,[PosX]
733
	add eax,[PosX]
679
	add ebx,[PosY]
734
	add ebx,[PosY]
680
	mov [OldX],eax
735
	mov [OldX],eax
681
	mov [OldY],ebx
736
	mov [OldY],ebx
682
	mov [Activate_instrument],1
737
	mov [Activate_instrument],1
683
	xor eax,eax
738
	xor eax,eax
684
	mov ecx,mem_flood_f/4
739
	mov ecx,mem_flood_f/4
685
	mov edi,[ReserveArray]
740
	mov edi,[ReserveArray]
686
	rep stosd
741
	rep stosd
687
	jmp still
742
	jmp still
688
	no_new_line_xy:
743
	no_new_line_xy:
689
 
744
 
690
	;put saved pixels
745
	;put saved pixels
691
	square_width_put
746
	square_width_put
692
 
747
 
693
	;calculate line
748
	;calculate line
694
	mov ebx,[ReserveArray]
749
	mov ebx,[ReserveArray]
695
	add ebx,4
750
	add ebx,4
696
	mov eax,[PointerToPicture]
751
	mov eax,[PointerToPicture]
697
	mov ecx,[Picture_SizeX]
752
	mov ecx,[Picture_SizeX]
698
	mov edx,[OldX]
753
	mov edx,[OldX]
699
	shl edx,16
754
	shl edx,16
700
	add edx,[OldY]
755
	add edx,[OldY]
701
	mov esi,[ScreenX]
756
	mov esi,[ScreenX]
702
	mov edi,[ScreenY]
757
	mov edi,[ScreenY]
703
	add esi,[PosX]
758
	add esi,[PosX]
704
	add edi,[PosY]
759
	add edi,[PosY]
705
 
760
 
706
	mov ebp,[Picture_SizeX]
761
	mov ebp,[Picture_SizeX]
707
	sub ebp,[line_width]
762
	sub ebp,[line_width]
708
	cmp esi,ebp
763
	cmp esi,ebp
709
	jl no_minimum_x_line
764
	jl no_minimum_x_line
710
	mov esi,ebp
765
	mov esi,ebp
711
	no_minimum_x_line:
766
	no_minimum_x_line:
712
 
767
 
713
	mov ebp,[Picture_SizeY]
768
	mov ebp,[Picture_SizeY]
714
	sub ebp,[line_width]
769
	sub ebp,[line_width]
715
	cmp edi,ebp
770
	cmp edi,ebp
716
	jl no_minimum_y_line
771
	jl no_minimum_y_line
717
	mov edi,ebp
772
	mov edi,ebp
718
	no_minimum_y_line:
773
	no_minimum_y_line:
719
 
774
 
720
	call calculate_line
775
	call calculate_line
721
 
776
 
722
	;save color pixels in ReserveArray
777
	;save color pixels in ReserveArray
723
	square_width_save
778
	square_width_save
724
 
779
 
725
	;draw calculated pixels on work arrea
780
	;draw calculated pixels on work arrea
726
	mov ebx,[ReserveArray]
-
 
727
	mov ecx,[ebx]
-
 
728
	mov edx,[Color]
-
 
729
	mov esi,[Color]
-
 
730
	shr edx,16
-
 
731
	add ebx,4
-
 
732
	mov edi,[line_width]
-
 
733
	dec edi
-
 
734
	imul edi,25
-
 
735
	next_pixel_put_line:
-
 
736
 
-
 
737
	mov eax,[ebx]
-
 
738
	push eax
-
 
739
	push ecx
-
 
740
	xor ebp,ebp
-
 
741
	and [counter2],0
-
 
742
 
-
 
743
	vertical_width:
-
 
744
	   and [counter],0
-
 
745
 
-
 
746
	   horizontal_width:
-
 
747
	   xor ecx,ecx
-
 
748
	   mov cl,byte[width_pixels+edi+ebp]
-
 
749
	   test cl,cl
-
 
750
	     jz no_draw_pixel_line
-
 
751
	      mov [eax],si
-
 
752
	      mov [eax+2],dl
-
 
753
	     no_draw_pixel_line:
-
 
754
	   add eax,3
-
 
755
	   inc ebp
-
 
756
	   inc [counter]
-
 
757
	   cmp [counter],5
-
 
758
	   jne horizontal_width
-
 
759
 
-
 
760
	   mov ecx,[Picture_SizeX]
-
 
761
	   sub ecx,5
-
 
762
	   lea ecx,[ecx+ecx*2]
-
 
763
	   add eax,ecx
-
 
764
	inc [counter2]
-
 
765
	cmp [counter2],5
-
 
766
	jne vertical_width
-
 
767
 
-
 
768
	pop ecx
-
 
769
	pop eax
-
 
770
	add ebx,4
-
 
771
	dec ecx
-
 
772
	jnz next_pixel_put_line
781
	draw_calc_pixels width_pixels
773
 
782
 
774
	call MovePictureToWorkScreen
-
 
775
 
783
	call MovePictureToWorkScreen
776
	jmp still
784
	jmp still
777
	no_line:
785
	no_line:
778
 
786
 
779
	;************************draw rectangle*****************
787
	;************************draw rectangle*****************
780
	cmp eax,17
788
	cmp eax,17
781
	jne no_rectangle
789
	jne no_rectangle
782
 
790
 
783
	mov [Last_instrument],eax
791
	mov [Last_instrument],eax
784
 
792
 
785
	mov al,[Activate_instrument]
793
	mov al,[Activate_instrument]
786
	test al,al
794
	test al,al
787
	jnz no_new_rectangle_xy
795
	jnz no_new_rectangle_xy
788
	mov eax,[ScreenX]
796
	mov eax,[ScreenX]
789
	mov ebx,[ScreenY]
797
	mov ebx,[ScreenY]
790
	add eax,[PosX]
798
	add eax,[PosX]
791
	add ebx,[PosY]
799
	add ebx,[PosY]
792
	mov [OldX],eax
800
	mov [OldX],eax
793
	mov [OldY],ebx
801
	mov [OldY],ebx
794
	mov [Activate_instrument],1
802
	mov [Activate_instrument],1
795
	xor eax,eax
803
	xor eax,eax
796
	mov ecx,mem_flood_f/4
804
	mov ecx,mem_flood_f/4
797
	mov edi,[ReserveArray]
805
	mov edi,[ReserveArray]
798
	rep stosd
806
	rep stosd
799
	jmp still
807
	jmp still
800
	no_new_rectangle_xy:
808
	no_new_rectangle_xy:
801
 
809
 
802
	;put saved pixels
810
	;put saved pixels
803
	square_width_put
811
	square_width_put
804
 
812
 
805
	;calculate line
813
	;calculate line
806
	mov ebx,[ReserveArray]
814
	mov ebx,[ReserveArray]
807
	add ebx,4
815
	add ebx,4
808
	mov eax,[PointerToPicture]
816
	mov eax,[PointerToPicture]
809
	mov ecx,[Picture_SizeX]
817
	mov ecx,[Picture_SizeX]
810
	mov edx,[OldX]
818
	mov edx,[OldX]
811
	shl edx,16
819
	shl edx,16
812
	add edx,[OldY]
820
	add edx,[OldY]
813
	mov esi,[ScreenX]
821
	mov esi,[ScreenX]
814
	mov edi,[ScreenY]
822
	mov edi,[ScreenY]
815
	add esi,[PosX]
823
	add esi,[PosX]
816
	add edi,[PosY]
824
	add edi,[PosY]
817
 
825
 
818
	mov ebp,[Picture_SizeX]
826
	mov ebp,[Picture_SizeX]
819
	sub ebp,[line_width]
827
	sub ebp,[line_width]
820
	cmp esi,ebp
828
	cmp esi,ebp
821
	jl no_minimum_x_rectangle
829
	jl no_minimum_x_rectangle
822
	mov esi,ebp
830
	mov esi,ebp
823
	no_minimum_x_rectangle:
831
	no_minimum_x_rectangle:
824
 
832
 
825
	mov ebp,[Picture_SizeY]
833
	mov ebp,[Picture_SizeY]
826
	sub ebp,[line_width]
834
	sub ebp,[line_width]
827
	cmp edi,ebp
835
	cmp edi,ebp
828
	jl no_minimum_y_rectangle
836
	jl no_minimum_y_rectangle
829
	mov edi,ebp
837
	mov edi,ebp
830
	no_minimum_y_rectangle:
838
	no_minimum_y_rectangle:
831
 
839
 
832
	call calculate_rectangle
840
	call calculate_rectangle
833
 
841
 
834
	;save color pixels in ReserveArray
842
	;save color pixels in ReserveArray
835
	square_width_save
843
	square_width_save
836
 
844
 
837
	;draw calculated pixels on work arrea
845
	;draw calculated pixels on work arrea
838
	mov ebx,[ReserveArray]
-
 
839
	mov ecx,[ebx]
-
 
840
	mov edx,[Color]
-
 
841
	mov esi,[Color]
-
 
842
	shr edx,16
-
 
843
	add ebx,4
-
 
844
	mov edi,[line_width]
-
 
845
	dec edi
-
 
846
	imul edi,25
-
 
847
	next_pixel_put_rectangle:
-
 
848
 
-
 
849
	mov eax,[ebx]
-
 
850
	push eax
-
 
851
	push ecx
-
 
852
	xor ebp,ebp
-
 
853
	and [counter2],0
-
 
854
 
-
 
855
	vertical_width_rectangle:
-
 
856
	   and [counter],0
-
 
857
 
-
 
858
	   horizontal_width_rectangle:
-
 
859
	   xor ecx,ecx
-
 
860
	   mov cl,byte[width_pixels_rectangle+edi+ebp]
846
	draw_calc_pixels width_pixels_rectangle
861
	   test cl,cl
-
 
862
	     jz no_draw_pixel_rectangle
-
 
863
	      mov [eax],si
-
 
864
	      mov [eax+2],dl
-
 
865
	     no_draw_pixel_rectangle:
-
 
866
	   add eax,3
-
 
867
	   inc ebp
-
 
868
	   inc [counter]
-
 
869
	   cmp [counter],5
-
 
870
	   jne horizontal_width_rectangle
-
 
871
 
-
 
872
	   mov ecx,[Picture_SizeX]
-
 
873
	   sub ecx,5
-
 
874
	   lea ecx,[ecx+ecx*2]
-
 
875
	   add eax,ecx
-
 
876
	inc [counter2]
-
 
877
	cmp [counter2],5
-
 
878
	jne vertical_width_rectangle
-
 
879
 
-
 
880
	pop ecx
-
 
881
	pop eax
-
 
882
	add ebx,4
-
 
883
	dec ecx
-
 
884
	jnz next_pixel_put_rectangle
-
 
885
 
847
 
886
	call MovePictureToWorkScreen
848
	call MovePictureToWorkScreen
887
	jmp still
849
	jmp still
888
	no_rectangle:
850
	no_rectangle:
889
 
851
 
890
	;************************draw circle********************
852
	;************************draw circle********************
891
	cmp eax,18
853
	cmp eax,18
892
	jne no_circle
854
	jne no_circle
893
 
855
 
894
	mov [Last_instrument],eax
856
	mov [Last_instrument],eax
895
 
857
 
896
	mov al,[Activate_instrument]
858
	mov al,[Activate_instrument]
897
	test al,al
859
	test al,al
898
	jnz no_new_circle_xy
860
	jnz no_new_circle_xy
899
	mov eax,[ScreenX]
861
	mov eax,[ScreenX]
900
	mov ebx,[ScreenY]
862
	mov ebx,[ScreenY]
901
	add eax,[PosX]
863
	add eax,[PosX]
902
	add ebx,[PosY]
864
	add ebx,[PosY]
903
	mov [OldX],eax
865
	mov [OldX],eax
904
	mov [OldY],ebx
866
	mov [OldY],ebx
905
	mov [Activate_instrument],1
867
	mov [Activate_instrument],1
906
	xor eax,eax
868
	xor eax,eax
907
	mov ecx,mem_flood_f/4
869
	mov ecx,mem_flood_f/4
908
	mov edi,[ReserveArray]
870
	mov edi,[ReserveArray]
909
	rep stosd
871
	rep stosd
910
	jmp still
872
	jmp still
911
	no_new_circle_xy:
873
	no_new_circle_xy:
912
 
874
 
913
	;put saved pixels
875
	;put saved pixels
914
	square_width_put
876
	square_width_put
915
 
877
 
916
	mov esi,[ScreenX]
878
	mov esi,[ScreenX]
917
	mov edi,[ScreenY]
879
	mov edi,[ScreenY]
918
	add esi,[PosX]
880
	add esi,[PosX]
919
	add edi,[PosY]
881
	add edi,[PosY]
920
 
882
 
921
	sub esi,[OldX]
883
	sub esi,[OldX]
922
	jns no_sign_x_circle
884
	jns no_sign_x_circle
923
	neg esi
885
	neg esi
924
	shr esi,1
886
	shr esi,1
925
	neg esi
887
	neg esi
926
	add esi,[OldX]
888
	add esi,[OldX]
927
	jmp no_plus_sign_x_circle
889
	jmp no_plus_sign_x_circle
928
	no_sign_x_circle:
890
	no_sign_x_circle:
929
 
891
 
930
	shr esi,1
892
	shr esi,1
931
	add esi,[OldX]
893
	add esi,[OldX]
932
	no_plus_sign_x_circle:
894
	no_plus_sign_x_circle:
933
 
895
 
934
	sub edi,[OldY]
896
	sub edi,[OldY]
935
	jns no_sign_y_circle
897
	jns no_sign_y_circle
936
	neg edi
898
	neg edi
937
	shr edi,1
899
	shr edi,1
938
	neg edi
900
	neg edi
939
	add edi,[OldY]
901
	add edi,[OldY]
940
	jmp no_plus_sign_y_circle
902
	jmp no_plus_sign_y_circle
941
	no_sign_y_circle:
903
	no_sign_y_circle:
942
 
904
 
943
	shr edi,1
905
	shr edi,1
944
	add edi,[OldY]
906
	add edi,[OldY]
945
	no_plus_sign_y_circle:
907
	no_plus_sign_y_circle:
946
 
908
 
947
	mov [x],esi
909
	mov [x],esi
948
	mov [y],edi
910
	mov [y],edi
949
 
911
 
950
	mov esi,[ScreenX]
912
	mov esi,[ScreenX]
951
	mov edi,[ScreenY]
913
	mov edi,[ScreenY]
952
	add esi,[PosX]
914
	add esi,[PosX]
953
	add edi,[PosY]
915
	add edi,[PosY]
954
 
916
 
955
	sub esi,[OldX]
917
	sub esi,[OldX]
956
	jns no_sign_x_circle_r
918
	jns no_sign_x_circle_r
957
	neg esi
919
	neg esi
958
	no_sign_x_circle_r:
920
	no_sign_x_circle_r:
959
 
921
 
960
	sub edi,[OldY]
922
	sub edi,[OldY]
961
	jns no_sign_y_circle_r
923
	jns no_sign_y_circle_r
962
	neg edi
924
	neg edi
963
	no_sign_y_circle_r:
925
	no_sign_y_circle_r:
964
 
926
 
965
	mov [Dx_],esi
927
	mov [Dx_],esi
966
	mov [Dy_],edi
928
	mov [Dy_],edi
967
 
929
 
968
	;finit
930
	;finit
969
	fild [Dx_]
931
	fild [Dx_]
970
	fmul st0,st0
932
	fmul st0,st0
971
	fild [Dy_]
933
	fild [Dy_]
972
	fmul st0,st0
934
	fmul st0,st0
973
	fadd st0,st1
935
	fadd st0,st1
974
	fsqrt
936
	fsqrt
975
	fistp [Radius]
937
	fistp [Radius]
976
	fistp [Icon_X]
938
	fistp [Icon_X]
977
	mov esi,[Radius]
939
	mov esi,[Radius]
978
	shr esi,1
940
	shr esi,1
979
	cmp esi,0
941
	cmp esi,0
980
	jne no_null_radius
942
	jne no_null_radius
981
	mov [Radius],1
943
	mov [Radius],1
982
	no_null_radius:
944
	no_null_radius:
983
 
945
 
984
	mov [Radius],esi
946
	mov [Radius],esi
985
 
947
 
986
	mov edi,[x]
948
	mov edi,[x]
987
	mov ebp,[y]
949
	mov ebp,[y]
988
	add edi,esi
950
	add edi,esi
989
	add ebp,esi
951
	add ebp,esi
990
 
952
 
991
	mov edx,[Picture_SizeX]
953
	mov edx,[Picture_SizeX]
992
	sub edx,[line_width]
954
	sub edx,[line_width]
993
	cmp edi,edx
955
	cmp edi,edx
994
	jl no_limit_x_circle
956
	jl no_limit_x_circle
995
	sub edi,edx
957
	sub edi,edx
996
	sub [Radius],edi
958
	sub [Radius],edi
997
	no_limit_x_circle:
959
	no_limit_x_circle:
998
 
960
 
999
	mov edx,[Picture_SizeY]
961
	mov edx,[Picture_SizeY]
1000
	sub edx,[line_width]
962
	sub edx,[line_width]
1001
	cmp ebp,edx
963
	cmp ebp,edx
1002
	jl no_limit_y_circle
964
	jl no_limit_y_circle
1003
	sub ebp,edx
965
	sub ebp,edx
1004
	sub [Radius],ebp
966
	sub [Radius],ebp
1005
	no_limit_y_circle:
967
	no_limit_y_circle:
1006
 
968
 
1007
 
969
 
1008
	mov edi,[x]
970
	mov edi,[x]
1009
	mov ebp,[y]
971
	mov ebp,[y]
1010
 
972
 
1011
	sub edi,[Radius]
973
	sub edi,[Radius]
1012
	jns no_minimum_x_circle
974
	jns no_minimum_x_circle
1013
	add [Radius],edi
975
	add [Radius],edi
1014
	no_minimum_x_circle:
976
	no_minimum_x_circle:
1015
 
977
 
1016
	sub ebp,[Radius]
978
	sub ebp,[Radius]
1017
	jns no_minimum_y_circle
979
	jns no_minimum_y_circle
1018
	add [Radius],ebp
980
	add [Radius],ebp
1019
	no_minimum_y_circle:
981
	no_minimum_y_circle:
1020
 
982
 
1021
	;calculate circle
983
	;calculate circle
1022
	mov ebx,[ReserveArray]
984
	mov ebx,[ReserveArray]
1023
	add ebx,4
985
	add ebx,4
1024
	mov eax,[PointerToPicture]
986
	mov eax,[PointerToPicture]
1025
	mov ecx,[Picture_SizeX]
987
	mov ecx,[Picture_SizeX]
1026
	mov edx,[x]
988
	mov edx,[x]
1027
	shl edx,16
989
	shl edx,16
1028
	add edx,[y]
990
	add edx,[y]
1029
	mov esi,[Radius]
991
	mov esi,[Radius]
1030
	call calculate_circle
992
	call calculate_circle
1031
 
993
 
1032
	;save color pixels in ReserveArray
994
	;save color pixels in ReserveArray
1033
	square_width_save
995
	square_width_save
1034
 
996
 
1035
	;draw calculated pixels on work arrea
997
	;draw calculated pixels on work arrea
1036
	mov ebx,[ReserveArray]
-
 
1037
	mov ecx,[ebx]
-
 
1038
	mov edx,[Color]
-
 
1039
	mov esi,[Color]
-
 
1040
	shr edx,16
-
 
1041
	add ebx,4
-
 
1042
	mov edi,[line_width]
-
 
1043
	dec edi
-
 
1044
	imul edi,25
-
 
1045
	next_pixel_put_circle:
-
 
1046
 
-
 
1047
	mov eax,[ebx]
-
 
1048
	push eax
-
 
1049
	push ecx
-
 
1050
	xor ebp,ebp
-
 
1051
	and [counter2],0
-
 
1052
 
-
 
1053
	vertical_width_circle:
998
	draw_calc_pixels width_pixels
1054
	   and [counter],0
-
 
1055
 
-
 
1056
	   horizontal_width_circle:
-
 
1057
	   xor ecx,ecx
-
 
1058
	   mov cl,byte[width_pixels+edi+ebp]
-
 
1059
	   test cl,cl
-
 
1060
	     jz no_draw_pixel_circle
-
 
1061
	      mov [eax],si
-
 
1062
	      mov [eax+2],dl
-
 
1063
	     no_draw_pixel_circle:
-
 
1064
	   add eax,3
-
 
1065
	   inc ebp
-
 
1066
	   inc [counter]
-
 
1067
	   cmp [counter],5
-
 
1068
	   jne horizontal_width_circle
-
 
1069
 
-
 
1070
	   mov ecx,[Picture_SizeX]
-
 
1071
	   sub ecx,5
-
 
1072
	   lea ecx,[ecx+ecx*2]
-
 
1073
	   add eax,ecx
-
 
1074
	inc [counter2]
-
 
1075
	cmp [counter2],5
-
 
1076
	jne vertical_width_circle
-
 
1077
 
-
 
1078
	pop ecx
-
 
1079
	pop eax
-
 
1080
	add ebx,4
-
 
1081
	dec ecx
-
 
1082
	jnz next_pixel_put_circle
-
 
1083
 
999
 
1084
	call MovePictureToWorkScreen
1000
	call MovePictureToWorkScreen
1085
	jmp still
1001
	jmp still
1086
	no_circle:
1002
	no_circle:
1087
 
1003
 
1088
	;************************zoom 1*************************
1004
	;************************zoom 1*************************
1089
	cmp eax,45
1005
	cmp eax,45
1090
	jne no_1_
1006
	jne no_1_
1091
	mov [k],1
1007
	mov [k],1
1092
	mov [Scroll1CoordinatX],9
1008
	mov [Scroll1CoordinatX],9
1093
	mov [Scroll2CoordinatY],89
1009
	mov [Scroll2CoordinatY],89
1094
	and [Current_instrument],0
1010
	and [Current_instrument],0
1095
	call drawwin
1011
	call drawwin
1096
	jmp still
1012
	jmp still
1097
	no_1_:
1013
	no_1_:
1098
 
1014
 
1099
	;************************zoom 2*************************
1015
	;************************zoom 2*************************
1100
	cmp eax,46
1016
	cmp eax,46
1101
	jne no_2_
1017
	jne no_2_
1102
	mov [k],2
1018
	mov [k],2
1103
	call drawwin
1019
	call drawwin
1104
	mov [Scroll1CoordinatX],9
1020
	mov [Scroll1CoordinatX],9
1105
	mov [Scroll2CoordinatY],89
1021
	mov [Scroll2CoordinatY],89
1106
	and [Current_instrument],0
1022
	and [Current_instrument],0
1107
	jmp still
1023
	jmp still
1108
	no_2_:
1024
	no_2_:
1109
 
1025
 
1110
 
1026
 
1111
	;************************zoom 3*************************
1027
	;************************zoom 3*************************
1112
	cmp eax,47
1028
	cmp eax,47
1113
	jne no_3_
1029
	jne no_3_
1114
	mov [k],3
1030
	mov [k],3
1115
	call drawwin
1031
	call drawwin
1116
	mov [Scroll1CoordinatX],9
1032
	mov [Scroll1CoordinatX],9
1117
	mov [Scroll2CoordinatY],89
1033
	mov [Scroll2CoordinatY],89
1118
	and [Current_instrument],0
1034
	and [Current_instrument],0
1119
	jmp still
1035
	jmp still
1120
	no_3_:
1036
	no_3_:
1121
 
1037
 
1122
	;************************zoom 4*************************
1038
	;************************zoom 4*************************
1123
	cmp eax,48
1039
	cmp eax,48
1124
	jne no_4_
1040
	jne no_4_
1125
	mov [k],4
1041
	mov [k],4
1126
	call drawwin
1042
	call drawwin
1127
	mov [Scroll1CoordinatX],9
1043
	mov [Scroll1CoordinatX],9
1128
	mov [Scroll2CoordinatY],89
1044
	mov [Scroll2CoordinatY],89
1129
	and [Current_instrument],0
1045
	and [Current_instrument],0
1130
	jmp still
1046
	jmp still
1131
	no_4_:
1047
	no_4_:
1132
 
1048
 
1133
	;************************zoom 8*************************
1049
	;************************zoom 8*************************
1134
	cmp eax,49
1050
	cmp eax,49
1135
	jne no_8_
1051
	jne no_8_
1136
	mov [k],8
1052
	mov [k],8
1137
	call drawwin
1053
	call drawwin
1138
	mov [Scroll1CoordinatX],9
1054
	mov [Scroll1CoordinatX],9
1139
	mov [Scroll2CoordinatY],89
1055
	mov [Scroll2CoordinatY],89
1140
	and [Current_instrument],0
1056
	and [Current_instrument],0
1141
	jmp still
1057
	jmp still
1142
	no_8_:
1058
	no_8_:
1143
 
1059
 
1144
	;************************zoom 16************************
1060
	;************************zoom 16************************
1145
	cmp eax,50
1061
	cmp eax,50
1146
	jne no_16_
1062
	jne no_16_
1147
	mov [k],16
1063
	mov [k],16
1148
	call drawwin
1064
	call drawwin
1149
	mov [Scroll1CoordinatX],9
1065
	mov [Scroll1CoordinatX],9
1150
	mov [Scroll2CoordinatY],89
1066
	mov [Scroll2CoordinatY],89
1151
	and [Current_instrument],0
1067
	and [Current_instrument],0
1152
	jmp still
1068
	jmp still
1153
	no_16_:
1069
	no_16_:
1154
 
1070
 
1155
	;***************allocation of a countour****************
1071
	;***************allocation of a countour****************
1156
	cmp eax,21
1072
	cmp eax,21
1157
	jne no_allocation
1073
	jne no_allocation
1158
 
1074
 
1159
	cmp [instrument_used],0
1075
	cmp [instrument_used],0
1160
	jnz instrument_not_finished_work
1076
	jnz instrument_not_finished_work
1161
 
1077
 
1162
	mov al,[Activate_instrument]
1078
	mov al,[Activate_instrument]
1163
	test al,al
1079
	test al,al
1164
	jnz no_new_allocation_xy
1080
	jnz no_new_allocation_xy
1165
	mov eax,[ScreenX]
1081
	mov eax,[ScreenX]
1166
	mov ebx,[ScreenY]
1082
	mov ebx,[ScreenY]
1167
	add eax,[PosX]
1083
	add eax,[PosX]
1168
	add ebx,[PosY]
1084
	add ebx,[PosY]
1169
	mov [OldX],eax
1085
	mov [OldX],eax
1170
	mov [OldY],ebx
1086
	mov [OldY],ebx
1171
	inc eax
1087
	inc eax
1172
	inc ebx
1088
	inc ebx
1173
	mov [rectangular_shade_x],eax
1089
	mov [rectangular_shade_x],eax
1174
	mov [rectangular_shade_y],ebx
1090
	mov [rectangular_shade_y],ebx
1175
	mov [Activate_instrument],1
1091
	mov [Activate_instrument],1
1176
	mov [instrument_used],1
1092
	mov [instrument_used],1
1177
	and [crossing],0
1093
	and [crossing],0
1178
	and [finishing_crossing],0
1094
	and [finishing_crossing],0
1179
	xor eax,eax
1095
	xor eax,eax
1180
	mov ecx,mem_flood_f/4
1096
	mov ecx,mem_flood_f/4
1181
	mov edi,[ReserveArray]
1097
	mov edi,[ReserveArray]
1182
	rep stosd
1098
	rep stosd
1183
	jmp still
1099
	jmp still
1184
	no_new_allocation_xy:
1100
	no_new_allocation_xy:
1185
	instrument_not_finished_work:
1101
	instrument_not_finished_work:
1186
 
1102
 
1187
	mov al,[instrument_used]
1103
	mov al,[instrument_used]
1188
	test al,al
1104
	test al,al
1189
	jz no_change_coordinats
1105
	jz no_change_coordinats
1190
 
1106
 
1191
	cmp [Activate_instrument],0
1107
	cmp [Activate_instrument],0
1192
	jnz no_change_coordinats
1108
	jnz no_change_coordinats
1193
 
1109
 
1194
	;save coordinates as old if crossing=0
1110
	;save coordinates as old if crossing=0
1195
	cmp [crossing],0
1111
	cmp [crossing],0
1196
	jnz no_save_coordinate_of_crossing
1112
	jnz no_save_coordinate_of_crossing
1197
 
1113
 
1198
	mov eax,[OldX]
1114
	mov eax,[OldX]
1199
	mov ebx,[OldY]
1115
	mov ebx,[OldY]
1200
 
1116
 
1201
	cmp eax,[rectangular_shade_x]
1117
	cmp eax,[rectangular_shade_x]
1202
	jl no_remove_x
1118
	jl no_remove_x
1203
	mov ecx,[rectangular_shade_x]
1119
	mov ecx,[rectangular_shade_x]
1204
	mov [OldX],ecx			  ; OldX <-----> rectangulare_shade_x
1120
	mov [OldX],ecx			  ; OldX <-----> rectangulare_shade_x
1205
	mov [rectangular_shade_x],eax
1121
	mov [rectangular_shade_x],eax
1206
	no_remove_x:
1122
	no_remove_x:
1207
 
1123
 
1208
	cmp ebx,[rectangular_shade_y]
1124
	cmp ebx,[rectangular_shade_y]
1209
	jl no_remove_y
1125
	jl no_remove_y
1210
	mov ecx,[rectangular_shade_y]
1126
	mov ecx,[rectangular_shade_y]
1211
	mov [OldY],ecx			  ; OldY <-----> rectangulare_shade_y
1127
	mov [OldY],ecx			  ; OldY <-----> rectangulare_shade_y
1212
	mov [rectangular_shade_y],ebx
1128
	mov [rectangular_shade_y],ebx
1213
	no_remove_y:
1129
	no_remove_y:
1214
 
1130
 
1215
	mov eax,[ScreenX]
1131
	mov eax,[ScreenX]
1216
	mov ebx,[ScreenY]
1132
	mov ebx,[ScreenY]
1217
	add eax,[PosX]
1133
	add eax,[PosX]
1218
	add ebx,[PosY]
1134
	add ebx,[PosY]
1219
	mov [crossing_old_x],eax
1135
	mov [crossing_old_x],eax
1220
	mov [crossing_old_y],ebx
1136
	mov [crossing_old_y],ebx
1221
	mov [crossing],1
1137
	mov [crossing],1
1222
 
1138
 
1223
 
1139
 
1224
	mov eax,[OldX]
1140
	mov eax,[OldX]
1225
	mov ebx,[OldY]
1141
	mov ebx,[OldY]
1226
	inc eax
1142
	inc eax
1227
	inc ebx
1143
	inc ebx
1228
	mov [SpriteCoordinatX],eax
1144
	mov [SpriteCoordinatX],eax
1229
	mov [SpriteCoordinatY],ebx
1145
	mov [SpriteCoordinatY],ebx
1230
	mov [SpriteOldCoordinatX],eax
1146
	mov [SpriteOldCoordinatX],eax
1231
	mov [SpriteOldCoordinatY],ebx
1147
	mov [SpriteOldCoordinatY],ebx
1232
	mov esi,[rectangular_shade_x]
1148
	mov esi,[rectangular_shade_x]
1233
	mov edi,[rectangular_shade_y]
1149
	mov edi,[rectangular_shade_y]
1234
 
1150
 
1235
	sub esi,eax
1151
	sub esi,eax
1236
	jns no_sign_sprite_size_x
1152
	jns no_sign_sprite_size_x
1237
	neg esi
1153
	neg esi
1238
	no_sign_sprite_size_x:
1154
	no_sign_sprite_size_x:
1239
 
1155
 
1240
	sub edi,ebx
1156
	sub edi,ebx
1241
	jns no_sign_sprite_size_y
1157
	jns no_sign_sprite_size_y
1242
	neg edi
1158
	neg edi
1243
	no_sign_sprite_size_y:
1159
	no_sign_sprite_size_y:
1244
 
1160
 
1245
	test esi,esi
1161
	test esi,esi
1246
	jnz no_null_sprite_x
1162
	jnz no_null_sprite_x
1247
	mov esi,1
1163
	mov esi,1
1248
	no_null_sprite_x:
1164
	no_null_sprite_x:
1249
 
1165
 
1250
	test edi,edi
1166
	test edi,edi
1251
	jnz no_null_sprite_y
1167
	jnz no_null_sprite_y
1252
	mov edi,1
1168
	mov edi,1
1253
	no_null_sprite_y:
1169
	no_null_sprite_y:
1254
 
1170
 
1255
	mov [SpriteSizeX],esi
1171
	mov [SpriteSizeX],esi
1256
	mov [SpriteSizeY],edi
1172
	mov [SpriteSizeY],edi
1257
 
1173
 
1258
	call SaveFonForSprite
1174
	call SaveFonForSprite
1259
 
1175
 
1260
	no_save_coordinate_of_crossing:
1176
	no_save_coordinate_of_crossing:
1261
 
1177
 
1262
	cmp [crossing],0
1178
	cmp [crossing],0
1263
	je no_test_crossing_with_work_arrea
1179
	je no_test_crossing_with_work_arrea
1264
	;if mouse situatad after allocation than exit
1180
	;if mouse situatad after allocation than exit
1265
	push [ScreenX]
1181
	push [ScreenX]
1266
	push [ScreenY]
1182
	push [ScreenY]
1267
 
1183
 
1268
	call GetScreenCordinats
1184
	call GetScreenCordinats
1269
 
1185
 
1270
	mov eax,[OldX]
1186
	mov eax,[OldX]
1271
	mov ebx,[OldY]
1187
	mov ebx,[OldY]
1272
	mov ecx,[ScreenX]
1188
	mov ecx,[ScreenX]
1273
	mov edx,[ScreenY]
1189
	mov edx,[ScreenY]
1274
	mov esi,[SpriteSizeX]
1190
	mov esi,[SpriteSizeX]
1275
	mov edi,[SpriteSizeY]
1191
	mov edi,[SpriteSizeY]
1276
	add ecx,[PosX]
1192
	add ecx,[PosX]
1277
	add edx,[PosY]
1193
	add edx,[PosY]
1278
	inc esi;eax
1194
	inc esi;eax
1279
	inc edi;ebx
1195
	inc edi;ebx
1280
	call columnus
1196
	call columnus
1281
 
1197
 
1282
	test eax,eax
1198
	test eax,eax
1283
	jnz crossing_with_work_area
1199
	jnz crossing_with_work_area
1284
	mov [finishing_crossing],1
1200
	mov [finishing_crossing],1
1285
	mov [register],1
1201
	mov [register],1
1286
	crossing_with_work_area:
1202
	crossing_with_work_area:
1287
 
1203
 
1288
	pop [ScreenY]
1204
	pop [ScreenY]
1289
	pop [ScreenX]
1205
	pop [ScreenX]
1290
 
1206
 
1291
	no_test_crossing_with_work_arrea:
1207
	no_test_crossing_with_work_arrea:
1292
 
1208
 
1293
	mov eax,[ScreenX]
1209
	mov eax,[ScreenX]
1294
	mov ebx,[ScreenY]
1210
	mov ebx,[ScreenY]
1295
	add eax,[PosX]
1211
	add eax,[PosX]
1296
	add ebx,[PosY]
1212
	add ebx,[PosY]
1297
	mov ecx,eax
1213
	mov ecx,eax
1298
	mov edx,ebx
1214
	mov edx,ebx
1299
	sub eax,[crossing_old_x]  ;dx=(x-oldx)
1215
	sub eax,[crossing_old_x]  ;dx=(x-oldx)
1300
	sub ebx,[crossing_old_y]  ;dy=(y-oldy)
1216
	sub ebx,[crossing_old_y]  ;dy=(y-oldy)
1301
	mov [crossing_old_x],ecx
1217
	mov [crossing_old_x],ecx
1302
	mov [crossing_old_y],edx
1218
	mov [crossing_old_y],edx
1303
 
1219
 
1304
	add [OldX],eax		       ;x1=x1+dx
1220
	add [OldX],eax		       ;x1=x1+dx
1305
	add [OldY],ebx		       ;y1=y1+dy
1221
	add [OldY],ebx		       ;y1=y1+dy
1306
	add [rectangular_shade_x],eax  ;x2=x2+dx
1222
	add [rectangular_shade_x],eax  ;x2=x2+dx
1307
	add [rectangular_shade_y],ebx  ;y2+y2+dy
1223
	add [rectangular_shade_y],ebx  ;y2+y2+dy
1308
 
1224
 
1309
	mov eax,[OldX]
1225
	mov eax,[OldX]
1310
	mov ebx,[OldY]
1226
	mov ebx,[OldY]
1311
	inc eax
1227
	inc eax
1312
	inc ebx
1228
	inc ebx
1313
	mov [SpriteCoordinatX],eax
1229
	mov [SpriteCoordinatX],eax
1314
	mov [SpriteCoordinatY],ebx
1230
	mov [SpriteCoordinatY],ebx
1315
 
1231
 
1316
	cmp [SpriteCoordinatX],0
1232
	cmp [SpriteCoordinatX],0
1317
	jns no_null_sprite_coordinat_x
1233
	jns no_null_sprite_coordinat_x
1318
	mov [SpriteCoordinatX],1
1234
	mov [SpriteCoordinatX],1
1319
	no_null_sprite_coordinat_x:
1235
	no_null_sprite_coordinat_x:
1320
 
1236
 
1321
	cmp [SpriteCoordinatY],0
1237
	cmp [SpriteCoordinatY],0
1322
	jns no_null_sprite_coordinat_y
1238
	jns no_null_sprite_coordinat_y
1323
	mov [SpriteCoordinatY],1
1239
	mov [SpriteCoordinatY],1
1324
	no_null_sprite_coordinat_y:
1240
	no_null_sprite_coordinat_y:
1325
 
1241
 
1326
	mov esi,[rectangular_shade_x]
1242
	mov esi,[rectangular_shade_x]
1327
	mov edi,[rectangular_shade_y]
1243
	mov edi,[rectangular_shade_y]
1328
 
1244
 
1329
	sub esi,[OldX]
1245
	sub esi,[OldX]
1330
	jns no_znak_size_of_rectangulare_crossing_x
1246
	jns no_znak_size_of_rectangulare_crossing_x
1331
	neg esi
1247
	neg esi
1332
	no_znak_size_of_rectangulare_crossing_x:
1248
	no_znak_size_of_rectangulare_crossing_x:
1333
 
1249
 
1334
	sub edi,[OldY]
1250
	sub edi,[OldY]
1335
	jns no_znak_size_of_rectangulare_crossing_y
1251
	jns no_znak_size_of_rectangulare_crossing_y
1336
	neg edi
1252
	neg edi
1337
	no_znak_size_of_rectangulare_crossing_y:
1253
	no_znak_size_of_rectangulare_crossing_y:
1338
 
1254
 
1339
	mov ecx,[OldX]
1255
	mov ecx,[OldX]
1340
	mov edx,[OldY]
1256
	mov edx,[OldY]
1341
 
1257
 
1342
	sub ecx,[PosX]
1258
	sub ecx,[PosX]
1343
	jns no_minimum_x_crossing
1259
	jns no_minimum_x_crossing
1344
	mov ecx,0
1260
	mov ecx,0
1345
	add ecx,[PosX]
1261
	add ecx,[PosX]
1346
	mov [OldX],ecx
1262
	mov [OldX],ecx
1347
	add ecx,esi
1263
	add ecx,esi
1348
	mov [rectangular_shade_x],ecx
1264
	mov [rectangular_shade_x],ecx
1349
	no_minimum_x_crossing:
1265
	no_minimum_x_crossing:
1350
 
1266
 
1351
	sub edx,[PosY]
1267
	sub edx,[PosY]
1352
	jns no_minimum_y_crossing
1268
	jns no_minimum_y_crossing
1353
	mov edx,0
1269
	mov edx,0
1354
	add edx,[PosY]
1270
	add edx,[PosY]
1355
	mov [OldY],edx
1271
	mov [OldY],edx
1356
	add edx,edi
1272
	add edx,edi
1357
	mov [rectangular_shade_y],edx
1273
	mov [rectangular_shade_y],edx
1358
	no_minimum_y_crossing:
1274
	no_minimum_y_crossing:
1359
 
1275
 
1360
	mov ecx,[Picture_SizeX]
1276
	mov ecx,[Picture_SizeX]
1361
	sub ecx,esi
1277
	sub ecx,esi
1362
	cmp [OldX],ecx
1278
	cmp [OldX],ecx
1363
	jl no_maximum_x_crossing
1279
	jl no_maximum_x_crossing
1364
	dec ecx
1280
	dec ecx
1365
	mov [OldX],ecx
1281
	mov [OldX],ecx
1366
	add ecx,esi
1282
	add ecx,esi
1367
	mov [rectangular_shade_x],ecx
1283
	mov [rectangular_shade_x],ecx
1368
	no_maximum_x_crossing:
1284
	no_maximum_x_crossing:
1369
 
1285
 
1370
	mov edx,[Picture_SizeY]
1286
	mov edx,[Picture_SizeY]
1371
	sub edx,edi
1287
	sub edx,edi
1372
	cmp [OldY],edx
1288
	cmp [OldY],edx
1373
	jl no_maximum_y_crossing
1289
	jl no_maximum_y_crossing
1374
	dec edx
1290
	dec edx
1375
	mov [OldY],edx
1291
	mov [OldY],edx
1376
	add edx,edi
1292
	add edx,edi
1377
	mov [rectangular_shade_y],edx
1293
	mov [rectangular_shade_y],edx
1378
	no_maximum_y_crossing:
1294
	no_maximum_y_crossing:
1379
 
1295
 
1380
	mov eax,[rectangular_shade_x]
1296
	mov eax,[rectangular_shade_x]
1381
	mov ebx,[rectangular_shade_y]
1297
	mov ebx,[rectangular_shade_y]
1382
	sub eax,[PosX]
1298
	sub eax,[PosX]
1383
	sub ebx,[PosY]
1299
	sub ebx,[PosY]
1384
	mov [ScreenX],eax
1300
	mov [ScreenX],eax
1385
	mov [ScreenY],ebx
1301
	mov [ScreenY],ebx
1386
	no_change_coordinats:
1302
	no_change_coordinats:
1387
 
1303
 
1388
	;put saved pixels
1304
	;put saved pixels
1389
	square_width_put
1305
	square_width_put
1390
 
1306
 
1391
	cmp [DrawSprite_flag],1
1307
	cmp [DrawSprite_flag],1
1392
	jne no_activate_put_fon_
1308
	jne no_activate_put_fon_
1393
 
1309
 
1394
	cmp [Paste_flag],1
1310
	cmp [Paste_flag],1
1395
	je no_put_fon___
1311
	je no_put_fon___
1396
	call PutFonForSprite
1312
	call PutFonForSprite
1397
	no_put_fon___:
1313
	no_put_fon___:
1398
	and [Paste_flag],0
1314
	and [Paste_flag],0
1399
	no_activate_put_fon_:
1315
	no_activate_put_fon_:
1400
 
1316
 
1401
	cmp [finishing_crossing],0
1317
	cmp [finishing_crossing],0
1402
	jz not_finish_from_instrument_crossing
1318
	jz not_finish_from_instrument_crossing
1403
	and [Activate_instrument],0
1319
	and [Activate_instrument],0
1404
	and [crossing],0
1320
	and [crossing],0
1405
	and [instrument_used],0
1321
	and [instrument_used],0
1406
	and [DrawSprite_flag],0
1322
	and [DrawSprite_flag],0
1407
	call MovePictureToWorkScreen
1323
	call MovePictureToWorkScreen
1408
	jmp still
1324
	jmp still
1409
	not_finish_from_instrument_crossing:
1325
	not_finish_from_instrument_crossing:
1410
 
1326
 
1411
	;calculate line
1327
	;calculate line
1412
	mov ebx,[ReserveArray]
1328
	mov ebx,[ReserveArray]
1413
	add ebx,4
1329
	add ebx,4
1414
	mov eax,[PointerToPicture]
1330
	mov eax,[PointerToPicture]
1415
	mov ecx,[Picture_SizeX]
1331
	mov ecx,[Picture_SizeX]
1416
	mov edx,[OldX]
1332
	mov edx,[OldX]
1417
	shl edx,16
1333
	shl edx,16
1418
	add edx,[OldY]
1334
	add edx,[OldY]
1419
	mov esi,[ScreenX]
1335
	mov esi,[ScreenX]
1420
	mov edi,[ScreenY]
1336
	mov edi,[ScreenY]
1421
	add esi,[PosX]
1337
	add esi,[PosX]
1422
	add edi,[PosY]
1338
	add edi,[PosY]
1423
 
1339
 
1424
	mov ebp,[Picture_SizeX]
1340
	mov ebp,[Picture_SizeX]
1425
	dec ebp
1341
	dec ebp
1426
	cmp esi,ebp
1342
	cmp esi,ebp
1427
	jl no_minimum_x_allocation
1343
	jl no_minimum_x_allocation
1428
	mov esi,ebp
1344
	mov esi,ebp
1429
	no_minimum_x_allocation:
1345
	no_minimum_x_allocation:
1430
 
1346
 
1431
	mov ebp,[Picture_SizeY]
1347
	mov ebp,[Picture_SizeY]
1432
	dec ebp
1348
	dec ebp
1433
	cmp edi,ebp
1349
	cmp edi,ebp
1434
	jl no_minimum_y_allocation
1350
	jl no_minimum_y_allocation
1435
	mov edi,ebp
1351
	mov edi,ebp
1436
	no_minimum_y_allocation:
1352
	no_minimum_y_allocation:
1437
 
1353
 
1438
	call calculate_rectangle
1354
	call calculate_rectangle
1439
 
1355
 
1440
	;save color pixels in ReserveArray
1356
	;save color pixels in ReserveArray
1441
	square_width_save
1357
	square_width_save
1442
 
1358
 
1443
	cmp [DrawSprite_flag],1
1359
	cmp [DrawSprite_flag],1
1444
	jne no_save_fon_for_sprite_
1360
	jne no_save_fon_for_sprite_
1445
	;save current coordinats as old
1361
	;save current coordinats as old
1446
	mov eax,[SpriteCoordinatX]
1362
	mov eax,[SpriteCoordinatX]
1447
	mov ebx,[SpriteCoordinatY]
1363
	mov ebx,[SpriteCoordinatY]
1448
	mov [SpriteOldCoordinatX],eax
1364
	mov [SpriteOldCoordinatX],eax
1449
	mov [SpriteOldCoordinatY],ebx
1365
	mov [SpriteOldCoordinatY],ebx
1450
 
1366
 
1451
	call SaveFonForSprite
1367
	call SaveFonForSprite
1452
 
1368
 
1453
	no_save_fon_for_sprite_:
1369
	no_save_fon_for_sprite_:
1454
 
1370
 
1455
	;draw calculated pixels on work arrea
1371
	;draw calculated pixels on work arrea
1456
	mov ebx,[ReserveArray]
1372
	mov ebx,[ReserveArray]
1457
	mov ecx,[ebx]
1373
	mov ecx,[ebx]
1458
	add ebx,4
1374
	add ebx,4
1459
	next_pixel_put_allocation:
1375
	next_pixel_put_allocation:
1460
 
1376
 
1461
	mov edx,0x1f3fff
1377
	mov edx,0x1f3fff
1462
	mov esi,edx
1378
	mov esi,edx
1463
	shr edx,16
1379
	shr edx,16
1464
 
1380
 
1465
	mov ebp,ecx
1381
	mov ebp,ecx
1466
	and ebp,8
1382
	and ebp,8
1467
	cmp ebp,8
1383
	cmp ebp,8
1468
	jne black_color
1384
	jne black_color
1469
	mov si,0xffff
1385
	mov si,0xffff
1470
	mov dl,0xff
1386
	mov dl,0xff
1471
	black_color:
1387
	black_color:
1472
 
1388
 
1473
	mov eax,[ebx]
1389
	mov eax,[ebx]
1474
	mov [eax],si
1390
	mov [eax],si
1475
	mov [eax+2],dl
1391
	mov [eax+2],dl
1476
 
1392
 
1477
	add ebx,4
1393
	add ebx,4
1478
	dec ecx
1394
	dec ecx
1479
	jnz next_pixel_put_allocation
1395
	jnz next_pixel_put_allocation
1480
 
1396
 
1481
	cmp [DrawSprite_flag],1
1397
	cmp [DrawSprite_flag],1
1482
	jne no_activate_draw_sprite_
1398
	jne no_activate_draw_sprite_
1483
 
1399
 
1484
	call DrawSprite
1400
	call DrawSprite
1485
 
1401
 
1486
	no_activate_draw_sprite_:
1402
	no_activate_draw_sprite_:
1487
 
1403
 
1488
	mov al,[instrument_used]
1404
	mov al,[instrument_used]
1489
	test al,al
1405
	test al,al
1490
	jz no_change_coordinats
1406
	jz no_change_coordinats
1491
	cmp [Activate_instrument],0
1407
	cmp [Activate_instrument],0
1492
	jz no_save_shades
1408
	jz no_save_shades
1493
	mov eax,[ScreenX]
1409
	mov eax,[ScreenX]
1494
	mov ebx,[ScreenY]
1410
	mov ebx,[ScreenY]
1495
	add eax,[PosX]
1411
	add eax,[PosX]
1496
	add ebx,[PosY]
1412
	add ebx,[PosY]
1497
	mov [rectangular_shade_x],eax
1413
	mov [rectangular_shade_x],eax
1498
	mov [rectangular_shade_y],ebx
1414
	mov [rectangular_shade_y],ebx
1499
	no_save_shades:
1415
	no_save_shades:
1500
 
1416
 
1501
	call MovePictureToWorkScreen
1417
	call MovePictureToWorkScreen
1502
	jmp still
1418
	jmp still
1503
	no_allocation:
1419
	no_allocation:
1504
 
1420
 
1505
	;*************reflection from left to right*************
1421
	;*************reflection from left to right*************
1506
	cmp eax,23
1422
	cmp eax,23
1507
	jne no_reflection_from_left_to_right
1423
	jne no_reflection_from_left_to_right
1508
 
1424
 
1509
	mov ebp,[PointerToPicture]
1425
	mov ebp,[PointerToPicture]
1510
	mov edx,[ReserveArray]
1426
	mov edx,[ReserveArray]
1511
	mov esi,[Picture_SizeX]
1427
	mov esi,[Picture_SizeX]
1512
	mov ebx,[Picture_SizeX]
1428
	mov ebx,[Picture_SizeX]
1513
	lea ebx,[ebx+ebx*2]
1429
	lea ebx,[ebx+ebx*2]
1514
	shr esi,1
1430
	shr esi,1
1515
	next_line_reflection_x:
1431
	next_line_reflection_x:
1516
	;copy vertical line to array
1432
	;copy vertical line to array
1517
	mov ecx,[Picture_SizeX]
1433
	mov ecx,[Picture_SizeX]
1518
	shr ecx,1
1434
	shr ecx,1
1519
	sub ecx,esi
1435
	sub ecx,esi
1520
	lea ecx,[ecx+ecx*2]
1436
	lea ecx,[ecx+ecx*2]
1521
	add ecx,[PointerToPicture]
1437
	add ecx,[PointerToPicture]
1522
	mov edx,[ReserveArray]
1438
	mov edx,[ReserveArray]
1523
	and edi,0
1439
	and edi,0
1524
	copy_to_array_line_reflection_y:
1440
	copy_to_array_line_reflection_y:
1525
	mov eax,[ecx]
1441
	mov eax,[ecx]
1526
	mov ebp,edi
1442
	mov ebp,edi
1527
	lea ebp,[ebp+ebp*2]
1443
	lea ebp,[ebp+ebp*2]
1528
	mov [edx+ebp],ax
1444
	mov [edx+ebp],ax
1529
	shr eax,16
1445
	shr eax,16
1530
	mov [edx+ebp+2],al
1446
	mov [edx+ebp+2],al
1531
	add ecx,ebx
1447
	add ecx,ebx
1532
	inc edi
1448
	inc edi
1533
	cmp edi,[Picture_SizeY]
1449
	cmp edi,[Picture_SizeY]
1534
	jne copy_to_array_line_reflection_y
1450
	jne copy_to_array_line_reflection_y
1535
 
1451
 
1536
	mov ecx,[Picture_SizeX]
1452
	mov ecx,[Picture_SizeX]
1537
	shr ecx,1
1453
	shr ecx,1
1538
	mov ebp,ecx
1454
	mov ebp,ecx
1539
	add ecx,esi
1455
	add ecx,esi
1540
	dec ecx
1456
	dec ecx
1541
	lea ecx,[ecx+ecx*2]
1457
	lea ecx,[ecx+ecx*2]
1542
	add ecx,[PointerToPicture]
1458
	add ecx,[PointerToPicture]
1543
	sub ebp,esi
1459
	sub ebp,esi
1544
	lea ebp,[ebp+ebp*2]
1460
	lea ebp,[ebp+ebp*2]
1545
	add ebp,[PointerToPicture]
1461
	add ebp,[PointerToPicture]
1546
	and edi,0
1462
	and edi,0
1547
	next_line_reflection_y:
1463
	next_line_reflection_y:
1548
	mov eax,[ecx]
1464
	mov eax,[ecx]
1549
	and eax,0xffffff
1465
	and eax,0xffffff
1550
	mov [ebp],ax
1466
	mov [ebp],ax
1551
	shr eax,16
1467
	shr eax,16
1552
	mov [ebp+2],al
1468
	mov [ebp+2],al
1553
	add ebp,ebx
1469
	add ebp,ebx
1554
	add ecx,ebx
1470
	add ecx,ebx
1555
	inc edi
1471
	inc edi
1556
	cmp edi,[Picture_SizeY]
1472
	cmp edi,[Picture_SizeY]
1557
	jnz next_line_reflection_y
1473
	jnz next_line_reflection_y
1558
 
1474
 
1559
	;copy vertical line  from array to screen
1475
	;copy vertical line  from array to screen
1560
	mov ecx,[Picture_SizeX]
1476
	mov ecx,[Picture_SizeX]
1561
	shr ecx,1
1477
	shr ecx,1
1562
	add ecx,esi
1478
	add ecx,esi
1563
	dec ecx
1479
	dec ecx
1564
	lea ecx,[ecx+ecx*2]
1480
	lea ecx,[ecx+ecx*2]
1565
	add ecx,[PointerToPicture]
1481
	add ecx,[PointerToPicture]
1566
	mov edx,[ReserveArray]
1482
	mov edx,[ReserveArray]
1567
	and edi,0
1483
	and edi,0
1568
	copy_from_array_to_screen_reflection_y:
1484
	copy_from_array_to_screen_reflection_y:
1569
	mov ebp,edi
1485
	mov ebp,edi
1570
	lea ebp,[ebp+ebp*2]
1486
	lea ebp,[ebp+ebp*2]
1571
	xor eax,eax
1487
	xor eax,eax
1572
	mov eax,[edx+ebp]
1488
	mov eax,[edx+ebp]
1573
	mov [ecx],ax
1489
	mov [ecx],ax
1574
	shr eax,16
1490
	shr eax,16
1575
	mov [ecx+2],al
1491
	mov [ecx+2],al
1576
	add ecx,ebx
1492
	add ecx,ebx
1577
	inc edi
1493
	inc edi
1578
	cmp edi,[Picture_SizeY]
1494
	cmp edi,[Picture_SizeY]
1579
	jne copy_from_array_to_screen_reflection_y
1495
	jne copy_from_array_to_screen_reflection_y
1580
 
1496
 
1581
	dec esi
1497
	dec esi
1582
	jnz next_line_reflection_x
1498
	jnz next_line_reflection_x
1583
 
1499
 
1584
	call MovePictureToWorkScreen
1500
	call MovePictureToWorkScreen
1585
	jmp still
1501
	jmp still
1586
	no_reflection_from_left_to_right:
1502
	no_reflection_from_left_to_right:
1587
 
1503
 
1588
	;*************reflection from up to down****************
1504
	;*************reflection from up to down****************
1589
	cmp eax,24
1505
	cmp eax,24
1590
	jne no_reflection_from_up_to_down
1506
	jne no_reflection_from_up_to_down
1591
	mov esi,[Picture_SizeX]
1507
	mov esi,[Picture_SizeX]
1592
	mov edi,esi
1508
	mov edi,esi
1593
	lea esi,[esi+esi*2]
1509
	lea esi,[esi+esi*2]
1594
	lea edi,[edi+edi*2]
1510
	lea edi,[edi+edi*2]
1595
	imul edi,[Picture_SizeY]
1511
	imul edi,[Picture_SizeY]
1596
	mov edx,[ReserveArray]
1512
	mov edx,[ReserveArray]
1597
	mov ecx,[Picture_SizeY]
1513
	mov ecx,[Picture_SizeY]
1598
	shr ecx,1
1514
	shr ecx,1
1599
	add edi,[PointerToPicture]
1515
	add edi,[PointerToPicture]
1600
	sub edi,esi
1516
	sub edi,esi
1601
	mov ebp,[PointerToPicture]
1517
	mov ebp,[PointerToPicture]
1602
	next_lines_reflection:
1518
	next_lines_reflection:
1603
	;copy line
1519
	;copy line
1604
	xor ebx,ebx
1520
	xor ebx,ebx
1605
	copy_line_1:
1521
	copy_line_1:
1606
	xor eax,eax
1522
	xor eax,eax
1607
	mov al,[edi+ebx]
1523
	mov al,[edi+ebx]
1608
	mov [edx+ebx],al
1524
	mov [edx+ebx],al
1609
	inc ebx
1525
	inc ebx
1610
	cmp ebx,esi
1526
	cmp ebx,esi
1611
	jne copy_line_1
1527
	jne copy_line_1
1612
 
1528
 
1613
	xor ebx,ebx
1529
	xor ebx,ebx
1614
	copy_line_2:
1530
	copy_line_2:
1615
	xor eax,eax
1531
	xor eax,eax
1616
	mov al,[ebp+ebx]
1532
	mov al,[ebp+ebx]
1617
	mov [edi+ebx],al
1533
	mov [edi+ebx],al
1618
	inc ebx
1534
	inc ebx
1619
	cmp ebx,esi
1535
	cmp ebx,esi
1620
	jne copy_line_2
1536
	jne copy_line_2
1621
 
1537
 
1622
	xor ebx,ebx
1538
	xor ebx,ebx
1623
	copy_line_3:
1539
	copy_line_3:
1624
	xor eax,eax
1540
	xor eax,eax
1625
	mov al,[edx+ebx]
1541
	mov al,[edx+ebx]
1626
	mov [ebp+ebx],al
1542
	mov [ebp+ebx],al
1627
	inc ebx
1543
	inc ebx
1628
	cmp ebx,esi
1544
	cmp ebx,esi
1629
	jne copy_line_3
1545
	jne copy_line_3
1630
 
1546
 
1631
	add ebp,esi
1547
	add ebp,esi
1632
	sub edi,esi
1548
	sub edi,esi
1633
	dec ecx
1549
	dec ecx
1634
	jnz next_lines_reflection
1550
	jnz next_lines_reflection
1635
 
1551
 
1636
	call MovePictureToWorkScreen
1552
	call MovePictureToWorkScreen
1637
	jmp still
1553
	jmp still
1638
	no_reflection_from_up_to_down:
1554
	no_reflection_from_up_to_down:
1639
 
1555
 
1640
	;*********************draw hard contour*****************
1556
	;*********************draw hard contour*****************
1641
	cmp eax,20
1557
	cmp eax,20
1642
	jne no_kontur_
1558
	jne no_kontur_
1643
 
1559
 
1644
	mov [Last_instrument],eax
1560
	mov [Last_instrument],eax
1645
 
1561
 
1646
	mov al,[Activate_instrument]
1562
	mov al,[Activate_instrument]
1647
	test al,al
1563
	test al,al
1648
	jnz no_new_konture_xy
1564
	jnz no_new_konture_xy
1649
 
1565
 
1650
	mov al,[instrument_used]
1566
	mov al,[instrument_used]
1651
	test al,al
1567
	test al,al
1652
	jz instrument_not_used
1568
	jz instrument_not_used
1653
	mov eax,[used_OldX]
1569
	mov eax,[used_OldX]
1654
	mov ebx,[used_OldY]
1570
	mov ebx,[used_OldY]
1655
	mov [OldX],eax
1571
	mov [OldX],eax
1656
	mov [OldY],ebx
1572
	mov [OldY],ebx
1657
	jmp exit_used_instrument
1573
	jmp exit_used_instrument
1658
	instrument_not_used:
1574
	instrument_not_used:
1659
 
1575
 
1660
	mov eax,[ScreenX]
1576
	mov eax,[ScreenX]
1661
	mov ebx,[ScreenY]
1577
	mov ebx,[ScreenY]
1662
	add eax,[PosX]
1578
	add eax,[PosX]
1663
	add ebx,[PosY]
1579
	add ebx,[PosY]
1664
	mov [OldX],eax
1580
	mov [OldX],eax
1665
	mov [OldY],ebx
1581
	mov [OldY],ebx
1666
	exit_used_instrument:
1582
	exit_used_instrument:
1667
 
1583
 
1668
	mov al,[instrument_used]
1584
	mov al,[instrument_used]
1669
	test al,al
1585
	test al,al
1670
	jnz instrument_used_true
1586
	jnz instrument_used_true
1671
	mov [instrument_used],byte 1
1587
	mov [instrument_used],byte 1
1672
	instrument_used_true:
1588
	instrument_used_true:
1673
 
1589
 
1674
	mov [Activate_instrument],1
1590
	mov [Activate_instrument],1
1675
	xor eax,eax
1591
	xor eax,eax
1676
	mov ecx,mem_flood_f/4
1592
	mov ecx,mem_flood_f/4
1677
	mov edi,[ReserveArray]
1593
	mov edi,[ReserveArray]
1678
	rep stosd
1594
	rep stosd
1679
 
1595
 
1680
	no_new_konture_xy:
1596
	no_new_konture_xy:
1681
 
1597
 
1682
	;put saved pixels
1598
	;put saved pixels
1683
	square_width_put
1599
	square_width_put
1684
 
1600
 
1685
	;calculate line
1601
	;calculate line
1686
	mov ebx,[ReserveArray]
1602
	mov ebx,[ReserveArray]
1687
	add ebx,4
1603
	add ebx,4
1688
	mov eax,[PointerToPicture]
1604
	mov eax,[PointerToPicture]
1689
	mov ecx,[Picture_SizeX]
1605
	mov ecx,[Picture_SizeX]
1690
	mov edx,[OldX]
1606
	mov edx,[OldX]
1691
	shl edx,16
1607
	shl edx,16
1692
	add edx,[OldY]
1608
	add edx,[OldY]
1693
	mov esi,[ScreenX]
1609
	mov esi,[ScreenX]
1694
	mov edi,[ScreenY]
1610
	mov edi,[ScreenY]
1695
	add esi,[PosX]
1611
	add esi,[PosX]
1696
	add edi,[PosY]
1612
	add edi,[PosY]
1697
 
1613
 
1698
	mov ebp,[Picture_SizeX]
1614
	mov ebp,[Picture_SizeX]
1699
	sub ebp,[line_width]
1615
	sub ebp,[line_width]
1700
	cmp esi,ebp
1616
	cmp esi,ebp
1701
	jl no_minimum_x_konture
1617
	jl no_minimum_x_konture
1702
	mov esi,ebp
1618
	mov esi,ebp
1703
	no_minimum_x_konture:
1619
	no_minimum_x_konture:
1704
 
1620
 
1705
	mov ebp,[Picture_SizeY]
1621
	mov ebp,[Picture_SizeY]
1706
	sub ebp,[line_width]
1622
	sub ebp,[line_width]
1707
	cmp edi,ebp
1623
	cmp edi,ebp
1708
	jl no_minimum_y_konture
1624
	jl no_minimum_y_konture
1709
	mov edi,ebp
1625
	mov edi,ebp
1710
	no_minimum_y_konture:
1626
	no_minimum_y_konture:
1711
 
1627
 
1712
	call calculate_line
1628
	call calculate_line
1713
 
1629
 
1714
	;save color pixels in ReserveArray
1630
	;save color pixels in ReserveArray
1715
	square_width_save
1631
	square_width_save
1716
 
1632
 
1717
	;draw calculated pixels on work arrea
1633
	;draw calculated pixels on work arrea
1718
	mov ebx,[ReserveArray]
-
 
1719
	mov ecx,[ebx]
-
 
1720
	mov edx,[Color]
-
 
1721
	mov esi,[Color]
-
 
1722
	shr edx,16
-
 
1723
	add ebx,4
-
 
1724
	mov edi,[line_width]
-
 
1725
	dec edi
-
 
1726
	imul edi,25
-
 
1727
	next_pixel_put_konture:
-
 
1728
 
-
 
1729
	mov eax,[ebx]
-
 
1730
	push eax
-
 
1731
	push ecx
-
 
1732
	xor ebp,ebp
-
 
1733
	and [counter2],0
-
 
1734
 
-
 
1735
	vertical_width_konture:
-
 
1736
	   and [counter],0
-
 
1737
 
-
 
1738
	   horizontal_width_konture:
-
 
1739
	   xor ecx,ecx
-
 
1740
	   mov cl,byte[width_pixels+edi+ebp]
1634
	draw_calc_pixels width_pixels
1741
	   test cl,cl
-
 
1742
	     jz no_draw_pixel_konture
-
 
1743
	      mov [eax],si
-
 
1744
	      mov [eax+2],dl
-
 
1745
	     no_draw_pixel_konture:
-
 
1746
	   add eax,3
-
 
1747
	   inc ebp
-
 
1748
	   inc [counter]
-
 
1749
	   cmp [counter],5
-
 
1750
	   jne horizontal_width_konture
-
 
1751
 
-
 
1752
	   mov ecx,[Picture_SizeX]
-
 
1753
	   sub ecx,5
-
 
1754
	   lea ecx,[ecx+ecx*2]
-
 
1755
	   add eax,ecx
-
 
1756
	inc [counter2]
-
 
1757
	cmp [counter2],5
-
 
1758
	jne vertical_width_konture
-
 
1759
 
-
 
1760
	pop ecx
-
 
1761
	pop eax
-
 
1762
	add ebx,4
-
 
1763
	dec ecx
-
 
1764
	jnz next_pixel_put_konture
-
 
1765
 
1635
 
1766
	mov eax,[ScreenX]
1636
	mov eax,[ScreenX]
1767
	mov ebx,[ScreenY]
1637
	mov ebx,[ScreenY]
1768
	add eax,[PosX]
1638
	add eax,[PosX]
1769
	add ebx,[PosY]
1639
	add ebx,[PosY]
1770
	mov [used_OldX],eax
1640
	mov [used_OldX],eax
1771
	mov [used_OldY],ebx
1641
	mov [used_OldY],ebx
1772
 
1642
 
1773
	call MovePictureToWorkScreen
1643
	call MovePictureToWorkScreen
1774
 
1644
 
1775
	jmp still
1645
	jmp still
1776
 
1646
 
1777
	no_kontur_:
1647
	no_kontur_:
1778
	;************************draw ellips********************
1648
	;************************draw ellips********************
1779
	cmp eax,19
1649
	cmp eax,19
1780
	jne no_ellips
1650
	jne no_ellips
1781
 
1651
 
1782
	mov [Last_instrument],eax
1652
	mov [Last_instrument],eax
1783
 
1653
 
1784
	mov al,[Activate_instrument]
1654
	mov al,[Activate_instrument]
1785
	test al,al
1655
	test al,al
1786
	jnz no_new_ellips_xy
1656
	jnz no_new_ellips_xy
1787
	mov eax,[ScreenX]
1657
	mov eax,[ScreenX]
1788
	mov ebx,[ScreenY]
1658
	mov ebx,[ScreenY]
1789
	add eax,[PosX]
1659
	add eax,[PosX]
1790
	add ebx,[PosY]
1660
	add ebx,[PosY]
1791
	mov [OldX],eax
1661
	mov [OldX],eax
1792
	mov [OldY],ebx
1662
	mov [OldY],ebx
1793
	mov [Activate_instrument],1
1663
	mov [Activate_instrument],1
1794
	xor eax,eax
1664
	xor eax,eax
1795
	mov ecx,mem_flood_f/4
1665
	mov ecx,mem_flood_f/4
1796
	mov edi,[ReserveArray]
1666
	mov edi,[ReserveArray]
1797
	rep stosd
1667
	rep stosd
1798
	jmp still
1668
	jmp still
1799
	no_new_ellips_xy:
1669
	no_new_ellips_xy:
1800
 
1670
 
1801
	;put saved pixels
1671
	;put saved pixels
1802
	square_width_put
1672
	square_width_put
1803
 
1673
 
1804
 
1674
 
1805
	mov esi,[ScreenX]
1675
	mov esi,[ScreenX]
1806
	mov edi,[ScreenY]
1676
	mov edi,[ScreenY]
1807
	add esi,[PosX]
1677
	add esi,[PosX]
1808
	add edi,[PosY]
1678
	add edi,[PosY]
1809
 
1679
 
1810
	sub esi,[OldX]
1680
	sub esi,[OldX]
1811
	jns no_sign_x_ellips
1681
	jns no_sign_x_ellips
1812
	neg esi
1682
	neg esi
1813
	shr esi,1
1683
	shr esi,1
1814
	neg esi
1684
	neg esi
1815
	add esi,[OldX]
1685
	add esi,[OldX]
1816
	jmp no_plus_sign_x_ellips
1686
	jmp no_plus_sign_x_ellips
1817
	no_sign_x_ellips:
1687
	no_sign_x_ellips:
1818
 
1688
 
1819
	shr esi,1
1689
	shr esi,1
1820
	add esi,[OldX]
1690
	add esi,[OldX]
1821
	no_plus_sign_x_ellips:
1691
	no_plus_sign_x_ellips:
1822
 
1692
 
1823
	sub edi,[OldY]
1693
	sub edi,[OldY]
1824
	jns no_sign_y_ellips
1694
	jns no_sign_y_ellips
1825
	neg edi
1695
	neg edi
1826
	shr edi,1
1696
	shr edi,1
1827
	neg edi
1697
	neg edi
1828
	add edi,[OldY]
1698
	add edi,[OldY]
1829
	jmp no_plus_sign_y_ellips
1699
	jmp no_plus_sign_y_ellips
1830
	no_sign_y_ellips:
1700
	no_sign_y_ellips:
1831
 
1701
 
1832
	shr edi,1
1702
	shr edi,1
1833
	add edi,[OldY]
1703
	add edi,[OldY]
1834
	no_plus_sign_y_ellips:
1704
	no_plus_sign_y_ellips:
1835
 
1705
 
1836
	mov [x],esi
1706
	mov [x],esi
1837
	mov [y],edi
1707
	mov [y],edi
1838
 
1708
 
1839
	mov esi,[ScreenX]
1709
	mov esi,[ScreenX]
1840
	mov edi,[ScreenY]
1710
	mov edi,[ScreenY]
1841
	add esi,[PosX]
1711
	add esi,[PosX]
1842
	add edi,[PosY]
1712
	add edi,[PosY]
1843
 
1713
 
1844
	sub esi,[OldX]
1714
	sub esi,[OldX]
1845
	jns no_sign_x_ellips_r
1715
	jns no_sign_x_ellips_r
1846
	neg esi
1716
	neg esi
1847
	no_sign_x_ellips_r:
1717
	no_sign_x_ellips_r:
1848
 
1718
 
1849
	sub edi,[OldY]
1719
	sub edi,[OldY]
1850
	jns no_sign_y_ellips_r
1720
	jns no_sign_y_ellips_r
1851
	neg edi
1721
	neg edi
1852
	no_sign_y_ellips_r:
1722
	no_sign_y_ellips_r:
1853
 
1723
 
1854
	cmp edi,0
1724
	cmp edi,0
1855
	jnz no_null_a_ellips
1725
	jnz no_null_a_ellips
1856
	mov edi,1
1726
	mov edi,1
1857
	no_null_a_ellips:
1727
	no_null_a_ellips:
1858
 
1728
 
1859
	shr esi,1
1729
	shr esi,1
1860
	shr edi,1
1730
	shr edi,1
1861
	mov [a_ellips],esi
1731
	mov [a_ellips],esi
1862
	mov [b_ellips],edi
1732
	mov [b_ellips],edi
1863
 
1733
 
1864
	mov edi,[x]
1734
	mov edi,[x]
1865
	mov ebp,[y]
1735
	mov ebp,[y]
1866
	add edi,esi
1736
	add edi,esi
1867
	add ebp,esi
1737
	add ebp,esi
1868
 
1738
 
1869
	mov edx,[Picture_SizeX]
1739
	mov edx,[Picture_SizeX]
1870
	sub edx,[line_width]
1740
	sub edx,[line_width]
1871
	cmp edi,edx
1741
	cmp edi,edx
1872
	jl no_limit_x_ellips
1742
	jl no_limit_x_ellips
1873
	sub edi,edx
1743
	sub edi,edx
1874
	sub [a_ellips],edi
1744
	sub [a_ellips],edi
1875
	no_limit_x_ellips:
1745
	no_limit_x_ellips:
1876
 
1746
 
1877
	mov edx,[Picture_SizeY]
1747
	mov edx,[Picture_SizeY]
1878
	sub edx,[line_width]
1748
	sub edx,[line_width]
1879
	cmp ebp,edx
1749
	cmp ebp,edx
1880
	jl no_limit_y_ellips
1750
	jl no_limit_y_ellips
1881
	sub ebp,edx
1751
	sub ebp,edx
1882
	sub [b_ellips],ebp
1752
	sub [b_ellips],ebp
1883
	no_limit_y_ellips:
1753
	no_limit_y_ellips:
1884
 
1754
 
1885
 
1755
 
1886
	mov edi,[x]
1756
	mov edi,[x]
1887
	mov ebp,[y]
1757
	mov ebp,[y]
1888
 
1758
 
1889
	sub edi,[a_ellips]
1759
	sub edi,[a_ellips]
1890
	jns no_minimum_x_ellips
1760
	jns no_minimum_x_ellips
1891
	add [a_ellips],edi
1761
	add [a_ellips],edi
1892
	no_minimum_x_ellips:
1762
	no_minimum_x_ellips:
1893
 
1763
 
1894
	sub ebp,[b_ellips]
1764
	sub ebp,[b_ellips]
1895
	jns no_minimum_y_ellips
1765
	jns no_minimum_y_ellips
1896
	add [b_ellips],ebp
1766
	add [b_ellips],ebp
1897
	no_minimum_y_ellips:
1767
	no_minimum_y_ellips:
1898
 
1768
 
1899
	;calculate circle
1769
	;calculate circle
1900
	mov ebx,[ReserveArray]
1770
	mov ebx,[ReserveArray]
1901
	add ebx,4
1771
	add ebx,4
1902
	mov eax,[PointerToPicture]
1772
	mov eax,[PointerToPicture]
1903
	mov ecx,[Picture_SizeX]
1773
	mov ecx,[Picture_SizeX]
1904
	mov edx,[x]
1774
	mov edx,[x]
1905
	shl edx,16
1775
	shl edx,16
1906
	add edx,[y]
1776
	add edx,[y]
1907
	mov esi,[a_ellips]
1777
	mov esi,[a_ellips]
1908
	shl esi,16
1778
	shl esi,16
1909
	add esi,[b_ellips]
1779
	add esi,[b_ellips]
1910
	call calculate_ellips
1780
	call calculate_ellips
1911
 
1781
 
1912
	;save color pixels in ReserveArray
1782
	;save color pixels in ReserveArray
1913
	square_width_save
1783
	square_width_save
1914
 
1784
 
1915
	;draw calculated pixels on work arrea
1785
	;draw calculated pixels on work arrea
1916
	mov ebx,[ReserveArray]
-
 
1917
	mov ecx,[ebx]
-
 
1918
	mov edx,[Color]
-
 
1919
	mov esi,[Color]
-
 
1920
	shr edx,16
-
 
1921
	add ebx,4
-
 
1922
	mov edi,[line_width]
-
 
1923
	dec edi
-
 
1924
	imul edi,25
-
 
1925
	next_pixel_put_ellips:
-
 
1926
 
-
 
1927
	mov eax,[ebx]
-
 
1928
	push eax
-
 
1929
	push ecx
-
 
1930
	xor ebp,ebp
-
 
1931
	and [counter2],0
-
 
1932
 
-
 
1933
	vertical_width_ellips:
-
 
1934
	   and [counter],0
-
 
1935
 
-
 
1936
	   horizontal_width_ellips:
-
 
1937
	   xor ecx,ecx
-
 
1938
	   mov cl,byte[width_pixels+edi+ebp]
-
 
1939
	   test cl,cl
-
 
1940
	     jz no_draw_pixel_ellips
-
 
1941
	      mov [eax],si
-
 
1942
	      mov [eax+2],dl
-
 
1943
	     no_draw_pixel_ellips:
-
 
1944
	   add eax,3
-
 
1945
	   inc ebp
-
 
1946
	   inc [counter]
-
 
1947
	   cmp [counter],5
-
 
1948
	   jne horizontal_width_ellips
-
 
1949
 
-
 
1950
	   mov ecx,[Picture_SizeX]
-
 
1951
	   sub ecx,5
-
 
1952
	   lea ecx,[ecx+ecx*2]
-
 
1953
	   add eax,ecx
-
 
1954
	inc [counter2]
-
 
1955
	cmp [counter2],5
-
 
1956
	jne vertical_width_ellips
-
 
1957
 
-
 
1958
	pop ecx
-
 
1959
	pop eax
-
 
1960
	add ebx,4
-
 
1961
	dec ecx
-
 
1962
	jnz next_pixel_put_ellips
1786
	draw_calc_pixels width_pixels
1963
 
1787
 
1964
	call MovePictureToWorkScreen
1788
	call MovePictureToWorkScreen
1965
	jmp still
1789
	jmp still
1966
	no_ellips:
1790
	no_ellips:
1967
 
1791
 
1968
 
1792
 
1969
	jmp still
1793
	jmp still
1970
	ret
1794
	ret