User's guide

The working environment

The first thing you'll see when starting PC-BASIC is the working environment. Like GW-BASIC, but unlike practically all modern compilers and interpreters, PC-BASIC's working environment serves both as a development environment and as a canvas on which to execute BASIC commands directly. With a few exceptions, practically all commands that can be run in the working environment can be used in a program, and vice versa.

The default PC-BASIC screen has 25 rows and 80 columns. The 25th row is used by PC-BASIC to show keyboard shortcuts, which means you can't use it to type on. In some video modes, there are only 40 or 20 columns.

Logical lines exceed the width of the physical row: if you keep typing beyond the screen width, the text will wrap to the next line but PC-BASIC will still consider it part of the same line. A logical line can be at most 255 characters long; if you type more than 255 characters, it will ignore the remainder. A line can also be wrapped by a line-feed, entered with Ctrl+Enter.

If you press Enter, PC-BASIC will attempt to execute the logical line on which the cursor is placed as a command. When the command is executed correctly, PC-BASIC will display the prompt Ok. If there is an error, it will display an error message followed by Ok. If the line starts with a number, it will be stored as a program line. No prompt is displayed.

Special keys

The following keys have a special effect in the working environment:

or Ctrl+6 Move the cursor up, except at the top row.
or Ctrl+- Move the cursor down, except at row 24.
or Ctrl+] Move the cursor left. The left edge of the screen wraps around, except at the top row.
or Ctrl+/ Move the cursor right. The right edge of the screen wraps around, except at row 24.
Ctrl+ or Ctrl+B Move to the first letter of the previous word. Words consist of letters A—Z and figures 0—9.
Ctrl+ or Ctrl+F Move to the first letter of the next word.
Tab or Ctrl+I Move the cursor to the next tab stop. Tab stops are 8 columns wide.
Backspace or Ctrl+H Delete the character left of the cursor, shift all further characters on the logical line one position to the left and change the attributes of those characters to the current attribute. At the left edge of the screen, this does the same as Del.
Del or Ctrl+Backspace Delete the character at the cursor and shift all further characters one position to the left, changing attributes to current.
Esc or Ctrl+[ Delete the current logical line.
Ctrl+End or Ctrl+E Delete all characters from the cursor to the end of the logical line.
Ctrl+Break or Ctrl+C or Ctrl+Scroll Lock Jump to the first column of the next line, without executing or storing the line under the cursor.
Enter or Ctrl+M Execute or store the current logical line. The complete line on the screen is considered part of the command, even if you did not type it. A line starting with a number is stored as a program line.
End or Ctrl+N Move the cursor to the first position after the end of the logical line.
Home or Ctrl+K Move the cursor to the top left of the screen.
Ctrl+Home or Ctrl+L Clear the screen and move the cursor to the top left of the screen.
Ctrl+Enter or Ctrl+J Move to the first column of the next line, connecting the two lines into one logical line.
Ctrl+G Beep the speaker.
Pause or Ctrl+Num Lock Pause. Press another key to resume. The latter key press will not be detected by BASIC.
Ctrl+Prt Sc Toggle echoing screen output to the printer (or other device attached to LPT1:).
Shift+Prt Sc Print the screen.
Ins or Ctrl+R Toggle insert mode. In insert mode, characters are inserted rather than overwritten at the current location. If insertion causes the line to extend the physical screen width, the logical line extends onto the next line. Arrow keys exit insert mode.

When a program is started, the commands in the program are followed until the program quits and returns to direct mode or until user input is required. When a program is running, a few keys have immediate effect:

Pause or Ctrl+Num Lock Pause execution. Press another key to resume.
Ctrl+Break or Ctrl+Scroll Lock Stop execution and return to direct mode. A Break message is printed.
Ctrl+C If ctrl-c-break=True: stop execution and return to direct mode. A Break message is printed.

If user input is required by the statements INPUT, LINE INPUT, or RANDOMIZE, most keys have the same effect as in direct mode. The following keys have a different effect:

Ctrl+Break or Ctrl+C or Ctrl+Scroll Lock Stop execution and return to direct mode. A Break message is printed.
Enter Finish input and return to the previous mode.

Keyboard shortcuts

The function keys and the alt key can be used as keyboard shortcuts for some keywords. The default values for the function keys are:

F1 LIST
F2 RUNEnter
F3 LOAD"
F4 SAVE"
F5 CONTEnter
F6 ,"LPT1:"Enter
F7 TRONEnter
F8 TROFFEnter
F9 KEYSpace
F10 SCREEN 0,0,0Enter

The function key shortcuts can be redefined with the KEY statement. The shortcuts are displayed at the bottom of the screen.

The following keywords can be entered with Alt+first letter. The Alt shortcuts cannot be redefined.


Alternative keys

In PC-BASIC, the F12 key can be used to enter special keys that are not present on some keyboards.

F12+B Ctrl+Break
F12+P Pause
F12+C Caps Lock
F12+N Num Lock
F12+S Scroll Lock
F12+H Print Screen

The F12 key can also be used in combination with the regular number keys and arrow keys to enter numbers from the numeric keypad. The F12 combinations are not present in GW-BASIC.

Furthermore, as in GW-BASIC, the Alt key can be used to enter characters by their code points (ASCII values). This is done by pressing the Alt key and typing the code point as a decimal value on the numeric keypad, then releasing the Alt key.


Clipboard operations

Unlike in GW-BASIC, you can copy and paste text to the clipboard. This can be done with the mouse or with the F11 key.

Operating the clipboard with the mouse works in the style of X11: Left button is select and copy; middle button is paste.

The following keyboard combinations also operate the clipboard:

F11+ Select a screen region.
F11+A Select all.
F11+C Copy to clipboard.
F11+V Paste from clipboard.

Emulator control keys

In PC-BASIC, F11+F toggles fullscreen mode.

Compatibility

Some key combinations may have a different effect than described above, depending on the operating system and the choice of interface to use with PC-BASIC.

  • Certain key combinations will be interpreted by the operating system or window manager and cause special actions. For example, on most systems, Alt+F4 will terminate PC-BASIC unless the prevent_close option is set; F1 may open your operating system's help system. It may be possible to avoid some of these effects by using the graphical interface in full-screen mode.
  • In the command-line interface on Windows, Ctrl+C terminates PC-BASIC.
  • In the command-line interface on Linux and Mac, Ctrl+D terminates PC-BASIC.

Programs and files

PC-BASIC can hold one BASIC program at a time in memory. To enter a program line, start with a line number and enter BASIC commands after that. The maximum length of a program line is 255 characters, including the line number and any spaces. The program line will not be immediately executed, but stored in the program. Program lines are sorted by line number, so that line 10 is executed before line 20. All program lines must have a line number. Line numbers range from 0 to 65535 inclusive. It is not possible to enter a line number higher than 65529, but these can exist in loaded programs. Within one program line, statements are separated by colons :.

To run the program, type the command RUN. PC-BASIC will now execute all program lines in order inside the working environment. You cannot move the cursor around or enter commands while the program is running. If and when the program finishes, it will return control of the working environment to you. You can interrupt a program at any time by using one of the key combinations Ctrl+Break or Ctrl+Scroll Lock. The program will stop immediately, print a Break message and return control to you.

In GW-BASIC, you can not use Ctrl+C to interrupt a running program. However, many modern keyboards do not have a Break or Scroll Lock key, which would make it impossible to interrupt a program that does not exit. Therefore, by default, PC-BASIC treats Ctrl+C as if it were Ctrl+Break. Set the option ctrl-c-break=False if you prefer the GW-BASIC style behaviour. When using the text-based or command-line interface, this option is ignored.

A program can be stored on a drive by using the SAVE command, in one of three ways:

  1. Plain text, readable by any text editor: SAVE "MYPROG",A
  2. Tokenised, taking up less storage space: SAVE "MYPROG"
  3. Protected, which is an encrypted format: SAVE "MYPROG",P

In all three cases, the program will be written to the current working directory with the name MYPROG.BAS.

PC-BASIC can read and write Protected files created by GW-BASIC. Unlike GW-BASIC, however, it does not disable accessing the unencrypted contents of the file. The encryption used by GW-BASIC has been broken many decades ago, so Protected mode offered little protection anyway; disallowing access is a small security hazard as it would allow someone to send you a program that you cannot inspect before running it. However, it is possible to disable access of protected files by enabling the option hide-protected.

You can read a program file into memory with LOAD "MYPROG". This will erase the program currently in memory and replace it with the one read from the current working directory. To access files in a different directory, specify a path from the current directory. The path specification follows DOS conventions. The only valid path separator is the backslash \. For example, LOAD "PROGRAMS\MYPROG".

You can load or run a program immediately on starting PC-BASIC by using the load or run options. For example,

pcbasic --run=MYPROG.BAS

The arguments to these options can be provided as PC-BASIC paths or as paths in the standard form for your operating system.

PC-BASIC can be used to convert between the three program formats: either by loading the program and saving in your desired format, or from the command line using the convert option. To convert a tokenised or protected file to plain text you could use, for example:

pcbasic --convert=A PROGRAMP.BAS PROGRAMA.BAS

Accessing your drives

PC-BASIC emulates DOS disk devices, which are referred to by drive letters such as Z:. One of the drive letters is the current device.

On Windows:

  • By default, PC-BASIC disk devices will agree with Windows drive letters at the start of the PC-BASIC session.
  • If PC-BASIC is started from the start menu shortcut, the current device will be your Documents folder (or My Documents on some versions of Windows). You can change this location by setting the shortcut's Start In folder.
  • If PC-BASIC is started from the command prompt, the current device will be set to the current working directory of the command prompt.
  • If PC-BASIC's current device or Start In folder is changed to a system folder such as C:\Program Files\PC-BASIC, Windows will move files written there to %LocalAppData%\VirtualStore instead. This is best avoided.
  • Note that PC-BASIC's DOS disk devices are not the same thing as Windows drive letters. The device C: on PC-BASIC is not always your Windows C: drive. By default, Windows drive letters are mapped to PC-BASIC devices at the start of the PC-BASIC session. However, if you use the mount option; or if Windows drive letters change while PC-BASIC is running (through e.g. net use or Map Network Drive operations), they will no longer agree.

On other systems:

  • By default, Z: will point to the current working directory from where PC-BASIC was started. It will be the current device.
  • If started from a menu or app package, this will usually be your home directory ˜.

This current device is where files will be saved to and loaded from in BASIC if you do not specify another device. You can change the current device using the current-device option in the configuration file or on the command prompt.

You can map drives and other file system locations as PC-BASIC devices by using the mount option. For example, on Windows, the option mount=A:C:\Users\Me\BasicFloppy will make the folder C:\Users\Me\BasicFloppy available as PC-BASIC's A: device. On other platforms, an example mount option could look like mount=A:/home/me/BasicFloppy which would make the directory /home/me/BasicFloppy available as PC-BASIC's A: device.

PC-BASIC uses DOS conventions for filenames and paths. These are subtly different from Windows short filename conventions and not-so-subtly different from Unix conventions. This may lead to surprising effects in the presence of several files that match the same DOS name. To avoid such surprises, it's best to run PC-BASIC in a working directory of its own and use all-caps 8.3 format for all files.


Compatible BASIC files

Many BASIC dialects use the same extension .BAS, but their files are not compatible. PC-BASIC runs GW-BASIC program files only. Some tips to recognise GW-BASIC programs:

  • GW-BASIC files stored as text are plain text files with line numbers.
  • Tokenised files are binary files that start with magic byte &hFF.
  • Protected files are binary files that start with magic byte &hFE.

In particular, QBASIC files (which have no line numbers) and QuickBASIC files (magic byte &hFC) will not run.

PC-BASIC will accept both DOS and Unix newline conventions for programs stored as plain text. This behaviour is different from GW-BASIC, which only accepts text files with CR LF line endings. As a consequence, in exceptional cases where a program line is continued through LF correct GW-BASIC text files may not be loaded correctly. If you encounter such a case, use the soft-linefeed option to enable GW-BASIC behaviour. If soft-linefeed is enabled, text files in standard Unix format (LF line endings, no end-of-file character) will fail to load, as they do in GW-BASIC. On Linux or Mac, use a utility such as unix2dos to convert programs saved as text files before loading them. When saving as text, PC-BASIC always uses CR LF line endings and &h1A at end-of-file.


Packages

PC-BASIC can run packaged programs. A package is simply a directory or zip archive. The directory or zipfile contents will be loaded as the current working directory. If a configuration file named PCBASIC.INI is present inside this directory, its settings are loaded; usually, one of those settings will be a run argument linking to a BASIC program enclosed in the archive or directory. PC-BASIC will recognise zipfiles regardless of their extension. A suggested extension for PC-BASIC packages is .BAZ. Packages are a convenient choice if a program needs to change many PC-BASIC options to function as desired, or if it needs a particular working directory setup.

Zipfile packages are unpacked to a temporary directory each time they are loaded. The temporary directory is removed when PC-BASIC closes. With zipfile packages, it is therefore not possible to save files and re-open them on the next run of the package.


Cassette tapes

The CAS1 device interfaces with the cassette tape emulator. Tapes were never very popular on the IBM PC, and indeed only available with the original PC and the PCjr. There are not many IBM PC cassettes in the wild. However, should you come across one, all you have to do to read it with PC-BASIC is record it into a .WAV (RIFF WAVE) file and attach it to the CAS1: device with the cas1=WAV:filename option. You can also generate your own tape images and store your programs on it. WAV files generated by PC-BASIC are large but very easily compressed in a ZIP archive; this works better and leads to smaller files than transcoding to a lossy audio format like MP3.

As an alternative to .WAV, you can store tapes in CAS format. This is simply a bit-dump of the tape and is interchangeable with tape images for the PCE IBM PC emulator.

Previous versions of PC-BASIC included support for BASICODE cassettes; this has been discontinued in favour of a separate BASICODE decoder. Use this decoder to convert the BASICODE program to PC-BASIC format before loading it into PC-BASIC.


Security

PC-BASIC makes some default choices with basic security in mind, but does not sandbox its programs in any meaningful way. BASIC programs have more or less full access to your computer. You should treat them with the same caution as you would shell scripts or binaries. Therefore, do not run a program from the internet that you have not inspected first using LIST or pcbasic --convert=A filename on the command line. You wouldn't just download an executable from the internet and run it either, right?


Connecting to peripherals

Printing

You can print from PC-BASIC programs by accessing the LPT1: device. PC-BASIC will send the output to your operating system's default printer, unless you change the lpt1= option. To print through a printer named MyPrinter, set lpt1=PRINTER:MyPrinter. You can also attach printers to the LPT2: and LPT3: devices.

The output will be sent to the printer when one of the following happens: a file open to LPT1: is closed, a program terminates, or PC-BASIC is closed. If you prefer, you can instead send every page separately to the printer by setting lpt1=PRINTER:MyPrinter:page. You can even send every line separately, but this only makes sense on a tractor-fed printer (as was common in GW-BASIC's heyday).

It's easy to print to a file instead of a printer: set lpt1=FILE:output.txt to send all LPT1: printer output to the text file output.txt.

The printing statements LPRINT and LLIST always send their output to PC-BASIC's LPT1: device.

The presentation of printed documents is left to your operating system: it will be the default presentation of text files. If you wist to change the way documents are printed, please refer to your OS's settings.

  • On Windows, text files are printed the same way as would happen when you drag a text file and drop it on the printer's icon. That means the formatting is handled by the application associated to .txt files; usually this is notepad.exe. To change the way PC-BASIC documents are printed, change the page setup in that application. You will need to set a printer font that includes the characters you need to print.
  • On Unix systems, PC-BASIC will use the paps utility if it is available; this will automatically select fonts that support the characters you need.

Serial and parallel ports

PC-BASIC provides the serial devices COM1: and COM2:. To make use of these, you need to attach them to a communications port on your computer with the com1= or com2= option. To attach to the first physical serial port, set com1=PORT:0 (or, alternatively, com1=PORT:COM1 on Windows or com1=PORT:/dev/ttyS0 on Linux). If you do not have a serial port, you can emulate one by sending the communications over a network socket: set com1=SOCKET:localhost:7000 and all COM1: traffic will be sent through socket 7000.

To access a parallel port, attach it to one of LPT1:, LPT2: or LPT3:. For example, set lpt2=PARPORT:0 to attach your computer's first parallel port to LPT2:.


Changing the interface

Emulation targets

By default, PC-BASIC emulates GW-BASIC on a system with VGA video capabilities. However, it can emulate several other setups, which differ from each other in terms of video and audio capacity, fonts, memory size, as well as available BASIC syntax. The easiest way to set the emulation target is by using a preset option. For example, run pcbasic --preset=pcjr. Other available emulation target presets are:

PresetEmulation target
pcjr IBM PCjr with Cartridge BASIC, including PCjr video and 3-voice sound capabilities and extended BASIC syntax.
tandy Tandy 1000 with GW-BASIC, including Tandy video and 3-voice sound capabilities and extended BASIC syntax.
olivetti Olivetti M24 or AT&T PC 6300.
cga IBM or compatible with Color/Graphics Adapter and a composite monitor. This enables composite colorburst emulation.
ega IBM or compatible with Extended Graphics Adapter.
vga IBM or compatible with Video Graphics Array.
mda IBM or compatible with Monochrome Display Adapter and green-tinted monochrome monitor.
hercules IBM compatible with Hercules Graphics Adapter and green-tinted monochrome monitor.
strict Choose strict compatibility with GW-BASIC over convenience, security, rhyme or reason.

Presets are groups of options that are defined in the default configuration file. You can create your own presets by creating a header in your private configuration file with the name of the new preset, followed by the options you want to apply. For example, if you define: [my_preset]
video=vga
syntax=pcjr
you can now run pcbasic --preset=my_preset to start an emulation of a hypothetical machine with a VGA video card running PCjr Cartridge BASIC.

GW-BASIC compatibility features

PC-BASIC aims for a very high level of compatibility with GW-BASIC. However, some compatibility features are disabled by default for convenience or security reasons. These features can be switched on using individual command-line options. The highest level of compatibility with GW-BASIC can be attained by setting preset=strict, which switches off all convenience and security features that cause differences with GW-BASIC.


Codepages

PC-BASIC supports a large number of legacy codepages that were common at the time GW-BASIC was popular, including double-byte character set codepages used for Chinese, Japanese and Korean. You can select your codepage by using the codepage= option. For example, codepage=936 selects the GBK codepage commonly used on the Chinese mainland. PC-BASIC will load and save all program files as if encoded in the codepage you select.

It is also possible to load and save programs in a standard encoding by enabling the text-encoding option. For example, if --text-encoding=utf-8 is set, plain-text program source will be saved and loaded in standard UTF-8 encoding. Please note that you will still need to select a codepage that provides all the Unicode characters that your program needs.

Note that PC-BASIC does not implement the following features relevant to some of these codepages:

Bidirectional text
All text is printed left-to-right independent of the codepage selected. To write strings in a language that is written right-to-left, the logical character sequence must be inverted so that the order appears correct visually. While this is inconvenient, it is in line with the behaviour of GW-BASIC. This affects code pages marked with B in the table.
Combining characters
PC-BASIC recognises single-byte code points (where each glyph shows on a single cell on the screen) and double-byte code points (where a single glyph takes up two cells on the screen). Combining characters (such as the combining diacritics of codepages 874 and 1258) are therefore not shown correctly: instead of being combined with their preceding base character as a single combined glyph, such combinations will be shown as separate glyphs. Where available, alternative codepages with precomposed characters will give better results. This affects code pages marked with C in the table.

The following codepages are available. PC-BASIC uses the Microsoft OEM codepage number where this is unambiguous. The code pages are expected to agree with Microsoft sources for the ranges &h80&hFF. Ranges &h00&h1F and &h7F are implemented as the IBM Special Graphic Characters where some code page sources will list these as the corresponding control characters. For unofficial codepages and those with conflicting numbering, codepage names are used instead of numbers.

codepage_id Codepage Languages Notes
437 DOS Latin USA English
720 Transparent ASMO Arabic B
737 DOS Greek Greek
775 DOS Baltic Rim Estonian, Latvian and Lithuanian
850 DOS Latin 1 Western European languages
851 DOS Greek 1 Greek
852 DOS Latin 2 Central European languages
853 DOS Latin 3 Southern European languages
855 DOS Cyrillic 1 Serbian, Macedonian and Bulgarian
856 DOS Hebrew Hebrew B
857 DOS Latin 5 Turkish
858 DOS Latin 1 with Euro Western European languages
860 DOS Portuguese Portuguese
861 DOS Icelandic Icelandic
862 DOS Hebrew Hebrew B
863 DOS Canadian French French
864 DOS Arabic Arabic B
865 DOS Nordic Danish and Norwegian
866 DOS Cyrillic 2 Russian
868 DOS Urdu Urdu B
869 DOS Greek 2 Greek
874 TIS-620 Thai C
932 Shift-JIS (variant) Japanese
934 DOS/V Korea Korean
936 GBK; GB2312/EUC-CN superset Simplified Chinese
938 DOS/V Taiwan Traditional Chinese
949 IBM-PC Korea KS; EUC-KR superset Korean
950 Big-5 (variant) Traditional Chinese
1258 Vietnamese Vietnamese C
alternativnyj GOST Alternativnyj Variant Russian
armscii8a ArmSCII-8a; FreeDOS cp899 Armenian
big5-2003 Big-5 (Taiwan 2003) Traditional Chinese
big5-hkscs Big-5 (Hong Kong 2008) Traditional Chinese
georgian-academy Academy Standard Georgian
georgian-ps Parliament Standard Georgian
iransystem Iran System Persian B
kamenicky Kamenický; cp895 Czech
koi8-r KOI8-R Russian
koi8-ru KOI8-RU Ukrainian, Belarusian, Russian
koi8-u KOI8-U Ukrainian, Russian
mazovia Mazovia; cp667, 991, 790 Polish
mik MIK, FreeDOS cp3021 Bulgarian
osnovnoj GOST Osnovnoj Variant Russian
ruscii RUSCII Ukrainian, Russian
russup3 Cornell Russian Support for DOS v3 Russian
russup4ac Exceller Software Russian Support for DOS v4 Academic Russian
russup4na Exceller Software Russian Support for DOS v4 Non-Academic Russian
viscii VISCII, FreeDOS cp30006 Vietnamese

You can add custom codepages to PC-BASIC, by adding a file with its mapping to Unicode to the codepage/ directory.


Fonts

PC-BASIC emulates the distinctive raster fonts of IBM-compatible machines. The ROM fonts of the original IBM and Tandy adapters (which are in the public domain in a number of countries) have been included in PC-BASIC. These provide the most accurate emulation. However, the font ROMs only included a single code page – DOS Latin USA 437.

PC-BASIC defaults to a font which is very similar in style to the IBM VGA font but has support for many more code pages, in particular Western and Middle Eastern alphabets. Chinese, Japanese and Korean are supported through "fullwidth" glyphs which take the space of two regular characters.

It is possible to change the choice of font using the font= option. You can provide a list of fonts, where the last font specified is the most preferred one.

PC-BASIC reads fonts in a variant of the .hex format introduced by UniFont. It's easy to define custom fonts in this format: it can be edited in a regular text editor. See the UniFont project for an authoring tool. You can add custom fonts to PC-BASIC by installing them into the font/ subdirectory of PC-BASIC's installation directory.

By default, the following fonts are available:

font_name Name Sizes Codepages
default PC-BASIC default font 8, 14, 16 all bundled codepages
cga IBM Colour/Graphics Adapter font 8 437 only
mda IBM Monochrome Display Adapter font 14 437 only
vga IBM Video Graphics Array font 8, 14, 16 437 only
olivetti Olivetti/AT&T font 16 437 only
tandy1 Tandy-1000 font old version 8 437 only
tandy2 Tandy-1000 font new version 8 437 only

If not all glyphs are found in the specified font(s), the default font is used as a fallback.

The font names freedos, univga, and unifont are treated as synonyms of default unless a font with one of these names is available. This behaviour is deprecated.


Redirecting I/O

PC-BASIC supports redirecting input and output the GW-BASIC way: output redirected with the output= option will be sent to the screen as well as the specified file, while input redirected with input= is taken only from the specified file. Note that screen output through the SCRN: device and keyboard input through the KYBD: device are not redirected. Files are read and written in the codepage set with PC-BASIC.

Note that it is also possible to use your operating system's facility to redirect console output using the < and > operators. It's best to set interface=none so that I/O is redirected through the console. This will produce files in your console's standard encoding, which is often UTF-8 on Unix and Windows-1252 on Windows.


Command-line interface

You can run PC-BASIC as a command-line interface by setting the interface=cli (or -b) option. No window will be opened: you can type BASIC commands straight into your Command Prompt/Terminal. Use the horizontal arrow keys to move on the current line you're editing; use the vertical arrow keys to show screen rows above and below. Copy and paste are available only if the calling shell provides them. On Windows, Ctrl+Break will terminate PC-BASIC immediately. You can use Ctrl+C to interrupt the program. The end-of-file key combination (Ctrl+D on Unix, Ctrl+Z on Windows) will exit PC-BASIC.

You can use the command-line interface to run one or a few BASIC commands directly, like so:

me@mybox$ pcbasic -c '?1+1'
 2
me@mybox$

For scripting purposes, it is also possible to run PC-BASIC without any interface by setting interface=none or -n. If this is set, PC-BASIC will take input from and send output to the console as UTF-8 without further modification. This is useful in combination with redirection and pipes.


Text-based interface

There is also a full-screen text interface available: enable it by setting interface=text (or -t). The text-based interface is very similar to the default graphical interface, but runs in your Command Prompt or Terminal window.

Graphical screen modes can be used in text and command-line interface, but only the text on the screen will be visible. pre, many Ctrl and Alt key combinations are not available.

The text and command-line interfaces will attempt to use the PC speaker for sound. Only single-voice sound can be produced this way. On Linux systems under X11, you may need to install the beep utility and enable the PC-speaker driver or emulation; direct speaker access is often limited to root or tty logins, and on Ubuntu systems it is disabled by default.