Skip to content

boriel/pcbasic

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PC-BASIC

A free, cross-platform emulator for legacy Microsoft BASIC applications.

PC-BASIC is a free, cross-platform interpreter for GW-BASIC, BASICA, PCjr Cartridge Basic and Tandy 1000 GW-BASIC. It interprets these BASIC dialects with a high degree of accuracy, aiming for bug-for-bug compatibility. PC-BASIC emulates the most common video and audio hardware supported in their time. PC-BASIC can run (and convert between) ASCII, bytecode and 'protected' (encrypted) .BAS files. It implements floating-point arithmetic in the Microsoft Binary Format (MBF) and can therefore read and write binary data files created by GW-BASIC.

PC-BASIC is free and open source software released under the GPL version 3.

See also the PC-BASIC home page.


Quick Start Guide

This quick start guide covers installation and elementary use of PC-BASIC. For more information, please refer to the full PC-BASIC documentation which covers usage, command-line options and a full GW-BASIC language reference. This documentation is also included with the current PC-BASIC release.

If you find bugs, please report them on the SourceForge discussion page at https://sourceforge.net/p/pcbasic/discussion/bugs/. It would be most helpful if you could include a short bit of BASIC code that triggers the bug.

Installation

Packaged distributions are currently available for Windows XP and above and Mac OSX 10.6 and above. For Debian, Ubuntu, Mint and Fedora Linux an install script is provided in the source distribution.

They can be downloaded from one of the following locations:

On Windows:

  • run the installer
  • to start, click PC-BASIC in your Start menu

On OS X:

  • mount the disk image
  • move PC-BASIC.app to your Applications folder
  • to start, double click the PC-BASIC app

On Linux:

  • untar the archive
  • run sudo ./install.sh
  • to start, click PC-BASIC in your Applications menu or run pcbasic on the command line.

Installation from source

If your system is not supported or you prefer to install from source, download the source distribution and unpack the TGZ archive. The following packages are needed or recommended when installing PC-BASIC from source:

Package OS Status Needed for
Python 2.7.6 all required
PyWin32 Windows required
PyXDG Linux, other required
PyGame 1.9.1 all essential sound and graphics
NumPy all essential sound and graphics
PySerial all recommended physical or emulated serial port access
PyParallel Windows, Linux optional physical parallel port access
Pexpect OSX, Linux, other optional native SHELL

In this list, other refers to operating systems other than Windows, Linux or OSX.

On Windows, you should download all the required packages from the project web sites linked above.

On OSX, there are several versions of Python 2.7 and all downloads need to match your version and CPU architecture. It's a bit tricky, I'm afraid. The easiest option seems to be installing both Python and PyGame through MacPorts or Homebrew.

On Linux distrubutions with APT or DNF (including Debian, Ubuntu, Mint and Fedora), the install script will automatically install dependencies if it is run with root privileges.

The install script can also be used on other Unix systems or when not installing as root. Python 2.7 usually comes pre-installed; the other packages can often be installed through your package manager. For example, on Debian-based systems:

    sudo apt-get install python2.7 python-xdg python-pygame python-numpy python-serial python-pexpect python-parallel xsel

On Fedora:

    sudo dnf install python pyxdg pygame numpy pyserial python-pexpect xsel

On FreeBSD:

    sudo pkg install python27 py27-xdg py27-game py27-numpy py27-serial py27-pexpect xsel

Note that PyParallel is not available from the Fedora and FreeBSD repos; you'll need to install from source or do without access to physical parallel ports. It is not needed for printing to LPT1.

The official Pygame release 1.9.1 has a bug in its handling of copy & paste on X11-based systems. If you run into this, install one of the xsel or xclip utilities and PC-BASIC will work around the issue.

Pygame issues on Linux

If you get the following error when running PC-BASIC:

Fatal Python error: (pygame parachute) Segmentation Fault
Aborted (core dumped)

then you've run into a bug in the PyGame package for your distribution. It appears the 1.9.1 release of PyGame (as currently distributed with Ubuntu) has a few issues; another one is an annoying stream of debug messages on the console that occurs when you use a joystick.

Unfortunately, until a newer build of PyGame is released with major distributions, the only workaround that I know of is to install PyGame from current development sources.

  1. Install dependencies. These are the packages I needed on Ubuntu 15.04:

     sudo apt-get install mercurial libpython-dev python-numpy ffmpeg libsdl1.2-dev libsdl-ttf2.0-dev libsdl-font1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libportmidi-dev libswscale-dev libavformat-dev libftgl-dev libsmpeg-dev
    
  2. Make a working directory for your build, change into it and get the source

     hg clone https://bitbucket.org/pygame/pygame
    
  3. Configure

     ./configure
    

    The script will notify you if you're missing dependencies.

  4. Compile

     make
    
  5. Install into your /usr/local tree

     sudo make install
    

See also the PyGame source repository on BitBucket.

Usage essentials

Double-click on pcbasic or run pcbasic on the command line to start in interactive mode with no programs.
A few selected command-line options:
pcbasic PROGRAM.BAS runs PROGRAM.BAS directly.
pcbasic -h shows all available command line options.

If you're running PC-BASIC from a GUI, you can set the required options in the configuration file instead. The configuration file is a file named PCBASIC.INI, stored in the following location:

OS Configuration file location
Windows XP C:\Documents and Settings\ (your username) \Application Data\pcbasic
Windows 7 C:\Users\ (your username) \AppData\Roaming\pcbasic
OS X ~/Library/Application Support/pcbasic
Linux ~/.config/pcbasic

For example, you could include the following line in PCBASIC.INI to emulate IBM PCjr Cartridge Basic instead of GW-BASIC 3.23:

preset=pcjr  

For a full list of options, run pcbasic -h.

Basic BASIC commands

PC-BASIC starts in interactive mode, where you can execute BASIC statements directly. A few essential statements:
SYSTEM exits PC-BASIC.
LOAD "PROGRAM" loads PROGRAM.BAS but does not start it.
RUN starts the currently loaded program.
RUN "PROGRAM" loads and starts PROGRAM.BAS.

A full CC-licensed GW-BASIC language reference is included with PC-BASIC. This documentation aims to document the actual behaviour of GW-BASIC 3.23, on which PC-BASIC is modelled. Please note that the original Microsoft help file, which can be found on the internet, is rather hit-and-miss; GW-BASIC often behaves differently than documented by Microsoft.

Free BASIC compilers and saner dialects

If you're starting a new project in BASIC, please consider one of the more sensible free versions of the language, such as FreeBasic, QB64 or SmallBASIC. Under FreeDOS, you can use the Bywater BASIC interpreter.

GW-BASIC links and downloads

Norman De Forest's description of the tokenised file format is where this project started.
Dan Vanderkam's online GW-BASIC decoder was another inspiration.

BASIC program downloads and further links can be found on the following pages.

About

PC-BASIC - A free, cross-platform emulator for GW-BASIC and other legacy Microsoft BASICs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 64.2%
  • HTML 33.7%
  • Other 2.1%