EasyManua.ls Logo

Commodore PET User Manual

Commodore PET
447 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
Page #1 background imageLoading...
Page #1 background image
1

Table of Contents

Question and Answer IconNeed help?

Do you have a question about the Commodore PET and is the answer not in the manual?

Commodore PET Specifications

General IconGeneral
ProcessorMOS 6502
Clock Speed1 MHz
RAM4 KB (expandable to 32 KB)
Operating SystemCommodore BASIC
ManufacturerCommodore International
ModelPET 2001
Release Year1977
Power SupplyInternal
StorageCassette tape
Display9-inch monochrome CRT
Graphics40×25 character resolution
ROM14 KB
PortsIEEE-488
KeyboardChiclet keyboard

Summary

Preface

ACKNOWLEDGMENTS

Expressions of gratitude to individuals and organizations for their contributions and support.

CHAPTER 1: Introducing the PET

COMMUNICATING WITH THE PET

How to interact with the PET using BASIC commands.

ROM AND RAM

Explanation of Read-Only Memory (ROM) and Read/Write Memory (RAM) in the PET.

BASIC PROGRAMMING

Overview of available pre-written programs and writing custom programs in BASIC.

PET MODELS

Description of different PET computer models and their keyboards.

FEATURES

Key differences in PET models: ROM versions, keyboards, and memory.

CHAPTER 2: Operating the PET

UNPACKING

Steps for safely unpacking and setting up a new PET computer.

CASSETTE HOOKUP

Instructions for connecting the cassette tape unit to the PET.

KEYTOP FILM COVERING

Procedure for removing protective film from PET keyboard keys.

STARTUP

Steps to power on the PET and verify the initial display.

KEYBOARD

Overview of the PET keyboard layout and its function.

Full Size Keyboard

Details on the full-size PET keyboard layout and key features.

Compact Keyboard

Details on the compact PET keyboard layout and its differences.

KEYBOARD ENTRY

Key concepts related to entering data via the PET keyboard.

Variables

Explanation of variables, their names, types, and storage in PET BASIC.

PET KEY GROUPS

Categorization of PET keys into functional groups for easier understanding.

Alphabetic Keys

Description of the PET's alphabetic keys and character sets.

Numeric Keys

Description of the PET's numeric keys and their input format.

Special Symbols

Explanation of the dual uses of special symbols as punctuation and program operators.

SCREEN DISPLAY

Details about the PET's screen resolution, character positions, and line display capabilities.

CASSETTE TAPE DRIVE

Description of the PET's built-in and external cassette tape drive.

CASSETTE OPERATION

Procedures for inserting and removing tape cassettes from the PET tape drive.

CASSETTE TAPE CONTROLS

Explanation of the cassette tape control keys: Record, Rewind, Fast Forward, Play, Stop.

CLEANING AND MAINTENANCE

Guidelines for cleaning and maintaining the PET, including tape heads.

CLEANING AND DEMAGNETIZING THE TAPE HEAD

Procedures for cleaning and demagnetizing the cassette tape head.

CARE OF CASSETTE TAPES

Tips for taking care of cassette tapes, including balancing tension and selecting quality tapes.

Write Protect

How to prevent accidental recording on cassette tapes by using write-protect tabs.

ELEMENTARY TROUBLESHOOTING

Basic troubleshooting procedures for common PET issues and internal cable checks.

Internai Cable Connections

Step-by-step guide to opening the PET and checking internal cable connections.

Locating a Defective RAM

Procedure to identify and locate a faulty RAM chip in PETs with compact keyboards.

CHAPTER 3: Programming the PET

CALCULATOR OR IMMEDIATE MODE

Using the PET as a calculator for direct arithmetic operations without line numbers.

A ONE-LINE PROGRAM

Grouping multiple statements on a single line for immediate mode execution.

REEXECUTING IN IMMEDIATE MODE

Editing and re-executing immediate mode statements directly on the screen.

MODIFYING A PROGRAM

Techniques for making character and statement modifications within a program.

ELEMENTS

Introduction to the components of PET BASIC: alphabet, numbers, and special characters.

NUMBERS

Explanation of floating-point numbers and integers in PET BASIC.

Roundoff

How PET BASIC handles number rounding and potential inaccuracies.

Scientific Notation

Using scientific notation for large or small numbers in PET BASIC.

Integers

Definition and range of integers in PET BASIC, and their memory usage.

STRINGS

Definition and manipulation of strings, including concatenation and special symbols.

VARIABLES

Explanation of variables, their names, types, and storage in PET memory.

Floating Point Variable

Rules for naming and using floating-point variables in PET BASIC.

Integer Variable

Rules for naming and using integer variables in PET BASIC.

String Variable

Rules for naming and using string variables in PET BASIC.

Longer Variable Names

Using longer variable names and understanding PET BASIC's limitations.

Reserved Words

List and explanation of PET BASIC's reserved words and their usage.

OPERATORS

Introduction to arithmetic, relational, and Boolean operators in PET BASIC.

Arithmetic Operators

Explanation and examples of arithmetic operators: addition, subtraction, multiplication, division, exponentiation.

Order of Evaluation

How PET BASIC evaluates expressions with multiple operations and the role of parentheses.

Relational Operators

Using relational operators to compare terms and strings in PET BASIC.

Boolean Operators

Explanation of logical operators AND, OR, and NOT, and bit-oriented operations.

ARRAYS

Introduction to arrays, their dimensions, and storage in PET BASIC.

A single-dimensional array element has the form

Format and storage of single-dimensional arrays in PET BASIC.

A two-dimensional array element has the form

Format and storage of two-dimensional arrays in PET BASIC.

FUNCTIONS

Overview of PET BASIC's built-in functions for various operations.

The following functions constitute the arithmetic function group:

Details on INT, SGN, ABS, SQR, EXP, LOG, SIN, COS, TAN, ATN functions.

The following functions constitute the string function group:

Details on STR$, VAL, CHR$, ASC, LEN, LEFT$, RIGHT$, MID$ functions.

The following functions constitute the format function group:

Details on SPC, TAB, POS functions for controlling output format.

System Functions

Details on PEEK, SYS, TI, TI$, USR functions for system interaction.

USER-DEFINED FUNCTION

How to define and use custom functions with DEF FN in PET BASIC.

File Names

Creating and using file names for storing programs and data on tape.

WRITING BASIC PROGRAMS

Structure of BASIC programs, including numbered statements and execution.

LINE NUMBERS

The role and importance of unique line numbers in BASIC programs.

Programs and Immediate Mode

Using immediate mode to examine variable values within a program.

BASIC STATEMENT GROUPS

Categorization of BASIC statements by their functional groups.

Unconditional Branches: GOTO, FOR ... NEXT, GOSUB/RETURN

How to control program flow using GOTO, FOR...NEXT loops, and GOSUB/RETURN for subroutines.

Defining Data: LET ... =, READ/DATA/RESTORE, DIM

Statements for defining constants, assigning values, and dimensioning arrays.

Console Input/Output: PRINT, INPUT, GET

How to interact with the user via keyboard and display during program execution.

File Input/Output: OPEN, CLOSE, PRINT#, CMD, INPUT#, GET#

Statements for programmed communication with external devices like cassette units.

Miscellaneous: REM, POKE

Using REM for comments and POKE for memory manipulation.

Program Termination: END, STOP, WAIT

Statements used to end or temporarily halt program execution.

BASIC Commands: NEW, CLR, LIST, LOAD, RUN, CONT, SAVE, VERIFY

Essential BASIC commands for program management in immediate mode.

DEVELOPING A PROGRAM

Steps and considerations for creating and editing PET BASIC programs.

Multiple Statements on a Line

Using colons to combine multiple statements on a single line for efficiency.

CHAPTER 4: PET BASIC

FORMAT CONVENTIONS

Explanation of conventions used in PET BASIC format presentations (UPPER CASE, lower case, braces, ellipses).

BASIC COMMANDS

Detailed description of fundamental PET BASIC commands like CLR and CONT.

CLR

Reinitializes PET system pointers, variables, and stack, equivalent to restarting the PET.

CONT

Resumes program execution after a BREAK, useful for debugging.

LIST

Displays program lines on the screen for examination and editing.

LOAD

Loads a program from tape or other devices into PET memory.

NEW

Clears the PET's memory of the current program, preparing for new input.

RUN

Begins execution of the program currently stored in memory.

SAVE

Writes a copy of the current program from memory to tape or other specified devices.

VERIFY

Checks for recording errors after saving a program by comparing tape data with memory.

CHAPTER 5: Making the Most of PET Features

KEYBOARD ROLLOVER

How the PET keyboard handles rapid typing by remembering keystrokes in a buffer.

Two-Key Rollover (Small Keyboard)

Potential issues with rollover on the compact PET keyboard's bottom row keys due to coupling.

Three-Key Rollover (Small Keyboard)

Explanation of unpredictable three-key rollover behavior on the PET, especially with adjacent keys.

BUFFER

How the PET uses a 10-character keyboard buffer to store ASCII character equivalents.

Emptying the Buffer Before a GET

Programming a loop to clear the keyboard buffer before fetching intended input.

TWO-KEY REPETITION

Technique of holding one key while pressing another for repeating sequences or graphic diagrams.

STRING CONCATENATION

Connecting strings end-to-end using the '+' operator to create single strings.

NUMERIC STRINGS

Creating and handling strings composed of numbers, including issues with leading blanks.

Concatenating Numeric Strings

Combining numeric strings, handling leading blanks and sign values.

PROGRAMMED CURSOR MOVEMENT

Using PRINT statements and CHR$ function to control cursor position for output formatting.

THE PRINT STATEMENT

Using PRINT statements with cursor control keys and semicolons for formatting output.

THE CHR$ FUNCTION: PROGRAMMING CHARACTERS IN ASCII

Translating ASCII codes into equivalent characters for programming special symbols and controls.

ARITHMETIC

Performing addition, subtraction, multiplication, and division with PET's numeric length limitations.

ADDITION

Techniques for adding numbers exceeding PET's 9-digit limit using numeric strings or multiple integer math.

Method 1: Addition via Numeric Strings

Step-by-step process for adding large numbers using string manipulation and numeric conversion.

Method 2: Multiple Integer Addition

Method for adding numbers exceeding PET's 9-digit limit by dividing into segments.

SUBTRACTION

Techniques for subtracting numbers exceeding PET's 9-digit limit using numeric strings or multiple integer math.

Method 1: Subtraction via Numeric Strings

Step-by-step process for subtracting large numbers using string manipulation and numeric conversion.

Method 2: Multiple Integer Subtraction

Method for subtracting numbers exceeding PET's 9-digit limit by dividing into segments.

MULTIPLICATION

Performing multiplication for numbers exceeding PET's 9-digit limit using multiple integer multiplication.

Multiple Integer Multiplication

Step-by-step process for multiplying large numbers by dividing into segments and using subroutines.

GRAPHICS

Using PET's graphics character set and POKE command for creating visual displays.

GRAPHICS IN CALCULATOR MODE

Sketching graphics directly on the screen in calculator mode without line numbers or PRINT statements.

PROGRAMMING GRAPHICS

Converting sketched graphics into executable programs by creating PRINT statements for each line.

ANIMATION

Creating animated sequences by programming movement of graphic elements on the screen.

TIME DELAY

Using FOR...NEXT loops to create delays for controlling animation speed.

PROGRAMMING CHARACTER PLACEMENT

Precisely positioning characters and graphics on the screen using cursor movements and PRINT statements.

Enlarging the Square

Modifying programs to draw larger rectangles and screen boundaries.

FILES

Understanding the concept of files, records, and fields, particularly for cassette tape data.

PROGRAM FILES

How programs are stored as files on tape, including naming and verification.

DATA FILES

Creating and manipulating data files for processing large amounts of data.

FILE HANDLING

The four essential steps for working with files: LOAD, OPEN, Read/Write, CLOSE.

Mounting the Data Tape

Procedures for mounting and positioning data tapes for reading or writing.

WRITING A DATA FILE

Creating data files using OPEN, PRINT#, and CLOSE commands.

Writing Numbers

Writing numeric data to a data tape, record by record.

Writing Strings

Writing string data to tape, including handling item separators like commas and semicolons.

Sample Program

Demonstrating writing complex records of data to a tape using MAIL.PRINT#.

READING A DATA FILE

Reading data from a tape file into PET memory for use in other programs.

Reading Numbers with INPUT#

Reading numeric data from a data file using the INPUT# statement.

Reading Strings

Reading string data from a data file, including handling multiple strings per record.

CHAPTER 6: System Information

ORGANIZATION OF THE PET SYSTEM

Overview of the PET system architecture, including microprocessor, peripherals, and memory blocks.

PET Memory Allocation by 4K Blocks

Table detailing how PET memory is allocated into 4K blocks, including ROM, RAM, and I/O.

Addresses 0-8191: 8K RAM (Storage and User Program)

Description of the initial RAM allocation for working storage, stack, and user programs.

Addresses 8192-32767: Expansion RAM 24K

Allocation of memory addresses for expansion RAM up to 32K.

Addresses 32768-36863: 4K Video RAM

Memory locations allocated for screen display and POKE operations.

Addresses 36864-49151: Expansion ROM 12K

Memory addresses allocated for optional expansion ROM.

Addresses 49152-65535: 14K ROM and 2K I/O

Memory addresses for BASIC interpreter, OS diagnostics, and memory-mapped I/O.

MEMORY MAP

Detailed PET memory map showing addresses, sample values, and descriptions.

PET BASIC INTERPRETER

How the PET BASIC interpreter executes programs, manages lines, and stores data.

BASIC STATEMENT STORAGE

Format and storage of BASIC statements, keywords, and ASCII codes in memory.

PET BASIC Keyword Codes

Table of PET BASIC keywords and their corresponding abbreviations.

USER PROGRAM AREA INITIALIZATION

How the user program area of memory is initialized upon PET power-up or after a NEW command.

Principal Pointers in User Program Area

Key pointers indicating the start and end of program, text, variables, arrays, and strings.

DATA FORMATS

How variables (floating point, integer, string) are stored in memory.

Floating Point Variable Format

Detailed breakdown of the byte structure for storing floating-point variables.

Integer Variable Format

Detailed breakdown of the byte structure for storing integer variables.

String Variable Format

Structure and storage of string variables, including character count and pointers.

Constants

How constants are stored directly in BASIC statements, not in the variable area.

Array Storage Format

How arrays are stored in memory, including headers and elements.

ARRAY HEADER

Structure of the array header, including name, dimensions, and byte counts.

Character Representation

Explanation of ASCII and PET ASCII codes for character representation and PEEK/POKE usage.

ASSEMBLY LANGUAGE PROGRAMMING

When and why to use assembly language programming on the PET, and how to load programs.

SYS

Using the SYS function to transfer control to independent subsystems or machine language routines.

USR

Using the USR function to call assembly language subroutines and pass parameters.

APPENDIX A: PET ASCII Codes

STANDARD CHARACTER SET

Description of the default PET character set for PET and CBM keyboards.

GRAPHIC KEYBOARD

How PET graphic symbols are displayed and activated on the keyboard.

CBM KEYBOARD

How the alternate character set is activated on the CBM keyboard.

PET ASCII

Explanation of PET ASCII codes and how they relate to characters and PEEK/POKE numbers.

PEEK/POKE

How PEEK/POKE codes are used to access and manipulate screen memory and characters.

APPENDIX B: PET Error Messages

BASIC Error Message

Common BASIC error messages, their causes, and suggested remedies.

OPERATING SYSTEM ERROR MESSAGES

Error messages generated by the PET's operating system and how to address them.

APPENDIX C: Program Examples Solved

BLANKET

The original BLANKET program listing.

Program 1, CLEAN SCREEN

Modifying BLANKET to clear the screen before displaying messages.

Program 2, MESSAGES

Modifying BLANKET to display different messages based on user input.

Program 3, SINGLE

Combining messages into a single line and adjusting display output.

Program 4, CALLING YOU

Restructuring BLANKET into a subroutine with a main program call.

Program 5, SLOW DOWN

Slowing down the program's display speed using a delay loop.

Program 6, SPEED UP

Speeding up the program's display by optimizing string handling.

Program 7, INDIAN BLANKET

Allowing user input to change display characters and modifying delay loops.

Program 8, PRINTOVER I

Modifying BLANKET to type over existing display characters without blanking or scrolling.

Program 9, PRINTOVER II

Enhancing PRINTOVER I for smoother visual character updates and cleaner display.

Program 10, ALL THE WAY

Displaying characters across the entire screen using POKE, avoiding scrolling.

Program 11, BOTTOM UP

Displaying characters in reverse order, from bottom-right to top-left, with cursor control.

APPENDIX F: Conversion Tables

Hexadecimal-Decimal Integer Conversion

Tables for converting between hexadecimal and decimal integer values.

Powers of Two

Table of powers of two, useful for understanding binary representations.

Mathematical Constants

Common mathematical constants and their decimal/hexadecimal values.

Powers of Sixteen

Table of powers of sixteen, useful for hexadecimal conversions.

Powers of Ten

Table of powers of ten, useful for understanding decimal representations.

APPENDIX G: Variations for Original ROMs (Revision Level 2)

Chapter 2: STARTUP

Differences in the startup display between original (Rev 2) and new PET ROMs.

Chapter 3: DEVELOPING A PROGRAM, Interactive Programming

Differences in cursor blinking control between old and new ROMs.

Chapter 4: RND

Non-functional behavior of RND(0) in original ROMs and the method for generating random seeds.

Chapter 5: FILES

Problems with reading/writing data files using old ROMs and necessary programming precautions.

APPENDIX H: PET Features

Features of PET BASIC

Summary of PET BASIC capabilities including commands, statements, functions, and features.

Operational Features

Overview of the PET's physical and operational characteristics like chassis, CPU, memory, and keyboard.

Chassis

Physical dimensions and construction details of the PET's chassis.

CPU

Information about the PET's microprocessor, the MCS 6502.

Memory

Details on PET's RAM, ROM, and expansion memory configurations.

Keyboard

Features of the PET keyboard, including key count, character sets, and editing functions.

Video Display Screen

Specifications of the PET's screen resolution, character display, and dot matrix.

Tape Cassette Unit

Information on the PET's tape cassette unit, including its controls and baud rate.

Related product manuals