flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
baldr
flat_user,
Overload directives with struc-macro: Code: irps s, b w d f p q t { struc r#s num* \{ . r#s 1 .size = $-. r#s num-1 .length = num \} } mov eax,var.size ;=4 mov eax,var2.length ;=40 mov eax,var2.size * var2.length ;=80 var rd 1 var2 rw 40 Similar technique could be used for db-like directives. |
|||
![]() |
|
revolution
Code: struc rd val { . rd val sizeof.#. = 4 lengthof.#. = val } struc rw val { . rw val sizeof.#. = 2 lengthof.#. = val } mov eax,sizeof.var ;=4 mov eax,lengthof.var2 ;=40 mov eax,sizeof.var2 * lengthof.var2 ;=80 var rd 1 var2 rw 40 |
|||
![]() |
|
flat_user
Thanks,
but I would need to include those macros in every project... I also could insert them into FASM's package's includes so they would be easier to use, but then such source code would need to be given out with those include-mods as well means it'd be more extensive to compile... Nevertheless, I'd say such operators are very useful, so I've got the question if there will be native support? Thank you! |
|||
![]() |
|
revolution
flat_user wrote: I've got the question if there will be native support? Code: BUFFER_LENGTH = 40 ;... buff rd BUFER_LENGTH ;... mov ecx,BUFFER_LENGTH |
|||
![]() |
|
flat_user
Code: _64BIT equ 1 call ReadProcessMemory,[proc],[addr],var,size var,0 if _64BIT eq 1 var rq 1 else var rd 1 endif I guess this would be the most straightforwarded and most dynamical way without using any extra symbols or additional macros which you would need to distribute... (if there was native support) |
|||
![]() |
|
baldr
flat_user,
What if var is a structure? FASM knows nothing about structures. No need for feature that can be implemented almost hassle-free using current tools (macros from MACRO\STRUCT.INC for structures, as an example). |
|||
![]() |
|
LocoDelAssembly
baldr,
Your code fails when the size is zero. I've fixed it: Code: irps s, b w d f p q t { local elemSize virtual at 0 r#s 1 elemSize = $ end virtual struc r#s num* \{ . r#s num .size = elemSize .length = num \} } [edit]Removed the double dots. See the reason below.[/edit] Last edited by LocoDelAssembly on 16 Jun 2010, 19:33; edited 1 time in total |
|||
![]() |
|
baldr
LocoDelAssembly,
I knew about this. My first variant was similar to yours, only virtual block was inside struc-macro (just in case rx being overloaded again ![]() Numeric constant definition doesn't set new label prefix, you don't need ..elemSize. |
|||
![]() |
|
LocoDelAssembly
Quote:
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.