home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.forth      Forth programmers eat a lot of Bratwurst      117,927 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 116,391 of 117,927   
   sjack to All   
   Using just FigForth core words   
   03 Apr 24 07:59:59   
   
   From: sjack@dontemail.me   
      
   Put aside all my extensions and explored using FigForth core   
   words only. Here are three of several things I found interesting:   
      
   Fig-Forth 1.0.A   
   ( Example #1, Stash data stack items)   
      
   : XX S0 @ SP! ;  OK   
   : S0! S0 ! ;  OK   
   : !S0 TIB @ S0! ;  OK   
   : .S S0 @ BEGIN CELL - SP@ OVER < WHILE DUP ? REPEAT DROP ;  OK   
      
   ( some stack items.............) 1 2 3 4 5  OK   
   .s 1 2 3 4 5  OK   
   ( stash them...................) sp@ s0!  OK   
   ( use the stack................) 666 777 888  OK   
   .s 666 777 888  OK   
   ( restore stashed items........) xx !s0  OK   
   .s 1 2 3 4 5  OK   
      
   ( Example #2, Input counted string _directly_ into given storage area)   
      
   : CREATE:  ;  OK   
   : := DP @ SWAP DP ! 1 WORD DP ! ;  OK   
      
   CREATE: FOO 64 ALLOT     ( storage area for counted string FOO)  OK   
   FOO := Hello Chuck!  OK   
   FOO COUNT CR TYPE   
   Hello Chuck! OK   
      
   ( Example #3, Easily edit block screen without editor)   
      
   lib  OK   
   0 60 (LINE) DROP 1024 BLANKS  OK   
   0 60 (LINE) EXPECT ( FOO BAR )  OK   
   1 60 (LINE) EXPECT : FOO ." foo " ;  OK   
   2 60 (LINE) EXPECT : BAR ." bar " ;  OK   
   UPDATE FLUSH  OK   
   60 LIST   
   SCR # 60   
     0 ( FOO BAR )   
     1 : FOO ." foo " ;   
     2 : BAR ." bar " ;   
     3   
     4   
   ...   
    OK   
      
   ( Note RETURNS entered after EXPECTs)   
      
   PS: Having initializing variables can be a nice fit:   
      CREATE:  FCB 0 , HERE 64 ALLOT HERE 1024 ALLOT   
      CONSTANT FCB.BUF   
      CONSTANT FCB.NAME   
      
   PS2: Alignment after data is not needed when storage is followed   
        by a definition since Fig word names need not start on a   
        word boundary (in my build).   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca