Subversion Repositories Kolibri OS

Rev

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

Rev 109 Rev 485
Line 10... Line 10...
10
  db     'MENUET01'             ; 8 byte id
10
  db     'MENUET01'             ; 8 byte id
11
  dd     0x01                   ; header version
11
  dd     0x01                   ; header version
12
  dd     START                  ; start of code
12
  dd     START                  ; start of code
13
  dd     I_END                  ; size of image
13
  dd     I_END                  ; size of image
14
  dd     0x2000               ; memory for app
14
  dd     0x2000                ; memory for app
15
  dd     0x1000                ; esp
15
  dd     0x2000                ; esp
16
  dd     0x0 , 0x0              ; I_Param , I_Icon
16
  dd     0x0 , 0x0              ; I_Param , I_Icon
Line 17... Line 17...
17
 
17
 
18
include 'lang.inc'
18
include 'lang.inc'
Line 19... Line 19...
19
include 'macros.inc'
19
include '..\..\..\..\macros.inc'
Line -... Line 20...
-
 
20
 
20
 
21
 
Line 21... Line 22...
21
 
22
START:                          ; start of execution
Line 22... Line 23...
22
START:                          ; start of execution
23
 
23
 
24
red:                            ; redraw
Line 24... Line 25...
24
    call draw_window            ; at first, draw the window
25
    call draw_window            ; at first, draw the window
25
 
26
 
26
still:
27
still:
27
 
-
 
28
    mov  eax,10                 ; wait here for event
-
 
29
    int  0x40
28
 
30
 
-
 
31
    cmp  eax,1                  ; redraw request ?
-
 
32
    je   red
-
 
33
    cmp  eax,2                  ; key in buffer ?
-
 
34
    je   key
-
 
35
    cmp  eax,3                  ; button in buffer ?
-
 
Line 36... Line 29...
36
    je   button
29
    mov  eax,10                 ; wait here for event
37
 
30
    mcall
38
    jmp  still
31
 
39
 
32
    dec  eax                    ; redraw request ?
Line 40... Line 33...
40
  red:                          ; redraw
33
    je   red
41
    call draw_window
34
    dec  eax                    ; key in buffer ?
42
    jmp  still
35
    jne  button
Line 43... Line 36...
43
 
36
 
44
  key:                          ; key
37
  key:                          ; key
45
    mov  eax,2                  ; just read it and ignore
38
    mov  eax,2                  ; just read it and ignore
46
    int  0x40
39
    mcall
47
    jmp  still
40
    jmp  still
Line 48... Line 41...
48
 
41
 
49
  button:                       ; button
42
  button:                       ; button
Line 65... Line 58...
65
    add  [thread_stack],0x100
58
    add  [thread_stack],0x100
66
    mov  eax,51
59
    mov  eax,51
67
    mov  ebx,1
60
    mov  ebx,1
68
    mov  ecx,START
61
    mov  ecx,START
69
    mov  edx,[thread_stack]
62
    mov  edx,[thread_stack]
70
    int  0x40
63
    mcall
Line 71... Line 64...
71
 
64
 
Line 72... Line 65...
72
    jmp  still
65
    jmp  still
Line 73... Line 66...
73
 
66
 
Line -... Line 67...
-
 
67
  no_thread:
74
  no_thread:
68
 
Line 75... Line 69...
75
 
69
    jmp  still
76
    jmp  still
70
 
Line 85... Line 79...
85
 
79
 
Line 86... Line 80...
86
draw_window:
80
draw_window:
87
 
81
 
88
    mov  eax,12                    ; function 12:tell os about windowdraw
82
    mov  eax,12                    ; function 12:tell os about windowdraw
Line 89... Line 83...
89
    mov  ebx,1                     ; 1, start of draw
83
    mov  ebx,1                     ; 1, start of draw
90
    int  0x40
84
    mcall
91
 
85
 
92
                                   ; DRAW WINDOW
86
                                   ; DRAW WINDOW
93
    mov  eax,0                     ; function 0 : define and draw window
87
    xor  eax,eax                   ; function 0 : define and draw window
94
    mov  ebx,10*65536+290         ; [x start] *65536 + [x size]
88
    mov  ebx,10*65536+290         ; [x start] *65536 + [x size]
95
    mov  ecx,10*65536+130         ; [y start] *65536 + [y size]
89
    mov  ecx,10*65536+130         ; [y start] *65536 + [y size]
96
    mov  esi,[thread_stack]
90
    mov  esi,[thread_stack]
97
    sub  esi,0x1000
91
    sub  esi,0x1000
98
    shr  esi,4
92
    shr  esi,4
99
    shl  esi,16
93
    shl  esi,16
100
    add  ebx,esi
-
 
101
    add  ecx,esi
94
    add  ebx,esi
102
    mov  edx,0x03ffffff            ; color of work area RRGGBB,8->color gl
95
    add  ecx,esi
103
    mov  esi,0x808899ff            ; color of grab bar  RRGGBB,8->color gl
96
    mov  edx,0x33ffffff            ; color of work area RRGGBB,8->color gl
104
    mov  edi,0x008899ff            ; color of frames    RRGGBB
-
 
105
    int  0x40
-
 
106
 
-
 
107
                                   ; WINDOW LABEL
-
 
108
    mov  eax,4                     ; function 4 : write text to window
-
 
109
    mov  ebx,8*65536+8             ; [x start] *65536 + [y start]
-
 
110
    mov  ecx,0x10ddeeff            ; color of text RRGGBB
-
 
Line 111... Line 97...
111
    mov  edx,labelt                ; pointer to text beginning
97
    mov  edi,title               ; WINDOW LABEL
112
    mov  esi,labellen-labelt       ; text length
98
    mcall
113
    int  0x40
99
 
114
 
100
                                   
115
    mov  eax,8                     ; NEW THREAD BUTTON
101
    mov  eax,8                     ; NEW THREAD BUTTON
116
    mov  ebx,25*65536+128
102
    mov  ebx,20*65536+128
Line -... Line 103...
-
 
103
    mov  ecx,63*65536+20
117
    mov  ecx,88*65536+20
104
    mov  edx,2
118
    mov  edx,2
105
    mov  esi,0x90b0d0 ;0x5577cc
119
    mov  esi,0x90b0d0 ;0x5577cc
106
    mcall
120
    int  0x40
107
 
121
 
108
    mov  eax,4
122
    mov  ebx,25*65536+35           ; draw info text with function 4
109
    mov  ebx,20*65536+10           ; draw info text with function 4
123
    mov  ecx,0x224466
-
 
124
    mov  edx,text
110
    mov  ecx,0x224466
125
    mov  esi,40
111
    mov  edx,text
126
  newline:
112
    mov  esi,40
127
    mov  eax,4
113
  newline:
Line 128... Line 114...
128
    int  0x40
114
    mcall
129
    add  ebx,10
115
    add  ebx,10
130
    add  edx,40
116
    add  edx,40
Line 131... Line 117...
131
    cmp  [edx],byte 'x'
117
    cmp  [edx],byte 'x'
Line 132... Line 118...
132
    jne  newline
118
    jne  newline
Line 133... Line 119...
133
 
119
 
134
 
120
 
135
    mov  eax,12                    ; function 12:tell os about windowdraw
121
    mov  eax,12                    ; function 12:tell os about windowdraw
136
    mov  ebx,2                     ; 2, end of draw
122
    mov  ebx,2                     ; 2, end of draw
137
    int  0x40
123
    mcall
138
 
124
 
139
    ret
125
    ret
140
 
126
 
141
 
127
 
142
; DATA AREA
-
 
143
 
128
; DATA AREA
Line 144... Line -...
144
if lang eq ru
-
 
145
  text:
129
 
146
      db '’€ Žƒ€ŒŒ€ ‘Ž‡„€…’ Ž’ŽŠˆ, ‡€“‘Š€Ÿ  '
130
if lang eq ru
147
      db 'Ž„ˆ ˆ ’Ž’ †… ŠŽ„ ŒŽƒŽ €‡. €Œ “†Ž  '
131
  text:
148
      db '’Ž‹œŠŽ Ž‡€Ž’ˆ’œ‘Ÿ Ž Ž’„…‹œŽŒ ‘’Š…  '
132
      db 'â  ¯à®£à ¬¬  ᮧ¤ ¥â ¯®â®ª¨, § ¯ãáª ï  '
149
      db '„‹Ÿ Š€†„ŽƒŽ Ž’ŽŠ€.                     '
133
      db '®¤¨­ ¨ â®â ¦¥ ª®¤ ¬­®£® à §.  ¬ ­ã¦­®  '
150
      db '€ŒŸ’œ „‹Ÿ ‚‘…• Ž’ŽŠŽ‚ Ž™€Ÿ.          '
134
      db '⮫쪮 ¯®§ ¡®â¨âìáï ®¡ ®â¤¥«ì­®¬ áâíª¥  '
151
      db '                                        '
135
      db '¤«ï ª ¦¤®£® ¯®â®ª .                     '
152
      db ' ‘Ž‡„€’œ Ž‚›‰ Ž’ŽŠ                    '
136
      db ' ¬ïâì ¤«ï ¢á¥å ¯®â®ª®¢ ®¡é ï.          '
153
 
137
      db '                                        '
154
      db 'x' ; <- END MARKER, DONT DELETE
138
      db ' ‘Ž‡„€’œ Ž‚›‰ Ž’ŽŠ                    '
155
 
139
      db 'x' ; <- END MARKER, DONT DELETE
156
  labelt:
-
 
157
       db   'ˆŒ… ˆ‘Ž‹œ‡Ž‚€ˆŸ 51®© ”“Š–ˆˆ'
140
 
Line 158... Line -...
158
  labellen:
-
 
159
else
141
  title   db   'à¨¬¥à ¨á¯®«ì§®¢ ­¨ï ¯®â®ª®¢',0
160
  text:
142
 
161
      db 'THIS EXAMPLE CREATES THREADS BY RUNNING '
143
else
162
      db 'THE SAME CODE MULTIPLE TIMES. ALL WE    '
144
  text: