flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
bitshifter 12 May 2010, 23:31
Like this?
(From FASM manual, chapter 2.3.4) Code: struc db [data] { common . db data .size = $ - . } |
|||
![]() |
|
mindcooler 12 May 2010, 23:36
So the way to go is to put the data in a struc? I guess so..
|
|||
![]() |
|
mindcooler 12 May 2010, 23:57
A
Code: struc string [data] { common . db data .size = $ - . } and some Code: p_error string 'Parse error at ' p_success string $0d,$0a,'Parse successful!' works nicely! Thanks! _________________ This is a block of text that can be added to posts you make. |
|||
![]() |
|
bitshifter 13 May 2010, 00:05
Dont forget the NULL terminator (if required)
You could even modify the macro to insert it automatically... |
|||
![]() |
|
mindcooler 13 May 2010, 00:21
I print those strings with WriteConsole, so instead of an end of string marker, I need the char count.
|
|||
![]() |
|
Tyler 13 May 2010, 03:37
You should use Pascal style strings http://en.wikipedia.org/wiki/String_%28computer_science%29#Representations. Just pass pointer to string +1 instead, so as to skip the char count byte.
|
|||
![]() |
|
mindcooler 13 May 2010, 11:37
Yes, wherever you need dynamic length information, saving the length of the string is a good idea. Reserve a 0 at the end of the string, and you can use it anywhere.
_________________ This is a block of text that can be added to posts you make. |
|||
![]() |
|
mindcooler 13 May 2010, 17:06
I use .size thisly:
Code: macro output ptr { common mov esi,ptr mov eax,ptr#.size call printstr } Code: output c_lvalue _________________ This is a block of text that can be added to posts you make. |
|||
![]() |
|
Tyler 14 May 2010, 09:47
Is there a way to add the name of the most recent global then the most recent local(Is the "." recursive)?
Code: global: .local: ; I know how this works .local.sublocal: ; Is there a way to eliminate the need for the .local at the begginning? I use labels like this to organize my code in to globals, sections, and subsections based on where the (sub)section is called from. It gets irritating after the typing .local.sublocal for every subdivision past that level. |
|||
![]() |
|
Tomasz Grysztar 14 May 2010, 10:11
|
|||
![]() |
|
Tyler 15 May 2010, 01:41
And I thought I was special for my little conditional mov macro, I can't even tell what you're doing in that one
![]() |
|||
![]() |
|
Tyler 16 May 2010, 15:48
Tomasz, I don't mean to be annoying, I'm sure people are suggesting "improvements" for Fasm all the time. But if you decide to implement the function of your func/endf macro achieves as built-in, I think using multiple "."s would be the most intuitive way to indicate nesting level.
Example: Code: global: .local: ..sublocal: .local2: Would result in: Code: global: global.local: global.local.sublocal: global.local2: Would this interfere with any existing functionality? |
|||
![]() |
|
vid 16 May 2010, 20:47
Quote: Would this interfere with any existing functionality? Yep. Check the manual about meaning of double-dot prefix |
|||
![]() |
|
Tyler 16 May 2010, 22:21
Does the "@" in front of a label mean anything? I'm not going to suggest replacing ".." with "@", but if it won't interfere, I'm thinking about making a patch doing just that, and replacing the current functionality of multiple dots with what I mentioned above.
|
|||
![]() |
|
vid 16 May 2010, 22:30
People may have used labels starting with "@" in their code - I have already seen this couple times in real-world code.
|
|||
![]() |
|
Tyler 16 May 2010, 22:47
I wrote:
It'll be a personal patch, although (if I do it) I will release it, it'll be optional to use it. If someone uses labels like that, they won't have to use my patch. |
|||
![]() |
|
vid 17 May 2010, 07:26
In such case... go on!
![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.