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

Re: nFORTH


vic plichota:
>>  Have you tried to write any simple program with your command set?
>
>Yes.  How about a string-compare?  Or pixel-painting?  I will post


    How about bubble-sort with your nFORTH ? Please, show me an example.

>>  How are you going to realize next words with your 15 commands?
>>  >  <  >=  <=
>
>I assume that you mean signed compares.  I am prepared to sacrifice 1
>bit out of a 32-bit significand to make the 'carry' explicit.  Or use
>a co-proc (as is planned for floating-point and flash-multiply).

    No, I mean unsigned. Well, I would help you:

: >=  ( n1 n2 -- flag ) \  returns -1 if n1 >= n2,  0 otherwise

label1:
      >R dup R> swap  \ over
      >R dup R> swap  \ over
      nand dup nand   \ and
      jz  label2      \ leave if n1=0, or n2=0
      0 dup nand +    \ n2 = n2-1
      swap     
      0 dup nand +    \ n1 = n1-1
      swap
jmp label1

label2:
     jz  label3
     ;
label3:
     drop 0 dup nand       
;


Stas.