flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > useful macroinstruction |
Author |
|
dead_body 20 Mar 2007, 10:23
what about the advantages of this macro before the "libcall" macro...
|
|||
20 Mar 2007, 10:23 |
|
vid 20 Mar 2007, 11:30
dead_body: one advantage is
Quote: you will find that the string 'first window' that is used in the five invokes is only defined in the data section once I decided against doing that in libcall macro because compilation then takes quite a longer and eats lot more memory. daluca: similar macro was existing on board few years ago |
|||
20 Mar 2007, 11:30 |
|
dead_body 20 Mar 2007, 19:39
Quote:
but the source code will be more beautifull and optimized... |
|||
20 Mar 2007, 19:39 |
|
vid 20 Mar 2007, 21:39
what source code? This has nothing to do with source code... It's just whether you just declare string, or try to find same one already declared and use that
|
|||
20 Mar 2007, 21:39 |
|
dead_body 20 Mar 2007, 22:31
sorry, not source code, i mean the compiled exe).
|
|||
20 Mar 2007, 22:31 |
|
vid 20 Mar 2007, 22:45
dead_body: yes, it will, but you might need few extra megabytes of RAM to compile. Anyway, i could make some such macro. I will try to add it (sometimes), and see how big slowdown / RAM eater it is. And still i can make optional optimization module or define, which will be used only in "final" release.
|
|||
20 Mar 2007, 22:45 |
|
daluca 21 Mar 2007, 08:32
well I made some tests using the traditional way (define strings in data and pass offsets to invoke),the data_among_code way(putting the strings inside the invoke but without overload),and the overload way
for 1000 messageboxes with no repited strings the results for the traditional and data_among_code were almost the same but the data_among_code exe was a little biger than the traditional(for the inserted jumps i guess) for the overload way I couldn't get the 1000 messageboxes; for a 'out of memory error' I only get to 500 ( approximately) but I think is not really a matter of how much memory You have since I get the 500 in a computer with 1 GB of RAM and in another with only 240 MB the diference was the time it took: 1 GB =4.9 sec 240 MB = 770.1 sec (and a lot of hard disk activity) well... the diference was also the microprocesor: 1400 MHz vs 667 MHz I think these results limit the usage of the overload to small projects. if someone want to test this I have made 3 files that when compiled display text that can be saved to a file and compiled again to produce the exe: traditional way: Code: macro disp number { a=number if a=0 display '0' else sign=(number) and 0x8000000000000000 if sign<>0 display '-' a = -a end if first0=0 base= 1000000000000000000 ;9223372036854775808 repeat 19 digit=a/base if digit=0 if first0=1 display '0' end if else digit=digit+'0' display digit first0=1 end if a=a mod base base=base/10 end repeat end if } display 'format pe gui',13,10 display 'include ',0x27,'win32ax.inc',0x27,13,10 display 13,10,13,10,13,10 display 'section ',0x27,'code',0x27, ' code executable',13,10 display 'start:',13,10,13,10,13,10 repeat 1000 display ' invoke MessageBox,0,' display 'label_' disp % display 0x2C,'LABEL_' disp % display 0x2C,'MB_OK',13,10 end repeat display 13,10 display ' invoke ExitProcess,0',13,10 display 13,10,13,10,13,10 display 'section ',0x27,'data',0x27,' data readable writeable',13,10 repeat 1000 display 'label_' disp % display ' db ',0x27,'Large Message to be displayed number: ' disp % display 0x27,0x2C,'0',13,10 display 'LABEL_' disp % display ' db ',0x27,'Large title of window number: ' disp % display 0x27,0x2C,'0',13,10 end repeat display 13,10,13,10,13,10,'.end start' data_among_code way: Code: macro disp number { a=number if a=0 display '0' else sign=(number) and 0x8000000000000000 if sign<>0 display '-' a = -a end if first0=0 base= 1000000000000000000 ;9223372036854775808 repeat 19 digit=a/base if digit=0 if first0=1 display '0' end if else digit=digit+'0' display digit first0=1 end if a=a mod base base=base/10 end repeat end if } display 'format pe gui',13,10 display 'include ',0x27,'win32ax.inc',0x27,13,10 display 13,10,13,10,13,10 display 'section ',0x27,'code',0x27, ' code executable',13,10 display 'start:',13,10,13,10,13,10 repeat 1000 display ' invoke MessageBox,0,' display 0x27,'Large Message to be displayed number: ' disp % display 0x27,0x2C,0x27,'Large title of window number: ' disp % display 0x27,0x2C,'MB_OK',13,10 end repeat display 13,10,' invoke ExitProcess,0',13,10 display 13,10,13,10,13,10 display 'section ',0x27,'data',0x27,' data readable writeable',13,10 display 'db 0',13,10,13,10,13,10 display '.end start' overload way: Code: macro disp number { a=number if a=0 display '0' else sign=(number) and 0x8000000000000000 if sign<>0 display '-' a = -a end if first0=0 base= 1000000000000000000 ;9223372036854775808 repeat 19 digit=a/base if digit=0 if first0=1 display '0' end if else digit=digit+'0' display digit first0=1 end if a=a mod base base=base/10 end repeat end if } display 'format pe gui',13,10 display 'include ',0x27,'win32ax.inc',0x27,13,10 display 'include ',0x27,'overinvoke.inc',0x27,13,10 display 13,10,13,10,13,10 display 'section ',0x27,'code',0x27, ' code executable',13,10 display 'start:',13,10,13,10,13,10 repeat 500 display ' invoke MessageBox,0,' display 0x27,'Large Message to be displayed number: ' disp % display 0x27,0x2C,0x27,'Large title of window number: ' disp % display 0x27,0x2C,'MB_OK',13,10 end repeat display 13,10,' invoke ExitProcess,0',13,10 display 13,10,13,10,13,10 display 'section ',0x27,'data',0x27,' data readable writeable',13,10 display 'IN_DATA',13,10 display 13,10,13,10,13,10 display '.end start' |
|||
21 Mar 2007, 08:32 |
|
hopcode 29 Mar 2008, 17:51
Hallo daluca,
perhaps useful this for the case. http://board.flatassembler.net/topic.php?t=1890 file long_myvar3.zip check in, and let me know! Hope this helps, |
|||
29 Mar 2008, 17:51 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.