flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > I need help write macro.

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1769
Roman 18 Apr 2015, 17:08
I have big data (2000 lines)
I show for example this(small part):

Code:
B0000001

A0000220

C00AB222
    


I need macro, this macro must create this:
Code:
dd 0xB0000001

dd 0xA0000220

dd 0xC00AB222
    
Post 18 Apr 2015, 17:08
View user's profile Send private message Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 618
cod3b453 18 Apr 2015, 17:23
[Normally I'd use an editor/script to prepend dd 0x to the first line and replace newlines with ",\<newline>0x"; then just assemble as normal.]

In FASM the basic outline would be:
Code:
virtual at 0
input::
        file 'test.txt' ; list of 32bit ASCII hex
        len = $
end virtual

repeat (len / (8+1+1)) ; 8 hex CR LF

        db 'db 0x'
        load q qword from input:+(10*(%-1))
        dq q
        db 0x0D,0x0A

end repeat
                            
Note I've assumed windows line endings, you can add in detection etc for this.
Post 18 Apr 2015, 17:23
View user's profile Send private message 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.