|
-
Aug 26th, 2004, 08:01 PM
#1
write assembly with vs.net?
I'm taking an assembly class... we havent really started anything yet so I was wondering what would be a good editor. I have Visual Studio.NET.
is it possible to write/compile assembly code with VS.NET? what would be a good editor if not
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Aug 27th, 2004, 03:54 AM
#2
Hyperactive Member
I dont think Visual Studio.NET can do asm.
For a good editor:
Try RadAsm, google for it. (can be used with just about all assemblers)
Assembly Studio which is a similiar to MSVC IDE - available at www.negatory.com
Another good one is WinAsm Studio, google for it.
-
Aug 29th, 2004, 02:54 AM
#3
You can actually. With the C++ compiler you can write inline assembly..
Code:
void main()
{
__asm
{
push 12
pop 12
}
}
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Aug 29th, 2004, 05:12 AM
#4
MSDN C/C++ Language Reference
Writing Functions with Inline Assembly
Microsoft Specific
If you write a function with inline assembly code, it's easy to pass arguments to the function and return a value from it. The following examples compare a function first written for a separate assembler and then rewritten for the inline assembler. The function, called power2, receives two parameters, multiplying the first parameter by 2 to the power of the second parameter. Written for a separate assembler, the function might look like this:
Code:
; POWER.ASM
; Compute the power of an integer
;
PUBLIC _power2
_TEXT SEGMENT WORD PUBLIC 'CODE'
_power2 PROC
push ebp ; Save EBP
mov ebp, esp ; Move ESP into EBP so we can refer
; to arguments on the stack
mov eax, [ebp+4] ; Get first argument
mov ecx, [ebp+6] ; Get second argument
shl eax, cl ; EAX = EAX * ( 2 ^ CL )
pop ebp ; Restore EBP
ret ; Return with sum in EAX
_power2 ENDP
_TEXT ENDS
END
Since it's written for a separate assembler, the function requires a separate source file and assembly and link steps. C and C++ function arguments are usually passed on the stack, so this version of the power2 function accesses its arguments by their positions on the stack. (Note that the MODEL directive, available in MASM and some other assemblers, also allows you to access stack arguments and local stack variables by name.)
The POWER2.C program writes the power2 function with inline assembly code:
Code:
/* POWER2.C */
// Power2.c
// compile with: /EHsc
#include <stdio.h>
int power2( int num, int power );
void main( void )
{
printf( "3 times 2 to the power of 5 is %d\n", \
power2( 3, 5) );
}
int power2( int num, int power )
{
__asm
{
mov eax, num ; Get first argument
mov ecx, power ; Get second argument
shl eax, cl ; EAX = EAX * ( 2 to the power of CL )
}
/* Return with result in EAX */
}
The inline version of the power2 function refers to its arguments by name and appears in the same source file as the rest of the program. This version also requires fewer assembly instructions.
Because the inline version of power2 doesn't execute a C return statement, it causes a harmless warning if you compile at warning level 2 or higher. The function does return a value, but the compiler cannot tell that in the absence of a return statement. You can use #pragma warning to disable the generation of this warning.
END Microsoft Specific
Just a little extra info..
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Aug 29th, 2004, 09:48 AM
#5
Fanatic Member
I don't think that you are able to use INTs, though. If you have to use INT, you will have to go to something like MASM, NASM, TASM, etc.
You should be able to find at least one of those.
"Can't" and "shouldn't" are two totally separate things.
All questions should be answered. All answers should be true. That is why I post.
-
Aug 31st, 2004, 08:40 AM
#6
Member
INTs are for DOS, not for Windows, you use API calls in Windows, and there is no problem using API Calls in inline assembler.
-
Aug 31st, 2004, 09:46 AM
#7
Fanatic Member
See what your instructor perfers. If he uses INTs, then you will need a different environment. If he uses Windows API calls, then MSVC++ or some variation of it should be adequate.
"Can't" and "shouldn't" are two totally separate things.
All questions should be answered. All answers should be true. That is why I post.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|