[Tutor] Assembly Language (was Re: Which programming language...)

Paul Sidorsky paulsid@shaw.ca
Tue, 26 Mar 2002 22:49:31 -0700


Danny Yoo wrote:

> [way way way off topic]

Ditto...

> By the way, if you're interested in what "assembly language" is like, you
> may want to look at Knuth's description of the "MMIX" machine:

I would also suggest examining PDP-11 assembly language.  Googling will
turn up some emulators.  It has a relatively small core instruction set
and the code is quite clean.  Here's a snippet from the start of an
implementation of C's puts() function:

puts:   mov     R0, START
        mov     #OUTBUF, R1
loop:   cmpb    (R0), #0
        beq     print
        movb    (R0)+, (R1)+
        br      loop

PDP-11 is still taught here for the reasons I mentioned above - it's
used as a springboard to learning 80x86 assembler.  If you look at Intel
code and then look at PDP-11 code it's hard not to wonder "what do they
[Intel] need all that extra crap for?!?"  Besides it's cool to learn how
to program a machine that is so prominent in computing history!

> It's not Python, and it's not "practical", but it really does help us
> understand how computers work.  As dman mentions, programming in assembly
> makes one really appreciate 'for' loops.  *grin*

Not to mention data types, variables, functions, etc.  :-)

-- 
======================================================================
Paul Sidorsky                                          Calgary, Canada
paulsid@shaw.ca                        http://members.shaw.ca/paulsid/