Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
475 Ghost 1
 
2
macro iglobal {
3
  IGlobals equ IGlobals,
4
  macro __IGlobalBlock { }
5
6
 
7
  UGlobals equ UGlobals,
8
  macro __UGlobalBlock { }
9
10
 
11
12
 
13
 
14
  macro IGlobals dummy,[n] \{ __IGlobalBlock
15
     purge __IGlobalBlock  \}
16
  match I, IGlobals \{ I \} }
17
18
 
19
  macro UGlobals dummy,[n] \{
20
    \common
21
      \local begin, size
22
      begin = $
23
      virtual at $
24
    \forward
25
      __UGlobalBlock
26
      purge __UGlobalBlock
27
    \common
28
      size = $ - begin
29
    end virtual
30
    rb size
31
  \}
32
  match U, UGlobals \{ U \} }
33
34
 
35
endg
36
37
 
38
endg
39
40
 
41
; new application structure
132 diamond 42
macro meos_app_start
43
 {
44
  use32
45
  org 0x0
46
47
 
48
  dd 0x01
49
  dd __start
50
  dd __end
51
  dd __memory
52
  dd __stack
53
54
 
55
    dd __params
56
  else
57
    dd 0x0
58
  end if
59
60
 
61
 }
62
MEOS_APP_START fix meos_app_start
63
64
 
65
 {
66
  __start:
67
 }
68
CODE fix code
69
70
 
71
 {
72
  __data:
73
  IncludeIGlobals
475 Ghost 74
 }
132 diamond 75
DATA fix data
76
77
 
78
 {
79
  if used __params & ~defined __params
80
    __params:
81
      db 0
82
    __end:
83
      rb 255
84
  else
85
    __end:
86
  end if
87
  __udata:
88
  IncludeUGlobals
475 Ghost 89
 }
132 diamond 90
UDATA fix udata
91
92
 
93
 {
94
  align 32
95
  rb 2048
96
  __stack:
97
  __memory:
98
 }
99
MEOS_APP_END fix meos_app_end
100
101
 
102
 
103
struc mstr [sstring]
104
 {
105
  forward
106
    local ssize
107
    virtual at 0
108
      db sstring
109
      ssize = $
110
    end virtual
111
    dd ssize
112
    db sstring
113
  common
114
    dd -1
115
 }
116
475 Ghost 117
 
118
struc mls [sstring] {
119
	forward
120
	local ssize
121
	virtual at 0
122
		db sstring	; mod
123
		ssize = $
124
	end virtual
125
	db ssize
126
	db sstring
127
	common
128
132 diamond 129
 
475 Ghost 130
}
131
132 diamond 132
 
475 Ghost 133
 
134
 
132 diamond 135
macro sz name,[data] {       ; from MFAR [mike.dld]
136
  common
137
   if used name
138
    label name
139
   end if
140
  forward
141
   if used name
142
    db data
143
   end if
144
  common
145
   if used name
146
    .size = $-name
147
   end if
148
}
149
150
 
151
  common
152
   if used name
153
    label name
154
   end if
155
  forward
156
   if (used name)&(lang eq lng)
157
    db data
158
   end if
159
  common
160
   if used name
161
    .size = $-name
162
   end if
163
}
164
165
 
166
 
167
 
168
macro mpack dest, hsrc, lsrc
169
{
170
  if (hsrc eqtype 0) & (lsrc eqtype 0)
171
    mov dest, (hsrc) shl 16 + lsrc
172
  else
173
    if (hsrc eqtype 0) & (~lsrc eqtype 0)
174
      mov dest, (hsrc) shl 16
175
      add dest, lsrc
176
    else
177
      mov dest, hsrc
178
      shl dest, 16
179
      add dest, lsrc
180
    end if
181
  end if
182
}
183
184
 
205 heavyiron 185
 if (~a eq)&(~b eq)
186
   mpack reg,a,b
187
 else if (~a eq)&(b eq)
188
   mov reg,a
132 diamond 189
 end if
190
}
191
192
 
475 Ghost 193
SYSENTER_VAR	equ	0
194
195
 
196
 local	..ret_point
197
 __mov eax,a
132 diamond 198
 __mov ebx,b
199
 __mov ecx,c
200
 __mov edx,d
201
 __mov esi,e
202
 __mov edi,f
203
475 Ghost 204
 
205
	int	0x40
206
 else
207
  if __CPU_type eq p6
208
	push	ebp
209
	mov	ebp, esp
210
	push	..ret_point	; it may be 2 or 5 byte
211
	sysenter
212
 ..ret_point:
213
	pop	edx
214
	pop	ecx
215
216
 
217
   if __CPU_type eq k6
218
	push	ecx
219
	syscall
220
	pop	ecx
221
   else
222
	display 'ERROR : unknown CPU type'
223
	int	0x40
224
   end if
225
  end if
226
 end if
227
}
132 diamond 228
229
 
230
 
231
 
475 Ghost 232
 
132 diamond 233
__regs fix 
234
235
 
236
 {
237
   if (arg2 eqtype 0)
238
      if (arg2) = 1
239
         inc arg1
240
      else
241
         add arg1,arg2
242
      end if
243
   else
244
      add arg1,arg2
245
   end if
246
 }
247
248
 
249
 {
250
   if (arg2 eqtype 0)
251
      if (arg2) = 1
252
         dec arg1
253
      else
254
         sub arg1,arg2
255
      end if
256
   else
257
      sub arg1,arg2
258
   end if
259
 }
260
261
 
262
 {
263
   if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
205 heavyiron 264
      if (arg2) = 0
132 diamond 265
         xor arg1,arg1
266
      else if (arg2) = 1
267
         xor arg1,arg1
268
         inc arg1
269
      else if (arg2) = -1
270
         or  arg1,-1
271
      else if (arg2) > -128 & (arg2) < 128
272
         push arg2
273
         pop  arg1
274
      else
275
         mov  arg1,arg2
276
      end if
277
   else
278
      mov arg1,arg2
279
   end if
280
 }
281
282
 
283
 
284
 {
285
  virtual at 0
286
   name name
287
   sizeof.#name = $ - name
288
  end virtual
289
 }
290
291
 
292
struc process_information
293
 {
294
  .cpu_usage               dd ?  ; +0
295
  .window_stack_position   dw ?  ; +4
296
  .window_stack_value      dw ?  ; +6
297
  .not_used1               dw ?  ; +8
298
  .process_name            rb 12 ; +10
299
  .memory_start            dd ?  ; +22
300
  .used_memory             dd ?  ; +26
301
  .PID                     dd ?  ; +30
302
  .x_start                 dd ?  ; +34
303
  .y_start                 dd ?  ; +38
304
  .x_size                  dd ?  ; +42
305
  .y_size                  dd ?  ; +46
306
  .slot_state              dw ?  ; +50
307
                           dw ?  ; +52 - reserved
205 heavyiron 308
  .client_left             dd ?  ; +54
309
  .client_top              dd ?  ; +58
310
  .client_width            dd ?  ; +62
311
  .client_height           dd ?  ; +66
312
  .wnd_state               db ?  ; +70
313
  rb (1024-71)
314
 }
132 diamond 315
struct process_information
316
317
 
318
 {
319
  .frame            dd ?
320
  .grab             dd ?
321
  .grab_button      dd ?
322
  .grab_button_text dd ?
323
  .grab_text        dd ?
324
  .work             dd ?
325
  .work_button      dd ?
326
  .work_button_text dd ?
327
  .work_text        dd ?
328
  .work_graph       dd ?
329
 }
330
struct system_colors
331
332
 
333
 
334
335
 
336
EV_IDLE        = 0
337
EV_TIMER       = 0
338
EV_REDRAW      = 1
339
EV_KEY         = 2
340
EV_BUTTON      = 3
341
EV_EXIT        = 4
342
EV_BACKGROUND  = 5
343
EV_MOUSE       = 6
344
EV_IPC         = 7
345
EV_STACK       = 8
346
347
 
348
EVM_REDRAW     =        1b
349
EVM_KEY        =       10b
350
EVM_BUTTON     =      100b
351
EVM_EXIT       =     1000b
352
EVM_BACKGROUND =    10000b
353
EVM_MOUSE      =   100000b
354
EVM_IPC        =  1000000b
355
EVM_STACK      = 10000000b
356