home .. forth .. misc mail list archive ..

Re: Instructions for MISC


On Sat, 10 Jun 1995, Raul Miller wrote:

> One instruction I'd really like for F21 or F32 or later is: 0
> 
> It's really painful to have to eat up five instruction slots (1.25
> fetches) 

You mean  n 0 ?

> or four instruction slots 

This I can't guess what it is.

> (or, occasionally, resort to
> something obscure) to come up with a zero.

How about dup dup -or ? This eats one stack position up, but on deep
stacks (F21) it shouldn't matter. 

Another possibility (generic for constants) is to have a 0 in A , and 
then just do A . Well, this precludes A from being used as 
<some-useful-address> holder. This is addressed in F21 by having R act as 
a backup of A. 

On the other hand, what would you want to do with a 0? Looking at the
possible ALU instructions of F21, all give trivial results, when operating
on a 0. Aside from com, which produces a -1. But then, what would you do
with -1? 

From the non-ALU instructions only A! and A!+ seen reasonable candidates to
consume a 0 ( as in blanking a region of memory). There are two
possibilities here. <n 0> first and then <dup A!+ dup A!+> is one of them.
I saw Chuck use several drops to clear the stack and <A!+ A!+ A!+ A!+> to
write the 0es, produced at the bottom of the stack to memory. 

> It would also be nice to have an increment instruction that worked on
> TOS.

Well, this is addition, and we hit (almost) all problems with carry 
propagation.

--
Penio Penev <Penev@venezia.Rockefeller.edu> 1-212-327-7423