flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > if 0 include opens file and modifies current label [fixed] |
Author |
|
shutdownall 17 Aug 2013, 13:36
It is not a bug.
You have to distinct between conditional assembly and conditional preprocessing. if directive is conditional assembly and will interpreted during assembler phase only. include is preprocessing directive and is done before if directive is interpreted. You have to use match directive for conditional preprocessing. Code: SOME_VAR EQU YES match =YES,SOME_VAR { ... } match =SOME_VAR,SOME_VAR { ... } See documentation for more details. The last one is useful to handle cases where SOME_VAR is not set at all. |
|||
17 Aug 2013, 13:36 |
|
cod3b453 17 Aug 2013, 15:13
bah! , thank you shutdownall
Half of my problem was using x = 0 instead of x equ 0...time to rewrite some macros |
|||
17 Aug 2013, 15:13 |
|
baldr 17 Aug 2013, 20:31
shutdownall wrote: It is not a bug. Code: if 0 \1: end if .1: rb 16; make some noise \.1 = .1; make it accessible inside '\1' scope \1 dw \.1, \1.1 .1: Code: rept 0 { \1: } .1: rb 16; make some noise \.1 = .1; make it accessible inside '\1' scope \1 dw \.1, \1.1 .1: ----8<---- Tomasz Grysztar, Would you please entab/detab sources consistently? 1.71.00 (spaced) => 1.71.01 (tabbed) => 1.71.06 (spaced) => 1.71.07 (tabbed); this is based on ASSEMBLE.INC, other files reveal different patterns. |
|||
17 Aug 2013, 20:31 |
|
shutdownall 19 Aug 2013, 00:56
baldr wrote:
I know how FASM works as I did build up a lot of things to change the compiling process and results when integrating my BASIC commands and structure. There are done following 4 steps (in this order): <PREPROCESS> <PARSE> <ASSEMBLE> <FORMAT> During PREPROCESS labels are not touched or examined at all. So what is too early in your eyes ? Labels are determined in ASSEMBLE process only in several passes if necessary. They can not determined during PREPROCESS and not during PARSE because the resulting code (and its size) can be determined during ASSEMBLE only. baldr wrote: As a side note, presence of SOME_VAR equ SOME_VAR is indistinguishable from its absense. Yes but as there is no default match this is a workaround to determine a forgotten SOME_VAR directive. Even SOME_VAR EQU BAD doesn't find a match representation. If you know the size of inserted code for example you can work with labels and check the code size. Look at following code piece which checks if a variable is inserted at all (CDFLAG) to have a default handling. Could be done with a "label calculation" and assert as well: Code: match =FAST_MODE,STARTMODE { CDFLAG db FAST_MODE } match =SLOW_MODE,STARTMODE { CDFLAG db SLOW_MODE } match =STARTMODE,STARTMODE { CDFLAG db SLOW_MODE } assert CDFLAG > -1 |
|||
19 Aug 2013, 00:56 |
|
shutdownall 19 Aug 2013, 01:03
cod3b453 wrote: As shown above, other constructs appear to have no effect in test2.asm; only the jmp is assembled if another_label is removed. Well look at your sample in the first posting. The reason why the jump fails is simple. You make a jump to a local label 'sublabel'. This is valid in the own context 'a_label'. If you include your code, a new main label 'another_label' is defined and so 'sublabel' becomes a sub label of 'another_label'. That's the trick. But you can still jump to this label from the other code with jmp another_label.sublabel for example. But it is not a good coding style to include another file in this main label routine. At the end of 'a_label' would be a nicer place, don't you think so ? |
|||
19 Aug 2013, 01:03 |
|
shutdownall 19 Aug 2013, 01:07
baldr wrote: Consider the following: Well - in my eyes this is simply brainfucking. Have fun with this coding style. |
|||
19 Aug 2013, 01:07 |
|
cod3b453 19 Aug 2013, 16:46
shutdownall wrote:
|
|||
19 Aug 2013, 16:46 |
|
shutdownall 19 Aug 2013, 17:12
Was just a clarification.
|
|||
19 Aug 2013, 17:12 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.