Applesoft BASIC Emulator for Mac OS X?

After reading the article , I developed an urge to code in one of the original unstructured line programming varieties of BASIC (Beginner's All-purpose Symbolic Instruction Code) (as opposed to Visual BASIC or an alternative structured programming language) on Mac OS X. I once wrote a checkbook accounting program in N80-BASIC on the old NEC PC-8001 mkII, and would like to rewrite it in a line programming BASIC language on Mac OS X.

The article mentioned Chipmunk Basic for Mac OS, which piqued my interest--I am definitely going to get my hands wet with this one over the coming weekend.

Nevertheless, I'd still rather nostalgically rather program in either NEC's N80-BASIC or Apple's Applesoft BASIC. Does anybody know where I can find an emulator for one of these varieties of BASIC that will run on Mac OS X on a PowerPC processor (without requiring an NEC PC-8001 mkII or Apple II system unit to create a ROM image)?

-- DekuDekuplex

PowerBook G4 17-inch [Rev. A] Mac OS X (10.2.x) Mac OS X (10.2.8)

Posted on Sep 18, 2006 7:39 PM

Reply
13 replies

Sep 21, 2006 2:08 AM in response to iMac eMac-addict

In addition, I have discovered two sites where sourcecode for games in BASIC is either listed or downloadable:

* Classic Basic Games Page (contains links to sourcecode in IP BASIC, a minimalist version of classic BASIC written by Sam [the author of the homepage], where the sourcecode is easily customizable)

* Classic BASIC Games (contains a link to download sourcecode for a set of games written in Microsoft Level 2 BASIC for the TRS-80, together with their interpreter, as well as another link to download sourcecode for this interpreter [the games and their interpreter both run as native Windows apps; nevertheless, the sourcecode is simple and easily customizable])

Particularly noteworthy is an entry for the sourcecode for the original Star Trek. Star Trek is unusual as a game written in classic BASIC because it can be simultaneously useful as a learning tool to port/customize, and worthy as a game in its own right. I used to spend hours traveling on the train in the early 1980's to and from computer shops just to sit down and play a version written in a dialect of BASIC. Nevertheless, the sourcecode is still short enough to be understood in its entirety, and easily portable/customizable.

A useful plan of action for using the above-referenced sourcecode as a learning tool would be to understand the examples, then port them to Chipmunk BASIC, then customize the ported examples, and finally to port them to other languages, such as Python, Java, C, or C++ (or even to such semi-functional, functional, or logic languages as Scheme, Haskell, or Prolog, if feasible). This would be a much more entertaining approach than just getting a textbook and learning how to code, say, Fibonacci heaps in these languages.

-- DekuDekuplex

PowerBook G4 17-inch [Rev. A] Mac OS X (10.2.x) Mac OS X (10.2.8)

Sep 19, 2006 1:46 PM in response to Daniel Macks

a2central.com may have some Applesoft emulators for
you. Perl has a Language::Basic module, so you could
learn a bit of perl on the way to installing a BASIC
interpretter (not Applesoft-specific). Applesoft
itself is copyrighted, so different emulators have
different levels of compatibility with the original
AppleSoft implementation.


Wow, an Apple II site! Fascinating....

It didn't have what I was looking for, but the mere existence of a current site supporting such a legacy computer is highly encouraging.

Thank you very much!

-- DekuDekuplex

PowerBook G4 17-inch [Rev. A] Mac OS X (10.2.x) Mac OS X (10.2.8)

Sep 19, 2006 5:47 AM in response to iMac eMac-addict

Hi Deku,

I agree with Bill, I think Python can give what you're looking for. The only math operator that Basic has that is lacking in Python is exponentiation: the ^ operator in Basic, but it is a function call in Python pow(x,y).
I know a professor who taught an algorithms class which at the end he said: "All the pseudo-code i gave in class is actually written in a program laguage called Python!"
Here is his website:
http://www.cs.jhu.edu/

Why you think a programming language such as Python doens't fit your needs?

Antonello

PS: I was told the Fortran has matrices operations as primitives. Can anyone confirm this?

Sep 18, 2006 9:07 PM in response to iMac eMac-addict

Johnny should learn python or ruby or even shell scripting. If you want to learn an archaic procedural language, nothing beats FORTRAN. It is still used today, for the simple reason that it is actually really quite good at what it does.

What you need is a compiler, not an emulator. I just checked FINK and it doesn't seem to have one. So you'll just have to learn python instead. Sorry.

Sep 18, 2006 9:22 PM in response to Bill Scott

Johnny should learn python or ruby or even shell
scripting. If you want to learn an archaic
procedural language, nothing beats FORTRAN. It is
still used today, for the simple reason that it is
actually really quite good at what it does.

What you need is a compiler, not an emulator. I just
checked FINK and it doesn't seem to have one. So
you'll just have to learn python instead. Sorry.


Thank you for your reply, but I'm afraid that Fortran, while a worthy language in its own right, is simply not suited for the purpose described in the article.

To quote the author of the article, David Brin:

Those [math] textbook exercises were easy, effective,
universal, pedagogically interesting -- and nothing even
remotely like them can be done with any language other than
BASIC. Typing in a simple algorithm yourself, seeing
exactly how the computer calculates and iterates in a
manner you could duplicate with pencil and paper -- say,
running an experiment in coin flipping, or making a dot
change its position on a screen, propelled by math and
logic, and only by math and logic: All of this is
priceless.


The purpose is not "to learn an archaic procedural language," but rather "to learn a simple, relatively unstructured algorithmic language that allows straightforward, immediate coding and unfetteredly illustrates the principles of pure math and logic without unnecessary translation into the structure of the programming language itself." The closest example that I can think of is Scheme, but that language requires thinking recursively to do anything significant. BASIC doesn't.

-- DekuDekuplex

Sep 19, 2006 7:56 AM in response to Bill Scott

Bill,

Nice! and it takes roots too!(I actually don't know the word for the operation in English since I've learned math in a different language).

I've heard about the operator ** for exponentiation when I was learning BASIC some long time ago. I doubt it was Python. I just cannot recall which language was that. I just tried the pow(x,y) function before my previous post... I should have poked with it a little bit more 😉

Antonello

Sep 19, 2006 1:33 PM in response to Antonello Cruz

I know a professor who taught an algorithms class
which at the end he said: "All the pseudo-code i gave
in class is actually written in a program laguage
called Python!"
Here is his website:
http://www.cs.jhu.edu/


Could you please tell me the name of the professor? I clicked on the link, but couldn't figure out where to go there.

Why you think a programming language such as Python
doens't fit your needs?


I haven't tried out Python enough, so I don't know for sure. However, (the line-programming version of) BASIC was the very first language that I was exposed to, and programming in it brings back memories of carrying out such fun and simple tasks as moving a character across the screen while activating the beep function, or moving dots across the screen, or displaying funny greetings in multiple colors at specific locations on the screen.

For example, on an 80x25 character, 8-color screen, I used to write small, silly subroutines similar to the following one to display the user's name in different colors successively at the center of the screen (I'm writing this subroutine from my memory of BASIC, so please excuse me for any grammatical errors in the subroutine):

10 REM *************************************
20 REM * INTRODUCE THE COMPUTER TO THE USER, *
30 REM * AND PRINT THE USER'S NAME *
40 REM * IN MULTIPLE COLORS *
50 REM * COPYRIGHT(C) 2006, BY DEKUDEKUPLEX *
60 REM *************************************
70 CLEAR;
80 LOCATE 30, 10;
90 COLOR 4;
100 PRINT "RAINBOW ";
110 COLOR 5;
120 PRINT "NAME ";
130 COLOR 6;
140 PRINT "PROGRAM";
150 PRINT CHR$(13):PRINT CHR$(13);
160 COLOR 7;
170 PRINT "HELLO! MY NAME IS DATA; WHAT IS YOUR NAME?";
180 PRINT CHR$(13);
190 INPUT NAME$;
200 LGREET = LENGTH("GREETINGS, ");
210 LNAME = LENGTH(NAME$);
220 XPOS = (80-(LGREET + LNAME))/2;
230 LOCATE XPOS, 40;
240 PRINT "GREETINGS, ";
250 FOR I = 1 TO 7
260 LOCATE (XPOS + 11, 40)
270 COLOR I
280 PRINT NAME$
290 WAIT 500
300 NEXT I;
310 BEEP 20;
320 END;

The problem with trying to write this kind of subroutine in a modern computer language is that most modern computer languages try to be hardware-independent, and this makes writing simple, display- and sound-focused subroutines, such as simply displaying a user's name in multiple colors at a specific point on the screen and then beeping for a specific number of milliseconds, unnecessarily complicated.

I'm not trying to compute anything at this point; I'm just trying to have fun by emulating a simple conversation with the computer while exploring the elementary visual and audio capabilities of the computer. But modern computer languages tend to make this kind of task unnecessarily difficult, because they tend to relegate input/output to specialized subroutines that require calling windows and invoking specialized libraries.

The same problem arises if I try to move a character across the screen as it changes color; or if I try to move a dot across the screen; or if I try to plot lines in random locations and then draw circles in different colors centering on the points of intersection, for example.

BASIC didn't have this problem, and made this kind of silly, nonsense programming just to get exposed to writing simple code a lot of fun. The user didn't need to think about such issues as variable/function types and scope, pointers, and memory management from the very first line. While such issues are important for writing medium to large size programs, they are not important for silly, ten-line programs designed just to play around and have some fun. Having some, even silly, fun is necessary to getting started for some types of people.

-- DekuDekuplex

PowerBook G4 17-inch [Rev. A] Mac OS X (10.2.x) Mac OS X (10.2.8)

Sep 19, 2006 2:49 PM in response to iMac eMac-addict

Chipmunk Basic for Mac OS is fun! I've just started trying it out, and it allows me to do simple, fun things such as making the computer speak, making the computer emit MORSE code, printing letters at specific locations in the window, renaming the window title, drawing black circles in the graphics window, moving the graphics pen, drawing concentric ovals in multiple colors in the graphics window, printing my name in the graphics window in color, and other things that I haven't yet tried out!

This is much closer to what I was looking for as a starting point for elementary programming than anything else that I've seen in years.

Elementary multimedia subroutines involving playing various sounds and drawing different graphics were what originally attracted me to programming in the first place, back in 1981. Such tasks were much easier to do then, in computer-specific dialects of BASIC, than now, in computer-independent dialects of other higher-level programming languages.

Chipmunk Basic captures some of the original fun of BASIC multimedia programming. Yea! This is fun! Now I remember why I used to like programming!

Now to find a good BASIC textbook, preferably for this dialect, with some examples of simple, fun games that I can easily understand and rewrite into something better--preferably a small MUD.

I'm still looking for other dialects of BASIC and matching textbooks (either online or offline), preferably with simple, short, fun BASIC games (preferably adventure games or MUD's) that can be easily rewritten into something better to deepen understanding of programming. If anybody can find anything, please post a suggestion in this thread!

-- DekuDekuplex

PowerBook G4 17-inch [Rev. A] Mac OS X (10.2.x) Mac OS X (10.2.8)

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Applesoft BASIC Emulator for Mac OS X?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.