Subversion Repositories Kolibri OS

Rev

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

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