[ot] need help FAST: 680x0 asembler

Allan Herriman allan.herriman at fujitsu.com.au
Thu Jan 20 07:26:09 EST 2000


At 12:31 20/01/00 +0100, you wrote:
>Hi,
>
>my computer architecture exam is comming nearer every day.
>I'm looking for a printable-usefull reference for the motorola 680x0
>chips.
>Fast!
>The sylabus is a mess.
>Thanx a bunch.
>Bram
>
>PS: what the f*ck does 'link' do
>PPS: pardon my language...

I recently finished designing a board which has a 68360 on it (as well as a
couple of MPC860), so I think I can help (even if the '360 was just in
slave mode with its processor core turned off).

680x0 page:
http://ebus.mot-sps.com/ProdCat/sg/0,1251,934310184622,00.html

Click on your favourite family member (say 68060), go to the documentation
section, and find the M68000 Family Programmer's Reference Manual:
http://www.mot.com/SPS/HPESD/aesop/68k/68kprm.pdf
It should contain all the information you need.

OTOH, if your computer architecture course has a hardware flavour, then you
can also find many documents on that same site which detail bus operations,
etc.

BTW, from that pdf:

Instruction		LINK
Operand Syntax	An,#<d>
Operand Size		16, 32
Operation		SP – 4 => SP; An => (SP); SP => An, SP + D => SP

In plain language, this links the stack for a subroutine call.
It pushes address register An onto the stack.  It then puts the value of
the stack pointer into An (which on some processors would be the Base
Pointer).  It then adds a (optionally) 16 or 32 bit offset to the stack
pointer.
(The stack grows downward, BTW.)

Do you grok stack frames in languages like C and Pascal?  (I haven't
actually *programmed* a 68k for about 13 years (it's good to see your
teachers are keeping up to date!), so I hope this is right.)

In C, the *calling* function allocates space on the stack for the
parameters.  The *called* function will allocate more space on the stack
for local variables, but will usually keep another register (the base
pointer mentioned above) pointing to where the stack pointer was when the
program was called.  This simplifies offset generation (i.e. how to find
stack variables), as well as simplifying stack unwind for longjump();
Local variables and parameters can be accessed by an addressing mode which
offsets from that address register (the local variables have a -ve offset,
the parameters have a +ve offset).
When the called function returns, it deallocates its local variables by
copying the base pointer to the stack pointer, then returning, then the
calling function deallocates the parameters from the stack.

Pascal is sort of the same, except that the called function deallocates the
parameters from the stack (?).

In any case, the LINK instruction is meant to help with this sort of thing.
(You should probably also consider the unlink instruction.)

I could draw a pretty picture (gotta love that ascii art) but you said you
wanted the information quickly!
You should draw some pictures of stack frames on a piece of paper, and try
some example calling sequences.  If you can regurgitate that during an
exam, you deserve good marks.

(This sort of thing is why risc was invented, IMO.)

So there you are.  That's what the fuck 'link' does.

I hope this helps, and apologies for errors,
Allan.
--
Allan Herriman                        Senior Design Engineer
mailto:allan.herriman at fujitsu.com.au  Fujitsu Australia
Tel: (+61 3) 9845 4341                5 Lakeside Drive, Burwood East
Fax: (+61 3) 9845 4572                Victoria, 3151, AUSTRALIA
"Thirty five dollars and a six pack to my name."

dupswapdrop -- the music-dsp mailing list and website: subscription info,
FAQ, source code archive, list archive, book reviews, dsp links
http://shoko.calarts.edu/musicdsp/




More information about the music-dsp mailing list