dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004
    Location
    Orange, California
    Posts
    1,263

    Question Visual Studio with C and Asm files

    I am currently going through a book. It has C programs that call Assembly routines. I would like to type in some of the programs to see them work.
    The C programs are in .c files and the Assembly routines are in .asm files.
    How do I create a project in Visual Studio that will compile and assemble and link these files into a program that I can run?

    I have access to Visula Studio Versions: 6, 2005, 2010

    Sample c file:
    Code:
    #include <stdio.h>
    
    int first=1, second=2, third=0;		// these are the integers with
    					// whch we want to work.
    void main(void)
    {
    
    	printf("\nBefore adding third =%d",third);
    	Add_Ext();				// this call the assembly
    						// program that will add
    						// externals.
    	printf("\nAfter adding third = %d",third);
    
    } // end main

    Sample asm file:
    Code:
    .MODEL	MEDIUM			; This tells the procedure to use the
    				; MEDIUM memory model.
    
    EXTRN	first:WORD, second:WORD, third:WORD
    
    .CODE				; This is the beginning of the code segment.
    
    _Add_Ext PROC FAR		; The procedure is type FAR.
    mov AX, first			; This moves the first number into the
    				; accumulator.
    add AX, second			; This adds the second number to the
    				; accumulator.
    mov third, AX			; This stores the result back into
    				; third.
    
    _Add_Ext ENDP			; The procedure ends here.
    
    END				; This is the end of the code segment.

  2. #2
    Join Date
    Jan 2018
    Posts
    14
    For info for VS2017 see https://social.msdn.microsoft.com/Fo...orum=vcgeneral for info on how to configure VS to be able to use .asm files.

    Also note that for 32 bit (not for 64 bit), you can do in-line assembler using __asm {}. See https://docs.microsoft.com/en-us/cpp...ler/inline/asm

Similar Threads

  1. Adding files to visual Studio.net issue
    By sureshraina in forum .NET
    Replies: 3
    Last Post: 04-15-2006, 10:45 PM
  2. Replies: 0
    Last Post: 03-25-2003, 11:13 AM
  3. How add files to Visual Studio install?
    By Ted Young in forum VB Classic
    Replies: 1
    Last Post: 02-26-2001, 02:48 PM
  4. Getting only Visual Studio.Net online help files
    By Ara Ashikian in forum .NET
    Replies: 0
    Last Post: 08-04-2000, 06:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center