flat assembler
Message board for the users of flat assembler.
Index
> Main > Any way to refer to the most recent global label? |
Author |
|
bitshifter 12 May 2010, 23:31
Like this?
(From FASM manual, chapter 2.3.4) Code: struc db [data] { common . db data .size = $ - . } |
|||
12 May 2010, 23:31 |
|
mindcooler 12 May 2010, 23:36
So the way to go is to put the data in a struc? I guess so..
|
|||
12 May 2010, 23:36 |
|
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. |
|||
12 May 2010, 23:57 |
|
bitshifter 13 May 2010, 00:05
Dont forget the NULL terminator (if required)
You could even modify the macro to insert it automatically... |
|||
13 May 2010, 00:05 |
|
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.
|
|||
13 May 2010, 00:21 |
|
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.
|
|||
13 May 2010, 03:37 |
|
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. |
|||
13 May 2010, 11:37 |
|
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. |
|||
13 May 2010, 17:06 |
|
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. |
|||
14 May 2010, 09:47 |
|
Tomasz Grysztar 14 May 2010, 10:11
|
|||
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 . Thanks, that'll work.
|
|||
15 May 2010, 01:41 |
|
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? |
|||
16 May 2010, 15:48 |
|
vid 16 May 2010, 20:47
Quote: Would this interfere with any existing functionality? Yep. Check the manual about meaning of double-dot prefix |
|||
16 May 2010, 20:47 |
|
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.
|
|||
16 May 2010, 22:21 |
|
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.
|
|||
16 May 2010, 22:30 |
|
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. |
|||
16 May 2010, 22:47 |
|
vid 17 May 2010, 07:26
In such case... go on!
|
|||
17 May 2010, 07:26 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.