C++ and assembly [Resolved]
well, i know one thing:
there is a keyword __asm in c++ :)
sure thats not news, but guess i want to know more about that.
i have decieded to send this thread in assembly forum because i assumed that people who program assembly know c++, but not nessarily vice versa.
the point i want to get from __asm keyword is performance,
as i am trying to make an AI chess program i thought that inserting direct assembly code in the c++ program will boost performance.
PS: i am NOT an assembly programmer, but trying to figure out if its worth the trouble to start learning it.
is that a reasonable idea ???
would it be really better to use assembly ??
another thing, is there limitation on __asm ??
i mean are all assembly statements and stuff available ???
also, can i use c++ compiler as an assembler, intead of getting a seperate assembler ???
for example:
Code:
void main(){
__asm{
/* some assembly code */
}
}
does that have disadvantages ??!
also, as i have no idea about assembly language, i'd find it usefull to know few other stuff:
* does assembly provide the idea of "function" or "sub" ??
* does assembly provide the idea of a class ??
* can i make a dll file ??
* back to __asm keyword, does c++ change 1 statement into 1 assembly intruction. i mean would i find a statement which is lets say 5 assembly instruction, that i can do manually in assembly in one or two assembly instruction ?? (can u provide an example ?? )
thx in advance for trying to answer one or all of my questions. :D
a little bit of explanation
first of all, thanks packetVB :D
ok, i though it might be usefull to give some further explanation of my situation.
as i said, i am making a chess AI program, so performance is key.
i'll give you some statistics on that:
refering to first move on chessboard, and depth 8:
* VB6 in debug mode needs more than 5 minuits
* VB6 optimized for speed needs 135 sec
* VB.NET optimized needs 135 sec
* VC++6 in debug mode needs 85 sec
* VC++6 optimized needs 18 sec
* VC++.NET (using managed classes, and managed arrays) in debug mode needs 140 sec
* VC++.NET (using managed classes, and managed arrays) optimized needs 125 sec
i have programmed this chess engine first on VB6 , and converted a final version of that into VC++, so as u see the ratio between optimized versions of VC++ : VB is nearly 1 : 8 , which allows to to increase the depth by two, with a slight increase in time. ie. from default depth 5 in VB to default depth 7 in VC++.
i thought maybe for especially loop using assembly can make a time save of at least a ratio 3 : 4, maybe doing that in 13 sec ...
on your estimation could that benefit be possible, or is VC++ so fast that assembly would not make that big difference ???
also, as i was browsing the net, i found this site:
http://www.eventhelix.com/RealtimeMa...ranslation.htm
although i did not understand anything, i sensed it should be usefull .........
well, well, if smone would check it, and tell me if its worth the trouble understanding what they are saying.
there they explain how to translate C++ code into assembly :)
one last thing, is MASM included in visual studio 6.0 or .NET ???