flat assembler
Message board for the users of flat assembler.

 Index > Main > I read docs about definite, but not understood all functions
Author
Roman

Joined: 21 Apr 2012
Posts: 1701
Roman 30 Nov 2022, 08:47
In docs I found minimum info about definite. And no examples how using definite.
I feel something unusual in definite.
30 Nov 2022, 08:47
Tomasz Grysztar

Joined: 16 Jun 2003
Posts: 8344
Location: Kraków, Poland
Tomasz Grysztar 30 Nov 2022, 09:44
See the thread where this feature was announced: https://board.flatassembler.net/topic.php?t=21058

In short: DEFINITE is very similar to DEFINED, except it does not forward-reference, so you can check whether a symbol has been defined earlier in the source (while DEFINED would consider if the symbol ends up defined anywhere, even further down the text).
Code:
```A = 1

assert defined A
assert defined B
assert ~ defined C

assert definite A
assert ~ definite B
assert ~ definite C

B = 2    ```

A thing of note for both DEFINED and DEFINITE is that both operate on numeric (as opposed to symbolic) constants/variables. The variables created with EQU or DEFINE are replaced with their corresponding text before the expression containing DEFINED/DEFINITE is interpreted. So if you use DEFINED/DEFINITE with a symbol name that is assigned a value with EQU or DEFINE, you end up checking what is inside the symbolic value.
Code:
```A = 1

S equ A

assert defined S

S equ C

assert ~ defined S    ```
All these examples work the same with fasmg as with fasm 1.
30 Nov 2022, 09:44
Roman

Joined: 21 Apr 2012
Posts: 1701
Roman 30 Nov 2022, 12:02
I found this.
Code:
```if ~ definite Module
Module = 1 ; define only if it has not already been defined earlier
end if       ```

How I understood definite using for someName = some value.
And not using for EQU
30 Nov 2022, 12:02
Tomasz Grysztar

Joined: 16 Jun 2003
Posts: 8344
Location: Kraków, Poland
Tomasz Grysztar 30 Nov 2022, 13:09
Roman wrote:
How I understood definite using for someName = some value.
It also works for labels, because in fasm labels are just a kind of numeric constant ("foo:" means the same as "foo := \$" in fasmg syntax).
30 Nov 2022, 13:09
Roman

Joined: 21 Apr 2012
Posts: 1701
Roman 02 Dec 2022, 07:14
Interesting idea. Get number from lLoop8
Code:
```lLoop8:
inc eax
if  definite lLoop8
Somehow get from lLoop8 number 8 to Reg ecx
cmp eax,ecx
Jb lLoop8
end if
```
02 Dec 2022, 07:14
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainTutorials and ExamplesDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsOS ConstructionIDE DevelopmentProjects and IdeasNon-x86 architecturesHigh Level LanguagesProgramming Language DesignCompiler Internals Other----------------FeedbackHeapTest Area

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum