flat assembler
Message board for the users of flat assembler.

Index > Non-x86 architectures > Running fasmg on ARM v7

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
Lost_Ghost123



Joined: 12 Feb 2019
Posts: 29
Lost_Ghost123 15 Feb 2019, 19:31
So I've read through the manual a couple of times and have a few questions:

1.Is

X:

equal to

X = $

2. Can literally anything have descendants? Elements, variables, labels? Is there any OOP meaning to the dot symbol? Like,
a =66
db a
a.x=67
db a

This prints "BB" Are there just two separate variables "a" and "a.x" floating in memory, with nothing connecting them? Because if we add the folloing lines to the example above:

b=a

db b.x

It gives an error. Is there even any point to a term "descendant" in fasmg context? In both cases, why such design choises?
Post 15 Feb 2019, 19:31
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 15 Feb 2019, 20:05
Lost_Ghost123 wrote:
1.Is

X:

equal to

X = $
The effect of
Code:
X:    
is equivalent to:
Code:
X := $    


Lost_Ghost123 wrote:
2. Can literally anything have descendants? Elements, variables, labels?
Only the expression-class symbols have child namespaces associated with them. You can have macro-instruction named "a" and a label named "a", but "a.x" is always going to be in the namespace connected to the label.

Lost_Ghost123 wrote:
Is there any OOP meaning to the dot symbol?
No, there is nothing OOP-like about it. The namespaces are solely about scope. Think of it as "a" being the name of the procedure and "x" being a local label inside that procedure, accessible from the outside world through "a.x" identifier. This is in fact exactly how the PROC macro uses the NAMESPACE feature.

Lost_Ghost123 wrote:
Is there even any point to a term "descendant" in fasmg context?
When you want to use the "children" symbols directly (not through dot-based syntax) you have to switch to the namespace that contains them, and the only way to point to the namespace is through its parent symbol. This is, however, the only connection there is between the parent symbol and its "descendant" namespace.

Lost_Ghost123 wrote:
In both cases, why such design choises?
You can find the roots of this design in the thread that directly inspired fasmg development. Note that I designed fasmg's dot-based syntax to keep some compatibility with fasm 1, even though underlying mechanism are so different (fasm 1 does not have true namespaces).
Post 15 Feb 2019, 20:05
View user's profile Send private message Visit poster's website Reply with quote
Lost_Ghost123



Joined: 12 Feb 2019
Posts: 29
Lost_Ghost123 15 Feb 2019, 20:18
So in the end it's all just about optimisation. I could keep around a namespace prefix, and when a variable is used in an expression, I would search for prefix+var_name in the entire source, with the same result, right? Scope only reduces the amount of lines you have to parse.
Post 15 Feb 2019, 20:18
View user's profile Send private message Reply with quote
Lost_Ghost123



Joined: 12 Feb 2019
Posts: 29
Lost_Ghost123 15 Feb 2019, 20:23
Tomasz Grysztar wrote:

Lost_Ghost123 wrote:
Is there any OOP meaning to the dot symbol?
No, there is nothing OOP-like about it. The namespaces are solely about scope. Think of it as "a" being the name of the procedure and "x" being a local label inside that procedure, accessible from the outside world through "a.x" identifier. This is in fact exactly how the PROC macro uses the NAMESPACE feature.


So, if a, as a "function", is being assigned to b, why won't b have access to the "function"'s local variable through b.x? No matter if b=a copies a link or a value.
Post 15 Feb 2019, 20:23
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 15 Feb 2019, 20:50
Lost_Ghost123 wrote:

So, if a, as a "function", is being assigned to b, why won't b have access to the "function"'s local variable through b.x? No matter if b=a copies a link or a value.
"a" as a symbol is not a function, it is just a numerical value - when it is a label, this is an address of a procedure, for example. When you assign a value to an expression-class symbol, you just change that numerical value.

To emphasize: do not think about it in OOP terms. Namespaces are about how you access the symbols, the visibility of names, while symbols themselves have very simple values.
Post 15 Feb 2019, 20:50
View user's profile Send private message Visit poster's website Reply with quote
Lost_Ghost123



Joined: 12 Feb 2019
Posts: 29
Lost_Ghost123 15 Feb 2019, 20:53
I know that, I was just questioning your analogy (which I quoted). Thanks for your time anyways
Post 15 Feb 2019, 20:53
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 15 Feb 2019, 20:59
Lost_Ghost123 wrote:
I know that, I was just questioning your analogy (which I quoted). Thanks for your time anyways
What I meant there is that "a" is a label of a procedure, not that "a" is by itself a procedure. You are perhaps more embedded in HLL concepts like OOP and less in (quite simplistic) assembly languages and because of that my phrasing has misled you.
Post 15 Feb 2019, 20:59
View user's profile Send private message Visit poster's website Reply with quote
Lost_Ghost123



Joined: 12 Feb 2019
Posts: 29
Lost_Ghost123 27 Feb 2019, 15:23
Ok, here's an update on my progress. I am painfully close to implementing the very basic assembler, able to support db instructions. However, this little f****** bug just won't fix. I've been stuck with it for three days, and still can' t figure this shit out. Pls help11!!

Notice: all code is my first experience writing something in C, and it is all written on my phone. How? Still a mistery to me. Also, should I make a separate thread dedicated to this, or do I keep posting updates here? Anyways, here we go.

This is the file fprimitives.c, included into the main program. Here I implement all the structs and functions that are then used by the main program. For testing needs I write the void main() func, test the functions, then make int main() a comment and compile the main program. Here's how it works (or doesn't).

buflist is a double-linked list of char, pointer on it points to the first element of it. The construction is meant to be a convinient buffer for reading symbols one by one.

linelist is a double-linked list of char*, pointer on it points to the first element of it. The construction is meant to represent a line, an exprression, with parts of it connected as a list.

chunk is a double-linked list of linenode*, pointer on it points to thr first element of it. The construction is meant to represent part of a file, with each chunk in a list being a single line (macro being a chunk).

Now. What I am doing here is adding elements to a line, adding lines to a chunk, and printing out the chunk with each iteration. When adding elements to the end of the list it works, but not when adding them to the front. How do?


Description:
Download
Filename: fprimitives.c
Filesize: 9.23 KB
Downloaded: 883 Time(s)

Post 27 Feb 2019, 15:23
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20335
Location: In your JS exploiting you and your system
revolution 28 Feb 2019, 11:58
I'm thinking this might be better placed in the HLL forum. Someone who is familiar with C might be able to help you if they see a post there.
Post 28 Feb 2019, 11:58
View user's profile Send private message Visit poster's website Reply with quote
MazeGen



Joined: 06 Oct 2003
Posts: 977
Location: Czechoslovakia
MazeGen 25 Oct 2019, 18:37
Lost_Ghost123, getting x86 device (tablet) running Android isn't an option for you? These devices are slowly disappearing from the market but I'm sure you can still buy one, either new or used.

Also x86 Chromebooks gets better and better and can run Android apps.
Post 25 Oct 2019, 18:37
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.