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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:57:55+00:00 2026-06-15T10:57:55+00:00

I am trying to write inline assembly in a C file and I get

  • 0

I am trying to write inline assembly in a C file and I get 2 errors :

open.c:10: Error: junkptr nombre’ after expression`

open.c:10: Error: suffix or operands invalid forles’`

This is my file :

int open(char * nombre, unsigned char modo)
{
  int retval;
  int nrllamada = 6;
  asm("mov $8,%%ah \n\t"
      "les %%bx, dword ptr nombre \n\t"
      "int $0x22 \n\t"
      "mov %%eax,%0 \n\t"
      : "=r"(retval)
      : "a"(modo)
  );
  return retval;
}
  • 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-15T10:57:56+00:00Added an answer on June 15, 2026 at 10:57 am

    The correct way to write in registers ES and BX the 32 bits pointer named nombre is to connect the C variable nombre to register ECX, move the lower 16 bits of ECX to register BX, rotate the ECX register 16 bits so the lower 16 bits goes to the higher 16 bits of the same register and vice versa and finally move the lower 16 bits of ECX to ES.

    int open(char * nombre, unsigned char modo)
    {
      int retval;
      // numero servicio 6
      // nombre del fichero a abrir (ES:BX) y modo (AL) de apertura
      asm("mov $6,%%ah \n\t"
          "mov %%cx,%%bx \n\t"
          "rol $16,%%ecx \n\t"
          "mov %%cx,%%es \n\t"
          "int $0x22 \n\t"
          "mov %%eax,%0 \n\t"
          : "=r"(retval)
          : "a"(modo), "c"(nombre)
      );
      return retval;       
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get an odd intermittent error when trying to write a Diagnostics.Trace message from
all, I was trying to write a rot13 with inline assembly function... the following
I'm trying to write an inline editor for a specific type I'm writing. My
I m trying write code that after reset set up rrpmax as 3000. It
Trying to write app for service technicians that will display open service calls within
Trying to write a couple of functions that will encrypt or decrypt a file
I am trying to learn inline assembly programming in Delphi, and to this end
I'm trying to call the system call write with the inline assembler (gcc 4.2.1,
I'm trying to write a navigation bar using an <ul> with inline elements, but
I am trying to open pdf file in browser using the following code snippet:

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.