[Home]AssemblyLanguage

ec2-3-144-143-31.us-east-2.compute.amazonaws.com | ToothyWiki | RecentChanges | Login | Webcomic

As a protocompsci, I would very much like to learn to program in assembler. However, I have yet to find a single book or readable resource on this subject. I suspect that it tends to be buried deep in the sections of the compsci course that deal with compilers, but have yet to locate anything.
(PeterTaylor) You're looking at the wrong courses. At Cambridge, it's Part IB, courses Computer Design and possibly ECAD.

Can anyone recommend a book or website or other cool thing to aid me in my quest to learn assembler? I really mostly need some kind of basic reference or tutorial. Thanks
- CorkScrew




MoonShadow started off on [this], as well as other books in the same series (introduction to BASIC, programming games etc), many years ago. They're aimed at little kids, genuinely assume zero knowledge (they even contain litte comic strips in the margins to explain things like comparative architectures and binary notation, but using simple words) and are very gentle and very good. AFAIK, they have been out of print for a very long time now. For people who are more mature, MoonShadow recommends ISBN 0131659456 followed by something like ISBN 0830641009 . He can lend either or both of those to anyone who is around Cambridge. The subject does require some effort, though.
Libraries might have them and will probably be able to order them, even if they're out of print - SunKitten
YES!  That's the thing!  With the little robots pushing pieces of paper around!  --Vitenka

Alternatively, try digging up some of the old children's books on how to write Z80 assembler in your local library, and download yourself an emulator - those tend to give very gentle introductions, and once you're used to the concepts you can quickly adapt.  An [ARM] assembler and a GBA emulator might be a good combination to start on as well, except you will rapidly get lost without a textbook if you've never programmed before, and I am not aware of any introductions to ARM assembler that don't assume prior experience of assembler and/or C. The Steve Furber book on ARM is good - there are copies in Cockroft 4, and MoonShadow has one he can lend people too.
PeterTaylor has some notes which he thinks manage to teach ARM from scratch. Can try to dig them out if requested.
Yes, so has MoonShadow for that matter - he even knows where they are, and can lend them to Cantabrigians.

What experience have you had?
QBasic, Visual Basic (yuk), enough C to spot errors in a friend's code, lots of Python. I've also absently browsed anything relevant over the last couple of years, so I understand basic concepts (the stack, registers, pointers etc)
You could always try writing small, simple programs in C and once you have them working translate the parts of them that actually do the work (as opposed to the parts that talk to libraries to do the IO, manage memory and so on; which are usually the sort of thing you keep a reference book or Google around for) to assembler using your C compiler's inline assembler and something like ISBN 0830641009 for reference. Good things to practice doing:

And by 'should' we mean "won't the first eighty times you try"  --Vitenka (Come on, be fair - system interrupts are somewhat harder than maths.)
.
. (insert more in order of increasing difficulty)
.

Eviller still, for sheer perverseness value, write the wrappers in Java and the key logic in Java bytecode, using ISBN 1565921941 for reference (again, MoonShadow can lend this to interested Cantabrigians, or you can read it [online] - the [jasmin] site also has some docs).

(Before people ask, no, this is not a good place explain any of the terms. Using Google is part of the exercise).



Assembly in a nutshell:
Everything is a word (word length being machine dependant) you can load words into registers (very fast memory) and manipulate them there and unless incredibly insane you have a standard usage of the registers that you stick to.  To do anything, you put the words back out into memory.

Now read 'run MIPS run' and decide never ever to want to do assembly.  The devil is truly in the details of even the cleanest of assembly implementations.

Mind you, it can be a good way to learn what a computer is really doing.  Humm.  Got it.  Get yourself a dissasembler, or learn where your compiler hides the 'export assembler files' option.  Then take a look at what C turns into.  C is good for this, because it is a nice and simple conversion to machine code.  (Don't turn on too many optimisations, or this stops being true)


This will also help you in the only real remaining application for assembler outside of microcode - which is finding out why your perfectly legitimate code is not running as you would expect.  Assembly really does use all of the concepts you have encountered so far - especially stacks.  Back to comparative architectures for info about stack frames and how function pointers work, I guess.

All in all, programming in assembler from scratch generally consists of building your own small tools (or getting libraries of them) - and then once you have a reusable 'for next' loop (for example), you tend to stick with it over and over.

Another set of lecture notes you may find handy is 'compiler design' - typically you build compilers that turn stuff into pseudocode and then don't worry any more.  Assembler really IS just a very limited set of pseudocode.

Oh, if you go down the 'emulator' route, be aware that the BBC micro had perhaps the easiest impementation of assembler ever - you could just add chunks of it willy nilly to your BASIC programs.  There is plenty of old literature about the BBC micro out there.  --Vitenka
ChrisHowlett, a few years back, co-wrote an simulator for the BBC's 6502 assembler, to run under Windows. It's still around somewhere, and (to a reasonable approximation) works. I note that it was for teaching purposes, so not every command is implemented (although most are) and is doesn't emulate - it translates everything into the VB program it was written in, and displays what all your registers are doing. Still, if you want it, LMK, and I'll try to ferret out a distro.

(PeterTaylor) The Archimedes, of course, is a successor to the BBC. PeterTaylor picked one up for practicing ARM, but never got round to actually doing any. If anyone wants an Archi, I'm happy to give it away.
I'm interested. Which model? --Bobacus
440

Looking back at the response to my query: wow. Jackpot! Thanks guys - CorkScrew


CategoryComputing; see also [*scrape* *scrape* *crunch*]

ec2-3-144-143-31.us-east-2.compute.amazonaws.com | ToothyWiki | RecentChanges | Login | Webcomic
This page is read-only | View other revisions | Recently used referrers
Last edited May 8, 2006 10:17 pm (viewing revision 29, which is the newest) (diff)
Search: