flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Get values from rept 0

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1850
Roman 15 Mar 2023, 12:31
Fasmw 1.73
Idea get values from rept. Its possible do ?
Code:
.lb1:
rept 0 {
Print a
Write b, 2
include 'data.inc'
} 
;how get this or load ? 
Macro Get a, line {} 

Get a1, 1 ;do a1 equ Print a
Get a2, 2 ;do a2 equ Write b,2

    


Last edited by Roman on 15 Mar 2023, 13:06; edited 2 times in total
Post 15 Mar 2023, 12:31
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20454
Location: In your JS exploiting you and your system
revolution 15 Mar 2023, 12:53
Make a separate macro for each line.
Code:
macro Get_1 v { v equ Print a }
macro Get_2 v { v equ Write b, 2 }
Get_1 a1
Get_2 a2    
Post 15 Mar 2023, 12:53
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1850
Roman 15 Mar 2023, 12:56
This is cheating macros. Not for my case.
Code:
;this macros no needed any rept data.
macro Get_1 v { v equ Print a }
macro Get_2 v { v equ Write b, 2 }
Get_1 a1
Get_2 a2     
Post 15 Mar 2023, 12:56
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20454
Location: In your JS exploiting you and your system
revolution 15 Mar 2023, 13:05
Then use match
Code:
macro Get v, line {
  match =1, line \{ v equ Print a \}
  match =2, line \{ v equ Write b, 2 \}
}    
Post 15 Mar 2023, 13:05
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1850
Roman 15 Mar 2023, 13:10
Nice. If I put in rept other text.
I must write new macro.
Code:
.lb1:
rept 0 {
Set a,4
Read buffer1, 20
}

.lb2:
rept 0 { ;like obj 3d model data
vrtx 5.5,4,6
vrtx 1.5,2,5.2
faces 0,1,0,1
}

     


Its bad idea.
Post 15 Mar 2023, 13:10
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20454
Location: In your JS exploiting you and your system
revolution 15 Mar 2023, 13:52
Roman wrote:
Its bad idea.
Yes. Razz
Post 15 Mar 2023, 13:52
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1850
Roman 15 Mar 2023, 14:06
Nice if fasm have mechanism store text.
Like text Container.
Code:
Container A {
;ignored for compiler, but store text. And mechanism get this text in the macro.
Any text.
Or include text from file.
 }

Container B { }
Container C { }
    
Post 15 Mar 2023, 14:06
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 15 Mar 2023, 18:51
Roman wrote:
Nice if fasm have mechanism store text.
Any text.
Or include text from file.

Hmm...
Code:
include <file>
    

Example of conditional include you can find at Multisections theme
Code:
    virtual at 0
        file 'a.txt':10h,1
        load char from 0
    end virtual
loads the single byte from offset 10h in file a.txt into the char constant.
    

The magic of load/store needs more explanations and examples I think. Espesially what sort of stage is possible to use with that kind of data
Post 15 Mar 2023, 18:51
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:  


< 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.