WinAsm Studio, The Assembly IDE - Free Downloads, Source Code
Sponsors
Articles
Programming Quick Start
32-bit Assembler is Easy
Porting Iczelion tutorials
What is FASM
Hard Drive Recovery
Wiring your own LAN
Personal menu
Welcome Guest
User:
Pass:
Register!
Resend Validation Email
 
Forum
 

Append a charcter after a word (2 bytes), I want to add after every two bytes (word) the character that i want - I have tried MOV WORD PTR DS:[EDX],'X'

xspider
Quote Post


Very Active Member
****

Group: Members
Posts: 64
Member No.: 10609
Joined: 27-July 08


hi all biggrin.gif can someone help me with this

CODE
LEA EBX,szInput
XOR EDX,EDX
LEA EDX,szOutput
XOR ECX,ECX
@@:
MOVZX ECX,WORD PTR DS:[EBX]
MOV WORD PTR DS:[EDX],CX
;HERE I WAN'T TO ADD AN X AFTER THE WORD
INC EDX
DEC EAX
JNZ @B


well i guess i didn't explain better what i wan't is to add after every two bytes (word) the character that i wan't i've tryied MOV WORD PTR DS:[EDX],'X' but didn't work blink.gif

and thx in advance smile.gif

PMEmail Poster
Top
xspider
Quote Post


Very Active Member
****

Group: Members
Posts: 64
Member No.: 10609
Joined: 27-July 08


huh.gif this coded is buggy laugh.gif it gives 11111111112 as result for 1234567890 sad.gif
anyway what i wan't is like that 12x34x56x78x90 rolleyes.gif
PMEmail Poster
Top
ragdog
Quote Post


Extremely Active Member
******

Group: Moderators
Posts: 873
Member No.: 5019
Joined: 13-May 07


Hi Spider

Out is this what you want
12x34x56x78x90

CODE
.data
szNumber db "1234567890",0
.data?

Buffer db 15 dup (?)


.code
pushad        
      xor    edx,edx  
      xor    ecx,ecx                    
     lea    esi,szNumber
      lea    edi, Buffer
      mov    edx,2                                                          
     .while byte ptr [esi] != 0
            .if ecx==edx                  
                mov    byte ptr [edi],'x'  
                add    edx,2              
                .if byte ptr [esi]=='x'    
                    inc    esi            
                .endif
                inc    edi              
            .endif
            movsb      ;copy a  byte from szNumber (esi) to Buffer (edi)
            inc ecx
      .endw
     mov byte ptr[edi],0
  invoke MessageBox,0,addr Buffer,0,MB_OK
    popad


greets
PMUsers Website
Top
xspider
Quote Post


Very Active Member
****

Group: Members
Posts: 64
Member No.: 10609
Joined: 27-July 08


thank you mate for your help biggrin.gif
PMEmail Poster
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll

 

Sponsors
Computer Science

Internet
C/C++
Hardware & PC maintenance

HiEditor

General Discussions
Suggestions/Bug Reports
WinAsm Studio

General Discussions
Suggestions/Bug Reports
WinAsm Studio FAQ
Multilingual User Interface
Add-Ins
Assembly Programming

Main
Newbies
Projects
Custom Controls
Snippets
Announcements & Rules

Announcements

General

Online Degrees - Distance Learning
The Heap
Russian
Google