On 4/2/2006 at 7:12 PM Roy J. Tellason wrote:
And why it was necessary to stuff parameters into
registers, when it's
easy enough to put 'em on the stack, among other things.
Well, memory fetches are slower than register references for one. It
requires stack space, for another. And the 8080 code to access the
arguments, while not awful, is somewhat clumsy:
lxi h, 2
dad sp
mov c,m
inx h
mov b,m
....or something like that to grab a word off the stack into BC.
I think the real reason (?) goes to a difference in cultures between
register rich and register poor machines IN THAT TIMEFRAME.
E.g., if you are writing code for a 68xx, you have little choice
but to do everything in memory addressing. Whereas if you are
using 8080/8085/Z80 et al., you just get used to *keeping* things
in registers (I can recall spending lots of time evaluating
which arguments I would put in which registers so I could
*keep* them there -- or somewhere else in the register set -- for
the duration of the algorithm... XCHG being a favorite tool
in those cases!)
Moving to something like a 99000 can be terribly distressing
for the register rich crowd to become accustomed to! ;)
--don