PC-BASIC Documentation

PC-BASIC

documentation

Version 2.0.7

1. PC-BASIC 2.0.7

A free, cross-platform emulator for the GW-BASIC family of interpreters.

PC-BASIC is a free, cross-platform interpreter for GW-BASIC, Advanced BASIC (BASICA),

PCjr Cartridge Basic and Tandy 1000 GWBASIC. 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 on which these BASICs used to run. PC-BASIC runs

plain-text, tokenised and protected .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.

This is the documentation for PC-BASIC 2.0.7, last updated 2023-04-02 20:43:10.

It consists of the following documents:

?

?

?

?

?

?

?

2

Quick Start Guide, the essentials needed to get started

User's Guide, in-depth guide to using the emulator

Configuration Guide, settings and options

Language Guide, overview of the BASIC language by topic

Language Reference, comprehensive reference to BASIC

Technical Reference, file formats and internals

Developer's Guide, using PC-BASIC as a Python module

PC-BASIC

Table of Contents

PC-BASIC 2.0.7 ...................................................................................................................... 2

Quick Start Guide................................................................................................................. 14

Installation.............................................................................................................................. 15

BASIC survival kit .................................................................................................................. 16

Program location.................................................................................................................... 17

External resources ................................................................................................................. 18

User's guide ......................................................................................................................... 19

The working environment ...................................................................................................... 20

Special keys........................................................................................................................... 21

Keyboard shortcuts ................................................................................................................ 24

Alternative keys ..................................................................................................................... 25

Clipboard operations.............................................................................................................. 25

Emulator control keys ............................................................................................................ 25

Compatibility .......................................................................................................................... 26

Programs and files ................................................................................................................. 27

Accessing your drives ............................................................................................................ 29

Compatible BASIC files ......................................................................................................... 30

Packages ............................................................................................................................... 31

Cassette tapes ....................................................................................................................... 31

Security .................................................................................................................................. 32

Connecting to peripherals ...................................................................................................... 33

Printing................................................................................................................................... 33

Serial and parallel ports ......................................................................................................... 34

Changing the interface........................................................................................................... 35

Emulation targets ................................................................................................................... 36

Codepages ............................................................................................................................ 38

Fonts ...................................................................................................................................... 41

Table of Contents

3

Redirecting I/O ....................................................................................................................... 42

Command-line interface......................................................................................................... 42

Text-based interface .............................................................................................................. 43

Configuration guide............................................................................................................. 44

Changing settings .................................................................................................................. 45

Synopsis ................................................................................................................................ 47

Positional arguments ............................................................................................................. 48

Options .................................................................................................................................. 49

Examples ............................................................................................................................... 61

Language guide ................................................................................................................... 63

Working with programs .......................................................................................................... 64

Control flow ............................................................................................................................ 65

Arrays and variables .............................................................................................................. 68

Type conversion .................................................................................................................... 69

String operations.................................................................................................................... 70

Text and the screen ............................................................................................................... 71

The printer ............................................................................................................................. 72

Keyboard input....................................................................................................................... 73

Function-key macros ............................................................................................................. 74

Calculations and maths ......................................................................................................... 75

Mathematical functions .......................................................................................................... 75

Random numbers .................................................................................................................. 75

Devices and files.................................................................................................................... 76

File operations ....................................................................................................................... 76

Devices .................................................................................................................................. 76

Graphics ................................................................................................................................ 79

Sound .................................................................................................................................... 80

Joystick and pen .................................................................................................................... 81

Disks and DOS ...................................................................................................................... 82

Serial communications........................................................................................................... 83

4

PC-BASIC

Event handling ....................................................................................................................... 84

Error handling ........................................................................................................................ 85

User-defined functions ........................................................................................................... 86

Date and time ........................................................................................................................ 87

Including data in a program ................................................................................................... 88

Memory and machine ports ................................................................................................... 89

Features not yet implemented ............................................................................................... 90

Unsupported features ............................................................................................................ 91

Language reference............................................................................................................. 92

Metasyntax ............................................................................................................................ 93

Definitions .............................................................................................................................. 94

Literals ................................................................................................................................... 95

Variables ................................................................................................................................ 97

Types and sigils ..................................................................................................................... 97

Arrays..................................................................................................................................... 98

Conversions ........................................................................................................................... 98

Operators ............................................................................................................................... 99

Order of precedence .............................................................................................................. 99

Mathematical operators ....................................................................................................... 100

Relational operators............................................................................................................. 101

Bitwise operators ................................................................................................................. 101

String operators ................................................................................................................... 102

Functions ............................................................................................................................. 104

ABS ........................................................................................................................................

104

ASC ........................................................................................................................................

104

ATN ........................................................................................................................................

105

CDBL ......................................................................................................................................

105

CHR$ ......................................................................................................................................

105

CINT ......................................................................................................................................

106

COS ........................................................................................................................................

106

Table of Contents

5

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download