Jump to content
  • Advertisement
Sign in to follow this  
yats55

Learning Assembly on retro consoles?

This topic is 2125 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My biggest hobby are retro consoles, and I've always wanted to make something on one of them especially the SNES.

I know a tiny bit of C++, and am interested in programming in assembly, and for hobby's sake I want to asm code on consoles.

But I don't know if I should learn 86x assembly first, learn the SNES asm first, or some other console or processor (Maybe the Motorola 68000)

It seems like it would be more important to learn 86x first. The thing is I'm not sure how the whole thing of asm works of course.

I don't know if learning any one of the asm's means I'll know how to asm code everything else, or if each assembly are completely different.

I will say that I do have the Art of Assembly book.

 

So is it extremely important that I master 86x first before learning to do asm on another console and be able to understand it, or does it not matter which one?

If mastering 86x will make it very much easier to understand other console's or processor's assemblies, then I'll definitly do 86x first.

Other wise, is there any console that is best to learn for a first Assembly? 

Share this post


Link to post
Share on other sites
Advertisement

Other wise, is there any console that is best to learn for a first Assembly? 

 

The older the better.

 

Older machines had more limited capacity and fewer instructions.  

 

If you want versatility, pick up the MOS 6502 instruction set.  It has 56 instructions available to you, and you'll really end up using only about 35 of them frequently.

 

It was used on the Atari 2600 and the original NES.  The Atari 2600 console has less complex hardware so it is easier to develop for with an emulator. There are several good tutorials for learning to develop for it, such as this one.

Share this post


Link to post
Share on other sites

Targetting older stuff first is seconded. The 6502 instruction set is also very similar to its successor, the 6510, which was used in the C64. There's plenty of material out there giving you a glimpse of what to expect.

Share this post


Link to post
Share on other sites

You can actually write some interesting stuff in X86 without having to know the full instruction set, usually: mov, add, sub, call, cmp, je, jne, jmp are a good starting point.

 

If you compile in MSVC++ and set a breakpoint somewhere just right click and select show disassembly, this will show you a mixed mode of C++ and assembly instructions. The assembly is what the CPU is actually executing but it shows you what a line in C++ expands into in X86 asm.

 

Good series to read is this:

http://www.altdevblogaday.com/2013/05/22/cc-low-level-curriculum-part-12-multiple-inheritance/

Edited by NightCreature83

Share this post


Link to post
Share on other sites

For x86 asm, if you write some really simple code in C (using if, else, for, etc...) then compile it without optimization, you can use a tool called OllyDbg which breaks it down into the assembly but not only allows you to see how the code translates to asm but best of all allows you to fiddle (it supports patching) so you can have a go at changing the flow or even constructing your own completely.

 

Other things that might be useful is if you use gcc, you can compile with -S to output asm code rather than binary. Other compilers can probably do similar. This code can then be modified and finally compiled into a binary to test.

 

If you do want to branch out into asm completely, there are OpenGL bindings for NASM. The cool thing is that OpenGL with nasm is surprisingly easy to use.

 

A friend of mine maintains the zsnes port for OpenBSD and has also worked on its debugger. This might be a nice place to start too.

 

Just my 2c :)

Edited by Karsten_

Share this post


Link to post
Share on other sites

Skip the C64 - it has a fair number of quirks! 

6502 is definitely the easiest, although personally I was always partial to the z80 myself (it is a more complex beast than the 6502, but only if you use the esoteric extended instructions. If you stick to the 00 -> FF opcodes, then it isn't too different from the 6502 really). XASM will assemble 6502, ZASM will assemble Z80, although it's fairly 'easy' to just write machine code directly in HEX.....

Share this post


Link to post
Share on other sites

My biggest hobby are retro consoles, and I've always wanted to make something on one of them especially the SNES.

I know a tiny bit of C++, and am interested in programming in assembly, and for hobby's sake I want to asm code on consoles.

But I don't know if I should learn 86x assembly first, learn the SNES asm first, or some other console or processor (Maybe the Motorola 68000)

It seems like it would be more important to learn 86x first. The thing is I'm not sure how the whole thing of asm works of course.

I don't know if learning any one of the asm's means I'll know how to asm code everything else, or if each assembly are completely different.

I will say that I do have the Art of Assembly book.

 

So is it extremely important that I master 86x first before learning to do asm on another console and be able to understand it, or does it not matter which one?

If mastering 86x will make it very much easier to understand other console's or processor's assemblies, then I'll definitly do 86x first.

Other wise, is there any console that is best to learn for a first Assembly? 

 

learning x86 is bad option becouse assembly is not only instructions but the platform it works on and in x86 case the platform is complex and yet worse obscure - and this is tragic for asm learning the best way is running assembly on some pure machine / hardware

 

I would very much like to learn assembly on x86 but the platform is obscure - you assembly code will be packed in complex executable format file, then at runtime loaded in a complex and obscure way  into some place in complex and also proprietary windows system runtime [when you got no direct acces to hardware (even some processor mechanism will be not avaliable for you) but only winapi calls just like in other languages :/] when you got only partial info abouts it components and you  will not see how it all works on low lewel - so on windows you  efficiently could just do not some kind of full assembly coding but only some half assembly when you only could optymise your own routines in obscure environment 

 

maybe on linux if you will know linux kernel and intenals of linux drivers you could manage the true understanding in all asm and hardware but I do not know (dont know linux) - (they say that hardvare vendors  do not publish their hardvare specyfication in full details to free communitty (should ho to hell for it) so it can be difficult maybe)

 

 for me it is hard hard disappointment that I can learn pc/gpu/windows coding full in assembly - it is complicated but it is more obscure than complicated and if hardware would be fully public decribed it would be not much hard (I think)

Edited by fir

Share this post


Link to post
Share on other sites

As a professional assembly programmer, it gave me warm fuzzies to see all the responses having suggestions rather than "assembly!? Are you mad???"

:D

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!