Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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