What's the best system on which to learn ASM?

Started by
22 comments, last by CalvinCoder 8 years, 6 months ago

Hey guys,



I'm looking at getting into retro game dev. I've been a game developer for the last five years and am fairly proficient in C/C++ (although I've used Unity and JS/C# for all of my game projects) but assembly is completely new to me.



I understand you need to really get to know the hardware (something Unity doesn't require - lol) and my school of thought was that a simpler machine would be simpler to learn... or is there more to it than that?



I was thinking of starting on the C64 and working my way up to 68k asm so I can make stuff for the Mega Drive, but where would you guys suggest starting?

Regards!

Advertisement

If the goal is just to use ASM then I think straight x86 is the easiest.. has a lot of tools and you can easily use it on your desktop.

I'm sure it's a lot of fun to learn on an older machine, but it will be more difficult.

I much preferred the 68k style of assembly over x86 just feels cleaner and nicer to work with but as Eric said, you have an x86/x64 machine so easier to play with.

That said in the modern world it is far harder to get to the metal than it was when I played with assembly so getting an old machine emulator and using that would be a good in.

For a gentile introduction in playing at a low level you could explore the old nerd classic that is http://www.corewars.org/ is is a pseudo assembly language where two programs get loaded into an "address space" and have to locate and destroy the other before they get killed :)

I'll put in a vote for 68k.

z80 is also a nice processor.

One of them is probably already in a calculator near you, ready to be developed for smile.png

A good thing with these simpler CPUs is that their instruction set is way more limited then x86.

x86 is a big pile of layer of layer of decades of development... not really beginner friendly.

An 8 bit z80 is beautifully clean in comparison, which makes the basics so much clearer.

But the limitations of an 8 bit environment is not for everyone... With a 68k you have a lot more freedom, without the instruction set getting hugely complex.

I might be biased because those two cpus where the ones I started out with so long ago smile.png

C64 hardware is like a school book of basic computer architecture, so not a bad choice either IMO

I'm not sure what the goal is, but if it's learning ASM then both unrestricted hardware access as well as instruction set complexity are irrelevant. Easiest way to start learning x86 ASM is inline ASM in Visual Studio, then concepts can be added one at a time.

Unless you actually want to get to know a hardware well, which can be great in itself, but quite a small subset of it is required to learn ASM.

We learned MIPS assembly at university on an emulator, running on top of Windows. Thr nice thing was it had 3 different levels/instruction sets (MAL, SAL and TAL), each of which were just extensions to the one below it (basically, additional microcoded instructions / compiler hints / macros). So we started off with the highest level one, which wasn't that much harder to use than C, then moved down to the next level, which just removed some nice helpers. Repeat that again and you're left with just the base HW instruction set, with no nice microcode support.

Searching for MAL/SAL/TAL MIPS in google brings up lots of uni/college learning material :)

I much preferred the 68k style of assembly over x86 just feels cleaner and nicer to work with but as Eric said, you have an x86/x64 machine so easier to play with.

That said in the modern world it is far harder to get to the metal than it was when I played with assembly so getting an old machine emulator and using that would be a good in.

For a gentile introduction in playing at a low level you could explore the old nerd classic that is http://www.corewars.org/ is is a pseudo assembly language where two programs get loaded into an "address space" and have to locate and destroy the other before they get killed smile.png

Its not that hard to kick an asm function even from x64 code, the only thing that has gotten hard is that the C++ compiler no longer allows for inline ASM.

Is a good series on getting started with x64 asm in VS2010, he shows you how to call an asm function and then moves on to explaining what all the instructions do.

I learned ASM on a 8088 like board with MASM as the compiler this looked so much like x86 asm that moving to PC was only getting used to the new register names like EAX and stuff.

The other thing you can do is write a simple function in C/C++ and see what the compiler transforms that into on PC in a debug build. You will want to do this in a debug build because in that case the compiler will actual transform all of your code in to ASM.

Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, theHunter, theHunter: Primal, Mad Max, Watch Dogs: Legion

Get yourself a Raspberry Pi2B or a BeagleBone Black. These are ARM boards -- the ARM processor is way simpler than the x86 even though they're of the same relative vintage (ARM is RISC, x86 is Swiss Army knife). In addition to learning ASM, you can futz with blinkenlights so you can really feel close to the metal. Learn to love the smell of rosin-core solder, it's the smell of victory.

Stephen M. Webb
Professional Free Software Developer

If you're going retro I vote for the 6502.

It's a very simple instruction set, with only three registers plus stack pointer and flags.

You could probably learn it in a week if you're already programming in C or similar, and it serves as a great starting off point for x86 (which IMHO is a horrid bloated instruction set designed these days for compilers not humans and assemblers).

I cut my teeth on the BBC micro which is an 8 bit machine cheaply available in the UK. It's also the same hardware as the NES (famicom) so it has lots of retro uses.

Have fun! :)

I vote 68000 but I vote for Commodore Amiga not Megadrive. C64 with 6502 isn't a bad choice either. The reason for computer instead of videogame system is that you'll most likely find more resources on the web for programming them and they both had demo scenes IIRC.

-potential energy is easily made kinetic-

This topic is closed to new replies.

Advertisement