Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
180 heavyiron 1
; mov [pointer_to_screen],eax
2
; mov [output_array],ebx
3
; mov [screen_size_x],ecx
4
;setpixel (pixel_x,pixel_y)
5
setpixel:
6
 
7
  mov ecx,[output_array]
8
  mov eax,[pixel_y]
9
  mov ebx,[screen_size_x]
10
  imul eax,ebx
11
  add eax,[pixel_x]
12
  lea eax,[eax+eax*2]
13
  add eax,[pointer_to_screen]
14
  mov [ecx],eax
15
  add [output_array],4
16
  ret
17
; procedure <<<<<>>>>>
18
; IN
19
; eax - pointer to picture
20
; ebx - picture size x
21
; ecx - color of pixel
22
; esi - x coordinat of pixel
23
; edi - y coordinat of pixel
24
; OUT
25
; not returned value
26
PutPixel:
27
 
28
  imul ebx,edi
29
  add ebx,esi
30
  lea ebx,[ebx+ebx*2]
31
  add eax,ebx
32
  mov ebx,ecx
33
  shr ebx,16
34
  mov [eax],cx
35
  mov [eax+2],bl
36
  ret
37
; function <<<<<>>>>>
38
; IN
39
; eax - pointer to picture
40
; ebx - picture size x
41
; esi - x coordinat of pixel
42
; edi - y coordinat of pixel
43
; OUT
44
; eax - color of pixel in coordinats (x,y)
45
GetColorOfPixel:
46
 
47
  imul ebx,edi
48
  add ebx,esi
49
  lea ebx,[ebx+ebx*2]
50
  add eax,ebx
51
  mov ebx,[eax]
52
  and ebx,0xffffff
53
  mov eax,ebx
54
  ret
55
 
56
;procedure <<<>>>
57
; IN
58
;eax - pointer to screen
59
;ebx - output array
60
;ecx - (screen size x)*bytes per pixel
61
;edx - x1*65536+y1
62
;esi   x2
63
;edi - y2
64
; OUT
65
;eax - number of pixels
66
calculate_line:
67
 
68
  mov [pointer_to_screen],eax
69
  mov [output_array],ebx
70
  mov [screen_size_x],ecx
71
  mov eax,edx
72
  and eax,0xffff
73
  shr edx,16
74
  mov [x_l],edx     ;x=x1
75
  mov [y_l],eax     ;y=y1
76
  mov [sx],1
77
  mov [sy],1
78
 
79
  mov edx,[output_array]
80
 
81
  sub esi,[x_l]     ;esi=x2-x1
82
  jnz no_0_x
83
  and esi,0
84
  jmp x_no_minus
85
  no_0_x:
86
  jns x_no_minus
87
  neg esi
88
  mov [sx],-1	  ;sx=-sx
89
  x_no_minus:
90
 
91
  sub edi,[y_l]     ;edi=y2-y1
92
  jnz no_0_y
93
  and edi,0
94
  jmp y_no_minus
95
  no_0_y:
96
  jns y_no_minus
97
  neg edi
98
  mov [sy],-1	  ;sy=-sy
99
  y_no_minus:
100
 
101
  mov [_dx],esi
102
  mov [_dy],edi
103
 
104
  cmp [_dx],0	   ;if (dx=0 & dy=0) {  }
105
  jnz no_null_d
106
  cmp [_dy],0
107
  jnz no_null_d
108
  mov eax,[x_l]
109
  mov ebx,[y_l]
110
  mov [pixel_x],eax
111
  mov [pixel_y],ebx
112
  call setpixel    ;setpixel(x1,y1)
113
  mov eax,1
114
  ret
115
  no_null_d:
116
 
117
  cmp edi,esi	   ;if (dy>dx) {  }
118
  jle no_bigger
119
  mov eax,[_dx]
120
  mov [z],eax	   ;z=dx
121
  mov eax,[_dy]
122
  mov [_dx],eax    ;dx=dy
123
  mov eax,[z]
124
  mov [_dy],eax    ;dy=z
125
  mov [_ch],dword 1 ;ch=true
126
  jmp exit_if2
127
  no_bigger:	   ;else {}
128
  and [_ch],0
129
  exit_if2:
130
 
131
  mov eax,[_dy]
132
  shl eax,1
133
  sub eax,[_dx]
134
  mov [e],eax	 ;e=2*dy-dx
135
 
136
  mov esi,1	 ;counter
137
  mov edi,[sx]
138
  mov ebp,[sy]
139
  do:
140
 
141
     mov eax,[x_l]
142
     mov ebx,[y_l]
143
     mov [pixel_x],eax
144
     mov [pixel_y],ebx
145
     call setpixel
146
 
147
     cmp [e],0
148
     js while_e
149
 
150
       mov eax,[_ch]
151
       test eax,eax
152
       jz ch_else
153
       add [x_l],edi
154
       jmp exit_if3
155
       ch_else:
156
       add [y_l],ebp
157
       exit_if3:
158
 
159
       mov eax,[_dx]
160
       shl eax,1
161
       sub [e],eax    ;e=e-2*dx
162
 
163
     while_e:
164
 
165
     mov eax,[_ch]
166
     test eax,eax
167
     jz ch_else2
168
     add [y_l],ebp
169
     jmp exit_if4
170
     ch_else2:
171
     add [x_l],edi
172
     exit_if4:
173
 
174
     mov eax,[_dy]
175
     shl eax,1
176
     add [e],eax ;e=e+2*dy
177
     inc esi
178
 
179
     mov ecx,[_dx]
180
     cmp esi,ecx
181
     jle do	     ;while (i<=dx)
182
 
183
     mov eax,[x_l]
184
     mov ebx,[y_l]
185
     mov [pixel_x],eax
186
     mov [pixel_y],ebx
187
     call setpixel
188
 
189
     mov eax,[output_array]
190
     sub eax,edx
191
     shr eax,2
192
 
193
  ret
194
;---------------------------
195
;procedure calculate <<<<>>>>>>
196
; IN
197
;eax - pointer to screen
198
;ebx - output array
199
;ecx - (screen size x)
200
;edx - x1*65536+y1
201
;esi   x2
202
;edi - y2
203
; OUT
204
;eax - number of pixels
205
 
206
calculate_rectangle:
207
 
208
  mov [pointer_to_screen],eax
209
  mov [output_array],ebx
210
  mov [screen_size_x],ecx
211
  mov eax,edx
212
  and eax,0xffff
213
  shr edx,16
214
  mov [x_l],edx     ;x=x1
215
  mov [y_l],eax     ;y=y1
216
  mov [x2],esi	    ;x2
217
  mov [y2],edi	    ;y2
218
  mov [sx],1
219
  mov [sy],1
220
 
221
  mov edx,[output_array]
222
 
223
  sub esi,[x_l]     ;esi=x2-x1
224
  jnz no_0_x_r
225
  and esi,0
226
  jmp x_no_minus_r
227
  no_0_x_r:
228
  jns x_no_minus_r
229
  neg esi
230
  mov [sx],-1	  ;sx=-sx
231
  x_no_minus_r:
232
 
233
  sub edi,[y_l]     ;edi=y2-y1
234
  jnz no_0_y_r
235
  and edi,0
236
  jmp y_no_minus_r
237
  no_0_y_r:
238
  jns y_no_minus_r
239
  neg edi
240
  mov [sy],-1	  ;sy=-sy
241
  y_no_minus_r:
242
 
243
  mov [_dx],esi
244
  mov [_dy],edi
245
 
246
  cmp [_dx],0	   ;if (dx=0 & dy=0) {  }
247
  jnz no_null_r
248
  cmp [_dy],0
249
  jnz no_null_r
250
  mov eax,[x_l]
251
  mov ebx,[y_l]
252
  mov [pixel_x],eax
253
  mov [pixel_y],ebx
254
  call setpixel    ;setpixel(x1,y1)
255
  mov eax,1
256
  ret
257
  no_null_r:
258
 
259
  mov edi,[_dx]
260
  mov esi,[x_l]       ;x1
261
 
262
  horizontal_lines:
263
 
264
  mov eax,esi	      ;x
265
  mov ebx,[y_l]       ;y1
266
  mov [pixel_x],eax
267
  mov [pixel_y],ebx
268
  call setpixel
269
 
270
  mov eax,esi	      ;x
271
  mov ebx,[y2]	      ;y2
272
  mov [pixel_x],eax
273
  mov [pixel_y],ebx
274
  call setpixel
275
 
276
  add esi,[sx]
277
  dec edi
278
  jns horizontal_lines
279
 
280
  mov edi,[_dy]
281
  mov esi,[y_l]       ;y1
282
  vertical_lines:
283
 
284
  mov eax,[x_l]       ;x1
285
  mov ebx,esi	      ;y
286
  mov [pixel_x],eax
287
  mov [pixel_y],ebx
288
  call setpixel
289
 
290
  mov eax,[x2]	       ;x2
291
  mov ebx,esi	       ;y
292
  mov [pixel_x],eax
293
  mov [pixel_y],ebx
294
  call setpixel
295
 
296
  add esi,[sy]
297
  dec edi
298
  jns vertical_lines
299
 
300
  mov eax,[output_array]
301
  sub eax,edx
302
  shr eax,2
303
 
304
  ret
305
;procedure <<<<<>>>>>
306
; IN
307
;eax - pointer to screen
308
;ebx - output array
309
;ecx - (screen size x)*bytes per pixel
310
;edx - x_c*65536+y_c
311
;esi   r
312
; OUT
313
;eax - number of pixels
314
 
315
calculate_circle:
316
 
317
  mov [pointer_to_screen],eax
318
  mov [output_array],ebx
319
  mov [screen_size_x],ecx
320
  mov eax,edx
321
  and eax,0xffff
322
  shr edx,16
323
  mov [x2],edx	   ;circle centr x
324
  mov [y2],eax	   ;circle centr y
325
  mov [r],esi	   ;radius of cicrle
326
 
327
  mov edx,[output_array]
328
 
329
  mov [x_l],0	   ;x=0
330
  mov [y_l],esi    ;y=r
331
  mov [d],3
332
  mov eax,[r]
333
  shl eax,1
334
  sub [d],eax	   ;d=3-2*r
335
 
336
 
337
  while_circle:
338
 
339
  mov esi,[y_l]
340
  mov edi,[x_l]
341
 
342
  sub esi,edi	   ;while y>=x
343
  js exit_while_circle
344
 
345
 
346
  mov eax,[x_l] ;x
347
  mov ebx,[y_l] ;y
348
  add eax,[x2]	;x+xc
349
  add ebx,[y2]	;y+yc
350
  mov [pixel_x],eax
351
  mov [pixel_y],ebx
352
  call setpixel
353
 
354
  mov eax,[x_l] ;x
355
  mov ebx,[y2]	;yc
356
  add eax,[x2]	;x+xc
357
  sub ebx,[y_l] ;yc-y
358
  mov [pixel_x],eax
359
  mov [pixel_y],ebx
360
  call setpixel
361
 
362
  mov eax,[x2]	;xc
363
  mov ebx,[y2]	;yc
364
  sub eax,[x_l] ;xc-x
365
  add ebx,[y_l] ;yc+y
366
  mov [pixel_x],eax
367
  mov [pixel_y],ebx
368
  call setpixel
369
 
370
  mov eax,[x2]	;xc
371
  mov ebx,[y2]	;yc
372
  sub eax,[x_l] ;xc-x
373
  sub ebx,[y_l] ;yc-y
374
  mov [pixel_x],eax
375
  mov [pixel_y],ebx
376
  call setpixel
377
 
378
  mov eax,[x2]	;xc
379
  mov ebx,[y2]	;yc
380
  add eax,[y_l] ;xc+y
381
  add ebx,[x_l] ;yc+x
382
  mov [pixel_x],eax
383
  mov [pixel_y],ebx
384
  call setpixel
385
 
386
  mov eax,[x2]	;xc
387
  mov ebx,[y2]	;yc
388
  add eax,[y_l] ;xc+y
389
  sub ebx,[x_l] ;yc-x
390
  mov [pixel_x],eax
391
  mov [pixel_y],ebx
392
  call setpixel
393
 
394
  mov eax,[x2]	;xc
395
  mov ebx,[y2]	;yc
396
  sub eax,[y_l] ;xc-y
397
  add ebx,[x_l] ;x+yc
398
  mov [pixel_x],eax
399
  mov [pixel_y],ebx
400
  call setpixel
401
 
402
  mov eax,[x2]	;xc
403
  mov ebx,[y2]	;yc
404
  sub eax,[y_l] ;xc-y
405
  sub ebx,[x_l] ;yc-x
406
  mov [pixel_x],eax
407
  mov [pixel_y],ebx
408
  call setpixel
409
 
410
  cmp [d],0
411
  jns if1_d
412
  mov eax,[x_l]
413
  shl eax,2
414
  add eax,6
415
  add [d],eax  ;d=d+4*x+6
416
  jmp exit_if1_d
417
  if1_d:
418
  mov eax,[x_l]
419
  sub eax,[y_l]
420
  shl eax,2
421
  add eax,10
422
  add [d],eax	 ;d=d+4*(x-y)+10
423
  dec [y_l]
424
  exit_if1_d:
425
  inc [x_l]
426
 
427
  jmp while_circle
428
 
429
  exit_while_circle:
430
 
431
  mov eax,[output_array]
432
  sub eax,edx
433
  shr eax,2
434
 
435
  ret
436
;procedure <<<<<>>>>
437
;IN
438
;eax - pointer to screen
439
;ebx - pointer to output array
440
;ecx - picture size x
441
;edx - x0*65536+y0
442
;esi - x_max*65536+y_max
443
;edi - color of flood fill arrea
444
flood_fill:
445
 
446
  mov [pointer_to_screen],eax
447
  mov [output_array],ebx
448
  mov [screen_size_x],ecx
449
 
450
  mov eax,edx
451
  and edx,0xffff
452
  shr eax,16
453
  mov [sx],eax	 ;x0
454
  mov [sy],edx	 ;y0
455
 
456
  mov eax,esi
457
  and esi,0xffff
458
  shr eax,16
459
  mov [m_x],eax  ;maximum x size of picture
460
  mov [m_y],esi  ;maximum y size of picture
461
 
462
  mov [c_f],edi    ;color of feel
463
 
464
  mov eax,[output_array] ; stek
465
  mov [eax],dword 1	 ; number of pointes in stek
466
  mov esi,[sx]
467
  mov edi,[sy]
468
  mov [eax+4],si	;x0
469
  mov [eax+4+2],di	  ;y0
470
 
471
  mov eax,[pointer_to_screen]
472
  mov ebx,[screen_size_x]
473
  call GetColorOfPixel
474
  mov [c],eax
475
 
476
  cmp eax,[c_f]
477
  jne can_flood_fill
478
  mov eax,[output_array]
479
  mov [eax],dword 0
480
  ret
481
  can_flood_fill:
482
 
483
  while_no_null:
484
  ;извлекаем координаты из стека
485
  mov eax,[output_array]
486
  mov ebx,[eax]
487
  dec ebx
488
  shl ebx,2		  ;ebx=ebx*8
489
  add ebx,4		  ;ebx=ebx*8+4
490
  xor esi,esi
491
  xor edi,edi
492
  mov si,[eax+ebx]	 ;x
493
  mov di,[eax+ebx+2]	 ;y
494
  mov [x2],esi
495
  mov [y2],edi
496
 
497
  mov [sy],edi
498
 
499
  mov eax,[output_array]
500
  mov ebx,[eax]
501
  dec ebx
502
  mov [eax],ebx 	  ;
503
 
504
  ; go to right until color=c or until x
505
  mov edx,[x2]
506
  go_to_right:
507
 
508
  mov eax,[pointer_to_screen]
509
  mov ebx,[screen_size_x]
510
  mov esi,edx;
511
  mov edi,[sy]
512
  call GetColorOfPixel
513
 
514
  cmp eax,[c]
515
  jne not_color_of_feeling_arrea_right
516
 
517
  mov eax,[pointer_to_screen]
518
  mov ebx,[screen_size_x]
519
  mov ecx,[c_f]    ;color of filinf flood
520
  mov esi,edx
521
  mov edi,[sy]
522
  call PutPixel
523
 
524
  inc edx
525
 
526
  mov eax,edx
527
  cmp eax,[m_x]
528
  jle go_to_right
529
 
530
  not_color_of_feeling_arrea_right:
531
 
532
  mov eax,edx
533
  dec eax		 ;----------------------------------
534
  mov [x_r],eax      ; save right absciss
535
 
536
 
537
  ; go to left until color=c or until x>0
538
  mov esi,[x2]
539
  mov edi,[y2]
540
  dec esi
541
  mov edx,esi
542
  mov [sy],edi
543
 
544
  go_to_left:
545
 
546
  mov eax,[pointer_to_screen]
547
  mov ebx,[screen_size_x]
548
  mov esi,edx
549
  mov edi,[sy]
550
  call GetColorOfPixel
551
 
552
  cmp eax,[c]
553
  jne not_color_of_feeling_arrea_left
554
 
555
  mov eax,[pointer_to_screen]
556
  mov ebx,[screen_size_x]
557
  mov ecx,[c_f]    ;color of filing flood
558
  mov esi,edx
559
  mov edi,[sy]
560
  call PutPixel
561
 
562
  dec edx
563
  jns go_to_left
564
 
565
  not_color_of_feeling_arrea_left:
566
 
567
  mov eax,edx
568
  inc eax	    ;----------------------------------------
569
  mov [x_l],eax      ; save left absciss
570
 
571
  mov edi,[y2]
572
  dec edi
573
  jns no_null_1_floodfill
574
  mov edi,1
575
  no_null_1_floodfill:
576
  mov [sy],edi
577
 
578
  mov eax,[output_array]
579
  mov ebx,[eax]
580
  mov [l_s],ebx 	; save total number of points in stek
581
  mov [l_c],-1		; last color = -1
582
  mov edx,[x_l]
583
  analizing_from_left_to_right_upper:
584
  ;анализируем пиксели над линией с левого края
585
  mov eax,[pointer_to_screen]
586
  mov ebx,[screen_size_x]
587
  mov esi,edx
588
  mov edi,[sy]
589
  call GetColorOfPixel
590
  push eax
591
 
592
  cmp eax,[c]	 ;если цвет проверямого пикселя не равен с,то не заносим его в стек
593
  jne no_fill_1
594
  mov ebx,[l_c]
595
  cmp ebx,[c]
596
  jne no_fill_1
597
  mov edi,[sy]
598
  mov eax,[output_array]
599
  mov ebx,[eax]
600
  inc ebx
601
  mov [eax],ebx
602
  dec ebx
603
  shl ebx,2
604
  add ebx,4
605
  mov esi,edx
606
  dec esi
607
  mov [eax+ebx],si
608
  mov [eax+ebx+2],di
609
  no_fill_1:
610
 
611
  pop [l_c]
612
  inc edx
613
  cmp edx,[x_r]
614
  jle analizing_from_left_to_right_upper
615
 
616
  mov ebx,[l_c]
617
  cmp ebx,[c]	    ;last color is c(color of filing arrea) ?
618
  jne have_changes_in_stek_1
619
  ;save last color in stek
620
  mov edi,[sy]
621
  mov eax,[output_array]
622
  mov ebx,[eax]
623
  inc ebx
624
  mov [eax],ebx
625
  dec ebx
626
  shl ebx,2
627
  add ebx,4
628
  mov esi,edx
629
  dec esi
630
  mov [eax+ebx],si
631
  mov [eax+ebx+2],di
632
 
633
  have_changes_in_stek_1:
634
 
635
  mov edi,[y2]
636
  inc edi
637
  cmp edi,[m_y]
638
  jle no_max_1_floodfill
639
  mov edi,[m_y]
640
  no_max_1_floodfill:
641
  mov [sy],edi
642
 
643
  mov eax,[output_array]
644
  mov ebx,[eax]
645
  mov [l_s],ebx 	; save total number of points in stek
646
  mov [l_c],-1		; last color = -1
647
  mov edx,[x_l]
648
  analizing_from_left_to_right_down:
649
 
650
  ;анализируем пиксели под линией с левого края
651
  mov eax,[pointer_to_screen]
652
  mov ebx,[screen_size_x]
653
  mov esi,edx
654
  mov edi,[sy]
655
  call GetColorOfPixel
656
  push eax
657
 
658
  cmp eax,[c]	 ;если цвет проверямого пикселя не равен с,то не заносим его в стек
659
  je no_fill_3
660
  mov ebx,[l_c]
661
  cmp ebx,[c]
662
  jne no_fill_3
663
  mov edi,[sy]
664
  mov eax,[output_array]
665
  mov ebx,[eax]
666
  inc ebx
667
  mov [eax],ebx
668
  dec ebx
669
  shl ebx,2
670
  add ebx,4
671
  mov esi,edx
672
  dec esi
673
  mov [eax+ebx],si
674
  mov [eax+ebx+2],di
675
  no_fill_3:
676
 
677
  pop [l_c]
678
  inc edx
679
  cmp edx,[x_r]
680
  jle analizing_from_left_to_right_down
681
 
682
  mov ebx,[l_c]
683
  cmp ebx,[c]	    ;last color is c(color of filing arrea) ?
684
  jne have_changes_in_stek_2
685
  ;save last color in stek
686
  mov edi,[sy]
687
  mov eax,[output_array]
688
  mov ebx,[eax]
689
  inc ebx
690
  mov [eax],ebx
691
  dec ebx
692
  shl ebx,2
693
  add ebx,4
694
  mov esi,edx
695
  dec esi
696
  mov [eax+ebx],si
697
  mov [eax+ebx+2],di
698
 
699
  have_changes_in_stek_2:
700
 
701
  mov ebx,[output_array] ;while stek have points  пока в стеке есть точки(координаты)
702
  mov ecx,[ebx]
703
  test ecx,ecx
704
  jnz while_no_null
705
 
706
 
707
  ret
708
; procedure <<<<<>>>>>
709
; IN
710
; eax - pointer to picture
711
; ebx - output array
712
; ecx - picture size x
713
; edx - x0*65536+y0
714
; esi - a*65536+b
715
; edi - color
716
; OUT
717
; procedure not return value
718
calculate_ellips:
719
 
720
  mov [pointer_to_screen],eax
721
  mov [output_array],ebx
722
  mov [screen_size_x],ecx
723
  mov [e],ebx
724
 
725
  mov eax,edx
726
  and eax,0xffff
727
  shr edx,16
728
  mov [x2],edx	   ; centr x
729
  mov [y2],eax	   ; centr y
730
 
731
  mov eax,esi
732
  and eax,0xffff   ;eax=b
733
  shr esi,16	   ;esi=a
734
  mov [a],esi
735
  mov [b],eax
736
 
737
  mov [c],edi	   ;color
738
  mov [row],eax ;b
739
 
740
  imul esi,esi ;a*a
741
  imul eax,eax ;b*b
742
 
743
  mov [a_square],esi
744
  mov [b_square],eax
745
  and [col],0
746
 
747
  shl esi,1
748
  shl eax,1
749
  mov [two_a_square],esi
750
  mov [two_b_square],eax
751
  shl esi,1
752
  shl eax,1
753
  mov [four_a_square],esi
754
  mov [four_b_square],eax
755
 
756
  mov eax,[row] 	     ;eax=row
757
  mov ebx,eax
758
  dec ebx		     ;ebx=(row-1)
759
  imul ebx,eax		     ;ebx=(row-1)*row
760
  imul ebx,[two_a_square]    ;ebx=two_a_square*((row-1)*row)
761
  mov ecx,[a_square]	     ;ecx=a_square
762
  mov eax,1
763
  sub eax,ecx		     ;eax=(1-a_square)
764
  imul eax,[two_b_square]    ;eax=two_b_square*(1-a_square)
765
  add ebx,[a_square]	     ;ebx=two_a_square*((row-1)*row)+a_square
766
  add eax,ebx		     ;eax=two_a_square*((row-1)*row)+a_square+two_b_square*(1-a_square)
767
  mov [d],eax
768
 
769
  mov edx,[x2]		     ;x
770
  mov ebp,[y2]		     ;y
771
 
772
  while_ellips_1:
773
  mov esi,[a_square]
774
  mov edi,[b_square]
775
  imul esi,[row]
776
  imul edi,[col]
777
  cmp esi,edi
778
  jle no_while_ellips_1
779
 
780
  mov eax,edx	     ;x
781
  mov ebx,ebp	     ;y
782
  add eax,[col]      ;x+col
783
  add ebx,[row]      ;y+row
784
  mov [pixel_x],eax
785
  mov [pixel_y],ebx
786
  call setpixel
787
 
788
  mov eax,edx	     ;x
789
  mov ebx,ebp	     ;y
790
  add eax,[col]      ;x+col
791
  sub ebx,[row]      ;y-row
792
  mov [pixel_x],eax
793
  mov [pixel_y],ebx
794
  call setpixel
795
 
796
  mov eax,edx	     ;x
797
  mov ebx,ebp	     ;y
798
  sub eax,[col]      ;x-col
799
  add ebx,[row]      ;y+row
800
  mov [pixel_x],eax
801
  mov [pixel_y],ebx
802
  call setpixel
803
 
804
  mov eax,edx	     ;x
805
  mov ebx,ebp	     ;y
806
  sub eax,[col]      ;x-col
807
  sub ebx,[row]      ;y-row
808
  mov [pixel_x],eax
809
  mov [pixel_y],ebx
810
  call setpixel
811
 
812
  mov eax,[d]
813
  cmp eax,0
814
  js  lab33		 ;>=0
815
  dec [row]
816
  mov ebx,[four_a_square]
817
  mov ecx,[row]
818
  imul ebx,ecx		;ebx=four_a_square*(row)
819
  sub [d],ebx		;d=d-four_a_square*(row)
820
  lab33:
821
 
822
  mov eax,[col]
823
  shl eax,1
824
  add eax,3
825
  imul eax,[two_b_square]
826
  add [d],eax		;d=d+two_b_square*(3+(col*2))
827
 
828
  inc [col]
829
  jmp while_ellips_1
830
 
831
  no_while_ellips_1:
832
 
833
  mov eax,[col]
834
  inc eax
835
  imul eax,[col]
836
  imul eax,[two_b_square] ;eax=two_b_square*((col+1)*col)
837
  mov ebx,[row]
838
  sub ebx,2
839
  imul ebx,[row]
840
  inc ebx
841
  imul ebx,[two_a_square] ;ebx=two_a_square*((row-2)*row+1)
842
  mov ecx,1
843
  sub ecx,[two_a_square]
844
  imul ecx,[b_square]	  ;ecx=(1-two_a_square)*b_square
845
  add eax,ebx
846
  add eax,ecx
847
  mov [d],eax		  ;two_b_square*(col+1)*col+two_a_square*(row*(row-2)+1)+(1-two_a_square)*b_square
848
 
849
  mov edx,[x2]		     ;x
850
  mov ebp,[y2]		     ;y
851
 
852
  while_ellips_2:
853
  mov esi,[row]
854
  inc esi
855
  test esi,esi
856
  jz no_while_ellips_2
857
 
858
  mov eax,edx	     ;x
859
  mov ebx,ebp	     ;y
860
  add eax,[col]      ;x+col
861
  add ebx,[row]      ;y+row
862
  mov [pixel_x],eax
863
  mov [pixel_y],ebx
864
  call setpixel
865
 
866
  mov eax,edx	     ;x
867
  mov ebx,ebp	     ;y
868
  add eax,[col]      ;x+col
869
  sub ebx,[row]      ;y-row
870
  mov [pixel_x],eax
871
  mov [pixel_y],ebx
872
  call setpixel
873
 
874
  mov eax,edx	     ;x
875
  mov ebx,ebp	     ;y
876
  sub eax,[col]      ;x-col
877
  add ebx,[row]      ;y+row
878
  mov [pixel_x],eax
879
  mov [pixel_y],ebx
880
  call setpixel
881
 
882
  mov eax,edx	     ;x
883
  mov ebx,ebp	     ;y
884
  sub eax,[col]      ;x-col
885
  sub ebx,[row]      ;y-row
886
  mov [pixel_x],eax
887
  mov [pixel_y],ebx
888
  call setpixel
889
 
890
  mov eax,[d]
891
  cmp eax,0
892
  jns lab34
893
 
894
  inc [col]
895
  mov ebx,[col]
896
  imul ebx,[four_b_square]
897
  add [d],ebx		 ;d=d+four_b_square*col
898
  lab34:
899
  dec [row]
900
  mov ebx,[row]
901
  shl ebx,1
902
  mov eax,3
903
  sub eax,ebx
904
  imul eax,[two_a_square]
905
  add [d],eax		;d=d+two_b_square*(3-(row*2))
906
 
907
  jmp while_ellips_2
908
  no_while_ellips_2:
909
 
910
  mov eax,[output_array]
911
  sub eax,[e]
912
  shr eax,2
913
 
914
  ret
915
;---------------------------
916
  x_l dd ?
917
  y_l dd ?
918
  x_r dd ?
919
  y_r dd ?
920
  _dx dd ?
921
  _dy dd ?
922
  sx  dd ?
923
  sy  dd ?
924
  z   dd ?
925
  e   dd ?
926
  i   dd ?
927
  _ch dd ?
928
  x2  dd ?
929
  y2  dd ?
930
  d   dd ?
931
  r   dd ?
932
  m_x dd ?
933
  m_y dd ?
934
  c   dd ?
935
  c_f dd ?
936
  l_c dd ?
937
  l_s dd ?
938
;---------------------------
939
pointer_to_screen      dd 0
940
screen_size_x	       dd 0
941
output_array	       dd 0
942
pixel_x 	       dd 0
943
pixel_y 	       dd 0
944
;---------------------------
945
a		       dd 0
946
b		       dd 0
947
col		       dd 0
948
row		       dd 0
949
bnew		       dd 0
950
a_square	       dd 0
951
b_square	       dd 0
952
two_a_square	       dd 0
953
two_b_square	       dd 0
954
four_a_square	       dd 0
955
four_b_square	       dd 0
956
;-----------------------------