Re: A89: Registers


[Prev][Next][Index][Thread]

Re: A89: Registers




no no..   all the registers are totally independent...

//Olle

Miles Raymond wrote:
> 
> Yeah, yeah, that explaination is a good one.  But now you've confused me about a0-a6 and d0-d7...
> does the address that a0 points to precede the address that a1 points to?  (which precedes the
> address a2 points to, and so on?) and the same with d0-d7?
> 
> Such that if:
> a0 points to........$1008 then
> a1 would point to...$1009,
> a2 would point to...$100a, and so on
> and if
> d0 points to........$2c1e then
> d1 would point to...$2c1f,
> d2 would point to...$2c10, and so on
> 
> -Miles Raymond      EML: m_rayman@bigfoot.com
> ICQ: 13217756       IRC: Killer2        AIM: MRayMan
> http://www.bigfoot.com/~m_rayman/
> 
> -----Original Message-----
> From: Olle Hedman <oh@hem.passagen.se>
> To: assembly-89@lists.ticalc.org <assembly-89@lists.ticalc.org>
> Date: Wednesday, January 06, 1999 5:52 PM
> Subject: Re: A89: Registers
> 
> >
> >a0 and d0 is jut because they  are the first.. if you need the info in a0 or d0,
> >then you take a1 or d1...   it is just that simple..
> >with a7 though..  I can see that you need an explanation of how the stack works
> >:)
> >you don't put data IN a7, you put it in the stack, that a7 points to.. a7
> >contains the address of the stack.
> >if you move.l something,-(a7)
> >then a7 is decremented with 4 and you put the longword (4bytes) "something" into
> >the memory that a7 points to,
> >then when you want to "restore" a7 you should add 4 to a7 to be able to access
> >whatever is beneath the data you putted on the stack before..
> >if you move.w something,-(a7) then you must add 2 to a7, because move.w moves a
> >word and a word is 2 bytes long..
> >
> >if you pushes more things, then just add together the number of bytes you have
> >pushed, and there you have the number you need to restore a7..
> >
> >the reason you use a7 is that that is the register that by the system is
> >initialized to point to the stack, and it is also the register pea (push
> >effective address) uses..
> >
> >you can create your own stack anywhere in memory (if you just allocate it first)
> >and have any of the An regs to point to it and use it like a7 (exept for pea)
> >
> >I hope you got any of this..
> >//Olle
> >
> >> Miles Raymond wrote:
> >>
> >> I have had a few questions that have been bugging me since I started learning
> >> assembly for the 89:
> >>
> >> 1.Why are a0, a7, and d0 used more than the other registers?
> >> 2.And why do we constantly have to "restore" a7, when all we are doing is
> >> putting more stuff in it?  Why don't we just use a different register (a1-a6,
> >> or d1-d7?) so we won't have to restore anything?  Or will we still have to?
> >> 3.How do I know how to restore a7?  I see so many different numbers being used
> >> to restore it.
> >>
> >> Thanks to anyone who can answer these questions.
> >>
> >> -Miles Raymond      EML: m_rayman@bigfoot.com
> >> ICQ: 13217756       IRC: Killer2        AIM: MRayMan
> >> http://www.bigfoot.com/~m_rayman/
> >
> >


References: