Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7907105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:16:31+00:00 2026-06-03T11:16:31+00:00

I created a program in C to generate a char* processedData. I send to

  • 0

I created a program in C to generate a char* processedData.
I send to my assembly program and put it in a register:

mov     edx, [ebp+12]
mov     edi, edx

How can i write a char into it.
I know i need to
Write a char and inc edi… that in a loop.
But how can i write a char, i already have the value into another register.
But if i do mov edx, 49; char code i’ll lose the pointer.
I want to do something like

for(p=malloc(100*sizeof(char*)); p!=NULL;p++){
    *p=//my char code
}

Assembly for linux (DEBIAN) x86

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T11:16:33+00:00Added an answer on June 3, 2026 at 11:16 am

    edx is the address of the destination of the char. That is, edx is a pointer to the location you want to write to. Therefore, do this:

    mov byte ptr ds:[edx], 49
    

    This might even work:

    mov byte ptr ds:[edx], '1'
    

    You say your character is already in some register. I assume it is an 8 bit register (ah/al/bh/bl/ch/cl/dh/dl), in which case you can just do:

    mov [edx], ah
    

    The assembler can infer the size of the data [edx] is pointing to in this case.


    I’m on Windows right now so this code is for VC++. It demonstrates copying a string:

    #include <stdlib.h>
    #include <stdio.h>
    
    char src[] = "hello";
    char dest[8];
    
    int main( void )
    {
       __asm
       {
          xor ecx, ecx
    
          mov eax, offset src
          mov edx, offset dest
    
            loop_dest:
    
          mov bh, byte ptr ds:[eax+ecx]
          mov [edx+ecx], bh
    
          inc ecx
          cmp ecx, size src
          jnz loop_dest
       }
    
       printf("%s\n", dest);
       return EXIT_SUCCESS;
    }
    

    If your assembler uses AT&T syntax, you’ll need to do some minor translation, but hopefully this points you in the right direction.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What I want to do is to write a program that can generate large
The program created utilizes a 3rd party tool to generate a log file. However
I created an XSD file from Visual Studio and can generate a sample XML
I've created a little class to generate thumbnails with an external program ( gm
I created this program: #include <iostream> #include <fstream> using namespace std; int main ()
I created a program called test: #include<stdlib.h> #include<iostream> int main() { std::cout<<system(..\\add\\debug\\add.exe 4 8);
I created a program that more or less holds an array of strings as
I created a program in C++2011 that actually uses features of C++2011: mutex ,
I've created a program that creates and populates a custom document property in an
I've created a program in Eclipse / MinGW / C (project type: C) which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.