flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
macomics 05 Apr 2025, 19:36
Code: macro level n*, [b] { match =0, b \{ include n\#\`b\#'.txt' \} } |
|||
![]() |
|
Roman 05 Apr 2025, 19:47
level 'procs\a',2 ;not do include
level 'procs\a',0 ;file not found. Code: ;must be: level 'procs\a',0 ;not include any file. level 'procs\a',2,1 ;must do include file 'procs\a2.txt' and file 'procs\a1.txt' |
|||
![]() |
|
macomics 05 Apr 2025, 21:43
Code: macro level n*, [b] { match =0, b \{ rept 0\{ \} rept 1 \{ include n\#\`b\#'.txt' \}} |
|||
![]() |
|
revolution 05 Apr 2025, 22:51
This is the assembler vs preprocessor paradigm again.
include is preprocessor, runs before the assembler. if is assembler, runs after preprocessor. |
|||
![]() |
|
Roman 06 Apr 2025, 04:43
Quote:
How understand include do first. But if condition could undo include. That's the collusion\collision. for example: Code: aa=0 if aa>0 include 'code1.txt' ;not included file end if question: include get error. Exist method clear error ? something err=0. for example: include 'a0.txt' get error file not found. clear error and fasm continues to compile code. Code: include 'a0.txt' ;get error file not found. clearError ; fasm continues to compile code and ignored prevision error. clearError very useful for macro. |
|||
![]() |
|
revolution 06 Apr 2025, 05:41
The file is included, but the if makes all the code inside not assemble.
Code: if 0 ; anything in here is not assembled, ordinary lines and included files end if |
|||
![]() |
|
Roman 06 Apr 2025, 06:12
That's is confused.
Because: Quote: include is preprocessor, runs before the assembler. |
|||
![]() |
|
revolution 06 Apr 2025, 06:32
Being assembled is a different stage from included (by the preprocessor). Files are still included, no matter the result of the condition.
The preprocessor blindly includes all the files, later the assembler evaluates the conditions and decides whether to assemble or not. |
|||
![]() |
|
revolution 06 Apr 2025, 06:36
Try this:
Code: if 0 include 'thing.inc' ;inside thing.inc: ; thing equ 1 end if if thing = 1 display "thing is set" end if Code: flat assembler version 1.73.31 (16384 kilobytes memory) thing is set 1 passes, 0 bytes. |
|||
![]() |
|
macomics 06 Apr 2025, 09:13
Code: ky1 = 0 ky2 = 0 ky3 = 0 if 0 include 'my.inc' ; my.inc: ; ch1 equ 1 ; ky1 = 1 ; display 'No message!', 13, 10 ; end if ; ch2 equ 1 ; ky2 = 1 ; display 'Ha ha!!!', 13, 10 ; if 0 ; ch3 equ 1 ; ky3 = 1 ; display 'No message, too!', 13, 10 end if if ch1 = 1 display 'CH1', 13, 10 end if if ch2 = 1 display 'CH2', 13, 10 end if if ch3 = 1 display 'CH3', 13, 10 end if if ky1 = 1 display 'KY1', 13, 10 end if if ky2 = 1 display 'KY2', 13, 10 end if if ky3 = 1 display 'KY3', 13, 10 end if ; $ fasm ch.inc ; flat assembler version 1.73.32 (16384 kilobytes memory, x64) ; Ha ha!!! ; CH1 ; CH2 ; CH3 ; KY2 ; 1 passes, 0 bytes. |
|||
![]() |
|
revolution 07 Apr 2025, 02:23
Not just for if, but all assembler constructs mean nothing to the preprocessor.
Code: if 0 repeat 0 while 0 display 'cannot see me',10 foo equ 1 end while end repeat end if if foo display 'foo was processed',10 end if Code: flat assembler version 1.73.31 (16384 kilobytes memory) foo was processed 1 passes, 0 bytes. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.