flat assembler
Message board for the users of flat assembler.

 Index > Macroinstructions > fasm1: placing in output ASC sorted unique string list (Idea
Author
ProMiNick

Joined: 24 Mar 2012
Posts: 441
Location: Russian Federation, Sochi
ProMiNick
Code:
```macro dummy [arg]{
common
local ..StrTbl,..Strings
virtual at 0
..StrTbl::
end virtual

virtual at 0
..Strings::
end virtual

macro def_astring labl,[string] \{
\common
\local ..offs,sz
virtual ..Strings
..offs db string,0
sz = \$-..offs
virtual ..StrTbl
labl\#id = \$/8
dd labl\#id
dw ..offs,sz
end virtual
end virtual \}
forward
local ..arg
def_astring ..arg,arg

common
local count,x,y,z,v1,v2,str1,str2
virtual ..StrTbl
count = \$/8
end virtual
x = count shr 1
while x > 0
y = x
while y < count
z = y
while z-x >= 0
v1 = str1
while v1 > 0
if v1 <> v2
break
end if
end while
if v2>v1
break
else
if v1<v2
store dword v1 at ..StrTbl:((z-x)*8)
end if
store dword v2 at ..StrTbl:(z*8)
if v1<v2
store word v1 at ..StrTbl:((z-x)*8+4)
end if
store word v2 at ..StrTbl:(z*8+4)
if v1<v2
store word v1 at ..StrTbl:((z-x)*8+6)
end if
store word v2 at ..StrTbl:(z*8+6)
end if
z = z-x
end while
y = y+1
end while
x = x shr 1
end while
repeat count
forward
if ..arg#_id = v1
label ..arg at \$
common
v2=v1 shr 3
repeat v1 shr 3
dq v2
end repeat
repeat v1 and 7
load v2 dword from ..Strings:(str1+(v1 and (-8))+%-1)
db v2
end repeat
end repeat }    ```

_________________
I don`t like to refer by "you" to one person.
My soul requires acronim "thou" instead.
25 Mar 2019, 15:10
rocketsoft

Joined: 26 Jan 2010
Posts: 189
rocketsoft
An unique string is called an orphan!
04 Apr 2019, 12:10
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsCompiler InternalsIDE DevelopmentOS ConstructionNon-x86 architecturesHigh Level LanguagesProgramming Language DesignProjects and IdeasExamples and Tutorials 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