Subversion Repositories Kolibri OS

Rev

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

Rev 5916 Rev 6213
1
;
1
;
2
; äã­ªæ¨ ¤«ï ᮧ¤ ­¨ï ¨ । ªâ¨à®¢ ­¨ï ¯à®¢®¤®¢
2
; äã­ªæ¨ ¤«ï ᮧ¤ ­¨ï ¨ । ªâ¨à®¢ ­¨ï ¯à®¢®¤®¢
3
;
3
;
4
 
4
 
5
;--------------------------------------
5
;--------------------------------------
6
struct Cell
6
struct Cell
7
	x dd ? ;+0
7
	x dd ? ;+0
8
	y dd ? ;+4
8
	y dd ? ;+4
9
	liv db ? ;+8
9
	liv db ? ;+8
10
	napr db ? ;+9
10
	napr db ? ;+9
11
ends
11
ends
12
 
12
 
13
offs_cell_x equ 0
13
offs_cell_x equ 0
14
offs_cell_y equ 4
14
offs_cell_y equ 4
15
offs_cell_liv equ 8
15
offs_cell_liv equ 8
16
offs_cell_napr equ 9
16
offs_cell_napr equ 9
17
 
17
 
18
;áâàãªâãà  ¤«ï ᮧ¤ ­¨ï ¯®«ï
18
;áâàãªâãà  ¤«ï ᮧ¤ ­¨ï ¯®«ï
19
align 4
19
align 4
20
pole:
20
pole:
21
.index dd 0
21
.index dd 0
22
cell dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì á® áâàãªâãà ¬¨ ï祥ª
22
cell dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì á® áâàãªâãà ¬¨ ï祥ª
23
.max_cell dd 90000
23
.max_cell dd 90000
24
.b_sort dd 0 ;£à ­¨æ  ¤«ï á®àâ¨à®¢ ­­ëå ï祥ª
24
.b_sort dd 0 ;£à ­¨æ  ¤«ï á®àâ¨à®¢ ­­ëå ï祥ª
25
 
25
 
26
pole_index    equ dword[edi]
26
pole_index    equ dword[edi]
27
pole_data     equ dword[edi +4] ;㪠§ â¥«ì ­  ¯ ¬ïâì á® áâàãªâãà ¬¨ ï祥ª
27
pole_data     equ dword[edi +4] ;㪠§ â¥«ì ­  ¯ ¬ïâì á® áâàãªâãà ¬¨ ï祥ª
28
pole_max_cell equ dword[edi +8]
28
pole_max_cell equ dword[edi +8]
29
pole_b_sort   equ dword[edi+12] ;£à ­¨æ  ¤«ï á®àâ¨à®¢ ­­ëå ï祥ª
29
pole_b_sort   equ dword[edi+12] ;£à ­¨æ  ¤«ï á®àâ¨à®¢ ­­ëå ï祥ª
30
offs_pole_b_sort equ 12
30
offs_pole_b_sort equ 12
31
 
31
 
32
macro get_cell_offset reg,ind
32
macro get_cell_offset reg,ind
33
{
33
{
34
	mov reg,ind
34
	mov reg,ind
35
	imul reg,sizeof.Cell
35
	imul reg,sizeof.Cell
36
	add reg,dword[cell]
36
	add reg,dword[cell]
37
}
37
}
38
 
38
 
39
er_oom db 0 ;­  á«ãç © ¨áç¥à¯ ­¨ï ¯ ¬ïâ¨
39
er_oom db 0 ;­  á«ãç © ¨áç¥à¯ ­¨ï ¯ ¬ïâ¨
40
Cor_x dd 0
40
Cor_x dd 0
41
Cor_y dd 0
41
Cor_y dd 0
42
zoom db 3 ;¬ áèâ ¡ ¯®«ï
42
zoom db 3 ;¬ áèâ ¡ ¯®«ï
43
txt_zoom db 'Œ áèâ ¡:',0
43
txt_zoom db 'Œ áèâ ¡:',0
44
txt_osob db '’®ç¥ª:',0
44
txt_osob db '’®ç¥ª:',0
45
txt_info: db ' §¬¥à: '
45
txt_info: db ' §¬¥à: '
46
.size: rb 16
46
.size: rb 16
47
txt_mull db '*',0
47
txt_mull db '*',0
48
txt_space db ' ',0
48
txt_space db ' ',0
49
txt_nl db 13,10,0
49
txt_nl db 13,10,0
50
txt_buf rb 32
50
txt_buf rb 32
51
 
51
 
52
 
52
 
53
align 4
53
align 4
54
proc pole_init uses eax ebx edi, pole:dword
54
proc pole_init uses eax ebx edi, pole:dword
55
	mov edi,dword[pole]
55
	mov edi,dword[pole]
56
 
56
 
57
	;*** ª®¤ á ®¤­®© ®¡« áâìî ¢ ¯ ¬ï⨠***
57
	;*** ª®¤ á ®¤­®© ®¡« áâìî ¢ ¯ ¬ï⨠***
58
	mov ebx,4
58
	mov ebx,4
59
	add ebx,sizeof.Cell
59
	add ebx,sizeof.Cell
60
	imul ebx,pole_max_cell
60
	imul ebx,pole_max_cell
61
	stdcall mem.Alloc,ebx
61
	stdcall mem.Alloc,ebx
62
	mov pole_index,eax
62
	mov pole_index,eax
63
 
63
 
64
	mov ebx,pole_max_cell
64
	mov ebx,pole_max_cell
65
	shl ebx,2
65
	shl ebx,2
66
	add eax,ebx
66
	add eax,ebx
67
	mov pole_data,eax
67
	mov pole_data,eax
68
 
68
 
69
	stdcall pole_clear, edi
69
	stdcall pole_clear, edi
70
	stdcall pole_paint, edi ;à¨á®¢ ­¨¥ ¯®«ï ¢ ¡ãä¥à¥ (­¥ ­  íªà ­¥)
70
	stdcall pole_paint, edi ;à¨á®¢ ­¨¥ ¯®«ï ¢ ¡ãä¥à¥ (­¥ ­  íªà ­¥)
71
	ret
71
	ret
72
endp
72
endp
73
 
73
 
74
align 4
74
align 4
75
proc pole_delete uses edi, pole:dword
75
proc pole_delete uses edi, pole:dword
76
	mov edi,dword[pole]
76
	mov edi,dword[pole]
77
	stdcall mem.Free,pole_index
77
	stdcall mem.Free,pole_index
78
	ret
78
	ret
79
endp
79
endp
80
 
80
 
81
;ç¨á⪠ ¯à®¢®¤®¢ ­  á奬¥
81
;ç¨á⪠ ¯à®¢®¤®¢ ­  á奬¥
82
align 4
82
align 4
83
proc pole_clear uses eax ecx edi, pole:dword
83
proc pole_clear uses eax ecx edi, pole:dword
84
	mov edi,dword[pole]
84
	mov edi,dword[pole]
85
 
85
 
86
	xor eax,eax
86
	xor eax,eax
87
	mov pole_b_sort,eax
87
	mov pole_b_sort,eax
88
	mov byte[er_oom],al
88
	mov byte[er_oom],al
89
	cld
89
	cld
90
	mov ecx,pole_max_cell
90
	mov ecx,pole_max_cell
91
	imul ecx,sizeof.Cell
91
	imul ecx,sizeof.Cell
92
	mov edi,pole_data
92
	mov edi,pole_data
93
	repne stosb ;memset(cell,0,sizeof(Cell)*pole_max_cell);
93
	repne stosb ;memset(cell,0,sizeof(Cell)*pole_max_cell);
94
 
94
 
95
	mov edi,dword[pole]
95
	mov edi,dword[pole]
96
	mov ecx,pole_max_cell
96
	mov ecx,pole_max_cell
97
	mov edi,pole_index
97
	mov edi,pole_index
98
	@@:
98
	@@:
99
		stosd ;for(i=0;i
99
		stosd ;for(i=0;i
100
		;mov dword[edi],eax
-
 
101
		;add edi,4
-
 
102
		inc eax
100
		inc eax
103
		loop @b
101
		loop @b
104
	ret
102
	ret
105
endp
103
endp
106
 
104
 
107
align 4
105
align 4
108
proc pole_cell_creat, pole:dword, x:dword, y:dword, li:dword
106
proc pole_cell_creat, pole:dword, x:dword, y:dword, li:dword
109
	pushad
107
	pushad
110
	mov edi,dword[pole]
108
	mov edi,dword[pole]
111
	mov esi,pole_index
109
	mov esi,pole_index
112
 
110
 
113
	; *** ¥á«¨ ª«¥âª  㦥 ¡ë«  ᮧ¤ ­ 
111
	; *** ¥á«¨ ª«¥âª  㦥 ¡ë«  ᮧ¤ ­ 
114
	stdcall pole_cell_find, [pole], [x],[y]
112
	stdcall pole_cell_find, [pole], [x],[y]
115
	cmp eax,0
113
	cmp eax,0
116
	je @f
114
	je @f
117
		get_cell_offset ebx,eax
115
		get_cell_offset ebx,eax
118
		jmp .change
116
		jmp .change
119
	@@:
117
	@@:
120
 
118
 
121
	; *** ᮧ¤ ­¨¥ ­®¢®© ï祩ª¨
119
	; *** ᮧ¤ ­¨¥ ­®¢®© ï祩ª¨
122
	; ­ å®¤¨¬ ­®¬¥à ᢮¡®¤­®© ï祩ª¨ (i) ¤«ï ¤®¡ ¢«¥­¨ï ­®¢®©
120
	; ­ å®¤¨¬ ­®¬¥à ᢮¡®¤­®© ï祩ª¨ (i) ¤«ï ¤®¡ ¢«¥­¨ï ­®¢®©
123
	;mov esi,pole_index
121
	;mov esi,pole_index
124
	inc dword[esi]
122
	inc dword[esi]
125
	mov ebx,pole_max_cell
123
	mov ebx,pole_max_cell
126
	cmp dword[esi],ebx
124
	cmp dword[esi],ebx
127
	jne @f
125
	jne @f
128
		dec dword[esi]
126
		dec dword[esi]
129
		;... need call message: "eror out of memory" ...
127
		;... need call message: "eror out of memory" ...
130
		;... ¢ë¢®¤ á®®¡é¥­¨ï ¯¥à¥¯®«­¥­¨ï ­ ¤® ¤®¡ ¢¨âì  ...
128
		;... ¢ë¢®¤ á®®¡é¥­¨ï ¯¥à¥¯®«­¥­¨ï ­ ¤® ¤®¡ ¢¨âì  ...
131
		mov byte[er_oom],0
129
		mov byte[er_oom],0
132
		jmp .fun_e ;return;
130
		jmp .fun_e ;return;
133
	@@:
131
	@@:
134
	mov eax,dword[esi] ;eax - ­®¬¥à ¤«ï ¯®á«¥¤­¥© ï祩ª¨
132
	mov eax,dword[esi] ;eax - ­®¬¥à ¤«ï ¯®á«¥¤­¥© ï祩ª¨
135
	shl eax,2
133
	shl eax,2
136
	add eax,pole_index ;eax - 㪠§ â¥«ì ­  ¤®¡ ¢«ï¥¬ãî ï祩ªã (¢ ª®­¥æ ¬ áᨢ )
134
	add eax,pole_index ;eax - 㪠§ â¥«ì ­  ¤®¡ ¢«ï¥¬ãî ï祩ªã (¢ ª®­¥æ ¬ áᨢ )
137
	get_cell_offset ebx,dword[eax]
135
	get_cell_offset ebx,dword[eax]
138
	mov ecx,dword[x]
136
	mov ecx,dword[x]
139
	mov dword[ebx],ecx ;+0 = .x
137
	mov dword[ebx],ecx ;+0 = .x
140
	mov edx,dword[y]
138
	mov edx,dword[y]
141
	mov dword[ebx+4],edx ;+4 = .y
139
	mov dword[ebx+4],edx ;+4 = .y
142
	.change:
140
	.change:
143
		mov ecx,[li]
141
		mov ecx,[li]
144
		mov byte[ebx+offs_cell_liv],cl
142
		mov byte[ebx+offs_cell_liv],cl
145
	.fun_e:
143
	.fun_e:
146
	popad
144
	popad
147
	ret
145
	ret
148
endp
146
endp
149
 
147
 
150
;㤠«¥­¨¥ ï祩ª¨
148
;㤠«¥­¨¥ ï祩ª¨
151
align 4
149
align 4
152
proc pole_cell_delete, pole:dword, x:dword, y:dword
150
proc pole_cell_delete, pole:dword, x:dword, y:dword
153
	pushad
151
	pushad
154
	mov edi,dword[pole]
152
	mov edi,dword[pole]
155
	mov ebx,edi
153
	mov ebx,edi
156
	add ebx,offs_pole_b_sort
154
	add ebx,offs_pole_b_sort
157
	mov esi,pole_index
155
	mov esi,pole_index
158
 
156
 
159
	mov ecx,[esi]
157
	mov ecx,[esi]
160
	cmp ecx,1
158
	cmp ecx,1
161
	jl .fun_e
159
	jl .fun_e
162
 
160
 
163
	stdcall pole_cell_find, [pole], [x],[y]
161
	stdcall pole_cell_find, [pole], [x],[y]
164
	cmp eax,0
162
	cmp eax,0
165
	je .fun_e ;¥á«¨ ª«¥âª  ­¥ ¡ë«  ᮧ¤ ­ 
163
	je .fun_e ;¥á«¨ ª«¥âª  ­¥ ¡ë«  ᮧ¤ ­ 
166
 
164
 
167
	dec dword[esi]
165
	dec dword[esi]
168
 
166
 
169
	mov edi,esi
167
	mov edi,esi
170
	add edi,4
168
	add edi,4
171
	mov edx,ecx
169
	mov edx,ecx
172
	cld
170
	cld
173
	repnz scasd ;¯®¨áª
171
	repnz scasd ;¯®¨áª
174
	sub edi,4
172
	sub edi,4
175
 
173
 
176
	cmp dword[ebx],1 ;[ebx]=pole_b_sort
174
	cmp dword[ebx],1 ;[ebx]=pole_b_sort
177
	jl @f
175
	jl @f
178
	mov eax,edi
176
	mov eax,edi
179
	sub eax,esi ;esi=pole_index
177
	sub eax,esi ;esi=pole_index
180
	shr eax,2
178
	shr eax,2
181
	dec eax
179
	dec eax
182
	cmp [ebx],eax ;eax - ¯®§¨æ¨ï 㪠§ â¥«ï 㤠«ï¥¬®© ï祩ª¨
180
	cmp [ebx],eax ;eax - ¯®§¨æ¨ï 㪠§ â¥«ï 㤠«ï¥¬®© ï祩ª¨
183
	jle @f ;¡ë«® jl @f
181
	jle @f ;¡ë«® jl @f
184
		dec dword[ebx]
182
		dec dword[ebx]
185
	@@:
183
	@@:
186
 
184
 
187
	shl edx,2
185
	shl edx,2
188
	add edx,esi ;ª®­¥ç­ë© í«¥¬¥­â ¬ áᨢ 
186
	add edx,esi ;ª®­¥ç­ë© í«¥¬¥­â ¬ áᨢ 
189
	sub edx,edi
187
	sub edx,edi
190
	shr edx,2
188
	shr edx,2
191
	mov ecx,edx
189
	mov ecx,edx
192
 
190
 
193
	bt ecx,31
191
	bt ecx,31
194
	jc .fun_e
192
	jc .fun_e
195
		mov esi,edi
193
		mov esi,edi
196
		add esi,4
194
		add esi,4
197
		mov edx,[edi] ;á®åà ­¥­¨¥ ⥪ã饣® 㪠§ â¥«ï
195
		mov edx,[edi] ;á®åà ­¥­¨¥ ⥪ã饣® 㪠§ â¥«ï
198
		cld
196
		cld
199
		rep movsd
197
		rep movsd
200
		mov [edi],edx ;¢®ááâ ­®¢«¥­¨¥ ⥪ã饣® 㪠§ â¥«ï (¢ ª®­æ¥ ¬ áᨢ )
198
		mov [edi],edx ;¢®ááâ ­®¢«¥­¨¥ ⥪ã饣® 㪠§ â¥«ï (¢ ª®­æ¥ ¬ áᨢ )
201
	.fun_e:
199
	.fun_e:
202
	popad
200
	popad
203
	ret
201
	ret
204
endp
202
endp
205
 
203
 
206
if debug
204
if debug
207
align 4
205
align 4
208
proc but_test_pole, pole:dword
206
proc but_test_pole, pole:dword
209
	pushad
207
	pushad
210
	stdcall [buf2d_clear], buf_0, [buf_0.color]
208
	stdcall [buf2d_clear], buf_0, [buf_0.color]
211
 
209
 
212
	mov edi,dword[pole]
210
	mov edi,dword[pole]
213
	stdcall pole_paint,edi
211
	stdcall pole_paint,edi
214
	mov ebx,5
212
	mov ebx,5
215
 
213
 
216
	mov esi,pole_index
214
	mov esi,pole_index
217
	mov ecx,[esi]
215
	mov ecx,[esi]
218
 
216
 
219
	mov eax,pole_b_sort
217
	mov eax,pole_b_sort
220
	mov edi,open_file_lif
218
	mov edi,open_file_lif
221
	stdcall convert_int_to_str
219
	stdcall convert_int_to_str
222
	stdcall [buf2d_draw_text], buf_0, buf_font,edi,5,ebx,[shem_colors] ;à¨á㥬 b_sort
220
	stdcall [buf2d_draw_text], buf_0, buf_font,edi,5,ebx,[shem_colors] ;à¨á㥬 b_sort
223
	add ebx,18
221
	add ebx,18
224
 
222
 
225
	mov eax,[esi]
223
	mov eax,[esi]
226
	add esi,4
224
	add esi,4
227
	stdcall convert_int_to_str
225
	stdcall convert_int_to_str
228
	stdcall [buf2d_draw_text], buf_0, buf_font,edi,5,ebx,[shem_colors] ;à¨á㥬 ç¨á«® â®ç¥ª
226
	stdcall [buf2d_draw_text], buf_0, buf_font,edi,5,ebx,[shem_colors] ;à¨á㥬 ç¨á«® â®ç¥ª
229
	add ebx,9
227
	add ebx,9
230
 
228
 
231
	cmp ecx,1
229
	cmp ecx,1
232
	jl .end_dr
230
	jl .end_dr
233
	cld
231
	cld
234
	@@:
232
	@@:
235
		mov eax,[esi]
233
		mov eax,[esi]
236
		add esi,4
234
		add esi,4
237
		stdcall convert_int_to_str
235
		stdcall convert_int_to_str
238
		stdcall [buf2d_draw_text], buf_0, buf_font,edi,5,ebx,[color_captions] ;à¨á㥬 㪠§ â¥«¨ ­  ¬ áᨢë â®ç¥ª
236
		stdcall [buf2d_draw_text], buf_0, buf_font,edi,5,ebx,[color_captions] ;à¨á㥬 㪠§ â¥«¨ ­  ¬ áᨢë â®ç¥ª
239
		add ebx,9
237
		add ebx,9
240
		loop @b
238
		loop @b
241
	.end_dr:
239
	.end_dr:
242
	mov ecx,4
240
	mov ecx,4
243
	cld
241
	cld
244
	@@:
242
	@@:
245
		mov eax,[esi]
243
		mov eax,[esi]
246
		add esi,4
244
		add esi,4
247
		stdcall convert_int_to_str
245
		stdcall convert_int_to_str
248
		stdcall [buf2d_draw_text], buf_0, buf_font,edi,5,ebx,[color_border] ;à¨á㥬 4 áâப¨ 㪠§ â¥«¥©
246
		stdcall [buf2d_draw_text], buf_0, buf_font,edi,5,ebx,[color_border] ;à¨á㥬 4 áâப¨ 㪠§ â¥«¥©
249
		add ebx,9
247
		add ebx,9
250
		loop @b
248
		loop @b
251
 
249
 
252
	stdcall [buf2d_draw], buf_0
250
	stdcall [buf2d_draw], buf_0
253
 
251
 
254
	;call redraw_pole
252
	;call redraw_pole
255
	popad
253
	popad
256
	ret
254
	ret
257
endp
255
endp
258
end if
256
end if
259
 
257
 
260
;output:
258
;output:
261
; eax - index
259
; eax - index
262
align 4
260
align 4
263
proc pole_cell_find uses edi, pole:dword, x:dword, y:dword
261
proc pole_cell_find uses edi, pole:dword, x:dword, y:dword
264
	mov edi,dword[pole]
262
	mov edi,dword[pole]
265
 
263
 
266
	mov eax,pole_index
264
	mov eax,pole_index
267
	cmp dword[eax],0
265
	cmp dword[eax],0
268
	jne @f
266
	jne @f
269
		xor eax,eax ;if(!fristC) return 0;
267
		xor eax,eax ;if(!fristC) return 0;
270
		jmp .fun_e
268
		jmp .fun_e
271
	@@:
269
	@@:
272
 
270
 
273
	xor eax,eax ;fnd=0;
271
	xor eax,eax ;fnd=0;
274
	cmp pole_b_sort,0
272
	cmp pole_b_sort,0
275
	je @f
273
	je @f
276
		stdcall pole_bin_find, pole_index, [x],[y], pole_b_sort ;i=BinFind(pole_index, x,y, pole_b_sort);
274
		stdcall pole_bin_find, pole_index, [x],[y], pole_b_sort ;i=BinFind(pole_index, x,y, pole_b_sort);
277
		cmp eax,0
275
		cmp eax,0
278
		je @f
276
		je @f
279
			shl eax,2
277
			shl eax,2
280
			add eax,pole_index
278
			add eax,pole_index
281
			mov eax,dword[eax] ;if(i) fnd=pole_index[i];
279
			mov eax,dword[eax] ;if(i) fnd=pole_index[i];
282
			jmp .fun_e
280
			jmp .fun_e
283
	@@:
281
	@@:
284
 
282
 
285
	cmp eax,0
283
	cmp eax,0
286
	jne @f ;¯®¨áª ï祩ª¨ §  ¡¨­ à­ë¬ ¤¥à¥¢®¬
284
	jne @f ;¯®¨áª ï祩ª¨ §  ¡¨­ à­ë¬ ¤¥à¥¢®¬
287
		push ebx ecx edx esi
285
		push ebx ecx edx esi
288
		;ebx -> i
286
		;ebx -> i
289
		;ecx -> firstC
287
		;ecx -> firstC
290
		;edx -> &pole_index[i]
288
		;edx -> &pole_index[i]
291
		;esi -> cell[pole_index[i]]
289
		;esi -> cell[pole_index[i]]
292
		mov ecx,pole_index
290
		mov ecx,pole_index
293
		mov ebx,pole_b_sort
291
		mov ebx,pole_b_sort
294
		mov edx,ebx
292
		mov edx,ebx
295
		shl edx,2
293
		shl edx,2
296
		add edx,ecx
294
		add edx,ecx
297
		mov ecx,dword[ecx]
295
		mov ecx,dword[ecx]
298
		.cycle_b: ;for(i=pole_b_sort+1;i<=fristC;i++)
296
		.cycle_b: ;for(i=pole_b_sort+1;i<=fristC;i++)
299
			inc ebx
297
			inc ebx
300
			cmp ebx,ecx
298
			cmp ebx,ecx
301
			jg .not_found
299
			jg .not_found
302
			add edx,4
300
			add edx,4
303
			get_cell_offset esi,dword[edx]
301
			get_cell_offset esi,dword[edx]
304
			mov eax,dword[x]
302
			mov eax,dword[x]
305
			cmp dword[esi],eax ;+0 = .x
303
			cmp dword[esi],eax ;+0 = .x
306
			jne .if_e
304
			jne .if_e
307
			mov eax,dword[y]
305
			mov eax,dword[y]
308
			cmp dword[esi+4],eax ;+4 = .y
306
			cmp dword[esi+4],eax ;+4 = .y
309
			jne .if_e
307
			jne .if_e
310
				;if(cell[pole_index[i]].x==x && cell[pole_index[i]].y==y){
308
				;if(cell[pole_index[i]].x==x && cell[pole_index[i]].y==y){
311
				mov eax,dword[edx] ;fnd=pole_index[i];
309
				mov eax,dword[edx] ;fnd=pole_index[i];
312
				jmp .cycle_e ;break;
310
				jmp .cycle_e ;break;
313
			.if_e:
311
			.if_e:
314
			jmp .cycle_b
312
			jmp .cycle_b
315
			.not_found:
313
			.not_found:
316
		xor eax,eax ;¢®ááâ ­ ¢«¨¢ ¥¬ ­ã«¥¢®¥ §­ ç¥­¨¥ ¥á«¨ ­¥ ­ è«¨ ï祩ªã (¢ 横«¥ eax ¯®àâ¨âáï ¯à¨ ¯à®¢¥àª¥ ª®®à¤¨­ â)
314
		xor eax,eax ;¢®ááâ ­ ¢«¨¢ ¥¬ ­ã«¥¢®¥ §­ ç¥­¨¥ ¥á«¨ ­¥ ­ è«¨ ï祩ªã (¢ 横«¥ eax ¯®àâ¨âáï ¯à¨ ¯à®¢¥àª¥ ª®®à¤¨­ â)
317
		.cycle_e:
315
		.cycle_e:
318
		pop esi edx ecx ebx
316
		pop esi edx ecx ebx
319
	@@:
317
	@@:
320
	.fun_e:
318
	.fun_e:
321
	ret
319
	ret
322
endp
320
endp
323
 
321
 
324
;output:
322
;output:
325
; eax - index
323
; eax - index
326
align 4
324
align 4
327
proc pole_bin_find uses ebx ecx edx edi, mas:dword, fx:dword, fy:dword, k:dword
325
proc pole_bin_find uses ebx ecx edx edi, mas:dword, fx:dword, fy:dword, k:dword
328
	xor eax,eax
326
	xor eax,eax
329
	mov ebx,1 ;ebx - ¬ ªá¨¬ «ì­ë© ¯®à冷ª ¤«ï ¤¥à¥¢ 
327
	mov ebx,1 ;ebx - ¬ ªá¨¬ «ì­ë© ¯®à冷ª ¤«ï ¤¥à¥¢ 
330
	@@:
328
	@@:
331
	cmp dword[k],ebx
329
	cmp dword[k],ebx
332
	jle @f ;while(k>por)
330
	jle @f ;while(k>por)
333
		shl ebx,1 ;por<<=1;
331
		shl ebx,1 ;por<<=1;
334
		jmp @b
332
		jmp @b
335
	@@:
333
	@@:
336
	cmp dword[k],ebx
334
	cmp dword[k],ebx
337
	jge @f ;if(k
335
	jge @f ;if(k
338
		shr ebx,1 ;por>>=1;
336
		shr ebx,1 ;por>>=1;
339
	@@:
337
	@@:
340
	mov ecx,ebx ;i=por;
338
	mov ecx,ebx ;i=por;
341
 
339
 
342
	;ecx -> i
340
	;ecx -> i
343
	;edi -> mas[i]
341
	;edi -> mas[i]
344
	.cycle_b: ;do{
342
	.cycle_b: ;do{
345
		shr ebx,1 ;por>>=1;
343
		shr ebx,1 ;por>>=1;
346
 
344
 
347
		mov edi,ecx
345
		mov edi,ecx
348
		shl edi,2
346
		shl edi,2
349
		add edi,dword[mas]
347
		add edi,dword[mas]
350
		;if(compare_cells_mb(mas[i],fx,fy)){
348
		;if(compare_cells_mb(mas[i],fx,fy)){
351
		stdcall pole_compare_cells_mb_coords, dword[edi],[fx],[fy]
349
		stdcall pole_compare_cells_mb_coords, dword[edi],[fx],[fy]
352
		cmp dl,0
350
		cmp dl,0
353
		je .if_u0_e
351
		je .if_u0_e
354
			@@: ;while(i+por>k)
352
			@@: ;while(i+por>k)
355
			mov edx,ecx
353
			mov edx,ecx
356
			add edx,ebx
354
			add edx,ebx
357
			cmp edx,dword[k] ;i+por>k
355
			cmp edx,dword[k] ;i+por>k
358
			jle @f
356
			jle @f
359
				shr ebx,1 ;por>>=1;
357
				shr ebx,1 ;por>>=1;
360
				jmp @b
358
				jmp @b
361
			@@:
359
			@@:
362
			add ecx,ebx ;i+=por;
360
			add ecx,ebx ;i+=por;
363
			jmp .if_e
361
			jmp .if_e
364
		.if_u0_e:
362
		.if_u0_e:
365
		;else if(compare_cells_bm(mas[i],fx,fy))i-=por;
363
		;else if(compare_cells_bm(mas[i],fx,fy))i-=por;
366
		stdcall pole_compare_cells_bm_coords, dword[edi],[fx],[fy]
364
		stdcall pole_compare_cells_bm_coords, dword[edi],[fx],[fy]
367
		cmp dl,0
365
		cmp dl,0
368
		je .if_u1_e
366
		je .if_u1_e
369
			sub ecx,ebx
367
			sub ecx,ebx
370
			jmp .if_e
368
			jmp .if_e
371
		.if_u1_e:
369
		.if_u1_e:
372
		;else { m=i; por=0; }
370
		;else { m=i; por=0; }
373
			mov eax,ecx
371
			mov eax,ecx
374
			xor ebx,ebx
372
			xor ebx,ebx
375
		.if_e:
373
		.if_e:
376
	cmp ebx,0
374
	cmp ebx,0
377
	jne .cycle_b ;}while(por);
375
	jne .cycle_b ;}while(por);
378
 
376
 
379
	ret
377
	ret
380
endp
378
endp
381
 
379
 
382
;ᤢ¨£ ¢á¥å ï祥ª (¨ ®¡ê¥ªâ®¢)
380
;ᤢ¨£ ¢á¥å ï祥ª (¨ ®¡ê¥ªâ®¢)
383
align 4
381
align 4
384
proc pole_move_all, pole:dword, m_d_x:dword, m_d_y:dword
382
proc pole_move_all, pole:dword, m_d_x:dword, m_d_y:dword
385
pushad
383
pushad
386
	mov edi,dword[pole]
384
	mov edi,dword[pole]
387
	mov edx,[m_d_x]
385
	mov edx,[m_d_x]
388
	mov esi,[m_d_y]
386
	mov esi,[m_d_y]
389
 
387
 
390
	mov eax,pole_index
388
	mov eax,pole_index
391
	cmp dword[eax],0
389
	cmp dword[eax],0
392
	je .end_0 ;¥á«¨ ­¥â ï祥ª (¯à®¢®¤®¢) â® ¢ë室
390
	je .end_0 ;¥á«¨ ­¥â ï祥ª (¯à®¢®¤®¢) â® ¢ë室
393
 
391
 
394
	mov ecx,dword[eax]
392
	mov ecx,dword[eax]
395
	cld
393
	cld
396
	@@: ;横« ¯® ¢á¥¬ ï祩ª ¬
394
	@@: ;横« ¯® ¢á¥¬ ï祩ª ¬
397
		add eax,4
395
		add eax,4
398
		mov ebx,[eax]
396
		mov ebx,[eax]
399
		imul ebx,sizeof.Cell
397
		imul ebx,sizeof.Cell
400
		add ebx,pole_data
398
		add ebx,pole_data
401
 
399
 
402
		add dword[ebx+offs_cell_x],edx
400
		add dword[ebx+offs_cell_x],edx
403
		add dword[ebx+offs_cell_y],esi
401
		add dword[ebx+offs_cell_y],esi
404
		loop @b
402
		loop @b
405
	.end_0:
403
	.end_0:
406
 
404
 
407
	;横« ¯® «®£¨ç¥áª¨¬ í«¥¬¥­â ¬ ¨ ¯®¤¯¨áï¬
405
	;横« ¯® «®£¨ç¥áª¨¬ í«¥¬¥­â ¬ ¨ ¯®¤¯¨áï¬
408
	stdcall dword[tl_node_poi_get_info], tree1,0
406
	stdcall dword[tl_node_poi_get_info], tree1,0
409
	@@:
407
	@@:
410
		cmp eax,0
408
		cmp eax,0
411
		je .end_1
409
		je .end_1
412
		cmp word[eax],el_icon_elems ;¯®«ã祭¨¥ ç¥à¥§ eax ⨯ ¨ª®­ª¨
410
		cmp word[eax],el_icon_elems ;¯®«ã祭¨¥ ç¥à¥§ eax ⨯ ¨ª®­ª¨
413
		je .mov_1
411
		je .mov_1
414
		cmp word[eax],el_icon_captions
412
		cmp word[eax],el_icon_captions
415
		je .mov_1
413
		je .mov_1
416
			jmp .end_mov_1
414
			jmp .end_mov_1
417
		.mov_1:
415
		.mov_1:
418
			mov ecx,eax
416
			mov ecx,eax
419
			stdcall [tl_node_poi_get_data], tree1,eax
417
			stdcall [tl_node_poi_get_data], tree1,eax
420
			add [eax],edx ;coord x
418
			add [eax],edx ;coord x
421
			add [eax+4],esi ;coord y
419
			add [eax+4],esi ;coord y
422
			mov eax,ecx
420
			mov eax,ecx
423
		.end_mov_1:
421
		.end_mov_1:
424
		stdcall dword[tl_node_poi_get_next_info], tree1,eax ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
422
		stdcall dword[tl_node_poi_get_next_info], tree1,eax ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
425
		jmp @b
423
		jmp @b
426
	.end_1:
424
	.end_1:
427
 
425
 
428
popad
426
popad
429
	ret
427
	ret
430
endp
428
endp
431
 
429
 
432
;output:
430
;output:
433
; dl
431
; dl
434
align 4
432
align 4
435
proc pole_compare_cells_bm_coords uses eax ebx ecx, i0:dword, fx:dword, fy:dword
433
proc pole_compare_cells_bm_coords uses eax ebx ecx, i0:dword, fx:dword, fy:dword
436
	get_cell_offset eax,[i0]
434
	get_cell_offset eax,[i0]
437
	;eax -> cell[i0]
435
	;eax -> cell[i0]
438
	mov ebx,dword[fx]
436
	mov ebx,dword[fx]
439
	cmp dword[eax],ebx
437
	cmp dword[eax],ebx
440
	jle @f
438
	jle @f
441
		mov dl,1
439
		mov dl,1
442
		jmp .fun_e
440
		jmp .fun_e
443
	@@:
441
	@@:
444
	mov ecx,dword[fy]
442
	mov ecx,dword[fy]
445
	cmp dword[eax+4],ecx
443
	cmp dword[eax+4],ecx
446
	jle @f
444
	jle @f
447
	cmp dword[eax],ebx
445
	cmp dword[eax],ebx
448
	jne @f
446
	jne @f
449
		mov dl,1
447
		mov dl,1
450
		jmp .fun_e
448
		jmp .fun_e
451
	@@:
449
	@@:
452
	xor dl,dl
450
	xor dl,dl
453
	.fun_e:
451
	.fun_e:
454
	ret
452
	ret
455
endp
453
endp
456
 
454
 
457
;output:
455
;output:
458
; dl
456
; dl
459
align 4
457
align 4
460
proc pole_compare_cells_mb_coords uses eax ebx ecx, i0:dword, fx:dword, fy:dword
458
proc pole_compare_cells_mb_coords uses eax ebx ecx, i0:dword, fx:dword, fy:dword
461
	get_cell_offset eax,[i0]
459
	get_cell_offset eax,[i0]
462
	;eax -> cell[i0]
460
	;eax -> cell[i0]
463
	mov ebx,dword[fx]
461
	mov ebx,dword[fx]
464
	cmp dword[eax],ebx
462
	cmp dword[eax],ebx
465
	jge @f
463
	jge @f
466
		mov dl,1
464
		mov dl,1
467
		jmp .fun_e
465
		jmp .fun_e
468
	@@:
466
	@@:
469
	mov ecx,dword[fy]
467
	mov ecx,dword[fy]
470
	cmp dword[eax+4],ecx
468
	cmp dword[eax+4],ecx
471
	jge @f
469
	jge @f
472
	cmp dword[eax],ebx
470
	cmp dword[eax],ebx
473
	jne @f
471
	jne @f
474
		mov dl,1
472
		mov dl,1
475
		jmp .fun_e
473
		jmp .fun_e
476
	@@:
474
	@@:
477
	xor dl,dl
475
	xor dl,dl
478
	.fun_e:
476
	.fun_e:
479
	ret
477
	ret
480
endp
478
endp
481
 
479
 
482
;output:
480
;output:
483
; dl
481
; dl
484
align 4
482
align 4
485
proc pole_compare_cells_bm, i0:dword, i1:dword
483
proc pole_compare_cells_bm, i0:dword, i1:dword
486
	push eax ebx ecx
484
	push eax ebx ecx
487
	get_cell_offset eax,[i0] ;eax -> cell[i0]
485
	get_cell_offset eax,[i0] ;eax -> cell[i0]
488
	get_cell_offset ebx,[i1] ;ebx -> cell[i1]
486
	get_cell_offset ebx,[i1] ;ebx -> cell[i1]
489
	mov ecx,dword[ebx] ;+0 = .x
487
	mov ecx,dword[ebx] ;+0 = .x
490
	cmp dword[eax],ecx
488
	cmp dword[eax],ecx
491
	jle @f ;x0>x1
489
	jle @f ;x0>x1
492
		mov dl,1
490
		mov dl,1
493
		jmp .fun_e
491
		jmp .fun_e
494
	@@:
492
	@@:
495
	jne @f ;x0==x1
493
	jne @f ;x0==x1
496
	mov ecx,dword[ebx+4] ;+4 = .y
494
	mov ecx,dword[ebx+4] ;+4 = .y
497
	cmp dword[eax+4],ecx
495
	cmp dword[eax+4],ecx
498
	jle @f ;y0>y1
496
	jle @f ;y0>y1
499
		mov dl,1
497
		mov dl,1
500
		jmp .fun_e
498
		jmp .fun_e
501
	@@:
499
	@@:
502
	xor dl,dl
500
	xor dl,dl
503
	.fun_e:
501
	.fun_e:
504
	pop ecx ebx eax
502
	pop ecx ebx eax
505
	ret
503
	ret
506
endp
504
endp
507
 
505
 
508
;description:
506
;description:
509
; ç¨á⪠ ï祥ª (¯à®¢®¤®¢), ãáâ ­®¢ª  ­  ¢á¥å ¯à®¢®¤ å 0-£® ᨣ­ « 
507
; ç¨á⪠ ï祥ª (¯à®¢®¤®¢), ãáâ ­®¢ª  ­  ¢á¥å ¯à®¢®¤ å 0-£® ᨣ­ « 
510
; ­ã¦­® ¢ë§ë¢ âì ¯à¨ ä®à¬¨à®¢ ­¨¨ ¨«¨ ¯¥à¥¤ § ¯ã᪮¬ á奬ë
508
; ­ã¦­® ¢ë§ë¢ âì ¯à¨ ä®à¬¨à®¢ ­¨¨ ¨«¨ ¯¥à¥¤ § ¯ã᪮¬ á奬ë
511
align 4
509
align 4
512
proc pole_reset_cells uses eax ebx ecx edi, pole:dword
510
proc pole_reset_cells uses eax ebx ecx edi, pole:dword
513
	mov edi,dword[pole]
511
	mov edi,dword[pole]
514
	mov eax,pole_index
512
	mov eax,pole_index
515
	cmp dword[eax],0
513
	cmp dword[eax],0
516
	je .fun_e ;¥á«¨ ­¥â ï祥ª (¯à®¢®¤®¢) â® ¢ë室
514
	je .fun_e ;¥á«¨ ­¥â ï祥ª (¯à®¢®¤®¢) â® ¢ë室
517
 
515
 
518
	mov ecx,dword[eax]
516
	mov ecx,dword[eax]
519
	cld
517
	cld
520
	@@: ;横« ¯® ¢á¥¬ ï祩ª ¬
518
	@@: ;横« ¯® ¢á¥¬ ï祩ª ¬
521
		add eax,4
519
		add eax,4
522
		mov ebx,[eax]
520
		mov ebx,[eax]
523
		imul ebx,sizeof.Cell
521
		imul ebx,sizeof.Cell
524
		add ebx,pole_data
522
		add ebx,pole_data
525
		;and byte[ebx+offs_cell_liv],0xfe ;á¡à®á ¬« ¤è¥£® ¡¨â 
523
		;and byte[ebx+offs_cell_liv],0xfe ;á¡à®á ¬« ¤è¥£® ¡¨â 
526
		cmp byte[ebx+offs_cell_liv],2
524
		cmp byte[ebx+offs_cell_liv],2
527
		je .no_clear
525
		je .no_clear
528
			mov byte[ebx+offs_cell_liv],0
526
			mov byte[ebx+offs_cell_liv],0
529
		.no_clear:
527
		.no_clear:
530
		loop @b
528
		loop @b
531
	.fun_e:
529
	.fun_e:
532
	ret
530
	ret
533
endp
531
endp
534
 
532
 
535
align 4
533
align 4
536
proc p_paint_elems uses eax esi
534
proc p_paint_elems uses eax esi
537
	stdcall dword[tl_node_poi_get_info], tree1,0
535
	stdcall dword[tl_node_poi_get_info], tree1,0
538
	@@:
536
	@@:
539
		cmp eax,0
537
		cmp eax,0
540
		je @f
538
		je @f
541
		mov esi,eax
539
		mov esi,eax
542
		cmp word[esi],el_icon_elems ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨
540
		cmp word[esi],el_icon_elems ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨
543
		jne .end_element
541
		jne .end_element
544
			stdcall [tl_node_poi_get_data], tree1,esi
542
			stdcall [tl_node_poi_get_data], tree1,esi
545
			stdcall el_draw, eax
543
			stdcall el_draw, eax
546
		.end_element:
544
		.end_element:
547
		cmp word[esi],el_icon_captions ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨
545
		cmp word[esi],el_icon_captions ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨
548
		jne .end_caption
546
		jne .end_caption
549
			stdcall [tl_node_poi_get_data], tree1,esi
547
			stdcall [tl_node_poi_get_data], tree1,esi
550
			stdcall capt_draw, eax
548
			stdcall capt_draw, eax
551
		.end_caption:
549
		.end_caption:
552
		stdcall dword[tl_node_poi_get_next_info], tree1,esi
550
		stdcall dword[tl_node_poi_get_next_info], tree1,esi
553
		jmp @b
551
		jmp @b
554
	@@:
552
	@@:
555
	ret
553
	ret
556
endp
554
endp
557
 
555
 
558
;description:
556
;description:
559
; äã­ªæ¨ï à¨á®¢ ­¨ï í«¥¬¥­â  ­  ¯®«¥
557
; äã­ªæ¨ï à¨á®¢ ­¨ï í«¥¬¥­â  ­  ¯®«¥
560
align 4
558
align 4
561
proc el_draw, h_elem:dword
559
proc el_draw, h_elem:dword
562
	pushad
560
	pushad
563
 
561
 
564
	mov edi,[h_elem]
562
	mov edi,[h_elem]
565
	mov eax,[edi] ;coord x
563
	mov eax,[edi] ;coord x
566
	mov ebx,[edi+4] ;coord y
564
	mov ebx,[edi+4] ;coord y
567
 
565
 
568
	movzx edi,byte[edi+sp_offs_el_type]
566
	movzx edi,byte[edi+sp_offs_el_type]
569
	imul edi,size_el_opt
567
	imul edi,size_el_opt
570
	add edi,el_opt_beg ;edi - 㪠§ â¥«ì ­  áâàãªâãàã ᮠ᢮©á⢠¬¨ í«¥¬¥­â 
568
	add edi,el_opt_beg ;edi - 㪠§ â¥«ì ­  áâàãªâãàã ᮠ᢮©á⢠¬¨ í«¥¬¥­â 
571
 
569
 
572
	movzx ecx,byte[edi+el_offs_box_x]
570
	movzx ecx,byte[edi+el_offs_box_x]
573
	movzx edx,byte[edi+el_offs_box_y]
571
	movzx edx,byte[edi+el_offs_box_y]
574
	dec ecx
572
	dec ecx
575
	dec edx
573
	dec edx
576
 
574
 
577
	push eax ebx
575
	push eax ebx
578
		mov esi,[h_elem]
576
		mov esi,[h_elem]
579
		movzx esi,byte[esi+8]
577
		movzx esi,byte[esi+8]
580
		push dword[edi+el_offs_col]
578
		push dword[edi+el_offs_col]
581
		push ebx
579
		push ebx
582
		push eax
580
		push eax
583
		stdcall move_rotate_n90, ecx,edx,esi
581
		stdcall move_rotate_n90, ecx,edx,esi
584
		stdcall draw_scaled_rect, eax,ebx ;à¨á®¢ ­¨ ª®à¯ãá  í«¥¬¥­â 
582
		stdcall draw_scaled_rect, eax,ebx ;à¨á®¢ ­¨ ª®à¯ãá  í«¥¬¥­â 
585
	pop ebx eax
583
	pop ebx eax
586
 
584
 
587
	;***  «£®à¨â¬ à¨á®¢ ­¨ï ­®£ ***
585
	;***  «£®à¨â¬ à¨á®¢ ­¨ï ­®£ ***
588
	movzx esi,byte[zoom]
586
	movzx esi,byte[zoom]
589
	cmp esi,1
587
	cmp esi,1
590
	jne .end_m1
588
	jne .end_m1
591
		;*** à¨á®¢ ­¨¥ ­®£ ¯à¨ 1-¬ ¬ áèâ ¡¥ ***
589
		;*** à¨á®¢ ­¨¥ ­®£ ¯à¨ 1-¬ ¬ áèâ ¡¥ ***
592
		;¢å®¤­ë¥ ­®£¨
590
		;¢å®¤­ë¥ ­®£¨
593
		mov esi,[h_elem]
591
		mov esi,[h_elem]
594
		stdcall el_get_leg_coords,esi,0 ;ãáâ ­®¢ª  ¯ à ¬¥â஢ 0-© ­®£¨
592
		stdcall el_get_leg_coords,esi,0 ;ãáâ ­®¢ª  ¯ à ¬¥â஢ 0-© ­®£¨
595
		add eax,[Cor_x]
593
		add eax,[Cor_x]
596
		add ebx,[Cor_y]
594
		add ebx,[Cor_y]
597
		movzx esi,byte[esi+8]
595
		movzx esi,byte[esi+8]
598
		stdcall move_rotate_n90, 1,0,esi
596
		stdcall move_rotate_n90, 1,0,esi
599
		mov edx,1
597
		mov edx,1
600
		@@:
598
		@@:
601
			stdcall [buf2d_set_pixel], buf_0, eax,ebx,dword[edi+el_offs_col]
599
			stdcall [buf2d_set_pixel], buf_0, eax,ebx,dword[edi+el_offs_col]
602
			mov ecx,[edi+el_offs_legs_inp]
600
			mov ecx,[edi+el_offs_legs_inp]
603
			movzx ecx,byte[ecx+edx]
601
			movzx ecx,byte[ecx+edx]
604
			cmp ecx,0
602
			cmp ecx,0
605
			je @f
603
			je @f
606
			stdcall move_rotate_n90, 0,ecx,esi
604
			stdcall move_rotate_n90, 0,ecx,esi
607
			inc edx
605
			inc edx
608
			jmp @b
606
			jmp @b
609
		@@:
607
		@@:
610
 
608
 
611
		;¢ë室­ë¥ ­®£¨
609
		;¢ë室­ë¥ ­®£¨
612
		mov esi,[h_elem]
610
		mov esi,[h_elem]
613
		stdcall el_get_leg_coords,esi,(1 shl 16) ;ãáâ ­®¢ª  ¯ à ¬¥â஢ 0-© ­®£¨
611
		stdcall el_get_leg_coords,esi,(1 shl 16) ;ãáâ ­®¢ª  ¯ à ¬¥â஢ 0-© ­®£¨
614
		add eax,[Cor_x] ;¤«ï à ¡®âë á buf2d_line
612
		add eax,[Cor_x] ;¤«ï à ¡®âë á buf2d_line
615
		add ebx,[Cor_y] ;¤«ï à ¡®âë á buf2d_line
613
		add ebx,[Cor_y] ;¤«ï à ¡®âë á buf2d_line
616
		movzx esi,byte[esi+8]
614
		movzx esi,byte[esi+8]
617
		stdcall move_rotate_n90, -2,0,esi
615
		stdcall move_rotate_n90, -2,0,esi
618
		mov edx,el_offs_legs_out
616
		mov edx,el_offs_legs_out
619
		inc edx
617
		inc edx
620
		@@:
618
		@@:
621
			push dword[edi+el_offs_col]
619
			push dword[edi+el_offs_col]
622
			stdcall move_rotate_n90, 1,0,esi
620
			stdcall move_rotate_n90, 1,0,esi
623
			push ebx
621
			push ebx
624
			push eax
622
			push eax
625
			stdcall move_rotate_n90, -1,0,esi
623
			stdcall move_rotate_n90, -1,0,esi
626
			;stdcall draw_scaled_rect, eax,ebx
624
			;stdcall draw_scaled_rect, eax,ebx
627
			stdcall [buf2d_line], buf_0, eax,ebx
625
			stdcall [buf2d_line], buf_0, eax,ebx
628
			movzx ecx,byte[edi+edx]
626
			movzx ecx,byte[edi+edx]
629
			cmp ecx,0
627
			cmp ecx,0
630
			je @f
628
			je @f
631
			stdcall move_rotate_n90, 0,ecx,esi
629
			stdcall move_rotate_n90, 0,ecx,esi
632
			inc edx
630
			inc edx
633
			jmp @b
631
			jmp @b
634
		@@:
632
		@@:
635
 
633
 
636
		jmp .end_mn
634
		jmp .end_mn
637
	.end_m1:
635
	.end_m1:
638
		;*** à¨á®¢ ­¨¥ ­®£ ¯à¨ n-¬ ¬ áèâ ¡¥ ***
636
		;*** à¨á®¢ ­¨¥ ­®£ ¯à¨ n-¬ ¬ áèâ ¡¥ ***
639
		;¢å®¤­ë¥ ­®£¨
637
		;¢å®¤­ë¥ ­®£¨
640
		xor edx,edx
638
		xor edx,edx
641
		@@:
639
		@@:
642
			stdcall el_get_leg_coords,[h_elem],edx
640
			stdcall el_get_leg_coords,[h_elem],edx
643
			mov ecx,eax
641
			mov ecx,eax
644
			or ecx,ebx
642
			or ecx,ebx
645
			jz @f
643
			jz @f
646
			mov ecx,[h_elem]
644
			mov ecx,[h_elem]
647
			movzx ecx,byte[ecx+8]
645
			movzx ecx,byte[ecx+8]
648
			stdcall move_rotate_n90, 1,0,ecx
646
			stdcall move_rotate_n90, 1,0,ecx
649
			add eax,[Cor_x]
647
			add eax,[Cor_x]
650
			add ebx,[Cor_y]
648
			add ebx,[Cor_y]
651
			imul eax,esi
649
			imul eax,esi
652
			imul ebx,esi
650
			imul ebx,esi
653
			stdcall [buf2d_filled_rect_by_size], buf_0, eax,ebx,esi,esi, dword[edi+el_offs_col]
651
			stdcall [buf2d_filled_rect_by_size], buf_0, eax,ebx,esi,esi, dword[edi+el_offs_col]
654
			inc edx
652
			inc edx
655
			jmp @b
653
			jmp @b
656
		@@:
654
		@@:
657
 
655
 
658
		;¢ë室­ë¥ ­®£¨
656
		;¢ë室­ë¥ ­®£¨
659
		mov edx,(1 shl 16)
657
		mov edx,(1 shl 16)
660
		@@:
658
		@@:
661
			stdcall el_get_leg_coords,[h_elem],edx
659
			stdcall el_get_leg_coords,[h_elem],edx
662
			mov ecx,eax
660
			mov ecx,eax
663
			or ecx,ebx
661
			or ecx,ebx
664
			jz @f
662
			jz @f
665
			mov ecx,[h_elem]
663
			mov ecx,[h_elem]
666
			movzx ecx,byte[ecx+8]
664
			movzx ecx,byte[ecx+8]
667
 
665
 
668
			push dword[edi+el_offs_col]
666
			push dword[edi+el_offs_col]
669
			stdcall move_rotate_n90, -2,0,ecx
667
			stdcall move_rotate_n90, -2,0,ecx
670
			push ebx
668
			push ebx
671
			push eax
669
			push eax
672
			stdcall move_rotate_n90, 1,0,ecx
670
			stdcall move_rotate_n90, 1,0,ecx
673
			stdcall draw_scaled_rect, eax,ebx
671
			stdcall draw_scaled_rect, eax,ebx
674
 
672
 
675
			inc edx
673
			inc edx
676
			jmp @b
674
			jmp @b
677
		@@:		
675
		@@:		
678
	.end_mn:
676
	.end_mn:
679
	popad
677
	popad
680
	ret
678
	ret
681
endp
679
endp
682
 
680
 
683
;description:
681
;description:
684
;à¨á®¢ ­¨¥ ¯®¤¯¨á¥©
682
;à¨á®¢ ­¨¥ ¯®¤¯¨á¥©
685
align 4
683
align 4
686
proc capt_draw uses eax ebx edi esi, h_capt:dword
684
proc capt_draw uses eax ebx edi esi, h_capt:dword
687
	mov edi,[h_capt]
685
	mov edi,[h_capt]
688
	mov eax,[edi] ;coord x
686
	mov eax,[edi] ;coord x
689
	mov ebx,[edi+4] ;coord y
687
	mov ebx,[edi+4] ;coord y
690
 
688
 
691
	movzx esi,byte[zoom]
689
	movzx esi,byte[zoom]
692
	cmp esi,3
690
	cmp esi,3
693
	jl @f
691
	jl @f
694
		;à¨á®¢ ­¨¥ à ¬ª¨, ¢®ªà㣠§ ­ï⮩ â®çª¨
692
		;à¨á®¢ ­¨¥ à ¬ª¨, ¢®ªà㣠§ ­ï⮩ â®çª¨
695
		stdcall draw_point_border, eax,ebx, [color_captions]
693
		stdcall draw_point_border, eax,ebx, [color_captions]
696
	@@:
694
	@@:
697
 
695
 
698
	add eax,[Cor_x]
696
	add eax,[Cor_x]
699
	add ebx,[Cor_y]
697
	add ebx,[Cor_y]
700
 
698
 
701
	cmp esi,1
699
	cmp esi,1
702
	jle @f
700
	jle @f
703
		imul eax,esi
701
		imul eax,esi
704
		imul ebx,esi
702
		imul ebx,esi
705
	@@:
703
	@@:
706
 
704
 
707
	cmp esi,3
705
	cmp esi,3
708
	jl @f
706
	jl @f
709
		;ᤢ¨£ ­ ¤¯¨á¨ á ãç¥â®¬ à ¬ª¨
707
		;ᤢ¨£ ­ ¤¯¨á¨ á ãç¥â®¬ à ¬ª¨
710
		add eax,esi
708
		add eax,esi
711
		inc eax
709
		inc eax
712
	@@:
710
	@@:
713
 
711
 
714
	add edi,capt_offs ;edi - 㪠§ â¥«ì ­  ¯®«­ãî ¯®¤¯¨áì (á ª®®à¤¨­ â ¬¨)
712
	add edi,capt_offs ;edi - 㪠§ â¥«ì ­  ¯®«­ãî ¯®¤¯¨áì (á ª®®à¤¨­ â ¬¨)
715
	call str_next_val
713
	call str_next_val
716
	call str_next_val
714
	call str_next_val
717
	stdcall [buf2d_draw_text], buf_0, buf_font,edi,eax,ebx,[color_captions] ;à¨á㥬 áâபã á ⥪á⮬
715
	stdcall [buf2d_draw_text], buf_0, buf_font,edi,eax,ebx,[color_captions] ;à¨á㥬 áâபã á ⥪á⮬
718
	ret
716
	ret
719
endp
717
endp
720
 
718
 
721
;description:
719
;description:
722
; äã­ªæ¨ï ¤«ï ¢ë¤¥«¥­¨ï â®ç¥ç­ëå ®¡ê¥ªâ®¢ ­  ªà㯭ëå ¬ áèâ ¡ å
720
; äã­ªæ¨ï ¤«ï ¢ë¤¥«¥­¨ï â®ç¥ç­ëå ®¡ê¥ªâ®¢ ­  ªà㯭ëå ¬ áèâ ¡ å
723
; ¤ ­­ ï äã­ªæ¨ï ®ç¥­ì ¯®å®¦  ­  draw_signal_rect
721
; ¤ ­­ ï äã­ªæ¨ï ®ç¥­ì ¯®å®¦  ­  draw_signal_rect
724
align 4
722
align 4
725
proc draw_point_border uses eax ebx edi, x0:dword,y0:dword, color:dword
723
proc draw_point_border uses eax ebx edi, x0:dword,y0:dword, color:dword
726
	movzx edi,byte[zoom]
724
	movzx edi,byte[zoom]
727
	mov ebx,[y0]
725
	mov ebx,[y0]
728
	mov eax,[x0]
726
	mov eax,[x0]
729
 
727
 
730
	add ebx,[Cor_y]
728
	add ebx,[Cor_y]
731
	imul ebx,edi
729
	imul ebx,edi
732
	add eax,[Cor_x]
730
	add eax,[Cor_x]
733
	imul eax,edi
731
	imul eax,edi
734
 
732
 
735
	stdcall [buf2d_rect_by_size], buf_0, eax,ebx,edi,edi, dword[color]
733
	stdcall [buf2d_rect_by_size], buf_0, eax,ebx,edi,edi, dword[color]
736
	ret
734
	ret
737
endp
735
endp
738
 
736
 
739
;description:
737
;description:
740
; ¯®¤äã­ªæ¨ï ¤«ï à¨á®¢ ­¨ï 㢥«¨ç¥­­ëå ¯àאַ㣮«ì­¨ª®¢ ­  á奬¥
738
; ¯®¤äã­ªæ¨ï ¤«ï à¨á®¢ ­¨ï 㢥«¨ç¥­­ëå ¯àאַ㣮«ì­¨ª®¢ ­  á奬¥
741
align 4
739
align 4
742
proc draw_scaled_rect uses eax ebx ecx edx edi, x0:dword,y0:dword,x1:dword,y1:dword, color:dword
740
proc draw_scaled_rect uses eax ebx ecx edx edi, x0:dword,y0:dword,x1:dword,y1:dword, color:dword
743
	movzx edi,byte[zoom]
741
	movzx edi,byte[zoom]
744
	mov edx,[y1]
742
	mov edx,[y1]
745
	mov ecx,[x1]
743
	mov ecx,[x1]
746
	mov ebx,[y0]
744
	mov ebx,[y0]
747
	mov eax,[x0]
745
	mov eax,[x0]
748
 
746
 
749
	cmp eax,ecx
747
	cmp eax,ecx
750
	jle @f
748
	jle @f
751
		xchg eax,ecx
749
		xchg eax,ecx
752
	@@:
750
	@@:
753
	sub ecx,eax
751
	sub ecx,eax
754
	cmp ebx,edx
752
	cmp ebx,edx
755
	jle @f
753
	jle @f
756
		xchg ebx,edx
754
		xchg ebx,edx
757
	@@:
755
	@@:
758
	sub edx,ebx
756
	sub edx,ebx
759
 
757
 
760
	inc ecx
758
	inc ecx
761
	inc edx
759
	inc edx
762
 
760
 
763
	imul edx,edi
761
	imul edx,edi
764
	imul ecx,edi
762
	imul ecx,edi
765
	add ebx,[Cor_y]
763
	add ebx,[Cor_y]
766
	imul ebx,edi
764
	imul ebx,edi
767
	add eax,[Cor_x]
765
	add eax,[Cor_x]
768
	imul eax,edi
766
	imul eax,edi
769
 
767
 
770
	stdcall [buf2d_filled_rect_by_size], buf_0, eax,ebx,ecx,edx, dword[color]
768
	stdcall [buf2d_filled_rect_by_size], buf_0, eax,ebx,ecx,edx, dword[color]
771
	ret
769
	ret
772
endp
770
endp
773
 
771
 
774
align 4
772
align 4
775
proc pole_paint, pole:dword
773
proc pole_paint, pole:dword
776
	pushad
774
	pushad
777
 
775
 
778
	;*** நᮢ ­¨¥ à ¬ª¨
776
	;*** நᮢ ­¨¥ à ¬ª¨
779
	mov eax,[Cor_x]
777
	mov eax,[Cor_x]
780
	mov ebx,[Cor_y]
778
	mov ebx,[Cor_y]
781
	mov ecx,[shem_w]
779
	mov ecx,[shem_w]
782
	mov edx,[shem_h]
780
	mov edx,[shem_h]
783
	movzx esi,byte[zoom]
781
	movzx esi,byte[zoom]
784
	cmp esi,1
782
	cmp esi,1
785
	jle @f
783
	jle @f
786
		imul eax,esi
784
		imul eax,esi
787
		imul ebx,esi
785
		imul ebx,esi
788
		imul ecx,esi
786
		imul ecx,esi
789
		imul edx,esi
787
		imul edx,esi
790
	@@:
788
	@@:
791
	dec eax
789
	dec eax
792
	dec ebx
790
	dec ebx
793
	add ecx,2
791
	add ecx,2
794
	add edx,2
792
	add edx,2
795
	stdcall [buf2d_rect_by_size], buf_0, eax,ebx, ecx,edx, [color_border]
793
	stdcall [buf2d_rect_by_size], buf_0, eax,ebx, ecx,edx, [color_border]
796
 
794
 
797
	;eax -> firstC
795
	;eax -> firstC
798
	;ebx -> i
796
	;ebx -> i
799
	;ecx -> cell[pole_index[i]]
797
	;ecx -> cell[pole_index[i]]
800
	;edx -> color
798
	;edx -> color
801
 
799
 
802
	mov edi,dword[pole]
800
	mov edi,dword[pole]
803
	mov eax,pole_index
801
	mov eax,pole_index
804
	cmp dword[eax],0
802
	cmp dword[eax],0
805
	je .no_draw
803
	je .no_draw
806
 
804
 
807
	mov eax,dword[eax]
805
	mov eax,dword[eax]
808
	mov ebx,1
806
	mov ebx,1
809
 
807
 
810
;---
808
;---
811
	@@: ;while(i
809
	@@: ;while(i
812
		cmp ebx,pole_b_sort
810
		cmp ebx,pole_b_sort
813
		jge @f ;¯¥à¥å®¤¨¬ ­  ­ ç «® ­¨¦­¥£® 横« 
811
		jge @f ;¯¥à¥å®¤¨¬ ­  ­ ç «® ­¨¦­¥£® 横« 
814
		mov ecx,ebx
812
		mov ecx,ebx
815
		shl ecx,2
813
		shl ecx,2
816
		add ecx,pole_index
814
		add ecx,pole_index
817
		get_cell_offset ecx,dword[ecx]
815
		get_cell_offset ecx,dword[ecx]
818
		mov edx,dword[ecx] ;+0 = .x
816
		mov edx,dword[ecx] ;+0 = .x
819
		add edx,dword[Cor_x]
817
		add edx,dword[Cor_x]
820
		cmp edx,0
818
		cmp edx,0
821
		jge @f ;¯¥à¥å®¤¨¬ ­  ­ ç «® ­¨¦­¥£® 横« 
819
		jge @f ;¯¥à¥å®¤¨¬ ­  ­ ç «® ­¨¦­¥£® 横« 
822
			inc ebx ;i++; // ¤«ï ¯à®¯ã᪠ ï祥ª §  ®ª­®¬ á«¥¢ 
820
			inc ebx ;i++; // ¤«ï ¯à®¯ã᪠ ï祥ª §  ®ª­®¬ á«¥¢ 
823
		jmp @b
821
		jmp @b
824
	@@:
822
	@@:
825
 
823
 
826
	;eax -> pole_index[firstC]
824
	;eax -> pole_index[firstC]
827
	;ebx -> pole_index[i]
825
	;ebx -> pole_index[i]
828
	;edi -> coord_x
826
	;edi -> coord_x
829
	;esi -> coord_y
827
	;esi -> coord_y
830
	shl eax,2
828
	shl eax,2
831
	shl ebx,2
829
	shl ebx,2
832
	add eax,pole_index
830
	add eax,pole_index
833
	add ebx,pole_index
831
	add ebx,pole_index
834
 
832
 
835
	cmp byte[zoom],2
833
	cmp byte[zoom],2
836
	jge .zoom2
834
	jge .zoom2
837
	@@: ;for(;i<=fristC;i++){
835
	@@: ;for(;i<=fristC;i++){
838
		get_cell_offset ecx,dword[ebx]
836
		get_cell_offset ecx,dword[ebx]
839
;...
837
;...
840
		mov edi,dword[Cor_x]
838
		mov edi,dword[Cor_x]
841
		add edi,dword[ecx] ;+0 = .x
839
		add edi,dword[ecx] ;+0 = .x
842
		mov esi,dword[Cor_y]
840
		mov esi,dword[Cor_y]
843
		add esi,dword[ecx+4] ;+4 = .y
841
		add esi,dword[ecx+4] ;+4 = .y
844
		movzx edx,byte[ecx+offs_cell_liv]
842
		movzx edx,byte[ecx+offs_cell_liv]
845
		and edx,3 ;®£à ­¨ç¥­¨¥
843
		and edx,3 ;®£à ­¨ç¥­¨¥
846
		shl edx,2
844
		shl edx,2
847
		add edx,shem_colors
845
		add edx,shem_colors
848
		stdcall [buf2d_set_pixel], buf_0, edi, esi, [edx]
846
		stdcall [buf2d_set_pixel], buf_0, edi, esi, [edx]
849
;...
847
;...
850
		add ebx,4
848
		add ebx,4
851
		cmp ebx,eax
849
		cmp ebx,eax
852
		jle @b
850
		jle @b
853
 
851
 
854
	jmp .no_draw
852
	jmp .no_draw
855
	.zoom2:
853
	.zoom2:
856
 
854
 
857
	@@: ;for(;i<=fristC;i++){
855
	@@: ;for(;i<=fristC;i++){
858
		get_cell_offset ecx,dword[ebx]
856
		get_cell_offset ecx,dword[ebx]
859
 
857
 
860
		movzx edx,byte[zoom] ;edx ¨á¯®«ì§ã¥âáï ¤«ï ¢­¥á¥­¨ï zoom ¢ 4 ¡ ©â­®¥ ç¨á«®
858
		movzx edx,byte[zoom] ;edx ¨á¯®«ì§ã¥âáï ¤«ï ¢­¥á¥­¨ï zoom ¢ 4 ¡ ©â­®¥ ç¨á«®
861
		mov edi,dword[ecx] ;+0 = .x
859
		mov edi,dword[ecx] ;+0 = .x
862
		add edi,dword[Cor_x]
860
		add edi,dword[Cor_x]
863
		imul edi,edx
861
		imul edi,edx
864
		mov esi,dword[ecx+4] ;+4 = .y
862
		mov esi,dword[ecx+4] ;+4 = .y
865
		add esi,dword[Cor_y]
863
		add esi,dword[Cor_y]
866
		imul esi,edx
864
		imul esi,edx
867
 
865
 
868
		movzx edx,byte[ecx+offs_cell_liv]
866
		movzx edx,byte[ecx+offs_cell_liv]
869
		and edx,3 ;®£à ­¨ç¥­¨¥
867
		and edx,3 ;®£à ­¨ç¥­¨¥
870
		shl edx,2
868
		shl edx,2
871
		add edx,shem_colors
869
		add edx,shem_colors
872
 
870
 
873
		movzx ecx,byte[zoom]
871
		movzx ecx,byte[zoom]
874
		;;;dec ecx
872
		;;;dec ecx
875
		stdcall [buf2d_filled_rect_by_size], buf_0, edi, esi, ecx, ecx, [edx]
873
		stdcall [buf2d_filled_rect_by_size], buf_0, edi, esi, ecx, ecx, [edx]
876
		add ebx,4
874
		add ebx,4
877
		cmp ebx,eax
875
		cmp ebx,eax
878
		jle @b
876
		jle @b
879
 
877
 
880
	.no_draw:
878
	.no_draw:
881
	popad
879
	popad
882
	call p_paint_elems
880
	call p_paint_elems
883
	ret
881
	ret
884
endp
882
endp
885
 
883
 
886
;‘®àâ¨à®¢ª  ï祥ª ¯®«ï, ­ã¦­  ¤«ï ¡®«¥¥ ¡ëáâண® ¯®¨áª 
884
;‘®àâ¨à®¢ª  ï祥ª ¯®«ï, ­ã¦­  ¤«ï ¡®«¥¥ ¡ëáâண® ¯®¨áª 
887
align 4
885
align 4
888
proc pole_sort uses eax edi, pole:dword
886
proc pole_sort uses eax edi, pole:dword
889
	mov edi,dword[pole]
887
	mov edi,dword[pole]
890
	mov eax,pole_index
888
	mov eax,pole_index
891
	mov eax,dword[eax] ;firstC -> eax
889
	mov eax,dword[eax] ;firstC -> eax
892
	stdcall pole_fl_sort, pole_index,eax ;á®àâ¨à㥬 ¢á¥ ï祩ª¨
890
	stdcall pole_fl_sort, pole_index,eax ;á®àâ¨à㥬 ¢á¥ ï祩ª¨
893
	mov pole_b_sort,eax ;áâ ¢¨¬ ç¨á«® ®âá®àâ¨à®¢ ­­ëå ï祥ª à ¢­®¥ ç¨á«ã ¢á¥å áãé¥áâ¢ãîé¨å ï祥ª
891
	mov pole_b_sort,eax ;áâ ¢¨¬ ç¨á«® ®âá®àâ¨à®¢ ­­ëå ï祥ª à ¢­®¥ ç¨á«ã ¢á¥å áãé¥áâ¢ãîé¨å ï祥ª
894
	ret
892
	ret
895
endp
893
endp
896
 
894
 
897
;‘®àâ¨à®¢ª  ¢¥ªâ®à  a[1..n] ¬¥â®¤®¬ ”«®©¤ 
895
;‘®àâ¨à®¢ª  ¢¥ªâ®à  a[1..n] ¬¥â®¤®¬ ”«®©¤ 
898
;«¥¬¥­â a[0] ¢ á®àâ¨à®¢ª¥ ­¥ ãç áâ¢ã¥â
896
;«¥¬¥­â a[0] ¢ á®àâ¨à®¢ª¥ ­¥ ãç áâ¢ã¥â
899
align 4
897
align 4
900
proc pole_fl_sort uses eax ecx edx edi esi, a:dword, n:dword
898
proc pole_fl_sort uses eax ecx edx edi esi, a:dword, n:dword
901
	mov ecx,dword[a]
899
	mov ecx,dword[a]
902
	;”®à¬¨à®¢ âì ¨á室­®¥ ç áâ¨ç­® 㯮à冷祭­®¥ ¤¥à¥¢®
900
	;”®à¬¨à®¢ âì ¨á室­®¥ ç áâ¨ç­® 㯮à冷祭­®¥ ¤¥à¥¢®
903
	mov eax,dword[n]
901
	mov eax,dword[n]
904
	shr eax,1
902
	shr eax,1
905
	@@: ;for(i=n>>1; i>=2; i--)
903
	@@: ;for(i=n>>1; i>=2; i--)
906
		stdcall pole_fl_surface, ecx,eax,[n] ;(a,i,n)
904
		stdcall pole_fl_surface, ecx,eax,[n] ;(a,i,n)
907
		dec eax
905
		dec eax
908
		cmp eax,2
906
		cmp eax,2
909
		jge @b
907
		jge @b
910
	;‚믮«­¨âì ¯à®æ¥¤ãà㠢ᯫëâ¨ï ”«®©¤  ¤«ï ª ¦¤®£® ¯®¤¤¥à¥¢ 
908
	;‚믮«­¨âì ¯à®æ¥¤ãà㠢ᯫëâ¨ï ”«®©¤  ¤«ï ª ¦¤®£® ¯®¤¤¥à¥¢ 
911
	mov eax,dword[n]
909
	mov eax,dword[n]
912
	@@: ;for(i=n; i>=2; i--){
910
	@@: ;for(i=n; i>=2; i--){
913
		stdcall pole_fl_surface, ecx,1,eax ;(a,1,i)
911
		stdcall pole_fl_surface, ecx,1,eax ;(a,1,i)
914
		;®¬¥áâ¨âì ­ ©¤¥­­ë© ¬ ªá¨¬ «ì­ë© í«¥¬¥­â ¢ ª®­¥æ ᯨ᪠
912
		;®¬¥áâ¨âì ­ ©¤¥­­ë© ¬ ªá¨¬ «ì­ë© í«¥¬¥­â ¢ ª®­¥æ ᯨ᪠
915
		mov edi,eax
913
		mov edi,eax
916
		shl edi,2
914
		shl edi,2
917
		add edi,ecx ;edi -> &a[i]
915
		add edi,ecx ;edi -> &a[i]
918
		mov esi,dword[edi] ;w=a[i];
916
		mov esi,dword[edi] ;w=a[i];
919
		mov edx,dword[ecx+4]
917
		mov edx,dword[ecx+4]
920
		mov dword[edi],edx ;a[i]=a[1];
918
		mov dword[edi],edx ;a[i]=a[1];
921
		mov dword[ecx+4],esi ;a[1]=w;
919
		mov dword[ecx+4],esi ;a[1]=w;
922
 
920
 
923
		dec eax
921
		dec eax
924
		cmp eax,2
922
		cmp eax,2
925
		jge @b
923
		jge @b
926
	ret
924
	ret
927
endp
925
endp
928
 
926
 
929
;à®æ¥¤ãà  ¢á¯«ëâ¨ï ”«®©¤  ¯® ¤¥à¥¢ã a[1..k]
927
;à®æ¥¤ãà  ¢á¯«ëâ¨ï ”«®©¤  ¯® ¤¥à¥¢ã a[1..k]
930
align 4
928
align 4
931
proc pole_fl_surface, a:dword, i:dword, k:dword
929
proc pole_fl_surface, a:dword, i:dword, k:dword
932
locals
930
locals
933
	copy dd ?
931
	copy dd ?
934
endl
932
endl
935
	pushad
933
	pushad
936
	;edx -> ...
934
	;edx -> ...
937
	;edi -> m
935
	;edi -> m
938
	;esi -> j
936
	;esi -> j
939
	mov eax,dword[a]
937
	mov eax,dword[a]
940
	mov ebx,dword[i]
938
	mov ebx,dword[i]
941
	mov ecx,dword[k]
939
	mov ecx,dword[k]
942
 
940
 
943
	mov edx,ebx
941
	mov edx,ebx
944
	shl edx,2
942
	shl edx,2
945
	add edx,eax
943
	add edx,eax
946
	mov edx,dword[edx]
944
	mov edx,dword[edx]
947
	mov dword[copy],edx ;copy=a[i];
945
	mov dword[copy],edx ;copy=a[i];
948
	mov edi,ebx
946
	mov edi,ebx
949
	shl edi,1 ;m=i<<1;
947
	shl edi,1 ;m=i<<1;
950
	.cycle_b: ;while (m<=k) {
948
	.cycle_b: ;while (m<=k) {
951
		cmp edi,ecx
949
		cmp edi,ecx
952
		jg .cycle_e
950
		jg .cycle_e
953
		jne @f ;if (m==k) j=m;
951
		jne @f ;if (m==k) j=m;
954
			mov esi,edi
952
			mov esi,edi
955
			jmp .else_e
953
			jmp .else_e
956
		@@: ;else if (pole_compare_cells_bm(a[m],a[m+1])) j=m;
954
		@@: ;else if (pole_compare_cells_bm(a[m],a[m+1])) j=m;
957
		mov edx,edi
955
		mov edx,edi
958
		shl edx,2
956
		shl edx,2
959
		add edx,eax
957
		add edx,eax
960
		stdcall pole_compare_cells_bm, dword[edx],dword[edx+4]
958
		stdcall pole_compare_cells_bm, dword[edx],dword[edx+4]
961
		cmp dl,0
959
		cmp dl,0
962
		je @f
960
		je @f
963
			mov esi,edi
961
			mov esi,edi
964
			jmp .else_e
962
			jmp .else_e
965
		@@: ;else j=m+1;
963
		@@: ;else j=m+1;
966
			mov esi,edi
964
			mov esi,edi
967
			inc esi
965
			inc esi
968
		.else_e:
966
		.else_e:
969
 
967
 
970
		;if (pole_compare_cells_bm(a[j],copy)) {
968
		;if (pole_compare_cells_bm(a[j],copy)) {
971
		mov edx,esi
969
		mov edx,esi
972
		shl edx,2
970
		shl edx,2
973
		add edx,eax
971
		add edx,eax
974
		stdcall pole_compare_cells_bm, dword[edx],dword[copy]
972
		stdcall pole_compare_cells_bm, dword[edx],dword[copy]
975
		cmp dl,0
973
		cmp dl,0
976
		je .cycle_e ;} else break; //¢ë室 ¨§ 横« 
974
		je .cycle_e ;} else break; //¢ë室 ¨§ 横« 
977
 
975
 
978
		mov edx,esi
976
		mov edx,esi
979
		shl edx,2
977
		shl edx,2
980
		add edx,eax
978
		add edx,eax
981
		push dword[edx] ;push a[j];
979
		push dword[edx] ;push a[j];
982
		mov edx,ebx
980
		mov edx,ebx
983
		shl edx,2
981
		shl edx,2
984
		add edx,eax
982
		add edx,eax
985
		pop dword[edx] ;a[i]=a[j];
983
		pop dword[edx] ;a[i]=a[j];
986
		mov ebx,esi ;i=j;
984
		mov ebx,esi ;i=j;
987
		mov edi,ebx
985
		mov edi,ebx
988
		shl edi,1 ;m=i<<1;
986
		shl edi,1 ;m=i<<1;
989
 
987
 
990
		jmp .cycle_b
988
		jmp .cycle_b
991
	.cycle_e:
989
	.cycle_e:
992
 
990
 
993
	;§­ ç¥­¨ï ¬­®£¨å ॣ¨áâ஢ 㦥 ­¥ ¢ ¦­ë â. ª. ª®­¥æ ä㭪樨
991
	;§­ ç¥­¨ï ¬­®£¨å ॣ¨áâ஢ 㦥 ­¥ ¢ ¦­ë â. ª. ª®­¥æ ä㭪樨
994
	shl ebx,2
992
	shl ebx,2
995
	add eax,ebx
993
	add eax,ebx
996
	mov edx,dword[copy]
994
	mov edx,dword[copy]
997
	mov dword[eax],edx ;a[i]=copy;
995
	mov dword[eax],edx ;a[i]=copy;
998
 
996
 
999
	popad
997
	popad
1000
	ret
998
	ret
1001
endp
999
endp
1002
;--------------------------------------
1000
;--------------------------------------
1003
 
1001
 
1004
align 4
1002
align 4
1005
proc pole_draw_pok uses eax ebx ecx edx edi esi, pole:dword
1003
proc pole_draw_pok, pole:dword
-
 
1004
pushad
1006
	;mov edi,dword[pole]
1005
	;mov edi,dword[pole]
1007
 
-
 
1008
	mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
-
 
1009
	mov ebx,400*65536+5
1006
 
1010
	mov ecx,[sc.work_text]
1007
	mov ecx,[sc.work_text]
1011
	or  ecx,0x80000000 ;or (1 shl 30)
-
 
1012
	mov edx,txt_zoom
1008
	or  ecx,0x80000000 ;or (1 shl 30)
1013
	;mov edi,[sc.work]
1009
	;mov edi,[sc.work]
1014
	int 0x40
1010
	mcall SF_DRAW_TEXT,(400 shl 16)+5,,txt_zoom
1015
 
1011
 
1016
	add bx,9
1012
	add bx,9
1017
	mov edx,txt_osob
1013
	mov edx,txt_osob
1018
	int 0x40
1014
	int 0x40
1019
 
1015
 
1020
	add bx,9
1016
	add bx,9
1021
	mov edx,txt_info
1017
	mov edx,txt_info
1022
	int 0x40
1018
	int 0x40
1023
 
-
 
1024
	mov eax,47
1019
 
1025
	movzx ecx,byte[zoom]
-
 
1026
	mov ebx,(2 shl 16)
1020
	movzx ecx,byte[zoom]
1027
	mov edx,(400+6*9)*65536+5
1021
	mov edx,(400+6*9)*65536+5
1028
	mov esi,[sc.work_button_text]
1022
	mov esi,[sc.work_button_text]
1029
	or  esi,(1 shl 30)
1023
	or  esi,(1 shl 30)
1030
	mov edi,[sc.work_button]
1024
	mov edi,[sc.work_button]
1031
	int 0x40 ;¬ áèâ ¡
1025
	mcall SF_DRAW_NUMBER,(2 shl 16) ;¬ áèâ ¡
1032
 
1026
 
1033
	mov edi,dword[pole]
1027
	mov edi,dword[pole]
1034
	mov ecx,pole_index
1028
	mov ecx,pole_index
1035
	mov ecx,[ecx]
1029
	mov ecx,[ecx]
1036
	mov edi,[sc.work_button]
1030
	mov edi,[sc.work_button]
1037
	mov ebx,(5 shl 16)
-
 
1038
	add edx,(6*0)*65536+9
1031
	add edx,(6*0)*65536+9
1039
	int 0x40 ;ç¨á«® â®ç¥ª
1032
	mcall ,(5 shl 16) ;ç¨á«® â®ç¥ª
-
 
1033
popad
1040
	ret
1034
	ret
1041
endp
1035
endp
1042
 
1036
 
1043
align 4
1037
align 4
1044
but_zoom_p:
1038
but_zoom_p:
1045
	cmp byte[zoom],16
1039
	cmp byte[zoom],16
1046
	jge @f
1040
	jge @f
1047
		pushad
1041
		pushad
1048
		;¢ëç¨á«¥­¨¥ ᤢ¨£®¢ ¤«ï ¯®«ï, ª®â®àë¥ ®¡¥á¯¥ç â 業â஢ªã ¯®«ï ¯à¨ 㢥«¨ç¥­¨¨ ¬ áèâ ¡ 
1042
		;¢ëç¨á«¥­¨¥ ᤢ¨£®¢ ¤«ï ¯®«ï, ª®â®àë¥ ®¡¥á¯¥ç â 業â஢ªã ¯®«ï ¯à¨ 㢥«¨ç¥­¨¨ ¬ áèâ ¡ 
1049
		movzx ecx,byte[zoom]
1043
		movzx ecx,byte[zoom]
1050
		xor edx,edx
1044
		xor edx,edx
1051
		mov eax,dword[buf_0.w]
1045
		mov eax,dword[buf_0.w]
1052
		shr eax,1 ;¢ eax ¯®«®¢¨­  è¨à¨­ë ¯®«ï
1046
		shr eax,1 ;¢ eax ¯®«®¢¨­  è¨à¨­ë ¯®«ï
1053
		mov ebx,eax ;¤¥« ¥¬ १¥à¢­ãî ª®¯¨î eax
1047
		mov ebx,eax ;¤¥« ¥¬ १¥à¢­ãî ª®¯¨î eax
1054
		div ecx ;¤¥«¨¬ eax ­  ⥪ã騩 ¬ áèâ ¡
1048
		div ecx ;¤¥«¨¬ eax ­  ⥪ã騩 ¬ áèâ ¡
1055
		xchg eax,ebx
1049
		xchg eax,ebx
1056
		xor edx,edx
1050
		xor edx,edx
1057
		inc ecx
1051
		inc ecx
1058
		div ecx ;¤¥«¨¬ eax ­  ­®¢ë© ¬ áèâ ¡
1052
		div ecx ;¤¥«¨¬ eax ­  ­®¢ë© ¬ áèâ ¡
1059
		sub ebx,eax ;¢ëç¨á«ï¥âáï ᤢ¨£ ¯®«ï ª®â®àë© ®¡¥á¯¥ç¨â 業â஢ªã ¯®«ï
1053
		sub ebx,eax ;¢ëç¨á«ï¥âáï ᤢ¨£ ¯®«ï ª®â®àë© ®¡¥á¯¥ç¨â 業â஢ªã ¯®«ï
1060
		sub dword[Cor_x],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ x
1054
		sub dword[Cor_x],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ x
1061
		xor ecx,ecx
1055
		xor ecx,ecx
1062
		mov cl,byte[zoom]
1056
		mov cl,byte[zoom]
1063
		xor edx,edx
1057
		xor edx,edx
1064
		mov eax,dword[buf_0.h]
1058
		mov eax,dword[buf_0.h]
1065
		shr eax,1
1059
		shr eax,1
1066
		mov ebx,eax
1060
		mov ebx,eax
1067
		div ecx
1061
		div ecx
1068
		xchg eax,ebx
1062
		xchg eax,ebx
1069
		xor edx,edx
1063
		xor edx,edx
1070
		inc ecx
1064
		inc ecx
1071
		div ecx
1065
		div ecx
1072
		sub ebx,eax
1066
		sub ebx,eax
1073
		sub dword[Cor_y],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ y
1067
		sub dword[Cor_y],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ y
1074
 
1068
 
1075
		inc byte[zoom]
1069
		inc byte[zoom]
1076
		stdcall pole_draw_pok, pole
1070
		stdcall pole_draw_pok, pole
1077
		popad
1071
		popad
1078
 
1072
 
1079
		.buf_clear:
1073
		.buf_clear:
1080
			call redraw_pole
1074
			call redraw_pole
1081
	@@:
1075
	@@:
1082
	ret
1076
	ret
1083
 
1077
 
1084
align 4
1078
align 4
1085
but_zoom_m:
1079
but_zoom_m:
1086
	cmp byte[zoom],1
1080
	cmp byte[zoom],1
1087
	jle @f
1081
	jle @f
1088
		pushad
1082
		pushad
1089
		;¢ëç¨á«¥­¨¥ ᤢ¨£®¢ ¤«ï ¯®«ï, ª®â®àë¥ ®¡¥á¯¥ç â 業â஢ªã ¯®«ï ¯à¨ 㬥­ì襭¨¨ ¬ áèâ ¡ 
1083
		;¢ëç¨á«¥­¨¥ ᤢ¨£®¢ ¤«ï ¯®«ï, ª®â®àë¥ ®¡¥á¯¥ç â 業â஢ªã ¯®«ï ¯à¨ 㬥­ì襭¨¨ ¬ áèâ ¡ 
1090
		movzx ecx,byte[zoom]
1084
		movzx ecx,byte[zoom]
1091
		xor edx,edx
1085
		xor edx,edx
1092
		mov eax,dword[buf_0.w]
1086
		mov eax,dword[buf_0.w]
1093
		shr eax,1 ;¢ eax ¯®«®¢¨­  è¨à¨­ë ¯®«ï
1087
		shr eax,1 ;¢ eax ¯®«®¢¨­  è¨à¨­ë ¯®«ï
1094
		mov ebx,eax ;¤¥« ¥¬ १¥à¢­ãî ª®¯¨î eax
1088
		mov ebx,eax ;¤¥« ¥¬ १¥à¢­ãî ª®¯¨î eax
1095
		div ecx ;¤¥«¨¬ eax ­  ⥪ã騩 ¬ áèâ ¡
1089
		div ecx ;¤¥«¨¬ eax ­  ⥪ã騩 ¬ áèâ ¡
1096
		xchg eax,ebx
1090
		xchg eax,ebx
1097
		xor edx,edx
1091
		xor edx,edx
1098
		dec ecx
1092
		dec ecx
1099
		div ecx ;¤¥«¨¬ eax ­  ­®¢ë© ¬ áèâ ¡
1093
		div ecx ;¤¥«¨¬ eax ­  ­®¢ë© ¬ áèâ ¡
1100
		sub ebx,eax ;¢ëç¨á«ï¥âáï ᤢ¨£ ¯®«ï ª®â®àë© ®¡¥á¯¥ç¨â 業â஢ªã ¯®«ï
1094
		sub ebx,eax ;¢ëç¨á«ï¥âáï ᤢ¨£ ¯®«ï ª®â®àë© ®¡¥á¯¥ç¨â 業â஢ªã ¯®«ï
1101
		sub dword[Cor_x],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ x
1095
		sub dword[Cor_x],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ x
1102
		xor ecx,ecx
1096
		xor ecx,ecx
1103
		mov cl,byte[zoom]
1097
		mov cl,byte[zoom]
1104
		xor edx,edx
1098
		xor edx,edx
1105
		mov eax,dword[buf_0.h]
1099
		mov eax,dword[buf_0.h]
1106
		shr eax,1
1100
		shr eax,1
1107
		mov ebx,eax
1101
		mov ebx,eax
1108
		div ecx
1102
		div ecx
1109
		xchg eax,ebx
1103
		xchg eax,ebx
1110
		xor edx,edx
1104
		xor edx,edx
1111
		dec ecx
1105
		dec ecx
1112
		div ecx
1106
		div ecx
1113
		sub ebx,eax
1107
		sub ebx,eax
1114
		sub dword[Cor_y],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ y
1108
		sub dword[Cor_y],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ y
1115
 
1109
 
1116
		dec byte[zoom]
1110
		dec byte[zoom]
1117
		stdcall pole_draw_pok, pole
1111
		stdcall pole_draw_pok, pole
1118
		popad
1112
		popad
1119
 
1113
 
1120
		.buf_clear:
1114
		.buf_clear:
1121
			call redraw_pole
1115
			call redraw_pole
1122
	@@:
1116
	@@:
1123
	ret
1117
	ret
1124
 
1118
 
1125
;業â஢ª  áå¥¬ë ¯® 業âàã íªà ­ 
1119
;業â஢ª  áå¥¬ë ¯® 業âàã íªà ­ 
1126
align 4
1120
align 4
1127
proc but_center uses eax ebx ecx edx
1121
proc but_center uses eax ebx ecx edx
1128
	movzx ecx,byte[zoom]
1122
	movzx ecx,byte[zoom]
1129
	cmp ecx,1
1123
	cmp ecx,1
1130
	jle .end_m_1
1124
	jle .end_m_1
1131
		mov eax,[buf_0.w]
1125
		mov eax,[buf_0.w]
1132
		mov ebx,[shem_w]
1126
		mov ebx,[shem_w]
1133
		imul ebx,ecx
1127
		imul ebx,ecx
1134
 
1128
 
1135
		sub eax,ebx
1129
		sub eax,ebx
1136
		xor edx,edx
1130
		xor edx,edx
1137
		shl ecx,1
1131
		shl ecx,1
1138
		cmp eax,0
1132
		cmp eax,0
1139
		jge @f
1133
		jge @f
1140
			neg eax
1134
			neg eax
1141
			inc eax
1135
			inc eax
1142
			div ecx
1136
			div ecx
1143
			neg eax
1137
			neg eax
1144
			inc eax
1138
			inc eax
1145
			jmp .set_x
1139
			jmp .set_x
1146
		@@:
1140
		@@:
1147
			div ecx
1141
			div ecx
1148
		.set_x:
1142
		.set_x:
1149
		mov [Cor_x],eax
1143
		mov [Cor_x],eax
1150
		mov eax,[buf_0.h]
1144
		mov eax,[buf_0.h]
1151
		mov ebx,[shem_h]
1145
		mov ebx,[shem_h]
1152
		shr ecx,1
1146
		shr ecx,1
1153
		imul ebx,ecx
1147
		imul ebx,ecx
1154
		sub eax,ebx
1148
		sub eax,ebx
1155
		xor edx,edx
1149
		xor edx,edx
1156
		shl ecx,1
1150
		shl ecx,1
1157
		cmp eax,0
1151
		cmp eax,0
1158
		jge @f
1152
		jge @f
1159
			neg eax
1153
			neg eax
1160
			inc eax
1154
			inc eax
1161
			div ecx
1155
			div ecx
1162
			neg eax
1156
			neg eax
1163
			inc eax
1157
			inc eax
1164
			jmp .set_y
1158
			jmp .set_y
1165
		@@:
1159
		@@:
1166
			div ecx
1160
			div ecx
1167
		.set_y:
1161
		.set_y:
1168
		mov [Cor_y],eax
1162
		mov [Cor_y],eax
1169
		jmp .end_m_n
1163
		jmp .end_m_n
1170
	.end_m_1:
1164
	.end_m_1:
1171
		mov eax,[buf_0.w]
1165
		mov eax,[buf_0.w]
1172
		sub eax,[shem_w]
1166
		sub eax,[shem_w]
1173
		shr eax,1
1167
		shr eax,1
1174
		bt eax,30
1168
		bt eax,30
1175
		jnc @f
1169
		jnc @f
1176
			bts eax,31
1170
			bts eax,31
1177
		@@:
1171
		@@:
1178
		mov [Cor_x],eax
1172
		mov [Cor_x],eax
1179
		mov eax,[buf_0.h]
1173
		mov eax,[buf_0.h]
1180
		sub eax,[shem_h]
1174
		sub eax,[shem_h]
1181
		shr eax,1
1175
		shr eax,1
1182
		bt eax,30
1176
		bt eax,30
1183
		jnc @f
1177
		jnc @f
1184
			bts eax,31
1178
			bts eax,31
1185
		@@:
1179
		@@:
1186
		mov [Cor_y],eax
1180
		mov [Cor_y],eax
1187
	.end_m_n:
1181
	.end_m_n:
1188
	call redraw_pole
1182
	call redraw_pole
1189
	ret
1183
	ret
1190
endp
1184
endp
1191
 
1185
 
1192
align 4
1186
align 4
1193
but_pole_up:
1187
but_pole_up:
1194
	push eax ecx edx
1188
	push eax ecx edx
1195
	mov eax,dword[buf_0.h]
1189
	mov eax,dword[buf_0.h]
1196
	shr eax,2
1190
	shr eax,2
1197
	movzx ecx,byte[zoom]
1191
	movzx ecx,byte[zoom]
1198
	cmp cx,2
1192
	cmp cx,2
1199
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1193
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1200
		xor edx,edx
1194
		xor edx,edx
1201
		div ecx
1195
		div ecx
1202
	@@:
1196
	@@:
1203
	add dword[Cor_y],eax
1197
	add dword[Cor_y],eax
1204
	pop edx ecx eax
1198
	pop edx ecx eax
1205
	call redraw_pole
1199
	call redraw_pole
1206
	ret
1200
	ret
1207
 
1201
 
1208
align 4
1202
align 4
1209
but_pole_dn:
1203
but_pole_dn:
1210
	push eax ecx edx
1204
	push eax ecx edx
1211
	mov eax,dword[buf_0.h]
1205
	mov eax,dword[buf_0.h]
1212
	shr eax,2
1206
	shr eax,2
1213
	xor ecx,ecx
1207
	xor ecx,ecx
1214
	mov cl,byte[zoom]
1208
	mov cl,byte[zoom]
1215
	cmp cx,2
1209
	cmp cx,2
1216
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1210
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1217
		xor edx,edx
1211
		xor edx,edx
1218
		div ecx
1212
		div ecx
1219
	@@:
1213
	@@:
1220
	sub dword[Cor_y],eax
1214
	sub dword[Cor_y],eax
1221
	pop edx ecx eax
1215
	pop edx ecx eax
1222
	call redraw_pole
1216
	call redraw_pole
1223
	ret
1217
	ret
1224
 
1218
 
1225
align 4
1219
align 4
1226
but_pole_left:
1220
but_pole_left:
1227
	push eax ecx edx
1221
	push eax ecx edx
1228
	mov eax,dword[buf_0.w]
1222
	mov eax,dword[buf_0.w]
1229
	shr eax,2
1223
	shr eax,2
1230
	xor ecx,ecx
1224
	xor ecx,ecx
1231
	mov cl,byte[zoom]
1225
	mov cl,byte[zoom]
1232
	cmp cx,2
1226
	cmp cx,2
1233
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1227
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1234
		xor edx,edx
1228
		xor edx,edx
1235
		div ecx
1229
		div ecx
1236
	@@:
1230
	@@:
1237
	add dword[Cor_x],eax
1231
	add dword[Cor_x],eax
1238
	pop edx ecx eax
1232
	pop edx ecx eax
1239
	call redraw_pole
1233
	call redraw_pole
1240
	ret
1234
	ret
1241
 
1235
 
1242
align 4
1236
align 4
1243
but_pole_right:
1237
but_pole_right:
1244
	push eax ecx edx
1238
	push eax ecx edx
1245
	mov eax,dword[buf_0.w]
1239
	mov eax,dword[buf_0.w]
1246
	shr eax,2
1240
	shr eax,2
1247
	xor ecx,ecx
1241
	xor ecx,ecx
1248
	mov cl,byte[zoom]
1242
	mov cl,byte[zoom]
1249
	cmp cx,2
1243
	cmp cx,2
1250
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1244
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1251
		xor edx,edx
1245
		xor edx,edx
1252
		div ecx
1246
		div ecx
1253
	@@:
1247
	@@:
1254
	sub dword[Cor_x],eax
1248
	sub dword[Cor_x],eax
1255
	pop edx ecx eax
1249
	pop edx ecx eax
1256
	call redraw_pole
1250
	call redraw_pole
1257
	ret
1251
	ret
1258
 
1252
 
1259
;output:
1253
;output:
1260
; edx - count created points
1254
; edx - count created points
1261
align 4
1255
align 4
1262
proc shem_create_line uses eax ebx ecx edi, x:dword, y:dword, opt:dword
1256
proc shem_create_line uses eax ebx ecx edi, x:dword, y:dword, opt:dword
1263
	mov edi,pole
1257
	mov edi,pole
1264
	xor edx,edx
1258
	xor edx,edx
1265
 
1259
 
1266
	mov ebx,[x]
1260
	mov ebx,[x]
1267
	mov ecx,[y]
1261
	mov ecx,[y]
1268
	bt dword[opt],0
1262
	bt dword[opt],0
1269
	jnc @f
1263
	jnc @f
1270
	.line_lr:
1264
	.line_lr:
1271
		inc ebx
1265
		inc ebx
1272
		cmp ebx,[shem_w]
1266
		cmp ebx,[shem_w]
1273
		jge @f
1267
		jge @f
1274
		stdcall pole_cell_find, pole,ebx,ecx
1268
		stdcall pole_cell_find, pole,ebx,ecx
1275
		cmp eax,0
1269
		cmp eax,0
1276
		je .u0
1270
		je .u0
1277
			imul eax,sizeof.Cell
1271
			imul eax,sizeof.Cell
1278
			add eax,pole_data
1272
			add eax,pole_data
1279
			cmp byte[eax+offs_cell_liv],1
1273
			cmp byte[eax+offs_cell_liv],1
1280
			jne @f
1274
			jne @f
1281
		.u0:
1275
		.u0:
1282
		stdcall pole_cell_creat, pole,ebx,ecx,1
1276
		stdcall pole_cell_creat, pole,ebx,ecx,1
1283
		inc edx
1277
		inc edx
1284
		jmp .line_lr
1278
		jmp .line_lr
1285
	@@:
1279
	@@:
1286
 
1280
 
1287
	mov ebx,[x]
1281
	mov ebx,[x]
1288
	;mov ecx,[y]
1282
	;mov ecx,[y]
1289
	bt dword[opt],2
1283
	bt dword[opt],2
1290
	jnc @f
1284
	jnc @f
1291
	.line_rl:
1285
	.line_rl:
1292
		dec ebx
1286
		dec ebx
1293
		cmp ebx,0
1287
		cmp ebx,0
1294
		jl @f
1288
		jl @f
1295
		stdcall pole_cell_find, pole,ebx,ecx
1289
		stdcall pole_cell_find, pole,ebx,ecx
1296
		cmp eax,0
1290
		cmp eax,0
1297
		je .u1
1291
		je .u1
1298
			imul eax,sizeof.Cell
1292
			imul eax,sizeof.Cell
1299
			add eax,pole_data
1293
			add eax,pole_data
1300
			cmp byte[eax+offs_cell_liv],1
1294
			cmp byte[eax+offs_cell_liv],1
1301
			jne @f
1295
			jne @f
1302
		.u1:
1296
		.u1:
1303
		stdcall pole_cell_creat, pole,ebx,ecx,1
1297
		stdcall pole_cell_creat, pole,ebx,ecx,1
1304
		inc edx
1298
		inc edx
1305
		jmp .line_rl
1299
		jmp .line_rl
1306
	@@:
1300
	@@:
1307
 
1301
 
1308
	mov ebx,[x]
1302
	mov ebx,[x]
1309
	mov ecx,[y]
1303
	mov ecx,[y]
1310
	bt dword[opt],3
1304
	bt dword[opt],3
1311
	jnc @f
1305
	jnc @f
1312
	.line_du:
1306
	.line_du:
1313
		dec ecx
1307
		dec ecx
1314
		cmp ecx,0
1308
		cmp ecx,0
1315
		jl @f
1309
		jl @f
1316
		stdcall pole_cell_find, pole,ebx,ecx
1310
		stdcall pole_cell_find, pole,ebx,ecx
1317
		cmp eax,0
1311
		cmp eax,0
1318
		je .u2
1312
		je .u2
1319
			imul eax,sizeof.Cell
1313
			imul eax,sizeof.Cell
1320
			add eax,pole_data
1314
			add eax,pole_data
1321
			cmp byte[eax+offs_cell_liv],1
1315
			cmp byte[eax+offs_cell_liv],1
1322
			jne @f
1316
			jne @f
1323
		.u2:
1317
		.u2:
1324
		stdcall pole_cell_creat, pole,ebx,ecx,1
1318
		stdcall pole_cell_creat, pole,ebx,ecx,1
1325
		inc edx
1319
		inc edx
1326
		jmp .line_du
1320
		jmp .line_du
1327
	@@:
1321
	@@:
1328
 
1322
 
1329
	;mov ebx,[x]
1323
	;mov ebx,[x]
1330
	mov ecx,[y]
1324
	mov ecx,[y]
1331
	bt dword[opt],1
1325
	bt dword[opt],1
1332
	jnc @f
1326
	jnc @f
1333
	.line_ud:
1327
	.line_ud:
1334
		inc ecx
1328
		inc ecx
1335
		cmp ecx,[shem_h]
1329
		cmp ecx,[shem_h]
1336
		jge @f
1330
		jge @f
1337
		stdcall pole_cell_find, pole,ebx,ecx
1331
		stdcall pole_cell_find, pole,ebx,ecx
1338
		cmp eax,0
1332
		cmp eax,0
1339
		je .u3
1333
		je .u3
1340
			imul eax,sizeof.Cell
1334
			imul eax,sizeof.Cell
1341
			add eax,pole_data
1335
			add eax,pole_data
1342
			cmp byte[eax+offs_cell_liv],1
1336
			cmp byte[eax+offs_cell_liv],1
1343
			jne @f
1337
			jne @f
1344
		.u3:
1338
		.u3:
1345
		stdcall pole_cell_creat, pole,ebx,ecx,1
1339
		stdcall pole_cell_creat, pole,ebx,ecx,1
1346
		inc edx
1340
		inc edx
1347
		jmp .line_ud
1341
		jmp .line_ud
1348
	@@:
1342
	@@:
1349
 
1343
 
1350
	ret
1344
	ret
1351
endp
1345
endp
1352
 
1346
 
1353
align 4
1347
align 4
1354
redraw_pole:
1348
redraw_pole:
1355
	stdcall [buf2d_clear], buf_0, [buf_0.color]
1349
	stdcall [buf2d_clear], buf_0, [buf_0.color]
1356
	stdcall pole_paint, pole
1350
	stdcall pole_paint, pole
1357
	stdcall [buf2d_draw], buf_0
1351
	stdcall [buf2d_draw], buf_0
1358
	ret
1352
	ret
1359
 
1353
 
1360
>
1354
>
1361
 
1355
 
1362
>
1356
>
1363
>
1357
>
1364
>
1358
>
1365
>
1359
>
1366
>
1360
>
1367
>
1361
>
1368
>
1362
>
1369
>
1363
>
1370
>
1364
>
1371
>
1365
>