Subversion Repositories Kolibri OS

Rev

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

Rev 2 Rev 33
1
setwindowdefaults:
1
setwindowdefaults:
2
        pushad
2
        pushad
3
 
3
 
4
        xor   eax,eax
4
        xor   eax,eax
5
        mov   ecx,0xc000
5
        mov   ecx,0xc000
6
       @@:
6
       @@:
7
        inc   eax
7
        inc   eax
8
        add   ecx,2
8
        add   ecx,2
9
        mov   [ecx+0x000],ax          ; process no
9
        mov   [ecx+0x000],ax          ; process no
10
        mov   [ecx+0x400],ax          ; positions in stack
10
        mov   [ecx+0x400],ax          ; positions in stack
11
        cmp   ecx,0xc400-2            ; the more high, the more surface
11
        cmp   ecx,0xc400-2            ; the more high, the more surface
12
        jnz   @b
12
        jnz   @b
13
 
13
 
14
        popad
14
        popad
15
        ret
15
        ret
16
 
16
 
17
 
17
 
18
 
18
 
19
; eax = cx
19
; eax = cx
20
; ebx = cy
20
; ebx = cy
21
; ecx = ex
21
; ecx = ex
22
; edx = ey
22
; edx = ey
23
; èäåÿ: ïåðåáðàòü âñå îêíà, íà÷èíàÿ ñ ñàìîãî íèæíåãî,
23
; èäåÿ: ïåðåáðàòü âñå îêíà, íà÷èíàÿ ñ ñàìîãî íèæíåãî,
24
;       è äëÿ êàæäîãî âûçâàòü setscreen
24
;       è äëÿ êàæäîãî âûçâàòü setscreen
25
align 4
25
align 4
26
calculatescreen:
26
calculatescreen:
27
        pushad
27
        pushad
28
        cli
28
        cli
29
 
29
 
30
        mov   esi, 1
30
        mov   esi, 1
31
        xor   eax, eax
31
        xor   eax, eax
32
        xor   ebx, ebx
32
        xor   ebx, ebx
33
        mov   ecx, [0xFE00]
33
        mov   ecx, [0xFE00]
34
        mov   edx, [0xFE04]
34
        mov   edx, [0xFE04]
35
        call  setscreen
35
        call  setscreen
36
 
36
 
37
        mov   ebp, [0x3004]        ; number of processes
37
        mov   ebp, [0x3004]        ; number of processes
38
        cmp   ebp, 1
38
        cmp   ebp, 1
39
        jbe   .finish
39
        jbe   .finish
40
        align 4
40
        align 4
41
      .new_wnd:
41
      .new_wnd:
42
        movzx edi, word [0xC400 + esi * 2]
42
        movzx edi, word [0xC400 + esi * 2]
43
        shl   edi, 5
43
        shl   edi, 5
44
        add   edi, window_data
44
        add   edi, window_data
45
        mov   eax, [edi+0]
45
        mov   eax, [edi+0]
46
        mov   ebx, [edi+4]
46
        mov   ebx, [edi+4]
47
        mov   ecx, [edi+8]
47
        mov   ecx, [edi+8]
48
        test  ecx, ecx
48
        test  ecx, ecx
49
        jz    .not_wnd
49
        jz    .not_wnd
50
        add   ecx, eax
50
        add   ecx, eax
51
        mov   edx, [edi+12]
51
        mov   edx, [edi+12]
52
        add   edx, ebx
52
        add   edx, ebx
53
        push  esi
53
        push  esi
54
        movzx esi, word [0xC400 + esi * 2]
54
        movzx esi, word [0xC400 + esi * 2]
55
        call  setscreen
55
        call  setscreen
56
        pop   esi
56
        pop   esi
57
      .not_wnd:
57
      .not_wnd:
58
        inc   esi
58
        inc   esi
59
        dec   ebp
59
        dec   ebp
60
        jnz   .new_wnd
60
        jnz   .new_wnd
61
      .finish:
61
      .finish:
62
        sti
62
        sti
63
        popad
63
        popad
64
ret
64
ret
65
 
65
 
66
 
66
 
67
 
67
 
68
virtual at esp
68
virtual at esp
69
  ff_xsz   dd ?
69
  ff_xsz   dd ?
70
  ff_ysz   dd ?
70
  ff_ysz   dd ?
71
  ff_scale dd ?
71
  ff_scale dd ?
72
end virtual
72
end virtual
73
 
73
 
74
align 4
74
align 4
75
; ðåçåðâèðóåò ìåñòî ïîä îêíî çàäàííîãî ïðîöåññà
75
; ðåçåðâèðóåò ìåñòî ïîä îêíî çàäàííîãî ïðîöåññà
76
setscreen:
76
setscreen:
77
;  eax  x start
77
;  eax  x start
78
;  ebx  y start
78
;  ebx  y start
79
;  ecx  x end
79
;  ecx  x end
80
;  edx  y end
80
;  edx  y end
81
;  esi  process number
81
;  esi  process number
82
pushad
82
pushad
83
        mov edi, esi ;;;word [esi*2+0xc400]
83
        mov edi, esi ;;;word [esi*2+0xc400]
84
        shl   edi, 8
84
        shl   edi, 8
85
        add   edi, 0x80000+0x80  ; address of random shaped window area
85
        add   edi, 0x80000+0x80  ; address of random shaped window area
86
        cmp   [edi], dword 0
86
        cmp   [edi], dword 0
87
        jne   .free_form
87
        jne   .free_form
88
 
88
 
89
        ; get x&y size
89
        ; get x&y size
90
        sub   ecx, eax
90
        sub   ecx, eax
91
        sub   edx, ebx
91
        sub   edx, ebx
92
        inc   ecx
92
        inc   ecx
93
        inc   edx
93
        inc   edx
94
 
94
 
95
        ; get WinMap start
95
        ; get WinMap start
96
        mov   edi, [0xFE00] ; screen_sx
96
        mov   edi, [0xFE00] ; screen_sx
97
        inc   edi
97
        inc   edi
98
        imul  edi, ebx
98
        imul  edi, ebx
99
        add   edi, eax
99
        add   edi, eax
100
        add   edi, WinMapAddress
100
        add   edi, WinMapAddress
101
 
101
 
102
  .new_y:
102
  .new_y:
103
        push  ecx ; sx
103
        push  ecx ; sx
104
        push  edx
104
        push  edx
105
 
105
 
106
        mov   edx, esi
106
        mov   edx, esi
107
        align 4
107
        align 4
108
  .new_x:
108
  .new_x:
109
        mov   byte [edi], dl
109
        mov   byte [edi], dl
110
        inc   edi
110
        inc   edi
111
        dec   ecx
111
        dec   ecx
112
        jnz   .new_x
112
        jnz   .new_x
113
 
113
 
114
        pop   edx
114
        pop   edx
115
        pop   ecx
115
        pop   ecx
116
        add   edi, [0xFE00]
116
        add   edi, [0xFE00]
117
        inc   edi
117
        inc   edi
118
        sub   edi, ecx
118
        sub   edi, ecx
119
        dec   edx
119
        dec   edx
120
        jnz   .new_y
120
        jnz   .new_y
121
 popad
121
 popad
122
 ret
122
 ret
123
  .read_byte:
123
  .read_byte:
124
   ;eax - address
124
   ;eax - address
125
   ;esi - slot
125
   ;esi - slot
126
        push  eax
126
        push  eax
127
        push  ebx
127
        push  ebx
128
        push  ecx
128
        push  ecx
129
        push  edx
129
        push  edx
130
        mov   edx,eax
130
        mov   edx,eax
131
        mov   eax,esi
131
        mov   eax,esi
132
        lea   ebx,[esp+12]
132
        lea   ebx,[esp+12]
133
        mov   ecx,1
133
        mov   ecx,1
134
        call  read_process_memory
134
        call  read_process_memory
135
        pop   edx
135
        pop   edx
136
        pop   ecx
136
        pop   ecx
137
        pop   ebx
137
        pop   ebx
138
        pop   eax
138
        pop   eax
139
        ret  
139
        ret  
140
  .free_form:
140
  .free_form:
141
 
141
 
142
        ;  for (y=0; y <= x_size; y++)
142
        ;  for (y=0; y <= x_size; y++)
143
        ;      for (x=0; x <= x_size; x++)
143
        ;      for (x=0; x <= x_size; x++)
144
        ;          if (shape[coord(x,y,scale)]==1)
144
        ;          if (shape[coord(x,y,scale)]==1)
145
        ;             set_pixel(x, y, process_number);
145
        ;             set_pixel(x, y, process_number);
146
 
146
 
147
        sub  ecx, eax
147
        sub  ecx, eax
148
        sub  edx, ebx
148
        sub  edx, ebx
149
        inc  ecx
149
        inc  ecx
150
        inc  edx
150
        inc  edx
151
 
151
 
152
        push  dword [edi+4]  ; push scale first -> for loop
152
        push  dword [edi+4]  ; push scale first -> for loop
153
 
153
 
154
        ; get WinMap start  -> ebp
154
        ; get WinMap start  -> ebp
155
        push  eax
155
        push  eax
156
        mov   eax, [0xFE00] ; screen_sx
156
        mov   eax, [0xFE00] ; screen_sx
157
        inc   eax
157
        inc   eax
158
        imul  eax, ebx   ;ebx
158
        imul  eax, ebx   ;ebx
159
        add   eax, [esp] ;eax
159
        add   eax, [esp] ;eax
160
        add   eax, WinMapAddress
160
        add   eax, WinMapAddress
161
        mov   ebp, eax
161
        mov   ebp, eax
162
 
162
 
163
        mov   edi, [edi]
163
        mov   edi, [edi]
164
;        mov   eax, esi
164
;        mov   eax, esi
165
;        shl   eax, 5
165
;        shl   eax, 5
166
;        add   edi, [eax+0x3000+0x10]
166
;        add   edi, [eax+0x3000+0x10]
167
        pop   eax
167
        pop   eax
168
 
168
 
169
        ; eax = x_start
169
        ; eax = x_start
170
        ; ebx = y_start
170
        ; ebx = y_start
171
        ; ecx = x_size
171
        ; ecx = x_size
172
        ; edx = y_size
172
        ; edx = y_size
173
        ; esi = process_number
173
        ; esi = process_number
174
        ; edi = &shape
174
        ; edi = &shape
175
        ;       [scale]
175
        ;       [scale]
176
        push edx ecx ;ebx eax
176
        push edx ecx ;ebx eax
177
        xor  ebx, ebx
177
        xor  ebx, ebx
178
        align 4
178
        align 4
179
      .ff_new_y:
179
      .ff_new_y:
180
        xor  edx, edx
180
        xor  edx, edx
181
        align 4
181
        align 4
182
      .ff_new_x:
182
      .ff_new_x:
183
        ; -- body --
183
        ; -- body --
184
        mov  ecx, [ff_scale]
184
        mov  ecx, [ff_scale]
185
        mov  eax, [ff_xsz]
185
        mov  eax, [ff_xsz]
186
        shr  eax, cl
186
        shr  eax, cl
187
        push ebx edx
187
        push ebx edx
188
        shr  ebx, cl
188
        shr  ebx, cl
189
        shr  edx, cl
189
        shr  edx, cl
190
        imul eax, ebx
190
        imul eax, ebx
191
        add  eax, edx
191
        add  eax, edx
192
        pop  edx ebx
192
        pop  edx ebx
193
        add  eax, edi ;[ff_shape]
193
        add  eax, edi ;[ff_shape]
194
        call .read_byte
194
        call .read_byte
195
;        cmp  byte [eax], 1
195
;        cmp  byte [eax], 1
196
;        jne  @f
196
;        jne  @f
197
        test al,al
197
        test al,al
198
        jz   @f
198
        jz   @f
199
        mov  eax, esi  ; [ff_proc]
199
        mov  eax, esi  ; [ff_proc]
200
        mov  [ebp], al
200
        mov  [ebp], al
201
       @@:
201
       @@:
202
        ; -- end body --
202
        ; -- end body --
203
        inc  ebp
203
        inc  ebp
204
        inc  edx
204
        inc  edx
205
        cmp  edx, [ff_xsz]
205
        cmp  edx, [ff_xsz]
206
        jb   .ff_new_x
206
        jb   .ff_new_x
207
        sub  ebp, [ff_xsz]
207
        sub  ebp, [ff_xsz]
208
        add  ebp, [0xFE00]  ; screen.x
208
        add  ebp, [0xFE00]  ; screen.x
209
        inc  ebp
209
        inc  ebp
210
        inc  ebx
210
        inc  ebx
211
        cmp  ebx, [ff_ysz]
211
        cmp  ebx, [ff_ysz]
212
        jb   .ff_new_y
212
        jb   .ff_new_y
213
 
213
 
214
        pop  ecx edx   ; eax ebx first
214
        pop  ecx edx   ; eax ebx first
215
        add  esp, 4
215
        add  esp, 4
216
popad
216
popad
217
ret
217
ret
218
 
218
 
219
 
219
 
220
display_settings:
220
display_settings:
221
 
221
 
222
;    eax = 0         ; DISPLAY redraw
222
;    eax = 0         ; DISPLAY redraw
223
;          ebx = 0   ; all
223
;          ebx = 0   ; all
224
;
224
;
225
;    eax = 1         ; BUTTON type
225
;    eax = 1         ; BUTTON type
226
;          ebx = 0   ; flat
226
;          ebx = 0   ; flat
227
;          ebx = 1   ; 3D
227
;          ebx = 1   ; 3D
228
;    eax = 2         ; set WINDOW colours
228
;    eax = 2         ; set WINDOW colours
229
;          ebx = pointer to table
229
;          ebx = pointer to table
230
;          ecx = number of bytes define
230
;          ecx = number of bytes define
231
;    eax = 3         ; get WINDOW colours
231
;    eax = 3         ; get WINDOW colours
232
;          ebx = pointer to table
232
;          ebx = pointer to table
233
;          ecx = number of bytes wanted
233
;          ecx = number of bytes wanted
234
;    eax = 4         ; get skin height
234
;    eax = 4         ; get skin height
235
;          input  : nothing
235
;          input  : nothing
236
;          output : eax = skin height in pixel
236
;          output : eax = skin height in pixel
237
 
237
 
238
 
238
 
239
     pushad
239
     pushad
240
 
240
 
241
     test eax, eax      ; redraw display
241
     test eax, eax      ; redraw display
242
     jnz  dspl0
242
     jnz  dspl0
243
     test ebx, ebx
243
     test ebx, ebx
244
     jnz  dspl0
244
     jnz  dspl0
245
     cmp  [windowtypechanged],dword 1
245
     cmp  [windowtypechanged],dword 1
246
     jne  dspl00
246
     jne  dspl00
247
     mov  [windowtypechanged],dword 0
247
     mov  [windowtypechanged],dword 0
248
     mov  [dlx],dword 0
248
     mov  [dlx],dword 0
249
     mov  [dly],dword 0
249
     mov  [dly],dword 0
250
     mov  eax,[0xfe00]
250
     mov  eax,[0xfe00]
251
     mov  [dlxe],eax
251
     mov  [dlxe],eax
252
     mov  eax,[0xfe04]
252
     mov  eax,[0xfe04]
253
     mov  [dlye],eax
253
     mov  [dlye],eax
254
     mov  eax,window_data
254
     mov  eax,window_data
255
     call redrawscreen
255
     call redrawscreen
256
   dspl00:
256
   dspl00:
257
     popad
257
     popad
258
     ret
258
     ret
259
   dspl0:
259
   dspl0:
260
 
260
 
261
     cmp  eax,1       ; button type
261
     cmp  eax,1       ; button type
262
     jne  dspl1
262
     jne  dspl1
263
     and  ebx,1
263
     and  ebx,1
264
     cmp  ebx,[buttontype]
264
     cmp  ebx,[buttontype]
265
     je   dspl9
265
     je   dspl9
266
     mov  [buttontype],ebx
266
     mov  [buttontype],ebx
267
     mov  [windowtypechanged],dword 1
267
     mov  [windowtypechanged],dword 1
268
    dspl9:
268
    dspl9:
269
     popad
269
     popad
270
     ret
270
     ret
271
   dspl1:
271
   dspl1:
272
 
272
 
273
     cmp  eax,2       ; set common window colours
273
     cmp  eax,2       ; set common window colours
274
     jne  no_com_colours
274
     jne  no_com_colours
275
     mov  [windowtypechanged],dword 1
275
     mov  [windowtypechanged],dword 1
276
     mov  esi,[0x3010]
276
     mov  esi,[0x3010]
277
     add  esi,0x10
277
     add  esi,0x10
278
     add  ebx,[esi]
278
     add  ebx,[esi]
279
     mov  esi,ebx
279
     mov  esi,ebx
280
     mov  edi,common_colours
280
     mov  edi,common_colours
281
     and  ecx,127
281
     and  ecx,127
282
     cld
282
     cld
283
     rep  movsb
283
     rep  movsb
284
     popad
284
     popad
285
     ret
285
     ret
286
   no_com_colours:
286
   no_com_colours:
287
 
287
 
288
     cmp  eax,3       ; get common window colours
288
     cmp  eax,3       ; get common window colours
289
     jne  no_get_com
289
     jne  no_get_com
290
     mov  esi,[0x3010]
290
     mov  esi,[0x3010]
291
     add  esi,0x10
291
     add  esi,0x10
292
     add  ebx,[esi]
292
     add  ebx,[esi]
293
     mov  edi,ebx
293
     mov  edi,ebx
294
     mov  esi,common_colours
294
     mov  esi,common_colours
295
     and  ecx,127
295
     and  ecx,127
296
     cld
296
     cld
297
     rep  movsb
297
     rep  movsb
298
     popad
298
     popad
299
     ret
299
     ret
300
   no_get_com:
300
   no_get_com:
301
 
301
 
302
     cmp  eax,4       ; get skin height
302
     cmp  eax,4       ; get skin height
303
     jne  no_skin_height
303
     jne  no_skin_height
304
     popad
304
     popad
305
     mov  eax,[_skinh]
305
     mov  eax,[_skinh]
306
     mov  [esp+36],eax
306
     mov  [esp+36],eax
307
     ret
307
     ret
308
   no_skin_height:
308
   no_skin_height:
309
 
309
 
310
     popad
310
     popad
311
     ret
311
     ret
312
 
312
 
313
uglobal
313
uglobal
314
  common_colours:
314
  common_colours:
315
     times 128 db 0x0
315
     times 128 db 0x0
316
endg
316
endg
317
 
317
 
318
check_window_move_request:
318
check_window_move_request:
319
 
319
 
320
        pushad
320
        pushad
321
 
321
 
322
        mov   edi,[window_move_pr]    ; requestor process base
322
        mov   edi,[window_move_pr]    ; requestor process base
323
 
323
 
324
        cmp   edi,0
324
        cmp   edi,0
325
        je    window_move_return
325
        je    window_move_return
326
 
326
 
327
        shl   edi,5
327
        shl   edi,5
328
        add   edi,window_data
328
        add   edi,window_data
329
 
329
 
330
        push  dword [edi+0]           ; save old coordinates
330
        push  dword [edi+0]           ; save old coordinates
331
        push  dword [edi+4]
331
        push  dword [edi+4]
332
        push  dword [edi+8]
332
        push  dword [edi+8]
333
        push  dword [edi+12]
333
        push  dword [edi+12]
334
 
334
 
335
        mov   eax,[window_move_eax]
335
        mov   eax,[window_move_eax]
336
        mov   ebx,[window_move_ebx]
336
        mov   ebx,[window_move_ebx]
337
        mov   ecx,[window_move_ecx]
337
        mov   ecx,[window_move_ecx]
338
        mov   edx,[window_move_edx]
338
        mov   edx,[window_move_edx]
339
 
339
 
340
        cmp   eax,-1                  ; set new position and size
340
        cmp   eax,-1                  ; set new position and size
341
        je    no_x_reposition
341
        je    no_x_reposition
342
        mov   [edi+0],eax
342
        mov   [edi+0],eax
343
      no_x_reposition:
343
      no_x_reposition:
344
        cmp   ebx,-1
344
        cmp   ebx,-1
345
        je    no_y_reposition
345
        je    no_y_reposition
346
        mov   [edi+4],ebx
346
        mov   [edi+4],ebx
347
      no_y_reposition:
347
      no_y_reposition:
348
        cmp   ecx,-1
348
        cmp   ecx,-1
349
        je    no_x_resizing
349
        je    no_x_resizing
350
        mov   [edi+8],ecx
350
        mov   [edi+8],ecx
351
      no_x_resizing:
351
      no_x_resizing:
352
        cmp   edx,-1
352
        cmp   edx,-1
353
        je    no_y_resizing
353
        je    no_y_resizing
354
        mov   [edi+12],edx
354
        mov   [edi+12],edx
355
      no_y_resizing:
355
      no_y_resizing:
356
 
356
 
357
        call  check_window_position
357
        call  check_window_position
358
 
358
 
359
        pushad                       ; save for window fullscreen/resize
359
        pushad                       ; save for window fullscreen/resize
360
        mov   esi,edi
360
        mov   esi,edi
361
        sub   edi,window_data
361
        sub   edi,window_data
362
        shr   edi,5
362
        shr   edi,5
363
        shl   edi,8
363
        shl   edi,8
364
        add   edi,0x80000+0x90
364
        add   edi,0x80000+0x90
365
        mov   ecx,4
365
        mov   ecx,4
366
        cld
366
        cld
367
        rep   movsd
367
        rep   movsd
368
        popad
368
        popad
369
 
369
 
370
        pushad                       ; calculcate screen at new position
370
        pushad                       ; calculcate screen at new position
371
        mov   eax,[edi+00]
371
        mov   eax,[edi+00]
372
        mov   ebx,[edi+04]
372
        mov   ebx,[edi+04]
373
        mov   ecx,[edi+8]
373
        mov   ecx,[edi+8]
374
        mov   edx,[edi+12]
374
        mov   edx,[edi+12]
375
        add   ecx,eax
375
        add   ecx,eax
376
        add   edx,ebx
376
        add   edx,ebx
377
        call  calculatescreen
377
        call  calculatescreen
378
        popad
378
        popad
379
 
379
 
380
        pop   edx                   ; calculcate screen at old position
380
        pop   edx                   ; calculcate screen at old position
381
        pop   ecx
381
        pop   ecx
382
        pop   ebx
382
        pop   ebx
383
        pop   eax
383
        pop   eax
384
        add   ecx,eax
384
        add   ecx,eax
385
        add   edx,ebx
385
        add   edx,ebx
386
        mov   [dlx],eax             ; save for drawlimits
386
        mov   [dlx],eax             ; save for drawlimits
387
        mov   [dly],ebx
387
        mov   [dly],ebx
388
        mov   [dlxe],ecx
388
        mov   [dlxe],ecx
389
        mov   [dlye],edx
389
        mov   [dlye],edx
390
        call  calculatescreen
390
        call  calculatescreen
391
 
391
 
392
        mov   [edi+31],byte 1       ; flag the process as redraw
392
        mov   [edi+31],byte 1       ; flag the process as redraw
393
 
393
 
394
        mov   eax,edi               ; redraw screen at old position
394
        mov   eax,edi               ; redraw screen at old position
395
        xor   esi,esi
395
        xor   esi,esi
396
        call  redrawscreen
396
        call  redrawscreen
397
 
397
 
398
        mov   [0xfff5],byte 0 ; mouse pointer
398
        mov   [0xfff5],byte 0 ; mouse pointer
399
        mov   [0xfff4],byte 0 ; no mouse under
399
        mov   [0xfff4],byte 0 ; no mouse under
400
        mov   [0xfb44],byte 0 ; react to mouse up/down
400
        mov   [0xfb44],byte 0 ; react to mouse up/down
401
 
401
 
402
        mov   ecx,10          ; wait 1/10 second
402
        mov   ecx,10          ; wait 1/10 second
403
      wmrl3:
403
      wmrl3:
404
        call  check_mouse_data
-
 
405
        call  [draw_pointer]
404
        call  [draw_pointer]
406
        mov   eax,1
405
        mov   eax,1
407
        call  delay_hs
406
        call  delay_hs
408
        loop  wmrl3
407
        loop  wmrl3
409
 
408
 
410
        mov   [window_move_pr],0
409
        mov   [window_move_pr],0
411
 
410
 
412
      window_move_return:
411
      window_move_return:
413
 
412
 
414
        popad
413
        popad
415
 
414
 
416
        ret
415
        ret
417
 
416
 
418
 
417
 
419
 
418
 
420
 
419
 
421
check_window_position:
420
check_window_position:
422
 
421
 
423
    pushad                           ; window inside screen ?
422
    pushad                           ; window inside screen ?
424
 
423
 
425
    movzx eax,word [edi+0]
424
    movzx eax,word [edi+0]
426
    movzx ebx,word [edi+4]
425
    movzx ebx,word [edi+4]
427
    movzx ecx,word [edi+8]
426
    movzx ecx,word [edi+8]
428
    movzx edx,word [edi+12]
427
    movzx edx,word [edi+12]
429
 
428
 
430
    mov   esi,ecx             ; check x pos
429
    mov   esi,ecx             ; check x pos
431
    add   esi,eax
430
    add   esi,eax
432
    cmp   esi,[0xfe00]
431
    cmp   esi,[0xfe00]
433
    jbe   x_pos_ok
432
    jbe   x_pos_ok
434
    mov   [edi+0],dword 0
433
    mov   [edi+0],dword 0
435
    xor   eax, eax
434
    xor   eax, eax
436
  x_pos_ok:
435
  x_pos_ok:
437
 
436
 
438
    mov   esi,edx             ; check y pos
437
    mov   esi,edx             ; check y pos
439
    add   esi,ebx
438
    add   esi,ebx
440
    cmp   esi,[0xfe04]
439
    cmp   esi,[0xfe04]
441
    jbe   y_pos_ok
440
    jbe   y_pos_ok
442
    mov   [edi+4],dword 0
441
    mov   [edi+4],dword 0
443
    mov   ebx,0
442
    mov   ebx,0
444
  y_pos_ok:
443
  y_pos_ok:
445
 
444
 
446
    mov   esi,ecx             ; check x size
445
    mov   esi,ecx             ; check x size
447
    add   esi,eax
446
    add   esi,eax
448
    cmp   esi,[0xfe00]
447
    cmp   esi,[0xfe00]
449
    jbe   x_size_ok
448
    jbe   x_size_ok
450
    mov   ecx,[0xfe00]
449
    mov   ecx,[0xfe00]
451
    mov   [edi+8],ecx
450
    mov   [edi+8],ecx
452
  x_size_ok:
451
  x_size_ok:
453
 
452
 
454
    mov   esi,edx             ; check y size
453
    mov   esi,edx             ; check y size
455
    add   esi,ebx
454
    add   esi,ebx
456
    cmp   esi,[0xfe04]
455
    cmp   esi,[0xfe04]
457
    jbe   y_size_ok
456
    jbe   y_size_ok
458
    mov   edx,[0xfe04]
457
    mov   edx,[0xfe04]
459
    mov   [edi+12],edx
458
    mov   [edi+12],edx
460
  y_size_ok:
459
  y_size_ok:
461
 
460
 
462
    popad
461
    popad
463
 
462
 
464
    ret
463
    ret
465
 
464
 
466
 
465
 
467
uglobal
466
uglobal
468
  new_window_starting dd 0
467
  new_window_starting dd 0
469
endg
468
endg
470
 
469
 
471
 
470
 
472
sys_window_mouse:
471
sys_window_mouse:
473
 
472
 
474
    push  eax
473
    push  eax
475
 
474
 
476
    mov   eax,[timer_ticks] ;[0xfdf0]
475
    mov   eax,[timer_ticks] ;[0xfdf0]
477
    cmp   [new_window_starting],eax
476
    cmp   [new_window_starting],eax
478
    jb    swml1
477
    jb    swml1
479
 
478
 
480
    mov   [0xfff4],byte 0  ; no mouse background
479
    mov   [0xfff4],byte 0  ; no mouse background
481
    mov   [0xfff5],byte 0  ; draw mouse
480
    mov   [0xfff5],byte 0  ; draw mouse
482
 
481
 
483
    mov   [new_window_starting],eax
482
    mov   [new_window_starting],eax
484
 
483
 
485
  swml1:
484
  swml1:
486
 
485
 
487
    pop   eax
486
    pop   eax
488
 
487
 
489
    ret
488
    ret
490
 
489
 
491
drawwindow_I:
490
drawwindow_I:
492
 
491
 
493
        pushad
492
        pushad
494
 
493
 
495
        mov   esi,[edx+24]   ; rectangle
494
        mov   esi,[edx+24]   ; rectangle
496
        mov   eax,[edx+0]
495
        mov   eax,[edx+0]
497
        shl   eax,16
496
        shl   eax,16
498
        add   eax,[edx+0]
497
        add   eax,[edx+0]
499
        add   eax,[edx+8]
498
        add   eax,[edx+8]
500
        mov   ebx,[edx+04]
499
        mov   ebx,[edx+04]
501
        shl   ebx,16
500
        shl   ebx,16
502
        add   ebx,[edx+4]
501
        add   ebx,[edx+4]
503
        add   ebx,[edx+12]
502
        add   ebx,[edx+12]
504
        call  draw_rectangle
503
        call  draw_rectangle
505
 
504
 
506
        mov   ecx,[edx+20]   ; grab bar
505
        mov   ecx,[edx+20]   ; grab bar
507
        push  ecx
506
        push  ecx
508
        mov   esi,edx
507
        mov   esi,edx
509
        mov   edx,[esi+04]
508
        mov   edx,[esi+04]
510
        add   edx,1
509
        add   edx,1
511
        mov   ebx,[esi+04]
510
        mov   ebx,[esi+04]
512
        add   ebx,25
511
        add   ebx,25
513
        mov   eax,[esi+04]
512
        mov   eax,[esi+04]
514
        add   eax,[esi+12]
513
        add   eax,[esi+12]
515
        cmp   ebx,eax
514
        cmp   ebx,eax
516
        jb    wdsizeok
515
        jb    wdsizeok
517
        mov   ebx,eax
516
        mov   ebx,eax
518
      wdsizeok:
517
      wdsizeok:
519
        push  ebx
518
        push  ebx
520
      drwi:
519
      drwi:
521
        mov   ebx,edx
520
        mov   ebx,edx
522
        shl   ebx,16
521
        shl   ebx,16
523
        add   ebx,edx
522
        add   ebx,edx
524
        mov   eax,[esi+00]
523
        mov   eax,[esi+00]
525
        inc   eax
524
        inc   eax
526
        shl   eax,16
525
        shl   eax,16
527
        add   eax,[esi+00]
526
        add   eax,[esi+00]
528
        add   eax,[esi+8]
527
        add   eax,[esi+8]
529
        sub   eax,1
528
        sub   eax,1
530
        push  edx
529
        push  edx
531
        mov   edx,0x80000000
530
        mov   edx,0x80000000
532
        mov   ecx,[esi+20]
531
        mov   ecx,[esi+20]
533
        and   ecx,edx
532
        and   ecx,edx
534
        cmp   ecx,edx
533
        cmp   ecx,edx
535
        jnz   nofa
534
        jnz   nofa
536
        mov   ecx,[esi+20]
535
        mov   ecx,[esi+20]
537
        sub   ecx,0x00040404
536
        sub   ecx,0x00040404
538
        mov   [esi+20],ecx
537
        mov   [esi+20],ecx
539
        and   ecx,0x00ffffff
538
        and   ecx,0x00ffffff
540
        jmp   faj
539
        jmp   faj
541
      nofa:
540
      nofa:
542
        mov   ecx,[esi+20]
541
        mov   ecx,[esi+20]
543
        and   ecx,0x00ffffff
542
        and   ecx,0x00ffffff
544
      faj:
543
      faj:
545
        pop   edx
544
        pop   edx
546
        mov   edi,0
545
        mov   edi,0
547
        call  [draw_line]
546
        call  [draw_line]
548
        inc   edx
547
        inc   edx
549
        cmp   edx,[esp]
548
        cmp   edx,[esp]
550
        jb    drwi
549
        jb    drwi
551
        add   esp,4
550
        add   esp,4
552
        pop   ecx
551
        pop   ecx
553
        mov   [esi+20],ecx
552
        mov   [esi+20],ecx
554
 
553
 
555
        mov   edx,[esi+04]      ; inside work area
554
        mov   edx,[esi+04]      ; inside work area
556
        add   edx,21+5
555
        add   edx,21+5
557
        mov   ebx,[esi+04]
556
        mov   ebx,[esi+04]
558
        add   ebx,[esi+12]
557
        add   ebx,[esi+12]
559
        cmp   edx,ebx
558
        cmp   edx,ebx
560
        jg    noinside
559
        jg    noinside
561
        mov   eax,1
560
        mov   eax,1
562
        mov   ebx,21
561
        mov   ebx,21
563
        mov   ecx,[esi+8]
562
        mov   ecx,[esi+8]
564
        mov   edx,[esi+12]
563
        mov   edx,[esi+12]
565
        mov   edi,[esi+16]
564
        mov   edi,[esi+16]
566
        call  [drawbar]
565
        call  [drawbar]
567
      noinside:
566
      noinside:
568
 
567
 
569
        popad
568
        popad
570
 
569
 
571
        ret
570
        ret
572
 
571
 
573
 
572
 
574
draw_rectangle:
573
draw_rectangle:
575
 
574
 
576
r_eax equ [esp+28]   ; x start
575
r_eax equ [esp+28]   ; x start
577
r_ax  equ [esp+30]   ; x end
576
r_ax  equ [esp+30]   ; x end
578
r_ebx equ [esp+16]   ; y start
577
r_ebx equ [esp+16]   ; y start
579
r_bx  equ [esp+18]   ; y end
578
r_bx  equ [esp+18]   ; y end
580
;esi                 ; color
579
;esi                 ; color
581
 
580
 
582
        pushad
581
        pushad
583
 
582
 
584
        mov   ecx,esi          ; yb,xb -> yb,xe
583
        mov   ecx,esi          ; yb,xb -> yb,xe
585
     ;<<< 14.11.2004 Ivan Poddubny  
584
     ;<<< 14.11.2004 Ivan Poddubny  
586
;        mov   eax,r_eax
585
;        mov   eax,r_eax
587
;        shl   eax,16
586
;        shl   eax,16
588
;        mov   ax,r_ax
587
;        mov   ax,r_ax
589
        mov   eax, r_eax
588
        mov   eax, r_eax
590
        rol   eax, 16
589
        rol   eax, 16
591
     ;>>> 14.11.2004 Ivan Poddubny  
590
     ;>>> 14.11.2004 Ivan Poddubny  
592
        mov   ebx,r_ebx
591
        mov   ebx,r_ebx
593
        shl   ebx,16
592
        shl   ebx,16
594
        mov   bx,r_ebx
593
        mov   bx,r_ebx
595
        xor   edi, edi
594
        xor   edi, edi
596
        call  [draw_line]
595
        call  [draw_line]
597
 
596
 
598
        mov   ebx,r_bx         ; ye,xb -> ye,xe
597
        mov   ebx,r_bx         ; ye,xb -> ye,xe
599
        shl   ebx,16
598
        shl   ebx,16
600
        mov   bx,r_bx
599
        mov   bx,r_bx
601
        call  [draw_line]
600
        call  [draw_line]
602
 
601
 
603
        mov   ecx,esi          ; ya,xa -> ye,xa
602
        mov   ecx,esi          ; ya,xa -> ye,xa
604
        mov   eax,r_eax
603
        mov   eax,r_eax
605
        shl   eax,16
604
        shl   eax,16
606
        mov   ax,r_eax
605
        mov   ax,r_eax
607
        mov   ebx,r_ebx
606
        mov   ebx,r_ebx
608
        shl   ebx,16
607
        shl   ebx,16
609
        mov   bx,r_bx
608
        mov   bx,r_bx
610
        mov   edi,0
609
        mov   edi,0
611
        call  [draw_line]
610
        call  [draw_line]
612
 
611
 
613
        mov   eax,r_ax       ; ya,xe -> ye,xe
612
        mov   eax,r_ax       ; ya,xe -> ye,xe
614
        shl   eax,16
613
        shl   eax,16
615
        mov   ax,r_ax
614
        mov   ax,r_ax
616
        call  [draw_line]
615
        call  [draw_line]
617
 
616
 
618
        popad
617
        popad
619
        ret
618
        ret
620
 
619
 
621
 
620
 
622
drawwindow_III:
621
drawwindow_III:
623
 
622
 
624
        pushad
623
        pushad
625
 
624
 
626
        mov   edi,edx                              ; RECTANGLE
625
        mov   edi,edx                              ; RECTANGLE
627
        mov   eax,[edi+0]
626
        mov   eax,[edi+0]
628
        shl   eax,16
627
        shl   eax,16
629
        mov   ax,[edi+0]
628
        mov   ax,[edi+0]
630
        add   ax,[edi+8]
629
        add   ax,[edi+8]
631
        mov   ebx,[edi+4]
630
        mov   ebx,[edi+4]
632
        shl   ebx,16
631
        shl   ebx,16
633
        mov   bx,[edi+4]
632
        mov   bx,[edi+4]
634
        add   bx,[edi+12]
633
        add   bx,[edi+12]
635
        mov   esi,[edi+24]
634
        mov   esi,[edi+24]
636
        shr   esi,1
635
        shr   esi,1
637
        and   esi,0x007f7f7f
636
        and   esi,0x007f7f7f
638
        push  esi
637
        push  esi
639
        call  draw_rectangle
638
        call  draw_rectangle
640
        mov   ecx,3
639
        mov   ecx,3
641
      dw3l:
640
      dw3l:
642
        add   eax,1*65536-1
641
        add   eax,1*65536-1
643
        add   ebx,1*65536-1
642
        add   ebx,1*65536-1
644
        mov   esi,[edi+24]
643
        mov   esi,[edi+24]
645
        call  draw_rectangle
644
        call  draw_rectangle
646
        dec   ecx
645
        dec   ecx
647
        jnz   dw3l
646
        jnz   dw3l
648
        pop   esi
647
        pop   esi
649
        add   eax,1*65536-1
648
        add   eax,1*65536-1
650
        add   ebx,1*65536-1
649
        add   ebx,1*65536-1
651
        call  draw_rectangle
650
        call  draw_rectangle
652
 
651
 
653
        mov   ecx,[edx+20]                       ; GRAB BAR
652
        mov   ecx,[edx+20]                       ; GRAB BAR
654
        push  ecx
653
        push  ecx
655
        mov   esi,edx
654
        mov   esi,edx
656
        mov   edx,[esi+04]
655
        mov   edx,[esi+04]
657
        add   edx,4
656
        add   edx,4
658
        mov   ebx,[esi+04]
657
        mov   ebx,[esi+04]
659
        add   ebx,20
658
        add   ebx,20
660
        mov   eax,[esi+04]
659
        mov   eax,[esi+04]
661
        add   eax,[esi+12]
660
        add   eax,[esi+12]
662
        cmp   ebx,eax
661
        cmp   ebx,eax
663
        jb    wdsizeok2
662
        jb    wdsizeok2
664
        mov   ebx,eax
663
        mov   ebx,eax
665
      wdsizeok2:
664
      wdsizeok2:
666
        push  ebx
665
        push  ebx
667
      drwi2:
666
      drwi2:
668
        mov   ebx,edx
667
        mov   ebx,edx
669
        shl   ebx,16
668
        shl   ebx,16
670
        add   ebx,edx
669
        add   ebx,edx
671
        mov   eax,[esi+00]
670
        mov   eax,[esi+00]
672
        shl   eax,16
671
        shl   eax,16
673
        add   eax,[esi+00]
672
        add   eax,[esi+00]
674
        add   eax,[esi+8]
673
        add   eax,[esi+8]
675
        add   eax,4*65536-4
674
        add   eax,4*65536-4
676
        mov   ecx,[esi+20]
675
        mov   ecx,[esi+20]
677
        test  ecx,0x40000000
676
        test  ecx,0x40000000
678
        jz    nofa3
677
        jz    nofa3
679
        add   ecx,0x040404
678
        add   ecx,0x040404
680
      nofa3:
679
      nofa3:
681
        test  ecx,0x80000000
680
        test  ecx,0x80000000
682
        jz    nofa2
681
        jz    nofa2
683
        sub   ecx,0x040404
682
        sub   ecx,0x040404
684
      nofa2:
683
      nofa2:
685
        mov   [esi+20],ecx
684
        mov   [esi+20],ecx
686
        and   ecx,0xffffff
685
        and   ecx,0xffffff
687
        xor   edi, edi
686
        xor   edi, edi
688
        call  [draw_line]
687
        call  [draw_line]
689
        inc   edx
688
        inc   edx
690
        cmp   edx,[esp]
689
        cmp   edx,[esp]
691
        jb    drwi2
690
        jb    drwi2
692
        add   esp,4
691
        add   esp,4
693
        pop   ecx
692
        pop   ecx
694
        mov   [esi+20],ecx
693
        mov   [esi+20],ecx
695
 
694
 
696
        mov   edx,[esi+04]                       ; WORK AREA
695
        mov   edx,[esi+04]                       ; WORK AREA
697
        add   edx,21+5
696
        add   edx,21+5
698
        mov   ebx,[esi+04]
697
        mov   ebx,[esi+04]
699
        add   ebx,[esi+12]
698
        add   ebx,[esi+12]
700
        cmp   edx,ebx
699
        cmp   edx,ebx
701
        jg    noinside2
700
        jg    noinside2
702
        mov   eax,5
701
        mov   eax,5
703
        mov   ebx,20
702
        mov   ebx,20
704
        mov   ecx,[esi+8]
703
        mov   ecx,[esi+8]
705
        mov   edx,[esi+12]
704
        mov   edx,[esi+12]
706
        sub   ecx,4
705
        sub   ecx,4
707
        sub   edx,4
706
        sub   edx,4
708
        mov   edi,[esi+16]
707
        mov   edi,[esi+16]
709
        call  [drawbar]
708
        call  [drawbar]
710
      noinside2:
709
      noinside2:
711
 
710
 
712
        popad
711
        popad
713
 
712
 
714
        ret
713
        ret
715
 
714
 
716
 
715
 
717
 
716
 
718
; activate window
717
; activate window
719
align 4
718
align 4
720
windowactivate:
719
windowactivate:
721
 
720
 
722
        ; esi = abs mem position in stack 0xC400+
721
        ; esi = abs mem position in stack 0xC400+
723
 
722
 
724
        pushad
723
        pushad
725
 
-
 
726
       push   esi
724
        push   esi
727
      movzx   eax, word [esi] ; ax <- process no
725
      movzx   eax, word [esi] ; ax <- process no
728
      movzx   eax, word [0xC000+eax*2] ; ax <- position in window stack
726
      movzx   eax, word [0xC000+eax*2] ; ax <- position in window stack
729
 
727
 
730
        xor   esi, esi        ; drop others
728
        xor   esi, esi        ; drop others
731
      waloop:
729
      waloop:
732
        cmp   esi, dword [0x3004]
730
        cmp   esi, dword [0x3004]
733
        jae   wacont
731
        jae   wacont
734
        inc   esi
732
        inc   esi
735
        lea   edi, [0xC000 + esi*2]
733
        lea   edi, [0xC000 + esi*2]
736
        mov   bx, [edi] ; position of the current process
734
        mov   bx, [edi] ; position of the current process
737
        cmp   bx, ax
735
        cmp   bx, ax
738
        jbe   @f
736
        jbe   @f
739
        dec   bx       ; upper? => drop!
737
        dec   bx       ; upper? => drop!
740
        mov   [edi], bx
738
        mov   [edi], bx
741
      @@:
739
      @@:
742
        jmp   waloop
740
        jmp   waloop
743
      wacont:
741
      wacont:
744
                            ; set to no 1
742
                            ; set to no 1
745
        pop   esi           ;   esi = pointer at 0xC400
743
        pop   esi           ;   esi = pointer at 0xC400
746
 
744
 
747
      movzx   eax, word [esi]
745
      movzx   eax, word [esi]
748
        mov   bx, [0x3004]  ; number of processes
746
        mov   bx, [0x3004]  ; number of processes
749
        mov   [0xC000+eax*2], bx     ; this is the last (and the upper)
747
        mov   [0xC000+eax*2], bx     ; this is the last (and the upper)
750
 
748
 
751
;* start code - get active process (4) - Mario79
749
;* start code - get active process (4) - Mario79
-
 
750
        cli
-
 
751
        cmp  [active_process_flag],1
-
 
752
        jne  @f
-
 
753
        mov   [active_process_flag],0
-
 
754
        jmp   end_save_active_process
-
 
755
    @@:
-
 
756
        call save_active_process_stack
-
 
757
    end_save_active_process:
752
         mov  [active_process],eax
758
        mov  [active_process],eax
-
 
759
        push  eax
-
 
760
        mov   eax,[active_process]
-
 
761
        shl   eax,5
-
 
762
        add   eax,0x3000
-
 
763
        mov   [eax-twdw+31],byte 1
-
 
764
        pop   eax
-
 
765
        sti
753
;* end code - get active process (4) - Mario79
766
;* end code - get active process (4) - Mario79
754
 
767
 
755
        ; update on screen -window stack
768
        ; update on screen -window stack
756
        xor   esi, esi
769
        xor   esi, esi
757
      waloop2:
770
      waloop2:
758
        mov   edi, [0x3004]
771
        mov   edi, [0x3004]
759
        cmp   esi, edi
772
        cmp   esi, edi
760
        jae   wacont2
773
        jae   wacont2
761
        inc   esi
774
        inc   esi
762
        movzx ebx, word [esi*2 + 0xC000]
775
        movzx ebx, word [esi*2 + 0xC000]
763
        mov   [ebx*2 + 0xC400], si
776
        mov   [ebx*2 + 0xC400], si
764
        jmp   waloop2
777
        jmp   waloop2
765
      wacont2:
778
      wacont2:
766
 
-
 
767
        mov   [0xf400], byte 0           ; empty keyboard buffer
779
        mov   [0xf400], byte 0           ; empty keyboard buffer
768
        mov   [0xf500], byte 0           ; empty button buffer
780
        mov   [0xf500], byte 0           ; empty button buffer
769
 
-
 
770
        popad
781
        popad
771
        ret
782
        ret
772
 
783
 
773
 
784
 
774
; check if window is necessary to draw
785
; check if window is necessary to draw
775
 
786
 
776
checkwindowdraw:
787
checkwindowdraw:
777
 
788
 
778
        ; edi = position in window_data+
789
        ; edi = position in window_data+
779
 
790
 
780
        mov   esi, edi
791
        mov   esi, edi
781
        sub   esi, window_data
792
        sub   esi, window_data
782
        shr   esi, 5
793
        shr   esi, 5
783
 
794
 
784
        ; esi = process number
795
        ; esi = process number
785
 
796
 
786
; 
797
; 
787
        movzx eax, word [0xC000 + esi * 2] ; get value of the curr process
798
        movzx eax, word [0xC000 + esi * 2] ; get value of the curr process
788
        lea   esi, [0xC400 + eax * 2]      ; get address of this process at 0xC400
799
        lea   esi, [0xC400 + eax * 2]      ; get address of this process at 0xC400
789
; 
800
; 
790
 
801
 
791
        push  esi
802
        push  esi
792
 
803
 
793
      .new_check:
804
      .new_check:
794
 
805
 
795
        pop   esi
806
        pop   esi
796
        add   esi, 2
807
        add   esi, 2
797
        push  esi
808
        push  esi
798
 
809
 
799
        mov   eax, [0x3004]
810
        mov   eax, [0x3004]
800
        lea   eax, word [0xC400 + eax * 2] ; number of the upper window
811
        lea   eax, word [0xC400 + eax * 2] ; number of the upper window
801
 
812
 
802
        cmp   esi, eax
813
        cmp   esi, eax
803
        ja    .all_wnds_to_top
814
        ja    .all_wnds_to_top
804
 
815
 
805
        movzx eax, word [esi]
816
        movzx eax, word [esi]
806
        shl   eax, 5
817
        shl   eax, 5
807
        add   eax, window_data
818
        add   eax, window_data
808
        mov   esi, eax
819
        mov   esi, eax
809
 
820
 
810
        mov   ebx, [edi+4]
821
        mov   ebx, [edi+4]
811
        mov   edx, [edi+12]
822
        mov   edx, [edi+12]
812
        add   edx, ebx
823
        add   edx, ebx
813
 
824
 
814
        mov   ecx, [esi+4]    ; y check
825
        mov   ecx, [esi+4]    ; y check
815
        cmp   ecx, edx
826
        cmp   ecx, edx
816
        jae   .new_check
827
        jae   .new_check
817
        mov   eax, [esi+12]
828
        mov   eax, [esi+12]
818
        add   ecx, eax
829
        add   ecx, eax
819
        cmp   ebx, ecx
830
        cmp   ebx, ecx
820
        ja    .new_check
831
        ja    .new_check
821
 
832
 
822
        mov   eax, [edi+0]
833
        mov   eax, [edi+0]
823
        mov   ecx, [edi+8]
834
        mov   ecx, [edi+8]
824
        add   ecx, eax
835
        add   ecx, eax
825
 
836
 
826
        mov   edx, [esi+0]    ; x check
837
        mov   edx, [esi+0]    ; x check
827
        cmp   edx, ecx
838
        cmp   edx, ecx
828
        jae   .new_check
839
        jae   .new_check
829
        mov   ecx, [esi+8]
840
        mov   ecx, [esi+8]
830
        add   edx, ecx
841
        add   edx, ecx
831
        cmp   eax, edx
842
        cmp   eax, edx
832
        ja    .new_check
843
        ja    .new_check
833
 
844
 
834
        pop   esi
845
        pop   esi
835
        mov   ecx,1   ; overlap some window
846
        mov   ecx,1   ; overlap some window
836
        ret
847
        ret
837
 
848
 
838
  .all_wnds_to_top:
849
  .all_wnds_to_top:
839
 
850
 
840
        pop   esi
851
        pop   esi
841
 
852
 
842
        xor   ecx, ecx       ; passed all windows to top
853
        xor   ecx, ecx       ; passed all windows to top
843
        ret
854
        ret
844
 
855
 
845
 
856
 
846
 
857
 
847
 
858
 
848
waredraw:     ; if redraw necessary at activate
859
waredraw:     ; if redraw necessary at activate
849
 
860
 
850
        pushad
861
        pushad
851
 
862
 
852
        call  checkwindowdraw      ; draw window on activation ?
863
        call  checkwindowdraw      ; draw window on activation ?
853
        test  ecx, ecx
864
        test  ecx, ecx
854
        jz    .do_not_draw
865
        jz    .do_not_draw
855
 
866
 
856
        popad
867
        popad
857
        mov   [0xfb44], byte 1     ; do draw mouse
868
        mov   [0xfb44], byte 1     ; do draw mouse
858
        call  windowactivate
869
        call  windowactivate
859
 
870
 
860
        ; update screen info
871
        ; update screen info
861
        pushad
872
        pushad
862
        mov   edi, [0x3004] ; the last process (number)
873
        mov   edi, [0x3004] ; the last process (number)
863
        movzx esi, word [0xC400 + edi * 2]
874
        movzx esi, word [0xC400 + edi * 2]
864
        shl   esi, 5
875
        shl   esi, 5
865
        add   esi, window_data
876
        add   esi, window_data
866
 
877
 
867
        ; coordinates of the upper window
878
        ; coordinates of the upper window
868
        mov   eax, [esi+00] ; cx
879
        mov   eax, [esi+00] ; cx
869
        mov   ebx, [esi+04] ; cy
880
        mov   ebx, [esi+04] ; cy
870
        mov   ecx, [esi+08] ; sx
881
        mov   ecx, [esi+08] ; sx
871
        mov   edx, [esi+12] ; sy
882
        mov   edx, [esi+12] ; sy
872
 
883
 
873
        add   ecx, eax       ; ecx = x_end
884
        add   ecx, eax       ; ecx = x_end
874
        add   edx, ebx       ; edx = y_end
885
        add   edx, ebx       ; edx = y_end
875
 
886
 
876
        mov   edi, [0x3004]
887
        mov   edi, [0x3004]
877
        movzx esi, word [0xC400 + edi * 2]
888
        movzx esi, word [0xC400 + edi * 2]
878
        shl   esi, 5
889
        shl   esi, 5
879
        movzx esi, byte [esi + 0x3000 + 0xE]
890
        movzx esi, byte [esi + 0x3000 + 0xE]
880
        call  setscreen ;;;calculatescreen ; setscreen
891
        call  setscreen ;;;calculatescreen ; setscreen
881
        popad
892
        popad
882
 
893
 
883
        cmp   [0xff01], dword 1 ; if > 1 then activate process
894
        cmp   [0xff01], dword 1 ; if > 1 then activate process
884
        jbe   .not_activate
895
        jbe   .not_activate
885
 
896
 
886
;;;        mov   eax, 10            ; wait for putimages to finish
897
;;;        mov   eax, 10            ; wait for putimages to finish
887
;;;        call  delay_hs
898
;;;        call  delay_hs
888
 
899
 
889
        mov   [edi+31],byte 1  ; redraw flag for app
900
        mov   [edi+31],byte 1  ; redraw flag for app
890
        mov   [0xfb44],byte 0  ; mouse down checks
901
        mov   [0xfb44],byte 0  ; mouse down checks
891
 
902
 
892
        ret
903
        ret
893
 
904
 
894
     .not_activate:
905
     .not_activate:
895
 
906
 
896
;        mov   eax,5            ; wait for putimages to finish
907
;        mov   eax,5            ; wait for putimages to finish
897
;        call  delay_hs
908
;        call  delay_hs
898
 
909
 
899
        mov   [edi+31],byte 1  ; redraw flag for app
910
        mov   [edi+31],byte 1  ; redraw flag for app
900
 
911
 
901
        mov   ecx, 25 ;100
912
        mov   ecx, 25 ;100
902
     .waitflagdown:
913
     .waitflagdown:
903
        dec   ecx
914
        dec   ecx
904
        jz    .nowait
915
        jz    .nowait
905
        mov   eax, 2
916
;        mov   eax, 2
906
        call  delay_hs
917
;        call  delay_hs
907
        cmp   [edi+31], byte 0 ; wait flag to drop
918
        cmp   [edi+31], byte 0 ; wait flag to drop
908
        jnz   .waitflagdown
919
        jnz   .waitflagdown
909
      .nowait:
920
      .nowait:
910
 
921
 
911
;        mov   ecx,10
922
;        mov   ecx,10
912
;      .wait:
923
;      .wait:
913
;        mov   eax,1           ; wait for draw to finish
924
;        mov   eax,1           ; wait for draw to finish
914
;        call  delay_hs
925
;        call  delay_hs
915
;        loop  .wait
926
;        loop  .wait
916
 
927
 
917
        mov   [0xfb44],byte 0
928
        mov   [0xfb44],byte 0
918
 
929
 
919
        ret
930
        ret
920
 
931
 
921
     .do_not_draw:
932
     .do_not_draw:
922
 
933
 
923
        popad
934
        popad
924
 
935
 
925
        call  windowactivate
936
        call  windowactivate
926
        mov   [0xfb44],byte 0  ; mouse down checks
937
        mov   [0xfb44],byte 0  ; mouse down checks
927
        mov   [0xfff4],byte 0  ; no mouse background
938
        mov   [0xfff4],byte 0  ; no mouse background
928
        mov   [0xfff5],byte 0  ; draw mouse
939
        mov   [0xfff5],byte 0  ; draw mouse
929
        ret
940
        ret
930
 
941
 
931
 
942
 
932
iglobal
943
iglobal
933
  window_moving   db 'K : Window - move/resize',13,10,0
944
  window_moving   db 'K : Window - move/resize',13,10,0
934
  window_moved    db 'K : Window - done',13,10,0
945
  window_moved    db 'K : Window - done',13,10,0
935
endg
946
endg
936
 
947
 
937
; check window touch
948
; check window touch
938
align 4
949
align 4
939
checkwindows:
950
checkwindows:
940
        pushad
951
        pushad
941
 
952
 
942
        cmp  [0xff01],dword 1  ; activate request from app ?
953
        cmp  [0xff01],dword 1  ; activate request from app ?
943
        jbe  .no_activate_request
954
        jbe  .no_activate_request
944
        mov  edi,[0xff01]     ; process number
955
        mov  edi,[0xff01]     ; process number
945
        shl  edi,5
956
        shl  edi,5
946
        add  edi,window_data
957
        add  edi,window_data
947
        mov  ebx,[0xff01]
958
        mov  ebx,[0xff01]
948
        movzx esi, word [0xC000 + ebx * 2]
959
        movzx esi, word [0xC000 + ebx * 2]
949
        lea  esi, [0xC400 + esi * 2]
960
        lea  esi, [0xC400 + esi * 2]
950
        call waredraw
961
        call waredraw
951
 
962
 
952
;* start code - get active process (2) - Mario79
963
;* start code - get active process (2) - Mario79
953
        mov  eax,[0xff01]
964
;        mov  eax,[0xff01]
954
        mov  [active_process],eax
965
;        mov  [active_process],eax
955
;* end code - get active process  (2) - Mario79
966
;* end code - get active process  (2) - Mario79
956
 
967
 
957
        mov  [0xff01],dword 0  ; activated
968
        mov  [0xff01],dword 0  ; activated
958
 
969
 
959
        popad
970
        popad
960
        ret
971
        ret
961
 
972
 
962
    .no_activate_request:
973
    .no_activate_request:
963
    
974
    
964
        cmp   [0xfb40],byte 0    ; mouse buttons pressed ?
975
        cmp   [0xfb40],byte 0    ; mouse buttons pressed ?
965
        jne   .mouse_buttons_pressed
976
        jne   .mouse_buttons_pressed
966
;        cmp   [window_minimize],2
977
;        cmp   [window_minimize],2
967
;        jne   .no_activate_request_1
978
;        jne   .no_activate_request_1
968
        cmp   [window_minimize],0
979
        cmp   [window_minimize],0
969
        je   .no_activate_request_2
980
        je   .no_activate_request_2
970
        cmp   [window_minimize],1
981
        cmp   [window_minimize],1
971
        je    .mouse_buttons_pressed
982
        je    .mouse_buttons_pressed
972
        mov   esi,[0x3004]
983
        mov   esi,[0x3004]
973
        movzx edi, word [0xC400 + esi * 2]
984
        movzx edi, word [0xC400 + esi * 2]
974
        shl   edi, 5
985
        shl   edi, 5
975
        add   edi, window_data
986
        add   edi, window_data
976
        cmp   [edi+12],dword 0
987
        cmp   [edi+12],dword 0
977
        je    .mouse_buttons_pressed
988
        je    .mouse_buttons_pressed
978
;        jne   .no_activate_request_2
989
;        jne   .no_activate_request_2
979
;    .no_activate_request_1:
990
;    .no_activate_request_1:
980
;        cmp   [window_minimize],1
991
;        cmp   [window_minimize],1
981
;        jge   .mouse_buttons_pressed
992
;        jge   .mouse_buttons_pressed
982
;        jmp   .mouse_buttons_pressed
993
;        jmp   .mouse_buttons_pressed
983
    .no_activate_request_2:
994
    .no_activate_request_2:
984
        mov   [window_minimize],0
995
        mov   [window_minimize],0
985
        popad
996
        popad
986
        ret
997
        ret
987
 
998
 
988
    .mouse_buttons_pressed:
999
    .mouse_buttons_pressed:
989
 
1000
 
990
        mov   esi,[0x3004]
1001
        mov   esi,[0x3004]
991
        inc   esi
1002
        inc   esi
992
 
1003
 
993
      cwloop:
1004
      cwloop:
994
        cmp   esi,2
1005
        cmp   esi,2
995
        jb   .exit
1006
        jb   .exit
996
        .temp_window_minimize_1:
1007
        .temp_window_minimize_1:
997
        dec   esi
1008
        dec   esi
998
        movzx edi, word [0xC400 + esi * 2] ; ebx
1009
        movzx edi, word [0xC400 + esi * 2] ; ebx
999
        shl   edi, 5
1010
        shl   edi, 5
1000
        add   edi, window_data
1011
        add   edi, window_data
1001
;        mov   edi, ebx
1012
;        mov   edi, ebx
1002
        mov   ecx, [edi+0]
1013
        mov   ecx, [edi+0]
1003
        mov   edx, [edi+4]
1014
        mov   edx, [edi+4]
1004
 
1015
 
1005
        mov   eax,ecx
1016
        mov   eax,ecx
1006
        mov   ebx,edx
1017
        mov   ebx,edx
1007
       cmp   [window_minimize],1
1018
       cmp   [window_minimize],1
1008
       jge   .window_minimize_no_check_mouse
1019
       jge   .window_minimize_no_check_mouse
1009
 
1020
 
1010
       movzx  eax, word [0xfb0a]
1021
       movzx  eax, word [0xfb0a]
1011
       movzx  ebx, word [0xfb0c]
1022
       movzx  ebx, word [0xfb0c]
1012
       
1023
       
1013
        cmp   ecx, eax
1024
        cmp   ecx, eax
1014
        jae   cwloop
1025
        jae   cwloop
1015
        cmp   edx, ebx
1026
        cmp   edx, ebx
1016
        jae   cwloop
1027
        jae   cwloop
1017
        add   ecx, [edi+8]
1028
        add   ecx, [edi+8]
1018
        add   edx, [edi+12]
1029
        add   edx, [edi+12]
1019
        cmp   eax, ecx
1030
        cmp   eax, ecx
1020
        jae   cwloop
1031
        jae   cwloop
1021
        cmp   ebx, edx
1032
        cmp   ebx, edx
1022
        jae   cwloop
1033
        jae   cwloop
1023
 
1034
 
1024
      .window_minimize_no_check_mouse:
1035
      .window_minimize_no_check_mouse:
1025
 
1036
 
1026
        pushad
1037
        pushad
1027
        mov   eax, esi
1038
        mov   eax, esi
1028
        mov   ebx, [0x3004]
1039
        mov   ebx, [0x3004]
1029
        cmp   eax, ebx      ; is this window active?
1040
        cmp   eax, ebx      ; is this window active?
1030
        jz    .move_resize_window
1041
        jz    .move_resize_window
1031
 
1042
 
1032
        ; eax = position in windowing stack
1043
        ; eax = position in windowing stack
1033
        ; redraw must ?
1044
        ; redraw must ?
1034
        lea   esi, [0xC400 + esi * 2]
1045
        lea   esi, [0xC400 + esi * 2]
1035
        call  waredraw
1046
        call  waredraw
1036
        add   esp, 32
1047
        add   esp, 32
1037
 
1048
 
1038
      .exit:
1049
      .exit:
1039
        popad
1050
        popad
1040
        ret
1051
        ret
1041
 
1052
 
1042
   .move_resize_window:    ; MOVE OR RESIZE WINDOW
1053
   .move_resize_window:    ; MOVE OR RESIZE WINDOW
1043
 
1054
 
1044
        popad
1055
        popad
1045
 
1056
 
1046
        ; Check for user enabled fixed window
1057
        ; Check for user enabled fixed window
1047
        mov   edx, [edi+0x14]
1058
        mov   edx, [edi+0x14]
1048
        and   edx, 0x0f000000
1059
        and   edx, 0x0f000000
1049
        cmp   edx, 0x01000000
1060
        cmp   edx, 0x01000000
1050
        jne   .window_move_enabled_for_user
1061
        jne   .window_move_enabled_for_user
1051
        popad
1062
        popad
1052
        ret
1063
        ret
1053
      .window_move_enabled_for_user:
1064
      .window_move_enabled_for_user:
1054
 
1065
 
1055
        mov   [do_resize_from_corner],byte 0   ; resize for skinned window
1066
        mov   [do_resize_from_corner],byte 0   ; resize for skinned window
1056
        mov   edx, [edi+0x10]
1067
        mov   edx, [edi+0x10]
1057
        and   edx, 0x0f000000
1068
        and   edx, 0x0f000000
1058
        cmp   edx, 0x02000000
1069
        cmp   edx, 0x02000000
1059
        jb    .no_resize_2 ; not type 2 wnd
1070
        jb    .no_resize_2 ; not type 2 wnd
1060
 
1071
 
1061
        mov   edx, [edi+4]
1072
        mov   edx, [edi+4]
1062
        add   edx, [edi+12]
1073
        add   edx, [edi+12]
1063
        sub   edx, 6       ; edx = y_end - 6
1074
        sub   edx, 6       ; edx = y_end - 6
1064
        cmp   ebx, edx     ; ebx = mouse_y
1075
        cmp   ebx, edx     ; ebx = mouse_y
1065
        jb    .no_resize_2
1076
        jb    .no_resize_2
1066
        mov   [do_resize_from_corner],byte 1
1077
        mov   [do_resize_from_corner],byte 1
1067
        jmp   .continue
1078
        jmp   .continue
1068
      .no_resize_2:
1079
      .no_resize_2:
1069
 
1080
 
1070
;// mike.dld [
1081
;// mike.dld [
1071
        mov   dl,[edi+0x10+3]
1082
        mov   dl,[edi+0x10+3]
1072
        and   dl,0x0F
1083
        and   dl,0x0F
1073
        cmp   dl,0x03
1084
        cmp   dl,0x03
1074
        jne   @f
1085
        jne   @f
1075
        mov   edx, [edi+4] ; check if touch on bar
1086
        mov   edx, [edi+4] ; check if touch on bar
1076
        add   edx, [_skinh]
1087
        add   edx, [_skinh]
1077
        cmp   ebx, edx
1088
        cmp   ebx, edx
1078
        jae   .exit
1089
        jae   .exit
1079
        jmp   .continue
1090
        jmp   .continue
1080
    @@:
1091
    @@:
1081
;// mike.dld ]
1092
;// mike.dld ]
1082
 
1093
 
1083
        mov   edx, [edi+4] ; check if touch on bar
1094
        mov   edx, [edi+4] ; check if touch on bar
1084
        add   edx, 21
1095
        add   edx, 21
1085
        cmp   ebx, edx
1096
        cmp   ebx, edx
1086
        jae   .exit
1097
        jae   .exit
1087
 
1098
 
1088
     .continue:
1099
     .continue:
1089
 
1100
 
1090
        push  esi
1101
        push  esi
1091
        mov   esi, window_moving
1102
        mov   esi, window_moving
1092
        call  sys_msg_board_str
1103
        call  sys_msg_board_str
1093
        pop   esi
1104
        pop   esi
1094
 
1105
 
1095
        mov   ecx, [timer_ticks] ;[0xfdf0]    ; double-click ?
1106
        mov   ecx, [timer_ticks] ;[0xfdf0]    ; double-click ?
1096
        mov   edx, ecx
1107
        mov   edx, ecx
1097
        sub   edx, [latest_window_touch]
1108
        sub   edx, [latest_window_touch]
1098
        mov   [latest_window_touch], ecx
1109
        mov   [latest_window_touch], ecx
1099
        mov   [latest_window_touch_delta], edx
1110
        mov   [latest_window_touch_delta], edx
1100
 
1111
 
1101
        mov   cl, [0xfb40]     ; save for shade check
1112
        mov   cl, [0xfb40]     ; save for shade check
1102
        mov   [do_resize], cl
1113
        mov   [do_resize], cl
1103
        cmp  [window_minimize],0
1114
        cmp  [window_minimize],0
1104
        je    no_emulation_righ_button
1115
        je    no_emulation_righ_button
1105
        mov   [do_resize], byte 2
1116
        mov   [do_resize], byte 2
1106
     no_emulation_righ_button:
1117
     no_emulation_righ_button:
1107
        mov   ecx, [edi+0]
1118
        mov   ecx, [edi+0]
1108
        mov   edx, [edi+4]
1119
        mov   edx, [edi+4]
1109
 
1120
 
1110
        push  eax ecx edx
1121
        push  eax ecx edx
1111
        mov   [dlx], ecx      ; save for drawlimits
1122
        mov   [dlx], ecx      ; save for drawlimits
1112
        mov   [dly], edx
1123
        mov   [dly], edx
1113
        mov   eax, [edi+8]
1124
        mov   eax, [edi+8]
1114
        add   ecx, eax
1125
        add   ecx, eax
1115
        mov   eax, [edi+12]
1126
        mov   eax, [edi+12]
1116
        add   edx, eax
1127
        add   edx, eax
1117
        mov   [dlxe], ecx
1128
        mov   [dlxe], ecx
1118
        mov   [dlye], edx
1129
        mov   [dlye], edx
1119
        pop   edx ecx eax
1130
        pop   edx ecx eax
1120
 
1131
 
1121
        sub   eax, ecx
1132
        sub   eax, ecx
1122
        sub   ebx, edx
1133
        sub   ebx, edx
1123
 
1134
 
1124
        mov   esi, [0xfb0a]
1135
        mov   esi, [0xfb0a]
1125
        mov   [0xf300], esi
1136
        mov   [0xf300], esi
1126
 
1137
 
1127
        pushad           ; wait for putimages to finish
1138
        pushad           ; wait for putimages to finish
1128
;        mov   eax,5
1139
;        mov   eax,5
1129
;        call  delay_hs
1140
;        call  delay_hs
1130
        mov   eax,[edi+0]
1141
        mov   eax,[edi+0]
1131
        mov   [npx],eax
1142
        mov   [npx],eax
1132
        mov   eax,[edi+4]
1143
        mov   eax,[edi+4]
1133
        mov   [npy],eax
1144
        mov   [npy],eax
1134
        popad
1145
        popad
1135
 
1146
 
1136
        push eax                  ; save old coordinates
1147
        push eax                  ; save old coordinates
1137
        mov   ax,[edi+00]
1148
        mov   ax,[edi+00]
1138
        mov   word [oldc+00],ax
1149
        mov   word [oldc+00],ax
1139
        mov   ax,[edi+04]
1150
        mov   ax,[edi+04]
1140
        mov   word [oldc+04],ax
1151
        mov   word [oldc+04],ax
1141
        mov   ax,[edi+8]
1152
        mov   ax,[edi+8]
1142
        mov   word [oldc+8],ax
1153
        mov   word [oldc+8],ax
1143
        mov   word [npxe],ax
1154
        mov   word [npxe],ax
1144
        mov   ax,[edi+12]
1155
        mov   ax,[edi+12]
1145
        mov   word [oldc+12],ax
1156
        mov   word [oldc+12],ax
1146
        mov   word [npye],ax
1157
        mov   word [npye],ax
1147
        pop eax
1158
        pop eax
1148
 
1159
 
1149
        call  drawwindowframes
1160
        call  drawwindowframes
1150
 
1161
 
1151
        mov   [reposition],0
1162
        mov   [reposition],0
1152
        mov   [0xfb44],byte 1   ; no reaction to mouse up/down
1163
        mov   [0xfb44],byte 1   ; no reaction to mouse up/down
1153
 
1164
 
1154
        ; move window
1165
        ; move window
1155
 
1166
 
1156
      newchm:
1167
      newchm:
1157
 
1168
 
1158
        mov   [0xfff5],byte 1
1169
        mov   [0xfff5],byte 1
1159
 
1170
 
1160
        call  checkidle
1171
        call  checkidle
1161
 
1172
 
1162
        call  checkEgaCga
1173
        call  checkEgaCga
1163
 
1174
 
1164
        mov   [0xfff4],byte 0
1175
        mov   [0xfff4],byte 0
1165
 
-
 
1166
        call  check_mouse_data
1176
 
1167
        call  [draw_pointer]
1177
        call  [draw_pointer]
1168
 
1178
 
1169
        pushad
1179
        pushad
1170
        call   stack_handler
1180
        call   stack_handler
1171
        popad
1181
        popad
1172
 
1182
 
1173
        mov   esi,[0xf300]
1183
        mov   esi,[0xf300]
1174
        cmp   esi,[0xfb0a]
1184
        cmp   esi,[0xfb0a]
1175
        je    cwb
1185
        je    cwb
1176
 
1186
 
1177
        mov   cx,[0xfb0a]
1187
        mov   cx,[0xfb0a]
1178
        mov   dx,[0xfb0c]
1188
        mov   dx,[0xfb0c]
1179
        sub   cx,ax
1189
        sub   cx,ax
1180
        sub   dx,bx
1190
        sub   dx,bx
1181
 
1191
 
1182
        push  ax
1192
        push  ax
1183
        push  bx
1193
        push  bx
1184
 
1194
 
1185
        call  drawwindowframes
1195
        call  drawwindowframes
1186
 
1196
 
1187
        mov   ax,[0xfe00]
1197
        mov   ax,[0xfe00]
1188
        mov   bx,[0xfe04]
1198
        mov   bx,[0xfe04]
1189
 
1199
 
1190
        cmp   [do_resize_from_corner],1
1200
        cmp   [do_resize_from_corner],1
1191
        je    no_new_position
1201
        je    no_new_position
1192
 
1202
 
1193
        mov   word [npx],word 0     ; x repos ?
1203
        mov   word [npx],word 0     ; x repos ?
1194
        cmp   ax,cx
1204
        cmp   ax,cx
1195
        jb    noreposx
1205
        jb    noreposx
1196
        mov   [reposition],1
1206
        mov   [reposition],1
1197
        sub   ax,word [npxe]
1207
        sub   ax,word [npxe]
1198
        mov   word [npx],ax
1208
        mov   word [npx],ax
1199
        cmp   ax,cx
1209
        cmp   ax,cx
1200
        jb    noreposx
1210
        jb    noreposx
1201
        mov   word [npx],cx
1211
        mov   word [npx],cx
1202
      noreposx:
1212
      noreposx:
1203
 
1213
 
1204
        mov   word [npy],word 0     ; y repos ?
1214
        mov   word [npy],word 0     ; y repos ?
1205
        cmp   bx,dx
1215
        cmp   bx,dx
1206
        jb    noreposy
1216
        jb    noreposy
1207
        mov   [reposition],1
1217
        mov   [reposition],1
1208
        sub   bx,word [npye]
1218
        sub   bx,word [npye]
1209
        mov   word [npy],bx
1219
        mov   word [npy],bx
1210
        cmp   bx,dx
1220
        cmp   bx,dx
1211
        jb    noreposy
1221
        jb    noreposy
1212
        mov   word [npy],dx
1222
        mov   word [npy],dx
1213
      noreposy:
1223
      noreposy:
1214
 
1224
 
1215
      no_new_position:
1225
      no_new_position:
1216
 
1226
 
1217
        cmp   [do_resize_from_corner],0    ; resize from right corner
1227
        cmp   [do_resize_from_corner],0    ; resize from right corner
1218
        je    norepos_size
1228
        je    norepos_size
1219
        pushad
1229
        pushad
1220
 
1230
 
1221
        mov   edx,edi
1231
        mov   edx,edi
1222
        sub   edx,window_data
1232
        sub   edx,window_data
1223
        shr   edx,5
1233
        shr   edx,5
1224
        shl   edx,8
1234
        shl   edx,8
1225
        add   edx,0x80000                 ; process base at 0x80000+
1235
        add   edx,0x80000                 ; process base at 0x80000+
1226
 
1236
 
1227
        movzx eax,word [0xfb0a]
1237
        movzx eax,word [0xfb0a]
1228
        cmp   eax,[edi+0]
1238
        cmp   eax,[edi+0]
1229
        jb    nnepx
1239
        jb    nnepx
1230
        sub   eax,[edi+0]
1240
        sub   eax,[edi+0]
1231
        cmp   eax,[edx+0x90+8]
1241
        cmp   eax,[edx+0x90+8]
1232
        jge   nnepx2
1242
        jge   nnepx2
1233
        mov   eax,[edx+0x90+8]
1243
        mov   eax,[edx+0x90+8]
1234
      nnepx2:
1244
      nnepx2:
1235
        mov   [npxe],eax
1245
        mov   [npxe],eax
1236
      nnepx:
1246
      nnepx:
1237
 
1247
 
1238
        movzx eax,word [0xfb0c]
1248
        movzx eax,word [0xfb0c]
1239
        cmp   eax,[edi+4]
1249
        cmp   eax,[edi+4]
1240
        jb    nnepy
1250
        jb    nnepy
1241
        sub   eax,[edi+4]
1251
        sub   eax,[edi+4]
1242
        cmp   eax,23 ; [edx+0x90+12]
1252
        cmp   eax,23 ; [edx+0x90+12]
1243
        jge   nnepy2
1253
        jge   nnepy2
1244
        mov   eax,23 ; [edx+0x90+12]
1254
        mov   eax,23 ; [edx+0x90+12]
1245
      nnepy2:
1255
      nnepy2:
1246
        mov   [npye],eax
1256
        mov   [npye],eax
1247
      nnepy:
1257
      nnepy:
1248
 
1258
 
1249
        mov   [reposition],1
1259
        mov   [reposition],1
1250
 
1260
 
1251
        popad
1261
        popad
1252
      norepos_size:
1262
      norepos_size:
1253
 
1263
 
1254
        pop   bx
1264
        pop   bx
1255
        pop   ax
1265
        pop   ax
1256
        call  drawwindowframes
1266
        call  drawwindowframes
1257
 
1267
 
1258
        mov   esi,[0xfb0a]
1268
        mov   esi,[0xfb0a]
1259
        mov   [0xf300],esi
1269
        mov   [0xf300],esi
1260
 
1270
 
1261
      cwb:
1271
      cwb:
1262
        cmp   [0xfb40],byte 0
1272
        cmp   [0xfb40],byte 0
1263
        jne   newchm 
1273
        jne   newchm 
1264
                                     ; new position done
1274
                                     ; new position done
1265
        call  drawwindowframes
1275
        call  drawwindowframes
1266
        mov   [0xfff5],byte 1
1276
        mov   [0xfff5],byte 1
1267
 
1277
 
1268
        mov   eax,[npx]
1278
        mov   eax,[npx]
1269
        mov   [edi+0],eax
1279
        mov   [edi+0],eax
1270
        mov   eax,[npy]
1280
        mov   eax,[npy]
1271
        mov   [edi+4],eax
1281
        mov   [edi+4],eax
1272
        mov   eax,[npxe]
1282
        mov   eax,[npxe]
1273
        mov   [edi+8],eax
1283
        mov   [edi+8],eax
1274
        mov   eax,[npye]
1284
        mov   eax,[npye]
1275
        mov   [edi+12],eax
1285
        mov   [edi+12],eax
1276
 
1286
 
1277
        cmp   [reposition],1         ; save new X and Y start
1287
        cmp   [reposition],1         ; save new X and Y start
1278
        jne   no_xy_save
1288
        jne   no_xy_save
1279
        ; 
1289
        ; 
1280
        push  esi edi ecx
1290
        push  esi edi ecx
1281
        mov   esi,edi
1291
        mov   esi,edi
1282
        sub   edi,window_data
1292
        sub   edi,window_data
1283
        shr   edi,5
1293
        shr   edi,5
1284
        shl   edi,8
1294
        shl   edi,8
1285
        add   edi,0x80000+0x90
1295
        add   edi,0x80000+0x90
1286
        mov   ecx,2
1296
        mov   ecx,2
1287
        cld
1297
        cld
1288
        rep   movsd
1298
        rep   movsd
1289
        pop   ecx edi esi
1299
        pop   ecx edi esi
1290
        ; 
1300
        ; 
1291
      no_xy_save:
1301
      no_xy_save:
1292
 
1302
 
1293
        pushad                             ; WINDOW SHADE/FULLSCREEN
1303
        pushad                             ; WINDOW SHADE/FULLSCREEN
1294
 
1304
 
1295
        cmp   [reposition],1
1305
        cmp   [reposition],1
1296
        je    no_window_sizing
1306
        je    no_window_sizing
1297
        mov   edx,edi
1307
        mov   edx,edi
1298
        sub   edx,window_data
1308
        sub   edx,window_data
1299
        shr   edx,5
1309
        shr   edx,5
1300
        shl   edx,8
1310
        shl   edx,8
1301
        add   edx,0x80000                 ; process base at 0x80000+
1311
        add   edx,0x80000                 ; process base at 0x80000+
1302
 
1312
 
1303
        cmp   [do_resize],2               ; window shade ?
1313
        cmp   [do_resize],2               ; window shade ?
1304
        jb    no_window_shade
1314
        jb    no_window_shade
1305
        mov   [reposition],1
1315
        mov   [reposition],1
1306
 
1316
 
1307
        cmp   [window_minimize],1
1317
        cmp   [window_minimize],1
1308
        jge    for_window_minimize
1318
        jge    for_window_minimize
1309
        cmp   [edi+12],dword 23 
1319
        cmp   [edi+12],dword 23 
1310
        jle    window_shade_up
1320
        jle    window_shade_up
1311
        jmp   for_window_shade
1321
        jmp   for_window_shade
1312
    for_window_minimize:
1322
    for_window_minimize:
1313
        cmp   [edi+12],dword 0 
1323
        cmp   [edi+12],dword 0 
1314
        je    window_shade_up
1324
        je    window_shade_up
1315
    for_window_shade:
1325
    for_window_shade:
1316
        cmp   [window_minimize],0
1326
        cmp   [window_minimize],0
1317
        je   no_window_minimize
1327
        je   no_window_minimize
1318
        cmp   [window_minimize],2
1328
        cmp   [window_minimize],2
1319
        je   window_minimize_no_shade_full ;window_shade_up
1329
        je   window_minimize_no_shade_full ;window_shade_up
1320
        mov   [edi+8],dword 0 ;66
1330
        mov   [edi+8],dword 0 ;66
1321
        mov   [edi+12],dword 0 ;279           ; on
1331
        mov   [edi+12],dword 0 ;279           ; on
1322
        jmp   no_window_shade
1332
        jmp   no_window_shade
1323
  no_window_minimize:  
1333
  no_window_minimize:  
1324
        mov   [edi+12],dword 23           ; on
1334
        mov   [edi+12],dword 23           ; on
1325
        jmp   no_window_shade
1335
        jmp   no_window_shade
1326
      window_shade_up:
1336
      window_shade_up:
1327
        cmp   [window_minimize],1
1337
        cmp   [window_minimize],1
1328
        jge   window_minimize_no_shade_full
1338
        jge   window_minimize_no_shade_full
1329
        mov   eax,[edi+0]
1339
        mov   eax,[edi+0]
1330
        add   eax,[edi+4]
1340
        add   eax,[edi+4]
1331
        test  eax, eax
1341
        test  eax, eax
1332
        je    shade_full
1342
        je    shade_full
1333
        push  edi 
1343
        push  edi 
1334
        lea   esi, [edx + 0x90]
1344
        lea   esi, [edx + 0x90]
1335
        mov   ecx,4
1345
        mov   ecx,4
1336
        cld
1346
        cld
1337
        rep   movsd
1347
        rep   movsd
1338
        pop   edi
1348
        pop   edi
1339
 
1349
 
1340
    window_minimize_no_shade_full:
1350
    window_minimize_no_shade_full:
1341
;        mov   eax,[edx+0x90]              ; off
1351
;        mov   eax,[edx+0x90]              ; off
1342
;        mov   [edi+0],eax
1352
;        mov   [edi+0],eax
1343
;        mov   eax,[edx+0x94]              ; off
1353
;        mov   eax,[edx+0x94]              ; off
1344
;        mov   [edi+4],eax
1354
;        mov   [edi+4],eax
1345
;        mov   eax,[edx+0x98]              ; off
1355
;        mov   eax,[edx+0x98]              ; off
1346
;        mov   [edi+8],eax
1356
;        mov   [edi+8],eax
1347
;        mov   eax,[edx+0x9C]              ; off
1357
;        mov   eax,[edx+0x9C]              ; off
1348
;        mov   [edi+12],eax
1358
;        mov   [edi+12],eax
1349
 
1359
 
1350
        push  edi 
1360
        push  edi 
1351
        lea   esi, [edx + 0x90]
1361
        lea   esi, [edx + 0x90]
1352
        mov   ecx,4
1362
        mov   ecx,4
1353
        cld
1363
        cld
1354
        rep   movsd
1364
        rep   movsd
1355
        pop   edi
1365
        pop   edi
1356
        jmp   no_window_shade
1366
        jmp   no_window_shade
1357
 
1367
 
1358
      shade_full:
1368
      shade_full:
1359
;        mov   eax,[0xfe00]
1369
;        mov   eax,[0xfe00]
1360
;        mov   [edi+8],eax
1370
;        mov   [edi+8],eax
1361
        mov   eax,[0xfe04]
1371
        mov   eax,[0xfe04]
1362
        sub   eax,19
1372
        sub   eax,19
1363
        mov   [edi+12],eax
1373
        mov   [edi+12],eax
1364
      no_window_shade:
1374
      no_window_shade:
1365
 
1375
 
1366
        cmp   [do_resize],1               ; fullscreen/restore ?
1376
        cmp   [do_resize],1               ; fullscreen/restore ?
1367
        jne   no_fullscreen_restore
1377
        jne   no_fullscreen_restore
1368
        cmp   [latest_window_touch_delta],dword 50
1378
        cmp   [latest_window_touch_delta],dword 50
1369
        jg    no_fullscreen_restore
1379
        jg    no_fullscreen_restore
1370
        mov   [reposition],1
1380
        mov   [reposition],1
1371
        mov   eax,[edi+12]
1381
        mov   eax,[edi+12]
1372
        add   eax,19
1382
        add   eax,19
1373
        cmp   eax,[0xfe04]
1383
        cmp   eax,[0xfe04]
1374
        je    restore_from_fullscreen
1384
        je    restore_from_fullscreen
1375
        mov   [edi+0],dword 0             ; set fullscreen
1385
        mov   [edi+0],dword 0             ; set fullscreen
1376
        mov   [edi+4],dword 0
1386
        mov   [edi+4],dword 0
1377
        mov   eax,[0xfe00]
1387
        mov   eax,[0xfe00]
1378
        mov   [edi+8],eax
1388
        mov   [edi+8],eax
1379
        mov   eax,[0xfe04]
1389
        mov   eax,[0xfe04]
1380
        sub   eax,19
1390
        sub   eax,19
1381
        mov   [edi+12],eax
1391
        mov   [edi+12],eax
1382
        jmp   no_fullscreen_restore
1392
        jmp   no_fullscreen_restore
1383
      restore_from_fullscreen:
1393
      restore_from_fullscreen:
1384
        push  edi                         ; restore
1394
        push  edi                         ; restore
1385
;        mov   esi,edx
1395
;        mov   esi,edx
1386
;        add   esi,0x90
1396
;        add   esi,0x90
1387
        lea   esi, [edx + 0x90]
1397
        lea   esi, [edx + 0x90]
1388
        mov   ecx,4
1398
        mov   ecx,4
1389
        cld
1399
        cld
1390
        rep   movsd
1400
        rep   movsd
1391
        pop   edi
1401
        pop   edi
1392
 
1402
 
1393
      no_fullscreen_restore:
1403
      no_fullscreen_restore:
1394
 
1404
 
1395
        mov   eax,[edi+4]                 ; check Y inside screen
1405
        mov   eax,[edi+4]                 ; check Y inside screen
1396
        add   eax,[edi+12]
1406
        add   eax,[edi+12]
1397
        cmp   eax,[0xfe04]
1407
        cmp   eax,[0xfe04]
1398
        jbe   no_window_sizing
1408
        jbe   no_window_sizing
1399
        mov   eax,[edi+0]                 ; check X inside screen
1409
        mov   eax,[edi+0]                 ; check X inside screen
1400
        add   eax,[edi+8]
1410
        add   eax,[edi+8]
1401
        cmp   eax,[0xfe00]
1411
        cmp   eax,[0xfe00]
1402
        jbe   no_window_sizing
1412
        jbe   no_window_sizing
1403
        mov   eax,[0xfe00]
1413
        mov   eax,[0xfe00]
1404
        sub   eax,[edi+8]
1414
        sub   eax,[edi+8]
1405
        mov   [edi+0],eax
1415
        mov   [edi+0],eax
1406
        mov   eax,[0xfe04]
1416
        mov   eax,[0xfe04]
1407
        sub   eax,[edi+12]
1417
        sub   eax,[edi+12]
1408
        mov   [edi+4],eax
1418
        mov   [edi+4],eax
1409
      no_window_sizing:
1419
      no_window_sizing:
1410
 
1420
 
1411
        popad
1421
        popad
1412
 
1422
 
1413
        cmp   [reposition],0
1423
        cmp   [reposition],0
1414
        je    retwm
1424
        je    retwm
1415
 
1425
 
1416
        pushad
1426
        pushad
1417
        mov   eax,[edi+00]
1427
        mov   eax,[edi+00]
1418
        mov   ebx,[edi+04]
1428
        mov   ebx,[edi+04]
1419
        mov   ecx,[edi+8]
1429
        mov   ecx,[edi+8]
1420
        mov   edx,[edi+12]
1430
        mov   edx,[edi+12]
1421
        add   ecx,eax
1431
        add   ecx,eax
1422
        add   edx,ebx
1432
        add   edx,ebx
1423
        mov   edi,[0x3004]
1433
        mov   edi,[0x3004]
1424
        shl   edi,1
1434
        shl   edi,1
1425
        add   edi,0xc400
1435
        add   edi,0xc400
1426
        movzx esi,byte [edi]
1436
        movzx esi,byte [edi]
1427
        shl   esi,5
1437
        shl   esi,5
1428
        add   esi,0x3000+0xe
1438
        add   esi,0x3000+0xe
1429
        movzx esi,byte [esi]
1439
        movzx esi,byte [esi]
1430
 
1440
 
1431
        sub   edi,draw_data
1441
        sub   edi,draw_data
1432
        shr   edi,5
1442
        shr   edi,5
1433
        shl   edi,8
1443
        shl   edi,8
1434
        add   edi,0x80000+0x80
1444
        add   edi,0x80000+0x80
1435
        ;cmp   [edi],dword 0
1445
        ;cmp   [edi],dword 0
1436
        ;jne   no_rect_shaped_move
1446
        ;jne   no_rect_shaped_move
1437
        call  setscreen
1447
        call  setscreen
1438
        jmp   move_calculated
1448
        jmp   move_calculated
1439
      no_rect_shaped_move:
1449
      no_rect_shaped_move:
1440
        call  calculatescreen
1450
        call  calculatescreen
1441
      move_calculated:
1451
      move_calculated:
1442
 
1452
 
1443
        popad
1453
        popad
1444
 
1454
 
1445
        mov   [edi+31],byte 1 ; mark first as redraw
1455
        mov   [edi+31],byte 1 ; mark first as redraw
1446
        mov   [0xfff5],byte 1 ; no mouse
1456
        mov   [0xfff5],byte 1 ; no mouse
1447
 
1457
 
1448
        push  eax ebx ecx edx
1458
        push  eax ebx ecx edx
1449
        mov   eax,[oldc+00]
1459
        mov   eax,[oldc+00]
1450
        mov   ebx,[oldc+04]
1460
        mov   ebx,[oldc+04]
1451
        mov   ecx,[oldc+8]
1461
        mov   ecx,[oldc+8]
1452
        mov   edx,[oldc+12]
1462
        mov   edx,[oldc+12]
1453
        add   ecx,eax
1463
        add   ecx,eax
1454
        add   edx,ebx
1464
        add   edx,ebx
1455
        call  calculatescreen
1465
        call  calculatescreen
1456
        pop   edx ecx ebx eax
1466
        pop   edx ecx ebx eax
1457
 
1467
 
1458
        mov   eax,edi
1468
        mov   eax,edi
1459
        call  redrawscreen
1469
        call  redrawscreen
1460
 
1470
 
1461
        mov   ecx,100         ; wait to avoid mouse residuals
1471
        mov   ecx,100         ; wait to avoid mouse residuals
1462
      waitre2:
1472
      waitre2:
1463
        call  check_mouse_data
-
 
1464
        mov   [0xfff5],byte 1
1473
        mov   [0xfff5],byte 1
1465
        call  checkidle
1474
        call  checkidle
1466
        cmp   [edi+31],byte 0
1475
        cmp   [edi+31],byte 0
1467
        jz    retwm
1476
        jz    retwm
1468
        loop  waitre2
1477
        loop  waitre2
1469
 
1478
 
1470
      retwm:
1479
      retwm:
1471
 
1480
 
1472
        mov   [0xfff5],byte 0 ; mouse pointer
1481
        mov   [0xfff5],byte 0 ; mouse pointer
1473
        mov   [0xfff4],byte 0 ; no mouse under
1482
        mov   [0xfff4],byte 0 ; no mouse under
1474
        mov   [0xfb44],byte 0 ; react to mouse up/down
1483
        mov   [0xfb44],byte 0 ; react to mouse up/down
1475
 
1484
 
1476
        mov    esi,window_moved
1485
        mov    esi,window_moved
1477
        call   sys_msg_board_str
1486
        call   sys_msg_board_str
1478
 
1487
 
1479
        popad
1488
        popad
1480
 
1489
 
1481
       mov   [window_minimize],0
1490
       mov   [window_minimize],0
1482
;        sti
1491
;        sti
1483
        ret
1492
        ret
1484
 
1493
 
1485
;temp_mouse_1 dw 0
1494
;temp_mouse_1 dw 0
1486
;temp_mouse_2 dw 0
1495
;temp_mouse_2 dw 0
1487
 
1496
 
1488
uglobal
1497
uglobal
1489
  add_window_data            dd  0
1498
  add_window_data            dd  0
1490
  do_resize_from_corner      db  0x0
1499
  do_resize_from_corner      db  0x0
1491
  reposition                 db  0x0
1500
  reposition                 db  0x0
1492
  latest_window_touch        dd  0x0
1501
  latest_window_touch        dd  0x0
1493
  latest_window_touch_delta  dd  0x0
1502
  latest_window_touch_delta  dd  0x0
1494
 
1503
 
1495
  do_resize db 0x0
1504
  do_resize db 0x0
1496
 
1505
 
1497
  oldc    dd 0x0,0x0,0x0,0x0
1506
  oldc    dd 0x0,0x0,0x0,0x0
1498
 
1507
 
1499
  dlx     dd 0x0
1508
  dlx     dd 0x0
1500
  dly     dd 0x0
1509
  dly     dd 0x0
1501
  dlxe    dd 0x0
1510
  dlxe    dd 0x0
1502
  dlye    dd 0x0
1511
  dlye    dd 0x0
1503
 
1512
 
1504
  npx     dd 0x0
1513
  npx     dd 0x0
1505
  npy     dd 0x0
1514
  npy     dd 0x0
1506
  npxe    dd 0x0
1515
  npxe    dd 0x0
1507
  npye    dd 0x0
1516
  npye    dd 0x0
1508
 
1517
 
1509
  mpx     dd 0x0
1518
  mpx     dd 0x0
1510
  mpy     dd 0x0
1519
  mpy     dd 0x0
1511
endg
1520
endg
1512
 
1521
 
1513
 
1522
 
1514
; draw negative window frames
1523
; draw negative window frames
1515
 
1524
 
1516
drawwindowframes:
1525
drawwindowframes:
1517
 
1526
 
1518
        pushad
1527
        pushad
1519
 
1528
 
1520
        mov   eax,[npx]
1529
        mov   eax,[npx]
1521
        shl   eax,16
1530
        shl   eax,16
1522
        add   eax,[npx]
1531
        add   eax,[npx]
1523
        add   eax,[npxe]
1532
        add   eax,[npxe]
1524
        add   eax,65536*1-1
1533
        add   eax,65536*1-1
1525
        mov   ebx,[npy]
1534
        mov   ebx,[npy]
1526
        shl   ebx,16
1535
        shl   ebx,16
1527
        add   ebx,[npy]
1536
        add   ebx,[npy]
1528
        mov   ecx,0x01000000
1537
        mov   ecx,0x01000000
1529
        push  edi
1538
        push  edi
1530
        mov   edi,1
1539
        mov   edi,1
1531
        call  [draw_line]
1540
        call  [draw_line]
1532
        pop   edi
1541
        pop   edi
1533
 
1542
 
1534
        mov   eax,[npx]
1543
        mov   eax,[npx]
1535
        shl   eax,16
1544
        shl   eax,16
1536
        add   eax,[npx]
1545
        add   eax,[npx]
1537
        add   eax,[npxe]
1546
        add   eax,[npxe]
1538
        add   eax,65536*1-1
1547
        add   eax,65536*1-1
1539
        mov   ebx,[npy]
1548
        mov   ebx,[npy]
1540
        add   ebx,[npye]
1549
        add   ebx,[npye]
1541
        shl   ebx,16
1550
        shl   ebx,16
1542
        add   ebx,[npy]
1551
        add   ebx,[npy]
1543
        add   ebx,[npye]
1552
        add   ebx,[npye]
1544
        mov   ecx,0x01000000
1553
        mov   ecx,0x01000000
1545
        push  edi
1554
        push  edi
1546
        mov   edi,1
1555
        mov   edi,1
1547
        call  [draw_line]
1556
        call  [draw_line]
1548
        pop   edi
1557
        pop   edi
1549
 
1558
 
1550
        mov   eax,[npx]
1559
        mov   eax,[npx]
1551
        shl   eax,16
1560
        shl   eax,16
1552
        add   eax,[npx]
1561
        add   eax,[npx]
1553
        mov   ebx,[npy]
1562
        mov   ebx,[npy]
1554
        shl   ebx,16
1563
        shl   ebx,16
1555
        add   ebx,[npy]
1564
        add   ebx,[npy]
1556
        add   ebx,[npye]
1565
        add   ebx,[npye]
1557
        mov   ecx,0x01000000
1566
        mov   ecx,0x01000000
1558
        push  edi
1567
        push  edi
1559
        mov   edi,1
1568
        mov   edi,1
1560
        call  [draw_line]
1569
        call  [draw_line]
1561
        pop   edi
1570
        pop   edi
1562
 
1571
 
1563
        mov   eax,[npx]
1572
        mov   eax,[npx]
1564
        add   eax,[npxe]
1573
        add   eax,[npxe]
1565
        shl   eax,16
1574
        shl   eax,16
1566
        add   eax,[npx]
1575
        add   eax,[npx]
1567
        add   eax,[npxe]
1576
        add   eax,[npxe]
1568
        mov   ebx,[npy]
1577
        mov   ebx,[npy]
1569
        shl   ebx,16
1578
        shl   ebx,16
1570
        add   ebx,[npy]
1579
        add   ebx,[npy]
1571
        add   ebx,[npye]
1580
        add   ebx,[npye]
1572
        mov   ecx,0x01000000
1581
        mov   ecx,0x01000000
1573
        push  edi
1582
        push  edi
1574
        mov   edi,1
1583
        mov   edi,1
1575
        call  [draw_line]
1584
        call  [draw_line]
1576
        mov   edi,[0x3000]
1585
        mov   edi,[0x3000]
1577
        shl   edi,5
1586
        shl   edi,5
1578
        add   edi,window_data
1587
        add   edi,window_data
1579
        mov   [edi+30],byte 1
1588
        mov   [edi+30],byte 1
1580
        pop   edi
1589
        pop   edi
1581
 
1590
 
1582
        popad
1591
        popad
1583
 
1592
 
1584
        ret
1593
        ret
1585
 
1594
 
1586
 
1595
 
1587
 
1596
 
1588
random_shaped_window:
1597
random_shaped_window:
1589
 
1598
 
1590
;
1599
;
1591
;  eax = 0    giving address of data area
1600
;  eax = 0    giving address of data area
1592
;      ebx    address
1601
;      ebx    address
1593
;  ebx = 1    shape area scale
1602
;  ebx = 1    shape area scale
1594
;      ebx    2^ebx scale
1603
;      ebx    2^ebx scale
1595
 
1604
 
1596
     test eax, eax
1605
     test eax, eax
1597
     jne  rsw_no_address
1606
     jne  rsw_no_address
1598
     mov  eax,[0x3000]
1607
     mov  eax,[0x3000]
1599
     shl  eax,8
1608
     shl  eax,8
1600
 
1609
 
1601
     mov  [eax+0x80000+0x80],ebx
1610
     mov  [eax+0x80000+0x80],ebx
1602
   rsw_no_address:
1611
   rsw_no_address:
1603
 
1612
 
1604
     cmp  eax,1
1613
     cmp  eax,1
1605
     jne  rsw_no_scale
1614
     jne  rsw_no_scale
1606
     mov  eax,[0x3000]
1615
     mov  eax,[0x3000]
1607
     shl  eax,8
1616
     shl  eax,8
1608
     mov  [eax+0x80000+0x84],bl
1617
     mov  [eax+0x80000+0x84],bl
1609
   rsw_no_scale:
1618
   rsw_no_scale:
1610
 
1619
 
1611
     ret
1620
     ret