Subversion Repositories Kolibri OS

Rev

Rev 255 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
180 heavyiron 1
;******************************************************
2
;***GRAPHICS EDIT ANIMAGE creted by andrew_programmer**
3
;******************************************************
4
 
5
use32
6
org 0x0
7
 
8
  db  'MENUET01'
9
  dd  0x1
10
  dd  START
11
  dd  I_END
12
  dd  0x19000;100 kb
13
  dd  0x19000;
14
  dd  0x0
15
  dd  0x0
16
  include 'giflib.inc'
17
  include 'bmplib.inc'
18
  include 'dialog.inc'
19
  include 'dialog2.inc'
20
  include 'design.inc'
21
  include 'graphlib.inc'
22
START:
23
 
24
;--------------------------------------------------------
25
;---------------set events mask--------------------------
26
;--------------------------------------------------------
27
   mov eax,40
28
   mov ebx,1100111b
29
   int 0x40
30
 
31
;---------------------------------------------------------
32
;--------initializate data and params of program----------
33
;---------------------------------------------------------
34
   mov [Scroll1CoordinatX],8+1
35
   mov [Scroll2CoordinatY],20+15+1+46+3
36
   mov [Window_SizeX],640
37
   mov [Window_SizeY],400
38
   mov [Window_CordinatX],50
39
   mov [Window_CordinatY],50
40
   mov [WorkScreen_SizeX],100
41
   mov [WorkScreen_SizeY],100
42
   mov [MaxWorkScreen_SizeX],100
43
   mov [MaxWorkScreen_SizeY],100
44
   mov [ScreenPointer],0x19000
45
   and [PosX],0
46
   and [PosY],0
47
   mov [Picture_SizeX],640;400
48
   mov [Picture_SizeY],400;280
49
   mov [k],1
50
   mov [PointerToPicture],0x19000+(1200*1000*3)+30*(20*20*3)+500000
51
   mov [PointerToCopyPicture],0x19000+(1200*1000*3)+30*(20*20*3)+500000+(640*400*3)
52
   mov [PointerToCopyPicture2],0x19000+(1200*1000*3)+30*(20*20*3)+500000+(640*400*3)*2
53
   mov [PointerToEditBufer],0x19000+(1200*1000*3)+30*(20*20*3)+500000+(640*400*3)*3
54
   mov [PointerToSpriteBufer],0x19000+(1200*1000*3)+30*(20*20*3)+500000+(640*400*3)*4
55
   mov [PointerToPalette],0x19000+(1200*100*3)+30*(20*20*3)+1
56
   mov [ReserveArray],0x19000+(1200*1000)*3+30*(20*20*3)+8
57
   and [save_flag],0
58
   mov [line_width],1
59
   mov [lastik_is_active],0
60
   and [crossing],0
61
   and [finishing_crossing],0
62
   and [number_undo],0
63
   and [instrument_used],0
64
   and [DrawSprite_flag],0
65
   and [extended_memory],0
66
 
67
   finit
68
;----------------------------------------------------------
69
;--------get memory and draw window of program-------------
70
;----------------------------------------------------------
71
   call GetMemory
72
 
73
   call cleare_work_arrea
74
   call load_icons
75
   call drawwin
76
;----------------------------------------------------------
77
;---------------------MAIN LOOP----------------------------
78
;----------------------------------------------------------
79
main_loop:
80
   still:
81
 
82
   call event
83
 
84
   cmp eax,1
85
   jne no_redraw_window
86
   call drawwin
87
   call drawwin
88
   jmp still
89
   no_redraw_window:
90
   cmp eax,3
91
   je buttons
92
   cmp eax,6
93
   je mouse
94
   cmp eax,2
95
   je keys
96
   jmp main_loop
97
 
98
;------------------------------------------
99
;-------------KEYS-------------------------
100
;------------------------------------------
101
   keys:
102
 
103
   mov eax,2
104
   int 0x40
105
   shr eax,8
106
 
107
   cmp eax,176
108
   jne key2
109
   sub [PosX],20
110
   jmp change_screen
111
 key2:
112
   cmp eax,179
113
   jne key3
114
   add [PosX],20
115
   jmp change_screen
116
 key3:
117
   cmp eax,177
118
   jne key4
119
   add [PosY],20
120
   jmp change_screen
121
 key4:
122
  cmp eax,178
123
   jne key5
124
   sub [PosY],20
125
   jmp change_screen
126
 key5:
127
   cmp eax,49
128
   jne key6
129
   mov [k],1
130
   mov [Scroll1CoordinatX],9
131
   mov [Scroll2CoordinatY],85
132
   call drawwin
133
   jmp change_screen
134
 key6:
135
   cmp eax,50
136
   jne key7
137
   mov [k],2
138
   mov [Scroll1CoordinatX],9
139
   mov [Scroll2CoordinatY],85
140
   call drawwin
141
   jmp change_screen
142
 key7:
143
   cmp eax,52
144
   jne key8
145
   mov [k],4
146
   mov [Scroll1CoordinatX],9
147
   mov [Scroll2CoordinatY],85
148
   call drawwin
149
   jmp change_screen
150
 key8:
151
   cmp eax,56
152
   jne key9
153
   mov [k],8
154
   mov [Scroll1CoordinatX],9
155
   mov [Scroll2CoordinatY],85
156
   call drawwin
157
   jmp change_screen
158
 key9:
159
   cmp eax,48
160
   jne key10
161
   mov [k],16
162
   mov [Scroll1CoordinatX],9
163
   mov [Scroll2CoordinatY],85
164
   call drawwin
165
   jmp change_screen
166
 key10:
167
   cmp eax,255
168
   jne key11
169
   call analizing_picture_to_palette
170
   call drawwin
171
   jmp change_screen
172
 key11:
173
   cmp eax,27
174
   jne still
175
    mov eax,-1
176
    int 0x40
177
   jmp still
178
 
179
   change_screen:
180
 
181
   call CalculatePositionScreen
182
   call MovePictureToWorkScreen
183
   call draw_scrollers
184
   call PrintMousePos
185
 
186
   jmp still
187
;---------------------------------------------
188
;-----------panel BUTTONS---------------------
189
;---------------------------------------------
190
buttons:
191
 
192
	cmp [Current_instrument],30
193
	jne no_finish_instrument_button
194
 
195
	cmp [instrument_used],1
196
	jne no_finish_instrument_button
197
 
198
	cmp [Activate_instrument],0
199
	jne no_finish_instrument_button
200
 
201
	cmp [crossing],1
202
	jne no_finish_instrument_button
203
 
204
	mov [finishing_crossing],1
205
	call TakeButtonInstruments
206
 
207
	no_finish_instrument_button:
208
 
209
	mov eax,17
210
	int 0x40
211
 
212
	shr eax,8
213
 
214
	cmp eax,1
215
	jne no_exit
216
 
217
	mov eax,-1
218
	int 0x40
219
 
220
	no_exit:
221
 
222
	mov [Current_instrument],eax
223
 
224
	cmp eax,10
225
	jl still
226
 
227
	cmp eax,15
228
	je still
229
 
230
	cmp eax,17
231
	je still
232
 
233
	cmp eax,18
234
	je still
235
 
236
	cmp eax,19
237
	je still
238
 
239
	cmp eax,20
240
	je still
241
 
242
	cmp eax,21
243
	jne no_palette_
244
 
245
	call TakeButtonInstruments
246
	jmp still
247
 
248
	no_palette_:
249
 
250
	cmp eax,23
251
	je still
252
 
253
	cmp eax,30
254
	jne no_allocation__
255
 
256
	and [Activate_instrument],0
257
	jmp still
258
 
259
	no_allocation__:
260
 
261
	cmp eax,38
262
	jne no_kontur__
263
 
264
	and [instrument_used],0
265
	jmp still
266
 
267
	no_kontur__:
268
 
269
	call TakeButtonInstruments
270
	jmp still
271
;---------------------------------------------
272
;-------------interraction MOUSE--------------
273
;---------------------------------------------
274
mouse:
275
 
276
	call GetMouseCoordinats
277
 
278
	;panel
279
	mov edx,[Window_SizeX]
280
	sub edx,5
281
 
282
	cmp ebx,20
283
	jle no_panel
284
 
285
	cmp ebx,20+15
286
	jae no_panel
287
 
288
	cmp eax,5
289
	jle no_panel
290
 
291
	cmp eax,edx ;585
292
	jae no_panel
293
 
294
	call GetMouseCoordinats
295
 
296
	mov [counter],7
297
	mov edi,panel_text
298
	call panel_interraction
299
 
300
	jmp still
301
	no_panel:
302
 
303
	cmp [Panel_flag],0
304
	jz no_redraw_panel
305
 
306
	mov [counter],7
307
	mov edi,panel_text
308
	call panel_interraction
309
 
310
	no_redraw_panel:
311
 
312
	call GetMouseCoordinats
313
	mov eax,[MouseX]
314
	mov ebx,[MouseY]
315
	mov ecx,[WorkScreen_SizeX]
316
	mov edx,[WorkScreen_SizeY]
317
	add ecx,9
318
	add edx,85
319
 
320
	cmp eax,ecx
321
	jae mouse_scroll
322
 
323
	cmp ebx,edx
324
	jae mouse_scroll
325
 
326
	jmp no_scrollers
327
 
328
	mouse_scroll:
329
 
330
	mov [exit_from_work_arrea],1  ;mouse situated after work arrea
331
 
332
	;scrollers
333
	call GetMouseClick
334
 
335
	cmp eax,1
336
	jne no_click
337
 
338
	call GetMouseCoordinats
339
	;interraction with horizontal scroller
340
	mov eax,[Scroll1CoordinatX]
341
	mov ebx,[Scroll1CoordinatY]
342
	mov ecx,[MouseX]
343
	mov edx,[MouseY]
344
	mov esi,[Scroll1MaxSizeX]
345
	mov edi,[Scroll1MaxSizeY]
346
	call columnus
347
 
348
	test eax,eax
349
	jz no_horizontal
350
 
351
 
352
	mov eax,9
353
	mov ebx,[Scroll1CoordinatY]
354
	mov ecx,[Scroll1MaxSizeX]
355
	mov edx,14+10
356
	mov esi,7
357
	inc ecx
358
	call draw_volume_rectangle
359
 
360
	mov eax,[MouseX]
361
	mov ebx,[Scroll1SizeX]
362
	shr ebx,1
363
	sub eax,ebx
364
	mov ecx,[MouseX]
365
	add ecx,ebx
366
	mov edx,8+1
367
	add edx,[Scroll1MaxSizeX]
368
	mov [Scroll1CoordinatX],eax
369
 
370
	sub eax,9
371
	jns no_min_scroll
372
 
373
	mov [Scroll1CoordinatX],9
374
 
375
	no_min_scroll:
376
 
377
	cmp ecx,edx
378
	jl no_max_scroll
379
 
380
	sub edx,ebx
381
	sub edx,ebx
382
	mov [Scroll1CoordinatX],edx
383
 
384
	no_max_scroll:
385
	;
386
	mov eax,[Scroll1CoordinatX]
387
	sub eax,9
388
	mov ebx,[Picture_SizeX]
389
	imul eax,ebx
390
	mov ebx,[Scroll1MaxSizeX]
391
	cdq
392
	idiv ebx
393
	mov [PosX],eax
394
 
395
	jmp no_vertical
396
 
397
	no_horizontal:
398
 
399
	mov eax,[Scroll2CoordinatX]
400
	mov ebx,[Scroll2CoordinatY]
401
	mov ecx,[MouseX]
402
	mov edx,[MouseY]
403
	mov esi,[Scroll2MaxSizeX]
404
	mov edi,[Scroll2MaxSizeY]
405
	call columnus
406
 
407
	test eax,eax
408
	jz no_vertical
409
 
410
	mov eax,[Scroll2CoordinatX]
411
	mov ebx,85
412
	mov ecx,14+10
413
	mov edx,[Scroll2MaxSizeY]
414
	mov esi,7
415
	inc edx
416
	call draw_volume_rectangle
417
 
418
	mov eax,[MouseY]
419
	mov ebx,[Scroll2SizeY]
420
	shr ebx,1
421
	sub eax,ebx
422
	mov ecx,[MouseY]
423
	add ecx,ebx
424
	mov edx,85
425
	add edx,[Scroll2MaxSizeY]
426
	mov [Scroll2CoordinatY],eax
427
 
428
	sub eax,85
429
	jns no_min_scroll2
430
 
431
	mov [Scroll2CoordinatY],85
432
 
433
	no_min_scroll2:
434
 
435
	cmp ecx,edx
436
	jl no_max_scroll2
437
 
438
	sub edx,ebx
439
	sub edx,ebx
440
	mov [Scroll2CoordinatY],edx
441
 
442
	no_max_scroll2:
443
	;
444
	mov eax,[Scroll2CoordinatY]
445
	sub eax,85
446
	mov ebx,[Picture_SizeY]
447
	imul eax,ebx
448
	mov ebx,[Scroll2MaxSizeY]
449
	cdq
450
	idiv ebx
451
	mov [PosY],eax
452
 
453
	no_vertical:
454
 
455
	call CalculatePositionScreen
456
 
457
	call draw_scrollers
458
	call MovePictureToWorkScreen
459
 
460
	no_click:
461
 
462
	jmp still
463
	no_scrollers:
464
 
465
 
466
	mov eax,[MouseX]
467
	mov ebx,[MouseY]
468
	mov ecx,[Window_SizeX]
469
	mov edx,[Window_SizeY]
470
	sub ecx,36
471
	sub edx,35
472
 
473
	cmp eax,9
474
	jle not_work_arrea
475
 
476
	cmp eax,ecx
477
	jae not_work_arrea
478
 
479
	cmp ebx,20+15+1+46
480
	jle not_work_arrea
481
 
482
	cmp ebx,edx
483
	jae not_work_arrea
484
 
485
	jmp mouse_in_work_arrea
486
 
487
	not_work_arrea:
488
 
489
	mov [exit_from_work_arrea],1
490
 
491
	jmp still
492
 
493
	mouse_in_work_arrea:
494
 
495
	call GetScreenCordinats
496
	call PrintMousePos
497
	call GetMouseClick
498
 
499
	test eax,eax
500
	jz no_use_instruments
501
 
502
	cmp [Activate_instrument],0
503
 
504
	jnz no_undo___
505
	;------------begin copy for undo-------------
506
	inc [number_undo]
507
 
508
	cmp [number_undo],1
509
	jne no_one__
510
 
511
	mov edi,[PointerToCopyPicture]
512
 
513
	no_one__:
514
 
515
	cmp [number_undo],2
516
	jne no_two__
517
 
518
	mov edi,[PointerToCopyPicture2]
519
 
520
	no_two__:
521
 
522
	cmp [number_undo],3
523
	jne no_three__
524
 
525
	;copy bufer number two to bufer number one
526
	mov esi,[PointerToCopyPicture2]
527
	mov edi,[PointerToCopyPicture]
528
	mov ecx,[Picture_SizeX]
529
	imul ecx,[Picture_SizeY]
530
	lea ecx,[ecx+ecx*2]
531
	add ecx,4
532
	shr ecx,2
533
	inc ecx
534
	cld
535
	rep movsd
536
	;end copy
537
	dec [number_undo]
538
	mov edi,[PointerToCopyPicture2]
539
 
540
	no_three__:
541
 
542
	mov esi,[PointerToPicture]
543
	mov ecx,[Picture_SizeX]
544
	imul ecx,[Picture_SizeY]
545
	lea ecx,[ecx+ecx*2]
546
	add ecx,4
547
	shr ecx,2
548
	inc ecx
549
	cld
550
	rep movsd
551
	;--------------end copy for undo-------------
552
	no_undo___:
553
 
554
	call TakeButtonInstruments
555
	no_use_instruments:
556
 
557
	mov eax,[Current_instrument]
558
	and [Activate_instrument],0
559
 
560
	jmp still
561
;-----------------------------------------------
562
;---------get mouse cordinats-------------------
563
;-----------------------------------------------
564
GetMouseCoordinats:
565
 
566
	mov eax,37
567
	mov ebx,1
568
	int 0x40
569
 
570
	mov ebx,eax
571
	shr eax,16
572
	and ebx,0xffff
573
 
574
	mov [MouseX],eax
575
	mov [MouseY],ebx
576
 
577
	ret
578
;------------------------------------------------
579
;-------get mouse attributs----------------------
580
;------------------------------------------------
581
GetMouseClick:
582
	 mov eax,37
583
	 mov ebx,2
584
	 int 0x40
585
 
586
	 ret
587
;-------------------------------------------------
588
;-----interraction panel with user----------------
589
;-------------------------------------------------
590
panel_interraction:
591
	;>>>>>>>>>>>>>>>>>>>>>>>>>>
592
	mov eax,18
593
	mov ebx,14
594
	int 0x40
595
 
596
	and [Panel_flag],0
597
	;collision with text on panel
598
      next_columnus_text:
599
 
600
	mov eax,[edi]
601
	mov ebx,[edi+4]
602
	sub eax,10
603
	sub ebx,3
604
	mov [Icon_text_x],eax
605
	mov [Icon_text_y],ebx
606
	mov esi,[edi+8]
607
	add edi,esi
608
	add edi,3*4
609
	mov ecx,[MouseX]
610
	mov edx,[MouseY]
611
	push edi
612
	mov edi,13
613
	mov esi,80
614
	call columnus
615
 
616
	pop edi
617
	mov esi,7
618
 
619
	test eax,eax
620
	jz no_columnus_text
621
 
622
	mov esi,1
623
	mov [Panel_flag],1
624
	call GetMouseClick
625
 
626
	test eax,eax
627
	jz no_mouse_pressed
628
 
629
	call print_panel_menu
630
 
631
	no_mouse_pressed:
632
 
633
	no_columnus_text:
634
 
635
	mov eax,[Icon_text_x]
636
	mov ebx,[Icon_text_y]
637
	mov ecx,79
638
	mov edx,13
639
	call draw_volume_rectangle
640
 
641
	push [counter]
642
	push edi
643
	mov [counter],7
644
	mov edi,panel_text
645
	call print_panel_text
646
 
647
	pop edi
648
	pop [counter]
649
	dec [counter]
650
	jnz next_columnus_text
651
 
652
	ret
653
;---------------------------------------------------------
654
;-----draw panel menu(main engin of panel)----------------
655
;---------------------------------------------------------
656
print_panel_menu:
657
 
658
 
659
	push [counter]
660
	;delit icon buttons(some time)
661
	mov [counter],10
662
	next_icon_delit:
663
	mov eax,8
664
	mov edx,[counter]
665
	add edx,11100000000000000000000000000000b
666
	int 0x40
667
	inc [counter]
668
 
669
	cmp [counter],30
670
	jl next_icon_delit
671
 
672
	pop [counter]
673
 
674
	push esi
675
	mov esi,[counter]
676
	dec esi
677
	shl esi,4
678
 
679
	mov eax,[menu_rectangles+esi]
680
	mov ebx,[menu_rectangles+esi+4]
681
	mov ecx,[menu_rectangles+esi+8]
682
	mov edx,[menu_rectangles+esi+12]
683
	mov esi,1
684
	mov [menu_coordinat_x],eax
685
	mov [menu_size_x],ecx
686
	call draw_volume_rectangle
687
	pop esi
688
 
689
    calculate_counter_menu:
690
 
691
 
692
	;calculate menu counter
693
	mov eax,[counter]
694
	dec eax
695
	shl eax,2
696
	mov ebx,[menu_counters+eax]
697
	mov [counter_menu],ebx
698
 
699
	call GetMouseCoordinats
700
 
701
	and [menu_counter],0
702
	push esi
703
	push edi
704
	;ᣫ ¦¨¢ ­¨¥  ­¨¬ æ¨¨ >>>>>>>>>>>>>>>>>>
705
	mov eax,18
706
	mov ebx,14
707
	int 0x40
708
 
709
    menu_loop:
710
 
711
	mov eax,[menu_coordinat_x]
712
	mov ebx,36
713
	mov ecx,[MouseX]
714
	mov edx,[MouseY]
715
	mov esi,[menu_size_x]
716
	mov edi,18
717
	add ebx,[menu_counter]
718
	add eax,2
719
	sub esi,3
720
	inc ebx
721
	call columnus
722
	mov esi,7
723
 
724
	test eax,eax
725
	jz no_columnus_menu_text
726
 
727
	mov esi,1
728
 
729
	no_columnus_menu_text:
730
 
731
	mov eax,[menu_coordinat_x]
732
	mov ebx,36
733
	mov ecx,[menu_size_x]
734
	mov edx,18
735
	add ebx,[menu_counter]
736
	add eax,2
737
	sub ecx,3
738
	inc ebx
739
	call draw_volume_rectangle
740
	add [menu_counter],20
741
 
742
 
743
	dec [counter_menu]
744
	jnz menu_loop
745
 
746
	;print menu text
747
	push [counter]
748
	mov esi,[counter]
749
	dec esi
750
	shl esi,2
751
	mov edi,[menu_text_en+esi]
752
	mov eax,[menu_counters+esi]
753
	mov [counter],eax
754
	call print_panel_text
755
	pop [counter]
756
	pop edi
757
	pop esi
758
 
759
 
760
	menu_still:
761
 
762
	mov eax,10
763
	int 0x40
764
	mov eax,2
765
	int 0x40
766
	mov eax,17
767
	int 0x40
768
 
769
	call GetMouseClick
770
 
771
	test eax,eax
772
	jz calculate_counter_menu
773
 
774
	call GetMouseCoordinats
775
 
776
	;calculate menu counter
777
	mov eax,[counter]
778
	dec eax
779
	shl eax,2
780
	mov ebx,[menu_counters+eax]
781
	mov [counter_menu],ebx
782
 
783
	and [menu_counter],0
784
	and [counter_11],0
785
 
786
	push esi
787
	push edi
788
 
789
    menu_loop2:
790
 
791
 
792
	mov eax,[menu_coordinat_x]
793
	mov ebx,36
794
	mov ecx,[MouseX]
795
	mov edx,[MouseY]
796
	mov esi,[menu_size_x]
797
	mov edi,18
798
	add ebx,[menu_counter]
799
	add eax,2
800
	sub esi,3
801
	inc ebx
802
	call columnus
803
 
804
	inc [counter_11]
805
 
806
	test eax,eax
807
	jz no_columnus_menu_text2
808
 
809
	mov esi,[counter_11]
810
	mov [number_menu],esi
811
 
812
	no_columnus_menu_text2:
813
 
814
	add [menu_counter],20
815
 
816
	dec [counter_menu]
817
	jnz menu_loop2
818
 
819
	pop edi
820
	pop esi
821
 
822
	mov eax,5
823
	mov ebx,15
824
	int 0x40
825
 
826
	push [counter]
827
	pushad
828
 
829
	call drawwin
830
 
831
	popad
832
	pop [counter]
833
 
834
	mov eax,[counter]
835
	mov [number_panel],eax
836
 
837
	call TakeInstruments
838
	jmp still
839
 
840
;---------------------------------------------------------
841
;------print mouse position on panel----------------------
842
;---------------------------------------------------------
843
PrintMousePos:
844
 
845
	pushad
846
 
847
	mov eax,385
848
	mov ebx,20+15+6
849
	mov ecx,52
850
	mov edx,18
851
	mov esi,4
852
	call draw_volume_rectangle
853
 
854
	mov eax,385
855
	mov ebx,20+15+6+18+1
856
	mov ecx,52
857
	mov edx,18
858
	mov esi,4
859
	call draw_volume_rectangle
860
 
861
	mov eax,390
862
	mov ebx,20+15+6+6
863
	and ecx,0
864
	mov edx,mouse_pos_x
865
	mov esi,2
866
	call print_text
867
 
868
	mov eax,390
869
	mov ebx,20+15+6+6+18+1
870
	and ecx,0
871
	mov edx,mouse_pos_y
872
	mov esi,2
873
	call print_text
874
 
875
	mov eax,47
876
	mov ebx,4*65536
877
	mov ecx,[ScreenX]
878
	add ecx,[PosX]
879
	mov edx,405*65536+20+15+6+6
880
	and esi,0
881
	int 0x40
882
 
883
	mov eax,47
884
	mov ebx,4*65536
885
	mov ecx,[ScreenY]
886
	add ecx,[PosY]
887
	mov edx,405*65536+20+15+6+18+1+6
888
	and esi,0
889
	int 0x40
890
 
891
	popad
892
	ret
893
 
894
;---------------------------------------------------------
895
;---------- get time in 1/100 secunds---------------------
896
;---------------------------------------------------------
897
Clock:
898
	  mov eax,26
899
	  mov ebx,9
900
	  int 0x40
901
	  mov [time],eax
902
	  ret
903
;----------------------------------------------------------
904
;-------------draw window of program-----------------------
905
;----------------------------------------------------------
906
drawwin:
907
 
908
	mov eax,12
909
	mov ebx,1
910
	int 0x40
911
 
912
	and eax,0
913
	mov ebx,[Window_CordinatX]
914
	mov ecx,[Window_CordinatY]
915
	shl ebx,16
916
	shl ecx,16
917
	add ebx,[Window_SizeX]
918
	add ecx,[Window_SizeY]
919
	mov edx,0x03aabbcc
920
	mov esi,0x805080d0
921
	mov edi,0x005080d0
922
	int 0x40
923
 
924
	call draw_panel
925
	call PrintMousePos
926
 
927
	mov [counter],7
928
	mov edi,panel_text
929
	call print_panel_text
930
 
931
	mov eax,10
932
	mov ebx,5
933
	mov ecx,0xffffff
934
	mov edx,name_of_program
935
	mov esi,34
936
	call print_text
937
 
938
	mov eax,13
939
	mov ebx,447*65536+35
940
	mov ecx,42*65536+36
941
	mov edx,[Color]
942
	int 0x40
943
 
944
	mov eax,12
945
	mov ebx,2
946
	int 0x40
947
 
948
	mov eax,9
949
	mov ebx,IPC_table
950
	or ecx,-1
951
	int 0x40
952
 
953
	mov eax,[IPC_table+34]
954
	mov ebx,[IPC_table+38]
955
	mov ecx,[IPC_table+42]
956
	mov edx,[IPC_table+46]
957
	mov [Window_CordinatX],eax
958
	mov [Window_CordinatY],ebx
959
	mov [Window_SizeX],ecx
960
	mov [Window_SizeY],edx
961
 
962
	cmp [Window_SizeX],585
963
	jae no_minimum_size_x
964
 
965
	mov [Window_SizeX],585
966
	mov ecx,[Window_SizeX]
967
 
968
	no_minimum_size_x:
969
 
970
	cmp [Window_SizeY],320
971
	jae no_minimum_size_y
972
 
973
	mov [Window_SizeY],320
974
	mov edx,[Window_SizeY]
975
 
976
	no_minimum_size_y:
977
 
978
	mov [MaxWorkScreen_SizeX],ecx
979
	mov [MaxWorkScreen_SizeY],edx
980
	sub [MaxWorkScreen_SizeX],20+10+5+10
981
	sub [MaxWorkScreen_SizeY],20+10+15+1+45+20+10
982
 
983
	cmp [MaxWorkScreen_SizeX],0
984
	jns no_znak1
985
 
986
	mov [MaxWorkScreen_SizeX],ecx
987
 
988
	no_znak1:
989
	cmp [MaxWorkScreen_SizeY],0
990
	jns no_znak2
991
 
992
	mov [MaxWorkScreen_SizeY],ecx
993
 
994
	no_znak2:
995
 
996
	mov ecx,[k]
997
 
998
	and [PosX],0
999
	and [PosY],0
1000
	call MovePictureToWorkScreen
1001
	call draw_scrollers
1002
	call draw_icons
1003
 
1004
	ret
1005
;----------------------------------------------------------
1006
;---------------draw panel in window of program------------
1007
;----------------------------------------------------------
1008
draw_panel:
1009
 
1010
	mov eax,5
1011
	mov ebx,20
1012
	mov ecx,[Window_SizeX]
1013
	mov edx,15
1014
	mov esi,6
1015
	sub ecx,10
1016
	call draw_volume_rectangle
1017
 
1018
	mov eax,5
1019
	mov ebx,20
1020
	mov ecx,[Window_SizeX]
1021
	mov edx,15
1022
	mov esi,6
1023
	sub ecx,10
1024
	call draw_volume_rectangle
1025
 
1026
	mov eax,5
1027
	mov ebx,20+15+1
1028
	mov ecx,[Window_SizeX]
1029
	mov edx,46
1030
	mov esi,1
1031
	sub ecx,10
1032
	call draw_volume_rectangle
1033
 
1034
	mov eax,5
1035
	mov ebx,20+15+1+46+1
1036
	mov ecx,[Window_SizeX]
1037
	mov edx,[Window_SizeY]
1038
	mov esi,1
1039
	sub ecx,10+20
1040
	sub edx,20+15+1+46+1+5+20
1041
	call draw_volume_rectangle
1042
 
1043
	mov eax,5
1044
	mov ebx,[Window_SizeY]
1045
	mov ecx,[Window_SizeX]
1046
	mov edx,20+10
1047
	mov esi,3
1048
	sub ecx,30
1049
	sub ebx,25+10
1050
	call draw_volume_rectangle
1051
 
1052
	mov eax,[Window_SizeX]
1053
	mov ebx,20+15+1+45+2
1054
	mov ecx,20+10
1055
	mov edx,[Window_SizeY]
1056
	mov esi,3
1057
	sub eax,25+10
1058
	sub edx,20+15+1+45+5+20
1059
	call draw_volume_rectangle
1060
 
1061
	mov eax,[Window_SizeX]
1062
	mov ebx,[Window_SizeY]
1063
	mov ecx,20+10
1064
	mov edx,20+10
1065
	mov esi,6
1066
	sub eax,25+10
1067
	sub ebx,25+10
1068
	call draw_volume_rectangle
1069
 
1070
	mov eax,445
1071
	mov ebx,20+15+6
1072
	mov ecx,37
1073
	mov edx,37
1074
	mov esi,4
1075
	call draw_volume_rectangle
1076
 
1077
	ret
1078
;----------------------------------------------------------
1079
;---------------------system events------------------------
1080
;----------------------------------------------------------
1081
event:
1082
	mov eax,10
1083
	int 0x40
1084
	ret
1085
 
1086
;----------------------------------------------------------
1087
;----------print text on the panel and menu----------------
1088
;----------------------------------------------------------
1089
print_panel_text:
1090
       next_panel_text:
1091
 
1092
	mov eax,[edi]
1093
	mov ebx,[edi+4]
1094
	xor ecx,ecx
1095
	mov edx,edi
1096
	add edx,12
1097
	mov esi,[edi+8]
1098
	add edi,esi
1099
	add edi,3*4
1100
 
1101
	push edi
1102
	call print_text
1103
	pop edi
1104
 
1105
	dec [counter]
1106
	jnz next_panel_text
1107
	ret
1108
;----------------------------------------------------------
1109
;--------Move picture from array to work screeen-----------
1110
;----------------------------------------------------------
1111
MovePictureToWorkScreen:
1112
 
1113
	call cleare_screen
1114
 
1115
	mov eax,[Picture_SizeX]
1116
	mov ebx,[Picture_SizeY]
1117
	mov ecx,[MaxWorkScreen_SizeX]
1118
	mov edx,[MaxWorkScreen_SizeY]
1119
	mov esi,[k]
1120
	imul eax,esi
1121
	imul ebx,esi
1122
 
1123
	cmp eax,ecx
1124
	jle lab1
1125
	mov eax,[MaxWorkScreen_SizeX]
1126
	mov [WorkScreen_SizeX],eax
1127
	jmp lab2
1128
	lab1:
1129
	mov [WorkScreen_SizeX],eax
1130
	lab2:
1131
 
1132
	cmp ebx,edx
1133
	jle lab3
1134
	mov ebx,[MaxWorkScreen_SizeY]
1135
	mov [WorkScreen_SizeY],ebx
1136
	jmp lab4
1137
	lab3:
1138
	mov [WorkScreen_SizeY],ebx
1139
	lab4:
1140
 
1141
	mov eax,[WorkScreen_SizeX]
1142
	mov ebx,[k]
1143
	cdq
1144
	idiv ebx
1145
	mov [CounterX],eax
1146
	mov eax,[WorkScreen_SizeY]
1147
	cdq
1148
	idiv ebx
1149
	mov [CounterY],eax
1150
 
1151
	mov eax,[WorkScreen_SizeX]
1152
	mov ecx,eax
1153
	mov ebx,[k]
1154
	cdq
1155
	idiv ebx
1156
	imul eax,ebx
1157
	sub ecx,eax
1158
	lea ecx,[ecx+ecx*2]
1159
	;
1160
	mov eax,[WorkScreen_SizeX]
1161
	mov ebx,[k]
1162
	dec ebx
1163
	imul eax,ebx
1164
	lea eax,[eax+eax*2]
1165
	add eax,ecx
1166
	mov [OffsetYWorkScreen],eax
1167
 
1168
 
1169
	mov ebx,[Picture_SizeX]
1170
	mov eax,[CounterX]
1171
	sub ebx,eax
1172
	lea ebx,[ebx+ebx*2]
1173
	mov [OffsetYPicture],ebx
1174
 
1175
	mov eax,[WorkScreen_SizeX]
1176
	mov ebx,[k]
1177
	sub eax,ebx
1178
	lea eax,[eax+eax*2]
1179
	mov [OffsetYBigPixel],eax
1180
 
1181
	mov eax,[PosX]
1182
	mov ebx,[PosY]
1183
	mov ecx,[Picture_SizeX]
1184
	imul ecx,ebx
1185
	add eax,ecx
1186
	lea eax,[eax+eax*2]
1187
	add eax,[PointerToPicture]
1188
 
1189
 
1190
	mov ebx,[ScreenPointer]
1191
 
1192
	mov edi,[CounterY]
1193
 
1194
	;if size of picture natural(mastab is 1) than move picture to work screen
1195
	cmp [k],1
1196
	jne no_zoom_1_
1197
	screen_y_1:
1198
	    mov esi,[CounterX]
1199
	    screen_x_1:
1200
	      mov ecx,[eax]
1201
	      and ecx,0xffffff
1202
	      mov ebp,ecx
1203
	      shr ecx,16
1204
		   mov [ebx],bp
1205
		   mov [ebx+2],cl
1206
	      add ebx,3;
1207
	      add eax,3
1208
	    dec esi
1209
	    jnz screen_x_1
1210
	    add eax,[OffsetYPicture]
1211
	    add ebx,[OffsetYWorkScreen]
1212
	dec edi
1213
	jnz screen_y_1
1214
	jmp fps
1215
	no_zoom_1_:
1216
 
1217
	cmp [k],2
1218
	jne no_zoom_2
1219
 
1220
	screen_y_2:
1221
	    mov esi,[CounterX]
1222
	    screen_x_2:
1223
	      mov ecx,[eax]
1224
	      and ecx,0xffffff
1225
	      mov ebp,ecx
1226
	      shr ecx,16
1227
	      mov edx,ebx
1228
		   mov [edx],bp
1229
		   mov [edx+2],cl
1230
		   mov [edx+3],bp
1231
		   mov [edx+3+2],cl
1232
		   add edx,3*2
1233
		   add edx,[OffsetYBigPixel]
1234
		   mov [edx],bp
1235
		   mov [edx+2],cl
1236
		   mov [edx+3],bp
1237
		   mov [edx+3+2],cl
1238
		   add edx,3*2
1239
		   add edx,[OffsetYBigPixel]
1240
	      add ebx,3*2
1241
	      add eax,3
1242
	    dec esi
1243
	    jnz screen_x_2
1244
	    add eax,[OffsetYPicture]
1245
	    add ebx,[OffsetYWorkScreen]
1246
	dec edi
1247
	jnz screen_y_2
1248
	jmp fps
1249
	no_zoom_2:
1250
 
1251
	cmp [k],4
1252
	jne no_zoom_4
1253
	screen_y_4:
1254
	    mov esi,[CounterX]
1255
	    screen_x_4:
1256
	      mov ecx,[eax]
1257
	      and ecx,0xffffff
1258
	      mov ebp,ecx
1259
	      shr ecx,16
1260
	      mov edx,ebx
1261
		   mov [edx],bp
1262
		   mov [edx+2],cl
1263
		   mov [edx+3],bp
1264
		   mov [edx+3+2],cl
1265
		   mov [edx+6],bp
1266
		   mov [edx+6+2],cl
1267
		   mov [edx+9],bp
1268
		   mov [edx+9+2],cl
1269
		   add edx,3*4
1270
		   add edx,[OffsetYBigPixel]
1271
		   mov [edx],bp
1272
		   mov [edx+2],cl
1273
		   mov [edx+3],bp
1274
		   mov [edx+3+2],cl
1275
		   mov [edx+6],bp
1276
		   mov [edx+6+2],cl
1277
		   mov [edx+9],bp
1278
		   mov [edx+9+2],cl
1279
		   add edx,3*4
1280
		   add edx,[OffsetYBigPixel]
1281
		   mov [edx],bp
1282
		   mov [edx+2],cl
1283
		   mov [edx+3],bp
1284
		   mov [edx+3+2],cl
1285
		   mov [edx+6],bp
1286
		   mov [edx+6+2],cl
1287
		   mov [edx+9],bp
1288
		   mov [edx+9+2],cl
1289
		   add edx,3*4
1290
		   add edx,[OffsetYBigPixel]
1291
		   mov [edx],bp
1292
		   mov [edx+2],cl
1293
		   mov [edx+3],bp
1294
		   mov [edx+3+2],cl
1295
		   mov [edx+6],bp
1296
		   mov [edx+6+2],cl
1297
		   mov [edx+9],bp
1298
		   mov [edx+9+2],cl
1299
		   add edx,3*4
1300
		   add edx,[OffsetYBigPixel]
1301
	      add ebx,4*3
1302
	      add eax,3
1303
	    dec esi
1304
	    jnz screen_x_4
1305
	    add eax,[OffsetYPicture]
1306
	    add ebx,[OffsetYWorkScreen]
1307
	dec edi
1308
	jnz screen_y_4
1309
	jmp fps
1310
	no_zoom_4:
1311
	;if zoom more than 4
1312
	screen_y:
1313
	    mov esi,[CounterX]
1314
	    screen_x:
1315
	      mov ecx,[eax]
1316
	      and ecx,0xffffff
1317
	      mov ebp,ecx
1318
	      shr ecx,16
1319
	      push ebx
1320
	      push eax
1321
	      mov edx,[k]
1322
	      big_pixel_y:
1323
		 mov eax,[k]
1324
		 big_pixel_x:
1325
		   mov [ebx],bp
1326
		   mov [ebx+2],cl
1327
		   add ebx,3
1328
		 dec eax
1329
		 jnz big_pixel_x
1330
		 add ebx,[OffsetYBigPixel]
1331
	      dec edx
1332
	      jnz big_pixel_y
1333
	      pop eax
1334
	      pop ebx
1335
	      mov edx,[k]
1336
	      lea edx,[edx+edx*2]
1337
	      add ebx,edx
1338
	      add eax,3
1339
	    dec esi
1340
	    jnz screen_x
1341
	    add eax,[OffsetYPicture]
1342
	    add ebx,[OffsetYWorkScreen]
1343
	dec edi
1344
	jnz screen_y
1345
 
1346
	 fps:
1347
	 mov eax,18
1348
	 mov ebx,14
1349
	 int 0x40
1350
 
1351
	 mov eax,7
1352
	 mov ebx,[ScreenPointer]
1353
	 mov ecx,[WorkScreen_SizeX]
1354
	 mov edx,[WorkScreen_SizeY]
1355
	 shl ecx,16
1356
	 add ecx,edx
1357
	 mov edx,8*65536+20+15+45+5
1358
	 int 0x40
1359
 
1360
	 ret
1361
;----------------------------------------------------------
1362
;--------------------clear screen--------------------------
1363
;----------------------------------------------------------
1364
cleare_screen:
1365
 
1366
	mov eax,[ScreenPointer]
1367
	mov ebx,[WorkScreen_SizeX]
1368
	imul ebx,[WorkScreen_SizeY]
1369
	lea ebx,[ebx+ebx*2]
1370
	shr ebx,3
1371
	inc ebx
1372
	mov esi,0xffffff
1373
 
1374
	clear_screen_loop:
1375
 
1376
	  mov [eax],esi
1377
	  mov [eax+3],esi
1378
	  mov [eax+6],si
1379
	  add eax,4+4
1380
 
1381
	dec ebx
1382
	jnz clear_screen_loop
1383
	ret
1384
;----------------------------------------------------------
1385
;-------------cleare work arrea(work screen)---------------
1386
;----------------------------------------------------------
1387
cleare_work_arrea:
1388
 
1389
	mov eax,[PointerToPicture]
1390
	mov ebx,[Picture_SizeX]
1391
	imul ebx,[Picture_SizeY]
1392
	lea ebx,[ebx+ebx*2]
1393
	shr ebx,3
1394
	inc ebx
1395
	mov esi,0xffffff
1396
 
1397
	clear_work_arrea_loop:
1398
 
1399
	  mov [eax],esi
1400
	  mov [eax+3],esi
1401
	  mov [eax+6],si
1402
	  add eax,4+4
1403
 
1404
	dec ebx
1405
	jnz clear_work_arrea_loop
1406
	ret
1407
;----------------------------------------------------------
1408
;------------draw lines of scoll---------------------------
1409
;----------------------------------------------------------
1410
draw_scrollers:
1411
 
1412
	 mov edi,[CounterX]
1413
	 mov eax,[Scroll1CoordinatX]
1414
	 mov ebx,[Window_SizeY]
1415
	 sub ebx,22+10
1416
	 mov ecx,[Window_SizeX]
1417
	 sub ecx,10+5+20+10+1
1418
	 mov edx,14+10
1419
	 mov esi,1
1420
	 mov [Scroll1CoordinatX],eax
1421
	 mov [Scroll1CoordinatY],ebx
1422
	 mov [Scroll1MaxSizeY],edx
1423
	 mov [Scroll1MaxSizeX],ecx
1424
	 imul ecx,edi
1425
	 push eax
1426
	 push ebx
1427
	 push edx
1428
	 mov eax,ecx
1429
	 mov ebx,[Picture_SizeX]
1430
	 cdq
1431
	 idiv ebx
1432
	 mov ecx,eax
1433
	 pop edx
1434
	 pop ebx
1435
	 pop eax
1436
	 mov [Scroll1SizeX],ecx
1437
	 mov edi,[Scroll1MaxSizeX]
1438
	 sub edi,ecx
1439
	 mov [Scroll1FreeX],edi
1440
	 call draw_volume_rectangle
1441
 
1442
	 mov eax,[Window_SizeX]
1443
	 sub eax,22+10
1444
	 mov ebx,[Scroll2CoordinatY]
1445
	 mov ecx,14+10
1446
	 mov edx,[Window_SizeY]
1447
	 sub edx,20+15+1+46+10+20+11
1448
	 mov esi,1
1449
	 mov [Scroll2CoordinatX],eax
1450
	 mov [Scroll2CoordinatY],ebx
1451
	 mov [Scroll2MaxSizeX],ecx
1452
	 mov [Scroll2MaxSizeY],edx
1453
 
1454
	 imul edx,[CounterY]
1455
	 push eax
1456
	 push ebx
1457
	 mov eax,edx
1458
	 mov ebx,[Picture_SizeY]
1459
	 cdq
1460
	 idiv ebx
1461
	 mov edx,eax
1462
	 pop ebx
1463
	 pop eax
1464
	 mov [Scroll2SizeY],edx
1465
	 mov edi,[Scroll2MaxSizeY]
1466
	 sub edi,edx
1467
	 mov [Scroll2FreeY],edi
1468
 
1469
	 call draw_volume_rectangle
1470
 
1471
	 ret
1472
;----------------------------------------------------------
1473
;--------change size of memory which use program-----------
1474
;----------------------------------------------------------
1475
GetMemory:
1476
	 pushad
1477
	 mov eax,64
1478
	 mov ebx,1
1479
	 mov ecx,[Picture_SizeX]
1480
	 mov edx,[Picture_SizeY]
1481
	 imul ecx,edx
1482
	 lea ecx,[ecx+ecx*2]
1483
	 lea ecx,[ecx+ecx*4]		;(Picture_SizeX*Picture_SizeY*3)*5
1484
	 add ecx,[ScreenPointer]
1485
	 add ecx,(1200*1000)*3+30*(20*20*3)+500000+16000+0x4000
1486
	 add ecx,[extended_memory]
1487
	 int 0x40
1488
 
1489
	 test eax,eax
1490
	 jz have_new_memory
1491
 
1492
	    mov esi,sound_havent_memory
1493
	    call sound
1494
 
1495
	    jmp still
1496
 
1497
	 have_new_memory:
1498
	 popad
1499
	 ret
1500
;-----------------------------------------------------------
1501
;-----------instruments of menu-----------------------------
1502
;-----------------------------------------------------------
1503
TakeInstruments:
1504
 
1505
	 ;|||||||||||||||||||FILE||||||||||||||||||||||
1506
	 cmp [number_panel],7
1507
	 jne no_file
1508
 
1509
	 ;<<<<>>>>>>
1510
	 cmp [number_menu],1
1511
	 jne no_new
1512
 
1513
	 mov eax,80
1514
	 mov ebx,100
1515
	 mov ecx,150
1516
	 mov edx,90
1517
	 mov  esi,1
1518
	 call draw_volume_rectangle
1519
 
1520
	 mov eax,177
1521
	 mov ebx,115
1522
	 mov ecx,40
1523
	 mov edx,14
1524
	 mov  esi,4
1525
	 call draw_volume_rectangle
1526
 
1527
	 mov eax,177
1528
	 mov ebx,115+24
1529
	 mov ecx,40
1530
	 mov edx,14
1531
	 mov  esi,4
1532
	 call draw_volume_rectangle
1533
 
1534
	 mov eax,175
1535
	 mov ebx,170
1536
	 mov ecx,40
1537
	 mov edx,15
1538
	 mov  esi,1
1539
	 call draw_volume_rectangle
1540
 
1541
	 mov eax,90
1542
	 mov ebx,118
1543
	 mov ecx,0xffffff
1544
	 mov edx,new_text1
1545
	 mov esi,14
1546
	 call print_text
1547
 
1548
	 mov eax,90
1549
	 mov ebx,118+24
1550
	 mov ecx,0xffffff
1551
	 mov edx,new_text2
1552
	 mov esi,14
1553
	 call print_text
1554
 
1555
	 mov eax,185
1556
	 mov ebx,175
1557
	 mov ecx,0xffffff
1558
	 mov edx,ok_text
1559
	 mov esi,2
1560
	 call print_text
1561
 
1562
	 mov eax,8
1563
	 mov ebx,177*65536+40
1564
	 mov ecx,115*65536+14
1565
	 mov edx,1000000000000000000000000000000b
1566
	 add edx,1000
1567
	 int 0x40
1568
 
1569
	 mov eax,8
1570
	 mov ebx,177*65536+40
1571
	 mov ecx,139*65536+14
1572
	 mov edx,1000000000000000000000000000000b
1573
	 add edx,1001
1574
	 int 0x40
1575
 
1576
	 mov eax,8
1577
	 mov ebx,175*65536+40
1578
	 mov ecx,170*65536+15
1579
	 mov edx,1000000000000000000000000000000b
1580
	 add edx,1002
1581
	 int 0x40
1582
 
1583
	 no_activate_space:
1584
 
1585
	 mov eax,10
1586
	 int 0x40
1587
 
1588
	 cmp eax,1
1589
	 je exit_new
1590
 
1591
	 cmp eax,3
1592
	 jne no_activate_space
1593
 
1594
	 mov eax,17
1595
	 int 0x40
1596
	 shr eax,8
1597
 
1598
	 cmp eax,1000
1599
	 jl no_activate_space
1600
 
1601
	 cmp eax,1000
1602
	 jne no_picture_size_x
1603
 
1604
	 mov eax,180
1605
	 mov ebx,119
1606
	 mov ecx,5
1607
	 call dialog_line
1608
 
1609
	 mov eax,string_
1610
	 mov ebx,13
1611
	 call find_symvol
1612
 
1613
	 dec eax
1614
	 mov [length_number],eax
1615
	 mov eax,string_
1616
	 call value
1617
 
1618
	 mov [Picture_SizeX],eax
1619
 
1620
	 jmp no_activate_space
1621
 
1622
	 no_picture_size_x:
1623
 
1624
	 cmp eax,1001
1625
	 jne no_picture_size_y
1626
 
1627
	 mov eax,180
1628
	 mov ebx,119+24
1629
	 mov ecx,5
1630
	 call dialog_line
1631
 
1632
	 mov eax,string_
1633
	 mov ebx,13
1634
	 call find_symvol
1635
 
1636
	 dec eax
1637
	 mov [length_number],eax
1638
	 mov eax,string_
1639
	 call value
1640
 
1641
	 mov [Picture_SizeY],eax
1642
 
1643
	 jmp no_activate_space
1644
 
1645
	 no_picture_size_y:
1646
 
1647
	 cmp eax,1002
1648
	 jne no_activate_space
1649
 
1650
	 exit_new:
1651
 
1652
	 mov eax,8
1653
	 mov ebx,175*65536+40
1654
	 mov ecx,170*65536+15
1655
	 mov edx,11100000000000000000000000000000b
1656
	 add edx,1002
1657
	 int 0x40
1658
 
1659
	 mov eax,8
1660
	 mov ebx,177*65536+40
1661
	 mov ecx,139*65536+14
1662
	 mov edx,11100000000000000000000000000000b
1663
	 add edx,1001
1664
	 int 0x40
1665
 
1666
	 mov eax,8
1667
	 mov ebx,177*65536+40
1668
	 mov ecx,115*65536+14
1669
	 mov edx,11100000000000000000000000000000b
1670
	 add edx,1000
1671
	 int 0x40
1672
 
1673
	 ;get memory for new picture
1674
	 mov eax,[Picture_SizeX]
1675
	 mov ebx,[Picture_SizeY]
1676
 
1677
	 imul eax,ebx
1678
	 lea eax,[eax+eax*2]
1679
 
1680
	 mov ebx,[ScreenPointer]
1681
	 add ebx,(1200*1000*3)+30*(20*20*3)+500000
1682
 
1683
	 mov [PointerToPicture],ebx
1684
	 mov [PointerToCopyPicture],ebx
1685
	 mov [PointerToCopyPicture2],ebx
1686
	 mov [PointerToEditBufer],ebx
1687
	 mov [PointerToSpriteBufer],ebx
1688
 
1689
	 add [PointerToCopyPicture],eax
1690
 
1691
	 add [PointerToCopyPicture2],eax
1692
	 add [PointerToCopyPicture2],eax
1693
 
1694
	 add [PointerToEditBufer],eax
1695
	 add [PointerToEditBufer],eax
1696
	 add [PointerToEditBufer],eax
1697
 
1698
	 add [PointerToSpriteBufer],eax
1699
	 add [PointerToSpriteBufer],eax
1700
	 add [PointerToSpriteBufer],eax
1701
	 add [PointerToSpriteBufer],eax
1702
 
1703
	 call GetMemory
1704
 
1705
	 and [save_flag],0
1706
	 and [number_panel],0
1707
	 and [number_menu],0
1708
 
1709
	 call cleare_work_arrea
1710
	 call drawwin
1711
 
1712
	 jmp still
1713
	 no_new:
1714
 
1715
	 ;<<<<>>>>>>
1716
	 cmp [number_menu],2
1717
	 jne no_open
1718
 
1719
	 opendialog drawwin,open_1,open_2,file_path
1720
	 open_1:
1721
 
1722
	 mov eax,40
1723
	 mov ebx,100111b
1724
	 int 0x40
1725
 
1726
	 mov eax,[ScreenPointer]
1727
	 add eax,0x10000
1728
	 mov [file_info],dword 0
1729
	 mov [file_info+8],dword 1
1730
	 mov [file_info+12],eax
1731
	 mov eax,58
1732
	 mov ebx,file_info
1733
	 int 0x40
1734
 
1735
	 mov esi,[ScreenPointer]
1736
	 add esi,0x10000
1737
	 ;-------------is this BMP file ?----------------
1738
	 xor eax,eax
1739
	 mov ax,[esi]
1740
	 mov [type],ax
1741
 
1742
	 cmp [type],word 'BM'
1743
	 jne no_bmp_file
1744
 
1745
	 xor eax,eax
1746
	 xor ebx,ebx
1747
	 mov eax,[esi+18]
1748
	 mov ebx,[esi+22]
1749
	 mov [Picture_SizeX],eax
1750
	 mov [Picture_SizeY],ebx
1751
 
1752
	 jmp exit_type
1753
 
1754
	 no_bmp_file:
1755
 
1756
	 ;-------------is this GIF file ?----------------
1757
	 xor eax,eax
1758
	 mov ax,[esi]
1759
	 mov [type],ax
1760
 
1761
	 cmp [type],'GI'
1762
	 jne no_gif_file
1763
 
1764
	 add esi,6
1765
	 xor eax,eax
1766
	 xor ebx,ebx
1767
	 mov ax,word[esi]
1768
	 mov bx,word[esi+2]
1769
	 mov [Picture_SizeX],eax
1770
	 mov [Picture_SizeY],ebx
1771
 
1772
	 jmp exit_type
1773
 
1774
	 no_gif_file:
1775
 
1776
	 jmp no_unpakcing_gif_file
1777
 
1778
	 exit_type:
1779
	 ;----------------------------------------------------------
1780
	 ;Get momory for unpacking picture and for picture's bufers
1781
	 ;----------------------------------------------------------
1782
	 mov eax,[Picture_SizeX]
1783
	 mov ebx,[Picture_SizeY]
1784
 
1785
	 imul eax,ebx
1786
	 lea eax,[eax+eax*2]
1787
 
1788
	 mov ebx,[ScreenPointer]
1789
	 add ebx,(1200*1000*3)+30*(20*20*3)+500000
1790
 
1791
	 mov [PointerToPicture],ebx
1792
	 mov [PointerToCopyPicture],ebx
1793
	 mov [PointerToCopyPicture2],ebx
1794
	 mov [PointerToEditBufer],ebx
1795
	 mov [PointerToSpriteBufer],ebx
1796
 
1797
	 add [PointerToCopyPicture],eax
1798
 
1799
	 add [PointerToCopyPicture2],eax
1800
	 add [PointerToCopyPicture2],eax
1801
 
1802
	 add [PointerToEditBufer],eax
1803
	 add [PointerToEditBufer],eax
1804
	 add [PointerToEditBufer],eax
1805
 
1806
	 add [PointerToSpriteBufer],eax
1807
	 add [PointerToSpriteBufer],eax
1808
	 add [PointerToSpriteBufer],eax
1809
	 add [PointerToSpriteBufer],eax
1810
 
1811
	 call GetMemory
1812
	 ;----------------------------------------------------------
1813
	 ;--------------------Load file in memory-------------------
1814
	 ;----------------------------------------------------------
1815
 
1816
	 mov eax,[PointerToCopyPicture]
1817
	 mov ebx,[ScreenPointer]
1818
	 add eax,1000
1819
	 mov [file_info],dword 0
1820
	 mov [file_info+8],dword 1
1821
	 mov [file_info+12],dword eax
1822
	 mov [file_info+16],dword ebx
1823
 
1824
	 call load_file
1825
 
1826
	 ;----------------------------------------------------------
1827
	 ;-------------------Unpacking picture----------------------
1828
	 ;----------------------------------------------------------
1829
	 mov esi,[PointerToCopyPicture]
1830
	 add esi,1000
1831
	 mov edi,[PointerToPicture]
1832
	 mov eax,[ScreenPointer]
1833
 
1834
	 cmp [type],'BM'
1835
	 jne no_unpakcing_bmp_file
1836
	    ;BMP DECODER
1837
	    call bmptoimg
1838
 
1839
	 no_unpakcing_bmp_file:
1840
 
1841
 
1842
	 cmp [type],'GI'
1843
	 jne no_unpakcing_gif_file
1844
	   ;GIF DECODER
1845
	   sub edi,12
1846
	   call ReadGIF
1847
 
1848
	 no_unpakcing_gif_file:
1849
 
1850
	 mov [Scroll1CoordinatX],9
1851
	 mov [Scroll2CoordinatY],85
1852
	 call load_icons
1853
	 call drawwin
1854
	 and [number_panel],0
1855
	 and [number_menu],0
1856
	 mov [save_flag],1
1857
 
1858
	 open_2:
1859
 
1860
	 jmp still
1861
 
1862
	 no_open:
1863
 
1864
	 ;<<<<<<<<<<>>>>>>>>>>>
1865
	 cmp [number_menu],3
1866
	 jne no_save_
1867
 
1868
	 mov al,[save_flag]
1869
 
1870
	 test al,al
1871
	 jz no_save_file
1872
 
1873
	 jmp save_enter
1874
 
1875
	 no_save_file:
1876
 
1877
	 and [number_panel],0
1878
	 and [number_menu],0
1879
 
1880
	 jmp still
1881
 
1882
	 no_save_:
1883
 
1884
	 ;<<<<<<<<>>>>>>>>>>
1885
	 cmp [number_menu],4
1886
	 jne no_save
1887
 
1888
	 savedialog drawwin,save1,save2,file_path
1889
 
1890
	 save1:
1891
 
1892
	 save_enter:
1893
	 mov eax,40
1894
	 mov ebx,100111b
1895
	 int 0x40
1896
 
1897
	 call analizing_picture_to_palette
1898
	 ;eax => number of colors in picture
1899
	 mov ebx,[PointerToPicture]
1900
	 mov ecx,[PointerToEditBufer]
1901
	 mov edx,[PointerToPalette]
1902
	 mov esi,[Picture_SizeX]
1903
	 mov edi,[Picture_SizeY]
1904
 
1905
	 call coding_bmp
1906
	 mov edi,[PointerToEditBufer]
1907
	 mov [file_info],dword 1
1908
	 mov [file_info+8],dword ebx
1909
	 mov [file_info+12],edi
1910
 
1911
	 mov eax,58
1912
	 mov ebx,file_info
1913
	 int 0x40
1914
 
1915
	 mov [save_flag],1
1916
	 and [number_panel],0
1917
	 and [number_menu],0
1918
	 call drawwin
1919
 
1920
	 jmp still
1921
 
1922
	 save2:
1923
 
1924
	 and [number_panel],0
1925
	 and [number_menu],0
1926
 
1927
	 jmp still
1928
	 no_save:
1929
 
1930
	 ;<<<<<>>>>>>
1931
	 cmp [number_menu],5
1932
	 jne no_exit_program
1933
 
1934
	 mov eax,-1
1935
	 int 0x40
1936
 
1937
	 no_exit_program:
1938
 
1939
	 no_file:
1940
 
1941
	 ;|||||||||||||||||||||||||||||EDIT|||||||||||||||||||||||||
1942
 
1943
	 ;<<<<<<<<<>>>>>>>>>
1944
	 cmp [number_panel],6
1945
	 jne no_edit
1946
 
1947
	 cmp [number_menu],1
1948
	 jne no_undo
1949
 
1950
	 cmp [number_undo],1
1951
	 jne no_one____
1952
 
1953
	 mov esi,[PointerToCopyPicture]
1954
 
1955
	 no_one____:
1956
 
1957
	 cmp [number_undo],2
1958
	 jne no_two____
1959
 
1960
	 mov esi,[PointerToCopyPicture2]
1961
 
1962
	 no_two____:
1963
 
1964
	 mov edi,[PointerToPicture]
1965
	 mov ecx,[Picture_SizeX]
1966
	 imul ecx,[Picture_SizeY]
1967
	 lea ecx,[ecx+ecx*2]
1968
	 add ecx,4
1969
	 shr ecx,2
1970
	 cld
1971
	 rep movsd
1972
	 call MovePictureToWorkScreen
1973
 
1974
	 dec [number_undo]
1975
	 jnz no_null_undo
1976
 
1977
	 mov [number_undo],1
1978
 
1979
	 no_null_undo:
1980
 
1981
	 and [number_panel],0
1982
	 and [number_menu],0
1983
	 jmp still
1984
	 no_undo:
1985
 
1986
	 ;<<<<<<<<<>>>>>>>>>
1987
 
1988
	 cmp [number_menu],2
1989
	 jne no_copy
1990
 
1991
	 cmp [instrument_used],1
1992
	 jne no_copy
1993
	 cmp [Activate_instrument],0
1994
	 jne no_copy
1995
 
1996
	mov eax,[OldX]
1997
	mov ebx,[OldY]
1998
 
1999
	cmp eax,[rectangular_shade_x]
2000
	jl no_remove_x_copy
2001
 
2002
	mov ecx,[rectangular_shade_x]
2003
	mov [OldX],ecx			  ; OldX <-----> rectangulare_shade_x
2004
	mov [rectangular_shade_x],eax
2005
 
2006
	no_remove_x_copy:
2007
 
2008
	cmp ebx,[rectangular_shade_y]
2009
	jl no_remove_y_copy
2010
 
2011
	mov ecx,[rectangular_shade_y]
2012
	mov [OldY],ecx			  ; OldY <-----> rectangulare_shade_y
2013
	mov [rectangular_shade_y],ebx
2014
 
2015
	no_remove_y_copy:
2016
 
2017
	 mov eax,[OldX]
2018
	 mov ebx,[OldY]
2019
	 mov ecx,[rectangular_shade_x]
2020
	 mov edx,[rectangular_shade_y]
2021
	 inc eax
2022
	 inc ebx
2023
	 dec ecx
2024
	 dec edx
2025
 
2026
	 mov [x],eax
2027
	 mov [y],ebx
2028
	 mov esi,eax
2029
	 mov edi,ebx
2030
	 mov [Dx_],1
2031
	 mov [Dy_],1
2032
 
2033
	 sub ecx,eax
2034
	 jnz no_signum_fill_r_x_copy
2035
 
2036
	 mov [Dx_],-1
2037
 
2038
	 no_signum_fill_r_x_copy:
2039
 
2040
	 sub edx,ebx
2041
	 jnz no_signum_fill_r_y_copy
2042
 
2043
	 mov [Dy_],-1
2044
 
2045
	 no_signum_fill_r_y_copy:
2046
 
2047
	 mov ebx,[rectangular_shade_y]
2048
	 sub ebx,edi
2049
 
2050
	 mov edx,[PointerToEditBufer]
2051
	 mov [y],edi
2052
	 loop_fill_rectangle_y_copy:
2053
 
2054
	 mov [x],esi
2055
	 loop_fill_rectangle_x_copy:
2056
 
2057
	 push esi
2058
	 push edi
2059
 
2060
	 mov eax,[PointerToPicture]
2061
	 mov ebx,[Picture_SizeX]
2062
	 mov esi,[x]
2063
	 mov edi,[y]
2064
	 call GetColorOfPixel
2065
 
2066
	 mov [edx],ax
2067
	 shr eax,16
2068
	 mov [edx+2],al
2069
 
2070
	 pop edi
2071
	 pop esi
2072
 
2073
	 add edx,3
2074
 
2075
	 mov eax,[x]
2076
	 add eax,[Dx_]
2077
	 mov [x],eax
2078
 
2079
	 cmp eax,[rectangular_shade_x]
2080
	 jl loop_fill_rectangle_x_copy
2081
 
2082
	 mov eax,[y]
2083
	 add eax,[Dy_]
2084
	 mov [y],eax
2085
 
2086
	 cmp eax,[rectangular_shade_y]
2087
	 jl loop_fill_rectangle_y_copy
2088
 
2089
	 call MovePictureToWorkScreen
2090
 
2091
	 and [number_panel],0
2092
	 and [number_menu],0
2093
	 mov [DrawSprite_flag],1
2094
 
2095
	 jmp still
2096
 
2097
	 no_copy:
2098
 
2099
	 ;<<<<<<<<<>>>>>>>
2100
	 cmp [number_menu],3
2101
	 jne no_paste
2102
 
2103
	 cmp [instrument_used],1
2104
	 jne no_paste
2105
 
2106
	 cmp [Activate_instrument],0
2107
	 jne no_paste
2108
 
2109
	 mov eax,[OldX]
2110
	 mov ebx,[OldY]
2111
 
2112
	 cmp eax,[rectangular_shade_x]
2113
	 jl no_remove_x_paste
2114
 
2115
	 mov ecx,[rectangular_shade_x]
2116
	 mov [OldX],ecx 		   ; OldX <-----> rectangulare_shade_x
2117
	 mov [rectangular_shade_x],eax
2118
 
2119
	 no_remove_x_paste:
2120
 
2121
	 cmp ebx,[rectangular_shade_y]
2122
	 jl no_remove_y_paste
2123
 
2124
	 mov ecx,[rectangular_shade_y]
2125
	 mov [OldY],ecx 		   ; OldY <-----> rectangulare_shade_y
2126
	 mov [rectangular_shade_y],ebx
2127
 
2128
	 no_remove_y_paste:
2129
 
2130
	 mov eax,[OldX]
2131
	 mov ebx,[OldY]
2132
	 mov ecx,[rectangular_shade_x]
2133
	 mov edx,[rectangular_shade_y]
2134
	 inc eax
2135
	 inc ebx
2136
	 dec ecx
2137
	 dec edx
2138
 
2139
	 mov [x],eax
2140
	 mov [y],ebx
2141
	 mov esi,eax
2142
	 mov edi,ebx
2143
	 mov [Dx_],1
2144
	 mov [Dy_],1
2145
 
2146
	 sub ecx,eax
2147
	 jnz no_signum_fill_r_x_paste
2148
 
2149
	 mov [Dx_],-1
2150
 
2151
	 no_signum_fill_r_x_paste:
2152
 
2153
	 sub edx,ebx
2154
	 jnz no_signum_fill_r_y_paste
2155
 
2156
	 mov [Dy_],-1
2157
 
2158
	 no_signum_fill_r_y_paste:
2159
 
2160
	 mov edx,[PointerToEditBufer]
2161
	 mov [y],edi
2162
 
2163
	 loop_fill_rectangle_y_paste:
2164
 
2165
	 mov [x],esi
2166
	 loop_fill_rectangle_x_paste:
2167
 
2168
	 push esi
2169
	 push edi
2170
 
2171
	 mov ecx,[edx]
2172
	 and ecx,0xffffff ;color
2173
 
2174
	 mov eax,[PointerToPicture]
2175
	 mov ebx,[Picture_SizeX]
2176
	 mov esi,[x]
2177
	 mov edi,[y]
2178
	 call PutPixel
2179
 
2180
	 pop edi
2181
	 pop esi
2182
 
2183
	 add edx,3
2184
 
2185
	 mov eax,[x]
2186
	 add eax,[Dx_]
2187
	 mov [x],eax
2188
	 cmp eax,[rectangular_shade_x]
2189
	 jl loop_fill_rectangle_x_paste
2190
 
2191
	 mov eax,[y]
2192
	 add eax,[Dy_]
2193
	 mov [y],eax
2194
	 cmp eax,[rectangular_shade_y]
2195
 
2196
	 jl loop_fill_rectangle_y_paste
2197
 
2198
	 call MovePictureToWorkScreen
2199
	 and [number_panel],0
2200
	 and [number_menu],0
2201
	 mov [Paste_flag],1
2202
 
2203
	 jmp still
2204
 
2205
	 no_paste:
2206
 
2207
	 ;<<<<<<<<<>>>>>>>>>
2208
	 cmp [number_menu],4
2209
	 jne no_cut
2210
 
2211
	 cmp [instrument_used],1
2212
	 jne no_cut
2213
 
2214
	 cmp [Activate_instrument],0
2215
	 jne no_cut
2216
 
2217
	 mov eax,[OldX]
2218
	 mov ebx,[OldY]
2219
 
2220
	 cmp eax,[rectangular_shade_x]
2221
	 jl no_remove_x_cut
2222
 
2223
	 mov ecx,[rectangular_shade_x]
2224
	 mov [OldX],ecx 		   ; OldX <-----> rectangulare_shade_x
2225
	 mov [rectangular_shade_x],eax
2226
 
2227
	 no_remove_x_cut:
2228
 
2229
	 cmp ebx,[rectangular_shade_y]
2230
	 jl no_remove_y_cut
2231
 
2232
	 mov ecx,[rectangular_shade_y]
2233
	 mov [OldY],ecx 		   ; OldY <-----> rectangulare_shade_y
2234
	 mov [rectangular_shade_y],ebx
2235
 
2236
	 no_remove_y_cut:
2237
 
2238
	 mov eax,[OldX]
2239
	 mov ebx,[OldY]
2240
	 mov ecx,[rectangular_shade_x]
2241
	 mov edx,[rectangular_shade_y]
2242
	 inc eax
2243
	 inc ebx
2244
	 dec ecx
2245
	 dec edx
2246
 
2247
	 mov [x],eax
2248
	 mov [y],ebx
2249
	 mov esi,eax
2250
	 mov edi,ebx
2251
	 mov [Dx_],1
2252
	 mov [Dy_],1
2253
 
2254
	 sub ecx,eax
2255
	 jnz no_signum_fill_r_x
2256
 
2257
	 mov [Dx_],-1
2258
 
2259
	 no_signum_fill_r_x:
2260
 
2261
	 sub edx,ebx
2262
	 jnz no_signum_fill_r_y
2263
 
2264
	 mov [Dy_],-1
2265
 
2266
	 no_signum_fill_r_y:
2267
 
2268
	 mov [y],edi
2269
	 loop_fill_rectangle_y:
2270
 
2271
	 mov [x],esi
2272
	 loop_fill_rectangle_x:
2273
 
2274
	 push esi
2275
	 push edi
2276
 
2277
	 mov eax,[PointerToPicture]
2278
	 mov ebx,[Picture_SizeX]
2279
	 mov ecx,dword 0xffffff
2280
	 mov esi,[x]
2281
	 mov edi,[y]
2282
	 call PutPixel
2283
 
2284
	 pop edi
2285
	 pop esi
2286
 
2287
	 mov eax,[x]
2288
	 add eax,[Dx_]
2289
	 mov [x],eax
2290
 
2291
	 cmp eax,[rectangular_shade_x]
2292
	 jl loop_fill_rectangle_x
2293
 
2294
	 mov eax,[y]
2295
	 add eax,[Dy_]
2296
	 mov [y],eax
2297
 
2298
	 cmp eax,[rectangular_shade_y]
2299
	 jl loop_fill_rectangle_y
2300
 
2301
	 call MovePictureToWorkScreen
2302
 
2303
	 and [number_panel],0
2304
	 and [number_menu],0
2305
 
2306
	 jmp still
2307
	 no_cut:
2308
 
2309
	 ;<<<<<>>>>>
2310
	 cmp [number_menu],5
2311
	 jne no_cleare_all
2312
 
2313
	 call cleare_work_arrea
2314
 
2315
	 call MovePictureToWorkScreen
2316
 
2317
	 and [number_panel],0
2318
	 and [number_menu],0
2319
 
2320
	 jmp still
2321
	 no_cleare_all:
2322
	 ;<<<<<>>>>>
2323
 
2324
	 cmp [number_menu],6
2325
	 jne no_to_allocate_all
2326
 
2327
	 mov [OldX],1
2328
	 mov [OldY],1
2329
	 mov eax,[Picture_SizeX]
2330
	 mov ebx,[Picture_SizeY]
2331
	 dec eax
2332
	 dec ebx
2333
	 mov [rectangular_shade_x],eax
2334
	 mov [rectangular_shade_y],ebx
2335
	 mov [instrument_used],1
2336
	 mov [Activate_instrument],1
2337
	 mov [Current_instrument],30
2338
	 mov [crossing],0
2339
	 and [number_panel],0
2340
	 and [number_menu],0
2341
	 ;call TakeButtonInstruments
2342
	 ;call MovePictureToWorkScreen
2343
	 jmp still
2344
 
2345
	 no_to_allocate_all:
2346
 
2347
	 no_edit:
2348
 
2349
 
2350
	 jmp still
2351
 
2352
	 ret
2353
;-----------------------------------------------------------
2354
;-----instruments of panel(icon's instruments)--------------
2355
;-----------------------------------------------------------
2356
TakeButtonInstruments:
2357
 
2358
	mov eax,[Current_instrument]
2359
 
2360
	;*************************brush 1***********************
2361
	cmp eax,10
2362
	jne no_brush1
2363
 
2364
	mov [Brush_SizeX],4
2365
	mov [Brush_SizeY],4
2366
	mov [Number_Brush],0
2367
	mov [Current_instrument],18
2368
 
2369
	jmp still
2370
	no_brush1:
2371
 
2372
	;*************************brush 2***********************
2373
	cmp eax,11
2374
	jne no_brush2
2375
 
2376
	mov [Brush_SizeX],6
2377
	mov [Brush_SizeY],4
2378
	mov [Number_Brush],1
2379
	mov [Current_instrument],18
2380
 
2381
	jmp still
2382
	no_brush2:
2383
 
2384
	;*************************brush 3***********************
2385
	cmp eax,12
2386
	jne no_brush3
2387
 
2388
	mov [Brush_SizeX],8
2389
	mov [Brush_SizeY],7
2390
	mov [Number_Brush],2
2391
	mov [Current_instrument],18
2392
 
2393
	jmp still
2394
	no_brush3:
2395
 
2396
	;************************brush 4************************
2397
	cmp eax,13
2398
	jne no_brush4
2399
 
2400
	mov [Brush_SizeX],14
2401
	mov [Brush_SizeY],14
2402
	mov [Number_Brush],3
2403
	mov [Current_instrument],18
2404
 
2405
	jmp still
2406
	no_brush4:
2407
 
2408
	;************************brush 5************************
2409
	cmp eax,14
2410
	jne no_brush5
2411
 
2412
	mov [Brush_SizeX],6
2413
	mov [Brush_SizeY],6
2414
	mov [Number_Brush],4
2415
	mov [Current_instrument],18
2416
 
2417
	jmp still
2418
	no_brush5:
2419
 
2420
	;*************************pensil************************
2421
	cmp eax,15
2422
	jne no_pensil
2423
 
2424
	mov al,[exit_from_work_arrea]
2425
 
2426
	test al,al
2427
	jz no_exit_from_work_arrea
2428
 
2429
	and [Activate_instrument],0
2430
	and [exit_from_work_arrea],0
2431
 
2432
	no_exit_from_work_arrea:
2433
 
2434
	mov al,[Activate_instrument]
2435
 
2436
	test al,al
2437
	jnz no_activated_later
2438
 
2439
	call GetScreenCordinats
2440
	mov eax,[ScreenX]
2441
	mov ebx,[ScreenY]
2442
	add eax,[PosX]
2443
	add ebx,[PosY]
2444
	mov [OldX],eax
2445
	mov [OldY],ebx
2446
 
2447
	no_activated_later:
2448
 
2449
	mov eax,[MaxWorkScreen_SizeX]
2450
	mov ebx,[MaxWorkScreen_SizeY]
2451
 
2452
	mov eax,[PointerToPicture]
2453
	mov ebx,[ReserveArray]
2454
	mov ecx,[Picture_SizeX]
2455
	mov edx,[OldX]
2456
	shl edx,16
2457
	add edx,[OldY]
2458
	mov esi,[ScreenX]
2459
	mov edi,[ScreenY]
2460
	add esi,[PosX]
2461
	add edi,[PosY]
2462
	call calculate_line
2463
 
2464
	mov ecx,eax
2465
	mov edx,[Color]
2466
	mov esi,[Color]
2467
	shr edx,16
2468
	xor ebx,ebx
2469
	mov eax,[ReserveArray]
2470
 
2471
	pensil_next_pixel_draw:
2472
 
2473
	  mov ebx,[eax]
2474
	  mov [ebx],si
2475
	  mov [ebx+2],dl
2476
	  add eax,4
2477
 
2478
	dec ecx
2479
	jnz pensil_next_pixel_draw
2480
 
2481
	mov eax,[ScreenX]
2482
	mov ebx,[ScreenY]
2483
	add eax,[PosX]
2484
	add ebx,[PosY]
2485
	mov [OldX],eax
2486
	mov [OldY],ebx
2487
 
2488
	call MovePictureToWorkScreen
2489
	mov [Activate_instrument],1
2490
	jmp still
2491
	no_pensil:
2492
 
2493
	;**********************pipetka**************************
2494
	cmp eax,16
2495
	jne no_pipetka
2496
	mov eax,[ScreenY]
2497
	mov ebx,[Picture_SizeX]
2498
	add eax,[PosY]
2499
	imul eax,ebx
2500
	add eax,[ScreenX]
2501
	add eax,[PosX]
2502
	lea eax,[eax+eax*2]
2503
	add eax,[PointerToPicture]
2504
	mov ebx,[eax]
2505
	and ebx,0xffffff
2506
	mov [Color],ebx
2507
	mov eax,13
2508
	mov ebx,447*65536+35
2509
	mov ecx,42*65536+36
2510
	mov edx,[Color]
2511
	int 0x40
2512
	jmp still
2513
	no_pipetka:
2514
 
2515
	;**********************draw brush***********************
2516
	cmp eax,18
2517
	jne no_brush
2518
 
2519
	jmp no_lastik_
2520
 
2521
	lastik_in:
2522
	mov eax,[Color]
2523
	mov [SColor],eax
2524
	mov [Color],0xffffff
2525
	no_lastik_:
2526
 
2527
	mov eax,[ScreenX]
2528
	mov ebx,[ScreenY]
2529
	mov ecx,[Brush_SizeX]
2530
	mov edx,[Brush_SizeY]
2531
	add eax,[PosX]
2532
	add ebx,[PosY]
2533
	add eax,ecx
2534
	add ebx,edx
2535
 
2536
	cmp eax,[Picture_SizeX]
2537
	jl no_max_pos_x
2538
	mov eax,[Picture_SizeX]
2539
	no_max_pos_x:
2540
 
2541
	cmp ebx,[Picture_SizeY]
2542
	jl no_max_pos_y
2543
	mov ebx,[Picture_SizeY]
2544
	no_max_pos_y:
2545
 
2546
	cmp eax,ecx
2547
	ja no_min_pos_x
2548
	mov eax,[Brush_SizeX]
2549
	no_min_pos_x:
2550
 
2551
	cmp ebx,edx
2552
	ja no_min_pos_y
2553
	mov ebx,[Brush_SizeY]
2554
	no_min_pos_y:
2555
 
2556
	sub eax,[Brush_SizeX]
2557
	sub ebx,[Brush_SizeY]
2558
 
2559
	mov [x],eax
2560
	mov [y],ebx
2561
 
2562
	mov al,[exit_from_work_arrea]
2563
	test al,al
2564
	jz no_exit_from_work_arrea_brush
2565
	and [Activate_instrument],0
2566
	and [exit_from_work_arrea],0
2567
	no_exit_from_work_arrea_brush:
2568
 
2569
	mov al,[Activate_instrument]
2570
	test al,al
2571
	jnz no_new_brush_xy
2572
	mov eax,[x]
2573
	mov ebx,[y]
2574
	mov [OldX],eax
2575
	mov [OldY],ebx
2576
	mov [Activate_instrument],1
2577
	no_new_brush_xy:
2578
 
2579
	mov eax,[PointerToPicture]
2580
	mov ebx,[ReserveArray]
2581
	add ebx,4
2582
	mov ecx,[Picture_SizeX]
2583
	mov edx,[OldX]
2584
	shl edx,16
2585
	add edx,[OldY]
2586
	mov esi,[x]
2587
	mov edi,[y]
2588
 
2589
	call calculate_line
2590
 
2591
	mov ebx,[ReserveArray]
2592
	mov [ebx],eax
2593
 
2594
	;procedure drawing of brush
2595
	mov ebx,[ReserveArray]
2596
	mov ecx,[ebx]
2597
	mov edx,[Color]
2598
	mov esi,[Color]
2599
	shr edx,16
2600
	add ebx,4
2601
	mov edi,[Number_Brush]
2602
	imul edi,20*20
2603
 
2604
	next_pixel_put_brush:
2605
 
2606
	mov eax,[ebx]
2607
	push eax
2608
	push ecx
2609
	xor ebp,ebp
2610
	and [counter2],0
2611
 
2612
	vertical_width_brush:
2613
	   and [counter],0
2614
 
2615
	   horizontal_width_brush:
2616
	   xor ecx,ecx
2617
	   mov cl,byte[Brush_color+edi+ebp]
2618
	   test cl,cl
2619
	     jz no_draw_pixel_brush
2620
	      mov [eax],si
2621
	      mov [eax+2],dl
2622
	     no_draw_pixel_brush:
2623
	   add eax,3
2624
	   inc ebp
2625
	   inc [counter]
2626
	   cmp [counter],20
2627
	   jne horizontal_width_brush
2628
 
2629
	   mov ecx,[Picture_SizeX]
2630
	   sub ecx,20
2631
	   lea ecx,[ecx+ecx*2]
2632
	   add eax,ecx
2633
	inc [counter2]
2634
	cmp [counter2],20
2635
	jne vertical_width_brush
2636
 
2637
	pop ecx
2638
	pop eax
2639
	add ebx,4
2640
	dec ecx
2641
	jnz next_pixel_put_brush
2642
 
2643
	mov eax,[x]
2644
	mov ebx,[y]
2645
	mov [OldX],eax
2646
	mov [OldY],ebx
2647
 
2648
	mov al,[lastik_is_active]
2649
	test al,al
2650
	jz no_lastik_active
2651
 
2652
	mov eax,[SColor]
2653
	mov [Color],eax
2654
	and [lastik_is_active],0
2655
	no_lastik_active:
2656
 
2657
	call MovePictureToWorkScreen
2658
	jmp still
2659
	no_brush:
2660
 
2661
	;************************Flood Fill*******************
2662
	cmp eax,17
2663
	jne no_FloodFill
2664
 
2665
	mov eax,[PointerToPicture]
2666
	mov ebx,[PointerToEditBufer]
2667
 
2668
	mov ecx,[Picture_SizeX]
2669
	imul ecx,[Picture_SizeY]
2670
	lea ecx,[ecx+ecx*2]
2671
	shl ecx,1
2672
 
2673
	cmp ecx,500000
2674
	ja normal_size_of_bufer
2675
 
2676
	mov ebx,[ReserveArray]
2677
 
2678
	normal_size_of_bufer:
2679
 
2680
	add ebx,4
2681
	mov ecx,[Picture_SizeX]
2682
	mov edx,[ScreenX]
2683
	add edx,[PosX]
2684
	shl edx,16
2685
	add edx,[ScreenY]
2686
	add edx,[PosY]
2687
	mov esi,[Picture_SizeX]
2688
	dec esi
2689
	shl esi,16
2690
	add esi,[Picture_SizeY]
2691
	dec esi
2692
	mov edi,[Color]
2693
 
2694
	call flood_fill
2695
	call MovePictureToWorkScreen
2696
 
2697
	jmp still
2698
	no_FloodFill:
2699
 
2700
	;************************lastik*************************
2701
	cmp eax,19
2702
	jne no_lastik
2703
 
2704
	 mov [lastik_is_active],1
2705
	jmp lastik_in
2706
 
2707
	no_lastik:
2708
 
2709
	;******************************************************
2710
	cmp eax,20
2711
	jne  no_spray
2712
 
2713
	cmp [Activate_instrument],0
2714
	jne no_null_spray
2715
	mov [Activate_instrument],1
2716
	jmp still
2717
	no_null_spray:
2718
 
2719
	mov eax,[ScreenX]
2720
	mov ebx,[ScreenY]
2721
	mov ecx,[Brush_SizeX]
2722
	mov edx,[Brush_SizeY]
2723
	add eax,[PosX]
2724
	add ebx,[PosY]
2725
	add eax,ecx
2726
	add ebx,edx
2727
 
2728
	cmp eax,[Picture_SizeX]
2729
	jl no_max_pos_x_spray
2730
	mov eax,[Picture_SizeX]
2731
	no_max_pos_x_spray:
2732
 
2733
	cmp ebx,[Picture_SizeY]
2734
	jl no_max_pos_y_spray
2735
	mov ebx,[Picture_SizeY]
2736
	no_max_pos_y_spray:
2737
 
2738
	cmp eax,ecx
2739
	ja no_min_pos_x_spray
2740
	mov eax,[Brush_SizeX]
2741
	no_min_pos_x_spray:
2742
 
2743
	cmp ebx,edx
2744
	ja no_min_pos_y_spray
2745
	mov ebx,[Brush_SizeY]
2746
	no_min_pos_y_spray:
2747
 
2748
	sub eax,[Brush_SizeX]
2749
	sub ebx,[Brush_SizeY]
2750
	mov edi,0;[Number_Brush]
2751
	imul edi,20*20
2752
 
2753
	mov [x],eax
2754
	mov [y],ebx
2755
	mov ebp,[Picture_SizeX]
2756
	xor edx,edx
2757
	brush_y_spray:
2758
	  xor ecx,ecx
2759
	  brush_x_spray:
2760
	   ;calculate position in array of spray
2761
	   mov esi,edx
2762
	   lea esi,[esi+esi*4] ;esi=esi*5
2763
	   shl esi,2	       ;esi=(esi*3)*4
2764
	   add esi,ecx
2765
	   add esi,edi
2766
	   ;read byte from array
2767
	   xor eax,eax
2768
	   mov al,[Spray_color+esi]
2769
	   test eax,eax
2770
	   jz no_color_spray
2771
	   mov eax,[x]
2772
	   mov ebx,[y]
2773
	   add eax,ecx
2774
	   add ebx,edx
2775
	   imul ebx,ebp; ebp=[Picture_SizeX]
2776
	   add eax,ebx
2777
	   lea eax,[eax+eax*2]
2778
	   add eax,[PointerToPicture]
2779
	   mov ebx,[Color]
2780
	   mov [eax],bx
2781
	   shr ebx,16
2782
	   mov [eax+2],bl
2783
	   no_color_spray:
2784
	   inc ecx
2785
	   cmp ecx,20
2786
	  jl brush_x_spray
2787
	inc edx
2788
	cmp edx,20
2789
	jl brush_y_spray
2790
 
2791
	call MovePictureToWorkScreen
2792
	jmp still
2793
 
2794
	no_spray:
2795
 
2796
	;***********************palette*************************
2797
	cmp eax,21
2798
	jne no_palette
2799
 
2800
	mov eax,20
2801
	mov ebx,100
2802
	mov ecx,32*10+32*5+7
2803
	mov edx,8*10+7*10
2804
	mov  esi,1
2805
	call draw_volume_rectangle
2806
	mov [x],20+5
2807
	mov [y],100+10
2808
	mov edi,256
2809
	xor esi,esi
2810
	next_rectangle:
2811
	mov eax,13
2812
	mov ebx,[x]
2813
	mov ecx,[y]
2814
	mov edx,[palitra+esi]
2815
	and edx,0xffffff
2816
	shl ebx,16
2817
	shl ecx,16
2818
	add ebx,13
2819
	add ecx,13
2820
	int 0x40
2821
	add [x],15
2822
	cmp [x],20+15*32
2823
	jl no_new_line
2824
	mov [x],20+5
2825
	add [y],15
2826
	no_new_line:
2827
	add esi,4
2828
	dec edi
2829
	jnz next_rectangle
2830
 
2831
	wait_events:
2832
	call event
2833
 
2834
	cmp eax,1
2835
	je still
2836
	cmp eax,2
2837
	jne no_keys
2838
	mov eax,2
2839
	int 0x40
2840
	no_keys:
2841
	cmp eax,3
2842
	jne no_buttons
2843
	mov eax,17
2844
	int 0x40
2845
	no_buttons:
2846
	cmp eax,6
2847
	jne wait_events
2848
 
2849
	call GetMouseClick
2850
 
2851
	test eax,eax
2852
	jz wait_events
2853
	call GetMouseCoordinats
2854
	mov [x],20+5
2855
	mov [y],100+10
2856
	mov [counter],0
2857
	next_rectangle_column:
2858
	mov eax,[x]
2859
	mov ebx,[y]
2860
	mov ecx,[MouseX]
2861
	mov edx,[MouseY]
2862
	mov esi,13
2863
	mov edi,13
2864
	call columnus
2865
	test eax,eax
2866
	jz no_columnus_color
2867
	mov eax,[counter]
2868
	shl eax,2
2869
	mov ebx,[palitra+eax]
2870
	and ebx,0xffffff
2871
	mov [Color],ebx
2872
	no_columnus_color:
2873
	add [x],15
2874
	cmp [x],20+15*32
2875
	jl no_new_line_column
2876
	mov [x],20+5
2877
	add [y],15
2878
	no_new_line_column:
2879
	inc [counter]
2880
	cmp [counter],257
2881
	jne next_rectangle_column
2882
	mov eax,5
2883
	mov ebx,10
2884
	int 0x40
2885
	call drawwin
2886
	and [Current_instrument],0
2887
	jmp still
2888
	no_palette:
2889
 
2890
	;************************draw line**********************
2891
	cmp eax,22
2892
	jne no_line
2893
 
2894
	mov al,[Activate_instrument]
2895
	test al,al
2896
	jnz no_new_line_xy
2897
	mov eax,[ScreenX]
2898
	mov ebx,[ScreenY]
2899
	add eax,[PosX]
2900
	add ebx,[PosY]
2901
	mov [OldX],eax
2902
	mov [OldY],ebx
2903
	mov [Activate_instrument],1
2904
	mov eax,[ReserveArray]
2905
	mov ecx,60000
2906
	clear_array_line:
2907
	mov [eax],dword 0
2908
	add eax,4
2909
	dec ecx
2910
	jnz clear_array_line
2911
	jmp still
2912
	no_new_line_xy:
2913
 
2914
	;put saved pixels
2915
	mov ebx,[ReserveArray]
2916
	mov eax,[ebx]
2917
	test eax,eax
2918
	jz no_put_line_to_screen_line
2919
	mov ecx,[ebx]
2920
	add ebx,4
2921
	xor ebp,ebp
2922
	next_color_put_line:
2923
	;put saved pixels in ReserveArray
2924
	push ecx
2925
	and [counter2],0
2926
	mov edi,[ebx]
2927
	push edi
2928
	vertical_width_put:
2929
	   and [counter],0
2930
 
2931
	   horizontal_width_put:
2932
	      mov edx,[ebx+4807*4+ebp]
2933
	      and edx,0xffffff
2934
	      mov [edi],dx
2935
	      shr edx,16
2936
	      mov [edi+2],dl
2937
 
2938
	   add edi,3
2939
	   add ebp,4
2940
	   inc [counter]
2941
	   cmp [counter],5
2942
	   jne horizontal_width_put
2943
 
2944
	   mov ecx,[Picture_SizeX]
2945
	   sub ecx,5
2946
	   lea ecx,[ecx+ecx*2]
2947
	   add edi,ecx
2948
	inc [counter2]
2949
	cmp [counter2],5
2950
	jne vertical_width_put
2951
	pop edi
2952
	pop ecx
2953
	add ebx,4
2954
	dec ecx
2955
	jnz next_color_put_line
2956
 
2957
	no_put_line_to_screen_line:
2958
 
2959
	;calculate line
2960
	mov ebx,[ReserveArray]
2961
	add ebx,4
2962
	mov eax,[PointerToPicture]
2963
	mov ecx,[Picture_SizeX]
2964
	mov edx,[OldX]
2965
	shl edx,16
2966
	add edx,[OldY]
2967
	mov esi,[ScreenX]
2968
	mov edi,[ScreenY]
2969
	add esi,[PosX]
2970
	add edi,[PosY]
2971
 
2972
	mov ebp,[Picture_SizeX]
2973
	sub ebp,[line_width]
2974
	cmp esi,ebp
2975
	jl no_minimum_x_line
2976
	mov esi,ebp
2977
	no_minimum_x_line:
2978
 
2979
	mov ebp,[Picture_SizeY]
2980
	sub ebp,[line_width]
2981
	cmp edi,ebp
2982
	jl no_minimum_y_line
2983
	mov edi,ebp
2984
	no_minimum_y_line:
2985
 
2986
	call calculate_line
2987
	;call calculate_rectangle
2988
	mov [counter],eax
2989
 
2990
	;save color pixels in ReserveArray
2991
	mov eax,[counter]
2992
	mov ebx,[ReserveArray]
2993
	mov [ebx],eax
2994
 
2995
	mov ecx,[ebx]
2996
	add ebx,4
2997
 
2998
	xor ebp,ebp
2999
	next_color_save_line:
3000
	;save color of pixel in ReserveArray
3001
	push ecx
3002
	and [counter2],0
3003
	mov edi,[ebx]
3004
	vertical_width_save:
3005
	   and [counter],0
3006
 
3007
	   horizontal_width_save:
3008
	      mov eax,edi
3009
	      mov edx,[eax]
3010
	      and edx,0xffffff
3011
	      mov [ebx+4807*4+ebp],dx
3012
	      shr edx,16
3013
	      mov [ebx+4807*4+2+ebp],dl
3014
 
3015
	   add edi,3
3016
	   add ebp,4
3017
	   inc [counter]
3018
	   cmp [counter],5
3019
	   jne horizontal_width_save
3020
 
3021
	   mov ecx,[Picture_SizeX]
3022
	   sub ecx,5
3023
	   lea ecx,[ecx+ecx*2]
3024
	   add edi,ecx
3025
	inc [counter2]
3026
	cmp [counter2],5
3027
	jne vertical_width_save
3028
	pop ecx
3029
	add ebx,4
3030
	dec ecx
3031
	jnz next_color_save_line
3032
 
3033
	;draw calculated pixels on work arrea
3034
	mov ebx,[ReserveArray]
3035
	mov ecx,[ebx]
3036
	mov edx,[Color]
3037
	mov esi,[Color]
3038
	shr edx,16
3039
	add ebx,4
3040
	mov edi,[line_width]
3041
	dec edi
3042
	imul edi,25
3043
	next_pixel_put_line:
3044
 
3045
	mov eax,[ebx]
3046
	push eax
3047
	push ecx
3048
	xor ebp,ebp
3049
	and [counter2],0
3050
 
3051
	vertical_width:
3052
	   and [counter],0
3053
 
3054
	   horizontal_width:
3055
	   xor ecx,ecx
3056
	   mov cl,byte[width_pixels+edi+ebp]
3057
	   test cl,cl
3058
	     jz no_draw_pixel_line
3059
	      mov [eax],si
3060
	      mov [eax+2],dl
3061
	     no_draw_pixel_line:
3062
	   add eax,3
3063
	   inc ebp
3064
	   inc [counter]
3065
	   cmp [counter],5
3066
	   jne horizontal_width
3067
 
3068
	   mov ecx,[Picture_SizeX]
3069
	   sub ecx,5
3070
	   lea ecx,[ecx+ecx*2]
3071
	   add eax,ecx
3072
	inc [counter2]
3073
	cmp [counter2],5
3074
	jne vertical_width
3075
 
3076
	pop ecx
3077
	pop eax
3078
	add ebx,4
3079
	dec ecx
3080
	jnz next_pixel_put_line
3081
 
3082
	call MovePictureToWorkScreen
3083
 
3084
	jmp still
3085
	no_line:
3086
 
3087
	;*********************************DRAW RECTANGLE****************************
3088
	cmp eax,23
3089
	jne no_rectangle
3090
 
3091
	mov al,[Activate_instrument]
3092
	test al,al
3093
	jnz no_new_rectangle_xy
3094
	mov eax,[ScreenX]
3095
	mov ebx,[ScreenY]
3096
	add eax,[PosX]
3097
	add ebx,[PosY]
3098
	mov [OldX],eax
3099
	mov [OldY],ebx
3100
	mov [Activate_instrument],1
3101
	mov eax,[ReserveArray]
3102
	mov ecx,60000
3103
	clear_array_rectangle:
3104
	mov [eax],dword 0
3105
	add eax,4
3106
	dec ecx
3107
	jnz clear_array_rectangle
3108
	jmp still
3109
	no_new_rectangle_xy:
3110
 
3111
	;put saved pixels
3112
	mov ebx,[ReserveArray]
3113
	mov eax,[ebx]
3114
	test eax,eax
3115
	jz no_put_rectangle_to_screen_line
3116
	mov ecx,[ebx]
3117
	add ebx,4
3118
	xor ebp,ebp
3119
	next_color_put_rectangle:
3120
	;put saved pixels in ReserveArray
3121
	push ecx
3122
	and [counter2],0
3123
	mov edi,[ebx]
3124
	push edi
3125
	vertical_width_put_rectangle:
3126
	   and [counter],0
3127
 
3128
	   horizontal_width_put_rectangle:
3129
	      mov edx,[ebx+4807*4+ebp]
3130
	      and edx,0xffffff
3131
	      mov [edi],dx
3132
	      shr edx,16
3133
	      mov [edi+2],dl
3134
 
3135
	   add edi,3
3136
	   add ebp,4
3137
	   inc [counter]
3138
	   cmp [counter],5
3139
	   jne horizontal_width_put_rectangle
3140
 
3141
	   mov ecx,[Picture_SizeX]
3142
	   sub ecx,5
3143
	   lea ecx,[ecx+ecx*2]
3144
	   add edi,ecx
3145
	inc [counter2]
3146
	cmp [counter2],5
3147
	jne vertical_width_put_rectangle
3148
	pop edi
3149
	pop ecx
3150
	add ebx,4
3151
	dec ecx
3152
	jnz next_color_put_rectangle
3153
 
3154
	no_put_rectangle_to_screen_line:
3155
 
3156
	;calculate line
3157
	mov ebx,[ReserveArray]
3158
	add ebx,4
3159
	mov eax,[PointerToPicture]
3160
	mov ecx,[Picture_SizeX]
3161
	mov edx,[OldX]
3162
	shl edx,16
3163
	add edx,[OldY]
3164
	mov esi,[ScreenX]
3165
	mov edi,[ScreenY]
3166
	add esi,[PosX]
3167
	add edi,[PosY]
3168
 
3169
	mov ebp,[Picture_SizeX]
3170
	sub ebp,[line_width]
3171
	cmp esi,ebp
3172
	jl no_minimum_x_rectangle
3173
	mov esi,ebp
3174
	no_minimum_x_rectangle:
3175
 
3176
	mov ebp,[Picture_SizeY]
3177
	sub ebp,[line_width]
3178
	cmp edi,ebp
3179
	jl no_minimum_y_rectangle
3180
	mov edi,ebp
3181
	no_minimum_y_rectangle:
3182
 
3183
	call calculate_rectangle
3184
	mov [counter],eax
3185
 
3186
	;save color pixels in ReserveArray
3187
	mov eax,[counter]
3188
	mov ebx,[ReserveArray]
3189
	mov [ebx],eax
3190
 
3191
	mov ecx,[ebx]
3192
	add ebx,4
3193
 
3194
	xor ebp,ebp
3195
	next_color_save_rectangle:
3196
	;save color of pixel in ReserveArray
3197
	push ecx
3198
	and [counter2],0
3199
	mov edi,[ebx]
3200
	vertical_width_save_rectangle:
3201
	   and [counter],0
3202
 
3203
	   horizontal_width_save_rectangle:
3204
	      mov eax,edi
3205
	      mov edx,[eax]
3206
	      and edx,0xffffff
3207
	      mov [ebx+4807*4+ebp],dx
3208
	      shr edx,16
3209
	      mov [ebx+4807*4+2+ebp],dl
3210
 
3211
	   add edi,3
3212
	   add ebp,4
3213
	   inc [counter]
3214
	   cmp [counter],5
3215
	   jne horizontal_width_save_rectangle
3216
 
3217
	   mov ecx,[Picture_SizeX]
3218
	   sub ecx,5
3219
	   lea ecx,[ecx+ecx*2]
3220
	   add edi,ecx
3221
	inc [counter2]
3222
	cmp [counter2],5
3223
	jne vertical_width_save_rectangle
3224
	pop ecx
3225
	add ebx,4
3226
	dec ecx
3227
	jnz next_color_save_rectangle
3228
 
3229
	;draw calculated pixels on work arrea
3230
	mov ebx,[ReserveArray]
3231
	mov ecx,[ebx]
3232
	mov edx,[Color]
3233
	mov esi,[Color]
3234
	shr edx,16
3235
	add ebx,4
3236
	mov edi,[line_width]
3237
	dec edi
3238
	imul edi,25
3239
	next_pixel_put_rectangle:
3240
 
3241
	mov eax,[ebx]
3242
	push eax
3243
	push ecx
3244
	xor ebp,ebp
3245
	and [counter2],0
3246
 
3247
	vertical_width_rectangle:
3248
	   and [counter],0
3249
 
3250
	   horizontal_width_rectangle:
3251
	   xor ecx,ecx
3252
	   mov cl,byte[width_pixels_rectangle+edi+ebp]
3253
	   test cl,cl
3254
	     jz no_draw_pixel_rectangle
3255
	      mov [eax],si
3256
	      mov [eax+2],dl
3257
	     no_draw_pixel_rectangle:
3258
	   add eax,3
3259
	   inc ebp
3260
	   inc [counter]
3261
	   cmp [counter],5
3262
	   jne horizontal_width_rectangle
3263
 
3264
	   mov ecx,[Picture_SizeX]
3265
	   sub ecx,5
3266
	   lea ecx,[ecx+ecx*2]
3267
	   add eax,ecx
3268
	inc [counter2]
3269
	cmp [counter2],5
3270
	jne vertical_width_rectangle
3271
 
3272
	pop ecx
3273
	pop eax
3274
	add ebx,4
3275
	dec ecx
3276
	jnz next_pixel_put_rectangle
3277
 
3278
	call MovePictureToWorkScreen
3279
	jmp still
3280
	no_rectangle:
3281
 
3282
	;*********************************DRAW CIRCLE****************************
3283
	cmp eax,24
3284
	jne no_circle
3285
 
3286
	mov al,[Activate_instrument]
3287
	test al,al
3288
	jnz no_new_circle_xy
3289
	mov eax,[ScreenX]
3290
	mov ebx,[ScreenY]
3291
	add eax,[PosX]
3292
	add ebx,[PosY]
3293
	mov [OldX],eax
3294
	mov [OldY],ebx
3295
	mov [Activate_instrument],1
3296
	mov eax,[ReserveArray]
3297
	mov ecx,60000
3298
	clear_array_circle:
3299
	mov [eax],dword 0
3300
	add eax,4
3301
	dec ecx
3302
	jnz clear_array_circle
3303
	jmp still
3304
	no_new_circle_xy:
3305
 
3306
	;put saved pixels
3307
	mov ebx,[ReserveArray]
3308
	mov eax,[ebx]
3309
	test eax,eax
3310
	jz no_put_line_to_screen_circle
3311
	mov ecx,[ebx]
3312
	add ebx,4
3313
	xor ebp,ebp
3314
	next_color_put_circle:
3315
	;put saved pixels in ReserveArray
3316
	push ecx
3317
	and [counter2],0
3318
	mov edi,[ebx]
3319
	push edi
3320
	vertical_width_put_circle:
3321
	   and [counter],0
3322
 
3323
	   horizontal_width_put_circle:
3324
	      mov edx,[ebx+4807*4+ebp]
3325
	      and edx,0xffffff
3326
	      mov [edi],dx
3327
	      shr edx,16
3328
	      mov [edi+2],dl
3329
 
3330
	   add edi,3
3331
	   add ebp,4
3332
	   inc [counter]
3333
	   cmp [counter],5
3334
	   jne horizontal_width_put_circle
3335
 
3336
	   mov ecx,[Picture_SizeX]
3337
	   sub ecx,5
3338
	   lea ecx,[ecx+ecx*2]
3339
	   add edi,ecx
3340
	inc [counter2]
3341
	cmp [counter2],5
3342
	jne vertical_width_put_circle
3343
	pop edi
3344
	pop ecx
3345
	add ebx,4
3346
	dec ecx
3347
	jnz next_color_put_circle
3348
 
3349
	no_put_line_to_screen_circle:
3350
 
3351
	mov esi,[ScreenX]
3352
	mov edi,[ScreenY]
3353
	add esi,[PosX]
3354
	add edi,[PosY]
3355
 
3356
	sub esi,[OldX]
3357
	jns no_sign_x_circle
3358
	neg esi
3359
	shr esi,1
3360
	neg esi
3361
	add esi,[OldX]
3362
	jmp no_plus_sign_x_circle
3363
	no_sign_x_circle:
3364
 
3365
	shr esi,1
3366
	add esi,[OldX]
3367
	no_plus_sign_x_circle:
3368
 
3369
	sub edi,[OldY]
3370
	jns no_sign_y_circle
3371
	neg edi
3372
	shr edi,1
3373
	neg edi
3374
	add edi,[OldY]
3375
	jmp no_plus_sign_y_circle
3376
	no_sign_y_circle:
3377
 
3378
	shr edi,1
3379
	add edi,[OldY]
3380
	no_plus_sign_y_circle:
3381
 
3382
	mov [x],esi
3383
	mov [y],edi
3384
 
3385
	mov esi,[ScreenX]
3386
	mov edi,[ScreenY]
3387
	add esi,[PosX]
3388
	add edi,[PosY]
3389
 
3390
	sub esi,[OldX]
3391
	jns no_sign_x_circle_r
3392
	neg esi
3393
	no_sign_x_circle_r:
3394
 
3395
	sub edi,[OldY]
3396
	jns no_sign_y_circle_r
3397
	neg edi
3398
	no_sign_y_circle_r:
3399
 
3400
	mov [Dx_],esi
3401
	mov [Dy_],edi
3402
 
3403
	;finit
3404
	fild [Dx_]
3405
	fmul st0,st0
3406
	fild [Dy_]
3407
	fmul st0,st0
3408
	fadd st0,st1
3409
	fsqrt
3410
	fistp [Radius]
3411
	fistp [Icon_X]
3412
	mov esi,[Radius]
3413
	shr esi,1
3414
	cmp esi,0
3415
	jne no_null_radius
3416
	mov [Radius],1
3417
	no_null_radius:
3418
 
3419
	mov [Radius],esi
3420
 
3421
	mov edi,[x]
3422
	mov ebp,[y]
3423
	add edi,esi
3424
	add ebp,esi
3425
 
3426
	mov edx,[Picture_SizeX]
3427
	sub edx,[line_width]
3428
	cmp edi,edx
3429
	jl no_limit_x_circle
3430
	sub edi,edx
3431
	sub [Radius],edi
3432
	no_limit_x_circle:
3433
 
3434
	mov edx,[Picture_SizeY]
3435
	sub edx,[line_width]
3436
	cmp ebp,edx
3437
	jl no_limit_y_circle
3438
	sub ebp,edx
3439
	sub [Radius],ebp
3440
	no_limit_y_circle:
3441
 
3442
 
3443
	mov edi,[x]
3444
	mov ebp,[y]
3445
 
3446
	sub edi,[Radius]
3447
	jns no_minimum_x_circle
3448
	add [Radius],edi
3449
	no_minimum_x_circle:
3450
 
3451
	sub ebp,[Radius]
3452
	jns no_minimum_y_circle
3453
	add [Radius],ebp
3454
	no_minimum_y_circle:
3455
 
3456
	;calculate circle
3457
	mov ebx,[ReserveArray]
3458
	add ebx,4
3459
	mov eax,[PointerToPicture]
3460
	mov ecx,[Picture_SizeX]
3461
	mov edx,[x]
3462
	shl edx,16
3463
	add edx,[y]
3464
	mov esi,[Radius]
3465
	call calculate_circle
3466
 
3467
	mov [counter],eax
3468
 
3469
	;save color pixels in ReserveArray
3470
	mov eax,[counter]
3471
	mov ebx,[ReserveArray]
3472
	mov [ebx],eax
3473
 
3474
	mov ecx,[ebx]
3475
	add ebx,4
3476
 
3477
	xor ebp,ebp
3478
	next_color_save_circle:
3479
	;save color of pixel in ReserveArray
3480
	push ecx
3481
	and [counter2],0
3482
	mov edi,[ebx]
3483
	vertical_width_save_circle:
3484
	   and [counter],0
3485
 
3486
	   horizontal_width_save_circle:
3487
	      mov eax,edi
3488
	      mov edx,[eax]
3489
	      and edx,0xffffff
3490
	      mov [ebx+4807*4+ebp],dx
3491
	      shr edx,16
3492
	      mov [ebx+4807*4+2+ebp],dl
3493
 
3494
	   add edi,3
3495
	   add ebp,4
3496
	   inc [counter]
3497
	   cmp [counter],5
3498
	   jne horizontal_width_save_circle
3499
 
3500
	   mov ecx,[Picture_SizeX]
3501
	   sub ecx,5
3502
	   lea ecx,[ecx+ecx*2]
3503
	   add edi,ecx
3504
	inc [counter2]
3505
	cmp [counter2],5
3506
	jne vertical_width_save_circle
3507
	pop ecx
3508
	add ebx,4
3509
	dec ecx
3510
	jnz next_color_save_circle
3511
 
3512
	;draw calculated pixels on work arrea
3513
	mov ebx,[ReserveArray]
3514
	mov ecx,[ebx]
3515
	mov edx,[Color]
3516
	mov esi,[Color]
3517
	shr edx,16
3518
	add ebx,4
3519
	mov edi,[line_width]
3520
	dec edi
3521
	imul edi,25
3522
	next_pixel_put_circle:
3523
 
3524
	mov eax,[ebx]
3525
	push eax
3526
	push ecx
3527
	xor ebp,ebp
3528
	and [counter2],0
3529
 
3530
	vertical_width_circle:
3531
	   and [counter],0
3532
 
3533
	   horizontal_width_circle:
3534
	   xor ecx,ecx
3535
	   mov cl,byte[width_pixels+edi+ebp]
3536
	   test cl,cl
3537
	     jz no_draw_pixel_circle
3538
	      mov [eax],si
3539
	      mov [eax+2],dl
3540
	     no_draw_pixel_circle:
3541
	   add eax,3
3542
	   inc ebp
3543
	   inc [counter]
3544
	   cmp [counter],5
3545
	   jne horizontal_width_circle
3546
 
3547
	   mov ecx,[Picture_SizeX]
3548
	   sub ecx,5
3549
	   lea ecx,[ecx+ecx*2]
3550
	   add eax,ecx
3551
	inc [counter2]
3552
	cmp [counter2],5
3553
	jne vertical_width_circle
3554
 
3555
	pop ecx
3556
	pop eax
3557
	add ebx,4
3558
	dec ecx
3559
	jnz next_pixel_put_circle
3560
 
3561
	call MovePictureToWorkScreen
3562
	jmp still
3563
	no_circle:
3564
 
3565
	;************************zoom 1*************************
3566
	cmp eax,25
3567
	jne no_1_
3568
	mov [k],1
3569
	mov [Scroll1CoordinatX],9
3570
	mov [Scroll2CoordinatY],85
3571
	and [Current_instrument],0
3572
	call drawwin
3573
	jmp still
3574
	no_1_:
3575
 
3576
	;*************************zoom 2************************
3577
	cmp eax,26
3578
	jne no_2_
3579
	mov [k],2
3580
	call drawwin
3581
	mov [Scroll1CoordinatX],9
3582
	mov [Scroll2CoordinatY],85
3583
	and [Current_instrument],0
3584
	jmp still
3585
	no_2_:
3586
 
3587
	;*************************zoom 4************************
3588
	cmp eax,27
3589
	jne no_4_
3590
	mov [k],4
3591
	call drawwin
3592
	mov [Scroll1CoordinatX],9
3593
	mov [Scroll2CoordinatY],85
3594
	and [Current_instrument],0
3595
	jmp still
3596
	no_4_:
3597
 
3598
	;************************zoom 8*************************
3599
	cmp eax,28
3600
	jne no_8_
3601
	mov [k],8
3602
	call drawwin
3603
	mov [Scroll1CoordinatX],9
3604
	mov [Scroll2CoordinatY],85
3605
	and [Current_instrument],0
3606
	jmp still
3607
	no_8_:
3608
 
3609
	;************************zoom 16************************
3610
	cmp eax,29
3611
	jne no_16_
3612
	mov [k],16
3613
	call drawwin
3614
	mov [Scroll1CoordinatX],9
3615
	mov [Scroll2CoordinatY],85
3616
	and [Current_instrument],0
3617
	jmp still
3618
	no_16_:
3619
 
3620
	;***************allocation of a countour*********************
3621
	cmp eax,30
3622
	jne no_allocation
3623
 
3624
	cmp [instrument_used],0
3625
	jnz instrument_not_finished_work
3626
 
3627
	mov al,[Activate_instrument]
3628
	test al,al
3629
	jnz no_new_allocation_xy
3630
	mov eax,[ScreenX]
3631
	mov ebx,[ScreenY]
3632
	add eax,[PosX]
3633
	add ebx,[PosY]
3634
	mov [OldX],eax
3635
	mov [OldY],ebx
3636
	inc eax
3637
	inc ebx
3638
	mov [rectangular_shade_x],eax
3639
	mov [rectangular_shade_y],ebx
3640
	mov [Activate_instrument],1
3641
	mov [instrument_used],1
3642
	and [crossing],0
3643
	and [finishing_crossing],0
3644
	mov eax,[ReserveArray]
3645
	mov ecx,60000
3646
	clear_array_allocation:
3647
	mov [eax],dword 0
3648
	add eax,4
3649
	dec ecx
3650
	jnz clear_array_allocation
3651
	jmp still
3652
	no_new_allocation_xy:
3653
	instrument_not_finished_work:
3654
 
3655
	mov al,[instrument_used]
3656
	test al,al
3657
	jz no_change_coordinats
3658
 
3659
	cmp [Activate_instrument],0
3660
	jnz no_change_coordinats
3661
 
3662
	;save coordinates as old if crossing=0
3663
	cmp [crossing],0
3664
	jnz no_save_coordinate_of_crossing
3665
 
3666
	mov eax,[OldX]
3667
	mov ebx,[OldY]
3668
 
3669
	cmp eax,[rectangular_shade_x]
3670
	jl no_remove_x
3671
	mov ecx,[rectangular_shade_x]
3672
	mov [OldX],ecx			  ; OldX <-----> rectangulare_shade_x
3673
	mov [rectangular_shade_x],eax
3674
	no_remove_x:
3675
 
3676
	cmp ebx,[rectangular_shade_y]
3677
	jl no_remove_y
3678
	mov ecx,[rectangular_shade_y]
3679
	mov [OldY],ecx			  ; OldY <-----> rectangulare_shade_y
3680
	mov [rectangular_shade_y],ebx
3681
	no_remove_y:
3682
 
3683
	mov eax,[ScreenX]
3684
	mov ebx,[ScreenY]
3685
	add eax,[PosX]
3686
	add ebx,[PosY]
3687
	mov [crossing_old_x],eax
3688
	mov [crossing_old_y],ebx
3689
	mov [crossing],1
3690
 
3691
 
3692
	mov eax,[OldX]
3693
	mov ebx,[OldY]
3694
	inc eax
3695
	inc ebx
3696
	mov [SpriteCoordinatX],eax
3697
	mov [SpriteCoordinatY],ebx
3698
	mov [SpriteOldCoordinatX],eax
3699
	mov [SpriteOldCoordinatY],ebx
3700
	mov esi,[rectangular_shade_x]
3701
	mov edi,[rectangular_shade_y]
3702
 
3703
	sub esi,eax
3704
	jns no_sign_sprite_size_x
3705
	neg esi
3706
	no_sign_sprite_size_x:
3707
 
3708
	sub edi,ebx
3709
	jns no_sign_sprite_size_y
3710
	neg edi
3711
	no_sign_sprite_size_y:
3712
 
3713
	test esi,esi
3714
	jnz no_null_sprite_x
3715
	mov esi,1
3716
	no_null_sprite_x:
3717
 
3718
	test edi,edi
3719
	jnz no_null_sprite_y
3720
	mov edi,1
3721
	no_null_sprite_y:
3722
 
3723
	mov [SpriteSizeX],esi
3724
	mov [SpriteSizeY],edi
3725
 
3726
	call SaveFonForSprite
3727
 
3728
	no_save_coordinate_of_crossing:
3729
 
3730
	cmp [crossing],0
3731
	je no_test_crossing_with_work_arrea
3732
	;if mouse situatad after allocation than exit
3733
	push [ScreenX]
3734
	push [ScreenY]
3735
 
3736
	call GetScreenCordinats
3737
 
3738
	mov eax,[OldX]
3739
	mov ebx,[OldY]
3740
	mov ecx,[ScreenX]
3741
	mov edx,[ScreenY]
3742
	mov esi,[SpriteSizeX]
3743
	mov edi,[SpriteSizeY]
3744
	add ecx,[PosX]
3745
	add edx,[PosY]
3746
	inc esi;eax
3747
	inc edi;ebx
3748
	call columnus
3749
 
3750
	test eax,eax
3751
	jnz crossing_with_work_area
3752
	mov [finishing_crossing],1
3753
	mov [register],1
3754
	crossing_with_work_area:
3755
 
3756
	pop [ScreenY]
3757
	pop [ScreenX]
3758
 
3759
	no_test_crossing_with_work_arrea:
3760
 
3761
	mov eax,[ScreenX]
3762
	mov ebx,[ScreenY]
3763
	add eax,[PosX]
3764
	add ebx,[PosY]
3765
	mov ecx,eax
3766
	mov edx,ebx
3767
	sub eax,[crossing_old_x]  ;dx=(x-oldx)
3768
	sub ebx,[crossing_old_y]  ;dy=(y-oldy)
3769
	mov [crossing_old_x],ecx
3770
	mov [crossing_old_y],edx
3771
 
3772
	add [OldX],eax		       ;x1=x1+dx
3773
	add [OldY],ebx		       ;y1=y1+dy
3774
	add [rectangular_shade_x],eax  ;x2=x2+dx
3775
	add [rectangular_shade_y],ebx  ;y2+y2+dy
3776
 
3777
	mov eax,[OldX]
3778
	mov ebx,[OldY]
3779
	inc eax
3780
	inc ebx
3781
	mov [SpriteCoordinatX],eax
3782
	mov [SpriteCoordinatY],ebx
3783
 
3784
	cmp [SpriteCoordinatX],0
3785
	jns no_null_sprite_coordinat_x
3786
	mov [SpriteCoordinatX],1
3787
	no_null_sprite_coordinat_x:
3788
 
3789
	cmp [SpriteCoordinatY],0
3790
	jns no_null_sprite_coordinat_y
3791
	mov [SpriteCoordinatY],1
3792
	no_null_sprite_coordinat_y:
3793
 
3794
	mov esi,[rectangular_shade_x]
3795
	mov edi,[rectangular_shade_y]
3796
 
3797
	sub esi,[OldX]
3798
	jns no_znak_size_of_rectangulare_crossing_x
3799
	neg esi
3800
	no_znak_size_of_rectangulare_crossing_x:
3801
 
3802
	sub edi,[OldY]
3803
	jns no_znak_size_of_rectangulare_crossing_y
3804
	neg edi
3805
	no_znak_size_of_rectangulare_crossing_y:
3806
 
3807
	mov ecx,[OldX]
3808
	mov edx,[OldY]
3809
 
3810
	sub ecx,[PosX]
3811
	jns no_minimum_x_crossing
3812
	mov ecx,0
3813
	add ecx,[PosX]
3814
	mov [OldX],ecx
3815
	add ecx,esi
3816
	mov [rectangular_shade_x],ecx
3817
	no_minimum_x_crossing:
3818
 
3819
	sub edx,[PosY]
3820
	jns no_minimum_y_crossing
3821
	mov edx,0
3822
	add edx,[PosY]
3823
	mov [OldY],edx
3824
	add edx,edi
3825
	mov [rectangular_shade_y],edx
3826
	no_minimum_y_crossing:
3827
 
3828
	mov ecx,[Picture_SizeX]
3829
	sub ecx,esi
3830
	cmp [OldX],ecx
3831
	jl no_maximum_x_crossing
3832
	dec ecx
3833
	mov [OldX],ecx
3834
	add ecx,esi
3835
	mov [rectangular_shade_x],ecx
3836
	no_maximum_x_crossing:
3837
 
3838
	mov edx,[Picture_SizeY]
3839
	sub edx,edi
3840
	cmp [OldY],edx
3841
	jl no_maximum_y_crossing
3842
	dec edx
3843
	mov [OldY],edx
3844
	add edx,edi
3845
	mov [rectangular_shade_y],edx
3846
	no_maximum_y_crossing:
3847
 
3848
	mov eax,[rectangular_shade_x]
3849
	mov ebx,[rectangular_shade_y]
3850
	sub eax,[PosX]
3851
	sub ebx,[PosY]
3852
	mov [ScreenX],eax
3853
	mov [ScreenY],ebx
3854
	no_change_coordinats:
3855
 
3856
	;put saved pixels
3857
	mov ebx,[ReserveArray]
3858
	mov eax,[ebx]
3859
	test eax,eax
3860
	jz no_put_line_to_screen_allocation
3861
	mov ecx,[ebx]
3862
	add ebx,4
3863
	xor ebp,ebp
3864
	next_color_put_allocation:
3865
	;put saved pixels in ReserveArray
3866
	push ecx
3867
	and [counter2],0
3868
	mov edi,[ebx]
3869
	push edi
3870
	vertical_width_put_allocation:
3871
	   and [counter],0
3872
 
3873
	   horizontal_width_put_allocation:
3874
	      mov edx,[ebx+4807*4+ebp]
3875
	      and edx,0xffffff
3876
	      mov [edi],dx
3877
	      shr edx,16
3878
	      mov [edi+2],dl
3879
 
3880
	   add edi,3
3881
	   add ebp,4
3882
	   inc [counter]
3883
	   cmp [counter],1;5
3884
	   jne horizontal_width_put_allocation
3885
 
3886
	   mov ecx,[Picture_SizeX]
3887
	   sub ecx,1;5
3888
	   lea ecx,[ecx+ecx*2]
3889
	   add edi,ecx
3890
	inc [counter2]
3891
	cmp [counter2],1;5
3892
	jne vertical_width_put_allocation
3893
	pop edi
3894
	pop ecx
3895
	add ebx,4
3896
	dec ecx
3897
	jnz next_color_put_allocation
3898
 
3899
	no_put_line_to_screen_allocation:
3900
 
3901
	cmp [DrawSprite_flag],1
3902
	jne no_activate_put_fon_
3903
 
3904
	cmp [Paste_flag],1
3905
	je no_put_fon___
3906
	call PutFonForSprite
3907
	no_put_fon___:
3908
	and [Paste_flag],0
3909
	no_activate_put_fon_:
3910
 
3911
	cmp [finishing_crossing],0
3912
	jz not_finish_from_instrument_crossing
3913
	and [Activate_instrument],0
3914
	and [crossing],0
3915
	and [instrument_used],0
3916
	and [DrawSprite_flag],0
3917
	call MovePictureToWorkScreen
3918
	jmp still
3919
	not_finish_from_instrument_crossing:
3920
 
3921
	;calculate line
3922
	mov ebx,[ReserveArray]
3923
	add ebx,4
3924
	mov eax,[PointerToPicture]
3925
	mov ecx,[Picture_SizeX]
3926
	mov edx,[OldX]
3927
	shl edx,16
3928
	add edx,[OldY]
3929
	mov esi,[ScreenX]
3930
	mov edi,[ScreenY]
3931
	add esi,[PosX]
3932
	add edi,[PosY]
3933
 
3934
	mov ebp,[Picture_SizeX]
3935
	dec ebp
3936
	cmp esi,ebp
3937
	jl no_minimum_x_allocation
3938
	mov esi,ebp
3939
	no_minimum_x_allocation:
3940
 
3941
	mov ebp,[Picture_SizeY]
3942
	dec ebp
3943
	cmp edi,ebp
3944
	jl no_minimum_y_allocation
3945
	mov edi,ebp
3946
	no_minimum_y_allocation:
3947
 
3948
	call calculate_rectangle
3949
	mov [counter],eax
3950
 
3951
	;save color pixels in ReserveArray
3952
	mov eax,[counter]
3953
	mov ebx,[ReserveArray]
3954
	mov [ebx],eax
3955
 
3956
	mov ecx,[ebx]
3957
	add ebx,4
3958
 
3959
	xor ebp,ebp
3960
	next_color_save_allocation:
3961
	;save color of pixel in ReserveArray
3962
	push ecx
3963
	and [counter2],0
3964
	mov edi,[ebx]
3965
	vertical_width_save_allocation:
3966
	   and [counter],0
3967
 
3968
	   horizontal_width_save_allocation:
3969
	      mov eax,edi
3970
	      mov edx,[eax]
3971
	      and edx,0xffffff
3972
	      mov [ebx+4807*4+ebp],dx
3973
	      shr edx,16
3974
	      mov [ebx+4807*4+2+ebp],dl
3975
 
3976
	   add edi,3
3977
	   add ebp,4
3978
	   inc [counter]
3979
	   cmp [counter],1;5
3980
	   jne horizontal_width_save_allocation
3981
 
3982
	   mov ecx,[Picture_SizeX]
3983
	   sub ecx,1;5
3984
	   lea ecx,[ecx+ecx*2]
3985
	   add edi,ecx
3986
	inc [counter2]
3987
	cmp [counter2],1;5
3988
	jne vertical_width_save_allocation
3989
	pop ecx
3990
	add ebx,4
3991
	dec ecx
3992
	jnz next_color_save_allocation
3993
 
3994
	cmp [DrawSprite_flag],1
3995
	jne no_save_fon_for_sprite_
3996
	;save current coordinats as old
3997
	mov eax,[SpriteCoordinatX]
3998
	mov ebx,[SpriteCoordinatY]
3999
	mov [SpriteOldCoordinatX],eax
4000
	mov [SpriteOldCoordinatY],ebx
4001
 
4002
	call SaveFonForSprite
4003
 
4004
	no_save_fon_for_sprite_:
4005
 
4006
	;draw calculated pixels on work arrea
4007
	mov ebx,[ReserveArray]
4008
	mov ecx,[ebx]
4009
	add ebx,4
4010
	next_pixel_put_allocation:
4011
 
4012
	mov edx,0x1f3fff
4013
	mov esi,edx
4014
	shr edx,16
4015
 
4016
	mov ebp,ecx
4017
	and ebp,8
4018
	cmp ebp,8
4019
	jne black_color
4020
	mov si,0xffff
4021
	mov dl,0xff
4022
	black_color:
4023
 
4024
	mov eax,[ebx]
4025
	mov [eax],si
4026
	mov [eax+2],dl
4027
 
4028
	add ebx,4
4029
	dec ecx
4030
	jnz next_pixel_put_allocation
4031
 
4032
	cmp [DrawSprite_flag],1
4033
	jne no_activate_draw_sprite_
4034
 
4035
	call DrawSprite
4036
 
4037
	no_activate_draw_sprite_:
4038
 
4039
	mov al,[instrument_used]
4040
	test al,al
4041
	jz no_change_coordinats
4042
	cmp [Activate_instrument],0
4043
	jz no_save_shades
4044
	mov eax,[ScreenX]
4045
	mov ebx,[ScreenY]
4046
	add eax,[PosX]
4047
	add ebx,[PosY]
4048
	mov [rectangular_shade_x],eax
4049
	mov [rectangular_shade_y],ebx
4050
	no_save_shades:
4051
 
4052
	call MovePictureToWorkScreen
4053
	jmp still
4054
	no_allocation:
4055
 
4056
	;*************reflection from left to right******************
4057
	cmp eax,35
4058
	jne no_reflection_from_left_to_right
4059
 
4060
	mov ebp,[PointerToPicture]
4061
	mov edx,[ReserveArray]
4062
	mov esi,[Picture_SizeX]
4063
	mov ebx,[Picture_SizeX]
4064
	lea ebx,[ebx+ebx*2]
4065
	shr esi,1
4066
	next_line_reflection_x:
4067
	;copy vertical line to array
4068
	mov ecx,[Picture_SizeX]
4069
	shr ecx,1
4070
	sub ecx,esi
4071
	lea ecx,[ecx+ecx*2]
4072
	add ecx,[PointerToPicture]
4073
	mov edx,[ReserveArray]
4074
	and edi,0
4075
	copy_to_array_line_reflection_y:
4076
	xor eax,eax
4077
	mov eax,[ecx]
4078
	mov ebp,edi
4079
	lea ebp,[ebp+ebp*2]
4080
	mov [edx+ebp],ax
4081
	shr eax,16
4082
	mov [edx+ebp+2],al
4083
	add ecx,ebx
4084
	inc edi
4085
	cmp edi,[Picture_SizeY]
4086
	jne copy_to_array_line_reflection_y
4087
 
4088
	mov ecx,[Picture_SizeX]
4089
	shr ecx,1
4090
	mov ebp,ecx
4091
	add ecx,esi
4092
	dec ecx
4093
	lea ecx,[ecx+ecx*2]
4094
	add ecx,[PointerToPicture]
4095
	sub ebp,esi
4096
	lea ebp,[ebp+ebp*2]
4097
	add ebp,[PointerToPicture]
4098
	and edi,0
4099
	next_line_reflection_y:
4100
	mov eax,[ecx]
4101
	and eax,0xffffff
4102
	mov [ebp],ax
4103
	shr eax,16
4104
	mov [ebp+2],al
4105
	add ebp,ebx
4106
	add ecx,ebx
4107
	inc edi
4108
	cmp edi,[Picture_SizeY]
4109
	jnz next_line_reflection_y
4110
 
4111
	;copy vertical line  from array to screen
4112
	mov ecx,[Picture_SizeX]
4113
	shr ecx,1
4114
	add ecx,esi
4115
	dec ecx
4116
	lea ecx,[ecx+ecx*2]
4117
	add ecx,[PointerToPicture]
4118
	mov edx,[ReserveArray]
4119
	and edi,0
4120
	copy_from_array_to_screen_reflection_y:
4121
	mov ebp,edi
4122
	lea ebp,[ebp+ebp*2]
4123
	xor eax,eax
4124
	mov eax,[edx+ebp]
4125
	mov [ecx],ax
4126
	shr eax,16
4127
	mov [ecx+2],al
4128
	add ecx,ebx
4129
	inc edi
4130
	cmp edi,[Picture_SizeY]
4131
	jne copy_from_array_to_screen_reflection_y
4132
 
4133
	dec esi
4134
	jnz next_line_reflection_x
4135
 
4136
	call MovePictureToWorkScreen
4137
	jmp still
4138
	no_reflection_from_left_to_right:
4139
 
4140
	;*************reflection from up to down******************
4141
	cmp eax,36
4142
	jne no_reflection_from_up_to_down
4143
	mov esi,[Picture_SizeX]
4144
	mov edi,esi
4145
	lea esi,[esi+esi*2]
4146
	lea edi,[edi+edi*2]
4147
	imul edi,[Picture_SizeY]
4148
	mov edx,[ReserveArray]
4149
	mov ecx,[Picture_SizeY]
4150
	shr ecx,1
4151
	add edi,[PointerToPicture]
4152
	sub edi,esi
4153
	mov ebp,[PointerToPicture]
4154
	next_lines_reflection:
4155
	;copy line
4156
	xor ebx,ebx
4157
	copy_line_1:
4158
	xor eax,eax
4159
	mov al,[edi+ebx]
4160
	mov [edx+ebx],al
4161
	inc ebx
4162
	cmp ebx,esi
4163
	jne copy_line_1
4164
 
4165
	xor ebx,ebx
4166
	copy_line_2:
4167
	xor eax,eax
4168
	mov al,[ebp+ebx]
4169
	mov [edi+ebx],al
4170
	inc ebx
4171
	cmp ebx,esi
4172
	jne copy_line_2
4173
 
4174
	xor ebx,ebx
4175
	copy_line_3:
4176
	xor eax,eax
4177
	mov al,[edx+ebx]
4178
	mov [ebp+ebx],al
4179
	inc ebx
4180
	cmp ebx,esi
4181
	jne copy_line_3
4182
 
4183
	add ebp,esi
4184
	sub edi,esi
4185
	dec ecx
4186
	jnz next_lines_reflection
4187
 
4188
	call MovePictureToWorkScreen
4189
	jmp still
4190
	no_reflection_from_up_to_down:
4191
 
4192
	;*********************draw hard contour*******************
4193
	cmp eax,38
4194
	jne no_kontur_
4195
 
4196
	mov al,[Activate_instrument]
4197
	test al,al
4198
	jnz no_new_konture_xy
4199
 
4200
	mov al,[instrument_used]
4201
	test al,al
4202
	jz instrument_not_used
4203
	mov eax,[used_OldX]
4204
	mov ebx,[used_OldY]
4205
	mov [OldX],eax
4206
	mov [OldY],ebx
4207
	jmp exit_used_instrument
4208
	instrument_not_used:
4209
 
4210
	mov eax,[ScreenX]
4211
	mov ebx,[ScreenY]
4212
	add eax,[PosX]
4213
	add ebx,[PosY]
4214
	mov [OldX],eax
4215
	mov [OldY],ebx
4216
	exit_used_instrument:
4217
 
4218
	mov al,[instrument_used]
4219
	test al,al
4220
	jnz instrument_used_true
4221
	mov [instrument_used],byte 1
4222
	instrument_used_true:
4223
 
4224
	mov [Activate_instrument],1
4225
	mov eax,[ReserveArray]
4226
	mov ecx,60000
4227
	clear_array_konture:
4228
	mov [eax],dword 0
4229
	add eax,4
4230
	dec ecx
4231
	jnz clear_array_line
4232
 
4233
	no_new_konture_xy:
4234
 
4235
	;put saved pixels
4236
	mov ebx,[ReserveArray]
4237
	mov eax,[ebx]
4238
	test eax,eax
4239
	jz no_put_line_to_screen_konture
4240
	mov ecx,[ebx]
4241
	add ebx,4
4242
	xor ebp,ebp
4243
	next_color_put_konture:
4244
	;put saved pixels in ReserveArray
4245
	push ecx
4246
	and [counter2],0
4247
	mov edi,[ebx]
4248
	push edi
4249
	vertical_width_put_konture:
4250
	   and [counter],0
4251
 
4252
	   horizontal_width_put_konture:
4253
	      mov edx,[ebx+4807*4+ebp]
4254
	      and edx,0xffffff
4255
	      mov [edi],dx
4256
	      shr edx,16
4257
	      mov [edi+2],dl
4258
 
4259
	   add edi,3
4260
	   add ebp,4
4261
	   inc [counter]
4262
	   cmp [counter],5
4263
	   jne horizontal_width_put_konture
4264
 
4265
	   mov ecx,[Picture_SizeX]
4266
	   sub ecx,5
4267
	   lea ecx,[ecx+ecx*2]
4268
	   add edi,ecx
4269
	inc [counter2]
4270
	cmp [counter2],5
4271
	jne vertical_width_put_konture
4272
	pop edi
4273
	pop ecx
4274
	add ebx,4
4275
	dec ecx
4276
	jnz next_color_put_konture
4277
 
4278
	no_put_line_to_screen_konture:
4279
 
4280
	;calculate line
4281
	mov ebx,[ReserveArray]
4282
	add ebx,4
4283
	mov eax,[PointerToPicture]
4284
	mov ecx,[Picture_SizeX]
4285
	mov edx,[OldX]
4286
	shl edx,16
4287
	add edx,[OldY]
4288
	mov esi,[ScreenX]
4289
	mov edi,[ScreenY]
4290
	add esi,[PosX]
4291
	add edi,[PosY]
4292
 
4293
	mov ebp,[Picture_SizeX]
4294
	sub ebp,[line_width]
4295
	cmp esi,ebp
4296
	jl no_minimum_x_konture
4297
	mov esi,ebp
4298
	no_minimum_x_konture:
4299
 
4300
	mov ebp,[Picture_SizeY]
4301
	sub ebp,[line_width]
4302
	cmp edi,ebp
4303
	jl no_minimum_y_konture
4304
	mov edi,ebp
4305
	no_minimum_y_konture:
4306
 
4307
	call calculate_line
4308
	;call calculate_rectangle
4309
	mov [counter],eax
4310
 
4311
	;save color pixels in ReserveArray
4312
	mov eax,[counter]
4313
	mov ebx,[ReserveArray]
4314
	mov [ebx],eax
4315
 
4316
	mov ecx,[ebx]
4317
	add ebx,4
4318
 
4319
	xor ebp,ebp
4320
	next_color_save_konture:
4321
	;save color of pixel in ReserveArray
4322
	push ecx
4323
	and [counter2],0
4324
	mov edi,[ebx]
4325
	vertical_width_save_konture:
4326
	   and [counter],0
4327
 
4328
	   horizontal_width_save_konture:
4329
	      mov eax,edi
4330
	      mov edx,[eax]
4331
	      and edx,0xffffff
4332
	      mov [ebx+4807*4+ebp],dx
4333
	      shr edx,16
4334
	      mov [ebx+4807*4+2+ebp],dl
4335
 
4336
	   add edi,3
4337
	   add ebp,4
4338
	   inc [counter]
4339
	   cmp [counter],5
4340
	   jne horizontal_width_save_konture
4341
 
4342
	   mov ecx,[Picture_SizeX]
4343
	   sub ecx,5
4344
	   lea ecx,[ecx+ecx*2]
4345
	   add edi,ecx
4346
	inc [counter2]
4347
	cmp [counter2],5
4348
	jne vertical_width_save_konture
4349
	pop ecx
4350
	add ebx,4
4351
	dec ecx
4352
	jnz next_color_save_konture
4353
 
4354
	;draw calculated pixels on work arrea
4355
	mov ebx,[ReserveArray]
4356
	mov ecx,[ebx]
4357
	mov edx,[Color]
4358
	mov esi,[Color]
4359
	shr edx,16
4360
	add ebx,4
4361
	mov edi,[line_width]
4362
	dec edi
4363
	imul edi,25
4364
	next_pixel_put_konture:
4365
 
4366
	mov eax,[ebx]
4367
	push eax
4368
	push ecx
4369
	xor ebp,ebp
4370
	and [counter2],0
4371
 
4372
	vertical_width_konture:
4373
	   and [counter],0
4374
 
4375
	   horizontal_width_konture:
4376
	   xor ecx,ecx
4377
	   mov cl,byte[width_pixels+edi+ebp]
4378
	   test cl,cl
4379
	     jz no_draw_pixel_konture
4380
	      mov [eax],si
4381
	      mov [eax+2],dl
4382
	     no_draw_pixel_konture:
4383
	   add eax,3
4384
	   inc ebp
4385
	   inc [counter]
4386
	   cmp [counter],5
4387
	   jne horizontal_width_konture
4388
 
4389
	   mov ecx,[Picture_SizeX]
4390
	   sub ecx,5
4391
	   lea ecx,[ecx+ecx*2]
4392
	   add eax,ecx
4393
	inc [counter2]
4394
	cmp [counter2],5
4395
	jne vertical_width_konture
4396
 
4397
	pop ecx
4398
	pop eax
4399
	add ebx,4
4400
	dec ecx
4401
	jnz next_pixel_put_konture
4402
 
4403
	mov eax,[ScreenX]
4404
	mov ebx,[ScreenY]
4405
	add eax,[PosX]
4406
	add ebx,[PosY]
4407
	mov [used_OldX],eax
4408
	mov [used_OldY],ebx
4409
 
4410
	call MovePictureToWorkScreen
4411
 
4412
	jmp still
4413
 
4414
	no_kontur_:
4415
	;************************Draw ellips***********************
4416
	cmp eax,39
4417
	jne no_ellips
4418
 
4419
	mov al,[Activate_instrument]
4420
	test al,al
4421
	jnz no_new_ellips_xy
4422
	mov eax,[ScreenX]
4423
	mov ebx,[ScreenY]
4424
	add eax,[PosX]
4425
	add ebx,[PosY]
4426
	mov [OldX],eax
4427
	mov [OldY],ebx
4428
	mov [Activate_instrument],1
4429
	mov eax,[ReserveArray]
4430
	mov ecx,60000
4431
	clear_array_ellips:
4432
	mov [eax],dword 0
4433
	add eax,4
4434
	dec ecx
4435
	jnz clear_array_ellips
4436
	jmp still
4437
	no_new_ellips_xy:
4438
 
4439
	;put saved pixels
4440
	mov ebx,[ReserveArray]
4441
	mov eax,[ebx]
4442
	test eax,eax
4443
	jz no_put_line_to_screen_ellips
4444
	mov ecx,[ebx]
4445
	add ebx,4
4446
	xor ebp,ebp
4447
	next_color_put_ellips:
4448
	;put saved pixels in ReserveArray
4449
	push ecx
4450
	and [counter2],0
4451
	mov edi,[ebx]
4452
	push edi
4453
	vertical_width_put_ellips:
4454
	   and [counter],0
4455
 
4456
	   horizontal_width_put_ellips:
4457
	      mov edx,[ebx+4807*4+ebp]
4458
	      and edx,0xffffff
4459
	      mov [edi],dx
4460
	      shr edx,16
4461
	      mov [edi+2],dl
4462
 
4463
	   add edi,3
4464
	   add ebp,4
4465
	   inc [counter]
4466
	   cmp [counter],5
4467
	   jne horizontal_width_put_ellips
4468
 
4469
	   mov ecx,[Picture_SizeX]
4470
	   sub ecx,5
4471
	   lea ecx,[ecx+ecx*2]
4472
	   add edi,ecx
4473
	inc [counter2]
4474
	cmp [counter2],5
4475
	jne vertical_width_put_ellips
4476
	pop edi
4477
	pop ecx
4478
	add ebx,4
4479
	dec ecx
4480
	jnz next_color_put_ellips
4481
 
4482
	no_put_line_to_screen_ellips:
4483
 
4484
	mov esi,[ScreenX]
4485
	mov edi,[ScreenY]
4486
	add esi,[PosX]
4487
	add edi,[PosY]
4488
 
4489
	sub esi,[OldX]
4490
	jns no_sign_x_ellips
4491
	neg esi
4492
	shr esi,1
4493
	neg esi
4494
	add esi,[OldX]
4495
	jmp no_plus_sign_x_ellips
4496
	no_sign_x_ellips:
4497
 
4498
	shr esi,1
4499
	add esi,[OldX]
4500
	no_plus_sign_x_ellips:
4501
 
4502
	sub edi,[OldY]
4503
	jns no_sign_y_ellips
4504
	neg edi
4505
	shr edi,1
4506
	neg edi
4507
	add edi,[OldY]
4508
	jmp no_plus_sign_y_ellips
4509
	no_sign_y_ellips:
4510
 
4511
	shr edi,1
4512
	add edi,[OldY]
4513
	no_plus_sign_y_ellips:
4514
 
4515
	mov [x],esi
4516
	mov [y],edi
4517
 
4518
	mov esi,[ScreenX]
4519
	mov edi,[ScreenY]
4520
	add esi,[PosX]
4521
	add edi,[PosY]
4522
 
4523
	sub esi,[OldX]
4524
	jns no_sign_x_ellips_r
4525
	neg esi
4526
	no_sign_x_ellips_r:
4527
 
4528
	sub edi,[OldY]
4529
	jns no_sign_y_ellips_r
4530
	neg edi
4531
	no_sign_y_ellips_r:
4532
 
4533
	cmp edi,0
4534
	jnz no_null_a_ellips
4535
	mov edi,1
4536
	no_null_a_ellips:
4537
 
4538
	shr esi,1
4539
	shr edi,1
4540
	mov [a_ellips],esi
4541
	mov [b_ellips],edi
4542
 
4543
	mov edi,[x]
4544
	mov ebp,[y]
4545
	add edi,esi
4546
	add ebp,esi
4547
 
4548
	mov edx,[Picture_SizeX]
4549
	sub edx,[line_width]
4550
	cmp edi,edx
4551
	jl no_limit_x_ellips
4552
	sub edi,edx
4553
	sub [a_ellips],edi
4554
	no_limit_x_ellips:
4555
 
4556
	mov edx,[Picture_SizeY]
4557
	sub edx,[line_width]
4558
	cmp ebp,edx
4559
	jl no_limit_y_ellips
4560
	sub ebp,edx
4561
	sub [b_ellips],ebp
4562
	no_limit_y_ellips:
4563
 
4564
 
4565
	mov edi,[x]
4566
	mov ebp,[y]
4567
 
4568
	sub edi,[a_ellips]
4569
	jns no_minimum_x_ellips
4570
	add [a_ellips],edi
4571
	no_minimum_x_ellips:
4572
 
4573
	sub ebp,[b_ellips]
4574
	jns no_minimum_y_ellips
4575
	add [b_ellips],ebp
4576
	no_minimum_y_ellips:
4577
 
4578
	;calculate circle
4579
	mov ebx,[ReserveArray]
4580
	add ebx,4
4581
	mov eax,[PointerToPicture]
4582
	mov ecx,[Picture_SizeX]
4583
	mov edx,[x]
4584
	shl edx,16
4585
	add edx,[y]
4586
	mov esi,[a_ellips]
4587
	shl esi,16
4588
	add esi,[b_ellips]
4589
	call calculate_ellips
4590
 
4591
	mov [counter],eax
4592
 
4593
	;save color pixels in ReserveArray
4594
	mov eax,[counter]
4595
	mov ebx,[ReserveArray]
4596
	mov [ebx],eax
4597
 
4598
	mov ecx,[ebx]
4599
	add ebx,4
4600
 
4601
	xor ebp,ebp
4602
	next_color_save_ellips:
4603
	;save color of pixel in ReserveArray
4604
	push ecx
4605
	and [counter2],0
4606
	mov edi,[ebx]
4607
	vertical_width_save_ellips:
4608
	   and [counter],0
4609
 
4610
	   horizontal_width_save_ellips:
4611
	      mov eax,edi
4612
	      mov edx,[eax]
4613
	      and edx,0xffffff
4614
	      mov [ebx+4807*4+ebp],dx
4615
	      shr edx,16
4616
	      mov [ebx+4807*4+2+ebp],dl
4617
 
4618
	   add edi,3
4619
	   add ebp,4
4620
	   inc [counter]
4621
	   cmp [counter],5
4622
	   jne horizontal_width_save_ellips
4623
 
4624
	   mov ecx,[Picture_SizeX]
4625
	   sub ecx,5
4626
	   lea ecx,[ecx+ecx*2]
4627
	   add edi,ecx
4628
	inc [counter2]
4629
	cmp [counter2],5
4630
	jne vertical_width_save_ellips
4631
	pop ecx
4632
	add ebx,4
4633
	dec ecx
4634
	jnz next_color_save_ellips
4635
 
4636
	;draw calculated pixels on work arrea
4637
	mov ebx,[ReserveArray]
4638
	mov ecx,[ebx]
4639
	mov edx,[Color]
4640
	mov esi,[Color]
4641
	shr edx,16
4642
	add ebx,4
4643
	mov edi,[line_width]
4644
	dec edi
4645
	imul edi,25
4646
	next_pixel_put_ellips:
4647
 
4648
	mov eax,[ebx]
4649
	push eax
4650
	push ecx
4651
	xor ebp,ebp
4652
	and [counter2],0
4653
 
4654
	vertical_width_ellips:
4655
	   and [counter],0
4656
 
4657
	   horizontal_width_ellips:
4658
	   xor ecx,ecx
4659
	   mov cl,byte[width_pixels+edi+ebp]
4660
	   test cl,cl
4661
	     jz no_draw_pixel_ellips
4662
	      mov [eax],si
4663
	      mov [eax+2],dl
4664
	     no_draw_pixel_ellips:
4665
	   add eax,3
4666
	   inc ebp
4667
	   inc [counter]
4668
	   cmp [counter],5
4669
	   jne horizontal_width_ellips
4670
 
4671
	   mov ecx,[Picture_SizeX]
4672
	   sub ecx,5
4673
	   lea ecx,[ecx+ecx*2]
4674
	   add eax,ecx
4675
	inc [counter2]
4676
	cmp [counter2],5
4677
	jne vertical_width_ellips
4678
 
4679
	pop ecx
4680
	pop eax
4681
	add ebx,4
4682
	dec ecx
4683
	jnz next_pixel_put_ellips
4684
 
4685
	call MovePictureToWorkScreen
4686
	jmp still
4687
	no_ellips:
4688
 
4689
	;*************************Line width 1*********************
4690
	cmp eax,41
4691
	jne no_line_width_1
4692
	mov [line_width],1
4693
	jmp still
4694
	no_line_width_1:
4695
	;*************************Line width 2*********************
4696
	cmp eax,42
4697
	jne no_line_width_2
4698
	mov [line_width],2
4699
	jmp still
4700
	no_line_width_2:
4701
	;*************************Line width 3*********************
4702
	cmp eax,43
4703
	jne no_line_width_3
4704
	mov [line_width],3
4705
	jmp still
4706
	no_line_width_3:
4707
	;*************************Line width 4*********************
4708
	cmp eax,44
4709
	jne no_line_width_4
4710
	mov [line_width],4
4711
	jmp still
4712
	no_line_width_4:
4713
	;*************************Line width 5*********************
4714
	cmp eax,45
4715
	jne no_line_width_5
4716
	mov [line_width],5
4717
	jmp still
4718
	no_line_width_5:
4719
 
4720
	jmp still
4721
	ret
4722
;-----------------------------------------------------------
4723
;-----------calculate cordinats on work picture--------------
4724
;-----------------------------------------------------------
4725
GetScreenCordinats:
4726
 
4727
	mov eax,[MouseX]
4728
	mov ebx,[MouseY]
4729
	sub eax,9
4730
	sub ebx,83
4731
 
4732
	mov ecx,[k]
4733
	cdq
4734
	idiv ecx
4735
	mov [ScreenX],eax
4736
	mov eax,ebx
4737
	cdq
4738
	idiv ecx
4739
	mov [ScreenY],eax
4740
 
4741
	ret
4742
;-----------------------------------------------------------
4743
;------------------SaveFonForSprite-------------------------
4744
;-----------------------------------------------------------
4745
SaveFonForSprite:
4746
 
4747
	mov edi,[PointerToSpriteBufer]
4748
	mov ecx,[SpriteSizeX]
4749
	mov edx,[Picture_SizeX]
4750
	sub edx,[SpriteSizeX]
4751
	mov esi,[SpriteCoordinatY]
4752
	imul esi,[Picture_SizeX]
4753
	add esi,[SpriteCoordinatX]
4754
	lea edx,[edx+edx*2]
4755
	lea esi,[esi+esi*2]
4756
	add esi,[PointerToPicture]
4757
	mov ebx,[SpriteSizeY]
4758
	mov [counter],ecx
4759
 
4760
	next_line_sprite_save:
4761
	mov ecx,[counter]
4762
 
4763
	next_pixel_sprite_save:
4764
	mov eax,[esi]
4765
	and eax,0xffffff
4766
	mov [edi],ax
4767
	shr eax,16
4768
	mov [edi+2],al
4769
	add esi,3
4770
	add edi,3
4771
	dec ecx
4772
	jnz next_pixel_sprite_save
4773
 
4774
	add esi,edx
4775
	dec ebx
4776
	jnz next_line_sprite_save
4777
 
4778
	ret
4779
;-----------------------------------------------------------
4780
;-------------------PutFonForSprite-------------------------
4781
;-----------------------------------------------------------
4782
PutFonForSprite:
4783
 
4784
	mov esi,[PointerToSpriteBufer]
4785
	mov ecx,[SpriteSizeX]
4786
	mov edx,[Picture_SizeX]
4787
	sub edx,[SpriteSizeX]
4788
	mov edi,[SpriteOldCoordinatY]
4789
	imul edi,[Picture_SizeX]
4790
	add edi,[SpriteOldCoordinatX]
4791
	lea edx,[edx+edx*2]
4792
	lea edi,[edi+edi*2]
4793
	add edi,[PointerToPicture]
4794
	mov ebx,[SpriteSizeY]
4795
	mov [counter],ecx
4796
 
4797
	next_line_sprite_put:
4798
	mov ecx,[counter]
4799
 
4800
	next_pixel_sprite_put:
4801
	mov eax,[esi]
4802
	and eax,0xffffff
4803
	mov [edi],ax
4804
	shr eax,16
4805
	mov [edi+2],al
4806
	add esi,3
4807
	add edi,3
4808
	dec ecx
4809
	jnz next_pixel_sprite_put
4810
 
4811
	add edi,edx
4812
	dec ebx
4813
	jnz next_line_sprite_put
4814
 
4815
	ret
4816
;-----------------------------------------------------------
4817
;------------------DrawFonForSprite-------------------------
4818
;-----------------------------------------------------------
4819
DrawSprite:
4820
 
4821
	mov esi,[PointerToEditBufer]
4822
	mov ecx,[SpriteSizeX]
4823
	mov edx,[Picture_SizeX]
4824
	sub edx,[SpriteSizeX]
4825
	mov edi,[SpriteCoordinatY]
4826
	imul edi,[Picture_SizeX]
4827
	add edi,[SpriteCoordinatX]
4828
	lea edx,[edx+edx*2]
4829
	lea edi,[edi+edi*2]
4830
	add edi,[PointerToPicture]
4831
	mov ebx,[SpriteSizeY]
4832
	mov [counter],ecx
4833
 
4834
	next_line_sprite_draw:
4835
	mov ecx,[counter]
4836
 
4837
	next_pixel_sprite_draw:
4838
	mov eax,[esi]
4839
	and eax,0xffffff
4840
	mov [edi],ax
4841
	shr eax,16
4842
	mov [edi+2],al
4843
	add esi,3
4844
	add edi,3
4845
	dec ecx
4846
	jnz next_pixel_sprite_draw
4847
 
4848
	add edi,edx
4849
	dec ebx
4850
	jnz next_line_sprite_draw
4851
 
4852
	ret
4853
;-----------------------------------------------------------
4854
;-------find simvole in string------------------------------
4855
;-----------------------------------------------------------
4856
find_symvol:
4857
	;eax,string
4858
	;ebx,symvol
4859
	mov esi,eax
4860
	next_symvol:
4861
	xor ecx,ecx
4862
	mov cl,[eax]
4863
	cmp cl,bl
4864
	je symvol_fined
4865
	inc eax
4866
	jmp next_symvol
4867
 
4868
	symvol_fined:
4869
	sub eax,esi
4870
	ret
4871
;-----------------------------------------------------------
4872
;--------load file in memory--------------------------------
4873
;-----------------------------------------------------------
4874
load_file:
4875
	 mov eax,58
4876
	 mov ebx,file_info
4877
	 int 0x40
4878
	 test eax,eax
4879
	 jnz no_open_
4880
	 mov [length_file],ebx
4881
	 shr ebx,9
4882
	 inc ebx
4883
	 mov [file_info+8],ebx
4884
	 mov eax,58
4885
	 mov ebx,file_info
4886
	 int 0x40
4887
	 no_open_:
4888
	 ret
4889
;-----------------------------------------------------------
4890
;---load icons  in memory and draw icons on panel-----------
4891
;-----------------------------------------------------------
4892
load_icons:
4893
	 mov esi,panel_picture
4894
	 mov edi,[ScreenPointer]
4895
	 mov eax,edi
4896
	 add edi,(1200*1000*3)
4897
	 call ReadGIF
4898
 
4899
	 ret
4900
 
4901
draw_icons:
4902
	 mov [Icon_X],10
4903
	 mov [Icon_Y],20+15+4
4904
	 and [counter],0
4905
   next_icon:
4906
	 mov eax,8
4907
	 mov ebx,[Icon_X]
4908
	 mov ecx,[Icon_Y]
4909
	 dec ebx
4910
	 dec ecx
4911
	 shl ebx,16
4912
	 shl ecx,16
4913
	 add ebx,20
4914
	 add ecx,20
4915
	 mov edx,[counter]
4916
	 add edx,10
4917
	 add edx,1000000000000000000000000000000b
4918
	 int 0x40
4919
 
4920
 
4921
	 mov edx,[Icon_X]
4922
	 shl edx,16
4923
	 add edx,[Icon_Y]
4924
	 mov ebx,[counter]
4925
	 imul ebx,20*20*3
4926
	 add ebx,[ScreenPointer]
4927
	 add ebx,(1200*1000*3)+12
4928
	 mov eax,7
4929
	 mov ecx,20*65536+20
4930
	 int 0x40
4931
 
4932
	 add [Icon_X],25
4933
	 cmp [Icon_X],10+25*15
4934
	 jl no_next_line_icons
4935
	 mov [Icon_X],10
4936
	 mov [Icon_Y],20+15+4+22
4937
	 no_next_line_icons:
4938
	 inc [counter]
4939
	 cmp [counter],30
4940
	 jl next_icon
4941
 
4942
	 and [counter],0
4943
	 mov [Icon_X],475
4944
	 mov [Icon_Y],20+15+7
4945
	 next_button_line:
4946
 
4947
	 mov eax,8
4948
	 mov ebx,[Icon_X]
4949
	 mov ecx,[Icon_Y]
4950
	 dec ebx
4951
	 dec ecx
4952
	 shl ebx,16
4953
	 shl ecx,16
4954
	 add ebx,10
4955
	 add ecx,35
4956
	 mov edx,[counter]
4957
	 add edx,40
4958
	 add edx,1000000000000000000000000000000b
4959
	 int 0x40
4960
 
4961
	 mov eax,13
4962
	 mov ebx,[Icon_X]
4963
	 mov ecx,[Icon_Y]
4964
	 add ebx,4
4965
	 shl ebx,16
4966
	 shl ecx,16
4967
	 add ebx,[counter]
4968
	 add ecx,35
4969
	 ;xor edx,edx
4970
	 mov edx,0xb1d8ff
4971
	 int 0x40
4972
 
4973
	 add [Icon_X],15
4974
	 inc [counter]
4975
	 cmp [counter],5
4976
	 jle next_button_line
4977
	 ret
4978
;-----------------------------------------------------------
4979
;calculate position work screen on a picture
4980
;-----------------------------------------------------------
4981
CalculatePositionScreen:
4982
 
4983
	 mov eax,[Picture_SizeX]
4984
	 mov ebx,[Picture_SizeY]
4985
	 mov ecx,[CounterX]
4986
	 mov edx,[CounterY]
4987
	 sub eax,ecx
4988
	 sub ebx,edx
4989
 
4990
	 cmp [PosX],eax
4991
	 jle no_limit_screen_x
4992
	 mov [PosX],eax
4993
	 no_limit_screen_x:
4994
 
4995
	 cmp [PosY],ebx
4996
	 jle no_limit_screen_y
4997
	 mov [PosY],ebx
4998
	 no_limit_screen_y:
4999
 
5000
	 cmp [PosX],0
5001
	 jns no_minimum_screen_x
5002
	 mov [PosX],0
5003
	 no_minimum_screen_x:
5004
 
5005
	 cmp [PosY],0
5006
	 jns no_minimum_screen_y
5007
	 mov [PosY],0
5008
	 no_minimum_screen_y:
5009
 
5010
	 ret
5011
;-----------------------------------------------------------
5012
;-------analizing picture to palette------------------------
5013
;-----------------------------------------------------------
5014
analizing_picture_to_palette:
5015
 
5016
	 mov eax,[Picture_SizeX]
5017
	 mov ebx,[Picture_SizeY]
5018
	 imul eax,ebx
5019
	 mov ecx,eax
5020
	 mov edx,[PointerToPicture]
5021
	 mov esi,1 ;counter colors in palette
5022
 
5023
	 ;put firs color of picture how one color in palette
5024
	 mov ebp,[PointerToPalette]
5025
	 mov eax,[edx]
5026
	 and eax,0xffffff
5027
	 mov [ebp],eax
5028
 
5029
	 analizing_to_palette:
5030
	 mov eax,[edx]
5031
	 and eax,0xffffff
5032
 
5033
	 mov edi,esi
5034
	 mov ebp,[PointerToPalette]
5035
	 next_color_in_palette:
5036
	 mov ebx,[ebp]
5037
	 and ebx,0xffffff
5038
	 cmp ebx,eax	     ;this is color have in palette
5039
	 je exit_loop_palette
5040
	 add ebp,4
5041
	 dec edi
5042
	 jnz next_color_in_palette
5043
 
5044
	 inc esi
5045
	 cmp esi,256 ;256 colors
5046
	 ja more_than_256_colors
5047
	 mov ebp,[PointerToPalette]
5048
	 mov ebx,esi
5049
	 dec ebx
5050
	 shl ebx,2
5051
	 add ebp,ebx
5052
	 mov [ebp],ax
5053
	 shr eax,16
5054
	 mov [ebp+2],al
5055
 
5056
	 exit_loop_palette:
5057
 
5058
	 add edx,3
5059
	 dec ecx
5060
	 jnz analizing_to_palette
5061
 
5062
 
5063
	 more_than_256_colors:
5064
	 mov eax,esi
5065
	 ret
5066
;---------------------------------------------------------
5067
;---------------SOUND of EVENTS---------------------------
5068
;---------------------------------------------------------
5069
sound:
5070
	  mov eax,55
5071
	  mov ebx,eax
5072
	  int 0x40
5073
	  ret
5074
;----------------------------------------------------------
5075
;-------------file info structure--------------------------
5076
;----------------------------------------------------------
5077
file_info:
5078
		     dd 0
5079
		     dd 0
5080
		     dd 1
5081
		     dd 0x19000+0x10000
5082
		     dd 0x19000
5083
 
5084
		    file_path:
5085
		     times 256 db 0
5086
;-----------------------------------------------------------
5087
;------------variables and data of program------------------
5088
;-----------------------------------------------------------
5089
length_file	     dd 0
5090
 
5091
time		     dd 0
5092
sound_havent_memory  db 150,64,0
5093
PosX		     dd 0
5094
PosY		     dd 0
5095
ScreenPointer	     dd 0
5096
PointerToPicture     dd 0
5097
PointerToCopyPicture dd 0
5098
PointerToCopyPicture2 dd 0
5099
PointerToEditBufer   dd 0
5100
PointerToSpriteBufer dd 0
5101
PointerToPalette     dd 0
5102
Color		     dd 0
5103
Number_Brush	     dd 0
5104
Brush_SizeX	     dd 0
5105
Brush_SizeY	     dd 0
5106
Current_instrument   dd 0
5107
Activate_instrument  db 0
5108
SColor		     dd 0
5109
OldX		     dd 0
5110
OldY		     dd 0
5111
 
5112
MouseX		     dd 0
5113
MouseY		     dd 0
5114
Window_SizeX	     dd 0
5115
Window_SizeY	     dd 0
5116
Window_CordinatX     dd 0
5117
Window_CordinatY     dd 0
5118
Picture_SizeX	     dd 0
5119
Picture_SizeY	     dd 0
5120
ScreenX 	     dd 0
5121
ScreenY 	     dd 0
5122
WorkScreen_SizeX     dd 0
5123
WorkScreen_SizeY     dd 0
5124
MaxWorkScreen_SizeX  dd 0
5125
MaxWorkScreen_SizeY  dd 0
5126
k		     dd 0
5127
IPC_table	     rd 256
5128
ReserveArray	     dd 0
5129
register	     dd 0
5130
CounterX	     dd 0
5131
CounterY	     dd 0
5132
OffsetYPicture	     dd 0
5133
OffsetYWorkScreen    dd 0
5134
OffsetYBigPixel      dd 0
5135
 
5136
Icon_X		     dd 0
5137
Icon_Y		     dd 0
5138
counter 	     dd 0
5139
counter2	     dd 0
5140
Icon_text_x	     dd 0
5141
Icon_text_y	     dd 0
5142
Panel_flag	     db 0
5143
counter_menu	     dd 0
5144
menu_coordinat_x     dd 0
5145
menu_size_x	     dd 0
5146
menu_counter	     dd 0
5147
counter_11	     dd 0
5148
number_panel	     dd 0
5149
number_menu	     dd 0
5150
 
5151
Scroll1CoordinatX    dd 0
5152
Scroll1CoordinatY    dd 0
5153
Scroll1MaxSizeX      dd 0
5154
Scroll1MaxSizeY      dd 0
5155
Scroll1SizeX	     dd 0
5156
Scroll1FreeX	     dd 0
5157
 
5158
Scroll2CoordinatX    dd 0
5159
Scroll2CoordinatY    dd 0
5160
Scroll2MaxSizeX      dd 0
5161
Scroll2MaxSizeY      dd 0
5162
Scroll2SizeY	     dd 0
5163
Scroll2FreeY	     dd 0
5164
 
5165
extended_memory      dd 0
5166
type		     dw 0
5167
x		     dd 0
5168
y		     dd 0
5169
save_flag	     db 0
5170
exit_from_work_arrea db 0
5171
 
5172
Radius		     dd 0
5173
Dx_		     dd 0
5174
Dy_		     dd 0
5175
line_width	     dd 0
5176
lastik_is_active     db 0
5177
a_ellips	     dd 0
5178
b_ellips	     dd 0
5179
instrument_used      db 0
5180
used_OldX	     dd 0
5181
used_OldY	     dd 0
5182
rectangular_shade_x  dd 0
5183
rectangular_shade_y  dd 0
5184
crossing_old_x	     dd 0
5185
crossing_old_y	     dd 0
5186
crossing	     dd 0
5187
finishing_crossing   dd 0
5188
number_undo	     dd 0
5189
DrawSprite_flag      db 0
5190
Paste_flag	     db 0
5191
SpriteSizeX	     dd 0
5192
SpriteSizeY	     dd 0
5193
SpriteCoordinatX     dd 0
5194
SpriteCoordinatY     dd 0
5195
SpriteOldCoordinatX  dd 0
5196
SpriteOldCoordinatY  dd 0
5197
;**********************************************************
5198
;------------------TEXT DATA-------------------------------
5199
;**********************************************************
5200
name_of_program      db 'Graphics editor <> V1.00 '
5201
mouse_pos_x	     db 'X='
5202
mouse_pos_y	     db 'Y='
5203
new_text1	     db 'PICTURE SIZE X'
5204
new_text2	     db 'PICTURE SIZE Y'
5205
ok_text 	     db 'OK'
5206
 
5207
panel_text	     dd 15,24,4
5208
		     db 'FILE'
5209
		     dd 95,24,4
5210
		     db 'EDIT'
5211
		     dd 175,24,11
5212
		     db 'INSTRUMENTS'
5213
		     dd 255,24,7
5214
		     db 'PALETTE'
5215
		     dd 335,24,7
5216
		     db 'FILTERS'
5217
		     dd 415,24,9
5218
		     db 'ANIMATION'
5219
		     dd 495,24,4
5220
		     db 'HELP'
5221
menu_text_en:
5222
		     dd menu_text7
5223
		     dd menu_text6
5224
		     dd menu_text5
5225
		     dd menu_text4
5226
		     dd menu_text3
5227
		     dd menu_text2
5228
		     dd menu_text1
5229
		     dd 0,0,0
5230
 
5231
menu_rectangles      dd 485,36,100,100
5232
		     dd 405,36,100,100
5233
		     dd 325,36,100,100
5234
		     dd 245,36,100,100
5235
		     dd 165,36,100,100
5236
		     dd 85,36,100,100;20
5237
		     dd 5,36,100,100
5238
 
5239
 
5240
menu_text1:
5241
		     dd 15,45,3
5242
		     db 'NEW'
5243
		     dd 15,65,4
5244
		     db 'OPEN'
5245
		     dd 15,85,4
5246
		     db 'SAVE'
5247
		     dd 15,105,7
5248
		     db 'SAVE AS'
5249
		     dd 15,125,4
5250
		     db 'EXIT'
5251
 
5252
menu_text2:
5253
		     dd 95,45,4
5254
		     db 'UNDO'
5255
		     dd 95,65,4
5256
		     db 'COPY'
5257
		     dd 95,85,5
5258
		     db 'PASTE'
5259
		     dd 95,105,3
5260
		     db 'CUT'
5261
		     dd 95,125,13
5262
		     db 'CLEARE SCREEN'
5263
		     ;dd 95,145,12
5264
		     ;db 'ALLOCATE ALL'
5265
menu_text3:
5266
		     dd 175,45,3
5267
		     db 0,0,0;'PENCIL'
5268
		     dd 175,65,3
5269
		     db 0,0,0;'BRUSHES'
5270
		     dd 175,85,3
5271
		     db 0,0,0;'COLORS'
5272
		     dd 175,105,3
5273
		     db 0,0,0;'PIPETKA'
5274
menu_text4:
5275
		     dd 255,45,1
5276
		     db 0,0,0
5277
menu_text5:
5278
		     dd 335,45,1
5279
		     db 0,0,0
5280
menu_text6:
5281
		     dd 415,45,1
5282
		     db 0,0,0
5283
menu_text7:
5284
		     dd 495,45,1
5285
		     db 0,0,0,0
5286
 
5287
 
5288
menu_counters:
5289
		     dd 1,1,1,1,1,5,5
5290
 
5291
;----------------------------------------------------------
5292
palitra:		 ;three bytes for one color
5293
db 0,0,0,0,0,0,128,0
5294
db 0,128,0,0,0,128,128,0
5295
db 128,0,0,0,128,0,128,0
5296
db 128,128,0,0,128,128,128,0
5297
db 192,220,192,0,240,202,166,0
5298
db 170,63,42,0,255,63,42,0
5299
db 0,95,42,0,85,95,42,0
5300
db 170,95,42,0,255,95,42,0
5301
db 0,127,42,0,85,127,42,0
5302
db 170,127,42,0,255,127,42,0
5303
db 0,159,42,0,85,159,42,0
5304
db 170,159,42,0,255,159,42,0
5305
db 0,191,42,0,85,191,42,0
5306
db 170,191,42,0,255,191,42,0
5307
db 0,223,42,0,85,223,42,0
5308
db 170,223,42,0,255,223,42,0
5309
db 0,255,42,0,85,255,42,0
5310
db 170,255,42,0,255,255,42,0
5311
db 0,0,85,0,85,0,85,0
5312
db 170,0,85,0,255,0,85,0
5313
db 0,31,85,0,85,31,85,0
5314
db 170,31,85,0,255,31,85,0
5315
db 0,63,85,0,85,63,85,0
5316
db 170,63,85,0,255,63,85,0
5317
db 0,95,85,0,85,95,85,0
5318
db 170,95,85,0,255,95,85,0
5319
db 0,127,85,0,85,127,85,0
5320
db 170,127,85,0,255,127,85,0
5321
db 0,159,85,0,85,159,85,0
5322
db 170,159,85,0,255,159,85,0
5323
db 0,191,85,0,85,191,85,0
5324
db 170,191,85,0,255,191,85,0
5325
db 0,223,85,0,85,223,85,0
5326
db 170,223,85,0,255,223,85,0
5327
db 0,255,85,0,85,255,85,0
5328
db 170,255,85,0,255,255,85,0
5329
db 0,0,127,0,85,0,127,0
5330
db 170,0,127,0,255,0,127,0
5331
db 0,31,127,0,85,31,127,0
5332
db 170,31,127,0,255,31,127,0
5333
db 0,63,127,0,85,63,127,0
5334
db 170,63,127,0,255,63,127,0
5335
db 0,95,127,0,85,95,127,0
5336
db 170,95,127,0,255,95,127,0
5337
db 0,127,127,0,85,127,127,0
5338
db 170,127,127,0,255,127,127,0
5339
db 0,159,127,0,85,159,127,0
5340
db 170,159,127,0,255,159,127,0
5341
db 0,191,127,0,85,191,127,0
5342
db 170,191,127,0,255,191,127,0
5343
db 0,223,127,0,85,223,127,0
5344
db 170,223,127,0,255,223,127,0
5345
db 0,255,127,0,85,255,127,0
5346
db 170,255,127,0,255,255,127,0
5347
db 0,0,170,0,85,0,170,0
5348
db 170,0,170,0,255,0,170,0
5349
db 0,31,170,0,85,31,170,0
5350
db 170,31,170,0,255,31,170,0
5351
db 0,63,170,0,85,63,170,0
5352
db 170,63,170,0,255,63,170,0
5353
db 0,95,170,0,85,95,170,0
5354
db 170,95,170,0,255,95,170,0
5355
db 0,127,170,0,85,127,170,0
5356
db 170,127,170,0,255,127,170,0
5357
db 0,159,170,0,85,159,170,0
5358
db 170,159,170,0,255,159,170,0
5359
db 0,191,170,0,85,191,170,0
5360
db 170,191,170,0,255,191,170,0
5361
db 0,223,170,0,85,223,170,0
5362
db 170,223,170,0,255,223,170,0
5363
db 0,255,170,0,85,255,170,0
5364
db 170,255,170,0,255,255,170,0
5365
db 0,0,212,0,85,0,212,0
5366
db 170,0,212,0,255,0,212,0
5367
db 0,31,212,0,85,31,212,0
5368
db 170,31,212,0,255,31,212,0
5369
db 0,63,212,0,85,63,212,0
5370
db 170,63,212,0,255,63,212,0
5371
db 0,95,212,0,85,95,212,0
5372
db 170,95,212,0,255,95,212,0
5373
db 0,127,212,0,85,127,212,0
5374
db 170,127,212,0,255,127,212,0
5375
db 0,159,212,0,85,159,212,0
5376
db 170,159,212,0,255,159,212,0
5377
db 0,191,212,0,85,191,212,0
5378
db 170,191,212,0,255,191,212,0
5379
db 0,223,212,0,85,223,212,0
5380
db 170,223,212,0,255,223,212,0
5381
db 0,255,212,0,85,255,212,0
5382
db 170,255,212,0,255,255,212,0
5383
db 85,0,255,0,170,0,255,0
5384
db 0,31,255,0,85,31,255,0
5385
db 170,31,255,0,255,31,255,0
5386
db 0,63,255,0,85,63,255,0
5387
db 170,63,255,0,255,63,255,0
5388
db 0,95,255,0,85,95,255,0
5389
db 170,95,255,0,255,95,255,0
5390
db 0,127,255,0,85,127,255,0
5391
db 170,127,255,0,255,127,255,0
5392
db 0,159,255,0,85,159,255,0
5393
db 170,159,255,0,255,159,255,0
5394
db 0,191,255,0,85,191,255,0
5395
db 170,191,255,0,255,191,255,0
5396
db 0,223,255,0,85,223,255,0
5397
db 170,223,255,0,255,223,255,0
5398
db 85,255,255,0,170,255,255,0
5399
db 255,204,204,0,255,204,255,0
5400
db 255,255,51,0,255,255,102,0
5401
db 255,255,153,0,255,255,204,0
5402
db 0,127,0,0,85,127,0,0
5403
db 170,127,0,0,255,127,0,0
5404
db 0,159,0,0,85,159,0,0
5405
db 170,159,0,0,255,159,0,0
5406
db 0,191,0,0,85,191,0,0
5407
db 170,191,0,0,255,191,0,0
5408
db 0,223,0,0,85,223,0,0
5409
db 170,223,0,0,255,223,0,0
5410
db 85,255,0,0,170,255,0,0
5411
db 0,0,42,0,85,0,42,0
5412
db 170,0,42,0,255,0,42,0
5413
db 0,31,42,0,85,31,42,0
5414
db 170,31,42,0,255,31,42,0
5415
db 0,63,42,0,170,174,160,0
5416
db 240,251,255,0,164,160,160,0
5417
db 128,128,128,0,0,0,255,0
5418
db 0,255,0,0,0,255,255,0
5419
db 255,0,0,0,255,0,255,0
5420
db 255,255,0,0xff,0xff,0xff,0xff
5421
;----------------------------------------------------------
5422
;--------------------COLOR BRUSHES-------------------------
5423
;----------------------------------------------------------
5424
Brush_color:
5425
;
5426
db 0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5427
db 1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5428
db 1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5429
db 0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5430
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5431
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5432
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5433
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5434
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5435
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5436
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5437
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5438
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5439
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5440
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5441
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5442
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5443
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5444
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5445
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5446
 
5447
;
5448
db 0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5449
db 0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5450
db 1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5451
db 1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5452
db 0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5453
db 0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5454
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5455
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5456
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5457
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5458
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5459
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5460
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5461
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5462
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5463
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5464
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5465
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5466
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5467
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5468
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5469
 
5470
;
5471
db 0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5472
db 0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0
5473
db 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0
5474
db 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0
5475
db 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0
5476
db 0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0
5477
db 0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5478
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5479
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5480
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5481
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5482
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5483
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5484
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5485
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5486
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5487
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5488
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5489
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5490
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5491
 
5492
;
5493
db 0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0
5494
db 0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
5495
db 0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0
5496
db 0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0
5497
db 0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0
5498
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0
5499
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0
5500
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0
5501
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0
5502
db 0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0
5503
db 0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0
5504
db 0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0
5505
db 0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
5506
db 0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0
5507
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5508
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5509
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5510
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5511
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5512
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5513
 
5514
;
5515
db 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5516
db 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5517
db 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5518
db 0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5519
db 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5520
db 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5521
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5522
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5523
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5524
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5525
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5526
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5527
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5528
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5529
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5530
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5531
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5532
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5533
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5534
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5535
 
5536
;
5537
db 0
5538
;------------------------------------------
5539
Spray_color:
5540
;
5541
db 0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0
5542
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5543
db 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5544
db 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0
5545
db 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5546
db 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5547
db 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0
5548
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5549
db 0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0
5550
db 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5551
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5552
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5553
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5554
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5555
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5556
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5557
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5558
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5559
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5560
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5561
;
5562
db 0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0
5563
db 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0
5564
db 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5565
db 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0
5566
db 0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0
5567
db 0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5568
db 0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0
5569
db 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5570
db 0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0
5571
db 0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0
5572
db 0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0
5573
db 0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0
5574
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5575
db 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0
5576
db 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0
5577
db 0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0
5578
db 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0
5579
db 0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0
5580
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5581
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5582
;
5583
db 0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0
5584
db 0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
5585
db 0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0
5586
db 0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0
5587
db 0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0
5588
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0
5589
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0
5590
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0
5591
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0
5592
db 0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0
5593
db 0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0
5594
db 0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0
5595
db 0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
5596
db 0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0
5597
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5598
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5599
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5600
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5601
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5602
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5603
 
5604
;------------------------------------------
5605
width_pixels:
5606
 
5607
db 1,0,0,0,0
5608
db 0,0,0,0,0
5609
db 0,0,0,0,0
5610
db 0,0,0,0,0
5611
db 0,0,0,0,0
5612
;
5613
db 1,1,0,0,0
5614
db 1,1,0,0,0
5615
db 0,0,0,0,0
5616
db 0,0,0,0,0
5617
db 0,0,0,0,0
5618
;
5619
db 0,1,0,0,0
5620
db 1,1,1,0,0
5621
db 0,1,0,0,0
5622
db 0,0,0,0,0
5623
db 0,0,0,0,0
5624
;
5625
db 0,1,1,0,0
5626
db 1,1,1,1,0
5627
db 1,1,1,1,0
5628
db 0,1,1,0,0
5629
db 0,0,0,0,0
5630
;
5631
db 0,0,1,0,0
5632
db 0,1,1,1,0
5633
db 1,1,1,1,1
5634
db 0,1,1,1,0
5635
db 0,0,1,0,0
5636
;-----------------------------------------
5637
width_pixels_rectangle:
5638
 
5639
db 1,0,0,0,0
5640
db 0,0,0,0,0
5641
db 0,0,0,0,0
5642
db 0,0,0,0,0
5643
db 0,0,0,0,0
5644
;
5645
db 1,1,0,0,0
5646
db 1,1,0,0,0
5647
db 0,0,0,0,0
5648
db 0,0,0,0,0
5649
db 0,0,0,0,0
5650
;
5651
db 1,1,1,0,0
5652
db 1,1,1,0,0
5653
db 1,1,1,0,0
5654
db 0,0,0,0,0
5655
db 0,0,0,0,0
5656
;
5657
db 1,1,1,1,0
5658
db 1,1,1,1,0
5659
db 1,1,1,1,0
5660
db 1,1,1,1,0
5661
db 0,0,0,0,0
5662
;
5663
db 1,1,1,1,1
5664
db 1,1,1,1,1
5665
db 1,1,1,1,1
5666
db 1,1,1,1,1
5667
db 1,1,1,1,1
5668
 
5669
;----------------------------------------------------------
5670
;-------------------ICON"S picture-------------------------
5671
;----------------------------------------------------------
5672
panel_picture:
5673
file 'worktab1.gif'
5674
 
5675
;----------------------------------------------------------
5676
 
5677
I_END:
5678