Subversion Repositories Kolibri OS

Rev

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

Rev 255 Rev 485
1
;----------------------------------------------------------
1
;----------------------------------------------------------
2
;--------Move picture from array to work screeen-----------
2
;--------Move picture from array to work screeen-----------
3
;----------------------------------------------------------
3
;----------------------------------------------------------
4
MovePictureToWorkScreen:
4
MovePictureToWorkScreen:
5
 
5
 
6
	call cleare_screen
6
	call cleare_screen
7
 
7
 
8
	mov eax,[Picture_SizeX]
8
	mov eax,[Picture_SizeX]
9
	mov ebx,[Picture_SizeY]
9
	mov ebx,[Picture_SizeY]
10
	mov ecx,[MaxWorkScreen_SizeX]
10
	mov ecx,[MaxWorkScreen_SizeX]
11
	mov edx,[MaxWorkScreen_SizeY]
11
	mov edx,[MaxWorkScreen_SizeY]
12
	mov esi,[k]
12
	mov esi,[k]
13
	imul eax,esi
13
	imul eax,esi
14
	imul ebx,esi
14
	imul ebx,esi
15
 
15
 
16
	cmp eax,ecx
16
	cmp eax,ecx
17
	jle lab1
17
	jle lab1
18
	mov eax,[MaxWorkScreen_SizeX]
18
	mov eax,[MaxWorkScreen_SizeX]
19
	mov [WorkScreen_SizeX],eax
19
	mov [WorkScreen_SizeX],eax
20
	jmp lab2
20
	jmp lab2
21
	lab1:
21
	lab1:
22
	mov [WorkScreen_SizeX],eax
22
	mov [WorkScreen_SizeX],eax
23
	lab2:
23
	lab2:
24
 
24
 
25
	cmp ebx,edx
25
	cmp ebx,edx
26
	jle lab3
26
	jle lab3
27
	mov ebx,[MaxWorkScreen_SizeY]
27
	mov ebx,[MaxWorkScreen_SizeY]
28
	mov [WorkScreen_SizeY],ebx
28
	mov [WorkScreen_SizeY],ebx
29
	jmp lab4
29
	jmp lab4
30
	lab3:
30
	lab3:
31
	mov [WorkScreen_SizeY],ebx
31
	mov [WorkScreen_SizeY],ebx
32
	lab4:
32
	lab4:
33
 
33
 
34
	mov eax,[WorkScreen_SizeX]
34
	mov eax,[WorkScreen_SizeX]
35
	mov ebx,[k]
35
	mov ebx,[k]
36
	cdq
36
	cdq
37
	idiv ebx
37
	idiv ebx
38
	mov [CounterX],eax
38
	mov [CounterX],eax
39
	mov eax,[WorkScreen_SizeY]
39
	mov eax,[WorkScreen_SizeY]
40
	cdq
40
	cdq
41
	idiv ebx
41
	idiv ebx
42
	mov [CounterY],eax
42
	mov [CounterY],eax
43
 
43
 
44
	mov eax,[WorkScreen_SizeX]
44
	mov eax,[WorkScreen_SizeX]
45
	mov ecx,eax
45
	mov ecx,eax
46
	mov ebx,[k]
46
	mov ebx,[k]
47
	cdq
47
	cdq
48
	idiv ebx
48
	idiv ebx
49
	imul eax,ebx
49
	imul eax,ebx
50
	sub ecx,eax
50
	sub ecx,eax
51
	lea ecx,[ecx+ecx*2]
51
	lea ecx,[ecx+ecx*2]
52
	;
52
	;
53
	mov eax,[WorkScreen_SizeX]
53
	mov eax,[WorkScreen_SizeX]
54
	mov ebx,[k]
54
	mov ebx,[k]
55
	dec ebx
55
	dec ebx
56
	imul eax,ebx
56
	imul eax,ebx
57
	lea eax,[eax+eax*2]
57
	lea eax,[eax+eax*2]
58
	add eax,ecx
58
	add eax,ecx
59
	mov [OffsetYWorkScreen],eax
59
	mov [OffsetYWorkScreen],eax
60
 
60
 
61
 
61
 
62
	mov ebx,[Picture_SizeX]
62
	mov ebx,[Picture_SizeX]
63
	mov eax,[CounterX]
63
	mov eax,[CounterX]
64
	sub ebx,eax
64
	sub ebx,eax
65
	lea ebx,[ebx+ebx*2]
65
	lea ebx,[ebx+ebx*2]
66
	mov [OffsetYPicture],ebx
66
	mov [OffsetYPicture],ebx
67
 
67
 
68
	mov eax,[WorkScreen_SizeX]
68
	mov eax,[WorkScreen_SizeX]
69
	mov ebx,[k]
69
	mov ebx,[k]
70
	sub eax,ebx
70
	sub eax,ebx
71
	lea eax,[eax+eax*2]
71
	lea eax,[eax+eax*2]
72
	mov [OffsetYBigPixel],eax
72
	mov [OffsetYBigPixel],eax
73
 
73
 
74
	mov eax,[PosX]
74
	mov eax,[PosX]
75
	mov ebx,[PosY]
75
	mov ebx,[PosY]
76
	mov ecx,[Picture_SizeX]
76
	mov ecx,[Picture_SizeX]
77
	imul ecx,ebx
77
	imul ecx,ebx
78
	add eax,ecx
78
	add eax,ecx
79
	lea eax,[eax+eax*2]
79
	lea eax,[eax+eax*2]
80
	add eax,[PointerToPicture]
80
	add eax,[PointerToPicture]
81
 
81
 
82
 
82
 
83
	mov ebx,[ScreenPointer]
83
	mov ebx,[ScreenPointer]
84
 
84
 
85
	mov edi,[CounterY]
85
	mov edi,[CounterY]
86
 
86
 
87
	;if size of picture natural(mastab is 1) than move picture to work screen
87
	;if size of picture natural(mastab is 1) than move picture to work screen
88
	cmp [k],1
88
	cmp [k],1
89
	jne no_zoom_1_
89
	jne no_zoom_1_
90
	screen_y_1:
90
	screen_y_1:
91
	    mov esi,[CounterX]
91
	    mov esi,[CounterX]
92
	    screen_x_1:
92
	    screen_x_1:
93
	      mov ecx,[eax]
93
	      mov ecx,[eax]
94
	      and ecx,0xffffff
94
	      and ecx,0xffffff
95
	      mov ebp,ecx
95
	      mov ebp,ecx
96
	      shr ecx,16
96
	      shr ecx,16
97
		   mov [ebx],bp
97
		   mov [ebx],bp
98
		   mov [ebx+2],cl
98
		   mov [ebx+2],cl
99
	      add ebx,3;
99
	      add ebx,3;
100
	      add eax,3
100
	      add eax,3
101
	    dec esi
101
	    dec esi
102
	    jnz screen_x_1
102
	    jnz screen_x_1
103
	    add eax,[OffsetYPicture]
103
	    add eax,[OffsetYPicture]
104
	    add ebx,[OffsetYWorkScreen]
104
	    add ebx,[OffsetYWorkScreen]
105
	dec edi
105
	dec edi
106
	jnz screen_y_1
106
	jnz screen_y_1
107
	jmp fps
107
	jmp fps
108
	no_zoom_1_:
108
	no_zoom_1_:
109
 
109
 
110
	cmp [k],2
110
	cmp [k],2
111
	jne no_zoom_2
111
	jne no_zoom_2
112
 
112
 
113
	screen_y_2:
113
	screen_y_2:
114
	    mov esi,[CounterX]
114
	    mov esi,[CounterX]
115
	    screen_x_2:
115
	    screen_x_2:
116
	      mov ecx,[eax]
116
	      mov ecx,[eax]
117
	      and ecx,0xffffff
117
	      and ecx,0xffffff
118
	      mov ebp,ecx
118
	      mov ebp,ecx
119
	      shr ecx,16
119
	      shr ecx,16
120
	      mov edx,ebx
120
	      mov edx,ebx
121
		   mov [edx],bp
121
		   mov [edx],bp
122
		   mov [edx+2],cl
122
		   mov [edx+2],cl
123
		   mov [edx+3],bp
123
		   mov [edx+3],bp
124
		   mov [edx+3+2],cl
124
		   mov [edx+3+2],cl
125
		   add edx,3*2
125
		   add edx,3*2
126
		   add edx,[OffsetYBigPixel]
126
		   add edx,[OffsetYBigPixel]
127
		   mov [edx],bp
127
		   mov [edx],bp
128
		   mov [edx+2],cl
128
		   mov [edx+2],cl
129
		   mov [edx+3],bp
129
		   mov [edx+3],bp
130
		   mov [edx+3+2],cl
130
		   mov [edx+3+2],cl
131
		   add edx,3*2
131
		   add edx,3*2
132
		   add edx,[OffsetYBigPixel]
132
		   add edx,[OffsetYBigPixel]
133
	      add ebx,3*2
133
	      add ebx,3*2
134
	      add eax,3
134
	      add eax,3
135
	    dec esi
135
	    dec esi
136
	    jnz screen_x_2
136
	    jnz screen_x_2
137
	    add eax,[OffsetYPicture]
137
	    add eax,[OffsetYPicture]
138
	    add ebx,[OffsetYWorkScreen]
138
	    add ebx,[OffsetYWorkScreen]
139
	dec edi
139
	dec edi
140
	jnz screen_y_2
140
	jnz screen_y_2
141
	jmp fps
141
	jmp fps
142
	no_zoom_2:
142
	no_zoom_2:
143
 
143
 
144
	cmp [k],4
144
	cmp [k],4
145
	jne no_zoom_4
145
	jne no_zoom_4
146
	screen_y_4:
146
	screen_y_4:
147
	    mov esi,[CounterX]
147
	    mov esi,[CounterX]
148
	    screen_x_4:
148
	    screen_x_4:
149
	      mov ecx,[eax]
149
	      mov ecx,[eax]
150
	      and ecx,0xffffff
150
	      and ecx,0xffffff
151
	      mov ebp,ecx
151
	      mov ebp,ecx
152
	      shr ecx,16
152
	      shr ecx,16
153
	      mov edx,ebx
153
	      mov edx,ebx
154
		   mov [edx],bp
154
		   mov [edx],bp
155
		   mov [edx+2],cl
155
		   mov [edx+2],cl
156
		   mov [edx+3],bp
156
		   mov [edx+3],bp
157
		   mov [edx+3+2],cl
157
		   mov [edx+3+2],cl
158
		   mov [edx+6],bp
158
		   mov [edx+6],bp
159
		   mov [edx+6+2],cl
159
		   mov [edx+6+2],cl
160
		   mov [edx+9],bp
160
		   mov [edx+9],bp
161
		   mov [edx+9+2],cl
161
		   mov [edx+9+2],cl
162
		   add edx,3*4
162
		   add edx,3*4
163
		   add edx,[OffsetYBigPixel]
163
		   add edx,[OffsetYBigPixel]
164
		   mov [edx],bp
164
		   mov [edx],bp
165
		   mov [edx+2],cl
165
		   mov [edx+2],cl
166
		   mov [edx+3],bp
166
		   mov [edx+3],bp
167
		   mov [edx+3+2],cl
167
		   mov [edx+3+2],cl
168
		   mov [edx+6],bp
168
		   mov [edx+6],bp
169
		   mov [edx+6+2],cl
169
		   mov [edx+6+2],cl
170
		   mov [edx+9],bp
170
		   mov [edx+9],bp
171
		   mov [edx+9+2],cl
171
		   mov [edx+9+2],cl
172
		   add edx,3*4
172
		   add edx,3*4
173
		   add edx,[OffsetYBigPixel]
173
		   add edx,[OffsetYBigPixel]
174
		   mov [edx],bp
174
		   mov [edx],bp
175
		   mov [edx+2],cl
175
		   mov [edx+2],cl
176
		   mov [edx+3],bp
176
		   mov [edx+3],bp
177
		   mov [edx+3+2],cl
177
		   mov [edx+3+2],cl
178
		   mov [edx+6],bp
178
		   mov [edx+6],bp
179
		   mov [edx+6+2],cl
179
		   mov [edx+6+2],cl
180
		   mov [edx+9],bp
180
		   mov [edx+9],bp
181
		   mov [edx+9+2],cl
181
		   mov [edx+9+2],cl
182
		   add edx,3*4
182
		   add edx,3*4
183
		   add edx,[OffsetYBigPixel]
183
		   add edx,[OffsetYBigPixel]
184
		   mov [edx],bp
184
		   mov [edx],bp
185
		   mov [edx+2],cl
185
		   mov [edx+2],cl
186
		   mov [edx+3],bp
186
		   mov [edx+3],bp
187
		   mov [edx+3+2],cl
187
		   mov [edx+3+2],cl
188
		   mov [edx+6],bp
188
		   mov [edx+6],bp
189
		   mov [edx+6+2],cl
189
		   mov [edx+6+2],cl
190
		   mov [edx+9],bp
190
		   mov [edx+9],bp
191
		   mov [edx+9+2],cl
191
		   mov [edx+9+2],cl
192
		   add edx,3*4
192
		   add edx,3*4
193
		   add edx,[OffsetYBigPixel]
193
		   add edx,[OffsetYBigPixel]
194
	      add ebx,4*3
194
	      add ebx,4*3
195
	      add eax,3
195
	      add eax,3
196
	    dec esi
196
	    dec esi
197
	    jnz screen_x_4
197
	    jnz screen_x_4
198
	    add eax,[OffsetYPicture]
198
	    add eax,[OffsetYPicture]
199
	    add ebx,[OffsetYWorkScreen]
199
	    add ebx,[OffsetYWorkScreen]
200
	dec edi
200
	dec edi
201
	jnz screen_y_4
201
	jnz screen_y_4
202
	jmp fps
202
	jmp fps
203
	no_zoom_4:
203
	no_zoom_4:
204
	;if zoom more than 4
204
	;if zoom more than 4
205
	screen_y:
205
	screen_y:
206
	    mov esi,[CounterX]
206
	    mov esi,[CounterX]
207
	    screen_x:
207
	    screen_x:
208
	      mov ecx,[eax]
208
	      mov ecx,[eax]
209
	      and ecx,0xffffff
209
	      and ecx,0xffffff
210
	      mov ebp,ecx
210
	      mov ebp,ecx
211
	      shr ecx,16
211
	      shr ecx,16
212
	      push ebx
212
	      push ebx
213
	      push eax
213
	      push eax
214
	      mov edx,[k]
214
	      mov edx,[k]
215
	      big_pixel_y:
215
	      big_pixel_y:
216
		 mov eax,[k]
216
		 mov eax,[k]
217
		 big_pixel_x:
217
		 big_pixel_x:
218
		   mov [ebx],bp
218
		   mov [ebx],bp
219
		   mov [ebx+2],cl
219
		   mov [ebx+2],cl
220
		   add ebx,3
220
		   add ebx,3
221
		 dec eax
221
		 dec eax
222
		 jnz big_pixel_x
222
		 jnz big_pixel_x
223
		 add ebx,[OffsetYBigPixel]
223
		 add ebx,[OffsetYBigPixel]
224
	      dec edx
224
	      dec edx
225
	      jnz big_pixel_y
225
	      jnz big_pixel_y
226
	      pop eax
226
	      pop eax
227
	      pop ebx
227
	      pop ebx
228
	      mov edx,[k]
228
	      mov edx,[k]
229
	      lea edx,[edx+edx*2]
229
	      lea edx,[edx+edx*2]
230
	      add ebx,edx
230
	      add ebx,edx
231
	      add eax,3
231
	      add eax,3
232
	    dec esi
232
	    dec esi
233
	    jnz screen_x
233
	    jnz screen_x
234
	    add eax,[OffsetYPicture]
234
	    add eax,[OffsetYPicture]
235
	    add ebx,[OffsetYWorkScreen]
235
	    add ebx,[OffsetYWorkScreen]
236
	dec edi
236
	dec edi
237
	jnz screen_y
237
	jnz screen_y
238
 
238
 
239
	 fps:
239
	 fps:
240
	 ;mov eax,18
240
	 ;mov eax,18
241
	 ;mov ebx,14
241
	 ;mov ebx,14
242
	 ;int 0x40
242
	 ;mcall
243
 
243
 
244
	 mov eax,7
244
	 mov eax,7
245
	 mov ebx,[ScreenPointer]
245
	 mov ebx,[ScreenPointer]
246
	 mov ecx,[WorkScreen_SizeX]
246
	 mov ecx,[WorkScreen_SizeX]
247
	 mov edx,[WorkScreen_SizeY]
247
	 mov edx,[WorkScreen_SizeY]
248
	 shl ecx,16
248
	 shl ecx,16
249
	 add ecx,edx
249
	 add ecx,edx
250
	 mov edx,8*65536+20+15+49+5+1
250
	 mov edx,8*65536+20+15+49+5+1
251
	 int 0x40
251
	 mcall
252
 
252
 
253
	 ret
253
	 ret
254
;----------------------------------------------------------
254
;----------------------------------------------------------
255
;--------------------clear screen--------------------------
255
;--------------------clear screen--------------------------
256
;----------------------------------------------------------
256
;----------------------------------------------------------
257
cleare_screen:
257
cleare_screen:
258
 
258
 
259
	mov eax,[ScreenPointer]
259
	mov eax,[ScreenPointer]
260
	mov ebx,[WorkScreen_SizeX]
260
	mov ebx,[WorkScreen_SizeX]
261
	imul ebx,[WorkScreen_SizeY]
261
	imul ebx,[WorkScreen_SizeY]
262
	lea ebx,[ebx+ebx*2]
262
	lea ebx,[ebx+ebx*2]
263
	shr ebx,3
263
	shr ebx,3
264
	inc ebx
264
	inc ebx
265
	mov esi,0xffffff
265
	mov esi,0xffffff
266
 
266
 
267
	clear_screen_loop:
267
	clear_screen_loop:
268
 
268
 
269
	  mov [eax],esi
269
	  mov [eax],esi
270
	  mov [eax+3],esi
270
	  mov [eax+3],esi
271
	  mov [eax+6],si
271
	  mov [eax+6],si
272
	  add eax,4+4
272
	  add eax,4+4
273
 
273
 
274
	dec ebx
274
	dec ebx
275
	jnz clear_screen_loop
275
	jnz clear_screen_loop
276
	ret
276
	ret
277
;----------------------------------------------------------
277
;----------------------------------------------------------
278
;-------------cleare work arrea(work screen)---------------
278
;-------------cleare work arrea(work screen)---------------
279
;----------------------------------------------------------
279
;----------------------------------------------------------
280
cleare_work_arrea:
280
cleare_work_arrea:
281
 
281
 
282
	mov eax,[PointerToPicture]
282
	mov eax,[PointerToPicture]
283
	mov ebx,[Picture_SizeX]
283
	mov ebx,[Picture_SizeX]
284
	imul ebx,[Picture_SizeY]
284
	imul ebx,[Picture_SizeY]
285
	lea ebx,[ebx+ebx*2]
285
	lea ebx,[ebx+ebx*2]
286
	shr ebx,3
286
	shr ebx,3
287
	inc ebx
287
	inc ebx
288
	mov esi,0xffffff
288
	mov esi,0xffffff
289
 
289
 
290
	clear_work_arrea_loop:
290
	clear_work_arrea_loop:
291
 
291
 
292
	  mov [eax],esi
292
	  mov [eax],esi
293
	  mov [eax+3],esi
293
	  mov [eax+3],esi
294
	  mov [eax+6],si
294
	  mov [eax+6],si
295
	  add eax,4+4
295
	  add eax,4+4
296
 
296
 
297
	dec ebx
297
	dec ebx
298
	jnz clear_work_arrea_loop
298
	jnz clear_work_arrea_loop
299
	ret
299
	ret
300
;-----------------------------------------------------------
300
;-----------------------------------------------------------
301
;calculate position work screen on a picture
301
;calculate position work screen on a picture
302
;-----------------------------------------------------------
302
;-----------------------------------------------------------
303
CalculatePositionScreen:
303
CalculatePositionScreen:
304
 
304
 
305
	 mov eax,[Picture_SizeX]
305
	 mov eax,[Picture_SizeX]
306
	 mov ebx,[Picture_SizeY]
306
	 mov ebx,[Picture_SizeY]
307
	 mov ecx,[CounterX]
307
	 mov ecx,[CounterX]
308
	 mov edx,[CounterY]
308
	 mov edx,[CounterY]
309
	 sub eax,ecx
309
	 sub eax,ecx
310
	 sub ebx,edx
310
	 sub ebx,edx
311
 
311
 
312
	 cmp [PosX],eax
312
	 cmp [PosX],eax
313
	 jle no_limit_screen_x
313
	 jle no_limit_screen_x
314
	 mov [PosX],eax
314
	 mov [PosX],eax
315
	 no_limit_screen_x:
315
	 no_limit_screen_x:
316
 
316
 
317
	 cmp [PosY],ebx
317
	 cmp [PosY],ebx
318
	 jle no_limit_screen_y
318
	 jle no_limit_screen_y
319
	 mov [PosY],ebx
319
	 mov [PosY],ebx
320
	 no_limit_screen_y:
320
	 no_limit_screen_y:
321
 
321
 
322
	 cmp [PosX],0
322
	 cmp [PosX],0
323
	 jns no_minimum_screen_x
323
	 jns no_minimum_screen_x
324
	 mov [PosX],0
324
	 mov [PosX],0
325
	 no_minimum_screen_x:
325
	 no_minimum_screen_x:
326
 
326
 
327
	 cmp [PosY],0
327
	 cmp [PosY],0
328
	 jns no_minimum_screen_y
328
	 jns no_minimum_screen_y
329
	 mov [PosY],0
329
	 mov [PosY],0
330
	 no_minimum_screen_y:
330
	 no_minimum_screen_y:
331
 
331
 
332
	 ret
332
	 ret
333
;-----------------------------------------------------------
333
;-----------------------------------------------------------
334
;-----------calculate cordinats on work picture--------------
334
;-----------calculate cordinats on work picture--------------
335
;-----------------------------------------------------------
335
;-----------------------------------------------------------
336
GetScreenCordinats:
336
GetScreenCordinats:
337
 
337
 
338
	mov eax,[MouseX]
338
	mov eax,[MouseX]
339
	mov ebx,[MouseY]
339
	mov ebx,[MouseY]
340
	sub eax,9
340
	sub eax,9
341
	sub ebx,87
341
	sub ebx,87
342
 
342
 
343
	mov ecx,[k]
343
	mov ecx,[k]
344
	cdq
344
	cdq
345
	idiv ecx
345
	idiv ecx
346
	mov [ScreenX],eax
346
	mov [ScreenX],eax
347
	mov eax,ebx
347
	mov eax,ebx
348
	cdq
348
	cdq
349
	idiv ecx
349
	idiv ecx
350
	mov [ScreenY],eax
350
	mov [ScreenY],eax
351
 
351
 
352
	ret
352
	ret