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

  • Home
  • SEARCH
  • 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 6898191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:15:53+00:00 2026-05-27T07:15:53+00:00

I am running a C program that calls an external assembly function. For academic

  • 0

I am running a C program that calls an external assembly function. For academic purposes, I am trying to perform strcat. I pass the two strings to my assembly program as char * parameters. I push ebp to the stack and assign string1 and string2 to edx and ebx like so:

mov edx, [ebp+8]
mov ebx, [ebp+4]

Now the rest is as follows:

procStr1:
     cmp BYTE PTR [edx], 0
     jne readStr1
procStr2:
     cmp BYTE PTR [ebx], 0
     jne readStr2
     jmp bottom
readStr1:
    inc edx
    jmp procStr1
readStr2:
    mov BYTE PTR [edx], 'a'
    inc edx
    inc ebx
    jmp procStr2

bottom:
    inc edx
    mov BYTE PTR [edx], 0
    pop ebx
    pop edx
    pop ebp
    ret

I am simply testing to see if it works by adding a’s to the end of string1. If I enter ‘hi’ and ‘bye’ I expect to get hiaaa printed out by the C program (by printing out string1). Instead I get usually 13 a’s after string1, no matter how big string2 is. I would appreciate any input, it is really boggling my mind..

  • 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-05-27T07:15:53+00:00Added an answer on May 27, 2026 at 7:15 am

    Did you do a:

    push ebp
    mov ebp, esp
    

    at the top?

    If so, your arguments are now found at:

    mov edx, [ebp+8]
    mov ebx, [ebp+Ch]  ; 0xC, not 4 -- C-language passes args right-to-left
    

    Also,

    bottom:
        inc edx       ; This inc should be removed -- edx already points one
                      ; byte beyond the ultimate copied byte.
        mov BYTE PTR [edx], 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to create a Ruby program that will be running online
I am looking for a method to monitor a running program that I have
When running a Python program that reads from stdin, I get the following error:
I am running a java program that sets up a database connection to an
I'm running a java program that uses many vectors. I'm afraid my use of
I have an automated test running on my program that generates some large MPG
I have a Matlab program that is running longer than I'd like it to.
I am working on a background program that will be running for a long
Is there a way to find the name of the program that is running
I now have a running Java program which only lacks of the final step,that

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.