954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Using Assembly Codes in Bloodshed Dev-CPP

I am using BloodshedDev-CPP GNU. Assembly codes are written in this format :

int Variable=45; /*a random value*/
__asm(mov %ax,_Degisken);

The crap compiler uses 'AT&T Assembly Syntax'. The problem is I don't know that AT&T stuff and I want to call some interrupts in my program.
In the normal assambly language, interrupts are called with "int" keyword. But what about AT&T?

AhmedHan
Junior Poster in Training
71 posts since Apr 2005
Reputation Points: 13
Solved Threads: 1
 

>The crap compiler uses 'AT&T Assembly Syntax'.
Just because it uses an ASM syntax that you don't know doesn't mean that the compiler is crap. In fact, GNU GCC is a very good compiler that many experts recommend. Good first impression. :rolleyes:

>In the normal assambly language
There is no "normal" assembly language. Every architecture uses a different base assembly language, and every compiler that supports inline assembly uses its own variant.

>But what about AT&T?
Hmm, I don't know about everyone else, but I'm disinclined to help you after reading your derogatory and ignorant comments toward something you don't understand.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

The differences are highlighted at this site: http://www.objsw.com/docs/as_196.html

Good luck!

BountyX
Posting Whiz in Training
230 posts since Mar 2004
Reputation Points: 28
Solved Threads: 9
 

-masm=intel in the compiler options

prog-bman
Junior Poster
109 posts since Nov 2004
Reputation Points: 14
Solved Threads: 4
 

I set this "-masm=intel" and then tried to compile this:

void flipIt(void* buffer)
{
    void* b = buffer;// Ukazatel na buffer
    __asm__ // ASM kód
    (
        "mov ecx, 256*256 \n\t"
        "mov ebx, b \n\t"
        "label: \n\t"
        "mov al, [ebx+0] \n\t"
        "mov ah, [ebx+2] \n\t"
        "mov [ebx+2], al \n\t"
        "mov [ebx+0], ah \n\t"
        "add ebx, 3 \n\t"
        "dec ecx \n\t"
        "jnz label \n\t"
    );
}


<< moderator edit: added [code][/code] tags >>

The errors were:

Assembler messages:
Error: symbol `label' is already defined
Error: symbol `label' is already defined

I don't know what to do.
Thanks for help

typek

typek
Newbie Poster
7 posts since May 2005
Reputation Points: 10
Solved Threads: 0
 

set "-masm=intel" and compile this:

void flipIt(void* buffer)
{
    static void* b asm("b")  = buffer;// Ukazatel na buffer
    asm(// ASM kód
        "mov ecx, 256*256;"
        "mov ebx, b;"
        "label:;"
        "mov al, [ebx+0];"
        "mov ah, [ebx+2];"
        "mov [ebx+2], al;"
        "mov [ebx+0], ah;"
        "add ebx, 3;"
        "dec ecx;"
        "jnz label;"
    );
}


AT&T does tend to suck. It hurts my eyes.

fluidDelusions
Newbie Poster
14 posts since Jul 2005
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You