delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/26/22:33:18

From: Mike_and_Beth <mandbx AT wco DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: _asm undeclared
Date: Tue, 26 Jan 1999 19:30:50 -0800
Organization: Verio Northern California's Usenet News Service
Lines: 46
Message-ID: <36AE886A.98E@wco.com>
NNTP-Posting-Host: venus175.wco.com
Mime-Version: 1.0
X-Mailer: Mozilla 3.04Gold (Win95; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I'm just starting to learn asm - What else am I missng for this to work
other than not being able to comprehend the autoConversion stuff in the
FAQ ? 

I also saw something about 16BIT and 32 BIT modes, I was loaned a book
that uses specifically 16 BIT code examples. Should I get a different
book for 32 BIT and skip 16 ?

/* sample asm program */

#include <stdio.h>

void swapIntegers(int num_1, int num_2);


int main(void)
{
    int n1 = 24;
    int n2 = 48;
    printf("num1 = %d and num2 = %d [ prior to swap ]\n",n1,n2 );
    swapIntegers(n1,n2);
    printf("num1 = %d and num2 = %d [ after the swap ]\n",n1,n2 );
    puts("\n\t\tBye!\n");

return 0;
}


void swapIntegers(int num_1, int num_2)
{
    _asm
    {
        mov AX, num_1
        mov BX, num_2
        mov num_2, AX
        mov num_1, BX
    }

}   

This example is right out of the book.


Thanks,
Mike Purtell
mandbx AT wco DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019