home .. forth .. colorforth mail list archive ..

Re: [colorforth] Disassembling Pentium ColorForth



--- Mark Slicker <maslicke@xxxxxxxxxxx> wrote:

> On Wed, 28 Dec 2005, John Drake wrote:
> 
> > So 6 instructions for colorForth versus 6
> > instructions for optimized SwiftForth.  Not
> > bad!  But I want to make sure I've done the
> > disassembly right.  Rummaging through the
> > c.l.f. archives I noticed Mark Slicker wrote
> > a definition for a non-existent MISC machine
> > that did it in 4 instructions.  His definition
> > used "+IF" which ColorForth doesn't have.
> > I suppose you could add that as a Pentium
> > macro though.
> 
> Just to clarify, this was 4 instructions for the
> non-existent machine, not 
> 4 pentium instructions. 

Well I did say "non-existent MISC machine" but
the extra clarification is appreciated. :)
Note, in retrospect was that really 4 
instructions or 5?

======================================
: digit
-10 +     ( 2 bytes, transfer sign )
+if 17 +  ( 2 bytes, sign is positive )
then 40 + ( 2 bytes, always )
;         ( 1 byte, always )
======================================

I'm thinking the jump implied by "+if"
is a seperate instruction from "17 +"?

> I'm not sure I would add
> +if, since it is very 
> close to -if, and in colorforth you are supposed to
> be thinking in terms 
> of a MISC machine. In that particular example I
> think either would have 
> worked.

Samuel Tardieu sent me a colorforth
solution that is closer to what you
wrote and better than mine in that
it only uses 5 instructions.

: digit -9 + -if -7 + then 64 + ;

Which I assume dissassembles to:

      add EAX, -9
      jns label
      add EAX, -7
label add EAX, 64
      ret

Regards,

John M. Drake


	
		
__________________________________ 
Yahoo! for Good - Make a difference this year. 
http://brand.yahoo.com/cybergivingweek2005/

---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com