Skip to main content

ASM book

I (re)discovered a great book about PC Assembler, which you can get for free from here. Printed it out yesterday, 197 pages, great stuff. Had this book some time ago, but I lost the PDF file. Finally found it again :) This is really an excellent book about ASM, although it does not cover SSE/MMX (but after reading it you should know enough that using those won't be a problem for you). Thanks for making this available for free!


I changed the name of the engine to Niven. From now on, every time I refer to Niven, I mean the 3D engine I'm working on (which was called formerly AdRem3d). Niven Image

Episode III and some C++

Woohaa, went to the cinema yesterday to watch StarWars:Episode III. Great! Surely the best of the first 3 movies, with some really amazing scenes, and, of course, incredible visual effects. This time it's not a demo reel any more (like Episode II), but an interesting and emotional movie (reminds me of "The Empire strikes back").

Rolling out your own RTTI

For my engine, it turned out that I would need some kind of RTTI system to be able to determine the exact type of resources I'm loading using plug-ins. This system would have to provide the following features:

  • Has to work in a multi-threaded environment
  • Must not import/export any kind of static data
  • Type checks have to be efficent
  • Support at least single inheritance, if possible, multiple inheritance
  • Does not need to support virtual inheritance
  • Easy to use
  • Only activated in classes that need it

C++'s built-in RTTI system was no option, as it was activated for all classes with a virtual function, something which I wanted to avoid. Moreover, it does not provide all the information I would like to store per-class. Hence, I decided to write my custom RTTI system. Turned out to be far more difficult than I thought it would be, took me now two weeks, in which I surely tried 4-5 different approaches which mostly solved the feature list, unfortunately not all of them. The final design uses a combination of static and virtual access functions, and a static class member that stores all type information. When performing run-time checks, the virtual function is called which returns the actual type of the class. For querying parent classes, the static function is called which returns the static type of a class. This is all encapsulated into some template functions, which also produce compile-time errors when used with non-rtti classes. Type checking is done by two function pointer calls and a single pointer compare, which is efficent enough. All the developer has to do is to add a AR_DEFINE_CLASS to the class definition and a corresponding AR_IMPLEMENT_CLASS to the class source file.