Good books for learning Assembly Language?

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
FrozenDelight
Interested
Posts: 45
Joined: Tue Aug 14, 2007 12:51 am

Good books for learning Assembly Language?

Post by FrozenDelight » Thu May 31, 2012 7:32 pm

It's been a long time, but I'm back now... well, kinda. I'm still trying to learn, but having problems.

Assembly Language Step-by-Step - Programming with Linux, 3rd Edition (2009, by Jeff Duntemann). I've been reading this book, at about page 100. Is this book good for learning how to program for Mega Drive hardware, or am I going down the wrong route?

Thanks for your time.

Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru » Thu May 31, 2012 8:25 pm

Linux is an operating system, Genesis does not have one - so probably major part of knowledge that you could learn from the book is not applicable. Also, x86 and M68K are very different CPUs. You would need general understanding of how computer systems work on very low level, without any intermediate software layer, and M68K architecture and opcodes.

Alternative is to start with C, in this case you won't need to know details on M68K architecture for a long time - you only need to learn Genesis architecture. You can even make a good game that way.

FrozenDelight
Interested
Posts: 45
Joined: Tue Aug 14, 2007 12:51 am

Post by FrozenDelight » Thu May 31, 2012 8:44 pm

Oh right, yes I see what you mean. I should have given more details, I'd forgotten what the book actually suggests by the title, and what I originally started reading it for.

Basically I started reading it to gain more of an understanding of programming in general. I've struggled to really understand it for years now. The book, as far as I am into it, seems to be good at explaining the fundamentals of programming. I guess it will get more into specifics later on, which will only apply to 32-bit CPU's, and the Linux OS's, and therefor be no good for Mega Drive dev.

I guess I just thought it would help me to understand programming for the M68K CPU. Because prior to this book, I tried to read '68000 Assembly Language (by Alan Clements)', but I found it way WAY too advanced for me (I still have that book btw). But I see you're suggesting learning 'C', was I totally wrong in thinking code for the Mega Drive hardware is written in Assembly?

By the way, I have also started to read 'Complete Idiots Guide to Programming Basics (by Clayton Walnum)', which mostly uses BASIC. This is the book I was reading before the Jeff Duntemann one, but I'm not sure if it's useful. It uses BASIC (the language) to explain programming in general, but while reading it, I find myself thinking; "Am I wasting my time learning BASIC? It's not used for anything anymore".

Sorry, I have a quick "on the side" question. Sorry for the total beginner questions; http://xi6.com/projects/asmx/. This 'asmx multi-CPU assembler', what is the input code? Does it assemble Assembly code? I know this is an odd question, but the answer will help me to better understand some basics.
Last edited by FrozenDelight on Thu May 31, 2012 9:23 pm, edited 2 times in total.

Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru » Thu May 31, 2012 9:22 pm

These day you can write nice programs in C for many retro consoles, even for NES. Of course it is noticeable less efficient than handwritten assembly code, but still good enough to make good games.

There is a BASIC compiler for Genesis, called BasiEgaXorz. Unfortunatelly it is full of problems, but still could be used to make simple (and not so simple) games.

Assembler is a tool that translates 'source code' (which is 'assembly code' in this case) - human-readable representation of code, into 'machine code' - binary data representation of the code that is executed by CPU.

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Thu May 31, 2012 9:22 pm

BASIC is good for learning the concept of writing a program. You can apply all of that knowledge elsewhere.

As for ASM, I used some Amiga programming docs I found on programmersheaven.com. I knew BASIC only and I really did not have issues going about ASM.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

FrozenDelight
Interested
Posts: 45
Joined: Tue Aug 14, 2007 12:51 am

Post by FrozenDelight » Thu May 31, 2012 9:28 pm

Assembler is a tool that translates 'source code' (which is 'assembly code' in this case) - human-readable representation of code, into 'machine code' - binary data representation of the code that is executed by CPU.
Ah yes, I do know what an assembler is, but thank you for the heads up. It's good to know it takes Assembly code, that's useful information to me.
There is a BASIC compiler for Genesis, called BasiEgaXorz. Unfortunatelly it is full of problems, but still could be used to make simple (and not so simple) games.
Ah yes, I remember looking at BasiEgaXorz a couple of years ago. I dismissed BASIC back then, but now that I'm back into attempting to learn programming, I may have another look at it. Thanks.

This old thread is interesting to me; viewtopic.php?t=838 Hmm, this 'Stef's GCC kit' seems interesting. Actually I remember hearing about it years ago, when I was last on this site. Also 'Easy68k' sounds interesting too, I will go read about it now.
TmEE co.(TM) wrote:BASIC is good for learning the concept of writing a program. You can apply all of that knowledge elsewhere. As for ASM, I used some Amiga programming docs I found on programmersheaven.com. I knew BASIC only and I really did not have issues going about ASM.
Thanks TmEE co.(TM), perhaps I will go back to 'The Idiots Guide' book (which mostly uses BASIC), because the Assembly book is already starting to get a bit complicated for me. It's also starting to talk about specific 32-bit CPU stuff which will not apply to 68000. Though, that said, I'm not totally learning all this to do stuff for Mega Drive, I'm also interested in coding in general, like really, I'd like to understand C# (sharp), so I can use Unity (the games making app for PC) to make some simple games. I started learning it, with yet another book, but it assumed I understood C#. So that's how I got here, I just end up going further and further back, away from what I originally intended :? . When reading about Assembly again, it just fasinates me, the whole down to the metal thing, the 'low level language' stuff. Though, I still haven't got to the point in the Jeff Duntenamm book where it explains (or I understand) how moving bits and bytes around in memory actually does anything useful :roll: . Like display things on screen, and move stuff around on screen... like games do :? .

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

ADDED LATER: EASy68K from http://www.easy68k.com/ looks real interesting to me. A "Editor/Assembler/Simulator for the 68000" for PC. So lets say, for example, if I took the source code from the example page, perhaps 'Pong game by Neil Richardson' (pong.X68), and used 'asmx multi-CPU assembler' to assemble the source code, would it work on a Mega Drive emulator?

My above question reminded me of something; I'm a bit confused, is a compiler different from an assembler?

Thanks.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Thu May 31, 2012 11:53 pm

Before using ASM i think you should be more familiar with megadrive hardware.
For that you can start with BasiEgaxorz :
http://devster.monkeeh.com/sega/basiegaxorz/

It's quite easy as it uses basic language and integrate almost all in one : the IDE, the compiler and SDK (a group of methods to access megadrive capabilities in a easy manner).

If you want more control and maybe more possibilities you can also use SGDK :
http://code.google.com/p/sgdk/
It comes with GCC compiler and a SDK too.
You can also use assembly if you want but again you should start simple.
Using SGDK is a bit more complicated than BasiEgaxorz but you have tutorials to help you.

FrozenDelight
Interested
Posts: 45
Joined: Tue Aug 14, 2007 12:51 am

Post by FrozenDelight » Fri Jun 01, 2012 1:00 am

Thanks Stef. OK I will learn BasiEgaxorz. By the way, do you have any links to examples (or just screenshots) of games or apps made with BasiEgaxorz, or BASIC in general? The 'Demonstration Example Code' link on the BasiEgaxorz site doesn't work. I'm having issues finding any images of games made with BASIC whatsoever. On Google, it often just comes up with DarkBasic games.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Fri Jun 01, 2012 9:55 am

FrozenDelight wrote:Thanks Stef. OK I will learn BasiEgaxorz. By the way, do you have any links to examples (or just screenshots) of games or apps made with BasiEgaxorz, or BASIC in general? The 'Demonstration Example Code' link on the BasiEgaxorz site doesn't work. I'm having issues finding any images of games made with BASIC whatsoever. On Google, it often just comes up with DarkBasic games.
I don't use it myself but i know there is a forum where you can find many examples from others guys :
http://devster.proboards.com/index.cgi? ... asiegaxorz
Also you have a complete documentation here :
http://devster.monkeeh.com/sega/basiega ... _full.html

GManiac
Very interested
Posts: 92
Joined: Thu Jan 29, 2009 2:05 am
Location: Russia

Post by GManiac » Fri Jun 01, 2012 3:06 pm

Once I learned programming in asm for Genesis reading these docs
http://www.ticalc.org/pub/text/68k/
You may read "68kguide.txt" first.

FrozenDelight
Interested
Posts: 45
Joined: Tue Aug 14, 2007 12:51 am

Post by FrozenDelight » Sat Jun 02, 2012 2:56 am

Oh, thanks Stef, and GManiac.

Ricky
Interested
Posts: 23
Joined: Tue May 22, 2012 10:09 am

Post by Ricky » Fri Jun 08, 2012 7:12 am

Guys I just ordered this book
Image
You guys think its good?
I hear these are some good books.
Can anyone tell me the specific name of the chip used as a VDP in the MD?

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Fri Jun 08, 2012 6:33 pm

It's called the "Genesis VDP". :lol: It's a custom chip derived from the SMS VDP which was in turn derived from the TMS9918.

As to assembly books being any good, I can't say - I've never used more than the user's manual for a CPU... never needed anything more. Once you know what a CPU instruction does, using it is easy. 8)

Ricky
Interested
Posts: 23
Joined: Tue May 22, 2012 10:09 am

Post by Ricky » Sun Jun 10, 2012 3:48 am

Chilly Willy wrote:It's called the "Genesis VDP". :lol: It's a custom chip derived from the SMS VDP which was in turn derived from the TMS9918.

As to assembly books being any good, I can't say - I've never used more than the user's manual for a CPU... never needed anything more. Once you know what a CPU instruction does, using it is easy. 8)
Oh ok, cool guy :lol:
SMS VDP eh.. I'll look into that, thanks!

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sun Jun 10, 2012 4:18 am

Ricky wrote:
Chilly Willy wrote:It's called the "Genesis VDP". :lol: It's a custom chip derived from the SMS VDP which was in turn derived from the TMS9918.

As to assembly books being any good, I can't say - I've never used more than the user's manual for a CPU... never needed anything more. Once you know what a CPU instruction does, using it is easy. 8)
Oh ok, cool guy :lol:
:wink: :lol:
SMS VDP eh.. I'll look into that, thanks!
You can find lots of good docs for the SMS and TMS9918 here:
http://www.smspower.org/Development/Index

Reading the TMS9918 docs, the SMS VDP docs, and then the MD VDP info in the SEGA docs should give you a good understanding of how these display processors work.

Post Reply