Author: Sune Fischer
Date: 02:17:49 12/09/01
Go up one level in this thread
On December 08, 2001 at 22:54:36, Wylie Garvin wrote: >>How are you doing it? >> >>-S. > >Well, first of all I'm writing the interesting parts of my program in 80x86 >assembly, so my method may not be general enough for everybody. ;) Sounds very ambitious ;) >However, my observation is that at the time you GENERATE moves you know what >kind of move you are generating; Precisely, so I put that information into the move sort of like this: move.typeofmove = WCastleQ; or move.typeofmove = BEnPassent; then I can call the correct move rutine without checking a thing: pMakeMove[move.typeofmove](Position,move); where pMakeMove is an array of pointers to my move functions. Don't know if it is faster though, assembler is lots faster for sure. > so I differentiate them into two categories. >There are the "normal" moves, which simply means "if dest is non-empty, remove >captured piece. Then move source to dest." Notice that the vast majority of >moves fit into this category. I use the bottom 12 bits (0-11) for the source >and dest squares, and bit 12 to indicate that a move is a "special" move. Okay, that helps, as long as you don't have a huge switch case or if else if structure you need to check everytime ;) >And why did I decide to write it all in assembly?? Well, (more than any other >reason) because it's fun. Also I can do some things that no C compiler can, >like take full advantage of Intel's bit-scan and bit-manipulation instructions >which have been fast since the Pentium II. My code will be A LOT smaller, and >hopefully a lot faster, than that generated by any C compiler, because I know >exactly what's going on in there and carefully juggle registers, etc. for >maximum effect. I'm getting the impression that this is almost 100% assembly you are writing, if so that is a bit overkill I think. Critical parts will benefit a lot obviously. >Of course there are some optimizations that I probably can't do >as well as a strong compiler, such as instruction scheduling, especially since >P2/P3/P4 have some different requirements. A major worry is that sometimes you >forget one single optimization principle (such as alignment of certain labels) >and the whole thing runs 15% slower. But I have VTune and someday when I have a >whole working engine, I'll go back and work harder on the parts where my code >gets punished the most. =) Sounds great, but what about portability? Are you using any of those new instruction sets like SSE or 3DNow! ? oh, I should mention, I don't know the first thing about assembler ;) >cheers, >wylie P.S. sorry for the double post.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.