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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:14:08+00:00 2026-06-12T13:14:08+00:00

Trying my hand at Linux assembly and I’m running into the following problem. I’m

  • 0

Trying my hand at Linux assembly and I’m running into the following problem. I’m just starting out so my program is a relatively simple one derived from some examples I found over at linuxassembly. It takes the first argument passed to the command line and prints it out. Here is what I have so far…

section .bss
    test_string: resb 3

section .text
    global _start

_start:
    pop ebx     ;argument number
    pop ebx     ;program name
    pop ebx     ;first argument
    mov [test_string],ebx

    mov eax,4
    mov ebx,1
    mov ecx,test_string
    mov edx,3
    int 80h

    mov eax,1
    mov ebx,0
    int 80h

I know that this is poorly written, but since I’m new to this, I’m just looking to better understand how assembly instructions/variables work before I move on. I assemble and link using…

nasm -f elf first.asm
ld -m elf_i386 -s -o first first.o

Then I run using..

./first one two

I was thinking that it would print out one but it prints out gibberish like Y*&. What am I doing wrong? Is my test_string the wrong type?

  • 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-12T13:14:09+00:00Added an answer on June 12, 2026 at 1:14 pm

    You’re trying to print out the value of the pointer to the string instead of printing the string. You want to do this instead.

    pop ebx     ;argument number
    pop ebx     ;program name
    pop ebx     ;pointer to the first argument
    
    mov ecx,ebx ;load the pointer into ecx for the write system call
    
    mov eax,4   ;load the other registers for the write system call
    mov ebx,1
    mov edx,3
    int 80h
    
    mov eax,1
    mov ebx,0
    int 80h
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just trying my hand in bash, so I wrote a simple program in
Trying my hand at java and android and have run into a problem which
I am trying to compile a simple program using arm-linux-androideabi-g++. I am including this
I'm fairly new to Python, so I'm trying my hand at some simple code.
I'm trying my hand at Euler Problem 4 in Haskell. It asks for that
I'm trying my hand at working with threads at an assembly language level. I'd
Trying my hand at some simple firefox extensions... I am trying to create a
I am trying my hand out in C and I thought it would be
I'm trying to start developing a program using ncurses on Linux. I can't even
I was thinking of trying my hand at some jit compilataion (just for the

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.