Subversion Repositories Kolibri OS

Rev

Rev 209 | Rev 551 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 209 Rev 485
Line 14... Line 14...
14
                dd      I_END                   ; program image size
14
                dd      I_END                   ; program image size
15
                dd      0x1000                  ; required amount of memory
15
                dd      0x1000                  ; required amount of memory
16
                dd      0x1000                  ; esp
16
                dd      0x1000                  ; esp
17
                dd      0, 0                    ; no parameters, no path
17
                dd      0, 0                    ; no parameters, no path
Line 18... Line 18...
18
 
18
 
19
include 'macros.inc'
19
include '..\..\..\macros.inc'
Line 20... Line 20...
20
delay   equ     20
20
delay   equ     20
21
 
21
 
Line 28... Line 28...
28
still:
28
still:
29
        call    draw_screen
29
        call    draw_screen
30
wtevent:
30
wtevent:
31
        mov     eax, 23         ; wait here for event with timeout
31
        mov     eax, 23         ; wait here for event with timeout
32
        mov     ebx, delay
32
        mov     ebx, delay
33
        int     0x40
33
        mcall
34
        dec     eax
34
        dec     eax
35
        js      still
35
        js      still
36
        jz      redraw
36
        jz      redraw
37
        dec     eax
37
        dec     eax
38
        jnz     button
38
        jnz     button
39
; key in buffer
39
; key in buffer
40
        mov     al, 2
40
        mov     al, 2
41
        int     0x40
41
        mcall
42
        jmp     wtevent
42
        jmp     wtevent
43
button:
43
button:
44
; we have only one button, close
44
; we have only one button, close
45
        or      eax, -1
45
        or      eax, -1
46
        int     0x40
46
        mcall
Line 47... Line 47...
47
 
47
 
48
;   *********************************************
48
;   *********************************************
49
;   *******  WINDOW DEFINITIONS AND DRAW ********
49
;   *******  WINDOW DEFINITIONS AND DRAW ********
Line 50... Line 50...
50
;   *********************************************
50
;   *********************************************
51
 
51
 
52
draw_window:
52
draw_window:
53
        mov     eax, 12         ; function 12:tell os about windowdraw
53
        mov     eax, 12         ; function 12:tell os about windowdraw
Line 54... Line 54...
54
        mov     ebx, 1          ; 1, start of draw
54
        mov     ebx, 1          ; 1, start of draw
55
        int     0x40
55
        mcall
56
 
56
 
Line 57... Line 57...
57
        mov     al, 48          ; function 48 : graphics parameters
57
        mov     al, 48          ; function 48 : graphics parameters
58
        mov     bl, 4           ; subfunction 4 : get skin height
58
        mov     bl, 4           ; subfunction 4 : get skin height
59
        int     0x40
59
        mcall
60
 
60
 
61
                                        ; DRAW WINDOW
61
                                        ; DRAW WINDOW
62
        mov     ebx, 100*65536 + 8*magnify_width + 8
62
        mov     ebx, 100*65536 + 8*magnify_width + 8
63
        lea     ecx, [eax + 100*65536 + 8*magnify_height + 3]
63
        lea     ecx, [eax + 100*65536 + 8*magnify_height + 3]
Line 64... Line 64...
64
        mov     edx, 0x33000000         ; color of work area RRGGBB
64
        mov     edx, 0x33000000         ; color of work area RRGGBB
65
        mov     edi, labelt             ; header
65
        mov     edi, labelt             ; header
66
        xor     eax, eax                ; function 0 : define and draw window
66
        xor     eax, eax                ; function 0 : define and draw window
Line 67... Line 67...
67
        int     0x40
67
        mcall
Line 68... Line 68...
68
 
68
 
69
 
69
 
70
        mov     al, 12                  ; function 12:tell os about windowdraw
70
        mov     al, 12                  ; function 12:tell os about windowdraw
71
        mov     ebx, 2                  ; 2, end of draw
71
        mov     ebx, 2                  ; 2, end of draw
72
        int     0x40
72
        mcall
73
 
73
 
74
        ret
74
        ret
75
 
75
 
76
draw_screen:
76
draw_screen:
77
draw_magnify:
77
draw_magnify:
Line 78... Line 78...
78
        mov     eax, 14
78
        mov     eax, 14
79
        int     0x40            ; get screen size
79
        mcall            ; get screen size
80
        movzx   ecx, ax
80
        movzx   ecx, ax
81
        inc     ecx
81
        inc     ecx
82
        mov     [size_y], ecx
82
        mov     [size_y], ecx
83
        shr     eax, 16
83
        shr     eax, 16
84
        inc     eax
84
        inc     eax
85
        mov     [size_x], eax
85
        mov     [size_x], eax
Line 111... Line 111...
111
        jge     .nopix
111
        jge     .nopix
112
        mov     ebx, edx
112
        mov     ebx, edx
113
        imul    ebx, [size_x]
113
        imul    ebx, [size_x]
114
        add     ebx, ecx
114
        add     ebx, ecx
115
        mov     eax, 35
115
        mov     eax, 35
116
        int     0x40            ; read pixel
116
        mcall            ; read pixel
117
.nopix:
117
.nopix:
118
        push    ecx edx
118
        push    ecx edx
119
        sub     ecx, [m_x]
119
        sub     ecx, [m_x]
120
        sub     edx, [m_y]
120
        sub     edx, [m_y]
121
        mov     ebx, ecx
121
        mov     ebx, ecx
Line 124... Line 124...
124
        mov     ecx, edx
124
        mov     ecx, edx
125
        shl     ecx, 3+16
125
        shl     ecx, 3+16
126
        mov     cl, 7
126
        mov     cl, 7
127
        mov     edx, eax
127
        mov     edx, eax
128
        mov     eax, 13
128
        mov     eax, 13
129
        int     0x40
129
        mcall
130
        pop     edx ecx
130
        pop     edx ecx
131
        inc     ecx
131
        inc     ecx
132
        cmp     ecx, [m_xe]
132
        cmp     ecx, [m_xe]
133
        jnz     .loop_x
133
        jnz     .loop_x
134
        mov     ecx, [m_x]
134
        mov     ecx, [m_x]