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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:01:41+00:00 2026-06-03T08:01:41+00:00

I want to write my first assembly program. I have done some programs on

  • 0

I want to write my first assembly program. I have done some programs on papers but its my first time with the compiler. I am using ideone. My program is very simple,
Translate A = 5 - A to Assembly

NEG A
ADD A, 5

Now I want to run this program and check it. How do I do it with the compiler? Please help me out. Thanks

  • 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-03T08:01:42+00:00Added an answer on June 3, 2026 at 8:01 am

    This is not quite valid 8086 assembly language. At least, it’s not in any assembly syntax that i’m aware of.

    • For one thing, 8086 registers’ names have two letters (they’re named AX, BX, CX, DX, BP, SP, SI, and DI..plus some semi-special “segment registers” that can’t be used for math).
    • If that A is a memory location, you need a label for it somewhere. And you need to let the assembler know that it’s supposed to be a word pointer, since you’re not putting it in a register. (The register size can make the pointer semantics obvious, but you’re not using registers here. :P)

    The corresponding 8086 code (which is quite similar) would be

    neg ax
    add ax, 5
    

    Or, for memory:

    neg  word [A]
    add  word [A], 5
    
    ... other stuff here ...
    A: resw 1             ; some assemblers say this; others say `dw ?`
    

    (MASM can sometimes do without the brackets. I don’t know MASM syntax, so hopefully someone else can clear that part up. Oh, and it’s not the way pretty much every other assembler does things. 😛 )

    Now, with that, you’d need an assembler (like Yasm) to turn that code into an executable. (You’d need more code, though. What you have here, won’t run correctly as is. At the very least, you need a ret at the end so that the CPU doesn’t run off the rails.) You could conceivably use a compiler and embed everything in an __asm block (or your compiler’s equivalent), but you generally wouldn’t do that if you’re writing in pure assembly language. That’s kinda like using a sledgehammer to pound in nails.

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

Sidebar

Related Questions

This is my first time using map/reduce. I want to write a program that
I want to write my first REST web service using the .Net framework. I've
I want to write an applescript program that first checks to see if the
In Persia(IRAN), when we want to write a date ,first we write its day
In my assembly language class, our first assignment was to write a program to
I want to write a simple text to speech program. First, I want to
I am using NLog for the first time, i figured out how to write
i want to write an event for the segment controller.By clicking First Tab i
I'm trying to write my first iterator class / container type. Basically, I want
I want to write a row in a db every time a user logs

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.