Rev 111 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 111 | Rev 131 | ||
---|---|---|---|
Line -... | Line 1... | ||
- | 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 | ||
1 | ; new application structure |
13 | ; new application structure |
2 | macro meos_app_start |
14 | macro meos_app_start |
3 | { |
15 | { |
4 | use32 |
16 | use32 |
5 | org 0x0 |
17 | org 0x0 |
Line 75... | Line 87... | ||
75 | 87 | ||
76 | ; strings |
88 | ; strings |
77 | macro sz name,[data] { ; from MFAR [mike.dld] |
89 | macro sz name,[data] { ; from MFAR [mike.dld] |
78 | common |
90 | common |
- | 91 | if used name |
|
79 | if used name |
92 | name db data |
80 | label name |
93 | .size = $-name |
- | 94 | end if |
|
- | 95 | } |
|
- | 96 | ||
81 | end if |
97 | macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
82 | forward |
98 | common |
- | 99 | if used name |
|
- | 100 | label name |
|
- | 101 | forward |
|
83 | if used name |
102 | if lang eq lng |
84 | db data |
103 | db data |
85 | end if |
104 | end if |
86 | common |
- | |
87 | if used name |
105 | common |
88 | .size = $-name |
106 | .size = $-name |
89 | end if |
107 | end if |
Line 90... | Line 108... | ||
90 | } |
108 | } |
91 | 109 | ||
- | 110 | macro szc name,elsz,[data] { ; from MFAR [mike.dld] |
|
- | 111 | common |
|
92 | macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
112 | local s,m |
93 | common |
113 | m = 0 |
- | 114 | if used name |
|
- | 115 | label name |
|
- | 116 | virtual at 0 |
|
- | 117 | db data |
|
- | 118 | s = $ |
|
- | 119 | end virtual |
|
- | 120 | d#elsz s |
|
94 | if used name |
121 | if m < s |
95 | label name |
- | |
96 | end if |
- | |
97 | forward |
122 | m = s |
- | 123 | end if |
|
- | 124 | db data |
|
98 | if (used name)&(lang eq lng) |
125 | .size = $-name |
- | 126 | .maxl = m |
|
- | 127 | end if |
|
- | 128 | } |
|
99 | db data |
129 | |
- | 130 | macro lszc name,elsz,[lng,data] { ; from MFAR [mike.dld] |
|
- | 131 | common |
|
- | 132 | local s,m,c |
|
100 | end if |
133 | m = 0 |
- | 134 | c = 0 |
|
- | 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 |
|
- | 145 | m = s |
|
- | 146 | end if |
|
- | 147 | db data |
|
- | 148 | c = c+1 |
|
101 | common |
149 | end if |
- | 150 | common |
|
- | 151 | .size = $-name |
|
102 | if used name |
152 | .maxl = m |
103 | .size = $-name |
153 | .count = c |
Line 104... | Line -... | ||
104 | end if |
- | |
105 | } |
154 | end if |
106 | 155 | } |
|
107 | 156 | ||
108 | 157 | ||
109 | ; easy system call macro |
158 | ; easy system call macro |
Line 121... | Line 170... | ||
121 | add dest, lsrc |
170 | add dest, lsrc |
122 | end if |
171 | end if |
123 | end if |
172 | end if |
124 | } |
173 | } |
Line 125... | Line 174... | ||
125 | 174 | ||
126 | macro __mov reg,a { ; mike.dld |
175 | ;macro __mov reg,a { ; mike.dld |
- | 176 | ; if ~a eq |
|
- | 177 | ; mov reg,a |
|
- | 178 | ; end if |
|
- | 179 | ;} |
|
- | 180 | ||
- | 181 | macro __mov reg,a,b { ; mike.dld |
|
- | 182 | if (~a eq)&(~b eq) |
|
- | 183 | mpack reg,a,b |
|
127 | if ~a eq |
184 | else if (~a eq)&(b eq) |
128 | mov reg,a |
185 | mov reg,a |
129 | end if |
186 | end if |
Line 130... | Line 187... | ||
130 | } |
187 | } |
Line 138... | Line 195... | ||
138 | __mov edi,f |
195 | __mov edi,f |
139 | int 0x40 |
196 | int 0x40 |
140 | } |
197 | } |
Line -... | Line 198... | ||
- | 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 |
|
141 | 227 | } |
|
- | 228 | macro endf { end if } |
|
- | 229 | ||
- | 230 | macro diff16 title,l1,l2 |
|
- | 231 | { |
|
142 | 232 | local s,d |
|
- | 233 | s = l2-l1 |
|
- | 234 | display title,': 0x' |
|
- | 235 | repeat 8 |
|
143 | 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 |
|
144 | ; language for programs |
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 |
|
145 | lang fix ru ; ru en fr ge fi |
262 | end repeat |
Line 146... | Line 263... | ||
146 | 263 | display 13,10 |
|
147 | 264 | } |
|
Line 148... | Line 265... | ||
148 | 265 | ||
Line 195... | Line 312... | ||
195 | mov arg1,arg2 |
312 | mov arg1,arg2 |
196 | end if |
313 | end if |
197 | } |
314 | } |
Line -... | Line 315... | ||
- | 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 | ||
198 | 331 | ; Macroinstructions for defining data structures |
|
- | 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 \\} \} } |
|
199 | 454 | ||
- | 455 | enable@substruct |
|
- | 456 | ||
200 | macro struct name |
457 | macro define@union parent,name,[field,type,def] |
201 | { |
458 | { common |
- | 459 | virtual at 0 |
|
- | 460 | forward |
|
- | 461 | if ~ field eq . |
|
202 | virtual at 0 |
462 | virtual at 0 |
203 | name name |
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 \\\} \\} |
|
204 | sizeof.#name = $ - name |
484 | last@union equ field |
- | 485 | common rb sizeof.#name - ($ - .\#name) \} } |
|
- | 486 | ||
- | 487 | macro define@substruct parent,name,[field,type,def] |
|
- | 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 |
|
- | 497 | local value |
|
- | 498 | common |
|
- | 499 | sizeof.#name = $ |
|
- | 500 | end virtual |
|
- | 501 | struc name value \{ |
|
- | 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 205... | Line 508... | ||
205 | end virtual |
508 | end if \\} |
206 | } |
- | |
207 | - | ||
208 | ; structures used in MeOS |
- | |
209 | struc process_information |
- | |
210 | { |
- | |
211 | .cpu_usage dd ? ; +0 |
- | |
212 | .window_stack_position dw ? ; +4 |
- | |
213 | .window_stack_value dw ? ; +6 |
- | |
214 | .not_used1 dw ? ; +8 |
- | |
215 | .process_name rb 12 ; +10 |
- | |
216 | .memory_start dd ? ; +22 |
- | |
217 | .used_memory dd ? ; +26 |
- | |
218 | .PID dd ? ; +30 |
- | |
219 | .x_start dd ? ; +34 |
- | |
220 | .y_start dd ? ; +38 |
- | |
221 | .x_size dd ? ; +42 |
- | |
222 | .y_size dd ? ; +46 |
- | |
223 | .slot_state dw ? ; +50 |
509 | common \} } |
- | 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 224... | Line -... | ||
224 | rb (1024-52) |
- | |
225 | } |
- | |
226 | struct process_information |
- | |
227 | - | ||
228 | struc system_colors |
- | |
229 | { |
- | |
230 | .frame dd ? |
- | |
231 | .grab dd ? |
- | |
232 | .grab_button dd ? |
- | |
233 | .grab_button_text dd ? |
- | |
234 | .grab_text dd ? |
- | |
235 | .work dd ? |
- | |
236 | .work_button dd ? |
- | |
237 | .work_button_text dd ? |
525 | slot_state dw ? ; +50 |
- | 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 238... | Line 537... | ||
238 | .work_text dd ? |
537 | work_button_text dd ? |
Line 239... | Line 538... | ||
239 | .work_graph dd ? |
538 | work_text dd ? |