Re: LF: programming stuff


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

Re: LF: programming stuff



Hmlacage@aol.com wrote:
> 
> Sorry to disturb....
> I am working on a trig lib which would really calculate sine and cosine
> values. ( the one which is available just stores values in an array... ) I am
> using " limited developpements" ( ?... ) ( am not sure about the spelling and
> the expression itself. ) U know: cos(x) = x + x^2 / 2 + ...

Taylor... before I learned about that I couldn't understand how calcs stored
sin and cos etc :)

> >000018 33FC 0001 000000BC          134    move.w  #1,K
> >000020 33FC 0001 000000BD          135    move.w  #1,nume         ;
> >Alignment error.                                                                    ^ lib.asm
> line 10>000028  3200
> 
> and "K" and "nume" are  defined as
> 
> >0000BC 00                          186 K:      dc.b 0
> >0000BD 00                          187 nume:   dc.b 0
> 
> nume and K are thus defined exactly in the same way and are used exactly in
> the same way: what is wrong ?

A common error for 68k asm beginners. When you store words (or longwords) in the
memory, the address _MUST BE_ an even address! If not, you'll get ADDRESS ERROR.
In the case above, the compiler notice is (but it won't if you try to 
move.w #1,(a0) when A0 is odd). To avoid that, but all variables using dc.b
last in the variable declaration. In the case above, I can't understand why you
store a word in a byte variable... change  K:   dc.b  0  ->   K:  dc.w 0 etc

> One thing more: in the 68k guide ( really great ! thanks jimmy mardel ! ) ,
> there are some "#" and "$" symbols used. "#" stands for "immediate" and "$"
> for "adress" ?

# = immediate value, and $ means it's in hex. If you don't have #, it is
an address (ie remove all ()! ). In Z80 and 80x86 asm, ( ) means address
and 'nothing' means immediate value.

-- 
Jimmy Mårdell                   "Searching for shelter
mailto:mja@algonet.se            My brain is on ice
http://www.algonet.se/~mja       I'm scared of my own thoughts
IRC: Yarin                       I can hear them cry" /Leather Strip


References: