Subversion Repositories Kolibri OS

Rev

Rev 3520 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3520 Rev 3598
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
 
6
 
7
 
7
 
8
;
8
;
9
; Formatted Debug Output (FDO)
9
; Formatted Debug Output (FDO)
10
; Copyright (c) 2005-2006, mike.dld
10
; Copyright (c) 2005-2006, mike.dld
11
; Created: 2005-01-29, Changed: 2006-11-10
11
; Created: 2005-01-29, Changed: 2006-11-10
12
;
12
;
13
; For questions and bug reports, mail to mike.dld@gmail.com
13
; For questions and bug reports, mail to mike.dld@gmail.com
14
;
14
;
15
; Available format specifiers are: %s, %d, %u, %x (with partial width support)
15
; Available format specifiers are: %s, %d, %u, %x (with partial width support)
16
;
16
;
17
 
17
 
18
; to be defined:
18
; to be defined:
19
;   __DEBUG__ equ 1
19
;   __DEBUG__ equ 1
20
;   __DEBUG_LEVEL__ equ 5
20
;   __DEBUG_LEVEL__ equ 5
-
 
21
 
-
 
22
; MOV Immediate.
-
 
23
; Useful for things like movi eax,10:
-
 
24
; shorter than regular mov, but slightly slower,
-
 
25
; do not use it in performance-critical places.
-
 
26
macro movi dst, imm
-
 
27
{
-
 
28
if imm >= -0x80 & imm <= 0x7F
-
 
29
        push    imm
-
 
30
        pop     dst
-
 
31
else
-
 
32
        mov     dst, imm
-
 
33
end if
-
 
34
}
21
 
35
 
22
macro debug_func name {
36
macro debug_func name {
23
 if used name
37
 if used name
24
  name@of@func equ name
38
  name@of@func equ name
25
}
39
}
26
 
40
 
27
macro debug_beginf {
41
macro debug_beginf {
28
 align 4
42
 align 4
29
 name@of@func:
43
 name@of@func:
30
}
44
}
31
 
45
 
32
debug_endf fix end if
46
debug_endf fix end if
33
 
47
 
34
macro DEBUGS _sign,[_str] {
48
macro DEBUGS _sign,[_str] {
35
 common
49
 common
36
  local tp
50
  local tp
37
  tp equ 0
51
  tp equ 0
38
  match _arg:_num,_str \{
52
  match _arg:_num,_str \{
39
   DEBUGS_N _sign,_num,_arg
53
   DEBUGS_N _sign,_num,_arg
40
   tp equ 1
54
   tp equ 1
41
  \}
55
  \}
42
  match =0 _arg,tp _str \{
56
  match =0 _arg,tp _str \{
43
   DEBUGS_N _sign,,_arg
57
   DEBUGS_N _sign,,_arg
44
  \}
58
  \}
45
}
59
}
46
 
60
 
47
macro DEBUGS_N _sign,_num,[_str] {
61
macro DEBUGS_N _sign,_num,[_str] {
48
 common
62
 common
49
        pushf
63
        pushf
50
        pushad
64
        pushad
51
  local ..str,..label,is_str
65
  local ..str,..label,is_str
52
  is_str = 0
66
  is_str = 0
53
 forward
67
 forward
54
  if _str eqtype ''
68
  if _str eqtype ''
55
   is_str = 1
69
   is_str = 1
56
  end if
70
  end if
57
 common
71
 common
58
  if is_str = 1
72
  if is_str = 1
59
        jmp     ..label
73
        jmp     ..label
60
   ..str db _str,0
74
   ..str db _str,0
61
   ..label:
75
   ..label:
62
        add     esp, 4*8+4
76
        add     esp, 4*8+4
63
        mov     edx, ..str
77
        mov     edx, ..str
64
        sub     esp, 4*8+4
78
        sub     esp, 4*8+4
65
  else
79
  else
66
        mov     edx, _str
80
        mov     edx, _str
67
  end if
81
  end if
68
  if ~_num eq
82
  if ~_num eq
69
   if _num eqtype eax
83
   if _num eqtype eax
70
    if _num in 
84
    if _num in 
71
        mov     esi, _num
85
        mov     esi, _num
72
    else if ~_num eq esi
86
    else if ~_num eq esi
73
        movzx   esi, _num
87
        movzx   esi, _num
74
    end if
88
    end if
75
   else if _num eqtype 0
89
   else if _num eqtype 0
76
        mov     esi, _num
90
        mov     esi, _num
77
   else
91
   else
78
    local tp
92
    local tp
79
    tp equ 0
93
    tp equ 0
80
    match [_arg],_num \{
94
    match [_arg],_num \{
81
        mov     esi, dword[_arg]
95
        mov     esi, dword[_arg]
82
     tp equ 1
96
     tp equ 1
83
    \}
97
    \}
84
    match =0 =dword[_arg],tp _num \{
98
    match =0 =dword[_arg],tp _num \{
85
        mov     esi, dword[_arg]
99
        mov     esi, dword[_arg]
86
     tp equ 1
100
     tp equ 1
87
    \}
101
    \}
88
    match =0 =word[_arg],tp _num \{
102
    match =0 =word[_arg],tp _num \{
89
        movzx   esi, word[_arg]
103
        movzx   esi, word[_arg]
90
     tp equ 1
104
     tp equ 1
91
    \}
105
    \}
92
    match =0 =byte[_arg],tp _num \{
106
    match =0 =byte[_arg],tp _num \{
93
        movzx   esi, byte[_arg]
107
        movzx   esi, byte[_arg]
94
     tp equ 1
108
     tp equ 1
95
    \}
109
    \}
96
    match =0,tp \{
110
    match =0,tp \{
97
     'Error: specified string width is incorrect'
111
     'Error: specified string width is incorrect'
98
    \}
112
    \}
99
   end if
113
   end if
100
  else
114
  else
101
        mov     esi, 0x7FFFFFFF
115
        mov     esi, 0x7FFFFFFF
102
  end if
116
  end if
103
        call    fdo_debug_outstr
117
        call    fdo_debug_outstr
104
        popad
118
        popad
105
        popf
119
        popf
106
}
120
}
107
 
121
 
108
macro DEBUGD _sign,_dec {
122
macro DEBUGD _sign,_dec {
109
 local tp
123
 local tp
110
 tp equ 0
124
 tp equ 0
111
 match _arg:_num,_dec \{
125
 match _arg:_num,_dec \{
112
  DEBUGD_N _sign,_num,_arg
126
  DEBUGD_N _sign,_num,_arg
113
  tp equ 1
127
  tp equ 1
114
 \}
128
 \}
115
 match =0 _arg,tp _dec \{
129
 match =0 _arg,tp _dec \{
116
  DEBUGD_N _sign,,_arg
130
  DEBUGD_N _sign,,_arg
117
 \}
131
 \}
118
}
132
}
119
 
133
 
120
macro DEBUGD_N _sign,_num,_dec {
134
macro DEBUGD_N _sign,_num,_dec {
121
        pushf
135
        pushf
122
        pushad
136
        pushad
123
 if (~_num eq)
137
 if (~_num eq)
124
  if (_dec eqtype eax | _dec eqtype 0)
138
  if (_dec eqtype eax | _dec eqtype 0)
125
   'Error: precision allowed only for in-memory variables'
139
   'Error: precision allowed only for in-memory variables'
126
  end if
140
  end if
127
  if (~_num in <1,2,4>)
141
  if (~_num in <1,2,4>)
128
   if _sign
142
   if _sign
129
    'Error: 1, 2 and 4 are only allowed for precision in %d'
143
    'Error: 1, 2 and 4 are only allowed for precision in %d'
130
   else
144
   else
131
    'Error: 1, 2 and 4 are only allowed for precision in %u'
145
    'Error: 1, 2 and 4 are only allowed for precision in %u'
132
   end if
146
   end if
133
  end if
147
  end if
134
 end if
148
 end if
135
 if _dec eqtype eax
149
 if _dec eqtype eax
136
  if _dec in 
150
  if _dec in 
137
        mov     eax, _dec
151
        mov     eax, _dec
138
  else if ~_dec eq eax
152
  else if ~_dec eq eax
139
   if _sign = 1
153
   if _sign = 1
140
        movsx   eax, _dec
154
        movsx   eax, _dec
141
   else
155
   else
142
        movzx   eax, _dec
156
        movzx   eax, _dec
143
   end if
157
   end if
144
  end if
158
  end if
145
 else if _dec eqtype 0
159
 else if _dec eqtype 0
146
        mov     eax, _dec
160
        mov     eax, _dec
147
 else
161
 else
148
        add     esp, 4*8+4
162
        add     esp, 4*8+4
149
  if _num eq
163
  if _num eq
150
        mov     eax, dword _dec
164
        mov     eax, dword _dec
151
  else if _num = 1
165
  else if _num = 1
152
   if _sign = 1
166
   if _sign = 1
153
        movsx   eax, byte _dec
167
        movsx   eax, byte _dec
154
   else
168
   else
155
        movzx   eax, byte _dec
169
        movzx   eax, byte _dec
156
   end if
170
   end if
157
  else if _num = 2
171
  else if _num = 2
158
   if _sign = 1
172
   if _sign = 1
159
        movsx   eax, word _dec
173
        movsx   eax, word _dec
160
   else
174
   else
161
        movzx   eax, word _dec
175
        movzx   eax, word _dec
162
   end if
176
   end if
163
  else
177
  else
164
        mov     eax, dword _dec
178
        mov     eax, dword _dec
165
  end if
179
  end if
166
        sub     esp, 4*8+4
180
        sub     esp, 4*8+4
167
 end if
181
 end if
168
        mov     cl, _sign
182
        mov     cl, _sign
169
        call    fdo_debug_outdec
183
        call    fdo_debug_outdec
170
        popad
184
        popad
171
        popf
185
        popf
172
}
186
}
173
 
187
 
174
macro DEBUGH _sign,_hex {
188
macro DEBUGH _sign,_hex {
175
 local tp
189
 local tp
176
 tp equ 0
190
 tp equ 0
177
 match _arg:_num,_hex \{
191
 match _arg:_num,_hex \{
178
  DEBUGH_N _sign,_num,_arg
192
  DEBUGH_N _sign,_num,_arg
179
  tp equ 1
193
  tp equ 1
180
 \}
194
 \}
181
 match =0 _arg,tp _hex \{
195
 match =0 _arg,tp _hex \{
182
  DEBUGH_N _sign,,_arg
196
  DEBUGH_N _sign,,_arg
183
 \}
197
 \}
184
}
198
}
185
 
199
 
186
macro DEBUGH_N _sign,_num,_hex {
200
macro DEBUGH_N _sign,_num,_hex {
187
        pushf
201
        pushf
188
        pushad
202
        pushad
189
 if (~_num eq) & (~_num in <1,2,3,4,5,6,7,8>)
203
 if (~_num eq) & (~_num in <1,2,3,4,5,6,7,8>)
190
  'Error: 1..8 are only allowed for precision in %x'
204
  'Error: 1..8 are only allowed for precision in %x'
191
 end if
205
 end if
192
 if _hex eqtype eax
206
 if _hex eqtype eax
193
  if _hex in 
207
  if _hex in 
194
   if ~_hex eq eax
208
   if ~_hex eq eax
195
        mov     eax, _hex
209
        mov     eax, _hex
196
   end if
210
   end if
197
        mov     edx, 8
211
        mov     edx, 8
198
  else if _hex in 
212
  else if _hex in 
199
   if ~_hex eq ax
213
   if ~_hex eq ax
200
        movzx   eax, _hex
214
        movzx   eax, _hex
201
   end if
215
   end if
202
   if (_num eq)
216
   if (_num eq)
203
        mov     edx, 4
217
        mov     edx, 4
204
   end if
218
   end if
205
  else if _hex in 
219
  else if _hex in 
206
   if ~_hex eq al
220
   if ~_hex eq al
207
        movzx   eax, _hex
221
        movzx   eax, _hex
208
   end if
222
   end if
209
   if (_num eq)
223
   if (_num eq)
210
        mov     edx, 2
224
        mov     edx, 2
211
   end if
225
   end if
212
  end if
226
  end if
213
 else if _hex eqtype 0
227
 else if _hex eqtype 0
214
        mov     eax, _hex
228
        mov     eax, _hex
215
 else
229
 else
216
        add     esp, 4*8+4
230
        add     esp, 4*8+4
217
        mov     eax, dword _hex
231
        mov     eax, dword _hex
218
        sub     esp, 4*8+4
232
        sub     esp, 4*8+4
219
 end if
233
 end if
220
 if ~_num eq
234
 if ~_num eq
221
        mov     edx, _num
235
        mov     edx, _num
222
 else
236
 else
223
  if ~_hex eqtype eax
237
  if ~_hex eqtype eax
224
        mov     edx, 8
238
        mov     edx, 8
225
  end if
239
  end if
226
 end if
240
 end if
227
        call    fdo_debug_outhex
241
        call    fdo_debug_outhex
228
        popad
242
        popad
229
        popf
243
        popf
230
}
244
}
231
 
245
 
232
;-----------------------------------------------------------------------------
246
;-----------------------------------------------------------------------------
233
 
247
 
234
debug_func fdo_debug_outchar
248
debug_func fdo_debug_outchar
235
debug_beginf
249
debug_beginf
236
        pushad
250
        pushad
237
        movzx   ebx, al
251
        movzx   ebx, al
238
        mov     eax, 1
252
        mov     eax, 1
239
;        mov     ecx,sys_msg_board
253
;        mov     ecx,sys_msg_board
240
;        call    ecx ; sys_msg_board
254
;        call    ecx ; sys_msg_board
241
        stdcall SysMsgBoardChar
255
        stdcall SysMsgBoardChar
242
        popad
256
        popad
243
        ret
257
        ret
244
debug_endf
258
debug_endf
245
 
259
 
246
debug_func fdo_debug_outstr
260
debug_func fdo_debug_outstr
247
debug_beginf
261
debug_beginf
248
        mov     eax, 1
262
        mov     eax, 1
249
  .l1:
263
  .l1:
250
        dec     esi
264
        dec     esi
251
        js      .l2
265
        js      .l2
252
        movzx   ebx, byte[edx]
266
        movzx   ebx, byte[edx]
253
        or      bl, bl
267
        or      bl, bl
254
        jz      .l2
268
        jz      .l2
255
;        mov     ecx,sys_msg_board
269
;        mov     ecx,sys_msg_board
256
;        call    ecx ; sys_msg_board
270
;        call    ecx ; sys_msg_board
257
        stdcall SysMsgBoardChar
271
        stdcall SysMsgBoardChar
258
        inc     edx
272
        inc     edx
259
        jmp     .l1
273
        jmp     .l1
260
  .l2:
274
  .l2:
261
        ret
275
        ret
262
debug_endf
276
debug_endf
263
 
277
 
264
debug_func fdo_debug_outdec
278
debug_func fdo_debug_outdec
265
debug_beginf
279
debug_beginf
266
        or      cl, cl
280
        or      cl, cl
267
        jz      @f
281
        jz      @f
268
        or      eax, eax
282
        or      eax, eax
269
        jns     @f
283
        jns     @f
270
        neg     eax
284
        neg     eax
271
        push    eax
285
        push    eax
272
        mov     al, '-'
286
        mov     al, '-'
273
        call    fdo_debug_outchar
287
        call    fdo_debug_outchar
274
        pop     eax
288
        pop     eax
275
    @@:
289
    @@:
276
        push    10
-
 
277
        pop     ecx
290
        movi    ecx, 10
278
        push    -'0'
291
        push    -'0'
279
  .l1:
292
  .l1:
280
        xor     edx, edx
293
        xor     edx, edx
281
        div     ecx
294
        div     ecx
282
        push    edx
295
        push    edx
283
        test    eax, eax
296
        test    eax, eax
284
        jnz     .l1
297
        jnz     .l1
285
  .l2:
298
  .l2:
286
        pop     eax
299
        pop     eax
287
        add     al, '0'
300
        add     al, '0'
288
        jz      .l3
301
        jz      .l3
289
        call    fdo_debug_outchar
302
        call    fdo_debug_outchar
290
        jmp     .l2
303
        jmp     .l2
291
  .l3:
304
  .l3:
292
        ret
305
        ret
293
debug_endf
306
debug_endf
294
 
307
 
295
debug_func fdo_debug_outhex
308
debug_func fdo_debug_outhex
296
  __fdo_hexdigits db '0123456789ABCDEF'
309
  __fdo_hexdigits db '0123456789ABCDEF'
297
debug_beginf
310
debug_beginf
298
        mov     cl, dl
311
        mov     cl, dl
299
        neg     cl
312
        neg     cl
300
        add     cl, 8
313
        add     cl, 8
301
        shl     cl, 2
314
        shl     cl, 2
302
        rol     eax, cl
315
        rol     eax, cl
303
  .l1:
316
  .l1:
304
        rol     eax, 4
317
        rol     eax, 4
305
        push    eax
318
        push    eax
306
        and     eax, 0x0000000F
319
        and     eax, 0x0000000F
307
        mov     al, [__fdo_hexdigits+eax]
320
        mov     al, [__fdo_hexdigits+eax]
308
        call    fdo_debug_outchar
321
        call    fdo_debug_outchar
309
        pop     eax
322
        pop     eax
310
        dec     edx
323
        dec     edx
311
        jnz     .l1
324
        jnz     .l1
312
        ret
325
        ret
313
debug_endf
326
debug_endf
314
 
327
 
315
;-----------------------------------------------------------------------------
328
;-----------------------------------------------------------------------------
316
 
329
 
317
macro DEBUGF _level,_format,[_arg] {
330
macro DEBUGF _level,_format,[_arg] {
318
 common
331
 common
319
 if __DEBUG__ = 1 & _level >= __DEBUG_LEVEL__
332
 if __DEBUG__ = 1 & _level >= __DEBUG_LEVEL__
320
  local ..f1,f2,a1,a2,c1,c2,c3,..lbl
333
  local ..f1,f2,a1,a2,c1,c2,c3,..lbl
321
  _debug_str_ equ __debug_str_ # a1
334
  _debug_str_ equ __debug_str_ # a1
322
  a1 = 0
335
  a1 = 0
323
  c2 = 0
336
  c2 = 0
324
  c3 = 0
337
  c3 = 0
325
  f2 = 0
338
  f2 = 0
326
  repeat ..lbl-..f1
339
  repeat ..lbl-..f1
327
   virtual at 0
340
   virtual at 0
328
    db _format,0,0
341
    db _format,0,0
329
    load c1 word from %-1
342
    load c1 word from %-1
330
   end virtual
343
   end virtual
331
   if c1 = '%s'
344
   if c1 = '%s'
332
    virtual at 0
345
    virtual at 0
333
     db _format,0,0
346
     db _format,0,0
334
     store word 0 at %-1
347
     store word 0 at %-1
335
     load c1 from f2-c2
348
     load c1 from f2-c2
336
    end virtual
349
    end virtual
337
    if c1 <> 0
350
    if c1 <> 0
338
     DEBUGS 0,_debug_str_+f2-c2
351
     DEBUGS 0,_debug_str_+f2-c2
339
    end if
352
    end if
340
    c2 = c2 + 1
353
    c2 = c2 + 1
341
    f2 = %+1
354
    f2 = %+1
342
    DEBUGF_HELPER S,a1,0,_arg
355
    DEBUGF_HELPER S,a1,0,_arg
343
   else if c1 = '%x'
356
   else if c1 = '%x'
344
    virtual at 0
357
    virtual at 0
345
     db _format,0,0
358
     db _format,0,0
346
     store word 0 at %-1
359
     store word 0 at %-1
347
     load c1 from f2-c2
360
     load c1 from f2-c2
348
    end virtual
361
    end virtual
349
    if c1 <> 0
362
    if c1 <> 0
350
     DEBUGS 0,_debug_str_+f2-c2
363
     DEBUGS 0,_debug_str_+f2-c2
351
    end if
364
    end if
352
    c2 = c2 + 1
365
    c2 = c2 + 1
353
    f2 = %+1
366
    f2 = %+1
354
    DEBUGF_HELPER H,a1,0,_arg
367
    DEBUGF_HELPER H,a1,0,_arg
355
   else if c1 = '%d' | c1 = '%u'
368
   else if c1 = '%d' | c1 = '%u'
356
    local c4
369
    local c4
357
    if c1 = '%d'
370
    if c1 = '%d'
358
     c4 = 1
371
     c4 = 1
359
    else
372
    else
360
     c4 = 0
373
     c4 = 0
361
    end if
374
    end if
362
    virtual at 0
375
    virtual at 0
363
     db _format,0,0
376
     db _format,0,0
364
     store word 0 at %-1
377
     store word 0 at %-1
365
     load c1 from f2-c2
378
     load c1 from f2-c2
366
    end virtual
379
    end virtual
367
    if c1 <> 0
380
    if c1 <> 0
368
     DEBUGS 0,_debug_str_+f2-c2
381
     DEBUGS 0,_debug_str_+f2-c2
369
    end if
382
    end if
370
    c2 = c2 + 1
383
    c2 = c2 + 1
371
    f2 = %+1
384
    f2 = %+1
372
    DEBUGF_HELPER D,a1,c4,_arg
385
    DEBUGF_HELPER D,a1,c4,_arg
373
   else if c1 = '\n'
386
   else if c1 = '\n'
374
    c3 = c3 + 1
387
    c3 = c3 + 1
375
   end if
388
   end if
376
  end repeat
389
  end repeat
377
  virtual at 0
390
  virtual at 0
378
   db _format,0,0
391
   db _format,0,0
379
   load c1 from f2-c2
392
   load c1 from f2-c2
380
  end virtual
393
  end virtual
381
  if (c1<>0)&(f2<>..lbl-..f1-1)
394
  if (c1<>0)&(f2<>..lbl-..f1-1)
382
   DEBUGS 0,_debug_str_+f2-c2
395
   DEBUGS 0,_debug_str_+f2-c2
383
  end if
396
  end if
384
  virtual at 0
397
  virtual at 0
385
   ..f1 db _format,0
398
   ..f1 db _format,0
386
   ..lbl:
399
   ..lbl:
387
   __debug_strings equ __debug_strings,_debug_str_,<_format>,..lbl-..f1-1-c2-c3
400
   __debug_strings equ __debug_strings,_debug_str_,<_format>,..lbl-..f1-1-c2-c3
388
  end virtual
401
  end virtual
389
 end if
402
 end if
390
}
403
}
391
 
404
 
392
macro __include_debug_strings dummy,[_id,_fmt,_len] {
405
macro __include_debug_strings dummy,[_id,_fmt,_len] {
393
 common
406
 common
394
  local c1,a1,a2
407
  local c1,a1,a2
395
 forward
408
 forward
396
  if defined _len & ~_len eq
409
  if defined _len & ~_len eq
397
   _id:
410
   _id:
398
   a1 = 0
411
   a1 = 0
399
   a2 = 0
412
   a2 = 0
400
   repeat _len
413
   repeat _len
401
    virtual at 0
414
    virtual at 0
402
     db _fmt,0,0
415
     db _fmt,0,0
403
     load c1 word from %+a2-1
416
     load c1 word from %+a2-1
404
    end virtual
417
    end virtual
405
    if (c1='%s')|(c1='%x')|(c1='%d')|(c1='%u')
418
    if (c1='%s')|(c1='%x')|(c1='%d')|(c1='%u')
406
     db 0
419
     db 0
407
     a2 = a2 + 1
420
     a2 = a2 + 1
408
    else if (c1='\n')
421
    else if (c1='\n')
409
     dw $0A0D
422
     dw $0A0D
410
     a1 = a1 + 1
423
     a1 = a1 + 1
411
     a2 = a2 + 1
424
     a2 = a2 + 1
412
    else
425
    else
413
     db c1 and 0x0FF
426
     db c1 and 0x0FF
414
    end if
427
    end if
415
   end repeat
428
   end repeat
416
   db 0
429
   db 0
417
  end if
430
  end if
418
}
431
}
419
 
432
 
420
macro DEBUGF_HELPER _letter,_num,_sign,[_arg] {
433
macro DEBUGF_HELPER _letter,_num,_sign,[_arg] {
421
 common
434
 common
422
  local num
435
  local num
423
  num = 0
436
  num = 0
424
 forward
437
 forward
425
  if num = _num
438
  if num = _num
426
   DEBUG#_letter _sign,_arg
439
   DEBUG#_letter _sign,_arg
427
  end if
440
  end if
428
  num = num+1
441
  num = num+1
429
 common
442
 common
430
  _num = _num+1
443
  _num = _num+1
431
}
444
}
432
 
445
 
433
macro include_debug_strings {
446
macro include_debug_strings {
434
 if __DEBUG__ = 1
447
 if __DEBUG__ = 1
435
  match dbg_str,__debug_strings \{
448
  match dbg_str,__debug_strings \{
436
   __include_debug_strings dbg_str
449
   __include_debug_strings dbg_str
437
  \}
450
  \}
438
 end if
451
 end if
439
}
452
}