I have been seing a little bit here and there about somthing called in line assembling. It sounds pretty cool, can anyone point me in a direction that I can find out more about it?
Thanks,
Posted on 2001-08-22 22:45:12 by -T-
you can place assembly within your HLL programs: this is a great way to utilize assembly to speed up your program in critical areas.

example of inline asm:

void SetVideoMode(int mode) {
_asm {
mov ax, 0x4f02;
mov bx, mode;
int 0x10;
}
}

note: some compilers use the asm keyword while others use _asm or __asm.

dr phil :)
Posted on 2001-08-22 23:37:11 by phil
-T-,

Some compilers have the capacity to handle assembler "inline" with the normal high level code. C has had it for years, from memory Pascal can still do it and PowerBASIC also can do inline asm.

C.
__asm{
mov eax, 1
rol eax, 16
}

PowerBASIC
! mov eax, 1
! rol eax, 16

Pascal
(who cares)

Inline asm allows you to tweak little bits of your code where it will help in speed or capacity terms but if you have serious assembler to do in C, you are better to write an asssembler module and link it in to your main prog.

Regards,

hutch@pbq.com.au
Posted on 2001-08-22 23:44:26 by hutch--
Very neat indeed. Thanks guys.

lol: "Pascal (who cares) "
Posted on 2001-08-22 23:53:37 by -T-
very nice !
do you know the sintax to start asm for VB ?

thx
Posted on 2001-08-23 03:07:10 by Bit7
no such thing.
Posted on 2001-08-23 03:40:27 by vcv
do you know the sintax to start asm for VB ?


Try this URL:

http://www.geocities.com/emami_s/assembly.html

Farrier
Posted on 2001-08-23 04:41:10 by farrier
thanks farrier, article is very interesting.
Posted on 2001-08-23 06:54:47 by Bit7
pascal:



asm
mov ax, 13h
int 10h
end;


As for "who cares" about pascal, I dunno. But there are several
32bit compilers around, that can do both win32 and dos32 apps.
So somebody might still care, pascal isn't the worst language :).
It's somewhat lacking wrt pointers (they don't work as nicely in C),
but it has *one* good thing at least... the "with" keyword. Oh well,
I switched to C+asm back when there were no 32bit pascal compilers
and I was sick of 16bit code.

As for inline... you're usually better off writing an external piece of
asm... inline asm can seriously interfere with the optimizer of your
compiler, giving sub-optimal results. And if you want asm, it will
usually be larger chunks of code, which will work very well when linked
externally. Ok, if you want to do fast fixed point math or similar,
inline will probably work fairly well.
Posted on 2001-08-23 10:24:57 by f0dder