flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
bitshifter
Like this?
(From FASM manual, chapter 2.3.4) Code: struc db [data] { common . db data .size = $ - . } |
|||
![]() |
|
mindcooler
So the way to go is to put the data in a struc? I guess so..
|
|||
![]() |
|
mindcooler
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
Dont forget the NULL terminator (if required)
You could even modify the macro to insert it automatically... |
|||
![]() |
|
mindcooler
I print those strings with WriteConsole, so instead of an end of string marker, I need the char count.
|
|||
![]() |
|
Tyler
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
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
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
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
|
|||
![]() |
|
Tyler
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
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
Quote: Would this interfere with any existing functionality? Yep. Check the manual about meaning of double-dot prefix |
|||
![]() |
|
Tyler
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
People may have used labels starting with "@" in their code - I have already seen this couple times in real-world code.
|
|||
![]() |
|
Tyler
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
In such case... go on!
![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.