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

Re: [f-cpu] calling conventions

Michael Riepe wrote:

> With respect to the memory load/store capabilities (or inabilities) of the
> F-CPU, I think that passing arguments in registers is the best choice.
> The other simple alternative - putting all arguments on the stack -
> will be much slower (and also produce longer code).

Mind you other than FORTH and dumb little functions like 
strlen() or strcat() most functions take a long time to 
execute compared to entry and exit times. I suspect that a lot
of slow routines are more do to poor Instruction set architecture
than coding style. Take a compare operation like A = C > F; for a
typical 8 bit CPU. 

ld   hl,C
push hl
ld   hl,F
call compare
st   F,hl

Stack or register parameter passing will not make up for a poor
set if you have a rather high number of subroutines that perform dumb
simple tasks that a better architecture could handle. It is not the time
a instruction executes, but rather the unknown latency of the entire
system that is critical. 
Ben Franchuk - Dawn * 12/24 bit cpu *
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/