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 6654831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:26:15+00:00 2026-05-26T01:26:15+00:00

What does .string do in assembly? In an inline asm call in c, I

  • 0

What does .string do in assembly?

In an inline asm call in c, I wrote

.string \"Hello World\"

1) Can somebody give me an overview of how .string works?

2) Somehow that value gets saved in %esi. Why?

3) How can I append a return carriage on the end? \n doesn’t work

  • 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-26T01:26:15+00:00Added an answer on May 26, 2026 at 1:26 am

    .string is an assembler directive in GAS similar to .long, .int, or .byte. All it does is create and initialize memory for you to use in your program. The .string directive will automatically null-terminate the string with [\0] for you. In this case, the assembler is allocating space for 14 characters in 14 contiguous bytes of memory. If you were to look at the memory, you would see this:

    ["][H][e][l][l][o][ ][W][o][r][l][d]["][\0]
    

    Except in hexadecimal rather than characters. I’m not sure how or why %esi points to the string (it’s either an assembler setting I’m not familiar with or has been set that way on a line of code you’re not showing us). What it means is that %esi “points” to the first byte of the string – in this case the first ["]. You can use the %esi register to loop through the bytes using an offset (%esi + 5 would be [o]) or by incrementing the register itself.

    To add a newline you might want to try \x0D\x0A instead of \n.

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

Sidebar

Related Questions

My question can be boiled down to, where does the string returned from stringstream.str().c_str()
Possible Duplicate: What does [String] mean in VB.NET? Dim assem As [Assembly] = [Assembly].GetExecutingAssembly()
Please, does anybody know how to code string input in assembly language? I'm using
Does string immutability work by statement, or by strings within a statement? For example,
Does String.ToLower() return the same reference (e.g. without allocating any new memory) if all
What does the [string] indexer of Dictionary return when the key doesn't exist in
I have a static util class that does some string manipulation on a bit
this compiles :-) string name; name = 1; this does not: string name =
I am validating an NSString to ensure that the string does not contain apostrophes.
I want to make sure a file path set via query string does not

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.