Subversion Repositories Kolibri OS

Rev

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

Rev 2501 Rev 5092
1
use32
1
use32
2
	org 0x0
2
	org 0x0
3
	db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
3
	db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
4
	dd 0x1
4
	dd 0x1
5
	dd start
5
	dd start
6
	dd i_end ;à §¬¥à ¯à¨«®¦¥­¨ï
6
	dd i_end ;à §¬¥à ¯à¨«®¦¥­¨ï
7
	dd mem
7
	dd mem
8
	dd stacktop
8
	dd stacktop
9
	dd 0
9
	dd 0
10
	dd sys_path
10
	dd sys_path
11
 
11
 
12
include '../../../macros.inc'
12
include '../../../macros.inc'
13
include '../../../proc32.inc'
13
include '../../../proc32.inc'
14
include '../../../develop/libraries/box_lib/load_lib.mac'
14
include '../../../develop/libraries/box_lib/load_lib.mac'
15
include '../../nu_pogodi/trunk/mem.inc'
-
 
16
include '../../nu_pogodi/trunk/dll.inc'
15
include '../../../dll.inc'
17
 
16
 
18
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
17
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
19
hed db 'Life 23.03.12',0 ;¯®¤¯¨áì ®ª­ 
18
hed db 'Life 05.09.14',0 ;¯®¤¯¨áì ®ª­ 
20
 
19
 
21
struct FileInfoBlock
20
struct FileInfoBlock
22
	Function dd ?
21
	Function dd ?
23
	Position dd ?
22
	Position dd ?
24
	Flags	 dd ?
23
	Flags	 dd ?
25
	Count	 dd ?
24
	Count	 dd ?
26
	Buffer	 dd ?
25
	Buffer	 dd ?
27
		db ?
26
		db ?
28
	FileName dd ?
27
	FileName dd ?
29
ends
28
ends
30
 
29
 
31
run_file_70 FileInfoBlock
30
run_file_70 FileInfoBlock
32
image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
31
image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
33
 
32
 
34
fn_toolbar db 'toolbar.png',0
33
fn_toolbar db 'toolbar.png',0
35
IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
34
IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
36
IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*9
35
IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*9
37
image_data_toolbar dd 0
36
image_data_toolbar dd 0
38
 
37
 
39
macro load_image_file path,buf,size { ;¬ ªà®á ¤«ï § £à㧪¨ ¨§®¡à ¦¥­¨©
38
macro load_image_file path,buf,size { ;¬ ªà®á ¤«ï § £à㧪¨ ¨§®¡à ¦¥­¨©
40
	;path - ¬®¦¥â ¡ëâì ¯¥à¥¬¥­­®© ¨«¨ áâப®¢ë¬ ¯ à ¬¥â஬
39
	;path - ¬®¦¥â ¡ëâì ¯¥à¥¬¥­­®© ¨«¨ áâப®¢ë¬ ¯ à ¬¥â஬
41
	if path eqtype '' ;¯à®¢¥à塞 § ¤ ­ «¨ áâப®© ¯ à ¬¥âà path
40
	if path eqtype '' ;¯à®¢¥à塞 § ¤ ­ «¨ áâப®© ¯ à ¬¥âà path
42
		jmp @f
41
		jmp @f
43
			local .path_str
42
			local .path_str
44
			.path_str db path ;ä®à¬¨à㥬 «®ª «ì­ãî ¯¥à¥¬¥­­ãî
43
			.path_str db path ;ä®à¬¨à㥬 «®ª «ì­ãî ¯¥à¥¬¥­­ãî
45
			db 0
44
			db 0
46
		@@:
45
		@@:
47
		;32 - áâ ­¤ àâ­ë©  ¤à¥á ¯® ª®â®à®¬ã ¤®«¦¥­ ¡ëâì ¡ãä¥à á á¨á⥬­ë¬ ¯ã⥬
46
		;32 - áâ ­¤ àâ­ë©  ¤à¥á ¯® ª®â®à®¬ã ¤®«¦¥­ ¡ëâì ¡ãä¥à á á¨á⥬­ë¬ ¯ã⥬
48
		copy_path .path_str,[32],file_name,0x0
47
		copy_path .path_str,[32],file_name,0x0
49
	else
48
	else
50
		copy_path path,[32],file_name,0x0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
49
		copy_path path,[32],file_name,0x0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
51
	end if
50
	end if
52
 
51
 
53
	stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
52
	stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
54
	mov [buf],eax
53
	mov [buf],eax
55
 
54
 
56
	mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
55
	mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
57
	mov [run_file_70.Function], 0
56
	mov [run_file_70.Function], 0
58
	mov [run_file_70.Position], 0
57
	mov [run_file_70.Position], 0
59
	mov [run_file_70.Flags], 0
58
	mov [run_file_70.Flags], 0
60
	mov [run_file_70.Count], dword size
59
	mov [run_file_70.Count], dword size
61
	m2m [run_file_70.Buffer], [buf]
60
	m2m [run_file_70.Buffer], [buf]
62
	mov byte[run_file_70+20], 0
61
	mov byte[run_file_70+20], 0
63
	mov [run_file_70.FileName], file_name
62
	mov [run_file_70.FileName], file_name
64
	mov ebx,run_file_70
63
	mov ebx,run_file_70
65
	int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
64
	int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
66
	cmp ebx,0xffffffff
65
	cmp ebx,0xffffffff
67
	je @f
66
	je @f
68
		;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥­­ë© ¡ãä¥à image_data
67
		;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥­­ë© ¡ãä¥à image_data
69
		stdcall dword[img_decode], dword[buf],ebx,0
68
		stdcall dword[img_decode], dword[buf],ebx,0
70
		mov dword[image_data],eax
69
		mov dword[image_data],eax
71
		;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥­¨¥ ª ä®à¬ âã rgb
70
		;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥­¨¥ ª ä®à¬ âã rgb
72
		stdcall dword[img_to_rgb2], dword[image_data],dword[buf]
71
		stdcall dword[img_to_rgb2], dword[image_data],dword[buf]
73
		;㤠«ï¥¬ ¢à¥¬¥­­ë© ¡ãä¥à image_data
72
		;㤠«ï¥¬ ¢à¥¬¥­­ë© ¡ãä¥à image_data
74
		stdcall dword[img_destroy], dword[image_data]
73
		stdcall dword[img_destroy], dword[image_data]
75
	@@:
74
	@@:
76
}
75
}
77
 
76
 
78
;--------------------------------------
77
;--------------------------------------
79
struct Cell
78
struct Cell
80
	x dd ? ;+0
79
	x dd ? ;+0
81
	y dd ? ;+4
80
	y dd ? ;+4
82
	tc dd ? ;+8
81
	tc dd ? ;+8
83
	liv db ? ;+12
82
	liv db ? ;+12
84
	so db ? ;+13
83
	so db ? ;+13
85
ends
84
ends
86
 
85
 
87
MAX_CELL equ 90000
86
MAX_CELL equ 90000
88
COL_MEM equ 64 ;ç¨á«® 梥⮢
87
COL_MEM equ 64 ;ç¨á«® 梥⮢
89
 
88
 
90
cell dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì á® áâàãªâãà ¬¨ ï祥ª
89
cell dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì á® áâàãªâãà ¬¨ ï祥ª
91
memCell dd 0
90
memCell dd 0
92
CellColors dd 0
91
CellColors dd 0
93
 
92
 
94
macro get_cell_offset reg,ind
93
macro get_cell_offset reg,ind
95
{
94
{
96
	mov reg,ind
95
	mov reg,ind
97
	imul reg,sizeof.Cell
96
	imul reg,sizeof.Cell
98
	add reg,dword[cell]
97
	add reg,dword[cell]
99
}
98
}
100
 
99
 
101
capt rb 50
100
capt rb 50
102
er_oom db 0 ;­  á«ãç © ¨áç¥à¯ ­¨ï ¯ ¬ïâ¨
101
er_oom db 0 ;­  á«ãç © ¨áç¥à¯ ­¨ï ¯ ¬ïâ¨
103
tim_ch db 0 ; ¢â®¬ â¨ç¥áª¨ ¯à®áç¨â뢠âì ¯®ª®«¥­¨ï
102
tim_ch db 0 ; ¢â®¬ â¨ç¥áª¨ ¯à®áç¨â뢠âì ¯®ª®«¥­¨ï
104
poc_stop dd 1 ;¯à®áç¥â ­  ç¨á«® ¯®ª®«¥­¨©
103
poc_stop dd 1 ;¯à®áç¥â ­  ç¨á«® ¯®ª®«¥­¨©
105
Cor_x dd 0
104
Cor_x dd 0
106
Cor_y dd 0
105
Cor_y dd 0
107
tim dd 0 ;¢à¥¬ï (¯®ª®«¥­¨¥)
106
tim dd 0 ;¢à¥¬ï (¯®ª®«¥­¨¥)
108
b_sort dd 0 ;£à ­¨æ  ¤«ï á®àâ¨à®¢ ­­ëå ï祥ª
107
b_sort dd 0 ;£à ­¨æ  ¤«ï á®àâ¨à®¢ ­­ëå ï祥ª
109
osob dd 0 ;ç¨á«® ®á®¡¥©
108
osob dd 0 ;ç¨á«® ®á®¡¥©
110
zoom db 3 ;¬ áèâ ¡ ¯®«ï
109
zoom db 3 ;¬ áèâ ¡ ¯®«ï
111
txt_zoom db 'Œ áèâ ¡:',0
110
txt_zoom db 'Œ áèâ ¡:',0
112
txt_gen db '®ª®«¥­¨¥:',0
111
txt_gen db '®ª®«¥­¨¥:',0
113
txt_osob db 'Žá®¡¥©:',0
112
txt_osob db 'Žá®¡¥©:',0
114
 
113
 
115
;­ áâனª  ¬ áᨢ  á 梥⠬¨
114
;­ áâனª  ¬ áᨢ  á 梥⠬¨
116
; col_pole - 梥⠯®«ï
115
; col_pole - 梥⠯®«ï
117
; col_cell_n - 梥⠭®¢®© ï祩ª¨
116
; col_cell_n - 梥⠭®¢®© ï祩ª¨
118
; col_cell_o - 梥â áâ à®© ï祩ª¨
117
; col_cell_o - 梥â áâ à®© ï祩ª¨
119
align 4
118
align 4
120
proc pole_init_colors uses eax ebx ecx edx esi edi, col_pole:dword, col_cell_n:dword, col_cell_o:dword
119
proc pole_init_colors uses eax ebx ecx edx esi edi, col_pole:dword, col_cell_n:dword, col_cell_o:dword
121
	mov esi,dword[CellColors]
120
	mov esi,dword[CellColors]
122
	mov ebx,dword[col_pole]
121
	mov ebx,dword[col_pole]
123
	mov dword[esi],ebx
122
	mov dword[esi],ebx
124
 
123
 
125
	add esi,4
124
	add esi,4
126
	mov edi,COL_MEM
125
	mov edi,COL_MEM
127
	dec edi
126
	dec edi
128
	shl edi,2
127
	shl edi,2
129
	add edi,esi
128
	add edi,esi
130
	; esi - 㪠§ â¥«ì ­  1-© £à ¤¨¥­â­ë© 梥â
129
	; esi - 㪠§ â¥«ì ­  1-© £à ¤¨¥­â­ë© 梥â
131
	; edi - 㪠§ â¥«ì ­  ¯®á«¥¤­¨© £à ¤¨¥­â­ë© 梥â
130
	; edi - 㪠§ â¥«ì ­  ¯®á«¥¤­¨© £à ¤¨¥­â­ë© 梥â
132
	mov eax,dword[col_cell_n]
131
	mov eax,dword[col_cell_n]
133
	mov ebx,dword[col_cell_o]
132
	mov ebx,dword[col_cell_o]
134
 
133
 
135
	mov dword[esi],eax
134
	mov dword[esi],eax
136
	mov dword[edi],ebx
135
	mov dword[edi],ebx
137
	;need save ecx edx
136
	;need save ecx edx
138
	stdcall middle_colors, esi,edi
137
	stdcall middle_colors, esi,edi
139
 
138
 
140
	ret
139
	ret
141
endp
140
endp
142
 
141
 
143
;¢á¯®¬®£ â¥«ì­ ï äã­ªæ¨ï ¤«ï ­ å®¤¦¥­¨ï á।­¥£® æ¢¥â  ¨ § ¯¨á¨ ¥£® ¢ ¬ áᨢ
142
;¢á¯®¬®£ â¥«ì­ ï äã­ªæ¨ï ¤«ï ­ å®¤¦¥­¨ï á।­¥£® æ¢¥â  ¨ § ¯¨á¨ ¥£® ¢ ¬ áᨢ
144
;input:
143
;input:
145
; eax - 梥⠭ ç «ì­ë©
144
; eax - 梥⠭ ç «ì­ë©
146
; ebx - 梥⠪®­¥ç­ë©
145
; ebx - 梥⠪®­¥ç­ë©
147
;§ §àãè îâìáï: ecx, edx
146
;§ §àãè îâìáï: ecx, edx
148
align 4
147
align 4
149
proc middle_colors uses edi esi, i0:dword, i1:dword
148
proc middle_colors uses edi esi, i0:dword, i1:dword
150
	mov esi,dword[i0]
149
	mov esi,dword[i0]
151
	mov edi,dword[i1]
150
	mov edi,dword[i1]
152
	;¯¥à¥¤ ¢ë§®¢®¬ ä㭪樨
151
	;¯¥à¥¤ ¢ë§®¢®¬ ä㭪樨
153
	;dword[esi]=eax
152
	;dword[esi]=eax
154
	;dword[edi]=ebx
153
	;dword[edi]=ebx
155
	sub edi,esi
154
	sub edi,esi
156
	shr edi,1
155
	shr edi,1
157
	btr edi,1 ;®ªà㣫塞 ¤® 4-å, â. ª. ­ã¦­® ¯®«ãç¨âì  ¤à¥á (®ªà㣫¥­¨¥ å¨â஥ - 㡨ࠥ¬ ®¤¨­ ¡¨â ¢¬¥áâ® ¯à¥¤¯®« £ ¥¬ëå 2-å)
156
	btr edi,1 ;®ªà㣫塞 ¤® 4-å, â. ª. ­ã¦­® ¯®«ãç¨âì  ¤à¥á (®ªà㣫¥­¨¥ å¨â஥ - 㡨ࠥ¬ ®¤¨­ ¡¨â ¢¬¥áâ® ¯à¥¤¯®« £ ¥¬ëå 2-å)
158
	add edi,esi
157
	add edi,esi
159
	cmp edi,esi
158
	cmp edi,esi
160
	je @f
159
	je @f
161
		push eax ebx
160
		push eax ebx
162
 
161
 
163
		mov ecx,eax
162
		mov ecx,eax
164
		mov edx,ebx
163
		mov edx,ebx
165
 
164
 
166
		;­ å®¤¨¬ á।­¨© 梥⠬¥¦¤ã eax ¨ ebx
165
		;­ å®¤¨¬ á।­¨© 梥⠬¥¦¤ã eax ¨ ebx
167
		and ebx,111111101111111011111110b ;㡨ࠥ¬ ¯®á«¥¤­¨¥ ¡¨âë ¢ 梥â å r, g, b
166
		and ebx,111111101111111011111110b ;㡨ࠥ¬ ¯®á«¥¤­¨¥ ¡¨âë ¢ 梥â å r, g, b
168
		and eax,111111101111111011111110b
167
		and eax,111111101111111011111110b
169
		add eax,ebx ;á㬨à㥬 æ¢¥â  ¨§ r, g, b
168
		add eax,ebx ;á㬨à㥬 æ¢¥â  ¨§ r, g, b
170
		shr eax,1   ;¤¥«¨¬ ­  2
169
		shr eax,1   ;¤¥«¨¬ ­  2
171
		mov dword[edi],eax
170
		mov dword[edi],eax
172
 
171
 
173
		;४ãàᨢ­ë© ¢ë§®¢ ¤«ï ¤à®¡«¥­¨ï ¢¥àå­¥© ¯®«®¢¨­ë
172
		;४ãàᨢ­ë© ¢ë§®¢ ¤«ï ¤à®¡«¥­¨ï ¢¥àå­¥© ¯®«®¢¨­ë
174
		mov ebx,eax
173
		mov ebx,eax
175
		mov eax,ecx
174
		mov eax,ecx
176
		stdcall middle_colors, [i0],edi
175
		stdcall middle_colors, [i0],edi
177
 
176
 
178
		;४ãàᨢ­ë© ¢ë§®¢ ¤«ï ¤à®¡«¥­¨ï ­¨¦­¥© ¯®«®¢¨­ë
177
		;४ãàᨢ­ë© ¢ë§®¢ ¤«ï ¤à®¡«¥­¨ï ­¨¦­¥© ¯®«®¢¨­ë
179
		mov eax,ebx
178
		mov eax,ebx
180
		mov ebx,edx
179
		mov ebx,edx
181
		stdcall middle_colors, edi,[i1]
180
		stdcall middle_colors, edi,[i1]
182
 
181
 
183
		pop ebx eax
182
		pop ebx eax
184
	@@:
183
	@@:
185
	ret
184
	ret
186
endp
185
endp
187
 
186
 
188
align 4
187
align 4
189
pole_clear:
188
pole_clear:
190
	push eax ecx edi
189
	push eax ecx edi
191
	xor eax,eax
190
	xor eax,eax
192
	mov dword[tim],eax
191
	mov dword[tim],eax
193
	mov dword[osob],eax
192
	mov dword[osob],eax
194
	mov  byte[tim_ch],al
193
	mov  byte[tim_ch],al
195
	mov dword[Cor_x],eax
194
	mov dword[Cor_x],eax
196
	mov dword[Cor_y],eax
195
	mov dword[Cor_y],eax
197
	mov dword[b_sort],eax
196
	mov dword[b_sort],eax
198
	mov  byte[er_oom],al
197
	mov  byte[er_oom],al
199
	cld
198
	cld
200
	mov ecx,MAX_CELL
199
	mov ecx,MAX_CELL
201
	imul ecx,sizeof.Cell
200
	imul ecx,sizeof.Cell
202
	mov edi,dword[cell]
201
	mov edi,dword[cell]
203
	repne stosb ;memset(cell,0,sizeof(Cell)*MAX_CELL);
202
	repne stosb ;memset(cell,0,sizeof(Cell)*MAX_CELL);
204
	mov edi,dword[memCell]
203
	mov edi,dword[memCell]
205
	mov ecx,MAX_CELL
204
	mov ecx,MAX_CELL
206
	@@:
205
	@@:
207
		stosd ;for(i=0;i
206
		stosd ;for(i=0;i
208
		;mov dword[edi],eax
207
		;mov dword[edi],eax
209
		;add edi,4
208
		;add edi,4
210
		inc eax
209
		inc eax
211
		loop @b
210
		loop @b
212
	pop edi ecx eax
211
	pop edi ecx eax
213
	ret
212
	ret
214
 
213
 
215
align 4
214
align 4
216
proc pole_cell_creat, x:dword, y:dword, li:dword
215
proc pole_cell_creat, x:dword, y:dword, li:dword
217
	pushad ;eax ebx ecx edx edi
216
	pushad ;eax ebx ecx edx edi
218
 
217
 
219
	; *** ¥á«¨ ª«¥âª  㦥 ¡ë«  ᮧ¤ ­ 
218
	; *** ¥á«¨ ª«¥âª  㦥 ¡ë«  ᮧ¤ ­ 
220
	stdcall pole_cell_find, [x],[y]
219
	stdcall pole_cell_find, [x],[y]
221
	cmp eax,0
220
	cmp eax,0
222
	je @f ;if(i){
221
	je @f ;if(i){
223
		get_cell_offset ebx,eax
222
		get_cell_offset ebx,eax
224
		cmp dword[li],0
223
		cmp dword[li],0
225
		jne .else_if ;if(!li)
224
		jne .else_if ;if(!li)
226
			; ¥á«¨ ᮧ¤ ¥âáï ¯ãáâ ï ª«¥âª 
225
			; ¥á«¨ ᮧ¤ ¥âáï ¯ãáâ ï ª«¥âª 
227
			inc byte[ebx+13] ;+13 = .so
226
			inc byte[ebx+13] ;+13 = .so
228
			jmp .fun_e
227
			jmp .fun_e
229
		.else_if: ;else if(!(cell[i].liv&1) ){
228
		.else_if: ;else if(!(cell[i].liv&1) ){
230
		bt word[ebx+12],0 ;+12 = .liv
229
		bt word[ebx+12],0 ;+12 = .liv
231
			; ¥á«¨ ᮧ¤ ¥âáï ¦¨¢ ï ª«¥âª 
230
			; ¥á«¨ ᮧ¤ ¥âáï ¦¨¢ ï ª«¥âª 
232
			; ¨ à ­ìè¥ ª«¥âª  ¡ë«  ᮧ¤ ­  ­® ®ª § « áì ¯ãá⮩
231
			; ¨ à ­ìè¥ ª«¥âª  ¡ë«  ᮧ¤ ­  ­® ®ª § « áì ¯ãá⮩
233
			jae .creat_border_cells
232
			jae .creat_border_cells
234
		jmp .fun_e
233
		jmp .fun_e
235
	@@:
234
	@@:
236
 
235
 
237
	; *** ᮧ¤ ­¨¥ ­®¢®© ï祩ª¨
236
	; *** ᮧ¤ ­¨¥ ­®¢®© ï祩ª¨
238
	; ­ å®¤¨¬ ­®¬¥à ᢮¡®¤­®© ï祩ª¨ (i) ¤«ï ¤®¡ ¢«¥­¨ï ­®¢®©
237
	; ­ å®¤¨¬ ­®¬¥à ᢮¡®¤­®© ï祩ª¨ (i) ¤«ï ¤®¡ ¢«¥­¨ï ­®¢®©
239
	mov edi,dword[memCell]
238
	mov edi,dword[memCell]
240
	inc dword[edi]
239
	inc dword[edi]
241
	cmp dword[edi],MAX_CELL
240
	cmp dword[edi],MAX_CELL
242
	jne @f
241
	jne @f
243
		dec dword[edi]
242
		dec dword[edi]
244
		mov byte[tim_ch],0
243
		mov byte[tim_ch],0
245
		;... need call message: "eror out of memory" ...
244
		;... need call message: "eror out of memory" ...
246
		;... ¢ë¢®¤ á®®¡é¥­¨ï ¯¥à¥¯®«­¥­¨ï ­ ¤® ¤®¡ ¢¨âì  ...
245
		;... ¢ë¢®¤ á®®¡é¥­¨ï ¯¥à¥¯®«­¥­¨ï ­ ¤® ¤®¡ ¢¨âì  ...
247
		mov byte[er_oom],0
246
		mov byte[er_oom],0
248
		jmp .fun_e ;return;
247
		jmp .fun_e ;return;
249
	@@:
248
	@@:
250
	mov eax,dword[edi]
249
	mov eax,dword[edi]
251
	shl eax,2
250
	shl eax,2
252
	add eax,dword[memCell] ;eax -> memCell[firstC]
251
	add eax,dword[memCell] ;eax -> memCell[firstC]
253
	get_cell_offset ebx,dword[eax]
252
	get_cell_offset ebx,dword[eax]
254
 
253
 
255
	mov ecx,dword[x]
254
	mov ecx,dword[x]
256
	mov dword[ebx],ecx ;+0 = .x
255
	mov dword[ebx],ecx ;+0 = .x
257
	mov edx,dword[y]
256
	mov edx,dword[y]
258
	mov dword[ebx+4],edx ;+4 = .y
257
	mov dword[ebx+4],edx ;+4 = .y
259
	mov eax,dword[tim]
258
	mov eax,dword[tim]
260
	mov dword[ebx+8],eax ;+8 = .tc
259
	mov dword[ebx+8],eax ;+8 = .tc
261
	mov byte[ebx+12],0 ;+12 = .liv
260
	mov byte[ebx+12],0 ;+12 = .liv
262
 
261
 
263
	cmp dword[li],0
262
	cmp dword[li],0
264
	jne @f
263
	jne @f
265
		mov byte[ebx+13],1 ;+13 = .so
264
		mov byte[ebx+13],1 ;+13 = .so
266
		jmp .fun_e
265
		jmp .fun_e
267
	@@:
266
	@@:
268
	mov byte[ebx+13],0 ;+13 = .so
267
	mov byte[ebx+13],0 ;+13 = .so
269
 
268
 
270
	.creat_border_cells:
269
	.creat_border_cells:
271
		inc dword[osob]
270
		inc dword[osob]
272
		or byte[ebx+12],1 ;+12 = .liv
271
		or byte[ebx+12],1 ;+12 = .liv
273
		mov ecx,dword[x]
272
		mov ecx,dword[x]
274
		dec ecx
273
		dec ecx
275
		mov edx,dword[y]
274
		mov edx,dword[y]
276
		dec edx
275
		dec edx
277
		stdcall pole_cell_creat,ecx,edx,0
276
		stdcall pole_cell_creat,ecx,edx,0
278
		inc edx
277
		inc edx
279
		stdcall pole_cell_creat,ecx,edx,0
278
		stdcall pole_cell_creat,ecx,edx,0
280
		inc edx
279
		inc edx
281
		stdcall pole_cell_creat,ecx,edx,0
280
		stdcall pole_cell_creat,ecx,edx,0
282
		inc ecx
281
		inc ecx
283
		stdcall pole_cell_creat,ecx,edx,0
282
		stdcall pole_cell_creat,ecx,edx,0
284
		sub edx,2
283
		sub edx,2
285
		stdcall pole_cell_creat,ecx,edx,0
284
		stdcall pole_cell_creat,ecx,edx,0
286
		inc ecx
285
		inc ecx
287
		stdcall pole_cell_creat,ecx,edx,0
286
		stdcall pole_cell_creat,ecx,edx,0
288
		inc edx
287
		inc edx
289
		stdcall pole_cell_creat,ecx,edx,0
288
		stdcall pole_cell_creat,ecx,edx,0
290
		inc edx
289
		inc edx
291
		stdcall pole_cell_creat,ecx,edx,0
290
		stdcall pole_cell_creat,ecx,edx,0
292
	.fun_e:
291
	.fun_e:
293
	popad ;edi edx ecx ebx eax
292
	popad ;edi edx ecx ebx eax
294
	ret
293
	ret
295
endp
294
endp
296
 
295
 
297
;output:
296
;output:
298
; eax - index
297
; eax - index
299
align 4
298
align 4
300
proc pole_cell_find, x:dword, y:dword
299
proc pole_cell_find, x:dword, y:dword
301
	mov eax,dword[memCell]
300
	mov eax,dword[memCell]
302
	cmp dword[eax],0
301
	cmp dword[eax],0
303
	jne @f
302
	jne @f
304
		xor eax,eax ;if(!fristC) return 0;
303
		xor eax,eax ;if(!fristC) return 0;
305
		jmp .fun_e
304
		jmp .fun_e
306
	@@:
305
	@@:
307
 
306
 
308
	xor eax,eax ;fnd=0;
307
	xor eax,eax ;fnd=0;
309
	cmp dword[b_sort],0
308
	cmp dword[b_sort],0
310
	je @f
309
	je @f
311
		stdcall pole_bin_find, [memCell], [x],[y], [b_sort] ;i=BinFind(memCell, x,y, b_sort);
310
		stdcall pole_bin_find, [memCell], [x],[y], [b_sort] ;i=BinFind(memCell, x,y, b_sort);
312
		cmp eax,0
311
		cmp eax,0
313
		je @f
312
		je @f
314
			shl eax,2
313
			shl eax,2
315
			add eax,dword[memCell]
314
			add eax,dword[memCell]
316
			mov eax,dword[eax] ;if(i) fnd=memCell[i];
315
			mov eax,dword[eax] ;if(i) fnd=memCell[i];
317
			jmp .fun_e
316
			jmp .fun_e
318
	@@:
317
	@@:
319
 
318
 
320
	cmp eax,0
319
	cmp eax,0
321
	jne @f ;if(!fnd){ // ¯®¨áª ï祩ª¨ §  ¡¨­ à­ë¬ ¤¥à¥¢®¬
320
	jne @f ;if(!fnd){ // ¯®¨áª ï祩ª¨ §  ¡¨­ à­ë¬ ¤¥à¥¢®¬
322
		push ebx ecx edx edi esi
321
		push ebx ecx edx edi esi
323
		;ebx -> i
322
		;ebx -> i
324
		;ecx -> firstC
323
		;ecx -> firstC
325
		;edx -> &memCell[i]
324
		;edx -> &memCell[i]
326
		;edi -> cell[memCell[i]]
325
		;edi -> cell[memCell[i]]
327
		mov ecx,dword[memCell]
326
		mov ecx,dword[memCell]
328
		mov ebx,dword[b_sort]
327
		mov ebx,dword[b_sort]
329
		mov edx,ebx
328
		mov edx,ebx
330
		shl edx,2
329
		shl edx,2
331
		add edx,ecx
330
		add edx,ecx
332
		mov ecx,dword[ecx]
331
		mov ecx,dword[ecx]
333
		.cycle_b: ;for(i=b_sort+1;i<=fristC;i++)
332
		.cycle_b: ;for(i=b_sort+1;i<=fristC;i++)
334
			inc ebx
333
			inc ebx
335
			cmp ebx,ecx
334
			cmp ebx,ecx
336
			jg .cycle_e
335
			jg .cycle_e
337
			add edx,4
336
			add edx,4
338
			get_cell_offset edi,dword[edx]
337
			get_cell_offset edi,dword[edx]
339
			mov esi,dword[x]
338
			mov esi,dword[x]
340
			cmp dword[edi],esi ;+0 = .x
339
			cmp dword[edi],esi ;+0 = .x
341
			jne .if_e
340
			jne .if_e
342
			mov esi,dword[y]
341
			mov esi,dword[y]
343
			cmp dword[edi+4],esi ;+4 = .y
342
			cmp dword[edi+4],esi ;+4 = .y
344
			jne .if_e
343
			jne .if_e
345
				;if(cell[memCell[i]].x==x && cell[memCell[i]].y==y){
344
				;if(cell[memCell[i]].x==x && cell[memCell[i]].y==y){
346
				mov eax,dword[edx] ;fnd=memCell[i];
345
				mov eax,dword[edx] ;fnd=memCell[i];
347
				jmp .cycle_e ;break;
346
				jmp .cycle_e ;break;
348
			.if_e:
347
			.if_e:
349
			jmp .cycle_b
348
			jmp .cycle_b
350
		.cycle_e:
349
		.cycle_e:
351
		pop esi edi edx ecx ebx
350
		pop esi edi edx ecx ebx
352
	@@:
351
	@@:
353
	.fun_e:
352
	.fun_e:
354
	ret
353
	ret
355
endp
354
endp
356
 
355
 
357
;output:
356
;output:
358
; eax - index
357
; eax - index
359
align 4
358
align 4
360
proc pole_bin_find, mas:dword, fx:dword, fy:dword, k:dword
359
proc pole_bin_find, mas:dword, fx:dword, fy:dword, k:dword
361
	push ebx ecx edx edi
360
	push ebx ecx edx edi
362
	xor eax,eax
361
	xor eax,eax
363
	mov ebx,1 ;ebx - ¬ ªá¨¬ «ì­ë© ¯®à冷ª ¤«ï ¤¥à¥¢ 
362
	mov ebx,1 ;ebx - ¬ ªá¨¬ «ì­ë© ¯®à冷ª ¤«ï ¤¥à¥¢ 
364
	@@:
363
	@@:
365
	cmp dword[k],ebx
364
	cmp dword[k],ebx
366
	jle @f ;while(k>por)
365
	jle @f ;while(k>por)
367
		shl ebx,1 ;por<<=1;
366
		shl ebx,1 ;por<<=1;
368
		jmp @b
367
		jmp @b
369
	@@:
368
	@@:
370
	cmp dword[k],ebx
369
	cmp dword[k],ebx
371
	jge @f ;if(k
370
	jge @f ;if(k
372
		shr ebx,1 ;por>>=1;
371
		shr ebx,1 ;por>>=1;
373
	@@:
372
	@@:
374
	mov ecx,ebx ;i=por;
373
	mov ecx,ebx ;i=por;
375
 
374
 
376
	;ecx -> i
375
	;ecx -> i
377
	;edi -> mas[i]
376
	;edi -> mas[i]
378
	.cycle_b: ;do{
377
	.cycle_b: ;do{
379
		shr ebx,1 ;por>>=1;
378
		shr ebx,1 ;por>>=1;
380
 
379
 
381
		mov edi,ecx
380
		mov edi,ecx
382
		shl edi,2
381
		shl edi,2
383
		add edi,dword[mas]
382
		add edi,dword[mas]
384
		;if(compare_cells_mb(mas[i],fx,fy)){
383
		;if(compare_cells_mb(mas[i],fx,fy)){
385
		stdcall pole_compare_cells_mb_coords, dword[edi],[fx],[fy]
384
		stdcall pole_compare_cells_mb_coords, dword[edi],[fx],[fy]
386
		cmp dl,0
385
		cmp dl,0
387
		je .if_u0_e
386
		je .if_u0_e
388
			@@: ;while(i+por>k)
387
			@@: ;while(i+por>k)
389
			mov edx,ecx
388
			mov edx,ecx
390
			add edx,ebx
389
			add edx,ebx
391
			cmp edx,dword[k] ;i+por>k
390
			cmp edx,dword[k] ;i+por>k
392
			jle @f
391
			jle @f
393
				shr ebx,1 ;por>>=1;
392
				shr ebx,1 ;por>>=1;
394
				jmp @b
393
				jmp @b
395
			@@:
394
			@@:
396
			add ecx,ebx ;i+=por;
395
			add ecx,ebx ;i+=por;
397
			jmp .if_e
396
			jmp .if_e
398
		.if_u0_e:
397
		.if_u0_e:
399
		;else if(compare_cells_bm(mas[i],fx,fy))i-=por;
398
		;else if(compare_cells_bm(mas[i],fx,fy))i-=por;
400
		stdcall pole_compare_cells_bm_coords, dword[edi],[fx],[fy]
399
		stdcall pole_compare_cells_bm_coords, dword[edi],[fx],[fy]
401
		cmp dl,0
400
		cmp dl,0
402
		je .if_u1_e
401
		je .if_u1_e
403
			sub ecx,ebx
402
			sub ecx,ebx
404
			jmp .if_e
403
			jmp .if_e
405
		.if_u1_e:
404
		.if_u1_e:
406
		;else { m=i; por=0; }
405
		;else { m=i; por=0; }
407
			mov eax,ecx
406
			mov eax,ecx
408
			xor ebx,ebx
407
			xor ebx,ebx
409
		.if_e:
408
		.if_e:
410
	cmp ebx,0
409
	cmp ebx,0
411
	jne .cycle_b ;}while(por);
410
	jne .cycle_b ;}while(por);
412
 
411
 
413
	pop edi edx ecx ebx
412
	pop edi edx ecx ebx
414
	ret
413
	ret
415
endp
414
endp
416
 
415
 
417
;output:
416
;output:
418
; dl
417
; dl
419
align 4
418
align 4
420
proc pole_compare_cells_bm_coords, i0:dword, fx:dword, fy:dword
419
proc pole_compare_cells_bm_coords, i0:dword, fx:dword, fy:dword
421
	push eax ebx ecx
420
	push eax ebx ecx
422
	get_cell_offset eax,[i0]
421
	get_cell_offset eax,[i0]
423
	;eax -> cell[i0]
422
	;eax -> cell[i0]
424
	mov ebx,dword[fx]
423
	mov ebx,dword[fx]
425
	cmp dword[eax],ebx
424
	cmp dword[eax],ebx
426
	jle @f
425
	jle @f
427
		mov dl,1
426
		mov dl,1
428
		jmp .fun_e
427
		jmp .fun_e
429
	@@:
428
	@@:
430
	mov ecx,dword[fy]
429
	mov ecx,dword[fy]
431
	cmp dword[eax+4],ecx
430
	cmp dword[eax+4],ecx
432
	jle @f
431
	jle @f
433
	cmp dword[eax],ebx
432
	cmp dword[eax],ebx
434
	jne @f
433
	jne @f
435
		mov dl,1
434
		mov dl,1
436
		jmp .fun_e
435
		jmp .fun_e
437
	@@:
436
	@@:
438
	xor dl,dl
437
	xor dl,dl
439
	.fun_e:
438
	.fun_e:
440
	pop ecx ebx eax
439
	pop ecx ebx eax
441
	ret
440
	ret
442
endp
441
endp
443
 
442
 
444
;output:
443
;output:
445
; dl
444
; dl
446
align 4
445
align 4
447
proc pole_compare_cells_mb_coords, i0:dword, fx:dword, fy:dword
446
proc pole_compare_cells_mb_coords, i0:dword, fx:dword, fy:dword
448
	push eax ebx ecx
447
	push eax ebx ecx
449
	get_cell_offset eax,[i0]
448
	get_cell_offset eax,[i0]
450
	;eax -> cell[i0]
449
	;eax -> cell[i0]
451
	mov ebx,dword[fx]
450
	mov ebx,dword[fx]
452
	cmp dword[eax],ebx
451
	cmp dword[eax],ebx
453
	jge @f
452
	jge @f
454
		mov dl,1
453
		mov dl,1
455
		jmp .fun_e
454
		jmp .fun_e
456
	@@:
455
	@@:
457
	mov ecx,dword[fy]
456
	mov ecx,dword[fy]
458
	cmp dword[eax+4],ecx
457
	cmp dword[eax+4],ecx
459
	jge @f
458
	jge @f
460
	cmp dword[eax],ebx
459
	cmp dword[eax],ebx
461
	jne @f
460
	jne @f
462
		mov dl,1
461
		mov dl,1
463
		jmp .fun_e
462
		jmp .fun_e
464
	@@:
463
	@@:
465
	xor dl,dl
464
	xor dl,dl
466
	.fun_e:
465
	.fun_e:
467
	pop ecx ebx eax
466
	pop ecx ebx eax
468
	ret
467
	ret
469
endp
468
endp
470
 
469
 
471
;output:
470
;output:
472
; dl
471
; dl
473
align 4
472
align 4
474
proc pole_compare_cells_bm, i0:dword, i1:dword
473
proc pole_compare_cells_bm, i0:dword, i1:dword
475
	push eax ebx ecx
474
	push eax ebx ecx
476
	get_cell_offset eax,[i0] ;eax -> cell[i0]
475
	get_cell_offset eax,[i0] ;eax -> cell[i0]
477
	get_cell_offset ebx,[i1] ;ebx -> cell[i1]
476
	get_cell_offset ebx,[i1] ;ebx -> cell[i1]
478
	mov ecx,dword[ebx] ;+0 = .x
477
	mov ecx,dword[ebx] ;+0 = .x
479
	cmp dword[eax],ecx
478
	cmp dword[eax],ecx
480
	jle @f ;x0>x1
479
	jle @f ;x0>x1
481
		mov dl,1
480
		mov dl,1
482
		jmp .fun_e
481
		jmp .fun_e
483
	@@:
482
	@@:
484
	jne @f ;x0==x1
483
	jne @f ;x0==x1
485
	mov ecx,dword[ebx+4] ;+4 = .y
484
	mov ecx,dword[ebx+4] ;+4 = .y
486
	cmp dword[eax+4],ecx
485
	cmp dword[eax+4],ecx
487
	jle @f ;y0>y1
486
	jle @f ;y0>y1
488
		mov dl,1
487
		mov dl,1
489
		jmp .fun_e
488
		jmp .fun_e
490
	@@:
489
	@@:
491
	xor dl,dl
490
	xor dl,dl
492
	.fun_e:
491
	.fun_e:
493
	pop ecx ebx eax
492
	pop ecx ebx eax
494
	ret
493
	ret
495
endp
494
endp
496
 
495
 
497
align 4
496
align 4
498
pole_paint:
497
pole_paint:
499
	pushad
498
	pushad
500
	;eax -> firstC
499
	;eax -> firstC
501
	;ebx -> i
500
	;ebx -> i
502
	;ecx -> cell[memCell[i]]
501
	;ecx -> cell[memCell[i]]
503
	;edx -> color
502
	;edx -> color
504
	;edi -> coord_x
503
	;edi -> coord_x
505
	;esi -> coord_y
504
	;esi -> coord_y
506
	mov eax,dword[memCell]
505
	mov eax,dword[memCell]
507
	cmp dword[eax],0
506
	cmp dword[eax],0
508
	je .no_draw
507
	je .no_draw
509
 
508
 
510
	mov eax,dword[eax]
509
	mov eax,dword[eax]
511
	mov ebx,1
510
	mov ebx,1
512
 
511
 
513
;---
512
;---
514
	@@: ;while(i
513
	@@: ;while(i
515
		cmp ebx,dword[b_sort]
514
		cmp ebx,dword[b_sort]
516
		jge @f ;¯¥à¥å®¤¨¬ ­  ­ ç «® ­¨¦­¥£® 横« 
515
		jge @f ;¯¥à¥å®¤¨¬ ­  ­ ç «® ­¨¦­¥£® 横« 
517
		mov ecx,ebx
516
		mov ecx,ebx
518
		shl ecx,2
517
		shl ecx,2
519
		add ecx,dword[memCell]
518
		add ecx,dword[memCell]
520
		get_cell_offset ecx,dword[ecx]
519
		get_cell_offset ecx,dword[ecx]
521
		mov edx,dword[ecx] ;+0 = .x
520
		mov edx,dword[ecx] ;+0 = .x
522
		add edx,dword[Cor_x]
521
		add edx,dword[Cor_x]
523
		cmp edx,0
522
		cmp edx,0
524
		jge @f ;¯¥à¥å®¤¨¬ ­  ­ ç «® ­¨¦­¥£® 横« 
523
		jge @f ;¯¥à¥å®¤¨¬ ­  ­ ç «® ­¨¦­¥£® 横« 
525
			inc ebx ;i++; // ¤«ï ¯à®¯ã᪠ ï祥ª §  ®ª­®¬ á«¥¢ 
524
			inc ebx ;i++; // ¤«ï ¯à®¯ã᪠ ï祥ª §  ®ª­®¬ á«¥¢ 
526
		jmp @b
525
		jmp @b
527
	@@:
526
	@@:
528
 
527
 
529
	cmp byte[zoom],2
528
	cmp byte[zoom],2
530
	jge .zoom2
529
	jge .zoom2
531
	@@: ;for(;i<=fristC;i++){
530
	@@: ;for(;i<=fristC;i++){
532
		mov ecx,ebx
531
		mov ecx,ebx
533
		shl ecx,2
532
		shl ecx,2
534
		add ecx,dword[memCell]
533
		add ecx,dword[memCell]
535
		get_cell_offset ecx,dword[ecx]
534
		get_cell_offset ecx,dword[ecx]
536
;...
535
;...
537
		mov edi,dword[Cor_x]
536
		mov edi,dword[Cor_x]
538
		add edi,dword[ecx] ;+0 = .x
537
		add edi,dword[ecx] ;+0 = .x
539
		mov esi,dword[Cor_y]
538
		mov esi,dword[Cor_y]
540
		add esi,dword[ecx+4] ;+4 = .y
539
		add esi,dword[ecx+4] ;+4 = .y
541
		bt word[ecx+12],0 ;+12 = .liv
540
		bt word[ecx+12],0 ;+12 = .liv
542
		jc .cell_1
541
		jc .cell_1
543
			;­¥ ¦¨¢ ï ï祩ª 
542
			;­¥ ¦¨¢ ï ï祩ª 
544
			mov edx,dword[CellColors]
543
			mov edx,dword[CellColors]
545
			mov edx,dword[edx]
544
			mov edx,dword[edx]
546
			jmp .cell_0
545
			jmp .cell_0
547
		.cell_1:
546
		.cell_1:
548
			;¦¨¢ ï ï祩ª 
547
			;¦¨¢ ï ï祩ª 
549
			mov edx,dword[tim]
548
			mov edx,dword[tim]
550
			inc edx
549
			inc edx
551
			sub edx,dword[ecx+8] ;+8 = .tc
550
			sub edx,dword[ecx+8] ;+8 = .tc
552
			cmp edx,COL_MEM
551
			cmp edx,COL_MEM
553
			jle .in_color
552
			jle .in_color
554
				mov edx,COL_MEM
553
				mov edx,COL_MEM
555
			.in_color:
554
			.in_color:
556
			shl edx,2
555
			shl edx,2
557
			add edx,dword[CellColors]
556
			add edx,dword[CellColors]
558
			mov edx,dword[edx]
557
			mov edx,dword[edx]
559
		.cell_0:
558
		.cell_0:
560
		stdcall [buf2d_set_pixel], buf_0, edi, esi, edx
559
		stdcall [buf2d_set_pixel], buf_0, edi, esi, edx
561
;...
560
;...
562
		inc ebx
561
		inc ebx
563
		cmp ebx,eax
562
		cmp ebx,eax
564
		jle @b
563
		jle @b
565
 
564
 
566
	jmp .no_draw
565
	jmp .no_draw
567
	.zoom2:
566
	.zoom2:
568
 
567
 
569
	@@: ;for(;i<=fristC;i++){
568
	@@: ;for(;i<=fristC;i++){
570
		mov ecx,ebx
569
		mov ecx,ebx
571
		shl ecx,2
570
		shl ecx,2
572
		add ecx,dword[memCell]
571
		add ecx,dword[memCell]
573
		get_cell_offset ecx,dword[ecx]
572
		get_cell_offset ecx,dword[ecx]
574
 
573
 
575
		xor edx,edx
574
		xor edx,edx
576
		mov dl,byte[zoom] ;edx ¨á¯®«ì§ã¥âáï ¤«ï ¢­¥á¥­¨ï zoom ¢ 4 ¡ ©â­®¥ ç¨á«®
575
		mov dl,byte[zoom] ;edx ¨á¯®«ì§ã¥âáï ¤«ï ¢­¥á¥­¨ï zoom ¢ 4 ¡ ©â­®¥ ç¨á«®
577
		mov edi,dword[ecx] ;+0 = .x
576
		mov edi,dword[ecx] ;+0 = .x
578
		add edi,dword[Cor_x]
577
		add edi,dword[Cor_x]
579
		imul edi,edx
578
		imul edi,edx
580
		mov esi,dword[ecx+4] ;+4 = .y
579
		mov esi,dword[ecx+4] ;+4 = .y
581
		add esi,dword[Cor_y]
580
		add esi,dword[Cor_y]
582
		imul esi,edx
581
		imul esi,edx
583
		bt word[ecx+12],0 ;+12 = .liv
582
		bt word[ecx+12],0 ;+12 = .liv
584
		jc .z2_cell_1
583
		jc .z2_cell_1
585
			;­¥ ¦¨¢ ï ï祩ª 
584
			;­¥ ¦¨¢ ï ï祩ª 
586
			mov edx,dword[CellColors]
585
			mov edx,dword[CellColors]
587
			mov edx,dword[edx]
586
			mov edx,dword[edx]
588
			jmp .z2_cell_0
587
			jmp .z2_cell_0
589
		.z2_cell_1:
588
		.z2_cell_1:
590
			;¦¨¢ ï ï祩ª 
589
			;¦¨¢ ï ï祩ª 
591
			mov edx,dword[tim]
590
			mov edx,dword[tim]
592
			inc edx
591
			inc edx
593
			sub edx,dword[ecx+8] ;+8 = .tc
592
			sub edx,dword[ecx+8] ;+8 = .tc
594
			cmp edx,COL_MEM
593
			cmp edx,COL_MEM
595
			jle .z2_in_color
594
			jle .z2_in_color
596
				mov edx,COL_MEM
595
				mov edx,COL_MEM
597
			.z2_in_color:
596
			.z2_in_color:
598
			shl edx,2
597
			shl edx,2
599
			add edx,dword[CellColors]
598
			add edx,dword[CellColors]
600
			mov edx,dword[edx]
599
			mov edx,dword[edx]
601
		.z2_cell_0:
600
		.z2_cell_0:
602
		xor ecx,ecx
601
		xor ecx,ecx
603
		mov cl,byte[zoom] ;ecx ¨á¯®«ì§ã¥âáï ¤«ï ¢­¥á¥­¨ï zoom ¢ 4 ¡ ©â­®¥ ç¨á«®
602
		mov cl,byte[zoom] ;ecx ¨á¯®«ì§ã¥âáï ¤«ï ¢­¥á¥­¨ï zoom ¢ 4 ¡ ©â­®¥ ç¨á«®
604
		;;;dec ecx
603
		;;;dec ecx
605
		stdcall [buf2d_filled_rect_by_size], buf_0, edi, esi, ecx, ecx, edx
604
		stdcall [buf2d_filled_rect_by_size], buf_0, edi, esi, ecx, ecx, edx
606
		inc ebx
605
		inc ebx
607
		cmp ebx,eax
606
		cmp ebx,eax
608
		jle @b
607
		jle @b
609
 
608
 
610
	.no_draw:
609
	.no_draw:
611
	popad
610
	popad
612
	ret
611
	ret
613
 
612
 
614
align 4
613
align 4
615
pole_next_gen:
614
pole_next_gen:
616
	pushad
615
	pushad
617
	;eax -> firstC
616
	;eax -> firstC
618
	;ebx -> i
617
	;ebx -> i
619
	;ecx -> &memCell[i]
618
	;ecx -> &memCell[i]
620
	;edx -> cell[memCell[i]]
619
	;edx -> cell[memCell[i]]
621
 
620
 
622
	mov eax,dword[memCell]
621
	mov eax,dword[memCell]
623
	mov ecx,eax
622
	mov ecx,eax
624
	mov eax,dword[eax]
623
	mov eax,dword[eax]
625
	cmp eax,1
624
	cmp eax,1
626
	jl .fun_e
625
	jl .fun_e
627
	inc dword[tim]
626
	inc dword[tim]
628
	mov ebx,1
627
	mov ebx,1
629
	@@: ;for(i=1;i<=firstC;i++)
628
	@@: ;for(i=1;i<=firstC;i++)
630
		add ecx,4
629
		add ecx,4
631
		get_cell_offset edx,dword[ecx]
630
		get_cell_offset edx,dword[ecx]
632
		bt word[edx+12],0 ;+12 = .liv
631
		bt word[edx+12],0 ;+12 = .liv
633
		jae .if_0_e
632
		jae .if_0_e
634
			; á®åà ­¥­¨¥ ï祩ª¨ (á®á¥¤¥© 2 ¨«¨ 3)
633
			; á®åà ­¥­¨¥ ï祩ª¨ (á®á¥¤¥© 2 ¨«¨ 3)
635
			cmp byte[edx+13],2 ;+13 = .so
634
			cmp byte[edx+13],2 ;+13 = .so
636
			je .if_2_e
635
			je .if_2_e
637
			cmp byte[edx+13],3 ;+13 = .so
636
			cmp byte[edx+13],3 ;+13 = .so
638
			je .if_2_e
637
			je .if_2_e
639
			jmp .change
638
			jmp .change
640
		.if_0_e:
639
		.if_0_e:
641
			; ᮧ¤ ­¨¥ ï祩ª¨ (á®á¥¤¥© 3)
640
			; ᮧ¤ ­¨¥ ï祩ª¨ (á®á¥¤¥© 3)
642
			cmp byte[edx+13],3 ;+13 = .so
641
			cmp byte[edx+13],3 ;+13 = .so
643
			jne .if_1_e
642
			jne .if_1_e
644
			.change:
643
			.change:
645
				or byte[edx+12],2 ;+12 = .liv
644
				or byte[edx+12],2 ;+12 = .liv
646
				jmp .if_2_e
645
				jmp .if_2_e
647
		.if_1_e:
646
		.if_1_e:
648
			; 㤠«¥­¨¥ ¯ãá⮩ ï祩ª¨ ¤«ï ®á¢®¡®¦¤¥­¨ï ¯ ¬ïâ¨
647
			; 㤠«¥­¨¥ ¯ãá⮩ ï祩ª¨ ¤«ï ®á¢®¡®¦¤¥­¨ï ¯ ¬ïâ¨
649
			cmp byte[edx+13],0 ;+13 = .so
648
			cmp byte[edx+13],0 ;+13 = .so
650
			jne .if_2_e
649
			jne .if_2_e
651
			mov edi,dword[edx+8] ;+8 = .tc
650
			mov edi,dword[edx+8] ;+8 = .tc
652
			add edi,5 ; 5 - ¢à¥¬ï á®åà ­¥­¨ï ¯ãá⮩ ï祩ª¨, ¤® ¥ñ 㤠«¥­¨ï
651
			add edi,5 ; 5 - ¢à¥¬ï á®åà ­¥­¨ï ¯ãá⮩ ï祩ª¨, ¤® ¥ñ 㤠«¥­¨ï
653
			cmp edi,dword[tim]
652
			cmp edi,dword[tim]
654
			jge .if_2_e
653
			jge .if_2_e
655
				mov edi,eax
654
				mov edi,eax
656
				shl edi,2
655
				shl edi,2
657
				add edi,dword[memCell] ;edi -> &memCell[fristC]
656
				add edi,dword[memCell] ;edi -> &memCell[fristC]
658
				mov esi,dword[edi] ;swp=memCell[fristC];
657
				mov esi,dword[edi] ;swp=memCell[fristC];
659
				mov edx,dword[ecx] ;edx - 㦥 ­¥ ¨á¯®«ì§ã¥¬, ¯®â®¬ã ¬®¦¥¬ ¯®àâ¨âì
658
				mov edx,dword[ecx] ;edx - 㦥 ­¥ ¨á¯®«ì§ã¥¬, ¯®â®¬ã ¬®¦¥¬ ¯®àâ¨âì
660
				mov dword[edi],edx ;memCell[fristC]=memCell[i];
659
				mov dword[edi],edx ;memCell[fristC]=memCell[i];
661
				mov dword[ecx],esi ;memCell[i]=swp;
660
				mov dword[ecx],esi ;memCell[i]=swp;
662
				dec eax
661
				dec eax
663
				dec ebx
662
				dec ebx
664
				sub ecx,4
663
				sub ecx,4
665
		.if_2_e:
664
		.if_2_e:
666
 
665
 
667
		inc ebx
666
		inc ebx
668
		cmp ebx,eax
667
		cmp ebx,eax
669
		jle @b
668
		jle @b
670
	mov ebx,dword[memCell]
669
	mov ebx,dword[memCell]
671
	mov dword[ebx],eax ;firstC <- eax
670
	mov dword[ebx],eax ;firstC <- eax
672
 
671
 
673
	mov dword[b_sort],eax
672
	mov dword[b_sort],eax
674
	stdcall pole_fl_sort, dword[memCell],eax
673
	stdcall pole_fl_sort, dword[memCell],eax
675
 
674
 
676
	mov ecx,dword[memCell]
675
	mov ecx,dword[memCell]
677
	mov ebx,1
676
	mov ebx,1
678
	@@: ;for(i=1;i<=firstC;i++)
677
	@@: ;for(i=1;i<=firstC;i++)
679
		add ecx,4
678
		add ecx,4
680
		get_cell_offset edx,dword[ecx]
679
		get_cell_offset edx,dword[ecx]
681
		bt word[edx+12],1 ;+12 = .liv
680
		bt word[edx+12],1 ;+12 = .liv
682
		jae .no_change
681
		jae .no_change
683
			xor byte[edx+12],3 ;+12 = .liv
682
			xor byte[edx+12],3 ;+12 = .liv
684
			mov edi,dword[tim]
683
			mov edi,dword[tim]
685
			mov dword[edx+8],edi ;+8 = .tc
684
			mov dword[edx+8],edi ;+8 = .tc
686
			bt word[edx+12],0 ;+12 = .liv
685
			bt word[edx+12],0 ;+12 = .liv
687
			jc .new_cell
686
			jc .new_cell
688
				push eax
687
				push eax
689
				mov edi,dword[edx]
688
				mov edi,dword[edx]
690
				dec edi
689
				dec edi
691
				mov esi,dword[edx+4]
690
				mov esi,dword[edx+4]
692
				dec esi
691
				dec esi
693
				dec dword[osob]
692
				dec dword[osob]
694
				;¤ «ìè¥ §­ ç¥­¨¥ edx ¯®àâ¨âáï
693
				;¤ «ìè¥ §­ ç¥­¨¥ edx ¯®àâ¨âáï
695
				stdcall pole_cell_find,edi,esi
694
				stdcall pole_cell_find,edi,esi
696
				get_cell_offset edx,eax
695
				get_cell_offset edx,eax
697
				dec byte[edx+13] ;+13 = .so
696
				dec byte[edx+13] ;+13 = .so
698
				inc esi
697
				inc esi
699
				stdcall pole_cell_find,edi,esi
698
				stdcall pole_cell_find,edi,esi
700
				get_cell_offset edx,eax
699
				get_cell_offset edx,eax
701
				dec byte[edx+13] ;+13 = .so
700
				dec byte[edx+13] ;+13 = .so
702
				inc esi
701
				inc esi
703
				stdcall pole_cell_find,edi,esi
702
				stdcall pole_cell_find,edi,esi
704
				get_cell_offset edx,eax
703
				get_cell_offset edx,eax
705
				dec byte[edx+13] ;+13 = .so
704
				dec byte[edx+13] ;+13 = .so
706
				inc edi
705
				inc edi
707
				stdcall pole_cell_find,edi,esi
706
				stdcall pole_cell_find,edi,esi
708
				get_cell_offset edx,eax
707
				get_cell_offset edx,eax
709
				dec byte[edx+13] ;+13 = .so
708
				dec byte[edx+13] ;+13 = .so
710
				sub esi,2
709
				sub esi,2
711
				stdcall pole_cell_find,edi,esi
710
				stdcall pole_cell_find,edi,esi
712
				get_cell_offset edx,eax
711
				get_cell_offset edx,eax
713
				dec byte[edx+13] ;+13 = .so
712
				dec byte[edx+13] ;+13 = .so
714
				inc edi
713
				inc edi
715
				stdcall pole_cell_find,edi,esi
714
				stdcall pole_cell_find,edi,esi
716
				get_cell_offset edx,eax
715
				get_cell_offset edx,eax
717
				dec byte[edx+13] ;+13 = .so
716
				dec byte[edx+13] ;+13 = .so
718
				inc esi
717
				inc esi
719
				stdcall pole_cell_find,edi,esi
718
				stdcall pole_cell_find,edi,esi
720
				get_cell_offset edx,eax
719
				get_cell_offset edx,eax
721
				dec byte[edx+13] ;+13 = .so
720
				dec byte[edx+13] ;+13 = .so
722
				inc esi
721
				inc esi
723
				stdcall pole_cell_find,edi,esi
722
				stdcall pole_cell_find,edi,esi
724
				get_cell_offset edx,eax
723
				get_cell_offset edx,eax
725
				dec byte[edx+13] ;+13 = .so
724
				dec byte[edx+13] ;+13 = .so
726
				pop eax
725
				pop eax
727
				jmp .no_change
726
				jmp .no_change
728
			.new_cell: ; ¯®ï¢¨« áì ­®¢ ï ï祩ª 
727
			.new_cell: ; ¯®ï¢¨« áì ­®¢ ï ï祩ª 
729
				inc dword[osob]
728
				inc dword[osob]
730
				mov edi,dword[edx]
729
				mov edi,dword[edx]
731
				dec edi
730
				dec edi
732
				mov esi,dword[edx+4]
731
				mov esi,dword[edx+4]
733
				dec esi
732
				dec esi
734
				stdcall pole_cell_creat,edi,esi,0
733
				stdcall pole_cell_creat,edi,esi,0
735
				inc esi
734
				inc esi
736
				stdcall pole_cell_creat,edi,esi,0
735
				stdcall pole_cell_creat,edi,esi,0
737
				inc esi
736
				inc esi
738
				stdcall pole_cell_creat,edi,esi,0
737
				stdcall pole_cell_creat,edi,esi,0
739
				inc edi
738
				inc edi
740
				stdcall pole_cell_creat,edi,esi,0
739
				stdcall pole_cell_creat,edi,esi,0
741
				sub esi,2
740
				sub esi,2
742
				stdcall pole_cell_creat,edi,esi,0
741
				stdcall pole_cell_creat,edi,esi,0
743
				inc edi
742
				inc edi
744
				stdcall pole_cell_creat,edi,esi,0
743
				stdcall pole_cell_creat,edi,esi,0
745
				inc esi
744
				inc esi
746
				stdcall pole_cell_creat,edi,esi,0
745
				stdcall pole_cell_creat,edi,esi,0
747
				inc esi
746
				inc esi
748
				stdcall pole_cell_creat,edi,esi,0
747
				stdcall pole_cell_creat,edi,esi,0
749
		.no_change:
748
		.no_change:
750
		inc ebx
749
		inc ebx
751
		cmp ebx,eax
750
		cmp ebx,eax
752
		jle @b
751
		jle @b
753
	.fun_e:
752
	.fun_e:
754
	popad
753
	popad
755
	ret
754
	ret
756
 
755
 
757
;‘®àâ¨à®¢ª  ¢¥ªâ®à  a[1..n] ¬¥â®¤®¬ ”«®©¤ 
756
;‘®àâ¨à®¢ª  ¢¥ªâ®à  a[1..n] ¬¥â®¤®¬ ”«®©¤ 
758
align 4
757
align 4
759
proc pole_fl_sort, a:dword, n:dword
758
proc pole_fl_sort, a:dword, n:dword
760
	pushad
759
	pushad
761
	mov ecx,dword[a]
760
	mov ecx,dword[a]
762
	;”®à¬¨à®¢ âì ¨á室­®¥ ç áâ¨ç­® 㯮à冷祭­®¥ ¤¥à¥¢®
761
	;”®à¬¨à®¢ âì ¨á室­®¥ ç áâ¨ç­® 㯮à冷祭­®¥ ¤¥à¥¢®
763
	mov eax,dword[n]
762
	mov eax,dword[n]
764
	shr eax,1
763
	shr eax,1
765
	@@: ;for(i=n>>1; i>=2; i--)
764
	@@: ;for(i=n>>1; i>=2; i--)
766
		stdcall pole_fl_surface, ecx,eax,[n] ;(a,i,n)
765
		stdcall pole_fl_surface, ecx,eax,[n] ;(a,i,n)
767
		dec eax
766
		dec eax
768
		cmp eax,2
767
		cmp eax,2
769
		jge @b
768
		jge @b
770
	;‚믮«­¨âì ¯à®æ¥¤ãà㠢ᯫëâ¨ï ”«®©¤  ¤«ï ª ¦¤®£® ¯®¤¤¥à¥¢ 
769
	;‚믮«­¨âì ¯à®æ¥¤ãà㠢ᯫëâ¨ï ”«®©¤  ¤«ï ª ¦¤®£® ¯®¤¤¥à¥¢ 
771
	mov eax,dword[n]
770
	mov eax,dword[n]
772
	@@: ;for(i=n; i>=2; i--){
771
	@@: ;for(i=n; i>=2; i--){
773
		stdcall pole_fl_surface, ecx,1,eax ;(a,1,i)
772
		stdcall pole_fl_surface, ecx,1,eax ;(a,1,i)
774
		;®¬¥áâ¨âì ­ ©¤¥­­ë© ¬ ªá¨¬ «ì­ë© í«¥¬¥­â ¢ ª®­¥æ ᯨ᪠
773
		;®¬¥áâ¨âì ­ ©¤¥­­ë© ¬ ªá¨¬ «ì­ë© í«¥¬¥­â ¢ ª®­¥æ ᯨ᪠
775
		mov edi,eax
774
		mov edi,eax
776
		shl edi,2
775
		shl edi,2
777
		add edi,ecx ;edi -> &a[i]
776
		add edi,ecx ;edi -> &a[i]
778
		mov esi,dword[edi] ;w=a[i];
777
		mov esi,dword[edi] ;w=a[i];
779
		mov edx,dword[ecx+4]
778
		mov edx,dword[ecx+4]
780
		mov dword[edi],edx ;a[i]=a[1];
779
		mov dword[edi],edx ;a[i]=a[1];
781
		mov dword[ecx+4],esi ;a[1]=w;
780
		mov dword[ecx+4],esi ;a[1]=w;
782
 
781
 
783
		dec eax
782
		dec eax
784
		cmp eax,2
783
		cmp eax,2
785
		jge @b
784
		jge @b
786
	popad
785
	popad
787
	ret
786
	ret
788
endp
787
endp
789
 
788
 
790
;à®æ¥¤ãà  ¢á¯«ëâ¨ï ”«®©¤  ¯® ¤¥à¥¢ã a[1..k]
789
;à®æ¥¤ãà  ¢á¯«ëâ¨ï ”«®©¤  ¯® ¤¥à¥¢ã a[1..k]
791
align 4
790
align 4
792
proc pole_fl_surface, a:dword, i:dword, k:dword
791
proc pole_fl_surface, a:dword, i:dword, k:dword
793
locals
792
locals
794
	copy dd ?
793
	copy dd ?
795
endl
794
endl
796
	pushad
795
	pushad
797
	;edx -> ...
796
	;edx -> ...
798
	;edi -> m
797
	;edi -> m
799
	;esi -> j
798
	;esi -> j
800
	mov eax,dword[a]
799
	mov eax,dword[a]
801
	mov ebx,dword[i]
800
	mov ebx,dword[i]
802
	mov ecx,dword[k]
801
	mov ecx,dword[k]
803
 
802
 
804
	mov edx,ebx
803
	mov edx,ebx
805
	shl edx,2
804
	shl edx,2
806
	add edx,eax
805
	add edx,eax
807
	mov edx,dword[edx]
806
	mov edx,dword[edx]
808
	mov dword[copy],edx ;copy=a[i];
807
	mov dword[copy],edx ;copy=a[i];
809
	mov edi,ebx
808
	mov edi,ebx
810
	shl edi,1 ;m=i<<1;
809
	shl edi,1 ;m=i<<1;
811
	.cycle_b: ;while (m<=k) {
810
	.cycle_b: ;while (m<=k) {
812
		cmp edi,ecx
811
		cmp edi,ecx
813
		jg .cycle_e
812
		jg .cycle_e
814
		jne @f ;if (m==k) j=m;
813
		jne @f ;if (m==k) j=m;
815
			mov esi,edi
814
			mov esi,edi
816
			jmp .else_e
815
			jmp .else_e
817
		@@: ;else if (pole_compare_cells_bm(a[m],a[m+1])) j=m;
816
		@@: ;else if (pole_compare_cells_bm(a[m],a[m+1])) j=m;
818
		mov edx,edi
817
		mov edx,edi
819
		shl edx,2
818
		shl edx,2
820
		add edx,eax
819
		add edx,eax
821
		stdcall pole_compare_cells_bm, dword[edx],dword[edx+4]
820
		stdcall pole_compare_cells_bm, dword[edx],dword[edx+4]
822
		cmp dl,0
821
		cmp dl,0
823
		je @f
822
		je @f
824
			mov esi,edi
823
			mov esi,edi
825
			jmp .else_e
824
			jmp .else_e
826
		@@: ;else j=m+1;
825
		@@: ;else j=m+1;
827
			mov esi,edi
826
			mov esi,edi
828
			inc esi
827
			inc esi
829
		.else_e:
828
		.else_e:
830
 
829
 
831
		;if (pole_compare_cells_bm(a[j],copy)) {
830
		;if (pole_compare_cells_bm(a[j],copy)) {
832
		mov edx,esi
831
		mov edx,esi
833
		shl edx,2
832
		shl edx,2
834
		add edx,eax
833
		add edx,eax
835
		stdcall pole_compare_cells_bm, dword[edx],dword[copy]
834
		stdcall pole_compare_cells_bm, dword[edx],dword[copy]
836
		cmp dl,0
835
		cmp dl,0
837
		je .cycle_e ;} else break; //¢ë室 ¨§ 横« 
836
		je .cycle_e ;} else break; //¢ë室 ¨§ 横« 
838
 
837
 
839
		mov edx,esi
838
		mov edx,esi
840
		shl edx,2
839
		shl edx,2
841
		add edx,eax
840
		add edx,eax
842
		push dword[edx] ;push a[j];
841
		push dword[edx] ;push a[j];
843
		mov edx,ebx
842
		mov edx,ebx
844
		shl edx,2
843
		shl edx,2
845
		add edx,eax
844
		add edx,eax
846
		pop dword[edx] ;a[i]=a[j];
845
		pop dword[edx] ;a[i]=a[j];
847
		mov ebx,esi ;i=j;
846
		mov ebx,esi ;i=j;
848
		mov edi,ebx
847
		mov edi,ebx
849
		shl edi,1 ;m=i<<1;
848
		shl edi,1 ;m=i<<1;
850
 
849
 
851
		jmp .cycle_b
850
		jmp .cycle_b
852
	.cycle_e:
851
	.cycle_e:
853
 
852
 
854
	;§­ ç¥­¨ï ¬­®£¨å ॣ¨áâ஢ 㦥 ­¥ ¢ ¦­ë â. ª. ª®­¥æ ä㭪樨
853
	;§­ ç¥­¨ï ¬­®£¨å ॣ¨áâ஢ 㦥 ­¥ ¢ ¦­ë â. ª. ª®­¥æ ä㭪樨
855
	shl ebx,2
854
	shl ebx,2
856
	add eax,ebx
855
	add eax,ebx
857
	mov edx,dword[copy]
856
	mov edx,dword[copy]
858
	mov dword[eax],edx ;a[i]=copy;
857
	mov dword[eax],edx ;a[i]=copy;
859
 
858
 
860
	popad
859
	popad
861
	ret
860
	ret
862
endp
861
endp
863
;--------------------------------------
862
;--------------------------------------
864
 
863
 
865
 
864
 
866
align 4
865
align 4
867
start:
866
start:
868
	load_libraries l_libs_start,l_libs_end
867
	load_libraries l_libs_start,l_libs_end
869
	;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ­ è  «¨¡ 
868
	;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ­ è  «¨¡ 
870
	mov	ebp,lib_7
869
	mov	ebp,lib_7
871
	cmp	dword [ebp+ll_struc_size-4],0
870
	cmp	dword [ebp+ll_struc_size-4],0
872
	jz	@f
871
	jz	@f
873
		mcall -1 ;exit not correct
872
		mcall -1 ;exit not correct
874
	@@:
873
	@@:
875
	mcall 48,3,sc,sizeof.system_colors
874
	mcall 48,3,sc,sizeof.system_colors
876
	mcall 40,0x27
875
	mcall 40,0x27
877
	stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
876
	stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
878
 
877
 
879
	stdcall [buf2d_create], buf_0 ;ᮧ¤ ­¨¥ ¡ãä¥à 
878
	stdcall [buf2d_create], buf_0 ;ᮧ¤ ­¨¥ ¡ãä¥à 
880
 
879
 
881
	stdcall mem.Alloc,MAX_CELL*sizeof.Cell
880
	stdcall mem.Alloc,MAX_CELL*sizeof.Cell
882
	mov [cell],eax
881
	mov [cell],eax
883
	stdcall mem.Alloc,MAX_CELL*4
882
	stdcall mem.Alloc,MAX_CELL*4
884
	mov [memCell],eax
883
	mov [memCell],eax
885
	stdcall mem.Alloc,(COL_MEM+1)*4
884
	stdcall mem.Alloc,(COL_MEM+1)*4
886
	mov [CellColors],eax
885
	mov [CellColors],eax
887
	load_image_file fn_toolbar, image_data_toolbar,IMAGE_TOOLBAR_SIZE
886
	load_image_file fn_toolbar, image_data_toolbar,IMAGE_TOOLBAR_SIZE
888
 
887
 
889
	;­ áâனª  梥⮢ ï祥ª
888
	;­ áâனª  梥⮢ ï祥ª
890
	stdcall pole_init_colors, 0xffffd0,0xff0000,0x0000ff
889
	stdcall pole_init_colors, 0xffffd0,0xff0000,0x0000ff
891
	call pole_clear
890
	call pole_clear
892
	call pole_paint ;à¨á®¢ ­¨¥ ¯®«ï ¢ ¡ãä¥à¥ (­¥ ­  íªà ­¥)
891
	call pole_paint ;à¨á®¢ ­¨¥ ¯®«ï ¢ ¡ãä¥à¥ (­¥ ­  íªà ­¥)
893
 
892
 
894
	;xor eax,eax
893
	;xor eax,eax
895
	;mov edi,txt_zoom.zi
894
	;mov edi,txt_zoom.zi
896
	;mov al,byte[zoom]
895
	;mov al,byte[zoom]
897
	;call tl_convert_to_str
896
	;call tl_convert_to_str
898
 
897
 
899
	mcall 26,9
898
	mcall 26,9
900
	mov [last_time],eax
899
	mov [last_time],eax
901
 
900
 
902
align 4
901
align 4
903
red_win:
902
red_win:
904
	call draw_window
903
	call draw_window
905
 
904
 
906
align 4
905
align 4
907
still:
906
still:
908
	mcall 26,9
907
	mcall 26,9
909
	mov ebx,[last_time]
908
	mov ebx,[last_time]
910
	add ebx,10 ;§ ¤¥à¦ª 
909
	add ebx,10 ;§ ¤¥à¦ª 
911
	cmp ebx,eax
910
	cmp ebx,eax
912
	jge @f
911
	jge @f
913
		mov ebx,eax
912
		mov ebx,eax
914
	@@:
913
	@@:
915
	sub ebx,eax
914
	sub ebx,eax
916
	;cmp ebx,10 ;§ ¤¥à¦ª 
915
	;cmp ebx,10 ;§ ¤¥à¦ª 
917
	;ja timer_funct
916
	;ja timer_funct
918
	;test ebx,ebx
917
	;test ebx,ebx
919
	;jz timer_funct
918
	;jz timer_funct
920
	mcall 23
919
	mcall 23
921
	cmp eax,0
920
	cmp eax,0
922
	je timer_funct
921
	je timer_funct
923
 
922
 
924
	cmp al,1
923
	cmp al,1
925
	jz red_win
924
	jz red_win
926
	cmp al,2
925
	cmp al,2
927
	jz key
926
	jz key
928
	cmp al,3
927
	cmp al,3
929
	jz button
928
	jz button
930
 
929
 
931
	jmp still
930
	jmp still
932
 
931
 
933
align 4
932
align 4
934
timer_funct:
933
timer_funct:
935
	pushad
934
	pushad
936
	mcall 26,9
935
	mcall 26,9
937
	mov [last_time],eax
936
	mov [last_time],eax
938
 
937
 
939
	cmp byte[tim_ch],0
938
	cmp byte[tim_ch],0
940
	je @f
939
	je @f
941
		;call but_next_gen
940
		;call but_next_gen
942
		cld
941
		cld
943
		mov ecx,dword[poc_stop]
942
		mov ecx,dword[poc_stop]
944
		cmp ecx,1
943
		cmp ecx,1
945
		jg .clear
944
		jg .clear
946
			mov ecx,1 ;¨á¯à ¢«¥­¨¥ ecx ­  á«ãç © ç¨á¥« ¬¥­ìè¨å 1
945
			mov ecx,1 ;¨á¯à ¢«¥­¨¥ ecx ­  á«ãç © ç¨á¥« ¬¥­ìè¨å 1
947
			jmp .cycle
946
			jmp .cycle
948
		.clear: ;ç¨á⨬ ¯®«¥ ¥á«¨ ¥áâì ¯à®áç¥â ­  ­¥áª®«ìª® ¯®ª®«¥­¨© §  1 â ªâ â ©¬¥à 
947
		.clear: ;ç¨á⨬ ¯®«¥ ¥á«¨ ¥áâì ¯à®áç¥â ­  ­¥áª®«ìª® ¯®ª®«¥­¨© §  1 â ªâ â ©¬¥à 
949
			stdcall [buf2d_clear], buf_0, [buf_0.color]
948
			stdcall [buf2d_clear], buf_0, [buf_0.color]
950
		.cycle:
949
		.cycle:
951
			call pole_next_gen
950
			call pole_next_gen
952
			loop .cycle
951
			loop .cycle
953
		call pole_paint
952
		call pole_paint
954
		stdcall [buf2d_draw], buf_0
953
		stdcall [buf2d_draw], buf_0
955
		call draw_pok
954
		call draw_pok
956
	@@:
955
	@@:
957
	popad
956
	popad
958
	jmp still
957
	jmp still
959
 
958
 
960
align 4
959
align 4
961
draw_window:
960
draw_window:
962
pushad
961
pushad
963
	mcall 12,1
962
	mcall 12,1
964
	xor eax,eax
963
	xor eax,eax
965
	mov ebx,(20 shl 16)+485
964
	mov ebx,(20 shl 16)+485
966
	mov ecx,(20 shl 16)+415
965
	mov ecx,(20 shl 16)+415
967
	mov edx,[sc.work]
966
	mov edx,[sc.work]
968
	or  edx,(3 shl 24)+0x10000000+0x20000000
967
	or  edx,(3 shl 24)+0x10000000+0x20000000
969
	mov edi,hed
968
	mov edi,hed
970
	int 0x40
969
	int 0x40
971
 
970
 
972
	mov eax,8
971
	mov eax,8
973
	mov ebx,(5 shl 16)+20
972
	mov ebx,(5 shl 16)+20
974
	mov ecx,(5 shl 16)+20
973
	mov ecx,(5 shl 16)+20
975
	mov edx,3
974
	mov edx,3
976
	mov esi,[sc.work_button]
975
	mov esi,[sc.work_button]
977
	int 0x40
976
	int 0x40
978
 
977
 
979
	mov ebx,(30 shl 16)+20
978
	mov ebx,(30 shl 16)+20
980
	mov ecx,(5 shl 16)+20
979
	mov ecx,(5 shl 16)+20
981
	mov edx,4
980
	mov edx,4
982
	int 0x40
981
	int 0x40
983
 
982
 
984
	mov ebx,(55 shl 16)+20
983
	mov ebx,(55 shl 16)+20
985
	mov ecx,(5 shl 16)+20
984
	mov ecx,(5 shl 16)+20
986
	mov edx,5
985
	mov edx,5
987
	int 0x40
986
	int 0x40
988
 
987
 
989
	mov ebx,(85 shl 16)+20
988
	mov ebx,(85 shl 16)+20
990
	mov ecx,(5 shl 16)+20
989
	mov ecx,(5 shl 16)+20
991
	mov edx,6
990
	mov edx,6
992
	int 0x40
991
	int 0x40
993
 
992
 
994
	mov ebx,(110 shl 16)+20
993
	mov ebx,(110 shl 16)+20
995
	mov ecx,(5 shl 16)+20
994
	mov ecx,(5 shl 16)+20
996
	mov edx,7
995
	mov edx,7
997
	int 0x40
996
	int 0x40
998
 
997
 
999
	mov ebx,(135 shl 16)+20
998
	mov ebx,(135 shl 16)+20
1000
	mov ecx,(5 shl 16)+20
999
	mov ecx,(5 shl 16)+20
1001
	mov edx,8
1000
	mov edx,8
1002
	int 0x40
1001
	int 0x40
1003
 
1002
 
1004
	mov ebx,(165 shl 16)+20
1003
	mov ebx,(165 shl 16)+20
1005
	mov ecx,(5 shl 16)+20
1004
	mov ecx,(5 shl 16)+20
1006
	mov edx,9
1005
	mov edx,9
1007
	int 0x40
1006
	int 0x40
1008
 
1007
 
1009
	mov ebx,(190 shl 16)+20
1008
	mov ebx,(190 shl 16)+20
1010
	mov ecx,(5 shl 16)+20
1009
	mov ecx,(5 shl 16)+20
1011
	mov edx,10
1010
	mov edx,10
1012
	int 0x40
1011
	int 0x40
1013
 
1012
 
1014
	mov ebx,(220 shl 16)+20
1013
	mov ebx,(220 shl 16)+20
1015
	mov ecx,(5 shl 16)+20
1014
	mov ecx,(5 shl 16)+20
1016
	mov edx,11
1015
	mov edx,11
1017
	int 0x40
1016
	int 0x40
1018
 
1017
 
1019
	mov ebx,(245 shl 16)+20
1018
	mov ebx,(245 shl 16)+20
1020
	mov ecx,(5 shl 16)+20
1019
	mov ecx,(5 shl 16)+20
1021
	mov edx,12
1020
	mov edx,12
1022
	int 0x40
1021
	int 0x40
1023
 
1022
 
1024
	mov ebx,(270 shl 16)+20
1023
	mov ebx,(270 shl 16)+20
1025
	mov ecx,(5 shl 16)+20
1024
	mov ecx,(5 shl 16)+20
1026
	mov edx,13
1025
	mov edx,13
1027
	int 0x40
1026
	int 0x40
1028
 
1027
 
1029
	mov ebx,(295 shl 16)+20
1028
	mov ebx,(295 shl 16)+20
1030
	mov ecx,(5 shl 16)+20
1029
	mov ecx,(5 shl 16)+20
1031
	mov edx,14
1030
	mov edx,14
1032
	int 0x40
1031
	int 0x40
1033
 
1032
 
1034
	mov eax,7
1033
	mov eax,7
1035
	mov ebx,[image_data_toolbar]
1034
	mov ebx,[image_data_toolbar]
1036
	mov ecx,(16 shl 16)+16
1035
	mov ecx,(16 shl 16)+16
1037
	mov edx,(32 shl 16)+7
1036
	mov edx,(32 shl 16)+7
1038
	int 0x40
1037
	int 0x40
1039
 
1038
 
1040
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
1039
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
1041
	mov edx,(87 shl 16)+7 ;run once
1040
	mov edx,(87 shl 16)+7 ;run once
1042
	int 0x40
1041
	int 0x40
1043
 
1042
 
1044
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
1043
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
1045
	mov edx,(112 shl 16)+7 ;run auto
1044
	mov edx,(112 shl 16)+7 ;run auto
1046
	int 0x40
1045
	int 0x40
1047
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
1046
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
1048
	mov edx,(137 shl 16)+7 ;stop
1047
	mov edx,(137 shl 16)+7 ;stop
1049
	int 0x40
1048
	int 0x40
1050
 
1049
 
1051
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
1050
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
1052
	mov edx,(167 shl 16)+7 ;-
1051
	mov edx,(167 shl 16)+7 ;-
1053
	int 0x40
1052
	int 0x40
1054
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
1053
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
1055
	mov edx,(192 shl 16)+7 ;+
1054
	mov edx,(192 shl 16)+7 ;+
1056
	int 0x40
1055
	int 0x40
1057
 
1056
 
1058
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
1057
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
1059
	mov edx,(222 shl 16)+7 ;move up
1058
	mov edx,(222 shl 16)+7 ;move up
1060
	int 0x40
1059
	int 0x40
1061
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
1060
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
1062
	mov edx,(247 shl 16)+7 ;move doun
1061
	mov edx,(247 shl 16)+7 ;move doun
1063
	int 0x40
1062
	int 0x40
1064
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
1063
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
1065
	mov edx,(272 shl 16)+7 ;move left
1064
	mov edx,(272 shl 16)+7 ;move left
1066
	int 0x40
1065
	int 0x40
1067
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
1066
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
1068
	mov edx,(297 shl 16)+7 ;move up
1067
	mov edx,(297 shl 16)+7 ;move up
1069
	int 0x40
1068
	int 0x40
1070
 
1069
 
1071
	call draw_pok
1070
	call draw_pok
1072
 
1071
 
1073
	stdcall [buf2d_draw], buf_0
1072
	stdcall [buf2d_draw], buf_0
1074
 
1073
 
1075
	mcall 12,2
1074
	mcall 12,2
1076
popad
1075
popad
1077
	ret
1076
	ret
1078
 
1077
 
1079
align 4
1078
align 4
1080
draw_pok:
1079
draw_pok:
1081
	mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
1080
	mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
1082
	mov ebx,325*65536+5
1081
	mov ebx,325*65536+5
1083
	mov ecx,[sc.work_text]
1082
	mov ecx,[sc.work_text]
1084
	or  ecx,0x80000000 ;or (1 shl 30)
1083
	or  ecx,0x80000000 ;or (1 shl 30)
1085
	mov edx,txt_zoom
1084
	mov edx,txt_zoom
1086
	;mov edi,[sc.work]
1085
	;mov edi,[sc.work]
1087
	int 0x40
1086
	int 0x40
1088
	add bx,9
1087
	add bx,9
1089
	mov edx,txt_gen
1088
	mov edx,txt_gen
1090
	int 0x40
1089
	int 0x40
1091
	add bx,9
1090
	add bx,9
1092
	mov edx,txt_osob
1091
	mov edx,txt_osob
1093
	int 0x40
1092
	int 0x40
1094
 
1093
 
1095
	mov eax,47
1094
	mov eax,47
1096
	xor ecx,ecx
1095
	xor ecx,ecx
1097
	mov cl,byte[zoom]
1096
	mov cl,byte[zoom]
1098
	mov ebx,(2 shl 16)
1097
	mov ebx,(2 shl 16)
1099
	mov edx,(325+6*9)*65536+5
1098
	mov edx,(325+6*9)*65536+5
1100
	mov esi,[sc.work_button_text]
1099
	mov esi,[sc.work_button_text]
1101
	or  esi,(1 shl 30)
1100
	or  esi,(1 shl 30)
1102
	mov edi,[sc.work_button]
1101
	mov edi,[sc.work_button]
1103
	int 0x40 ;¬ áèâ ¡
1102
	int 0x40 ;¬ áèâ ¡
1104
	mov ebx,(5 shl 16)
1103
	mov ebx,(5 shl 16)
1105
	mov ecx,[tim]
1104
	mov ecx,[tim]
1106
	add edx,(6*2)*65536+9
1105
	add edx,(6*2)*65536+9
1107
	int 0x40 ;¢à¥¬ï
1106
	int 0x40 ;¢à¥¬ï
1108
	mov ebx,(5 shl 16)
1107
	mov ebx,(5 shl 16)
1109
	mov ecx,[osob]
1108
	mov ecx,[osob]
1110
	add edx,(6*0)*65536+9
1109
	add edx,(6*0)*65536+9
1111
	int 0x40 ;¯®¯ã«ïæ¨ï
1110
	int 0x40 ;¯®¯ã«ïæ¨ï
1112
	ret
1111
	ret
1113
 
1112
 
1114
align 4
1113
align 4
1115
key:
1114
key:
1116
	mcall 2
1115
	mcall 2
1117
	jmp still
1116
	jmp still
1118
 
1117
 
1119
 
1118
 
1120
align 4
1119
align 4
1121
button:
1120
button:
1122
	mcall 17
1121
	mcall 17
1123
	cmp ah,3
1122
	cmp ah,3
1124
	jne @f
1123
	jne @f
1125
		call but_new_file
1124
		call but_new_file
1126
	@@:
1125
	@@:
1127
	cmp ah,4
1126
	cmp ah,4
1128
	jne @f
1127
	jne @f
1129
		call but_open_file
1128
		call but_open_file
1130
	@@:
1129
	@@:
1131
	cmp ah,5
1130
	cmp ah,5
1132
	jne @f
1131
	jne @f
1133
		call but_save_file
1132
		call but_save_file
1134
	@@:
1133
	@@:
1135
	cmp ah,6
1134
	cmp ah,6
1136
	jne @f
1135
	jne @f
1137
		call but_next_gen
1136
		call but_next_gen
1138
	@@:
1137
	@@:
1139
	cmp ah,7
1138
	cmp ah,7
1140
	jne @f
1139
	jne @f
1141
		call but_run
1140
		call but_run
1142
	@@:
1141
	@@:
1143
	cmp ah,8
1142
	cmp ah,8
1144
	jne @f
1143
	jne @f
1145
		call but_stop
1144
		call but_stop
1146
	@@:
1145
	@@:
1147
	cmp ah,9
1146
	cmp ah,9
1148
	jne @f
1147
	jne @f
1149
		call but_zoom_p
1148
		call but_zoom_p
1150
	@@:
1149
	@@:
1151
	cmp ah,10
1150
	cmp ah,10
1152
	jne @f
1151
	jne @f
1153
		call but_zoom_m
1152
		call but_zoom_m
1154
	@@:
1153
	@@:
1155
	cmp ah,11
1154
	cmp ah,11
1156
	jne @f
1155
	jne @f
1157
		call but_pole_up
1156
		call but_pole_up
1158
	@@:
1157
	@@:
1159
	cmp ah,12
1158
	cmp ah,12
1160
	jne @f
1159
	jne @f
1161
		call but_pole_dn
1160
		call but_pole_dn
1162
	@@:
1161
	@@:
1163
	cmp ah,13
1162
	cmp ah,13
1164
	jne @f
1163
	jne @f
1165
		call but_pole_left
1164
		call but_pole_left
1166
	@@:
1165
	@@:
1167
	cmp ah,14
1166
	cmp ah,14
1168
	jne @f
1167
	jne @f
1169
		call but_pole_right
1168
		call but_pole_right
1170
	@@:
1169
	@@:
1171
	cmp ah,1
1170
	cmp ah,1
1172
	jne still
1171
	jne still
1173
.exit:
1172
.exit:
1174
	stdcall [buf2d_delete],buf_0
1173
	stdcall [buf2d_delete],buf_0
1175
	stdcall mem.Free,[cell]
1174
	stdcall mem.Free,[cell]
1176
	stdcall mem.Free,[memCell]
1175
	stdcall mem.Free,[memCell]
1177
	stdcall mem.Free,[CellColors]
1176
	stdcall mem.Free,[CellColors]
1178
	stdcall mem.Free,[image_data_toolbar]
1177
	stdcall mem.Free,[image_data_toolbar]
1179
	mcall -1
1178
	mcall -1
1180
 
1179
 
1181
 
1180
 
1182
align 4
1181
align 4
1183
but_new_file:
1182
but_new_file:
1184
	ret
1183
	ret
1185
 
1184
 
1186
align 4
1185
align 4
1187
open_file_lif:
1186
open_file_lif:
1188
	rb 4096 ;®¡« áâì ¤«ï ®âªàëâ¨ï ä ©«®¢
1187
	rb 4096 ;®¡« áâì ¤«ï ®âªàëâ¨ï ä ©«®¢
1189
.end:
1188
.end:
1190
 
1189
 
1191
align 4
1190
align 4
1192
but_open_file:
1191
but_open_file:
1193
	pushad
1192
	pushad
1194
	copy_path open_dialog_name,communication_area_default_path,file_name,0
1193
	copy_path open_dialog_name,communication_area_default_path,file_name,0
1195
	mov [OpenDialog_data.type],0
1194
	mov [OpenDialog_data.type],0
1196
	stdcall [OpenDialog_Start],OpenDialog_data
1195
	stdcall [OpenDialog_Start],OpenDialog_data
1197
	cmp [OpenDialog_data.status],2
1196
	cmp [OpenDialog_data.status],2
1198
	je .end_open_file
1197
	je .end_open_file
1199
	;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
1198
	;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
1200
 
1199
 
1201
	mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
1200
	mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
1202
	mov [run_file_70.Function], 0
1201
	mov [run_file_70.Function], 0
1203
	mov [run_file_70.Position], 0
1202
	mov [run_file_70.Position], 0
1204
	mov [run_file_70.Flags], 0
1203
	mov [run_file_70.Flags], 0
1205
	mov dword[run_file_70.Count], open_file_lif.end-open_file_lif
1204
	mov dword[run_file_70.Count], open_file_lif.end-open_file_lif
1206
	m2m [run_file_70.Buffer], open_file_lif
1205
	m2m [run_file_70.Buffer], open_file_lif
1207
	mov byte[run_file_70+20], 0
1206
	mov byte[run_file_70+20], 0
1208
	mov dword[run_file_70.FileName], openfile_path
1207
	mov dword[run_file_70.FileName], openfile_path
1209
	mov ebx,run_file_70
1208
	mov ebx,run_file_70
1210
	int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
1209
	int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
1211
	cmp ebx,0xffffffff
1210
	cmp ebx,0xffffffff
1212
	je .end_open_file
1211
	je .end_open_file
1213
 
1212
 
1214
	add ebx,open_file_lif
1213
	add ebx,open_file_lif
1215
	mov byte[ebx],0 ;­  á«ãç © ¥á«¨ à ­¥¥ ¡ë« ®âªàëâ ä ©« ¡®«ì襣® à §¬¥à  ç¨á⨬ ª®­¥æ ¡ãä¥à  á ä ©«®¬
1214
	mov byte[ebx],0 ;­  á«ãç © ¥á«¨ à ­¥¥ ¡ë« ®âªàëâ ä ©« ¡®«ì襣® à §¬¥à  ç¨á⨬ ª®­¥æ ¡ãä¥à  á ä ©«®¬
1216
	mcall 71,1,openfile_path
1215
	mcall 71,1,openfile_path
1217
 
1216
 
1218
	call pole_clear
1217
	call pole_clear
1219
	mov eax,dword[buf_0.w]
1218
	mov eax,dword[buf_0.w]
1220
	shr eax,1
1219
	shr eax,1
1221
	xor ecx,ecx
1220
	xor ecx,ecx
1222
	mov cl,byte[zoom]
1221
	mov cl,byte[zoom]
1223
	cmp cx,2
1222
	cmp cx,2
1224
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1223
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1225
		xor edx,edx
1224
		xor edx,edx
1226
		div ecx
1225
		div ecx
1227
	@@:
1226
	@@:
1228
	add dword[Cor_x],eax
1227
	add dword[Cor_x],eax
1229
	mov eax,dword[buf_0.h]
1228
	mov eax,dword[buf_0.h]
1230
	shr eax,1
1229
	shr eax,1
1231
	cmp cx,2
1230
	cmp cx,2
1232
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1231
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1233
		xor edx,edx
1232
		xor edx,edx
1234
		div ecx
1233
		div ecx
1235
	@@:
1234
	@@:
1236
	add dword[Cor_y],eax
1235
	add dword[Cor_y],eax
1237
 
1236
 
1238
	;eax - first x position
1237
	;eax - first x position
1239
	;ebx - x position
1238
	;ebx - x position
1240
	;ecx - y position
1239
	;ecx - y position
1241
	mov edi,open_file_lif
1240
	mov edi,open_file_lif
1242
	xor ebx,ebx
1241
	xor ebx,ebx
1243
	xor ecx,ecx
1242
	xor ecx,ecx
1244
	mov eax,ebx
1243
	mov eax,ebx
1245
	@@:
1244
	@@:
1246
		cmp byte[edi],'*'
1245
		cmp byte[edi],'*'
1247
		jne .no_cell
1246
		jne .no_cell
1248
			stdcall pole_cell_creat, ebx,ecx,1
1247
			stdcall pole_cell_creat, ebx,ecx,1
1249
			inc ebx
1248
			inc ebx
1250
		.no_cell:
1249
		.no_cell:
1251
		cmp byte[edi],'.'
1250
		cmp byte[edi],'.'
1252
		jne .cell_move
1251
		jne .cell_move
1253
			inc ebx
1252
			inc ebx
1254
		.cell_move:
1253
		.cell_move:
1255
		cmp byte[edi],13
1254
		cmp byte[edi],13
1256
		jne .cell_nl
1255
		jne .cell_nl
1257
			mov ebx,eax
1256
			mov ebx,eax
1258
			inc ecx
1257
			inc ecx
1259
		.cell_nl:
1258
		.cell_nl:
1260
		cmp word[edi],'#P' ;ᬥ­  ¯®§¨æ¨¨
1259
		cmp word[edi],'#P' ;ᬥ­  ¯®§¨æ¨¨
1261
		jne .pos
1260
		jne .pos
1262
			inc edi ;¯à®¯ã᪠'#'
1261
			inc edi ;¯à®¯ã᪠'#'
1263
			.space:
1262
			.space:
1264
				inc edi ;¯à®¯ã᪠'P' ¨ ' '
1263
				inc edi ;¯à®¯ã᪠'P' ¨ ' '
1265
				cmp byte[edi],' '
1264
				cmp byte[edi],' '
1266
				je .space
1265
				je .space
1267
			stdcall conv_str_to_int,edi
1266
			stdcall conv_str_to_int,edi
1268
			mov ebx,eax
1267
			mov ebx,eax
1269
			cmp byte[edi],'-'
1268
			cmp byte[edi],'-'
1270
			jne .digit
1269
			jne .digit
1271
				inc edi
1270
				inc edi
1272
			.digit:
1271
			.digit:
1273
				cmp byte[edi],'0'
1272
				cmp byte[edi],'0'
1274
				jl .digit_no
1273
				jl .digit_no
1275
				cmp byte[edi],'9'
1274
				cmp byte[edi],'9'
1276
				jg .digit_no
1275
				jg .digit_no
1277
				inc edi
1276
				inc edi
1278
				jmp .digit
1277
				jmp .digit
1279
			.digit_no:
1278
			.digit_no:
1280
			;.space_1:
1279
			;.space_1:
1281
				inc edi ;¯à®¯ã᪠'P' ¨ ' '
1280
				inc edi ;¯à®¯ã᪠'P' ¨ ' '
1282
				cmp byte[edi],' '
1281
				cmp byte[edi],' '
1283
				je .digit_no ;.space_1
1282
				je .digit_no ;.space_1
1284
			stdcall conv_str_to_int,edi
1283
			stdcall conv_str_to_int,edi
1285
			mov ecx,eax
1284
			mov ecx,eax
1286
			mov eax,ebx ;¢®ááâ ­®¢«¥­¨¥ «¥¢®£® ®âáâ㯠 ¢ eax
1285
			mov eax,ebx ;¢®ááâ ­®¢«¥­¨¥ «¥¢®£® ®âáâ㯠 ¢ eax
1287
		.pos:
1286
		.pos:
1288
		inc edi
1287
		inc edi
1289
		cmp byte[edi],0
1288
		cmp byte[edi],0
1290
		jne @b
1289
		jne @b
1291
	;---
1290
	;---
1292
	stdcall [buf2d_clear], buf_0, [buf_0.color] ;ç¨á⨬ ¡ãä¥à
1291
	stdcall [buf2d_clear], buf_0, [buf_0.color] ;ç¨á⨬ ¡ãä¥à
1293
	call pole_paint ;à¨á㥬 ¯®«¥ (­  á«ãç © ¥á«¨ ¥áâì á¥âª  ¨«¨ ⥪áâ®¢ë¥ ¯®¤¯¨á¨)
1292
	call pole_paint ;à¨á㥬 ¯®«¥ (­  á«ãç © ¥á«¨ ¥áâì á¥âª  ¨«¨ ⥪áâ®¢ë¥ ¯®¤¯¨á¨)
1294
	stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
1293
	stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
1295
	.end_open_file:
1294
	.end_open_file:
1296
	popad
1295
	popad
1297
	ret
1296
	ret
1298
 
1297
 
1299
align 4
1298
align 4
1300
but_save_file:
1299
but_save_file:
1301
	ret
1300
	ret
1302
 
1301
 
1303
align 4
1302
align 4
1304
but_next_gen:
1303
but_next_gen:
1305
	call pole_next_gen
1304
	call pole_next_gen
1306
	call pole_paint
1305
	call pole_paint
1307
	stdcall [buf2d_draw], buf_0
1306
	stdcall [buf2d_draw], buf_0
1308
	pushad
1307
	pushad
1309
		call draw_pok
1308
		call draw_pok
1310
	popad
1309
	popad
1311
	ret
1310
	ret
1312
 
1311
 
1313
align 4
1312
align 4
1314
but_run:
1313
but_run:
1315
	mov byte[tim_ch],1
1314
	mov byte[tim_ch],1
1316
	ret
1315
	ret
1317
 
1316
 
1318
align 4
1317
align 4
1319
but_stop:
1318
but_stop:
1320
	mov byte[tim_ch],0
1319
	mov byte[tim_ch],0
1321
	;cld
1320
	;cld
1322
	;mov ecx,100
1321
	;mov ecx,100
1323
	;@@:
1322
	;@@:
1324
	;       call pole_next_gen
1323
	;       call pole_next_gen
1325
	;loop @b
1324
	;loop @b
1326
	;stdcall [buf2d_clear], buf_0, [buf_0.color]
1325
	;stdcall [buf2d_clear], buf_0, [buf_0.color]
1327
	;call pole_paint
1326
	;call pole_paint
1328
	;stdcall [buf2d_draw], buf_0
1327
	;stdcall [buf2d_draw], buf_0
1329
	ret
1328
	ret
1330
 
1329
 
1331
align 4
1330
align 4
1332
but_zoom_p:
1331
but_zoom_p:
1333
	cmp byte[zoom],16
1332
	cmp byte[zoom],16
1334
	jge @f
1333
	jge @f
1335
		pushad
1334
		pushad
1336
		;¢ëç¨á«¥­¨¥ ᤢ¨£®¢ ¤«ï ¯®«ï, ª®â®àë¥ ®¡¥á¯¥ç â 業â஢ªã ¯®«ï ¯à¨ 㢥«¨ç¥­¨¨ ¬ áèâ ¡ 
1335
		;¢ëç¨á«¥­¨¥ ᤢ¨£®¢ ¤«ï ¯®«ï, ª®â®àë¥ ®¡¥á¯¥ç â 業â஢ªã ¯®«ï ¯à¨ 㢥«¨ç¥­¨¨ ¬ áèâ ¡ 
1337
		xor ecx,ecx
1336
		xor ecx,ecx
1338
		mov cl,byte[zoom]
1337
		mov cl,byte[zoom]
1339
		xor edx,edx
1338
		xor edx,edx
1340
		mov eax,dword[buf_0.w]
1339
		mov eax,dword[buf_0.w]
1341
		shr eax,1 ;¢ eax ¯®«®¢¨­  è¨à¨­ë ¯®«ï
1340
		shr eax,1 ;¢ eax ¯®«®¢¨­  è¨à¨­ë ¯®«ï
1342
		mov ebx,eax ;¤¥« ¥¬ १¥à¢­ãî ª®¯¨î eax
1341
		mov ebx,eax ;¤¥« ¥¬ १¥à¢­ãî ª®¯¨î eax
1343
		div ecx ;¤¥«¨¬ eax ­  ⥪ã騩 ¬ áèâ ¡
1342
		div ecx ;¤¥«¨¬ eax ­  ⥪ã騩 ¬ áèâ ¡
1344
		xchg eax,ebx
1343
		xchg eax,ebx
1345
		xor edx,edx
1344
		xor edx,edx
1346
		inc ecx
1345
		inc ecx
1347
		div ecx ;¤¥«¨¬ eax ­  ­®¢ë© ¬ áèâ ¡
1346
		div ecx ;¤¥«¨¬ eax ­  ­®¢ë© ¬ áèâ ¡
1348
		sub ebx,eax ;¢ëç¨á«ï¥âáï ᤢ¨£ ¯®«ï ª®â®àë© ®¡¥á¯¥ç¨â 業â஢ªã ¯®«ï
1347
		sub ebx,eax ;¢ëç¨á«ï¥âáï ᤢ¨£ ¯®«ï ª®â®àë© ®¡¥á¯¥ç¨â 業â஢ªã ¯®«ï
1349
		sub dword[Cor_x],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ x
1348
		sub dword[Cor_x],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ x
1350
		xor ecx,ecx
1349
		xor ecx,ecx
1351
		mov cl,byte[zoom]
1350
		mov cl,byte[zoom]
1352
		xor edx,edx
1351
		xor edx,edx
1353
		mov eax,dword[buf_0.h]
1352
		mov eax,dword[buf_0.h]
1354
		shr eax,1
1353
		shr eax,1
1355
		mov ebx,eax
1354
		mov ebx,eax
1356
		div ecx
1355
		div ecx
1357
		xchg eax,ebx
1356
		xchg eax,ebx
1358
		xor edx,edx
1357
		xor edx,edx
1359
		inc ecx
1358
		inc ecx
1360
		div ecx
1359
		div ecx
1361
		sub ebx,eax
1360
		sub ebx,eax
1362
		sub dword[Cor_y],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ y
1361
		sub dword[Cor_y],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ y
1363
 
1362
 
1364
		inc byte[zoom]
1363
		inc byte[zoom]
1365
		;xor eax,eax
1364
		;xor eax,eax
1366
		;mov edi,txt_zoom.zi
1365
		;mov edi,txt_zoom.zi
1367
		;mov al,byte[zoom]
1366
		;mov al,byte[zoom]
1368
		;call tl_convert_to_str
1367
		;call tl_convert_to_str
1369
		call draw_pok
1368
		call draw_pok
1370
		popad
1369
		popad
1371
 
1370
 
1372
		cmp dword[poc_stop],1
1371
		cmp dword[poc_stop],1
1373
		jle .buf_clear
1372
		jle .buf_clear
1374
		cmp byte[tim_ch],0
1373
		cmp byte[tim_ch],0
1375
		jne @f
1374
		jne @f
1376
			.buf_clear:
1375
			.buf_clear:
1377
			stdcall [buf2d_clear], buf_0, [buf_0.color]
1376
			stdcall [buf2d_clear], buf_0, [buf_0.color]
1378
			call pole_paint
1377
			call pole_paint
1379
			stdcall [buf2d_draw], buf_0
1378
			stdcall [buf2d_draw], buf_0
1380
	@@:
1379
	@@:
1381
	ret
1380
	ret
1382
 
1381
 
1383
align 4
1382
align 4
1384
but_zoom_m:
1383
but_zoom_m:
1385
	cmp byte[zoom],1
1384
	cmp byte[zoom],1
1386
	jle @f
1385
	jle @f
1387
		pushad
1386
		pushad
1388
		;¢ëç¨á«¥­¨¥ ᤢ¨£®¢ ¤«ï ¯®«ï, ª®â®àë¥ ®¡¥á¯¥ç â 業â஢ªã ¯®«ï ¯à¨ 㬥­ì襭¨¨ ¬ áèâ ¡ 
1387
		;¢ëç¨á«¥­¨¥ ᤢ¨£®¢ ¤«ï ¯®«ï, ª®â®àë¥ ®¡¥á¯¥ç â 業â஢ªã ¯®«ï ¯à¨ 㬥­ì襭¨¨ ¬ áèâ ¡ 
1389
		xor ecx,ecx
1388
		xor ecx,ecx
1390
		mov cl,byte[zoom]
1389
		mov cl,byte[zoom]
1391
		xor edx,edx
1390
		xor edx,edx
1392
		mov eax,dword[buf_0.w]
1391
		mov eax,dword[buf_0.w]
1393
		shr eax,1 ;¢ eax ¯®«®¢¨­  è¨à¨­ë ¯®«ï
1392
		shr eax,1 ;¢ eax ¯®«®¢¨­  è¨à¨­ë ¯®«ï
1394
		mov ebx,eax ;¤¥« ¥¬ १¥à¢­ãî ª®¯¨î eax
1393
		mov ebx,eax ;¤¥« ¥¬ १¥à¢­ãî ª®¯¨î eax
1395
		div ecx ;¤¥«¨¬ eax ­  ⥪ã騩 ¬ áèâ ¡
1394
		div ecx ;¤¥«¨¬ eax ­  ⥪ã騩 ¬ áèâ ¡
1396
		xchg eax,ebx
1395
		xchg eax,ebx
1397
		xor edx,edx
1396
		xor edx,edx
1398
		dec ecx
1397
		dec ecx
1399
		div ecx ;¤¥«¨¬ eax ­  ­®¢ë© ¬ áèâ ¡
1398
		div ecx ;¤¥«¨¬ eax ­  ­®¢ë© ¬ áèâ ¡
1400
		sub ebx,eax ;¢ëç¨á«ï¥âáï ᤢ¨£ ¯®«ï ª®â®àë© ®¡¥á¯¥ç¨â 業â஢ªã ¯®«ï
1399
		sub ebx,eax ;¢ëç¨á«ï¥âáï ᤢ¨£ ¯®«ï ª®â®àë© ®¡¥á¯¥ç¨â 業â஢ªã ¯®«ï
1401
		sub dword[Cor_x],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ x
1400
		sub dword[Cor_x],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ x
1402
		xor ecx,ecx
1401
		xor ecx,ecx
1403
		mov cl,byte[zoom]
1402
		mov cl,byte[zoom]
1404
		xor edx,edx
1403
		xor edx,edx
1405
		mov eax,dword[buf_0.h]
1404
		mov eax,dword[buf_0.h]
1406
		shr eax,1
1405
		shr eax,1
1407
		mov ebx,eax
1406
		mov ebx,eax
1408
		div ecx
1407
		div ecx
1409
		xchg eax,ebx
1408
		xchg eax,ebx
1410
		xor edx,edx
1409
		xor edx,edx
1411
		dec ecx
1410
		dec ecx
1412
		div ecx
1411
		div ecx
1413
		sub ebx,eax
1412
		sub ebx,eax
1414
		sub dword[Cor_y],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ y
1413
		sub dword[Cor_y],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ y
1415
 
1414
 
1416
		dec byte[zoom]
1415
		dec byte[zoom]
1417
		;xor eax,eax
1416
		;xor eax,eax
1418
		;mov edi,txt_zoom.zi
1417
		;mov edi,txt_zoom.zi
1419
		;mov al,byte[zoom]
1418
		;mov al,byte[zoom]
1420
		;call tl_convert_to_str
1419
		;call tl_convert_to_str
1421
		call draw_pok
1420
		call draw_pok
1422
		popad
1421
		popad
1423
 
1422
 
1424
		cmp dword[poc_stop],1
1423
		cmp dword[poc_stop],1
1425
		jle .buf_clear
1424
		jle .buf_clear
1426
		cmp byte[tim_ch],0
1425
		cmp byte[tim_ch],0
1427
		jne @f
1426
		jne @f
1428
			.buf_clear:
1427
			.buf_clear:
1429
			stdcall [buf2d_clear], buf_0, [buf_0.color]
1428
			stdcall [buf2d_clear], buf_0, [buf_0.color]
1430
			call pole_paint
1429
			call pole_paint
1431
			stdcall [buf2d_draw], buf_0
1430
			stdcall [buf2d_draw], buf_0
1432
	@@:
1431
	@@:
1433
	ret
1432
	ret
1434
 
1433
 
1435
align 4
1434
align 4
1436
but_pole_up:
1435
but_pole_up:
1437
	push eax ecx edx
1436
	push eax ecx edx
1438
	mov eax,dword[buf_0.h]
1437
	mov eax,dword[buf_0.h]
1439
	shr eax,2
1438
	shr eax,2
1440
	xor ecx,ecx
1439
	xor ecx,ecx
1441
	mov cl,byte[zoom]
1440
	mov cl,byte[zoom]
1442
	cmp cx,2
1441
	cmp cx,2
1443
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1442
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1444
		xor edx,edx
1443
		xor edx,edx
1445
		div ecx
1444
		div ecx
1446
	@@:
1445
	@@:
1447
	add dword[Cor_y],eax
1446
	add dword[Cor_y],eax
1448
	pop edx ecx eax
1447
	pop edx ecx eax
1449
	stdcall [buf2d_clear], buf_0, [buf_0.color]
1448
	stdcall [buf2d_clear], buf_0, [buf_0.color]
1450
	call pole_paint
1449
	call pole_paint
1451
	stdcall [buf2d_draw], buf_0
1450
	stdcall [buf2d_draw], buf_0
1452
	ret
1451
	ret
1453
 
1452
 
1454
align 4
1453
align 4
1455
but_pole_dn:
1454
but_pole_dn:
1456
	push eax ecx edx
1455
	push eax ecx edx
1457
	mov eax,dword[buf_0.h]
1456
	mov eax,dword[buf_0.h]
1458
	shr eax,2
1457
	shr eax,2
1459
	xor ecx,ecx
1458
	xor ecx,ecx
1460
	mov cl,byte[zoom]
1459
	mov cl,byte[zoom]
1461
	cmp cx,2
1460
	cmp cx,2
1462
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1461
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1463
		xor edx,edx
1462
		xor edx,edx
1464
		div ecx
1463
		div ecx
1465
	@@:
1464
	@@:
1466
	sub dword[Cor_y],eax
1465
	sub dword[Cor_y],eax
1467
	pop edx ecx eax
1466
	pop edx ecx eax
1468
	stdcall [buf2d_clear], buf_0, [buf_0.color]
1467
	stdcall [buf2d_clear], buf_0, [buf_0.color]
1469
	call pole_paint
1468
	call pole_paint
1470
	stdcall [buf2d_draw], buf_0
1469
	stdcall [buf2d_draw], buf_0
1471
	ret
1470
	ret
1472
 
1471
 
1473
align 4
1472
align 4
1474
but_pole_left:
1473
but_pole_left:
1475
	push eax ecx edx
1474
	push eax ecx edx
1476
	mov eax,dword[buf_0.w]
1475
	mov eax,dword[buf_0.w]
1477
	shr eax,2
1476
	shr eax,2
1478
	xor ecx,ecx
1477
	xor ecx,ecx
1479
	mov cl,byte[zoom]
1478
	mov cl,byte[zoom]
1480
	cmp cx,2
1479
	cmp cx,2
1481
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1480
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1482
		xor edx,edx
1481
		xor edx,edx
1483
		div ecx
1482
		div ecx
1484
	@@:
1483
	@@:
1485
	add dword[Cor_x],eax
1484
	add dword[Cor_x],eax
1486
	pop edx ecx eax
1485
	pop edx ecx eax
1487
	stdcall [buf2d_clear], buf_0, [buf_0.color]
1486
	stdcall [buf2d_clear], buf_0, [buf_0.color]
1488
	call pole_paint
1487
	call pole_paint
1489
	stdcall [buf2d_draw], buf_0
1488
	stdcall [buf2d_draw], buf_0
1490
	ret
1489
	ret
1491
 
1490
 
1492
align 4
1491
align 4
1493
but_pole_right:
1492
but_pole_right:
1494
	push eax ecx edx
1493
	push eax ecx edx
1495
	mov eax,dword[buf_0.w]
1494
	mov eax,dword[buf_0.w]
1496
	shr eax,2
1495
	shr eax,2
1497
	xor ecx,ecx
1496
	xor ecx,ecx
1498
	mov cl,byte[zoom]
1497
	mov cl,byte[zoom]
1499
	cmp cx,2
1498
	cmp cx,2
1500
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1499
	jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
1501
		xor edx,edx
1500
		xor edx,edx
1502
		div ecx
1501
		div ecx
1503
	@@:
1502
	@@:
1504
	sub dword[Cor_x],eax
1503
	sub dword[Cor_x],eax
1505
	pop edx ecx eax
1504
	pop edx ecx eax
1506
	stdcall [buf2d_clear], buf_0, [buf_0.color]
1505
	stdcall [buf2d_clear], buf_0, [buf_0.color]
1507
	call pole_paint
1506
	call pole_paint
1508
	stdcall [buf2d_draw], buf_0
1507
	stdcall [buf2d_draw], buf_0
1509
	ret
1508
	ret
1510
 
1509
 
1511
;align 4
1510
;align 4
1512
;but_bru_clear:
1511
;but_bru_clear:
1513
;        ret
1512
;        ret
1514
 
1513
 
1515
;input:
1514
;input:
1516
; buf - 㪠§ â¥«ì ­  áâபã, ç¨á«® ¤®«¦­® ¡ëâì ¢ 10 ¨«¨ 16 à¨ç­®¬ ¢¨¤¥
1515
; buf - 㪠§ â¥«ì ­  áâபã, ç¨á«® ¤®«¦­® ¡ëâì ¢ 10 ¨«¨ 16 à¨ç­®¬ ¢¨¤¥
1517
;output:
1516
;output:
1518
; eax - ç¨á«®
1517
; eax - ç¨á«®
1519
align 4
1518
align 4
1520
proc conv_str_to_int, buf:dword
1519
proc conv_str_to_int, buf:dword
1521
	xor eax,eax
1520
	xor eax,eax
1522
	push ebx ecx esi
1521
	push ebx ecx esi
1523
	xor ebx,ebx
1522
	xor ebx,ebx
1524
	mov esi,[buf]
1523
	mov esi,[buf]
1525
	;®¯à¥¤¥«¥­¨¥ ®âà¨æ â¥«ì­ëå ç¨á¥«
1524
	;®¯à¥¤¥«¥­¨¥ ®âà¨æ â¥«ì­ëå ç¨á¥«
1526
	xor ecx,ecx
1525
	xor ecx,ecx
1527
	inc ecx
1526
	inc ecx
1528
	cmp byte[esi],'-'
1527
	cmp byte[esi],'-'
1529
	jne @f
1528
	jne @f
1530
		dec ecx
1529
		dec ecx
1531
		inc esi
1530
		inc esi
1532
	@@:
1531
	@@:
1533
 
1532
 
1534
	cmp word[esi],'0x'
1533
	cmp word[esi],'0x'
1535
	je .load_digit_16
1534
	je .load_digit_16
1536
 
1535
 
1537
	.load_digit_10: ;áç¨â뢠­¨¥ 10-â¨ç­ëå æ¨äà
1536
	.load_digit_10: ;áç¨â뢠­¨¥ 10-â¨ç­ëå æ¨äà
1538
		mov bl,byte[esi]
1537
		mov bl,byte[esi]
1539
		cmp bl,'0'
1538
		cmp bl,'0'
1540
		jl @f
1539
		jl @f
1541
		cmp bl,'9'
1540
		cmp bl,'9'
1542
		jg @f
1541
		jg @f
1543
			sub bl,'0'
1542
			sub bl,'0'
1544
			imul eax,10
1543
			imul eax,10
1545
			add eax,ebx
1544
			add eax,ebx
1546
			inc esi
1545
			inc esi
1547
			jmp .load_digit_10
1546
			jmp .load_digit_10
1548
	jmp @f
1547
	jmp @f
1549
 
1548
 
1550
	.load_digit_16: ;áç¨â뢠­¨¥ 16-à¨ç­ëå æ¨äà
1549
	.load_digit_16: ;áç¨â뢠­¨¥ 16-à¨ç­ëå æ¨äà
1551
		add esi,2
1550
		add esi,2
1552
	.cycle_16:
1551
	.cycle_16:
1553
		mov bl,byte[esi]
1552
		mov bl,byte[esi]
1554
		cmp bl,'0'
1553
		cmp bl,'0'
1555
		jl @f
1554
		jl @f
1556
		cmp bl,'f'
1555
		cmp bl,'f'
1557
		jg @f
1556
		jg @f
1558
		cmp bl,'9'
1557
		cmp bl,'9'
1559
		jle .us1
1558
		jle .us1
1560
			cmp bl,'A'
1559
			cmp bl,'A'
1561
			jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'9' ¨ <'A'
1560
			jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'9' ¨ <'A'
1562
		.us1: ;á®áâ ¢­®¥ ãá«®¢¨¥
1561
		.us1: ;á®áâ ¢­®¥ ãá«®¢¨¥
1563
		cmp bl,'F'
1562
		cmp bl,'F'
1564
		jle .us2
1563
		jle .us2
1565
			cmp bl,'a'
1564
			cmp bl,'a'
1566
			jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'F' ¨ <'a'
1565
			jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'F' ¨ <'a'
1567
			sub bl,32 ;¯¥à¥¢®¤¨¬ ᨬ¢®«ë ¢ ¢¥àå­¨© ॣ¨áâà, ¤«ï ã¯à®é¥­¨ï ¨å ¯®á«¥¤ã饩 ®¡à ¡®âª¨
1566
			sub bl,32 ;¯¥à¥¢®¤¨¬ ᨬ¢®«ë ¢ ¢¥àå­¨© ॣ¨áâà, ¤«ï ã¯à®é¥­¨ï ¨å ¯®á«¥¤ã饩 ®¡à ¡®âª¨
1568
		.us2: ;á®áâ ¢­®¥ ãá«®¢¨¥
1567
		.us2: ;á®áâ ¢­®¥ ãá«®¢¨¥
1569
			sub bl,'0'
1568
			sub bl,'0'
1570
			cmp bl,9
1569
			cmp bl,9
1571
			jle .cor1
1570
			jle .cor1
1572
				sub bl,7 ;convert 'A' to '10'
1571
				sub bl,7 ;convert 'A' to '10'
1573
			.cor1:
1572
			.cor1:
1574
			shl eax,4
1573
			shl eax,4
1575
			add eax,ebx
1574
			add eax,ebx
1576
			inc esi
1575
			inc esi
1577
			jmp .cycle_16
1576
			jmp .cycle_16
1578
	@@:
1577
	@@:
1579
	cmp ecx,0 ;¥á«¨ ç¨á«® ®âà¨æ â¥«ì­®¥
1578
	cmp ecx,0 ;¥á«¨ ç¨á«® ®âà¨æ â¥«ì­®¥
1580
	jne @f
1579
	jne @f
1581
		sub ecx,eax
1580
		sub ecx,eax
1582
		mov eax,ecx
1581
		mov eax,ecx
1583
	@@:
1582
	@@:
1584
	pop esi ecx ebx
1583
	pop esi ecx ebx
1585
	ret
1584
	ret
1586
endp
1585
endp
1587
 
1586
 
1588
;¤ ­­ë¥ ¤«ï ¤¨ «®£  ®âªàëâ¨ï ä ©«®¢
1587
;¤ ­­ë¥ ¤«ï ¤¨ «®£  ®âªàëâ¨ï ä ©«®¢
1589
align 4
1588
align 4
1590
OpenDialog_data:
1589
OpenDialog_data:
1591
.type			dd 0 ;0 - ®âªàëâì, 1 - á®åà ­¨âì, 2 - ¢ë¡à âì ¤â४â®à¨î
1590
.type			dd 0 ;0 - ®âªàëâì, 1 - á®åà ­¨âì, 2 - ¢ë¡à âì ¤â४â®à¨î
1592
.procinfo		dd procinfo	;+4
1591
.procinfo		dd procinfo	;+4
1593
.com_area_name		dd communication_area_name	;+8
1592
.com_area_name		dd communication_area_name	;+8
1594
.com_area		dd 0	;+12
1593
.com_area		dd 0	;+12
1595
.opendir_path		dd plugin_path	;+16
1594
.opendir_path		dd plugin_path	;+16
1596
.dir_default_path	dd default_dir ;+20
1595
.dir_default_path	dd default_dir ;+20
1597
.start_path		dd file_name ;+24 ¯ãâì ª ¤¨ «®£ã ®âªàëâ¨ï ä ©«®¢
1596
.start_path		dd file_name ;+24 ¯ãâì ª ¤¨ «®£ã ®âªàëâ¨ï ä ©«®¢
1598
.draw_window		dd draw_window	;+28
1597
.draw_window		dd draw_window	;+28
1599
.status 		dd 0	;+32
1598
.status 		dd 0	;+32
1600
.openfile_path		dd openfile_path	;+36 ¯ãâì ª ®âªà뢠¥¬®¬ã ä ©«ã
1599
.openfile_path		dd openfile_path	;+36 ¯ãâì ª ®âªà뢠¥¬®¬ã ä ©«ã
1601
.filename_area		dd filename_area	;+40
1600
.filename_area		dd filename_area	;+40
1602
.filter_area		dd Filter
1601
.filter_area		dd Filter
1603
.x:
1602
.x:
1604
.x_size 		dw 420 ;+48 ; Window X size
1603
.x_size 		dw 420 ;+48 ; Window X size
1605
.x_start		dw 10 ;+50 ; Window X position
1604
.x_start		dw 10 ;+50 ; Window X position
1606
.y:
1605
.y:
1607
.y_size 		dw 320 ;+52 ; Window y size
1606
.y_size 		dw 320 ;+52 ; Window y size
1608
.y_start		dw 10 ;+54 ; Window Y position
1607
.y_start		dw 10 ;+54 ; Window Y position
1609
 
1608
 
1610
default_dir db '/rd/1',0
1609
default_dir db '/rd/1',0
1611
 
1610
 
1612
communication_area_name:
1611
communication_area_name:
1613
	db 'FFFFFFFF_open_dialog',0
1612
	db 'FFFFFFFF_open_dialog',0
1614
open_dialog_name:
1613
open_dialog_name:
1615
	db 'opendial',0
1614
	db 'opendial',0
1616
communication_area_default_path:
1615
communication_area_default_path:
1617
	db '/rd/1/File managers/',0
1616
	db '/rd/1/File managers/',0
1618
 
1617
 
1619
Filter:
1618
Filter:
1620
dd Filter.end - Filter ;.1
1619
dd Filter.end - Filter ;.1
1621
.1:
1620
.1:
1622
db 'LIF',0
1621
db 'LIF',0
1623
db 'RLE',0
1622
db 'RLE',0
1624
.end:
1623
.end:
1625
db 0
1624
db 0
1626
 
1625
 
1627
 
1626
 
1628
 
1627
 
1629
head_f_i:
1628
head_f_i:
1630
head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0
1629
head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0
1631
 
1630
 
1632
system_dir_0 db '/sys/lib/'
1631
system_dir_0 db '/sys/lib/'
1633
lib_name_0 db 'proc_lib.obj',0
1632
lib_name_0 db 'proc_lib.obj',0
1634
err_message_found_lib_0 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'proc_lib.obj',39,0
1633
err_message_found_lib_0 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'proc_lib.obj',39,0
1635
err_message_import_0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'proc_lib.obj',39,0
1634
err_message_import_0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'proc_lib.obj',39,0
1636
 
1635
 
1637
system_dir_1 db '/sys/lib/'
1636
system_dir_1 db '/sys/lib/'
1638
lib_name_1 db 'libimg.obj',0
1637
lib_name_1 db 'libimg.obj',0
1639
err_message_found_lib_1 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,0
1638
err_message_found_lib_1 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,0
1640
err_message_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,0
1639
err_message_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,0
1641
 
1640
 
1642
system_dir_7 db '/sys/lib/'
1641
system_dir_7 db '/sys/lib/'
1643
lib_name_7 db 'buf2d.obj',0
1642
lib_name_7 db 'buf2d.obj',0
1644
err_msg_found_lib_7 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,0
1643
err_msg_found_lib_7 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,0
1645
err_msg_import_7 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,0
1644
err_msg_import_7 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,0
1646
 
1645
 
1647
l_libs_start:
1646
l_libs_start:
1648
	lib0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\
1647
	lib0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\
1649
		err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i
1648
		err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i
1650
	lib1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\
1649
	lib1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\
1651
		err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i
1650
		err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i
1652
	lib_7 l_libs lib_name_7, sys_path, library_path, system_dir_7,\
1651
	lib_7 l_libs lib_name_7, sys_path, library_path, system_dir_7,\
1653
		err_msg_found_lib_7,head_f_l,import_buf2d,err_msg_import_7,head_f_i
1652
		err_msg_found_lib_7,head_f_l,import_buf2d,err_msg_import_7,head_f_i
1654
l_libs_end:
1653
l_libs_end:
1655
 
1654
 
1656
align 4
1655
align 4
1657
import_libimg:
1656
import_libimg:
1658
	dd alib_init1
1657
	dd alib_init1
1659
	img_is_img  dd aimg_is_img
1658
	img_is_img  dd aimg_is_img
1660
	img_info    dd aimg_info
1659
	img_info    dd aimg_info
1661
	img_from_file dd aimg_from_file
1660
	img_from_file dd aimg_from_file
1662
	img_to_file dd aimg_to_file
1661
	img_to_file dd aimg_to_file
1663
	img_from_rgb dd aimg_from_rgb
1662
	img_from_rgb dd aimg_from_rgb
1664
	img_to_rgb  dd aimg_to_rgb
1663
	img_to_rgb  dd aimg_to_rgb
1665
	img_to_rgb2 dd aimg_to_rgb2
1664
	img_to_rgb2 dd aimg_to_rgb2
1666
	img_decode  dd aimg_decode
1665
	img_decode  dd aimg_decode
1667
	img_encode  dd aimg_encode
1666
	img_encode  dd aimg_encode
1668
	img_create  dd aimg_create
1667
	img_create  dd aimg_create
1669
	img_destroy dd aimg_destroy
1668
	img_destroy dd aimg_destroy
1670
	img_destroy_layer dd aimg_destroy_layer
1669
	img_destroy_layer dd aimg_destroy_layer
1671
	img_count   dd aimg_count
1670
	img_count   dd aimg_count
1672
	img_lock_bits dd aimg_lock_bits
1671
	img_lock_bits dd aimg_lock_bits
1673
	img_unlock_bits dd aimg_unlock_bits
1672
	img_unlock_bits dd aimg_unlock_bits
1674
	img_flip    dd aimg_flip
1673
	img_flip    dd aimg_flip
1675
	img_flip_layer dd aimg_flip_layer
1674
	img_flip_layer dd aimg_flip_layer
1676
	img_rotate  dd aimg_rotate
1675
	img_rotate  dd aimg_rotate
1677
	img_rotate_layer dd aimg_rotate_layer
1676
	img_rotate_layer dd aimg_rotate_layer
1678
	img_draw    dd aimg_draw
1677
	img_draw    dd aimg_draw
1679
 
1678
 
1680
	dd 0,0
1679
	dd 0,0
1681
	alib_init1   db 'lib_init',0
1680
	alib_init1   db 'lib_init',0
1682
	aimg_is_img  db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
1681
	aimg_is_img  db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
1683
	aimg_info    db 'img_info',0
1682
	aimg_info    db 'img_info',0
1684
	aimg_from_file db 'img_from_file',0
1683
	aimg_from_file db 'img_from_file',0
1685
	aimg_to_file db 'img_to_file',0
1684
	aimg_to_file db 'img_to_file',0
1686
	aimg_from_rgb db 'img_from_rgb',0
1685
	aimg_from_rgb db 'img_from_rgb',0
1687
	aimg_to_rgb  db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
1686
	aimg_to_rgb  db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
1688
	aimg_to_rgb2 db 'img_to_rgb2',0
1687
	aimg_to_rgb2 db 'img_to_rgb2',0
1689
	aimg_decode  db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
1688
	aimg_decode  db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
1690
	aimg_encode  db 'img_encode',0
1689
	aimg_encode  db 'img_encode',0
1691
	aimg_create  db 'img_create',0
1690
	aimg_create  db 'img_create',0
1692
	aimg_destroy db 'img_destroy',0
1691
	aimg_destroy db 'img_destroy',0
1693
	aimg_destroy_layer db 'img_destroy_layer',0
1692
	aimg_destroy_layer db 'img_destroy_layer',0
1694
	aimg_count   db 'img_count',0
1693
	aimg_count   db 'img_count',0
1695
	aimg_lock_bits db 'img_lock_bits',0
1694
	aimg_lock_bits db 'img_lock_bits',0
1696
	aimg_unlock_bits db 'img_unlock_bits',0
1695
	aimg_unlock_bits db 'img_unlock_bits',0
1697
	aimg_flip    db 'img_flip',0
1696
	aimg_flip    db 'img_flip',0
1698
	aimg_flip_layer db 'img_flip_layer',0
1697
	aimg_flip_layer db 'img_flip_layer',0
1699
	aimg_rotate  db 'img_rotate',0
1698
	aimg_rotate  db 'img_rotate',0
1700
	aimg_rotate_layer db 'img_rotate_layer',0
1699
	aimg_rotate_layer db 'img_rotate_layer',0
1701
	aimg_draw    db 'img_draw',0
1700
	aimg_draw    db 'img_draw',0
1702
 
1701
 
1703
align 4
1702
align 4
1704
proclib_import: ;®¯¨á ­¨¥ íªá¯®àâ¨à㥬ëå ä㭪権
1703
proclib_import: ;®¯¨á ­¨¥ íªá¯®àâ¨à㥬ëå ä㭪権
1705
	OpenDialog_Init dd aOpenDialog_Init
1704
	OpenDialog_Init dd aOpenDialog_Init
1706
	OpenDialog_Start dd aOpenDialog_Start
1705
	OpenDialog_Start dd aOpenDialog_Start
1707
dd 0,0
1706
dd 0,0
1708
	aOpenDialog_Init db 'OpenDialog_init',0
1707
	aOpenDialog_Init db 'OpenDialog_init',0
1709
	aOpenDialog_Start db 'OpenDialog_start',0
1708
	aOpenDialog_Start db 'OpenDialog_start',0
1710
 
1709
 
1711
align 4
1710
align 4
1712
import_buf2d:
1711
import_buf2d:
1713
	init dd sz_init
1712
	init dd sz_init
1714
	buf2d_create dd sz_buf2d_create
1713
	buf2d_create dd sz_buf2d_create
1715
	buf2d_create_f_img dd sz_buf2d_create_f_img
1714
	buf2d_create_f_img dd sz_buf2d_create_f_img
1716
	buf2d_clear dd sz_buf2d_clear
1715
	buf2d_clear dd sz_buf2d_clear
1717
	buf2d_draw dd sz_buf2d_draw
1716
	buf2d_draw dd sz_buf2d_draw
1718
	buf2d_delete dd sz_buf2d_delete
1717
	buf2d_delete dd sz_buf2d_delete
1719
	buf2d_line dd sz_buf2d_line
1718
	buf2d_line dd sz_buf2d_line
1720
	buf2d_rect_by_size dd sz_buf2d_rect_by_size
1719
	buf2d_rect_by_size dd sz_buf2d_rect_by_size
1721
	buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
1720
	buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
1722
	buf2d_circle dd sz_buf2d_circle
1721
	buf2d_circle dd sz_buf2d_circle
1723
	buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
1722
	buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
1724
	buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
1723
	buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
1725
	buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
1724
	buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
1726
	buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
1725
	buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
1727
	buf2d_bit_blt dd sz_buf2d_bit_blt
1726
	buf2d_bit_blt dd sz_buf2d_bit_blt
1728
	buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
1727
	buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
1729
	buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
1728
	buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
1730
	buf2d_curve_bezier dd sz_buf2d_curve_bezier
1729
	buf2d_curve_bezier dd sz_buf2d_curve_bezier
1731
	buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
1730
	buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
1732
	buf2d_draw_text dd sz_buf2d_draw_text
1731
	buf2d_draw_text dd sz_buf2d_draw_text
1733
	buf2d_crop_color dd sz_buf2d_crop_color
1732
	buf2d_crop_color dd sz_buf2d_crop_color
1734
	buf2d_offset_h dd sz_buf2d_offset_h
1733
	buf2d_offset_h dd sz_buf2d_offset_h
1735
	buf2d_flood_fill dd sz_buf2d_flood_fill
1734
	buf2d_flood_fill dd sz_buf2d_flood_fill
1736
	buf2d_set_pixel dd sz_buf2d_set_pixel
1735
	buf2d_set_pixel dd sz_buf2d_set_pixel
1737
	dd 0,0
1736
	dd 0,0
1738
	sz_init db 'lib_init',0
1737
	sz_init db 'lib_init',0
1739
	sz_buf2d_create db 'buf2d_create',0
1738
	sz_buf2d_create db 'buf2d_create',0
1740
	sz_buf2d_create_f_img db 'buf2d_create_f_img',0
1739
	sz_buf2d_create_f_img db 'buf2d_create_f_img',0
1741
	sz_buf2d_clear db 'buf2d_clear',0
1740
	sz_buf2d_clear db 'buf2d_clear',0
1742
	sz_buf2d_draw db 'buf2d_draw',0
1741
	sz_buf2d_draw db 'buf2d_draw',0
1743
	sz_buf2d_delete db 'buf2d_delete',0
1742
	sz_buf2d_delete db 'buf2d_delete',0
1744
	sz_buf2d_line db 'buf2d_line',0
1743
	sz_buf2d_line db 'buf2d_line',0
1745
	sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
1744
	sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
1746
	sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
1745
	sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
1747
	sz_buf2d_circle db 'buf2d_circle',0
1746
	sz_buf2d_circle db 'buf2d_circle',0
1748
	sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
1747
	sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
1749
	sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
1748
	sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
1750
	sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
1749
	sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
1751
	sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
1750
	sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
1752
	sz_buf2d_bit_blt db 'buf2d_bit_blt',0
1751
	sz_buf2d_bit_blt db 'buf2d_bit_blt',0
1753
	sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
1752
	sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
1754
	sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
1753
	sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
1755
	sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
1754
	sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
1756
	sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
1755
	sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
1757
	sz_buf2d_draw_text db 'buf2d_draw_text',0
1756
	sz_buf2d_draw_text db 'buf2d_draw_text',0
1758
	sz_buf2d_crop_color db 'buf2d_crop_color',0
1757
	sz_buf2d_crop_color db 'buf2d_crop_color',0
1759
	sz_buf2d_offset_h db 'buf2d_offset_h',0
1758
	sz_buf2d_offset_h db 'buf2d_offset_h',0
1760
	sz_buf2d_flood_fill db 'buf2d_flood_fill',0
1759
	sz_buf2d_flood_fill db 'buf2d_flood_fill',0
1761
	sz_buf2d_set_pixel db 'buf2d_set_pixel',0
1760
	sz_buf2d_set_pixel db 'buf2d_set_pixel',0
1762
 
1761
 
1763
mouse_dd dd 0x0
1762
mouse_dd dd 0x0
1764
sc system_colors 
1763
sc system_colors 
1765
last_time dd 0
1764
last_time dd 0
1766
 
1765
 
1767
align 16
1766
align 16
1768
procinfo process_information 
1767
procinfo process_information 
1769
 
1768
 
1770
align 4
1769
align 4
1771
buf_0: dd 0 ;a? § a?«i ­  ?aa?a ?§®?a ¦?­?i
1770
buf_0: dd 0 ;a? § a?«i ­  ?aa?a ?§®?a ¦?­?i
1772
	dw 5 ;+4 left
1771
	dw 5 ;+4 left
1773
	dw 35 ;+6 top
1772
	dw 35 ;+6 top
1774
.w: dd 460 ;+8 w
1773
.w: dd 460 ;+8 w
1775
.h: dd 340 ;+12 h
1774
.h: dd 340 ;+12 h
1776
.color: dd 0xffffd0 ;+16 color
1775
.color: dd 0xffffd0 ;+16 color
1777
	db 24 ;+20 bit in pixel
1776
	db 24 ;+20 bit in pixel
1778
 
1777
 
1779
;íâ®â ª®¤ ­¥ ¬®©, ®­ ¯à¥®¡à §ã¥â ç¨á«® ¢ áâபã
1778
;íâ®â ª®¤ ­¥ ¬®©, ®­ ¯à¥®¡à §ã¥â ç¨á«® ¢ áâபã
1780
;input:
1779
;input:
1781
; eax = value
1780
; eax = value
1782
; edi = string buffer
1781
; edi = string buffer
1783
;output:
1782
;output:
1784
align 4
1783
align 4
1785
tl_convert_to_str:
1784
tl_convert_to_str:
1786
	pushad
1785
	pushad
1787
		mov dword[edi+1],0
1786
		mov dword[edi+1],0
1788
		call .str
1787
		call .str
1789
	popad
1788
	popad
1790
	ret
1789
	ret
1791
 
1790
 
1792
align 4
1791
align 4
1793
.str:
1792
.str:
1794
	mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï ¨§¬¥­ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
1793
	mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï ¨§¬¥­ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
1795
    ;¯à¥à¥¢®¤ ç¨á«  ¢ ASCII áâப㠢§®¤­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­ï edi  ¤à¥á ªã¤  § ¯¨á뢠âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®© 
1794
    ;¯à¥à¥¢®¤ ç¨á«  ¢ ASCII áâப㠢§®¤­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­ï edi  ¤à¥á ªã¤  § ¯¨á뢠âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®© 
1796
	cmp eax,ecx  ;áà ¢­¨âì ¥á«¨ ¢ eax ¬¥­ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
1795
	cmp eax,ecx  ;áà ¢­¨âì ¥á«¨ ¢ eax ¬¥­ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
1797
	jb @f
1796
	jb @f
1798
		xor edx,edx  ;®ç¨áâ¨âì edx
1797
		xor edx,edx  ;®ç¨áâ¨âì edx
1799
		div ecx      ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
1798
		div ecx      ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
1800
		push edx     ;¯®«®¦¨âì ¢ á⥪
1799
		push edx     ;¯®«®¦¨âì ¢ á⥪
1801
		;dec edi             ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
1800
		;dec edi             ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
1802
		call .str ;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
1801
		call .str ;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
1803
		pop eax
1802
		pop eax
1804
	@@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
1803
	@@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
1805
	or al,0x30  ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥  祬 ¤¢¥ ¢ëè¥
1804
	or al,0x30  ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥  祬 ¤¢¥ ¢ëè¥
1806
	stosb	    ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祪㠯 ¬ï⨠es:edi
1805
	stosb	    ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祪㠯 ¬ï⨠es:edi
1807
	ret	      ;¢¥à­ãâìáï ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
1806
	ret	      ;¢¥à­ãâìáï ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
1808
 
1807
 
1809
i_end:
1808
i_end:
1810
	rb 1024
1809
	rb 1024
1811
stacktop:
1810
stacktop:
1812
	sys_path rb 1024
1811
	sys_path rb 1024
1813
	file_name:
1812
	file_name:
1814
		rb 1024 ;4096 
1813
		rb 1024 ;4096 
1815
	library_path rb 1024
1814
	library_path rb 1024
1816
	plugin_path rb 4096
1815
	plugin_path rb 4096
1817
	openfile_path rb 4096
1816
	openfile_path rb 4096
1818
	filename_area rb 256
1817
	filename_area rb 256
1819
mem:
1818
mem:
1820
>
1819
>
1821
>
1820
>
1822
 
1821
 
1823
>
1822
>
1824
 
1823
 
1825
>
1824
>
1826
>
1825
>
1827
>
1826
>
1828
>
1827
>
1829
>
1828
>
1830
>
1829
>
1831
>
1830
>
1832
>
1831
>
1833
>
1832
>
1834
>
1833
>
1835
>
1834
>
1836
>
1835
>