Subversion Repositories Kolibri OS

Rev

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

Rev 131 Rev 205
Line 1... Line -...
1
; language for programs
-
 
2
lang fix en ; ru en fr ge fi
-
 
3
 
-
 
4
@^ fix macro comment {
-
 
5
^@ fix }
-
 
6
 
-
 
7
 
-
 
8
macro m2m dest,src {
-
 
9
 push src
-
 
10
 pop  dest
-
 
11
}
-
 
12
 
-
 
13
; new application structure
1
; new application structure
14
macro meos_app_start
2
macro meos_app_start
15
 {
3
 {
16
  use32
4
  use32
17
  org 0x0
5
  org 0x0
Line 87... Line 75...
87
 
75
 
88
; strings
76
; strings
89
macro sz name,[data] {         ; from MFAR [mike.dld]
77
macro sz name,[data] {       ; from MFAR [mike.dld]
90
 common
78
  common
91
  if used name
-
 
92
   name db data
-
 
93
   .size = $-name
-
 
94
  end if
-
 
95
}
-
 
96
 
-
 
97
macro lsz name,[lng,data] {  ; from MFAR [mike.dld]
-
 
98
 common
-
 
99
  if used name
79
   if used name
-
 
80
    label name
100
   label name
81
   end if
101
 forward
82
  forward
102
  if lang eq lng
83
   if used name
103
   db data
84
    db data
104
  end if
85
   end if
105
 common
-
 
106
   .size = $-name
-
 
107
  end if
-
 
108
}
-
 
109
 
-
 
110
macro szc name,elsz,[data] {         ; from MFAR [mike.dld]
-
 
111
 common
-
 
112
  local s,m
-
 
113
  m = 0
86
  common
114
  if used name
-
 
115
   label name
-
 
116
   virtual at 0
-
 
117
    db data
-
 
118
    s = $
-
 
119
   end virtual
-
 
120
   d#elsz s
-
 
121
   if m < s
-
 
122
    m = s
-
 
123
   end if
-
 
124
   db data
87
   if used name
125
   .size = $-name
-
 
126
   .maxl = m
88
    .size = $-name
127
  end if
89
   end if
Line 128... Line 90...
128
}
90
}
129
 
91
 
130
macro lszc name,elsz,[lng,data] {  ; from MFAR [mike.dld]
-
 
131
 common
-
 
132
  local s,m,c
-
 
133
  m = 0
92
macro lsz name,[lng,data] {  ; from MFAR [mike.dld]
134
  c = 0
93
  common
135
  if used name
-
 
136
   label name
-
 
137
 forward
-
 
138
  if lang eq lng
-
 
139
   virtual at 0
-
 
140
    db data
-
 
141
    s = $
-
 
142
   end virtual
-
 
143
   d#elsz s
-
 
144
   if m < s
94
   if used name
-
 
95
    label name
-
 
96
   end if
145
    m = s
97
  forward
146
   end if
-
 
147
   db data
98
   if (used name)&(lang eq lng)
148
   c = c+1
99
    db data
-
 
100
   end if
149
  end if
101
  common
150
 common
-
 
151
   .size  = $-name
-
 
152
   .maxl  = m
102
   if used name
153
   .count = c
103
    .size = $-name
Line -... Line 104...
-
 
104
   end if
154
  end if
105
}
155
}
106
 
156
 
107
 
157
 
108
 
158
; easy system call macro
109
; easy system call macro
Line 170... Line 121...
170
      add dest, lsrc
121
      add dest, lsrc
171
    end if
122
    end if
172
  end if
123
  end if
173
}
124
}
Line 174... Line -...
174
 
-
 
175
;macro __mov reg,a {         ; mike.dld
-
 
176
; if ~a eq
-
 
177
;   mov reg,a
-
 
178
; end if
-
 
179
;}
-
 
180
 
125
 
181
macro __mov reg,a,b {        ; mike.dld
126
macro __mov reg,a,b {         ; mike.dld
182
 if (~a eq)&(~b eq)
127
 if (~a eq)&(~b eq)
183
   mpack reg,a,b
128
   mpack reg,a,b
184
 else if (~a eq)&(b eq)
129
 else if (~a eq)&(b eq)
Line 195... Line 140...
195
 __mov edi,f
140
 __mov edi,f
196
 int   0x40
141
 int   0x40
197
}
142
}
Line 198... Line -...
198
 
-
 
199
 
-
 
200
; -------------------------
-
 
201
macro header a,[b] {
-
 
202
 common
-
 
203
  use32
-
 
204
  org 0
-
 
205
  db 'MENUET',a
-
 
206
 forward
-
 
207
  if b eq
-
 
208
   dd 0
-
 
209
  else
-
 
210
   dd b
-
 
211
  end if }
-
 
212
macro section name { align 16
-
 
213
 label name }
-
 
214
macro func name {
-
 
215
 if ~used name
-
 
216
  display 'FUNC NOT USED: ',`name,13,10
-
 
217
 else
-
 
218
  align 4
-
 
219
  name:
-
 
220
;pushad
-
 
221
;pushfd
-
 
222
;dps `name
-
 
223
;newline
-
 
224
;mcall 5,1
-
 
225
;popfd
-
 
226
;popad
-
 
227
}
-
 
228
macro endf { end if }
-
 
229
 
-
 
230
macro diff16 title,l1,l2
-
 
231
 {
-
 
232
  local s,d
-
 
233
  s = l2-l1
-
 
234
  display title,': 0x'
-
 
235
  repeat 8
-
 
236
   d = '0' + s shr ((8-%) shl 2) and $0F
-
 
237
   if d > '9'
-
 
238
    d = d + 'A'-'9'-1
-
 
239
   end if
-
 
240
   display d
-
 
241
  end repeat
-
 
242
  display 13,10
-
 
243
 }
-
 
244
 
-
 
245
macro diff10 title,l1,l2
-
 
246
 {
-
 
247
  local s,d,z,m
-
 
248
  s = l2-l1
-
 
249
  z = 0
-
 
250
  m = 1000000000
-
 
251
  display title,': '
-
 
252
  repeat 10
-
 
253
   d = '0' + s / m
-
 
254
   s = s - (s/m)*m
-
 
255
   m = m / 10
-
 
256
   if d <> '0'
-
 
257
    z = 1
-
 
258
   end if
-
 
259
   if z <> 0
-
 
260
    display d
-
 
261
   end if
-
 
262
  end repeat
-
 
Line 263... Line 143...
263
  display 13,10
143
 
264
 }
144
 
Line 265... Line 145...
265
 
145
 
Line 292... Line 172...
292
   end if
172
   end if
293
 }
173
 }
Line 294... Line 174...
294
 
174
 
295
macro mov arg1,arg2
175
macro mov arg1,arg2
296
 {
176
 {
297
   if (arg1 in __regs) & (arg2 eqtype 0)
177
   if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
298
      if (arg2) = 0
178
      if (arg2) = 0
299
     xor arg1,arg1
179
         xor arg1,arg1
300
      else if (arg2) = 1
180
      else if (arg2) = 1
301
     xor arg1,arg1
181
         xor arg1,arg1
Line 312... Line 192...
312
      mov arg1,arg2
192
      mov arg1,arg2
313
   end if
193
   end if
314
 }
194
 }
Line 315... Line -...
315
 
-
 
316
 
-
 
317
macro RGB [a] {
-
 
318
 common
-
 
319
  match (r=,g=,b),a \{
-
 
320
   \dd ((r) shl 16) or ((g) shl 8) or (b)
-
 
321
  \}
-
 
322
}
-
 
323
 
-
 
324
 
-
 
325
struc POINT _t,_dx,_dy {
-
 
326
 .x _t _dx
-
 
327
 .y _t _dy
-
 
328
}
-
 
329
 
-
 
330
 
-
 
331
; Macroinstructions for defining data structures
195
 
332
 
-
 
333
macro struct name
-
 
334
 { fields@struct equ name
-
 
335
   match child parent, name \{ fields@struct equ child,fields@\#parent \}
-
 
336
   sub@struct equ
-
 
337
   struc db [val] \{ \common fields@struct equ fields@struct,.,db, \}
-
 
338
   struc dw [val] \{ \common fields@struct equ fields@struct,.,dw, \}
-
 
339
   struc du [val] \{ \common fields@struct equ fields@struct,.,du, \}
-
 
340
   struc dd [val] \{ \common fields@struct equ fields@struct,.,dd, \}
-
 
341
   struc dp [val] \{ \common fields@struct equ fields@struct,.,dp, \}
-
 
342
   struc dq [val] \{ \common fields@struct equ fields@struct,.,dq, \}
-
 
343
   struc dt [val] \{ \common fields@struct equ fields@struct,.,dt, \}
-
 
344
   struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \}
-
 
345
   struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \}
-
 
346
   struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \}
-
 
347
   struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \}
-
 
348
   struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \}
-
 
349
   struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \}
-
 
350
   macro db [val] \{ \common \local anonymous
-
 
351
             fields@struct equ fields@struct,anonymous,db, \}
-
 
352
   macro dw [val] \{ \common \local anonymous
-
 
353
             fields@struct equ fields@struct,anonymous,dw, \}
-
 
354
   macro du [val] \{ \common \local anonymous
-
 
355
             fields@struct equ fields@struct,anonymous,du, \}
-
 
356
   macro dd [val] \{ \common \local anonymous
-
 
357
             fields@struct equ fields@struct,anonymous,dd, \}
-
 
358
   macro dp [val] \{ \common \local anonymous
-
 
359
             fields@struct equ fields@struct,anonymous,dp, \}
-
 
360
   macro dq [val] \{ \common \local anonymous
-
 
361
             fields@struct equ fields@struct,anonymous,dq, \}
-
 
362
   macro dt [val] \{ \common \local anonymous
-
 
363
             fields@struct equ fields@struct,anonymous,dt, \}
-
 
364
   macro rb count \{ \local anonymous
-
 
365
             fields@struct equ fields@struct,anonymous,db,count dup (?) \}
-
 
366
   macro rw count \{ \local anonymous
-
 
367
             fields@struct equ fields@struct,anonymous,dw,count dup (?) \}
-
 
368
   macro rd count \{ \local anonymous
-
 
369
             fields@struct equ fields@struct,anonymous,dd,count dup (?) \}
-
 
370
   macro rp count \{ \local anonymous
-
 
371
             fields@struct equ fields@struct,anonymous,dp,count dup (?) \}
-
 
372
   macro rq count \{ \local anonymous
-
 
373
             fields@struct equ fields@struct,anonymous,dq,count dup (?) \}
-
 
374
   macro rt count \{ \local anonymous
-
 
375
             fields@struct equ fields@struct,anonymous,dt,count dup (?) \}
-
 
376
   macro union \{ fields@struct equ fields@struct,,union,<
-
 
377
          sub@struct equ union \}
-
 
378
   macro struct \{ fields@struct equ fields@struct,,substruct,<
-
 
379
          sub@struct equ substruct \}
-
 
380
   virtual at 0 }
-
 
381
 
-
 
382
macro ends
-
 
383
 { match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt
-
 
384
             restruc rb,rw,rd,rp,rq,rt
-
 
385
             purge db,dw,du,dd,dp,dq,dt
-
 
386
             purge rb,rw,rd,rp,rq,rt
-
 
387
             purge union,struct
-
 
388
             match name=,fields,fields@struct \\{ fields@struct equ
-
 
389
                                  make@struct name,fields
-
 
390
                                  fields@\\#name equ fields \\}
-
 
391
             end virtual \}
-
 
392
   match any, sub@struct \{ fields@struct equ fields@struct> \}
-
 
393
   restore sub@struct }
-
 
394
 
-
 
395
macro make@struct name,[field,type,def]
-
 
396
 { common
-
 
397
    if $
-
 
398
     display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah
-
 
399
     err
-
 
400
    end if
-
 
401
    local define
-
 
402
    define equ name
-
 
403
   forward
-
 
404
    local sub
-
 
405
    match , field \{ make@substruct type,name,sub def
-
 
406
             define equ define,.,sub, \}
-
 
407
    match any, field \{ define equ define,.#field,type, \}
-
 
408
   common
-
 
409
    match fields, define \{ define@struct fields \} }
-
 
410
 
-
 
411
macro define@struct name,[field,type,def]
-
 
412
 { common
-
 
413
    local list
-
 
414
    list equ
-
 
415
   forward
-
 
416
    if ~ field eq .
-
 
417
     name#field type def
-
 
418
     sizeof.#name#field = $ - name#field
-
 
419
    else
-
 
420
     rb sizeof.#type
-
 
421
    end if
-
 
422
    local value
-
 
423
    match any, list \{ list equ list, \}
-
 
424
    list equ list 
-
 
425
   common
-
 
426
    sizeof.#name = $
-
 
427
    restruc name
-
 
428
    match values, list \{
-
 
429
    struc name value \\{
-
 
430
    match any, fields@struct \\\{ fields@struct equ fields@struct,.,name, \\\}
-
 
431
    match , fields@struct \\\{ label .
-
 
432
   forward
-
 
433
     match , value \\\\{ field type def \\\\}
-
 
434
     match any, value \\\\{ field type value
-
 
435
               if ~ field eq .
-
 
436
                rb sizeof.#name#field - ($-field)
-
 
437
               end if \\\\}
-
 
438
   common \\\} \\} \} }
-
 
439
 
-
 
440
macro enable@substruct
-
 
441
 { macro make@substruct substruct,parent,name,[field,type,def]
-
 
442
    \{ \common
-
 
443
    \local define
-
 
444
    define equ parent,name
-
 
445
       \forward
-
 
446
    \local sub
-
 
447
    match , field \\{ match any, type \\\{ enable@substruct
-
 
448
                           make@substruct type,name,sub def
-
 
449
                           purge make@substruct
-
 
450
                           define equ define,.,sub, \\\} \\}
-
 
451
    match any, field \\{ define equ define,.\#field,type, \\}
-
 
452
       \common
-
 
453
    match fields, define \\{ define@\#substruct fields \\} \} }
-
 
454
 
-
 
455
enable@substruct
-
 
456
 
-
 
457
macro define@union parent,name,[field,type,def]
-
 
458
 { common
-
 
459
    virtual at 0
-
 
460
   forward
-
 
461
    if ~ field eq .
-
 
462
     virtual at 0
-
 
463
      parent#field type def
-
 
464
      sizeof.#parent#field = $ - parent#field
-
 
465
     end virtual
-
 
466
     if sizeof.#parent#field > $
-
 
467
      rb sizeof.#parent#field - $
-
 
468
     end if
-
 
469
    else if sizeof.#type > $
-
 
470
     rb sizeof.#type - $
-
 
471
    end if
-
 
472
   common
-
 
473
    sizeof.#name = $
-
 
474
    end virtual
-
 
475
    struc name [value] \{ \common
-
 
476
    label .\#name
-
 
477
    last@union equ
-
 
478
   forward
-
 
479
    match any, last@union \\{ virtual at .\#name
-
 
480
                   field type def
-
 
481
                  end virtual \\}
-
 
482
    match , last@union \\{ match , value \\\{ field type def \\\}
-
 
483
               match any, value \\\{ field type value \\\} \\}
-
 
484
    last@union equ field
196
 
485
   common rb sizeof.#name - ($ - .\#name) \} }
-
 
486
 
-
 
487
macro define@substruct parent,name,[field,type,def]
197
macro struct name
488
 { common
-
 
489
    virtual at 0
-
 
490
   forward
-
 
491
    if ~ field eq .
-
 
492
     parent#field type def
-
 
493
     sizeof.#parent#field = $ - parent#field
-
 
494
    else
-
 
495
     rb sizeof.#type
-
 
496
    end if
198
 {
497
    local value
199
  virtual at 0
498
   common
200
   name name
499
    sizeof.#name = $
-
 
500
    end virtual
-
 
501
    struc name value \{
201
   sizeof.#name = $ - name
502
    label .\#name
-
 
503
   forward
-
 
504
     match , value \\{ field type def \\}
-
 
505
     match any, value \\{ field type value
-
 
506
              if ~ field eq .
-
 
507
               rb sizeof.#parent#field - ($-field)
-
 
Line 508... Line 202...
508
              end if \\}
202
  end virtual
-
 
203
 }
-
 
204
 
-
 
205
; structures used in MeOS
-
 
206
struc process_information
-
 
207
 {
-
 
208
  .cpu_usage               dd ?  ; +0
-
 
209
  .window_stack_position   dw ?  ; +4
-
 
210
  .window_stack_value      dw ?  ; +6
-
 
211
  .not_used1               dw ?  ; +8
-
 
212
  .process_name            rb 12 ; +10
-
 
213
  .memory_start            dd ?  ; +22
-
 
214
  .used_memory             dd ?  ; +26
-
 
215
  .PID                     dd ?  ; +30
-
 
216
  .x_start                 dd ?  ; +34
-
 
217
  .y_start                 dd ?  ; +38
-
 
218
  .x_size                  dd ?  ; +42
-
 
219
  .y_size                  dd ?  ; +46
-
 
220
  .slot_state              dw ?  ; +50
-
 
221
                           dw ?  ; +52 - reserved
-
 
222
  .client_left             dd ?  ; +54
-
 
223
  .client_top              dd ?  ; +58
-
 
224
  .client_width            dd ?  ; +62
-
 
225
  .client_height           dd ?  ; +66
509
   common \} }
226
  .wnd_state               db ?  ; +70
510
 
-
 
511
; structures used in MeOS
-
 
512
struct process_information
-
 
513
  cpu_usage          dd ?    ; +0
-
 
514
  window_stack_position   dw ?    ; +4
-
 
515
  window_stack_value      dw ?    ; +6
-
 
516
  not_used1          dw ?    ; +8
-
 
517
  process_name          rb 12 ; +10
-
 
518
  memory_start          dd ?    ; +22
-
 
519
  used_memory          dd ?    ; +26
-
 
520
  PID              dd ?    ; +30
-
 
521
  x_start          dd ?    ; +34
-
 
522
  y_start          dd ?    ; +38
-
 
523
  x_size          dd ?    ; +42
-
 
524
  y_size          dd ?    ; +46
-
 
Line -... Line 227...
-
 
227
  rb (1024-71)
-
 
228
 }
-
 
229
struct process_information
-
 
230
 
-
 
231
struc system_colors
-
 
232
 {
-
 
233
  .frame            dd ?
-
 
234
  .grab             dd ?
-
 
235
  .grab_button      dd ?
-
 
236
  .grab_button_text dd ?
-
 
237
  .grab_text        dd ?
-
 
238
  .work             dd ?
-
 
239
  .work_button      dd ?
525
  slot_state          dw ?    ; +50
240
  .work_button_text dd ?
526
  rb (1024-52)
-
 
527
ends
-
 
528
 
-
 
529
struct system_colors
-
 
530
  frame        dd ?
-
 
531
  grab           dd ?
-
 
532
  grab_button       dd ?
-
 
533
  grab_button_text dd ?
-
 
534
  grab_text       dd ?
-
 
535
  work           dd ?
-
 
536
  work_button       dd ?
-
 
Line 537... Line 241...
537
  work_button_text dd ?
241
  .work_text        dd ?
Line 538... Line 242...
538
  work_text       dd ?
242
  .work_graph       dd ?