Announce: Assembly FAQs
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: Announce: Assembly FAQs

  1. #1
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,423

    Announce: Assembly FAQs

    ASSEMBLY LANGUAGE FAQ
    v0.1 (From VBForums' Assembly Language forum.) - 4/30/2001</font></p>

    Frequently asked questions

    ----------------------------------------------------

    Contents

    • Introduction
    • About
    • General Questions
      • How do I write an assembler program?
        • Assemblers
        • Hello World!
        • What Now?
      • How Do I Get The Command Line?
      • Links
    • Windows
      • How do I start programming for Windows?</a></li>
    • Contributors</a></li>


    ----------------------------------------------------

    .Introduction

    ..About

    This FAQ was originally created by Jake Bush for VBForums. It has since been updated by people here at CodeGuru

    ----------------------------------------------------

    .General Questions

    ..How do I write an assembler program?

    First you'll need an assembler, see below.

    ...Assemblers

    There are alot of assemblers, but for beginners I would suggest using the A86 assembler. It's free and very easy to use. It doesn't require all the different stuff an average assembler requires. It's for MS-DOS and will only assemble .com files, but it's perfect to learn with. Download it, unzip it and add the directory to the path. Here are some other assemblers...

    Turbo Assembler
    NASM
    flat assembler


    ...Hello World!

    Now that you have an assembler, you'll want to write your first program. The first program people write is usually the "Hello World!" program, so we'll do the same. Create a file and name it "Hello.asm". Then type in the following code...

    Code:
    	jmp	start
    Message1	db "Hello World!$"
    
    start:
    	mov	ah, 09h
    	mov	dx, offset Message1
    	int	21h
    
    	mov	ax, 4c00h
    	int	21h
    Then at the command line type...

    Code:
    a86 hello.asm
    You should get "HELLO.COM". Run it and see what happens.

    ...What Now?

    Now that you've written your first assembler program, you want to know what all
    that means. We'll for that you'll need to read an assembler tutorial, like these...

    Gavin's Guide to 80x86 Assembly
    Assembly Programming Journal


    ..How Do I Get The Command Line?

    The command line is loaded in the memory at offset 81h. The length of the command line is at 80h. So assemble this program with A86...

    Code:
    	mov	si, 81h
    	mov	ah, 02h
    
    nextbyte:
    	lodsb
    	cmp	al, 0dh
    	je	endload
    
    	mov	dl, al
    	int	21h
    
    	jmp	nextbyte
    
    endload:
    	ret
    This will print out the command line that you type when you run it.

    ..Links

    Easy Assembly
    Bob Rich's Tutorials
    Gavin's Guide to 80x86 Assembly
    Ralf Brown's Interrupt List
    The Art of Assembly Language Programming

    ----------------------------------------------------

    .Windows

    ..How do I start programming for Windows?

    First you need to download the MASM32 package at
    hutch's home page. Then to start programming for Windows go through the tutorials located at Iczelion's Win32 Assembly Homepage . The tutorials are at
    http://members.nbci.com/winasm/tutorials.html
    . They start very easy, and get pretty hard.

    ----------------------------------------------------

    Contributors

    • Jake Bush


    ----------------------------------------------------
    Last edited by Andreas Masur; December 16th, 2004 at 03:24 AM. Reason: Fixed small typo...
    Share on Google+

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center