Subversion Repositories Kolibri OS

Rev

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

Rev 828 Rev 832
1
;   Picture browser by lisovin@26.ru
1
;   Picture browser by lisovin@26.ru
2
;   Modified by Ivan Poddubny - v.0.3
2
;   Modified by Ivan Poddubny - v.0.3
3
;   Modified by Diamond - v.0.4
3
;   Modified by Diamond - v.0.4
4
;   Modified by Mario79:
4
;   Modified by Mario79:
5
;      v.0.5  18.07.08 Dinamic Allocation Memory
5
;      v.0.5  18.07.08 Dinamic Allocation Memory
6
;      v.0.6  20.07.08
6
;      v.0.6  20.07.08
7
;             1) Use Editbox (Author )
7
;             1) Use Editbox (Author )
8
;             2) Draw window without fill working area (C = 1)
8
;             2) Draw window without fill working area (C = 1)
9
;             3) Open file with parameter in patch:
9
;             3) Open file with parameter in patch:
10
;                Size of parameter - 4 bytes. Parameter starts with the character "\",
10
;                Size of parameter - 4 bytes. Parameter starts with the
11
;                the unused characters are filled by a blank (ASCII 20h).
11
;                character "\", the unused characters are filled
-
 
12
;                by a blank (ASCII 20h).
12
;                '\T  /hd0/1/1.jpg' - set background, mode: tile
13
;                '\T  /hd0/1/1.bmp' - set background, mode: tile
13
;                '\S  /hd0/1/1.jpg' - set background, mode: stretch
14
;                '\S  /hd0/1/1.bmp' - set background, mode: stretch
-
 
15
;      v.0.65  23.07.08
-
 
16
;             1) Use new version Editbox (Thanks )
-
 
17
;                (mouse correctly works in secondary thread)
-
 
18
;             2) The memory used for storage of the file BMP
-
 
19
;                after conversion in RAW comes back to OS.
-
 
20
;             3) Usage of keys 1,2,3,4 for call of buttons of the application
-
 
21
;                without the mouse, before the key were defined incorrectly.
-
 
22
;             4) Deleting of the unnecessary procedure of clearing of
-
 
23
;                a background of a picture at pressing the button "Open".
14
;   Compile with FASM for Menuet
24
;   Compile with FASM for Menuet
15
 
25
 
16
;******************************************************************************
26
;******************************************************************************
17
    use32
27
    use32
18
    org    0x0
28
    org    0x0
19
    db	   'MENUET01'		   ; 8 byte id
29
    db	   'MENUET01'		   ; 8 byte id
20
    dd	   0x01 		   ; header version
30
    dd	   0x01 		   ; header version
21
    dd	   START		   ; start of code
31
    dd	   START		   ; start of code
22
    dd	   IM_END		   ; size of image
32
    dd	   IM_END		   ; size of image
23
    dd	   I_END ;0x300000                 ; memory for app
33
    dd	   I_END       ; memory for app
24
    dd	   I_END ;0x300000                 ; esp
34
    dd	   I_END       ; esp
25
    dd	   temp_area , 0x0	   ; I_Param , I_Icon
35
    dd	   temp_area , 0x0	   ; I_Param , I_Icon
26
 
36
 
27
include    'lang.inc'
37
include    'lang.inc'
28
include    '..\..\..\macros.inc'
38
include    '..\..\..\macros.inc'
-
 
39
include    '..\..\..\develop\examples\editbox\trunk\editbox.inc'
29
;include    'macros.inc'
40
;include    'macros.inc'
30
include    'EDITBOX.INC'
41
;include    'EDITBOX.INC'
31
use_edit_box procinfo
42
use_edit_box
32
;******************************************************************************
43
;******************************************************************************
33
 
44
 
34
START:				; start of execution
45
START:				; start of execution
35
	mcall	68, 11
46
	mcall	68, 11
-
 
47
	mcall	66, 1,1
36
; check for parameters
48
; check for parameters
37
   cmp	 dword [temp_area],'BOOT'
49
   cmp	 dword [temp_area],'BOOT'
38
   jne	 .no_boot
50
   jne	 .no_boot
39
.background:
51
.background:
40
   call  load_image
52
   call  load_image
41
   call  convert
53
   call  convert
42
 
54
 
43
   call  background
55
   call  background
44
.exit:
56
.exit:
45
   or	 eax,-1
57
   or	 eax,-1
46
   mcall
58
   mcall
47
 .no_boot:
59
 .no_boot:
48
 
60
 
49
   cmp	 byte [temp_area],0
61
   cmp	 byte [temp_area],0
50
   jz	 .no_param
62
   jz	 .no_param
51
 
63
 
52
 
64
 
53
   mov	 edi,string	 ; clear string
65
   mov	 edi,string	 ; clear string
54
   mov	 ecx,256/4	 ;   length of a string
66
   mov	 ecx,256/4	 ;   length of a string
55
   xor	 eax,eax	 ;   symbol <0>
67
   xor	 eax,eax	 ;   symbol <0>
56
   rep	 stosd
68
   rep	 stosd
57
 
69
 
58
 
70
 
59
   mov	 edi,temp_area	 ; look for <0> in temp_area
71
   mov	 edi,temp_area	 ; look for <0> in temp_area
60
 
72
 
61
   cmp	 [edi],byte "\"
73
   cmp	 [edi],byte "\"
62
   jne	 .continue
74
   jne	 .continue
63
   cmp	 [edi+1],byte "T"
75
   cmp	 [edi+1],byte "T"
64
   jne	 @f
76
   jne	 @f
65
   mov	 [bgrmode],dword 1
77
   mov	 [bgrmode],dword 1
66
   jmp	 .continue_1
78
   jmp	 .continue_1
67
@@:
79
@@:
68
   cmp	 [edi+1],byte "S"
80
   cmp	 [edi+1],byte "S"
69
   jne	 START.exit
81
   jne	 START.exit
70
   mov	 [bgrmode],dword 2
82
   mov	 [bgrmode],dword 2
71
.continue_1:
83
.continue_1:
72
   add	 edi,4
84
   add	 edi,4
73
.continue:
85
.continue:
74
   mov	 esi,edi
86
   mov	 esi,edi
75
   mov	 ecx,257	 ;   strlen
87
   mov	 ecx,257	 ;   strlen
76
   repne scasb
88
   repne scasb
77
	lea	ecx, [edi-temp_area]
89
	lea	ecx, [edi-temp_area]
78
 
90
 
79
   mov	 edi,string
91
   mov	 edi,string
80
   rep	 movsb		 ; copy string from temp_area to "string" (filename)
92
   rep	 movsb		 ; copy string from temp_area to "string" (filename)
81
   cmp	 [temp_area],byte "\"
93
   cmp	 [temp_area],byte "\"
82
   je	 START.background
94
   je	 START.background
83
   call  load_image
95
   call  load_image
84
   call  convert
96
   call  convert
85
 
97
 
86
 .no_param:
98
 .no_param:
87
 
99
 
88
 
100
 
89
   or  ecx,-1		; get information about me
101
   or  ecx,-1		; get information about me
90
   call getappinfo
102
   call getappinfo
91
 
103
 
92
   mov	edx,[process_info+30] ; ⥯¥àì ¢ edx ­ è ¨¤¥­â¨ä¨ª â®à
104
   mov	edx,[process_info+30] ; ⥯¥àì ¢ edx ­ è ¨¤¥­â¨ä¨ª â®à
93
   mov	ecx,eax
105
   mov	ecx,eax
94
 
106
 
95
  @@:
107
  @@:
96
   call getappinfo
108
   call getappinfo
97
   cmp	edx,[process_info+30]
109
   cmp	edx,[process_info+30]
98
   je	@f  ; ¥á«¨ ­ è PID ᮢ¯ « á PID à áᬠâਢ ¥¬®£® ¯à®æ¥áá , ¬ë ­ è«¨ ᥡï
110
   je	@f  ; ¥á«¨ ­ è PID ᮢ¯ « á PID à áᬠâਢ ¥¬®£® ¯à®æ¥áá , ¬ë ­ è«¨ ᥡï
99
   dec	ecx ; ¨­ ç¥ ᬮâਬ á«¥¤ãî騩 ¯à®æ¥áá
111
   dec	ecx ; ¨­ ç¥ ᬮâਬ á«¥¤ãî騩 ¯à®æ¥áá
100
   jne	@b  ; ¢®§¢à é ¥¬áï, ¥á«¨ ­¥ ¢á¥ ¯à®æ¥ááë à áᬮâ७ë
112
   jne	@b  ; ¢®§¢à é ¥¬áï, ¥á«¨ ­¥ ¢á¥ ¯à®æ¥ááë à áᬮâ७ë
101
  @@:
113
  @@:
102
 
114
 
103
; ⥯¥àì ¢ ecx ­®¬¥à ¯à®æ¥áá 
115
; ⥯¥àì ¢ ecx ­®¬¥à ¯à®æ¥áá 
104
    mov  [process],ecx
116
    mov  [process],ecx
105
 
117
 
106
draw_still:
118
draw_still:
107
    call draw_window
119
    call draw_window
108
 
120
 
109
still:
121
still:
110
 
122
 
111
    mov  eax,10 		; wait here for event
123
    mov  eax,10 		; wait here for event
112
    mcall
124
    mcall
113
 
125
 
114
	dec	eax
126
	dec	eax
115
	jz	red
127
	jz	red
116
	dec	eax
128
	dec	eax
117
	jnz	button
129
	jnz	button
118
 
130
 
119
  key:				; key
131
  key:				; key
120
    mov  al,2
132
    mov  al,2
121
    mcall
133
    mcall
122
    mov  al,ah
134
    mov  al,ah
123
    cmp  al,6
135
    cmp  al,130  ; 1
124
    je	 kfile
136
    je	 kfile
125
    cmp  al,15
137
    cmp  al,131  ; 2
126
    je	 kopen
138
    je	 kopen
127
    cmp  al,9
139
    cmp  al,132  ; 3
128
    je	 kinfo
140
    je	 kinfo
129
    cmp  al,2
141
    cmp  al,133  ; 4
130
    je	 kbgrd
142
    je	 kbgrd
131
    jmp  still
143
    jmp  still
132
 
144
 
133
  red:
145
  red:
134
	test	byte [status], 4
146
	test	byte [status], 4
135
	jz	draw_still
147
	jz	draw_still
136
	mov	al, 18
148
	mov	al, 18
137
	mov	ebx, 3
149
	mov	ebx, 3
138
	mov	ecx, [process]
150
	mov	ecx, [process]
139
	mcall
151
	mcall
140
	and	byte [status], not 4
152
	and	byte [status], not 4
141
	jmp	still
153
	jmp	still
142
 
154
 
143
  button:			; button
155
  button:			; button
144
    mov  eax,17 		; get id
156
    mov  eax,17 		; get id
145
    mcall
157
    mcall
146
 
158
 
147
    cmp  ah,1			; button id=1 ?
159
    cmp  ah,1			; button id=1 ?
148
    jne  noclose
160
    jne  noclose
149
 
161
 
150
    mov  eax,-1 		; close this program
162
    mov  eax,-1 		; close this program
151
    mcall
163
    mcall
152
  noclose:
164
  noclose:
153
    cmp  ah,2
165
    cmp  ah,2
154
    jne  nofile
166
    jne  nofile
155
  kfile:
167
  kfile:
156
	test	byte [status], 1
168
	test	byte [status], 1
157
	jnz	still
169
	jnz	still
158
	or	byte [status], 1
170
	or	byte [status], 1
159
    mov  eax,51
171
    mov  eax,51
160
    mov  ebx,1
172
    mov  ebx,1
161
    mov  ecx,thread1
173
    mov  ecx,thread1
162
    mov  edx,thread   ;0x29fff0
174
    mov  edx,thread   ;0x29fff0
163
    mcall
175
    mcall
164
    jmp  still
176
    jmp  still
165
  nofile:
177
  nofile:
166
    cmp  ah,3
178
    cmp  ah,3
167
    jne  noopen
179
    jne  noopen
168
 
180
 
169
 kopen:
181
 kopen:
170
    mov ecx,-1
182
    mov ecx,-1
171
    call getappinfo
183
    call getappinfo
172
    mov eax,[image_file]
-
 
173
    mov ebx,dword [eax+42]
-
 
174
    mov ecx,dword [eax+46]
-
 
175
    add ebx,10*65536-15
-
 
176
    add ecx,50*65536-55
-
 
177
    mov edx,0xffffff
-
 
178
    mov eax,13
-
 
179
    mcall
-
 
180
 
184
 
181
    call load_image
185
    call load_image
182
 
186
 
183
  open1:
187
  open1:
184
    mov eax,[image_file]
188
    mov eax,[image_file]
185
    cmp [eax],word 'BM'
189
    cmp [eax],word 'BM'
186
    jne  still
190
    jne  still
187
    call convert
191
    call convert
188
    call drawimage
-
 
189
    jmp  still
192
    jmp  draw_still
190
  noopen:
193
  noopen:
191
 
194
 
192
    cmp  ah,4
195
    cmp  ah,4
193
    jne  noinfo
196
    jne  noinfo
194
  kinfo:
197
  kinfo:
195
	test	byte [status], 2
198
	test	byte [status], 2
196
	jnz	still
199
	jnz	still
197
	or	byte [status], 2
200
	or	byte [status], 2
198
    mov  eax,51
201
    mov  eax,51
199
    mov  ebx,1
202
    mov  ebx,1
200
    mov  ecx,thread2
203
    mov  ecx,thread2
201
    mov  edx,thread-512  ;0x2afff0
204
    mov  edx,thread-512
202
    mcall
205
    mcall
203
    jmp  still
206
    jmp  still
204
  noinfo:
207
  noinfo:
205
 
208
 
206
; “‘’€Ž‚ˆ’œ ”Ž
209
; “‘’€Ž‚ˆ’œ ”Ž
207
    cmp  ah,5
210
    cmp  ah,5
208
    jne  still
211
    jne  still
209
  kbgrd:
212
  kbgrd:
210
	test	byte [status], 8
213
	test	byte [status], 8
211
	jnz	still
214
	jnz	still
212
	or	byte [status], 8
215
	or	byte [status], 8
213
    mov  eax,51
216
    mov  eax,51
214
    mov  ebx,1
217
    mov  ebx,1
215
    mov  ecx,thread3
218
    mov  ecx,thread3
216
    mov  edx,thread-512*2  ;0x2bfff0
219
    mov  edx,thread-512*2
217
    mcall
220
    mcall
218
    jmp  still
221
    jmp  still
219
    ;call background
222
    ;call background
220
 
223
 
221
 getappinfo:
224
 getappinfo:
222
    mov  eax,9
225
    mov  eax,9
223
    mov  ebx,process_info
226
    mov  ebx,process_info
224
    mcall
227
    mcall
225
    ret
228
    ret
226
 
229
 
227
 
230
 
228
load_image:
231
load_image:
229
 
232
 
230
	  mov	[fileinfo+0],dword 5
233
	  mov	[fileinfo+0],dword 5
231
	  mov	[fileinfo+12],dword 0
234
	  mov	[fileinfo+12],dword 0
232
	  mov	[fileinfo+16],dword process_info
235
	  mov	[fileinfo+16],dword process_info
233
 
236
 
234
    cmp  [image_file],0
237
    cmp  [image_file],0
235
    je	  @f
238
    je	  @f
236
    mov   ecx,[image_file]
239
    mov   ecx,[image_file]
237
     mcall 68, 13,
240
     mcall 68, 13,
238
 
241
 
239
@@:
242
@@:
240
	  mcall 70, fileinfo
243
	  mcall 70, fileinfo
241
 
244
 
242
	  mov	[fileinfo+0],dword 0
245
	  mov	[fileinfo+0],dword 0
243
	  mov	[fileinfo+12],dword 512
246
	  mov	[fileinfo+12],dword 512
244
	  mov	[fileinfo+16],dword process_info+40
247
	  mov	[fileinfo+16],dword process_info+40
245
 
248
 
246
	  mcall 70, fileinfo
249
	  mcall 70, fileinfo
247
 
250
 
248
	  mov	ecx,[process_info+32]
251
	  mov	ecx,[process_info+32]
249
	  mov	[fileinfo+12],ecx
252
	  mov	[fileinfo+12],ecx
-
 
253
 
-
 
254
	  mcall 68, 12
-
 
255
 
-
 
256
 
-
 
257
	  mov	[fileinfo+16],eax
-
 
258
	  mov	[image_file_1],eax
250
 
259
 
251
    mov  eax,[process_info+40+28]
260
    mov  eax,[process_info+40+28]
252
 
261
 
253
	cmp	eax, 24
262
	cmp	eax, 24
254
	jz	.convert24
263
	jz	.convert24
255
	cmp	eax, 8
264
	cmp	eax, 8
256
	jz	.convert8
265
	jz	.convert8
257
	cmp	eax, 4
266
	cmp	eax, 4
258
	jz	.convert4
267
	jz	.convert4
259
     shl  ecx,2
268
     shl  ecx,2
260
.convert4:
269
.convert4:
261
     shl  ecx,1
270
     shl  ecx,1
262
.convert8:
271
.convert8:
263
     lea  ecx,[ecx*3]
272
     lea  ecx,[ecx*3]
264
.convert24:
273
.convert24:
265
     shl  ecx,1
-
 
266
@@:
-
 
267
 
274
 
-
 
275
;@@:
-
 
276
 
268
	  mcall 68, 12
-
 
269
 
277
    add   ecx,512
270
 
278
	  mcall 68, 12
271
	  mov	[fileinfo+16],eax
279
 
272
	  mov	[image_file],eax
280
	  mov	[image_file],eax
273
 
281
 
274
	  mcall 70, fileinfo
282
	  mcall 70, fileinfo
-
 
283
 
-
 
284
    mov   esi,[image_file_1]
-
 
285
    mov   edi,[image_file]
-
 
286
    mov   ecx,512/4
-
 
287
    cld
-
 
288
    rep  movsd
275
 
289
 
276
    mov  eax,[image_file]
290
    mov  eax,[image_file]
277
    mov  ebx,[eax+22]
291
    mov  ebx,[eax+22]
278
    mov  eax,[eax+18]
292
    mov  eax,[eax+18]
279
	test	ebx, ebx
293
	test	ebx, ebx
280
	jns	@f
294
	jns	@f
281
	neg	ebx
295
	neg	ebx
282
@@:
296
@@:
283
    add  eax,9	;20
297
    add  eax,9
284
    cmp  eax,210
298
    cmp  eax,210
285
    jae  @f
299
    jae  @f
286
    mov  eax,210
300
    mov  eax,210
287
@@:
301
@@:
288
    add  ebx,54     ;58
302
    add  ebx,54
289
    cmp  ebx,56
303
    cmp  ebx,56
290
    jae  @f
304
    jae  @f
291
    mov  ebx,56
305
    mov  ebx,56
292
@@:
306
@@:
293
    mov  [wnd_width],eax
307
    mov  [wnd_width],eax
294
    mov  [wnd_height],ebx
308
    mov  [wnd_height],ebx
295
    test [bWasDraw],1
309
    test [bWasDraw],1
296
    jz	 @f
310
    jz	 @f
297
    mov  esi,ebx
311
    mov  esi,ebx
298
    mov  edx,eax
312
    mov  edx,eax
299
    mcall 67,-1,-1
313
    mcall 67,-1,-1
300
@@:
314
@@:
301
    ret
315
    ret
302
 
316
 
303
 
317
 
304
  drawimage:
318
  drawimage:
305
    mov  eax,[image_file]
319
    mov  eax,[image_file]
306
    cmp  [eax],word 'BM'
320
    cmp  [eax],word 'BM'
307
    jne  nodrawimage
321
    jne  nodrawimage
308
	mov	ecx, dword [eax+18-2]
322
	mov	ecx, dword [eax+18-2]
309
	mov	cx, [eax+22]
323
	mov	cx, [eax+22]
310
	test	cx, cx
324
	test	cx, cx
311
	jns	@f
325
	jns	@f
312
	neg	cx
326
	neg	cx
313
@@:
327
@@:
314
    mov  edx,5*65536+50
328
    mov  edx,5*65536+50
315
    mcall 7,[soi]
329
    mcall 7,[soi]
316
  nodrawimage:
330
  nodrawimage:
317
    ret
331
    ret
318
 
332
 
319
; “‘’€Ž‚ˆ’œ ”Ž
333
; “‘’€Ž‚ˆ’œ ”Ž
320
  background:
334
  background:
321
    mov  eax,[image_file]
335
    mov  eax,[image_file]
322
    cmp  [eax],word 'BM'
336
    cmp  [eax],word 'BM'
323
    jne  @f
337
    jne  @f
324
    mov  ecx,[eax+18] ; è¨à¨­ 
338
    mov  ecx,[eax+18] ; è¨à¨­ 
325
    mov  edx,[eax+22] ; ¢ëá®â 
339
    mov  edx,[eax+22] ; ¢ëá®â 
326
    mcall 15,1
340
    mcall 15,1
327
 
341
 
328
    mov  esi, ecx
342
    mov  esi, ecx
329
    imul esi, edx
343
    imul esi, edx
330
	lea	esi, [esi+esi*2]
344
	lea	esi, [esi+esi*2]
331
    mov  ebx,5
345
    mov  ebx,5
332
    mov  ecx,[soi]
346
    mov  ecx,[soi]
333
    xor  edx,edx
347
    xor  edx,edx
334
;;;    mov  esi, ;640*480*3
348
;;;    mov  esi, ;640*480*3
335
    mcall
349
    mcall
336
 
350
 
337
    dec  ebx	;tile/stretch
351
    dec  ebx	;tile/stretch
338
    mov  ecx,dword [bgrmode]
352
    mov  ecx,dword [bgrmode]
339
    mcall
353
    mcall
340
 
354
 
341
    dec  ebx
355
    dec  ebx
342
    mcall
356
    mcall
343
   @@:
357
   @@:
344
    ret
358
    ret
345
 
359
 
346
convert:
360
convert:
-
 
361
    call  convert_1
-
 
362
    mov   ecx,[image_file_1]
-
 
363
    mcall 68, 13,
-
 
364
    ret
-
 
365
convert_1:
347
	mov	ecx, [image_file]  ;I_END
366
	mov	ecx, [image_file]
348
	add	ecx, [ecx+2]
367
  add ecx,512
349
	mov	[soi], ecx
368
	mov	[soi], ecx
350
	mov	eax,[image_file]
369
	mov	eax,[image_file_1]
351
	mov	ebp, [eax+18]
370
	mov	ebp, [eax+18]
352
	lea	ebp, [ebp*3]	; ebp = size of output scanline
371
	lea	ebp, [ebp*3]	; ebp = size of output scanline
353
	mov	eax, [eax+22]
372
	mov	eax, [eax+22]
354
	dec	eax
373
	dec	eax
355
	mul	ebp
374
	mul	ebp
356
	add	eax, ecx
375
	add	eax, ecx
357
	mov	edi, eax	; edi points to last scanline
376
	mov	edi, eax	; edi points to last scanline
358
	mov	esi, [image_file]  ;I_END
377
	mov	esi, [image_file_1]
359
	add	esi, [esi+10]
378
	add	esi, [esi+10]
360
;        mov     ebx, I_END+54
-
 
361
	mov	ebx,[image_file]
379
	mov	ebx,[image_file_1]
362
	mov	edx, [ebx+22]
380
	mov	edx, [ebx+22]
363
	add	ebx,54
381
	add	ebx,54
364
	lea	eax, [ebp*2]
382
	lea	eax, [ebp*2]
365
	mov	[delta], eax
383
	mov	[delta], eax
366
	test	edx, edx
384
	test	edx, edx
367
	jz	.ret
385
	jz	.ret
368
	jns	@f
386
	jns	@f
369
	neg	edx
387
	neg	edx
370
	and	[delta], 0
388
	and	[delta], 0
371
	mov	edi, ecx
389
	mov	edi, ecx
372
@@:
390
@@:
373
;        movzx   eax, word [I_END+28]
-
 
374
	mov	eax,[image_file]
391
	mov	eax,[image_file_1]
375
	movzx	eax,word [eax+28]
392
	movzx	eax,word [eax+28]
376
	cmp	eax, 24
393
	cmp	eax, 24
377
	jz	convert24
394
	jz	convert24
378
	cmp	eax, 8
395
	cmp	eax, 8
379
	jz	convert8
396
	jz	convert8
380
	cmp	eax, 4
397
	cmp	eax, 4
381
	jz	convert4
398
	jz	convert4
382
	dec	eax
399
	dec	eax
383
	jz	convert1
400
	jz	convert1
384
.ret:
401
.ret:
385
	ret
402
	ret
386
convert24:
403
convert24:
387
	mov	ecx, ebp
404
	mov	ecx, ebp
388
	rep	movsb
405
	rep	movsb
389
	sub	edi, [delta]
406
	sub	edi, [delta]
390
	mov	eax, ebp
407
	mov	eax, ebp
391
	neg	eax
408
	neg	eax
392
	and	eax, 3
409
	and	eax, 3
393
	add	esi, eax
410
	add	esi, eax
394
	dec	edx
411
	dec	edx
395
	jnz	convert24
412
	jnz	convert24
396
	ret
413
	ret
397
convert8:
414
convert8:
398
	push	edi
415
	push	edi
399
	add	[esp], ebp
416
	add	[esp], ebp
400
.loopi:
417
.loopi:
401
	xor	eax, eax
418
	xor	eax, eax
402
	lodsb
419
	lodsb
403
;        cmp     dword [I_END+30], 1
-
 
404
	push	eax
420
	push	eax
405
	mov	eax,[image_file]
421
	mov	eax,[image_file_1]
406
	cmp	dword [eax+30],1
422
	cmp	dword [eax+30],1
407
	pop	eax
423
	pop	eax
408
	jnz	.nocompressed
424
	jnz	.nocompressed
409
.compressed:
425
.compressed:
410
	mov	ecx, eax
426
	mov	ecx, eax
411
	jecxz	.special
427
	jecxz	.special
412
	lodsb
428
	lodsb
413
	mov	eax, [ebx+eax*4]
429
	mov	eax, [ebx+eax*4]
414
@@:
430
@@:
415
	call	putpixel
431
	call	putpixel
416
	loop	@b
432
	loop	@b
417
	jmp	.loopi
433
	jmp	.loopi
418
.nocompressed:
434
.nocompressed:
419
	mov	eax, [ebx+eax*4]
435
	mov	eax, [ebx+eax*4]
420
	call	putpixel
436
	call	putpixel
421
.loopicont:
437
.loopicont:
422
	cmp	edi, [esp]
438
	cmp	edi, [esp]
423
	jnz	.loopi
439
	jnz	.loopi
424
.next:
440
.next:
425
	pop	edi
441
	pop	edi
426
	sub	edi, [delta]
442
	sub	edi, [delta]
427
	mov	eax, ebp
443
	mov	eax, ebp
428
	and	eax, 3
444
	and	eax, 3
429
	add	esi, eax
445
	add	esi, eax
430
	dec	edx
446
	dec	edx
431
	jnz	convert8
447
	jnz	convert8
432
	ret
448
	ret
433
.special:
449
.special:
434
	lodsb
450
	lodsb
435
	test	al, al
451
	test	al, al
436
	jz	.next
452
	jz	.next
437
	cmp	al, 2
453
	cmp	al, 2
438
	jbe	.end
454
	jbe	.end
439
	mov	ecx, eax
455
	mov	ecx, eax
440
	push	ecx
456
	push	ecx
441
@@:
457
@@:
442
	xor	eax, eax
458
	xor	eax, eax
443
	lodsb
459
	lodsb
444
	mov	eax, [ebx+eax*4]
460
	mov	eax, [ebx+eax*4]
445
	call	putpixel
461
	call	putpixel
446
	loop	@b
462
	loop	@b
447
	pop	ecx
463
	pop	ecx
448
	and	ecx, 1
464
	and	ecx, 1
449
	add	esi, ecx
465
	add	esi, ecx
450
	jmp	.loopi
466
	jmp	.loopi
451
.end:
467
.end:
452
	pop	edi
468
	pop	edi
453
	ret
469
	ret
454
convert4:
470
convert4:
455
	push	edi
471
	push	edi
456
	add	[esp], ebp
472
	add	[esp], ebp
457
.loopi:
473
.loopi:
458
	xor	eax, eax
474
	xor	eax, eax
459
	lodsb
475
	lodsb
460
	shr	eax, 4
476
	shr	eax, 4
461
	mov	eax, [ebx+eax*4]
477
	mov	eax, [ebx+eax*4]
462
	call	putpixel
478
	call	putpixel
463
	cmp	edi, [esp]
479
	cmp	edi, [esp]
464
	jz	.loopidone
480
	jz	.loopidone
465
	mov	al, [esi-1]
481
	mov	al, [esi-1]
466
	and	eax, 0xF
482
	and	eax, 0xF
467
	mov	eax, [ebx+eax*4]
483
	mov	eax, [ebx+eax*4]
468
	stosd
484
	stosd
469
	dec	edi
485
	dec	edi
470
	cmp	edi, [esp]
486
	cmp	edi, [esp]
471
	jnz	.loopi
487
	jnz	.loopi
472
.loopidone:
488
.loopidone:
473
	pop	edi
489
	pop	edi
474
	sub	edi, [delta]
490
	sub	edi, [delta]
475
	call	align_input
491
	call	align_input
476
	dec	edx
492
	dec	edx
477
	jnz	convert4
493
	jnz	convert4
478
	ret
494
	ret
479
convert1:
495
convert1:
480
	push	edi
496
	push	edi
481
	add	[esp], ebp
497
	add	[esp], ebp
482
.loopi:
498
.loopi:
483
	lodsb
499
	lodsb
484
	mov	ecx, 8
500
	mov	ecx, 8
485
.loopii:
501
.loopii:
486
	add	al, al
502
	add	al, al
487
	push	eax
503
	push	eax
488
	setc	al
504
	setc	al
489
	movzx	eax, al
505
	movzx	eax, al
490
	mov	eax, [ebx+eax*4]
506
	mov	eax, [ebx+eax*4]
491
	call	putpixel
507
	call	putpixel
492
	pop	eax
508
	pop	eax
493
	cmp	edi, [esp]
509
	cmp	edi, [esp]
494
	loopnz	.loopii
510
	loopnz	.loopii
495
	jnz	.loopi
511
	jnz	.loopi
496
	pop	edi
512
	pop	edi
497
	sub	edi, [delta]
513
	sub	edi, [delta]
498
	call	align_input
514
	call	align_input
499
	dec	edx
515
	dec	edx
500
	jnz	convert1
516
	jnz	convert1
501
	ret
517
	ret
502
 
518
 
503
align_input:
519
align_input:
504
	push	esi
520
	push	esi
505
	push	eax
521
	push	eax
506
	mov	eax,[image_file]
522
	mov	eax,[image_file_1]
507
	sub	esi,eax    ;I_END
523
	sub	esi,eax
508
	sub	esi,[eax+10]
524
	sub	esi,[eax+10]
509
	pop	eax
525
	pop	eax
510
	neg	esi
526
	neg	esi
511
	and	esi, 3
527
	and	esi, 3
512
	add	[esp], esi
528
	add	[esp], esi
513
	pop	esi
529
	pop	esi
514
	ret
530
	ret
515
 
531
 
516
putpixel:
532
putpixel:
517
	push	eax
533
	push	eax
518
	stosw
534
	stosw
519
	shr	eax, 16
535
	shr	eax, 16
520
	stosb
536
	stosb
521
	pop	eax
537
	pop	eax
522
	ret
538
	ret
523
 
539
 
524
;---------------------------------------------------------------------
540
;---------------------------------------------------------------------
525
get_window_param:
541
get_window_param:
526
    mcall 9, procinfo, -1
542
    mcall 9, procinfo, -1
527
    mov   eax,[ebx+46]
543
    mov   eax,[ebx+46]
528
    mov   [window_high],eax
544
    mov   [window_high],eax
529
    mov   eax,[ebx+42]
545
    mov   eax,[ebx+42]
530
    mov   [window_width],eax
546
    mov   [window_width],eax
531
;    mov   eax,[ebx+70]
-
 
532
;    mov   [window_status],eax
-
 
533
    mcall 48,4
547
    mcall 48,4
534
    mov   [skin_high],eax
548
    mov   [skin_high],eax
535
    ret
549
    ret
536
;---------------------------------------------------------------------
550
;---------------------------------------------------------------------
537
 
551
 
538
;   *********************************************
552
;   *********************************************
539
;   *******  WINDOW DEFINITIONS AND DRAW ********
553
;   *******  WINDOW DEFINITIONS AND DRAW ********
540
;   *********************************************
554
;   *********************************************
541
 
555
 
542
 
556
 
543
draw_window:
557
draw_window:
544
    or	 [bWasDraw],1
558
    or	 [bWasDraw],1
545
 
559
 
546
    mov  eax,12 		   ; function 12:tell os about windowdraw
560
    mov  eax,12 		   ; function 12:tell os about windowdraw
547
    mov  ebx,1			   ; 1, start of draw
561
    mov  ebx,1			   ; 1, start of draw
548
    mcall
562
    mcall
549
 
563
 
550
				   ; DRAW WINDOW
564
				   ; DRAW WINDOW
551
    xor  eax,eax		   ; function 0 : define and draw window
565
    xor  eax,eax		   ; function 0 : define and draw window
552
;    mov  ebx,350                   ; [x start] *65536 + [x size]
566
;    mov  ebx,350                   ; [x start] *65536 + [x size]
553
;    mov  ecx,400                   ; [y start] *65536 + [y size]
567
;    mov  ecx,400                   ; [y start] *65536 + [y size]
554
    mov  ebx,0*65536
568
    mov  ebx,0*65536
555
    mov  ecx,0*65536
569
    mov  ecx,0*65536
556
    add  ebx,[wnd_width]
570
    add  ebx,[wnd_width]
557
    add  ecx,[wnd_height]
571
    add  ecx,[wnd_height]
-
 
572
    cmp  cx,55
-
 
573
    ja	 @f
-
 
574
    mov  cx,55
-
 
575
@@:
558
    mov  edx,0x43ffffff 	   ; color of work area RRGGBB,8->color gl
576
    mov  edx,0x43ffffff 	   ; color of work area RRGGBB,8->color gl
559
    mcall
577
    mcall
560
 
578
 
561
    call get_window_param
579
    call get_window_param
562
 
580
 
563
    mov   ebx,5
581
    mov   ebx,5
564
    shl   ebx,16
582
    shl   ebx,16
565
    add   ebx,[window_width]
583
    add   ebx,[window_width]
566
    sub   ebx,9
584
    sub   ebx,9
567
    push  ebx
585
    push  ebx
568
    mov   ecx,[skin_high]
586
    mov   ecx,[skin_high]
569
    shl   ecx,16
587
    shl   ecx,16
570
    add   ecx,50
588
    add   ecx,50
571
    sub   ecx,[skin_high]
589
    sub   ecx,[skin_high]
572
    mcall 13, , ,0xffffff
590
    mcall 13, , ,0xffffff
573
    mov  eax,[image_file]
591
    mov  eax,[image_file]
574
    mov  ecx,[eax+22]
592
    mov  ecx,[eax+22]
575
    mov  ebx,[eax+18]
593
    mov  ebx,[eax+18]
576
    push ecx
594
    push ecx
577
    add  ebx,5
595
    add  ebx,5
578
    mov  ax,bx
596
    mov  ax,bx
579
    shl  ebx,16
597
    shl  ebx,16
580
    add  ebx,[window_width]
598
    add  ebx,[window_width]
581
    sub  ebx,4
599
    sub  ebx,4
582
    sub  bx,ax
600
    sub  bx,ax
583
    cmp  bx,0
601
    cmp  bx,0
584
    jb	 @f
602
    jbe  @f
585
    add  ecx,50 shl 16
603
    add  ecx,50 shl 16
586
    mcall 13, , ,0xffffff
604
    mcall 13, , ,0xffffff
587
@@:
605
@@:
588
    pop  ecx
606
    pop  ecx
589
    pop  ebx
607
    pop  ebx
590
    add  ecx,50
608
    add  ecx,50
591
    mov  ax,cx
609
    mov  ax,cx
592
    shl  ecx,16
610
    shl  ecx,16
593
    add  ecx,[window_high]
611
    add  ecx,[window_high]
594
    sub  cx,ax
612
    sub  cx,ax
595
    sub  ecx,4
613
    sub  ecx,4
596
    cmp  bx,0
614
    cmp  cx,0
597
    jb	 @f
615
    jbe  @f
598
    mcall 13, , ,0xffffff
616
    mcall 13, , ,0xffffff
599
@@:
617
@@:
600
    mov  eax,8
618
    mov  eax,8
601
    mov  ebx,10*65536+46
619
    mov  ebx,10*65536+46
602
    mov  ecx,25*65536+20
620
    mov  ecx,25*65536+20
603
    mov  edx,2
621
    mov  edx,2
604
    mov  esi,0x780078
622
    mov  esi,0x780078
605
  newbutton:
623
  newbutton:
606
    mcall
624
    mcall
607
    add  ebx,48*65536
625
    add  ebx,48*65536
608
    inc  edx
626
    inc  edx
609
    cmp  edx,6
627
    cmp  edx,6
610
    jb	 newbutton
628
    jb	 newbutton
611
 
629
 
612
				   ; WINDOW LABEL
630
				   ; WINDOW LABEL
613
    mov  eax,4			   ; function 4 : write text to window
631
    mov  eax,4			   ; function 4 : write text to window
614
    mov  ebx,8*65536+8		   ; [x start] *65536 + [y start]
632
    mov  ebx,8*65536+8		   ; [x start] *65536 + [y start]
615
    mov  ecx,0x10ddeeff 	   ; font 1 & color ( 0xF0RRGGBB )
633
    mov  ecx,0x10ddeeff 	   ; font 1 & color ( 0xF0RRGGBB )
616
    mov  edx,labelt		   ; pointer to text beginning
634
    mov  edx,labelt		   ; pointer to text beginning
617
    mov  esi,12 		   ; text length
635
    mov  esi,12 		   ; text length
618
    mcall
636
    mcall
619
 
637
 
620
    mov  ebx,14*65536+32
638
    mov  ebx,14*65536+32
621
    mov  edx,buttext
639
    mov  edx,buttext
622
    mov  esi,26
640
    mov  esi,26
623
    mcall
641
    mcall
624
 
642
 
625
    call drawimage
643
    call drawimage
626
 
644
 
627
    mov  eax,12 		   ; function 12:tell os about windowdraw
645
    mov  eax,12 		   ; function 12:tell os about windowdraw
628
    mov  ebx,2			   ; 2, end of draw
646
    mov  ebx,2			   ; 2, end of draw
629
    mcall
647
    mcall
630
 
648
 
631
    ret
649
    ret
632
 
650
 
633
 
651
 
634
; DATA AREA
652
; DATA AREA
635
 
653
 
636
labelt:
654
labelt:
637
	 db 'MeView v.0.4'
655
	 db 'MeView v.0.4'
638
 
656
 
639
lsz buttext,\
657
lsz buttext,\
640
    en,   ' FILE   OPEN   INFO   BGRD',\
658
    en,   ' FILE   OPEN   INFO   BGRD',\
641
    ru,   ' ”€‰‹  Ž’Š   ˆ”Ž   ”Ž  ',\
659
    ru,   ' ”€‰‹  Ž’Š   ˆ”Ž   ”Ž  ',\
642
    de,   'DATEI OEFNEN  INFO   HGRD'
660
    de,   'DATEI OEFNEN  INFO   HGRD'
643
 
661
 
644
thread1:			; start of thread1
662
thread1:			; start of thread1
645
 
663
 
646
	  mcall 40, 0x27
664
	  mcall 40, 0x27
-
 
665
 
-
 
666
   or  ecx,-1		; get information about me
-
 
667
   call getappinfo
647
 
668
 
648
    mov  esi,string
669
    mov  esi,string
649
@@:
670
@@:
650
    cld
671
    cld
651
    lodsb
672
    lodsb
652
    test al,al
673
    test al,al
653
    jne  @r
674
    jne  @r
654
    sub  esi,string
675
    sub  esi,string
655
    mov  eax,esi
676
    mov  eax,esi
656
    dec  eax
677
    dec  eax
657
    mov edi, edit1
678
    mov edi, edit1
658
    mov ed_size, eax
679
    mov ed_size, eax
659
    mov ed_pos, eax
680
    mov ed_pos, eax
660
red1:
681
red1:
661
    call draw_window1
682
    call draw_window1
662
 
683
 
663
still1:
684
still1:
664
 
685
 
665
    mov  eax,10 		; wait here for event
-
 
666
    mcall
686
    mcall 10		; wait here for event
667
 
687
 
668
    cmp  eax,1			; redraw request ?
688
    cmp  eax,1			; redraw request ?
669
    je	 red1
689
    je	 red1
670
    cmp  eax,2			; key in buffer ?
690
    cmp  eax,2			; key in buffer ?
671
    je	 key1
691
    je	 key1
672
    cmp  eax,3			; button in buffer ?
692
    cmp  eax,3			; button in buffer ?
673
    je	 button1
693
    je	 button1
-
 
694
 
674
	  mouse_edit_box name_editboxes
695
	  mouse_edit_box name_editboxes
675
    jmp  still1
696
    jmp  still1
676
 
697
 
677
  key1: 			; key
698
  key1: 			; key
678
    mcall 2
699
    mcall 2
679
    cmp ah,13
700
    cmp ah,13
680
    je	close1
701
    je	close1
681
    cmp ah,27
702
    cmp ah,27
682
    je	close1
703
    je	close1
-
 
704
 
683
    key_edit_box name_editboxes
705
    key_edit_box name_editboxes
684
    jmp  still1
706
    jmp  still1
685
 
707
 
686
  button1:			; button
708
  button1:			; button
687
    mov  eax,17 		; get id
709
    mov  eax,17 		; get id
688
    mcall
710
    mcall
689
 
711
 
690
    cmp  ah,1			; button id=1 ?
712
    cmp  ah,1			; button id=1 ?
691
    jne  still1
713
    jne  still1
692
  close1:
714
  close1:
693
    bts  dword [status],2
715
    bts  dword [status],2
694
    btr  dword [status],0
716
    btr  dword [status],0
695
    mov  eax,-1 		; close this program
717
    mov  eax,-1 		; close this program
696
    mcall
718
    mcall
697
 
719
 
698
    jmp  still1
720
    jmp  still1
699
 
721
 
700
;   *********************************************
722
;   *********************************************
701
;   *******  WINDOW DEFINITIONS AND DRAW ********
723
;   *******  WINDOW DEFINITIONS AND DRAW ********
702
;   *********************************************
724
;   *********************************************
703
 
725
 
704
 
726
 
705
draw_window1:
727
draw_window1:
706
 
728
 
707
 
729
 
708
    mov  eax,12 		   ; function 12:tell os about windowdraw
730
    mov  eax,12 		   ; function 12:tell os about windowdraw
709
    mov  ebx,1			   ; 1, start of draw
731
    mov  ebx,1			   ; 1, start of draw
710
    mcall
732
    mcall
711
 
733
 
712
				   ; DRAW WINDOW
734
				   ; DRAW WINDOW
713
    xor  eax,eax		   ; function 0 : define and draw window
735
    xor  eax,eax		   ; function 0 : define and draw window
714
    mov  ebx,100*65536+300	   ; [x start] *65536 + [x size]
736
    mov  ebx,100*65536+300	   ; [x start] *65536 + [x size]
715
    mov  ecx,100*65536+80	   ; [y start] *65536 + [y size]
737
    mov  ecx,100*65536+80	   ; [y start] *65536 + [y size]
716
    mov  edx,0x03780078 	   ; color of work area RRGGBB,8->color gl
738
    mov  edx,0x03780078 	   ; color of work area RRGGBB,8->color gl
717
    mcall
739
    mcall
718
 
740
 
719
				   ; WINDOW LABEL
741
				   ; WINDOW LABEL
720
    mov  eax,4			   ; function 4 : write text to window
742
    mov  eax,4			   ; function 4 : write text to window
721
    mov  ebx,8*65536+8		   ; [x start] *65536 + [y start]
743
    mov  ebx,8*65536+8		   ; [x start] *65536 + [y start]
722
    mov  ecx,0x10ddeeff 	   ; font 1 & color ( 0xF0RRGGBB )
744
    mov  ecx,0x10ddeeff 	   ; font 1 & color ( 0xF0RRGGBB )
723
    mov  edx,labelt1		   ; pointer to text beginning
745
    mov  edx,labelt1		   ; pointer to text beginning
724
    mov  esi,labelt1.size	   ; text length
746
    mov  esi,labelt1.size	   ; text length
725
    mcall
747
    mcall
726
 
748
 
727
;    call drawstring
749
;    call drawstring
728
	draw_edit_box name_editboxes
750
	draw_edit_box name_editboxes
729
 
751
 
730
    mov  eax,12 		   ; function 12:tell os about windowdraw
752
    mov  eax,12 		   ; function 12:tell os about windowdraw
731
    mov  ebx,2			   ; 2, end of draw
753
    mov  ebx,2			   ; 2, end of draw
732
    mcall
754
    mcall
733
 
755
 
734
    ret
756
    ret
735
 
757
 
736
 drawstring:
758
 drawstring:
737
    pusha
759
    pusha
738
    mov  eax,8		   ;invisible button
760
    mov  eax,8		   ;invisible button
739
    mov  ebx,21*65536+258
761
    mov  ebx,21*65536+258
740
    mov  ecx,40*65536+15
762
    mov  ecx,40*65536+15
741
    mov  edx,0x60000002
763
    mov  edx,0x60000002
742
    mcall
764
    mcall
743
 
765
 
744
    mov  eax,13 	    ;bar
766
    mov  eax,13 	    ;bar
745
    mov  edx,0xe0e0e0
767
    mov  edx,0xe0e0e0
746
    mcall
768
    mcall
747
    push eax		    ;cursor
769
    push eax		    ;cursor
748
    mov  eax,6*65536
770
    mov  eax,6*65536
749
    mul  dword [pos]
771
    mul  dword [pos]
750
    add  eax,21*65536+6
772
    add  eax,21*65536+6
751
    mov  ebx,eax
773
    mov  ebx,eax
752
    pop  eax
774
    pop  eax
753
    mov  edx,0x6a73d0
775
    mov  edx,0x6a73d0
754
    mcall
776
    mcall
755
    mov  eax,4		    ;path
777
    mov  eax,4		    ;path
756
    mov  ebx,21*65536+44
778
    mov  ebx,21*65536+44
757
    xor  ecx,ecx
779
    xor  ecx,ecx
758
    mov  edx,string
780
    mov  edx,string
759
    mov  esi,43
781
    mov  esi,43
760
    mcall
782
    mcall
761
 
783
 
762
 
784
 
763
    popa
785
    popa
764
    ret
786
    ret
765
 
787
 
766
; DATA AREA
788
; DATA AREA
767
 
789
 
768
lsz labelt1,\
790
lsz labelt1,\
769
   en,	'File',\
791
   en,	'File',\
770
   ru,	'” ©«',\
792
   ru,	'” ©«',\
771
   de,	'Datei'
793
   de,	'Datei'
772
 
794
 
773
thread2:			  ; start of info thread
795
thread2:			  ; start of info thread
774
 
796
 
775
     call draw_window2
797
     call draw_window2
776
 
798
 
777
still2:
799
still2:
778
 
800
 
779
    mov  eax,10 		; wait here for event
801
    mov  eax,10 		; wait here for event
780
    mcall
802
    mcall
781
 
803
 
782
    cmp  eax,1			; redraw request ?
804
    cmp  eax,1			; redraw request ?
783
    je	 thread2
805
    je	 thread2
784
    cmp  eax,2			; key in buffer ?
806
    cmp  eax,2			; key in buffer ?
785
    je	 close2
807
    je	 close2
786
    cmp  eax,3			; button in buffer ?
808
    cmp  eax,3			; button in buffer ?
787
    je	 button2
809
    je	 button2
788
 
810
 
789
    jmp  still2
811
    jmp  still2
790
 
812
 
791
  button2:			 ; button
813
  button2:			 ; button
792
    mov  eax,17 		; get id
814
    mov  eax,17 		; get id
793
    mcall
815
    mcall
794
 
816
 
795
    cmp  ah,1			; button id=1 ?
817
    cmp  ah,1			; button id=1 ?
796
    jne  noclose2
818
    jne  noclose2
797
  close2:
819
  close2:
798
    btr dword [status],1
820
    btr dword [status],1
799
    bts dword [status],2
821
    bts dword [status],2
800
    mov  eax,-1 		; close this program
822
    mov  eax,-1 		; close this program
801
    mcall
823
    mcall
802
  noclose2:
824
  noclose2:
803
 
825
 
804
    jmp  still2
826
    jmp  still2
805
 
827
 
806
 
828
 
807
 
829
 
808
 
830
 
809
;   *********************************************
831
;   *********************************************
810
;   *******  WINDOW DEFINITIONS AND DRAW ********
832
;   *******  WINDOW DEFINITIONS AND DRAW ********
811
;   *********************************************
833
;   *********************************************
812
 
834
 
813
 
835
 
814
draw_window2:
836
draw_window2:
815
 
837
 
816
 
838
 
817
    mov  eax,12 		   ; function 12:tell os about windowdraw
839
    mov  eax,12 		   ; function 12:tell os about windowdraw
818
    mov  ebx,1			   ; 1, start of draw
840
    mov  ebx,1			   ; 1, start of draw
819
    mcall
841
    mcall
820
 
842
 
821
				   ; DRAW WINDOW
843
				   ; DRAW WINDOW
822
    xor  eax,eax		   ; function 0 : define and draw window
844
    xor  eax,eax		   ; function 0 : define and draw window
823
    mov  ebx,100*65536+330	   ; [x start] *65536 + [x size]
845
    mov  ebx,100*65536+330	   ; [x start] *65536 + [x size]
824
    mov  ecx,100*65536+90	   ; [y start] *65536 + [y size]
846
    mov  ecx,100*65536+90	   ; [y start] *65536 + [y size]
825
    mov  edx,0x03780078 	   ; color of work area RRGGBB,8->color gl
847
    mov  edx,0x03780078 	   ; color of work area RRGGBB,8->color gl
826
    mcall
848
    mcall
827
 
849
 
828
				   ; WINDOW LABEL
850
				   ; WINDOW LABEL
829
    mov  eax,4			   ; function 4 : write text to window
851
    mov  eax,4			   ; function 4 : write text to window
830
    mov  ebx,8*65536+8		   ; [x start] *65536 + [y start]
852
    mov  ebx,8*65536+8		   ; [x start] *65536 + [y start]
831
    mov  ecx,0x10ddeeff 	   ; font 1 & color ( 0xF0RRGGBB )
853
    mov  ecx,0x10ddeeff 	   ; font 1 & color ( 0xF0RRGGBB )
832
    mov  edx,labelt2		   ; pointer to text beginning
854
    mov  edx,labelt2		   ; pointer to text beginning
833
    mov  esi,labelt2.size	   ; text length
855
    mov  esi,labelt2.size	   ; text length
834
    mcall
856
    mcall
835
 
857
 
836
    mov  ebx,10*65536+30
858
    mov  ebx,10*65536+30
837
    mov  edx,string
859
    mov  edx,string
838
    mov  esi,43
860
    mov  esi,43
839
    mcall
861
    mcall
840
    mov  edx,fitext
862
    mov  edx,fitext
841
    mov  esi,14
863
    mov  esi,14
842
    add  ebx,70*65536+10
864
    add  ebx,70*65536+10
843
 followstring:
865
 followstring:
844
    mcall
866
    mcall
845
    add  ebx,10
867
    add  ebx,10
846
    add  edx,esi
868
    add  edx,esi
847
    cmp  ebx,80*65536+70
869
    cmp  ebx,80*65536+70
848
    jbe  followstring
870
    jbe  followstring
849
    mov  eax,47
871
    mov  eax,47
850
    mov  edx,200*65536+40
872
    mov  edx,200*65536+40
851
    mov  esi,ecx
873
    mov  esi,ecx
852
    mov  ecx,[image_file]
874
    mov  ecx,[image_file]
853
    push ecx
875
    push ecx
854
    mov  ecx, [ecx+2]
876
    mov  ecx, [ecx+2]
855
    call digitcorrect
877
    call digitcorrect
856
    mcall
878
    mcall
857
    add  edx,10
879
    add  edx,10
858
    pop  ecx
880
    pop  ecx
859
    push ecx
881
    push ecx
860
    mov  ecx, [ecx+18]
882
    mov  ecx, [ecx+18]
861
    call digitcorrect
883
    call digitcorrect
862
    mcall
884
    mcall
863
    add  edx,10
885
    add  edx,10
864
    pop  ecx
886
    pop  ecx
865
    push ecx
887
    push ecx
866
    mov  ecx, [ecx+22]
888
    mov  ecx, [ecx+22]
867
    call digitcorrect
889
    call digitcorrect
868
    mcall
890
    mcall
869
    add  edx,10
891
    add  edx,10
870
    pop  ecx
892
    pop  ecx
871
    movzx ecx,word [ecx+28]
893
    movzx ecx,word [ecx+28]
872
    call digitcorrect
894
    call digitcorrect
873
    mcall
895
    mcall
874
 
896
 
875
    mov  eax,12 		   ; function 12:tell os about windowdraw
897
    mov  eax,12 		   ; function 12:tell os about windowdraw
876
    mov  ebx,2			   ; 2, end of draw
898
    mov  ebx,2			   ; 2, end of draw
877
    mcall
899
    mcall
878
 
900
 
879
    ret
901
    ret
880
 
902
 
881
 digitcorrect:
903
 digitcorrect:
882
    xor  ebx,ebx
904
    xor  ebx,ebx
883
    mov  bh,6
905
    mov  bh,6
884
    cmp  ecx,99999
906
    cmp  ecx,99999
885
    ja	 c_end
907
    ja	 c_end
886
    dec  bh
908
    dec  bh
887
    cmp  ecx,9999
909
    cmp  ecx,9999
888
    ja	 c_end
910
    ja	 c_end
889
    dec  bh
911
    dec  bh
890
    cmp  ecx,999
912
    cmp  ecx,999
891
    ja	 c_end
913
    ja	 c_end
892
    dec  bh
914
    dec  bh
893
    cmp  ecx,99
915
    cmp  ecx,99
894
    ja	 c_end
916
    ja	 c_end
895
    dec  bh
917
    dec  bh
896
    cmp  ecx,9
918
    cmp  ecx,9
897
    ja	 c_end
919
    ja	 c_end
898
    dec  bh
920
    dec  bh
899
 c_end:
921
 c_end:
900
    bswap ebx
922
    bswap ebx
901
    ret
923
    ret
902
 
924
 
903
 
925
 
904
; DATA AREA
926
; DATA AREA
905
 
927
 
906
lsz labelt2,\
928
lsz labelt2,\
907
    en,   'File info',\
929
    en,   'File info',\
908
    ru,   'ˆ­ä®à¬ æ¨ï ® ä ©«¥',\
930
    ru,   'ˆ­ä®à¬ æ¨ï ® ä ©«¥',\
909
    de,   'Dateiinfo'
931
    de,   'Dateiinfo'
910
 
932
 
911
lsz fitext,\
933
lsz fitext,\
912
     en, 'FILE SIZE     ',\
934
     en, 'FILE SIZE     ',\
913
     en, 'X SIZE        ',\
935
     en, 'X SIZE        ',\
914
     en, 'Y SIZE        ',\
936
     en, 'Y SIZE        ',\
915
     en, 'BITS PER PIXEL',\
937
     en, 'BITS PER PIXEL',\
916
			  \
938
			  \
917
     ru, ' §¬¥à ä ©«   ',\
939
     ru, ' §¬¥à ä ©«   ',\
918
     ru, '˜¨à¨­         ',\
940
     ru, '˜¨à¨­         ',\
919
     ru, '‚ëá®â         ',\
941
     ru, '‚ëá®â         ',\
920
     ru, '¨â ­  ¯¨ªá¥« ',\
942
     ru, '¨â ­  ¯¨ªá¥« ',\
921
			  \
943
			  \
922
     de, 'FATEIGROESSE  ',\
944
     de, 'FATEIGROESSE  ',\
923
     de, 'X GROESSE     ',\
945
     de, 'X GROESSE     ',\
924
     de, 'Y GROESSE     ',\
946
     de, 'Y GROESSE     ',\
925
     de, 'BITS PER PIXEL'
947
     de, 'BITS PER PIXEL'
926
 
948
 
927
thread3:			  ; start of bgrd thread
949
thread3:			  ; start of bgrd thread
928
 
950
 
929
     call draw_window3
951
     call draw_window3
930
 
952
 
931
still3:
953
still3:
932
 
954
 
933
    mov  eax,10 		; wait here for event
955
    mov  eax,10 		; wait here for event
934
    mcall
956
    mcall
935
 
957
 
936
    cmp  eax,1			; redraw request ?
958
    cmp  eax,1			; redraw request ?
937
    je	 thread3
959
    je	 thread3
938
    cmp  eax,2			; key in buffer ?
960
    cmp  eax,2			; key in buffer ?
939
    je	 key3
961
    je	 key3
940
    cmp  eax,3			; button in buffer ?
962
    cmp  eax,3			; button in buffer ?
941
    je	 button3
963
    je	 button3
942
 
964
 
943
    jmp  still3
965
    jmp  still3
944
 
966
 
945
  key3:
967
  key3:
946
    mcall
968
    mcall
947
    cmp  ah,27
969
    cmp  ah,27
948
    je	 close3
970
    je	 close3
949
    cmp  ah,13
971
    cmp  ah,13
950
    je	 kok
972
    je	 kok
951
    cmp  ah,178 ;up
973
    cmp  ah,178 ;up
952
    jne  nofup
974
    jne  nofup
953
    cmp  dword [bgrmode],1
975
    cmp  dword [bgrmode],1
954
    je	 fdn
976
    je	 fdn
955
  fup:
977
  fup:
956
    dec dword [bgrmode]
978
    dec dword [bgrmode]
957
    jmp  flagcont
979
    jmp  flagcont
958
  nofup:
980
  nofup:
959
    cmp  ah,177 ;down
981
    cmp  ah,177 ;down
960
    jne  still3
982
    jne  still3
961
    cmp dword [bgrmode],2
983
    cmp dword [bgrmode],2
962
    je	 fup
984
    je	 fup
963
  fdn:
985
  fdn:
964
    inc dword [bgrmode]
986
    inc dword [bgrmode]
965
    jmp  flagcont
987
    jmp  flagcont
966
 
988
 
967
 
989
 
968
  button3:			 ; button
990
  button3:			 ; button
969
    mov  eax,17 		; get id
991
    mov  eax,17 		; get id
970
    mcall
992
    mcall
971
 
993
 
972
    cmp  ah,1			; button id=1 ?
994
    cmp  ah,1			; button id=1 ?
973
    jne  noclose3
995
    jne  noclose3
974
  close3:
996
  close3:
975
    btr dword [status],3
997
    btr dword [status],3
976
    bts dword [status],2
998
    bts dword [status],2
977
    mov  eax,-1 		; close this program
999
    mov  eax,-1 		; close this program
978
    mcall
1000
    mcall
979
  noclose3:
1001
  noclose3:
980
    cmp  ah,4
1002
    cmp  ah,4
981
    jne  nook
1003
    jne  nook
982
   kok:
1004
   kok:
983
    call background
1005
    call background
984
    jmp  close3
1006
    jmp  close3
985
  nook:
1007
  nook:
986
    cmp  ah,2
1008
    cmp  ah,2
987
    jb	 still3
1009
    jb	 still3
988
    cmp  ah,3
1010
    cmp  ah,3
989
    ja	 still3
1011
    ja	 still3
990
    dec  ah
1012
    dec  ah
991
    mov byte [bgrmode],ah
1013
    mov byte [bgrmode],ah
992
   flagcont:
1014
   flagcont:
993
    call drawflags
1015
    call drawflags
994
    jmp  still3
1016
    jmp  still3
995
 
1017
 
996
 
1018
 
997
 
1019
 
998
 
1020
 
999
;   *********************************************
1021
;   *********************************************
1000
;   *******  WINDOW DEFINITIONS AND DRAW ********
1022
;   *******  WINDOW DEFINITIONS AND DRAW ********
1001
;   *********************************************
1023
;   *********************************************
1002
 
1024
 
1003
 
1025
 
1004
draw_window3:
1026
draw_window3:
1005
 
1027
 
1006
 
1028
 
1007
    mov  eax,12 		   ; function 12:tell os about windowdraw
1029
    mov  eax,12 		   ; function 12:tell os about windowdraw
1008
    mov  ebx,1			   ; 1, start of draw
1030
    mov  ebx,1			   ; 1, start of draw
1009
    mcall
1031
    mcall
1010
 
1032
 
1011
				   ; DRAW WINDOW
1033
				   ; DRAW WINDOW
1012
    xor  eax,eax		   ; function 0 : define and draw window
1034
    xor  eax,eax		   ; function 0 : define and draw window
1013
    mov  ebx,100*65536+200	   ; [x start] *65536 + [x size]
1035
    mov  ebx,100*65536+200	   ; [x start] *65536 + [x size]
1014
    mov  ecx,100*65536+100	   ; [y start] *65536 + [y size]
1036
    mov  ecx,100*65536+100	   ; [y start] *65536 + [y size]
1015
    mov  edx,0x03780078 	   ; color of work area RRGGBB,8->color gl
1037
    mov  edx,0x03780078 	   ; color of work area RRGGBB,8->color gl
1016
    mcall
1038
    mcall
1017
 
1039
 
1018
    mov  eax,8
1040
    mov  eax,8
1019
    mov  ebx,70*65536+40
1041
    mov  ebx,70*65536+40
1020
    mov  ecx,70*65536+20
1042
    mov  ecx,70*65536+20
1021
    mov  edx,4
1043
    mov  edx,4
1022
    mov  esi,0xac0000
1044
    mov  esi,0xac0000
1023
    mcall
1045
    mcall
1024
 
1046
 
1025
				   ; WINDOW LABEL
1047
				   ; WINDOW LABEL
1026
    mov  eax,4			   ; function 4 : write text to window
1048
    mov  eax,4			   ; function 4 : write text to window
1027
    mov  ebx,8*65536+8		   ; [x start] *65536 + [y start]
1049
    mov  ebx,8*65536+8		   ; [x start] *65536 + [y start]
1028
    mov  ecx,0x10ddeeff 	   ; font 1 & color ( 0xF0RRGGBB )
1050
    mov  ecx,0x10ddeeff 	   ; font 1 & color ( 0xF0RRGGBB )
1029
    mov  edx,labelt3		   ; pointer to text beginning
1051
    mov  edx,labelt3		   ; pointer to text beginning
1030
    mov  esi,labelt3.size	   ; text length
1052
    mov  esi,labelt3.size	   ; text length
1031
    mcall
1053
    mcall
1032
    add  ebx,38*65536+20
1054
    add  ebx,38*65536+20
1033
    mov  ecx,0xddeeff
1055
    mov  ecx,0xddeeff
1034
    mov  edx, bgrdtext
1056
    mov  edx, bgrdtext
1035
    mov  esi, bgrdtext.size
1057
    mov  esi, bgrdtext.size
1036
    mcall
1058
    mcall
1037
    add  ebx,40*65536+15
1059
    add  ebx,40*65536+15
1038
    mov  edx, tiled
1060
    mov  edx, tiled
1039
    mov  esi, tiled.size
1061
    mov  esi, tiled.size
1040
    mcall
1062
    mcall
1041
    add  ebx,15
1063
    add  ebx,15
1042
    mov  edx, stretch
1064
    mov  edx, stretch
1043
    mov  esi, stretch.size ;7
1065
    mov  esi, stretch.size ;7
1044
    mcall
1066
    mcall
1045
    add  ebx,18
1067
    add  ebx,18
1046
    mov  edx, ok_btn
1068
    mov  edx, ok_btn
1047
    mov  esi, ok_btn.size ;2
1069
    mov  esi, ok_btn.size ;2
1048
    mcall
1070
    mcall
1049
 
1071
 
1050
    call drawflags
1072
    call drawflags
1051
 
1073
 
1052
    mov  eax,12 		   ; function 12:tell os about windowdraw
1074
    mov  eax,12 		   ; function 12:tell os about windowdraw
1053
    mov  ebx,2			   ; 2, end of draw
1075
    mov  ebx,2			   ; 2, end of draw
1054
    mcall
1076
    mcall
1055
 
1077
 
1056
    ret
1078
    ret
1057
 
1079
 
1058
 drawflags:
1080
 drawflags:
1059
    mov  eax,8
1081
    mov  eax,8
1060
    mov  ebx,70*65536+10
1082
    mov  ebx,70*65536+10
1061
    mov  ecx,40*65536+10
1083
    mov  ecx,40*65536+10
1062
    mov  edx,2
1084
    mov  edx,2
1063
    mov  esi,0xe0e0e0
1085
    mov  esi,0xe0e0e0
1064
    mcall
1086
    mcall
1065
    add  ecx,15*65536
1087
    add  ecx,15*65536
1066
    inc  edx
1088
    inc  edx
1067
    mcall
1089
    mcall
1068
    mov  eax,4
1090
    mov  eax,4
1069
    mov  ebx,73*65536+42
1091
    mov  ebx,73*65536+42
1070
    xor  ecx,ecx
1092
    xor  ecx,ecx
1071
    mov  edx,vflag
1093
    mov  edx,vflag
1072
    mov  esi,1
1094
    mov  esi,1
1073
    cmp  dword [bgrmode],1
1095
    cmp  dword [bgrmode],1
1074
    je	 nodownflag
1096
    je	 nodownflag
1075
    add  ebx,15
1097
    add  ebx,15
1076
 nodownflag:
1098
 nodownflag:
1077
    mcall
1099
    mcall
1078
    ret
1100
    ret
1079
 
1101
 
1080
 
1102
 
1081
; DATA AREA
1103
; DATA AREA
1082
status	 dd 0  ;bit0=1 if file thread is created
1104
status	 dd 0  ;bit0=1 if file thread is created
1083
soi	 dd 0
1105
soi	 dd 0
1084
delta	dd	0
1106
delta	dd	0
1085
process  dd 0
1107
process  dd 0
1086
 
1108
 
1087
bWasDraw db 0
1109
bWasDraw db 0
1088
vflag: db 'x'
1110
vflag: db 'x'
1089
bgrmode: dd 1
1111
bgrmode: dd 1
1090
 
1112
 
1091
wnd_width dd 210
1113
wnd_width dd 210
1092
wnd_height dd 53
1114
wnd_height dd 53
1093
 
1115
 
1094
lsz labelt3,\
1116
lsz labelt3,\
1095
    en,   'Background set',\
1117
    en,   'Background set',\
1096
    ru,   "“áâ ­®¢ª  ä®­ ",\
1118
    ru,   "“áâ ­®¢ª  ä®­ ",\
1097
    de,   'Hintergrund gesetzt'
1119
    de,   'Hintergrund gesetzt'
1098
 
1120
 
1099
lsz bgrdtext,\
1121
lsz bgrdtext,\
1100
    en, 'SET AS BACKGROUND:',\
1122
    en, 'SET AS BACKGROUND:',\
1101
    ru, '’¨¯ ®¡®¥¢:',\
1123
    ru, '’¨¯ ®¡®¥¢:',\
1102
    de, 'ALS HINTERGRUND'
1124
    de, 'ALS HINTERGRUND'
1103
 
1125
 
1104
lsz tiled,\
1126
lsz tiled,\
1105
    en, 'TILED',\
1127
    en, 'TILED',\
1106
    ru, '§ ¬®áâ¨âì',\
1128
    ru, '§ ¬®áâ¨âì',\
1107
    de, 'GEKACHELT'
1129
    de, 'GEKACHELT'
1108
 
1130
 
1109
lsz stretch,\
1131
lsz stretch,\
1110
    en, 'STRETCH',\
1132
    en, 'STRETCH',\
1111
    ru, 'à áâï­ãâì',\
1133
    ru, 'à áâï­ãâì',\
1112
    de, 'GESTRECKT'
1134
    de, 'GESTRECKT'
1113
 
1135
 
1114
lsz ok_btn,\
1136
lsz ok_btn,\
1115
    en, 'Ok',\
1137
    en, 'Ok',\
1116
    ru, 'Ok',\
1138
    ru, 'Ok',\
1117
    de, 'Ok'
1139
    de, 'Ok'
1118
 
1140
 
1119
image_file dd 0
1141
image_file dd 0
1120
;image_file_size dd 0
1142
image_file_1 dd 0
1121
 
1143
 
1122
pos: dd 6
1144
pos: dd 6
1123
 
1145
 
1124
window_high dd 0
1146
window_high dd 0
1125
window_width dd 0
1147
window_width dd 0
1126
skin_high dd 0
1148
skin_high dd 0
1127
;---------------------------------------------------------------------
1149
;---------------------------------------------------------------------
1128
; for EDITBOX
1150
; for EDITBOX
1129
name_editboxes:
1151
name_editboxes:
1130
edit1 edit_box 200,10,30,0xffffff,0xbbddff,0,0,0,255,string,ed_focus+ed_always_focus,0
1152
edit1 edit_box 200,10,30,0xffffff,0xbbddff,0,0,0,255,string,ed_focus+ed_always_focus,0
1131
name_editboxes_end:
1153
name_editboxes_end:
1132
 
1154
 
1133
mouse_flag: dd 0x0
1155
mouse_flag: dd 0x0
1134
;---------------------------------------------------------------------
1156
;---------------------------------------------------------------------
1135
fileinfo:
1157
fileinfo:
1136
     dd 5
1158
     dd 5
1137
     dd 0
1159
     dd 0
1138
     dd 0
1160
     dd 0
1139
     dd 0		;x290000-I_END
1161
     dd 0
1140
     dd process_info	;I_END
1162
     dd process_info
1141
string:
1163
string:
1142
	db	'/sys/bgr.bmp',0
1164
	db	'/sys/bgr.bmp',0
1143
 
1165
 
1144
IM_END:
1166
IM_END:
1145
	rb	string+257-$
1167
	rb	string+257-$
1146
 
1168
 
1147
temp_area:
1169
temp_area:
1148
procinfo:
1170
procinfo:
1149
process_info:
1171
process_info:
1150
rb 1024*4
1172
rb 1024*4
1151
rb 1024*2
1173
rb 1024*2
1152
;rb 0x10000
-
 
1153
thread:
1174
thread:
1154
rb 512
1175
rb 512
1155
I_END:
1176
I_END: