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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:25:56+00:00 2026-05-17T23:25:56+00:00

I am trying to learn assembly from scratch. I have been reading up quite

  • 0

I am trying to learn assembly from scratch. I have been reading up quite a bit, but even the following simple program I found in a reference book has me stumped:

section .data
msg db "Hello!", 0xa
len equ $ - msg
section .text

     global _start

_start:


move edx, len
move ecx, msg
move ebx, 1
move eax, 4
int  0x80
move ebx, 0
move eax, 1
int 0x80

Now apparently this is supposed to print “Hello”.
But I don’t even know whats happening at any of the stages.
The first two stages put the message length and messgae in two registers, which are never used again. I don’t understand why.

I don’t know why four different registers are needed.

  • 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-17T23:25:57+00:00Added an answer on May 17, 2026 at 11:25 pm

    int 0x80 is a mechanism in some(a) UNIX-like operating systems for making system calls.

    For these calls, the registers are used for specific values. From the syscalls file:

    0 STD NOHIDE { int nosys(void); } syscall nosys_args int
    1 STD NOHIDE { void exit(int rval); } exit rexit_args void
    2 STD POSIX  { int fork(void); }
    3 STD POSIX  { ssize_t read(int fd, void *buf, size_t nbyte); }
    4 STD POSIX  { ssize_t write(int fd, const void *buf, size_t nbyte); }
    

    you can see that number 4 is the write call and needs three other parameters. Number 1 is exit and needs only the return code.

    When making the call, eax is the syscall that you’re making while ebx, ecx and edx are the three parameters (assuming they’re all needed – exit for example only needs one).

    So, you could comment the code as follows:

    move edx, len   ; length of message (nbyte).
    move ecx, msg   ; message to print (buf).
    move ebx, 1     ; file descriptor 1 (stdout).
    move eax, 4     ; write syscall.
    int  0x80       ; do it.
    
    move ebx, 0     ; exit code (rval).
    move eax, 1     ; exit syscall.
    int 0x80        ; do it.
    

    (a) Later versions of Linux introduced a new interface which can use different methods based on which provides the best speed. For example, some Intel chips are much faster if you use sysenter rather than int 0x80.

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

Sidebar

Related Questions

No related questions found

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.