The advantage of asm-inserts for me is that I understand how it works, otherwise you know, in someone else's compiler and the devil will break his leg.
I make it this way: I take files from VS2005: ml.exe,link.exe,lib.exe mspdb80.dll
also cmd.exe
.
Then I write in assembler text in a notebook, for example:
;***************************** asm_CheckNechet.asm ************************************ ; Данный модуль возвращает 1 если число нечётное, в противном случае 0. ;************************************************************************************** ; Command Line (release): ; ml -c "-Fl$(IntDir)\$(InputName).lst" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)" ; Outputs: ; $(IntDir)\$(InputName).obj .686 .model flat, c .data .code asm_CheckNechet PROC pushad mov EBP, ESP ;************************************************************************************** mov ESI, DWORD PTR [EBP+36] ;загрузить указатель на входное число //int mov EDI, DWORD PTR [EBP+40] ;загрузить указатель на выходное число //float ;-------------------------------------------------------------------------------------- finit mov EAX, DWORD PTR [ESI] sar EAX, 1 ;сдвигаем вправо jc obxod1 fld1 fstp DWORD PTR [EDI] ;число чётное popad ret obxod1: fldz fstp DWORD PTR [EDI] ;число нечётное popad ret asm_CheckNechet endp end
Next, using the pre-assembled batch file, compile into the object manager:
ml -c asm_CheckNechet.asm asm_CheckNechet.obj
Then I add to the library:
lib /OUT:my.lib asm_CheckNechet.obj
Well, then I connect this library to the studio by simply putting it in the appropriate directory.
In the studio, this function is declared as follows:
extern "C" void asm_CheckNechet(const int*, float*);