Subversion Repositories Kolibri OS

Rev

Rev 485 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
205 heavyiron 1
;--- другие макросы ---
353 heavyiron 2
include '..\..\develop\examples\editbox\trunk\editbox.inc'
205 heavyiron 3
include 'txtbut.inc'
307 Lrz 4
;include 'gp.inc'
205 heavyiron 5
include 'label.inc'
833 Lrz 6
;include '..\..\develop\examples\checkbox\trunk\check.inc'
205 heavyiron 7
include 'check.inc'
8
include 'file_sys.inc'
9
include 'textwork.inc'
10
;include 'ini.inc'
11
 
833 Lrz 12
__CPU_type      equ     p5
13
SYSENTER_VAR    equ     0
485 heavyiron 14
 
15
 
205 heavyiron 16
macro movr reg,val
17
{
18
if val < 65536
833 Lrz 19
        push    val
20
        pop     reg
205 heavyiron 21
else
833 Lrz 22
        mov     reg,val
205 heavyiron 23
end if
24
}
25
 
485 heavyiron 26
macro mcall a,b,c,d,e,f {   ; mike.dld, updated by Ghost for Fast System Calls
833 Lrz 27
 local  ..ret_point
485 heavyiron 28
 __mov eax,a
29
 __mov ebx,b
30
 __mov ecx,c
31
 __mov edx,d
32
 __mov esi,e
33
 __mov edi,f
34
 
35
 if __CPU_type eq p5
833 Lrz 36
        int     0x40
485 heavyiron 37
 else
38
  if __CPU_type eq p6
833 Lrz 39
        push    ebp
40
        mov     ebp, esp
41
        push    ..ret_point     ; it may be 2 or 5 byte
42
        sysenter
485 heavyiron 43
 ..ret_point:
833 Lrz 44
        pop     edx
45
        pop     ecx
485 heavyiron 46
 
47
  else
48
   if __CPU_type eq k6
833 Lrz 49
        push    ecx
50
        syscall
51
        pop     ecx
485 heavyiron 52
   else
833 Lrz 53
        display 'ERROR : unknown CPU type'
54
        int     0x40
485 heavyiron 55
   end if
56
  end if
57
 end if
58
}
59
 
833 Lrz 60
macro __mov reg,a,b {       ; mike.dld
485 heavyiron 61
 if (~a eq)&(~b eq)
62
   mpack reg,a,b
63
 else if (~a eq)&(b eq)
64
   mov reg,a
65
 end if
66
}
67
 
68
 
205 heavyiron 69
;--- заголовок ---
70
macro meos_header par_buf,cur_dir_buf
71
{
833 Lrz 72
        use32
73
        org     0x0
205 heavyiron 74
 
833 Lrz 75
        db      'MENUET01'
76
        dd      0x01
77
        dd      __app_start
78
        dd      __app_end
79
        dd      __app_end
80
        dd      __app_end
205 heavyiron 81
if  eq <>
833 Lrz 82
        dd      0x0
205 heavyiron 83
else
833 Lrz 84
        dd      par_buf
205 heavyiron 85
end if
86
if  eq <>
833 Lrz 87
        dd      0x0
205 heavyiron 88
else
833 Lrz 89
        dd      cur_dir_buf
205 heavyiron 90
end if
91
}
92
 
93
;--- определить точку входа ---
94
macro app_start
95
{
96
__app_start:
97
}
98
 
99
;--- определить конец приложения и размер стека ---
100
macro app_end stack_size
101
{
102
if  eq <>
833 Lrz 103
        rb      1024
205 heavyiron 104
else
833 Lrz 105
        rb      stack_size
205 heavyiron 106
end if
107
__app_end:
108
}
109
 
110
;--- завершить текущий поток ---
111
macro app_close
112
{
833 Lrz 113
        xor     eax,eax
114
        dec     eax
115
        int     0x40
205 heavyiron 116
}
117
 
118
;--- получить код нажатой клавиши ---
119
macro get_key
120
{
833 Lrz 121
        ;mov     eax,2
122
        push    2
123
        pop     eax
124
        int     0x40
205 heavyiron 125
}
126
 
127
;--- получить код нажатой кнопки ---
128
macro get_pressed_button
129
{
833 Lrz 130
        ;mov     eax,17
131
        push    17
132
        pop     eax
133
        int     0x40
205 heavyiron 134
}
135
 
136
;--- сообщить системе о начале перерисовки окна ---
137
macro start_draw_window
138
{
833 Lrz 139
        ;mov     eax,12
140
        push    12
141
        pop     eax
142
        xor     ebx,ebx
143
        inc     ebx
144
        int     0x40
205 heavyiron 145
}
146
 
147
;--- сообщить системе о завершении перерисовки окна ---
148
macro stop_draw_window
149
{
833 Lrz 150
        ;mov     eax,12
151
        push    12
152
        pop     eax
153
        ;mov     ebx,2
154
        push    2
155
        pop     ebx
156
        int     0x40
205 heavyiron 157
}
158
 
159
;--- установить маску ожидаемых событий ---
160
macro set_events_mask mask
161
{
833 Lrz 162
        ;mov     eax,40
163
        push    40
164
        pop     eax
165
        ;mov     ebx,mask
166
        push    mask
167
        pop     ebx
168
        int     0x40
205 heavyiron 169
}
170
 
171
;--- получить информацию о процессе ---
172
macro get_procinfo proc_inf_buf,slot_num
173
{
833 Lrz 174
        ;mov     eax,9
175
        push    9
176
        pop     eax
177
        ;mov     ebx,proc_inf_buf
178
        push    proc_inf_buf
179
        pop     ebx
205 heavyiron 180
if  eq <>
833 Lrz 181
        xor     ecx,ecx
182
        dec     ecx
205 heavyiron 183
else
833 Lrz 184
        ;mov     ecx,slot_num
185
        push    slot_num
186
        pop     ecx
205 heavyiron 187
end if
833 Lrz 188
        int     0x40
205 heavyiron 189
}
190
 
191
macro get_sys_colors col_buf
192
{
833 Lrz 193
        ;mov     eax,48
194
        push    48
195
        pop     eax
196
        ;mov     ebx,3
197
        push    3
198
        pop     ebx
199
        ;mov     ecx,col_buf
200
        push    col_buf
201
        pop     ecx
202
        ;mov     edx,40
203
        push    40
204
        pop     edx
205
        int     0x40
205 heavyiron 206
}
207
 
208
macro get_grab_area
209
{
833 Lrz 210
        movr     eax,48
211
        movr     ebx,7
212
        int     0x40
205 heavyiron 213
}
214
 
307 Lrz 215
macro get_skin_height
205 heavyiron 216
{
833 Lrz 217
        movr     eax,48
218
        movr     ebx,4
219
        int     0x40
205 heavyiron 220
}
221
 
222
macro min_window
223
{
833 Lrz 224
        movr     eax,18
225
        movr     ebx,10
226
        int     0x40
205 heavyiron 227
}
228
 
229
macro activ_window slot_n
230
{
833 Lrz 231
        movr     eax,18
232
        movr     ebx,3
205 heavyiron 233
if  eq <>
234
else
833 Lrz 235
        movr     ecx,slot_n
205 heavyiron 236
end if
833 Lrz 237
        int     0x40
205 heavyiron 238
}
239
 
240
macro get_active_window
241
{
833 Lrz 242
        movr     eax,18
243
        movr     ebx,7
244
        int     0x40
205 heavyiron 245
}
246
 
247
macro delay time
248
{
833 Lrz 249
        movr     eax,5
205 heavyiron 250
if 
251
else
833 Lrz 252
        movr     ebx,time
205 heavyiron 253
end if
833 Lrz 254
        int     0x40
205 heavyiron 255
}
256
 
257
;--- ожидать события ---
258
macro wait_event redraw,key,button,mouse,ipc,other
259
{
833 Lrz 260
        movr     eax,10
261
        int     0x40
262
        dec     ax
205 heavyiron 263
if  eq <>
264
else
833 Lrz 265
        jz      redraw
205 heavyiron 266
end if
833 Lrz 267
        dec     ax
205 heavyiron 268
if  eq <>
269
else
833 Lrz 270
        jz      key
205 heavyiron 271
end if
833 Lrz 272
        dec     ax
205 heavyiron 273
if 
274
else
833 Lrz 275
        jz      button
205 heavyiron 276
end if
833 Lrz 277
        dec     ax
278
        dec     ax
279
        dec     ax
205 heavyiron 280
if  eq <>
281
else
833 Lrz 282
        jz      mouse
205 heavyiron 283
end if
284
if  eq <>
285
else
833 Lrz 286
        dec     ax
287
        jz      ipc
205 heavyiron 288
end if
289
if  eq <>
833 Lrz 290
        jmp     still
205 heavyiron 291
else
833 Lrz 292
        jmp     other
205 heavyiron 293
end if
294
}
295
 
296
;--- получить размеры экрана ---
297
macro get_screen_size
298
{
833 Lrz 299
        movr     eax,14
300
        int     0x40
205 heavyiron 301
}
302
 
303
macro get_screen_prop  struc_ptr
304
{
833 Lrz 305
        movr     eax,61
306
        push    eax eax
307
        xor     ebx,ebx
308
        inc     ebx
309
        int     0x40
310
        mov     [struc_ptr],eax
311
        pop     eax
312
        inc     ebx
313
        int     0x40
314
        mov     [struc_ptr+4],ax
315
        pop     eax
316
        inc     ebx
317
        int     0x40
318
        mov     [struc_ptr+6],eax
205 heavyiron 319
}
320
 
321
macro resize_mem mem_size
322
{
833 Lrz 323
        movr     eax,64
324
        xor     ebx,ebx
325
        inc     ebx
205 heavyiron 326
if  eq <>
327
else
833 Lrz 328
        movr     ecx,mem_size
205 heavyiron 329
end if
833 Lrz 330
        int     0x40
205 heavyiron 331
}
332
 
333
evm_redraw equ 1
334
evm_key equ 10b
335
evm_button equ 100b
336
evm_mouse equ 100000b
337
evm_ipc equ 1000000b
338
 
339
struc procinfo
340
{
341
.takts_per_second: dd ?
342
.window_stack_pos: dw ?
343
.slot_number: dw ?
344
dw ?
345
.name: rb 11
346
.align: db ?
347
.addres: dd ?
348
.use_mem: dd ?
349
.pid: dd ?
350
.left: dd ?
351
.top: dd ?
352
.width: dd ?
353
.height: dd ?
354
.slot_state: dw ?
355
rb (1024-56)
356
}
357
 
358
struc sys_color_table
359
{
360
.frames: dd ?  ;+0
361
.grab: dd ?    ;+4
362
.grab_button: dd ? ;+8
363
.grab_button_text: dd ?  ;+12
364
.grab_text: dd ?  ;+16
833 Lrz 365
.work: dd ?       ;+20
205 heavyiron 366
.work_button: dd ?;+24
367
.work_button_text: dd ? ;+28
833 Lrz 368
.work_text: dd ?        ;+32
369
.work_graph: dd ?       ;+36
205 heavyiron 370
}
371
 
372
struc screen_size
373
{
374
.height: dw ?
375
.width: dw ?
376
}
377
 
378
struc screen_prop
379
{
380
.height: dw ? ;+0
381
.width: dw ?  ;+2
382
.bitspp: dw ? ;+4
383
.bytesps: dd ?;+6
384
}
385
 
386
struc ipc_buffer size
387
{
388
.block: dd ?
389
.in_use: dd ?
390
.messages: rb size
391
}
392
 
393
;--- цвета ---
394
cl_white=0xffffff
307 Lrz 395
cl_black=0x000000
396
 
397
;==============================================================================
398
;============== Константы =====================================================
399
;==============================================================================