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

Re: Assembler problems



On Wed, 14 Jan 1998, Konrad Kokoszkiewicz wrote:

> 2) The assembler module contains two functions, those need to be called
>    with register parameters. These are six pointers located in registers
>    A0-A5 and a short int value passed in the register D0. How to force
>    the compiler to load them to the appropriate registers before function
>    call? Is it enough to use a prototype like this:

If it's anything like Pure C (which I guess it isn't), then it passes
arguments in registers by default. Pure C only use a0-a1/d0-d2 though,
the rest is passed on the stack.

One solution would be to pass all arguments on the stack and move them
into the appropriate register in the function. Ugly, but it should
work.

> void some_function(register float *val1, register float *val2, register
>    float *val3, register float *val4, register float *val5, register
>    float *val6, register short var)
> 
>    to be sure the pointers val1 to val6 will be loaded to registers A0-A5
>    respectively and the variable 'var' - to the register D0? 

I don't think so, the arguments will probably end up in different
registers depending on what registers that's already in use when you
call it. For all I know they might not end up in registers at all.

> The program I am talking about is not a Unix source, its from Amiga SAS C.
> 
> Thanks for any help (the program is *deadly* worth porting).

So what is it? One of the recent Amiga-ports of Doom perhaps? :-) I
saw one on a 060@50 yesterday, quite impressive.


/*
** Jo Even Skarstein    http://www.stud.ntnu.no/~josk/
**
**    beer - maria mckee - atari falcon - babylon 5
*/