flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > .:: Conditional macros v.1.01 ::. |
Author |
|
vadana 23 Dec 2003, 10:58
Hello all.
New version of Conditional macros Use these macros for relief of the programming. Send Your advices.
|
|||||||||||
23 Dec 2003, 10:58 |
|
aaro 10 Jan 2004, 15:10
In STRING macro it will define new version of string_data macro and insert old version of string_data at the beginning of it.
Code: macro string_data {} macro STRING name,str { macro string_data ; defines string_data macro m_ string_data ; inserts old version here name db str,0 _m } m_ fix { _m fix } STRING foo, 'foo' ;after that string_data is: ;foo db 'foo',0 STRING bar, 'bar' ;after that string_data is: ;foo db 'foo',0 ;bar db 'bar',0 |
|||
10 Jan 2004, 15:10 |
|
Kevin_Zheng 10 Jan 2004, 16:41
Dear aaro:
Thanks your reply. But I found that the complier maybe present a serious bug about the nested macro define. Please see the belowing demo code: Code: macro string_data {} macro STRING name,str { macro string_data ; defines string_data macro m_ string_data ; inserts old version here name db str,0 _m } m_ fix { _m fix } org 100h ; code starts at offset 100h use16 ; use 16-bit code STRING foo,'foo' STRING bar,'bar' display_text = 9 mov ah,display_text mov dx,hello int 21h int 20h hello db 'Hello world!',24h The complier result is wonderful. It shows on the belowing: (The file size is 22 bytes) Code: 0B56:0100 B4 09 BA 09 01 CD 21 CD-20 48 65 6C 6C 6F 20 77 ......!. Hello w 0B56:0110 6F 72 6C 64 21 24 99 C3-2E C7 06 55 91 00 00 2E orld!$.....U.... The complier result file don't define the foo and boo variable . Why?
|
|||||||||||
10 Jan 2004, 16:41 |
|
Tomasz Grysztar 10 Jan 2004, 17:12
You have to use that "string_data" macro somewhere. Currently you only define the macros.
|
|||
10 Jan 2004, 17:12 |
|
Kevin_Zheng 10 Jan 2004, 17:51
Hi,Privalov:
Thanks you helpping. I have added the "string_data" macro on the code. But I have found two results: 1. The "string_data" macro on the front of "STRING", the complier result file doesn't present the foo and bar variable. Code: string_data STRING foo,'foo' STRING bar,'bar' 2. The "string_data" macro after of "STRING", the result file is OK. Code: STRING foo,'foo' STRING bar,'bar' string_data I have maze the behaviour the nested macro define. Can you explain more information about it? Thank you. |
|||
10 Jan 2004, 17:51 |
|
Kevin_Zheng 16 Jan 2004, 12:19
Hi,Vadana:
The .for macro present a bug and I have fixed it . Please see the belowing code: Code: macro .for var,cond,val1,oper,val2,_step,stepval { local ..continue,..break,..endfor,..beginfor __BEGINFOR equ ..beginfor __CONTINUE equ ..continue __BREAK equ ..break __ENDFOR equ ..endfor __VARIABLE equ var __OPERATOR equ oper __STEPVAL equ stepval mov var,val1 __CONTINUE: __BEGINFOR: cmp var,val2 if oper eq to jge __ENDFOR else jle __ENDFOR end if } It should be the belowing code: Code: macro .for var,val1,oper,val2,_step,stepval { local ..continue,..break,..endfor,..beginfor __BEGINFOR equ ..beginfor __CONTINUE equ ..continue __BREAK equ ..break __ENDFOR equ ..endfor __VARIABLE equ var __OPERATOR equ oper __STEPVAL equ stepval mov var,val1 __CONTINUE: __BEGINFOR: cmp var,val2 if oper eq add jge __ENDFOR else jle __ENDFOR end if } Thank your macro file.
|
|||||||||||||||||||||
16 Jan 2004, 12:19 |
|
vadana 24 Jan 2004, 10:26
Hello all.
You dont need call macros init_string or init_data. You must init .data section, and strings or other init automaticly, becouse I create new macros .data: macro .data { section '.data' data readable writeable string_data dword_data word_data char_data struct_data array_data } The .data section must be placed after .code section For macros work: .for eax equal 15 to 30 step 2 ... .endfor Good luck!!! .:: VDN ::. |
|||
24 Jan 2004, 10:26 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.