Advertisement

Assembly

Started by July 12, 2000 11:50 AM
14 comments, last by Strife 24 years, 5 months ago
yup, i think the M stands for Macro to...

=======================
Game project(s):
www.fiend.cjb.net
=======================Game project(s):www.fiend.cjb.net
I''ve sort of always being interested in assembly. Mostly its the raw speed but I guess there''s a certain mystique involved as well. It looks so foreign. As a VB coder I could still real most C\C++, but assembler looks as hard to understand as hebrew.

I''ve seen heaps of globs of assembler lying around and have used them on occasion as black boxes, just assuming that whomever wrote them knew more than me. My question is, how do you know when to optimise by rewriting something in assembler. I''ve often seem comments saying that ''this sqr() func is blah clocks faster than the MS VC one. How do you know how many clock cycles a certain function takes in code? Is it a matter of analysing MS''s assembler or is there a clock timing function I can use to time the cycles of events in my code?

Thanks

gimp
Chris Brodie
Advertisement
> That''s a great free on-line book! It focuses on MASM, but the
> theory applies to TASM too, and is basically the same. There
> are a few macros that TASM doesn''t have but what the hell! He
> tries to make it as simple as possible for the transition
> between the two.

What if I want to use gas?

gimp: You can measure how many cycles a certain operation requires by using the rdtsc (read time-stamp counter) instruction. Look it up in whatever asm refernce you have.

"Paranoia is the belief in a hidden order behind the visible." - Anonymous
I made a 3D tank game entirely in assembly language for my final year high school project. It was a pretty simple engine, you just drove around on a flat landscape and bumped into the occasional tree, and shot at other tanks. The graphics were flat-shaded extremely low polygon count models, but the engine was Z-buffered (28-bit Z buffer, with 4-bits determining which frame a pixel was on: means I only had to clear the Z-buffer every 16 frames). If you wanted the source I could probably email it out to you.
I do almost all of my blt''s in asm.
For a good time hit Alt-F4! Go ahead try it, all the cool people are doing it.
I've done my whole game in asm. It'll be posted here first alpha version! However in the mean time look at:
win32asm.cjb.net

This is a great site! It covers *EVERYTHING* other than graphics, but it covers multithreading, memory management, structured exception handling, winsock programming, data base programming, as well as all the basics (31 tutorials for just the normal stuff! Plus more for database and winsock..)
So you can go from creating a simple hello world to a multithreaded game engine with this and some graphics tutorials.

Don't forget to look at Chris hobbs Assembly tutorials here on GameDev. It's a 7 or 8 part series that's got 6 of them up so far. The end result is a cool tetris game using asm DirectX w/ sound and input! It's very well done, and that's where I was first inspired to use asm for my games!
Good luck!
See ya round,
Ben

Oh yah your question what or where do I use asm. Well I use it everywhere but most people do intensive loops in asm, while all the init and Shutdown code for DDraw, DSound, DInput, and DPlay are in C++. But asm is great for blit's, alpha blending (In DDraw), real-time sound stuff, and intensive computations with lighting.

Edited: Oops URL wasn't right.. :-)

Edited by - cyberben on July 16, 2000 10:51:33 PM
__________________________Mencken's Law:"For every human problem, there is a neat, simple solution; and it's always wrong."
"Computers in the future may weigh no more than 1.5 tons."- Popular Mechanics, forecasting the relentless march of science in 1949

This topic is closed to new replies.

Advertisement