[comp.lang.forth] A F P N , Amiga Forth Newsletter

ForthNet@willett.pgh.pa.us (ForthNet articles from GEnie) (12/10/90)

Category 14,  Topic 5
Message 1         Sun Dec 09, 1990
GARY-S                       at 07:01 EST
 
            
 From jax Wed Dec  5 20:38:59 1990
 Date: Wed, 5 Dec 90 20:38:55 pst
 From: jax (Jack J. Woehr)
 To: gars
 Subject: AFPN 90-12

    _     _   _   _  _     _    ___  _   __ ____ 
  //\\  //\\//\\ ||//___ //\\  ||_ //\\ ||\\ || ||_|| PROGRAMMERS'
 //==\\// \\// \\||\\_////==\\ ||  \\// ||\\ || || ||  NEWSLETTER
 Issue 90-12 : JForth STRIP-PATHNAME ; : A4TH1.5 D2/ ; : AFPN ;
 Subscribe via {hplabs,pacbell,ucb}!well!jax jax@well.sf.ca.us
 with a Subject: header of AFPN SUBSCRIBE.

 : AFPN ; The Amiga Forth Programmers' Newsletter is back on line!
 Rich Thompson has passed us the subscription list, so it is time
 to send in any Forth code or tips for the Amiga which you have been
 accumulating, waiting for an opportunity to pass them on. Mail them
 to jax@well with a Subject: header of AFPN SUBMIT. Your submissions
 are necessary to keep the Amiga Forth Programmers' Newsletter coming.

 We are going to try to keep the newsletter short (99 lines or less),
 and post pointers to binaries rather than mailing them around. There
 are more and more sites which offer large collections of Forth files,
 especially in the world of small local BBSes (such as my own, the
 RealTime Control & Forth Board (303) 278-0364 3/12/24 24 hours). We
 will try to keep you posted on developments in that quarter.

 On with the show! Here are some bug fixes you may or may not have seen:

 : JForth STRIP-PATHNAME ;
 \ JU:STRIP-PATHNAME in JForth Professional 2.0 and 2.01 has bug, backs
 \ over filename which possess no path component. Replace definition
 \ with the following and recompile with JF:BUILDSYS. Approved by Delta.

 \ strip any additional 'pathname'
 : STRIP-PATHNAME  \ addr cnt -- addr' cnt' 
    2dup
    2dup +     ( -- adr cnt adr cnt one-past-LastAdr )
    swap 0
    DO
         1-      \ back up one byte
         dup c@  \ get char at that address
          dup ascii / = swap ascii : = or ( is it a path character?)
         ( -- adr cnt adr LastAdr flag )
         ?LEAVE  \ yes, leave the loop with the current address
    LOOP ( -- adr cnt adr FinalAdr )
    2dup -       \ are the addresses different?
    IF
    swap - 1+ >r \ calculate difference in length and save on rstack
    r@ -         \ subtract from original count
    swap  r> +   \ add difference to address
    swap ( -- addr ct)
    ELSE 2drop \ otherwise, leave orig. string if it contained no path
elements
    THEN
 ;

 : A4TH1.5 D2/ ;
 There is a previously-unreported (to my knowledge) bug in Peter
 Appelman's fine PD Forth for the Amiga, A4TH1.5.

 The definition of D2/ on screen 37 of AKernel.blk is wrong.
 The correct code is as follows:

 code d2/   (s d -- d/2 )
    sp )+ d1 move   sp ) d0 move   1 # d1 asr   1 # d0 roxr
    d0 sp ) move   d1 sp -) move   next    end-code

 Change the code, open meta.blk and type   ok   then follow
 instructions to save the metacompiled image as your new A4TH1.5
 image.
-----
This message came from GEnie via willett through a semi-automated process.
Report problems to: dwp@willett.pgh.pa.us or uunet!willett!dwp

ForthNet@willett.pgh.pa.us (ForthNet articles from GEnie) (04/09/91)

Category 14,  Topic 5
Message 3         Sun Apr 07, 1991
R.LAWRENCE10 [Randy]         at 11:53 MDT

[This message had be doubled, so I trimmed out the duplicate stuff.  -dwp]

What sort of stuff are you looking for Jax?

I purchased JForth about 6 months ago but, I haven't had much time to learn
it.  I would dearly love to contribute to this thread but I really cannot do
so until I better understand JForth and the Amiga operating system.

PLEASE keep sending these little morsels of code.  There is at least one
person who appreciates them.


On a slightly different subject:
 Do you know of a way to coax CLONE into generating ".library" files, or files
capable of being put into libraries?  I am experimenting with ways to send
data over radio and I think that having these What sort of stuff are you
looking for Jax?

                                chow,  Randy Lawrence   KG7GI


Forth programmers do it with words
-----
This message came from GEnie via willett.  You *cannot* reply to the author
using e-mail.  Please post a follow-up article, or use any instructions
the author may have included (USMail addresses, telephone #, etc.).
Report problems to: dwp@willett.pgh.pa.us _or_ uunet!willett!dwp

ForthNet@willett.pgh.pa.us (ForthNet articles from GEnie) (05/29/91)

Category 14,  Topic 5
Message 4         Tue May 28, 1991
GARY-S                       at 06:19 EDT
 
                 
  PORTED FROM the WELL =>
              --------

 From jax Tue May 21 22:19:23 1991
 From: jax (Jack J. Woehr)
 Subject: Amiga Forth Programmers' Newsletter
 To: nobody (Jeremy Hillary Boob)
 Date: Tue, 21 May 91 22:18:59 PDT

    _     _   _   _  _     _    ___  _   __ ____
  //\\  //\\//\\ ||//___ //\\  ||_ //\\ ||\\ || ||_|| PROGRAMMERS'
 //==\\// \\// \\||\\_////==\\ ||  \\// ||\\ || || ||  NEWSLETTER
  ---------------------------------------------------------------------
 Issue 91-05 : COMPLEX.F ( JForth); \ Submissions Eagerly Welcomed!
 Subscribe via {hplabs,pacbell,ucb}!well!jax jax@well.sf.ca.us
 with a Subject: header of AFPN SUBSCRIBE.

  \ Complex.F
  \ Complex Floating Point Routines    by Randell Lawrence  KG7GI
  \ Copyright 1991 Randell P. Lawrence
  \ Permission to freely use is herby granted.

 \ I can be contacted at:
  \       GENIE   R.LAWRENCE10
  \       CIS     72300,2606
  \       Packet Radio    KG7GI@WB7ULH.UT.USA.NA

 \ Complex numbers are entered as ordered floating point pairs with
  \ the real part second on the stack, and the imaginary part at the
  \ top.  For magnitude and angle, the magnitude is second on the
  \ stack and the angle is at the top of the stack.

 INCLUDE? F*  JU:FLOAT.FFP
  ANEW COMPLEX

 \ Usefull floating point words
  : F^2       ( r -- r^2)    \ Square floating point number on stack
     FDUP F* ;

 \ Complex number stack manipulation
 : ZDROP     ( z -- ) FDROP FDROP ;
 : ZDUP      ( z -- z z ) FOVER FOVER ;
 : ZSWAP     ( z1 z2 -- z2 z1 ) frot f>r  frot fr> ;
 : ZNIP      ( z1 z2 -- z2 ) ZSWAP ZDROP ;

 : Z!        ( z addr --) DUP >R  FCELL+ F! ( !j)  R> F! ( !real) ;
 : Z@        ( addr -- z) DUP >R  F@ ( @real)   R> FCELL+ F@ ( @j) ;

 : ZVARIABLE  CREATE  2 FCELLS ALLOT  DOES> ;

 : ZCONSTANT  CREATE  HERE 2 FCELLS ALLOT  Z!  DOES> Z@ ;

 : Z>R       ( z --   R: -- z) F>R F>R ;
 : ZR>       ( -- z   R: z --) FR> FR> ;
 : ZR@       ( -- z   R: z -- z) ZR> ZDUP Z>R ;  \ The simple version

 : ZOVER     ( z1 z2 -- z1 z2 z1 ) ZSWAP ZDUP Z>R  ZSWAP ZR> ;
 : ZROT      ( z1 z2 z3 -- z2 z3 z1 ) Z>R  ZSWAP ZR>  ZSWAP ;

  0.0     FCONSTANT F>Z   ( r -- z)   \ create a complex number
  0.0     FCONSTANT J0
  1.0 F>Z ZCONSTANT 1J0   \ return a complex '1'

 : ZNEGATE   ( z -- -z ) FNEGATE FSWAP  FNEGATE FSWAP ;

 : ZCONJUGATE    ( z1 -- z2 ) FNEGATE ;

 : POLAR>RECT    ( Zpolar -- Zrectangular )
  \ x = R * cos(Angle),  y = R * sin(Angle)
     DEG>RAD  ZDUP
     FSIN F*   F>R       \ Imaginary (y)
     FCOS F*   FR>  ;    \ Real      (x)

 : RECT>POLAR    ( Zrectangulr -- Zpolar )
  \ Real = SQRT(X^2 + Y^2),  Angle = ARCTAN(Y/X)
     fover f0< >r
     ZDUP
     FSWAP F/  FATAN   RAD>DEG   F>R     \ Angle
     F^2  FSWAP F^2  F+  FSQRT   FR>     \ Magnitude
     fswap r>                            \ sign correction
     if ( real was a negative number,) fnegate ( result) then fswap
  ;

 \ Use Rectangular notation when using these words

 : Z+        ( z1 z2 -- z3)      \ Add Complex numbers
     FROT F+  F>R F+  FR> ;

 : Z-        ( z1 z2 -- z3)      \ Subtrace complex numbers
     FROT FSWAP F-  F>R F-  FR> ;

 : Z*        ( z1 z2 -- z3)              \ Multiply complex numbers
     RECT>POLAR ZSWAP RECT>POLAR         \ both numbers to polar.
     F>R  FROT F*                        \ Multiply the magnitudes
     FSWAP FR> F+                        \ Add the angles
     POLAR>RECT ;

 : Z/        ( z1 z2 -- z3)      \ Divide complex numbers
     RECT>POLAR ZSWAP RECT>POLAR zswap
     F>R FROT  fswap F/          \ divide the Magnitudes
     FSWAP FR>       F-          \ Subtract the Angles
     POLAR>RECT ;

 : 1/Z       ( z1 -- 1/z1 )      \ Inverse of complex number
     1J0 ZSWAP Z/ ;

 \ End of AFPN 91-05 ... Send in your Amiga Forth Examples!
-----
This message came from GEnie via willett.  You *cannot* reply to the author
using e-mail.  Please post a follow-up article, or use any instructions
the author may have included (USMail addresses, telephone #, etc.).
Report problems to: dwp@willett.pgh.pa.us _or_ uunet!willett!dwp