Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
576 serge 1
;*****************************************************************************
2
;*
3
;*                            Open Watcom Project
4
;*
5
;*    Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
6
;*
7
;*  ========================================================================
8
;*
9
;*    This file contains Original Code and/or Modifications of Original
10
;*    Code as defined in and that are subject to the Sybase Open Watcom
11
;*    Public License version 1.0 (the 'License'). You may not use this file
12
;*    except in compliance with the License. BY USING THIS FILE YOU AGREE TO
13
;*    ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
14
;*    provided with the Original Code and Modifications, and is also
15
;*    available at www.sybase.com/developer/opensource.
16
;*
17
;*    The Original Code and all software distributed under the License are
18
;*    distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
19
;*    EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
20
;*    ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
21
;*    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
22
;*    NON-INFRINGEMENT. Please see the License for the specific language
23
;*    governing rights and limitations under the License.
24
;*
25
;*  ========================================================================
26
;*
27
;* Description:  Structured macros for MASM/WASM.
28
;*
29
;*****************************************************************************
30
 
31
 
32
        __label = 0
33
        __depth = 0
34
        __inner_loop = 0
35
 
36
_guess  macro   name
37
        __depth = __depth + 1
38
        __label = __label + 1
39
        _set    __astk,%__depth,__label,<>
40
        __label = __label + 1
41
        _set    __estk,%__depth,__label,<>
42
        ifnb    
43
          name = __label
44
        endif
45
        endm
46
 
47
_quif   macro   cc,name
48
        ifnb    
49
          _set  __elbl,,name,<>
50
          _j    cc,_l,%__elbl
51
        else
52
          _set  __albl,,__astk,%__depth
53
          _j    cc,_l,%__albl
54
        endif
55
        endm
56
 
57
_quit   macro   name
58
        _quif   ,name
59
        endm
60
 
61
_admit  macro
62
        _set    __albl,,__astk,%__depth
63
        __label = __label + 1
64
        _set    __astk,%__depth,__label,<>
65
        _set    __elbl,,__estk,%__depth
66
        _j      ,_l,%__elbl
67
        _label  _l,%__albl
68
        endm
69
 
70
_endguess macro
71
        _set    __albl,,__astk,%__depth
72
        _label  _l,%__albl
73
        _set    __elbl,,__estk,%__depth
74
        _label  _l,%__elbl
75
        __depth = __depth - 1
76
        endm
77
 
78
_loop   macro   name
79
        _guess  name
80
        _set    __albl,,__astk,%__depth
81
        _label  _m,%__albl
82
        _set    __elbl,,__estk,%__depth
83
        _label  _m,%__elbl
84
        _set    __llbl,%__depth,%__inner_loop,<>
85
        _set    __inner_loop,,%__depth,<>
86
        endm
87
 
88
_loopif macro   cc,name
89
        ifnb    
90
          _set  __elbl,,name,<>
91
          _j    cc,_m,%__elbl
92
        else
93
          _set  __albl,,__astk,%__inner_loop
94
          _j    cc,_m,%__albl
95
        endif
96
        endm
97
 
98
_until  macro   cc
99
        _set    __albl,,__astk,%__depth
100
        _jn     cc,_m,%__albl
101
        _set    __inner_loop,,__llbl,%__depth
102
        _endguess
103
        endm
104
 
105
_endloop macro
106
        _set    __albl,,__astk,%__depth
107
        _j      ,_m,%__albl
108
        _set    __inner_loop,,__llbl,%__depth
109
        _endguess
110
        endm
111
 
112
_if     macro   cc
113
        _guess
114
        _set    __albl,,__astk,%__depth
115
        _jn     cc,_l,%__albl
116
        endm
117
 
118
_else   macro
119
        _admit
120
        endm
121
 
122
_endif  macro
123
        _endguess
124
        endm
125
 
126
_set    macro   base1,ext1,base2,ext2
127
        base1&ext1 = base2&ext2
128
        endm
129
 
130
_label  macro   base,ext
131
base&ext:
132
        endm
133
 
134
_j      macro   cc,base,ext
135
        j&cc        base&ext
136
        endm
137
 
138
_jn     macro   cc,base,ext
139
        jn&cc       base&ext
140
        endm
141
 
142
jnna    macro   label
143
        ja      label
144
        endm
145
 
146
jnnae   macro   label
147
        jae     label
148
        endm
149
 
150
jnnb    macro   label
151
        jb      label
152
        endm
153
 
154
jnnbe   macro   label
155
        jbe     label
156
        endm
157
 
158
jnnc    macro   label
159
        jc      label
160
        endm
161
 
162
jnne    macro   label
163
        je      label
164
        endm
165
 
166
jnng    macro   label
167
        jg      label
168
        endm
169
 
170
jnnge   macro   label
171
        jge     label
172
        endm
173
 
174
jnnl    macro   label
175
        jl      label
176
        endm
177
 
178
jnnle   macro   label
179
        jle     label
180
        endm
181
 
182
jnno    macro   label
183
        jo      label
184
        endm
185
 
186
jnnp    macro   label
187
        jp      label
188
        endm
189
 
190
jnns    macro   label
191
        js      label
192
        endm
193
 
194
jnnz    macro   label
195
        jz      label
196
        endm
197
 
198
jnpe    macro   label
199
        jpo     label
200
        endm
201
 
202
jnpo    macro   label
203
        jpe     label
204
        endm
205
 
206
j       macro   label
207
        jmp     label
208
        endm
209
 
210
jn      macro   label
211
        nop
212
        endm
213
 
214
_shl    macro   reg,count
215
        add     reg,reg
216
        endm
217
 
218
_rcl    macro   reg,count
219
        adc     reg,reg
220
        endm