Skip to main content
gamedev.net
🔒 Locked

Is Assembly hard?

Started by GaMeStA Aug 15, 2000 at 4:23 AM 39 replies 3.6k views
Original Post
GaMeStA
GaMeStA
My question, is assembly hard to learn if you most of the basic C? Plus is it worth learning it these days, since computers and game console''s are gettin more powerful? Finally is there a tutorial for learning assembly? thanks
When there is a will, there is a way...
ZenGeneral
ZenGeneral
Assembly is really easy, but it takes alot of work and pre-thought.

Eh.. It can be worth it, for a few extra fps. Like doing the most basic operations that are done alot.

Just search yahoo, there are a couple.. not off the top of my head thou...

Why Not?
Premandrake
Premandrake
Assembly is a different concept to learn than C. Instead of having a whole bunch of things to help you out, you have to basically do everything yourself. So, things that you take for granted in C, like if statements with or''s are an exercise in logical thinking in assembly.

As for whether it is still valuable to learn, it depends on the amount of control that you like to have. Compilers nowadays are quite efficient in their optimizaiton techniques, but sometimes in time critical routines it can be worth it to write them in assembler. So in general, I would say it is worth it to learn assembler, if nothing else it will give you a better perspective on how the computer operates .

A quick search on yahoo turned up the following tutorials:

http://www.geocities.com/SiliconValley/2704/graphics.html
http://bobrich.lexitech.com/

Have Fun!

PreManDrake
Vlion
Vlion
Very worth it.
I needed to get milliseconds, and I tried about ever way thru the W32 api, timeb.h, etc, and finally I simply did about 3 lines of code in asm, and got it running great.
;-)
Nothing like it for down to the cpu precision and speed.
~V''lion

I came, I saw, I got programmers block.
~V''lion
~V'lionBugle4d
a2k
a2k
holy cow! you got milliseconds with 3 lines of assembly? that''s pretty cool. what were you doing? what type of algorithm was it?

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
OldManDave
OldManDave
I think in these days of fast processors and video cards, ASM would not be as needed as it was needed before. In a year or two, you wouldn''t probably even use ASM unless you were device-driver programmer or writing OS.

- OldManDave.
furby100
furby100
You can access the timestamp counter (a counter accurate to the CPU clock tick) using assembly. You can also move stuff in quad words at a time rather than just double words at a time by using the MMX/FPU registers. You can also use MMX, 3DNOW! and SIMD extensions. It''s not that hard to learn, especially MASM, which has built in control structures. There''s a tutorial on this site called Win32 Assembly or something like that. Although I don''t think I would use ASM to write a whole application.

------------------------------
#pragma twice
Frag_Daddy_
Frag_Daddy_

From my limited experience with assembly, it seems to be worth it to learn. I''m not the expert of course. I use C++ mainly, and have been for a long time, but I just recently started learning assembly, and it seems that it''s really cool. Especially because you have direct access over your computer. Anyways, because I just started, I can''t beat the compiler consistantly, but anybody can waste it doing conversions and small functions.

-----------------------------

1. "Diplomacy is the art of saying 'Nice doggie!'... till you can find a rock."

2. "Always remember you're unique, just like everyone else."

3. "If we don't succeed, we run the risk of failure."
-Dan Quayle

4. If life gives you sour grapes, squash them and make wine!
-----------------------------1. "Diplomacy is the art of saying 'Nice doggie!'... till you can find a rock." 2. "Always remember you're unique, just like everyone else." 3. "If we don't succeed, we run the risk of failure."-Dan Quayle4. If life gives you sour grapes, squash them and make wine!
Gladiator
Gladiator
Assembly is VERY EASY to learn, but the problem you''ll face is not knowing the hardware well, which wouldn''t let you create anything useful (as you start learning it). In order to create fast and efficient applications/routines in assembly you need to know the secrets and all the black magic behind the internal workings of your computer. There are LOTS of things to know, and that''s why it takes so long to learn. Other than that, learning assembly will take you about a week. By the end of the week you''ll remember what registers are used for what, and the most used interrupts, and a few functions for each interrupt, etc. That''s all you need to program assembly. When you get into graphics, or some other area of programming, then you need to know how to approach the problem and make up an algorithm that will combine your algo with asm and create an efficient application. It takes a while to learn all these things though!

btw, I program in assembly for fun, and I love being in control of what my program does, and want it to do what I tell it to do. Assembly will never die, and it will always be used by the hardcore programmers, and many hobbists.

-------------------------------
That's just my 200 bucks' worth!

..-=gLaDiAtOr=-..
baskuenen
baskuenen
If you can easy handle pointers in C(++) - ASM will also be easy!

Is it really worth learing assembly?
NO, not anymore if you ask me! But it''s always good to know more, and it will give you a greater insight into a processor and internal works of a computer.

Most of my computer friends also used to program lots of asm, but nowadays they ALL are doing C!!!

It''s not worth all your trouble. Only for most innerloops maybe.
Coded a uge optimized formula in asm using fixed point integers, but you want to change it to optimized floating point...welcome to hell!!!
Ever tried optimizing an asm function, and afterwards want to change a single thing...R.I.P.
Ever woke up in the middle of the night - dreaming you were attacked by 386,Pentium,FPU and some MMX monsters trying to optimize YOU?

Nowadays the saying is more looking like: Not fast enough? - Buy a new computer!

Gladiator
Gladiator
True, but on the other hand, Assembly is extremely fun to program, and I like it the most of all other languages, even though I''m not THAT good at it, YET!! And there are MANY people out there who program in ASM as well, and if you want to learn how to write well optimized code in C without using any ASM, then you should learn as ASM as much as you can.

I''m sure that no one who has ever used ASM (or hasn''t been told anyways) wouldn''t know the difference between these two:

int1 = 10;
int2 = 20;
int1++;
int2++;

int1 = 10;
int1++;
int2 = 20;
int2++;

Anyways... I like assembly, and there are a few people out there who have been using ASM for a long time that help me out to learn the tricks they used a decade ago. That''s about it...



-------------------------------
That's just my 200 bucks' worth!

..-=gLaDiAtOr=-..
Snyper
Snyper
ASM is easy....RIIIIIIGHT. Out of all the programming languages its the hardest. Now if you look at some code from like C or BASIC or something, that stuff makes much more sence then the cryptic ass ASM. Now, i like ASM but for like a beginner in programming, i can see how it can be hard as hell since its so cryptic. I know its not as bad now but still.

Snyper
=============================Where's the 'any' key?=============================
Snyper
Snyper
Incase you didnt know what exactly i mean my begginer in programming i mean some one that does not know ANY programming at all. I felt like i needed to say that since some people would misinterpret what i said.

Snyper
=============================Where's the 'any' key?=============================
Xtreme
Xtreme
Gladiator, i agree with what you said. Assembly may be tedious to write but you have full control of your hardware that way. My opinion is use assembly for time critical parts. Other uses are really not worth it these days.

Snyper, my opinion is in order to use assembly you must have a good knowledge of the CPU architecture and know a bit of maths and electronics. Since I love electronics & maths, I like assembly too

-Xtreme

sig u say?
Yes! There are kangaroos in Australia but I haven't seen them...yet
eng3d
eng3d
Asembly is very TOUGH.

The first step for learn some language is writte the sample "hello world". For basic is very easy, for c/c++ is easy or difficult in windows. But for assembly this is very difficult, and you need known many topics.

Better use assembly into c/c++ code.



-eng3d.softhome.net-
-----------------------------------------------"Cuando se es peon, la unica salida es la revolución"
Gladiator
Gladiator
eng3d, wrong...

BASIC:

print "hello world"

C/C++ (DOS/Win32 Console)

#include < stdio.h >

int main()
{
printf("hello world");
return 0;
}

C/C++ (Win32):

#include < windows.h >

int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
{
MessageBox(0, "Hello World", NULL, 0);
return 0;
}

Pascal:

uses crt;
begin
write(''hello world'');
end.

Delphi:

uses windows;
begin
MessageBox(0, "Hello World", nil, 0);
end.

assembly:

.model tiny
.code
org 256
start:
lea dx, msg
mov ah, 9 mov ax, 4c00h
int 21h

mov ax, 4c00h
int 21h

msg db ''hello world'', ''$''

end start

as you can see it''s not difficult at all... assembly.. pascal..c whatever...

-------------------------------
That's just my 200 bucks' worth!

..-=gLaDiAtOr=-..
LinkedList
LinkedList
Who said assembly is easy? Imma put the smack down!
...errrrrr


I don''t think assembly should be a first language, or even a
second. Learn C/C++ and when you want optimized code, assembly
will suck every ounce of dirt outta your program like a vaccum.

How do you think Quake3 can look so good and still get 60 fps on
my ATI card?

You do need to know the innerworkings of the computer to use
asm effectively, and I think this is the best online tutorial:
www.creative.net.au/mirrors/asm/


Hahaha, i removed the "asm/" from the link above and got into
some NeuralNetwork FAQ''s .



ImmaGNUman
ImmaGNUman
Gladiator, isnt that MASM? Pure asm code Hello world would be:

mov ax,3 ;reset video to text mode
int 10h ;= clear the screen (CLS)
mov es,0b800h ;set es to text video segment
mov si,message ;message to display
mov di,1760 ;display at line 11 on video
mov ah,7 ;medium white color
nex1: mov al,[si] ;byte from code seg message
inc si ;message +1
cmp al,0 ;end of message ?
jz done ;if so, jump to done
mov es:[di],ax ;move byte+color to video
add di,2 ;next video word address
jmp nex1 ;do next video
done: mov ah,0 ;wait for any key pressed
int 16h ;keyboard interrupt
mov ax,4c00h ;interrupt21h exit instruct
int 21h ;return to DOS ready prompt
message:
db ''Hello World!'', 0

-----------------------------

A wise man once said "A person with half a clue is more dangerous than a person with or without one."
-----------------------------A wise man once said "A person with half a clue is more dangerous than a person with or without one."The Micro$haft BSOD T-Shirt
Gladiator
Gladiator
NO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

That''s TASM , and what are you talking about pure asm and unpure one?! Hey, get some more sleep man

Sure, there are a few macros in use but i don''t really the point of your post? whats it got to do with anything in this post?

-------------------------------
That's just my 200 bucks' worth!

..-=gLaDiAtOr=-..
Martee
Martee
"ASM is the hardest language"
actually.....machine language is
break out the opcode table, cuz you''re gonna need it!

Martee
Magnum Games
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.