home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-02 | 4.6 KB | 123 lines | [TEXT/R*ch] |
- *chipmunk-basic-29b5-ppc.hqx README*
-
- Every *real* personal computer should come with a BASIC interpreter.
- Here's my contribution for the new Power Macintosh machines. It's a
- line number based BASIC interpreter similar to the BASIC that came
- with the Apple ][+ (that's Apple ][, *NOT* Mac II for you newcomers).
- Version 2.9b5 is a fat binary that runs on both Power Macs and 68k Macs.
-
- Chipmunk Basic is a simple Basic interpreter for the Macintosh. It is
- similar to the line number based MumbleSoft BASIC interpreters of circa
- 1980. Its roots are from a pascal program, basic.p, that was part of
- the test input suite to p2c, a pascal to c translator. Both basic.p
- and p2c should be in the net.sources archives somewhere (I no longer
- have copies). I cleaned up the translated source, ported it to the Mac
- and added some Mac specific features.
-
- Chipmunk Basic 2.9 is being distributed as freeware (but only for those
- who don't believe that using the BASIC language causes brain damage. :-)
- Please note that there are far better versions of BASIC available
- commercially. Just none that run PowerPC native and were available for
- the Mac as of March 14th. It's not very fast as BASIC systems go. But
- it does run 110 to 150 times faster on a PowerMac 7100/66 than Microsoft
- BASIC 1.0 did on the original Mac 128. Have fun. And please email any
- bugs reports.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; not even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE.
-
- 2.9b0 first native PowerPC port.
- 2.9b2 virtual memory crash bug fixed.
- 2.9b4 fat binary.
- 2.9b5 allows color Picts to be copied.
-
- ---
- Quick Reference for Chipmunk Basic v2.9 - PPC Macintosh version 94-Mar-14
- ported by Ronald H. Nicholson, Jr. rhn@netcom.com
-
- - The interpreter includes an old fashioned line number based editor.
- - The usual amount of numeric and string operators and functions and
- file I/O statements are available.
- - The two variable types are long floats and strings with a maximum length
- of 254 characters. Variable names can be up to 32 characters long and
- are case insensitive.
- - Unusual features include:
- The ability to play accurate morse code through the sound manager.
- Some simple graphics commands in a separate graphics window.
-
- Operator, functions and statements include:
-
- + - * / ^ mod and or xor not
- sqr() log() exp() abs() sgn() sin() cos() tan() log() arctan()
- int() rnd() peek() val() asc() len() fre
- mid$() right$() left$() str$() chr$()
- let goto gosub return for to step next while wend dim data read def
- rem input print open input# output append as close# load save run
- inkey$ date$ time$
- timer eof() peek() poke
- stop end exit quit renum new
- moveto lineto gotoxy graphics() mouse() cls sound morse
-
- Some Examples:
-
- open "filename" for output as #1 : print #1, a$ : close #1
- c$ = a$ + b$ : rem string concatenation
-
- graphics(0) : moveto 10,10 : lineto 110,80 : rem graphics window
- gotoxy 0,10 : print "here" : rem text window
- sound 440,0.5,30 : rem freq, seconds_duration, vol 0-100
- sound 0,128 : rem play snd resource 128
- morse "CQ DE N6YWU",16,40,13,700 : rem dot_wpm,vol,letter_wpm,freq
- open "SFGetFile" for input as #2 : rem "SFPutFile" works for output
-
- some experimental graphics commands:
- (The graphics commands in version 2.9b are beta test and may be buggy.)
-
- GRAPHICS 0 // init graphics window
-
- graphics MOVETO x,y // MoveTo
- graphics LINETO x,y // LineTo
- graphics OVAL x,y // oval x wide by y high
- graphics DRAWTEXT a$ // DrawText
-
- graphics RECT x1,y1,x2,y2 // FrameRect
- graphics FILLRECT x1,y1,x2,y2,pat# // PaintRect
- graphics OVAL x1,y1,x2,y2 // FrameOval
- graphics FILLOVAL x1,y1,x2,y2,pat# // PaintOval
- graphics PENSETUP xsize, ysize, [ mode, pat# ]
- graphics COLOR i // set RGBForeColor by index
- graphics COLOR r,g,b // red green blue 0-100
-
- graphics TEXTSETUP f, s, m // font, size, mode
-
- SPRITE n x, y, id // sprite n @ x,y using ICN# id
- // n from 1 to 15, 1 in frontmost plane
- sprite n UP x // sprite #n move up x pixels
- sprite n DOWN x
- sprite n LEFT x // move LEFT (not turn as in Logo!)
- sprite n RIGHT x
- sprite n TURN d // turn CCW d degrees
- sprite n FORWARD x // move forward x pixels
- sprite n PENUP
- sprite n PENDOWN
-
- ---
- 1 rem sieve benchmark
- 2 t = timer
- 3 dim f(8194)
- 4 for i = 0 to 8191 : f(i) = 1 : next i
- 5 s = 8191
- 6 for i = 0 to s
- 7 if f(i) = 0 then goto 11
- 8 p = i+i+3
- 9 for k = i+p to s step p : f(k) = 0 : next k
- 10 c = c+1
- 11 next i
- 12 print c;" primes found in ";
- 13 t = timer-t
- 14 print t;" seconds"
- 15 end
-
- --- cut here ---
-