Jump to content
  • Advertisement
Embassy of Time

Assembly language?

Recommended Posts

My game programming work has been very much a side project for these last few months, but in the meantime, I have been poking a stick at assembler / assembly language, whatever you want to call it (I keep seeing people use those two names interchangeably), but I cannot for the life of me find some really solid tutorials that go beyond philosophizing about the role of assembly language and some basic algebra. I would love to find something along the lines of NeHe's OpenGL, which was always IMHO the gold standard for OpenGL or any other programming tutorial. Does anyone know of assembly language tutorials that go into basic graphics (just dots on a screen) and very basic audio for x86 / Windows machines? I basically want to make something that can draw a few lines while playing some horrible tune, just to try it out :)

Share this post


Link to post
Share on other sites
Advertisement

I used 8086 assembly language for years way back when. It used to be that the screen was memory mapped using the same addresses space at as the CPU.  Also graphics cards did next to nothing. All they did was read memory and display it on the screen as pixels. In those days you could in fact draw by simply writing to memory.  For instance to draw a line you would use Bresenham's algorithm. To draw a polygon you would use the same algorithm on the edges and just scan the middle and write bytes to memory.  Now you have graphics cards with separate processors (GPUs) and graphics memory and typically you access the hardware using a library like DirectX or OpenGL. 

It's really not worth it to make whole programs in Assembly language any more.  Yes you can use it to optimize bits of code, but those bits don't have a lot to do with graphics directly.  Of course you can call graphics libraries from Assembly language but it won't get you much and it won't teach you much that you can't learn elsewhere.

I recently had to learn x64 just so I could help a friend do his homework. We wrote a basic big integer library (add, subtract, multiply and divide) and it worked pretty well.  (In fact he said it smoked the professors code so he got a 5+ which is like an A+ in the US, and he got to skip the final exam :)) In any case, IMO it's probably better to learn ASM doing something like that, where writing it in ASM might actually be of some benefit.

As for resources there are lots of them on the web or you can just grab a decent book on Amazon. ASM really isn't that hard. In fact I would say it's way easier than C++.  You typically just end up writing procedures. It's just a bit tedious at times but once you get used to it, it isn't that bad. It's also easy to link into C++ or C so you can write your procedures and use them in C++.

 

 

Edited by Gnollrunner

Share this post


Link to post
Share on other sites
7 minutes ago, Gnollrunner said:

It's really not worth it to make whole programs in Assembly language any more.  Yes you can use it to optimize bits of code, but those bits don't have a lot to do with graphics directly.  Of course you can call graphics libraries from Assembly language but it won't get you much and it won't teach you much that you can't learn elsewhere.

I know, but I was always fascinated by the .kkrieger guys and wanted to play around with it. I doubt it will be productive in the long run, but I am very much in a "just screw around and ignore the future" mode at the moment, due to the private issues...

Share this post


Link to post
Share on other sites

I just found this one, looks okay once you get into it:

This is the one I used recently to get back up to speed, I enjoyed it (has multiple videos):

 

Share this post


Link to post
Share on other sites

There won't be that much information about this and there certainly won't be many introductory tutorials.  You've strayed far, far into DIY territory and something that's not even practical or even in wide use in game development.  You will find generic information about assembly language programming, of course, but you won't really find anything about game development.

That said, assembly is a lot of fun.  One of my hobbies is 16-bit x86 assembly on DOS, and this is old enough that there is actually information about this available in the form of text files and books (many of which can be had on Ebay for $5 with free shipping).  It's also interesting and rewarding having an entire machine to yourself and controlling the video hardware manually.  This is as far from modern as you can get, but if you're interested in this I can dig up some info for you.

But in the end this is a real hardcore path that I only recommend if you're extremely persistent.  Games are complicated as they are and programming one in assembly when you're just learning assembly is a real tall order.  You won't find much or any help, you're going to have to be really self-reliant and know how to solve problems yourself.

Share this post


Link to post
Share on other sites
4 hours ago, gaxio said:

There won't be that much information about this and there certainly won't be many introductory tutorials.

Actually that is completely untrue.  I found about 2 dozen tutorials (mostly introductory tutorials at that) in a couple minutes of googling.  I even posted two video tutorial series one of which uses x64 assembly.  The Intel books are available via PDF as great references too.  I finally got rid of my print ones that they sent out for free just a couple years ago, but they were over 10 years out of date.

Share this post


Link to post
Share on other sites
11 minutes ago, CrazyCdn said:

Actually that is completely untrue.  I found about 2 dozen tutorials (mostly introductory tutorials at that) in a couple minutes of googling.  I even posted two video tutorial series one of which uses x64 assembly.  The Intel books are available via PDF as great references too.  I finally got rid of my print ones that they sent out for free just a couple years ago, but they were over 10 years out of date.

If you would have continued reading just one sentence down the road, it's clear I was talking about assembly in game development, not assembly in general.  Of course there are resources about assembly programming.

Share this post


Link to post
Share on other sites
On 7/10/2018 at 10:00 AM, Embassy of Time said:

poking a stick at assembler / assembly language, whatever you want to call it (I keep seeing people use those two names interchangeably

The difference is that "assembly language" is the language that you write your program in (ie the set of symbolic CPU instructions made available by the CPU manufacturer), while "assembler" is a program to convert your mnemonics text into proper machine language, possibly going through a linking stage.

The distinction is quite small though, as most assembly languages are extended with assembler-specific instructions, eg for specifying start memory addresses, or switching segments, etc. I guess you could name the extended set an assembler language, since often these extensions have specific syntax for one assembler.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!