flat assembler
Message board for the users of flat assembler.

Index > Windows > Adding Strings

Author
Thread Post new topic Reply to topic
Hutley



Joined: 12 Feb 2006
Posts: 6
Hutley 17 Jun 2006, 04:14
i have this:
Code:
first db "hasdhashdhas",13,10,\
           "askdjsladj",13,10,\
           "asdsaskdjsladj",13,10,\
           "sdjsladj",0
    


how i add the content of esi in 3ยบ line?
like: "asdsaskdjsladj" + esi
[/code]
Post 17 Jun 2006, 04:14
View user's profile Send private message Reply with quote
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 17 Jun 2006, 07:30
here's the simplest example you can examine and modify according to your needs:
Code:
section 'code' code readable executable
    ........
    mov esi, first
    xor ecx, ecx
  @@:
    lodsb
    cmp al, 13         ;find EOL
    jnz @b
    inc ecx
    cmp ecx, 3         ;line #3?
    jnz @b
    dec esi
    invoke wsprintf, buffer, frmt, first, mystr, esi
    add esp, 4*5   ;pop out 5 DWORDs
    
    .........
    
section 'data' data readable writeable

first db "hasdhashdhas",13,10,\
           "askdjsladj",13,10,\
           "asdsaskdjsladj",13,10,\
           "sdjsladj",0
           
frmt db '%s%s%s',0      ;concatenate 3 strings
           
mystr db 'MYSTRING',0
           
buffer db 256 dup(?)    
Post 17 Jun 2006, 07:30
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.