manuals.online logo
Brands
  1. Home
  2. •
  3. Brands
  4. •
  5. Commodore
  6. •
  7. Desktop
  8. •
  9. Commodore 64 User manual

Commodore 64 User manual

Other manuals for 64

7

Other Commodore Desktop manuals

Commodore 64 User manual

Commodore

Commodore 64 User manual

Commodore VIC-20 User manual

Commodore

Commodore VIC-20 User manual

Commodore 128 User manual

Commodore

Commodore 128 User manual

Commodore PC 10 User manual

Commodore

Commodore PC 10 User manual

Commodore C16 User manual

Commodore

Commodore C16 User manual

Commodore Amiga 500 User manual

Commodore

Commodore Amiga 500 User manual

Commodore 8000 Series User manual

Commodore

Commodore 8000 Series User manual

Commodore AMIGA 2500 Reference manual

Commodore

Commodore AMIGA 2500 Reference manual

Commodore 128 Parts list manual

Commodore

Commodore 128 Parts list manual

Commodore COLT 286 User manual

Commodore

Commodore COLT 286 User manual

Commodore SuperPET User manual

Commodore

Commodore SuperPET User manual

Commodore 8000 Series User manual

Commodore

Commodore 8000 Series User manual

Commodore 16 User manual

Commodore

Commodore 16 User manual

Commodore 64 User manual

Commodore

Commodore 64 User manual

Commodore Plus/4 User instructions

Commodore

Commodore Plus/4 User instructions

Commodore CDTV User manual

Commodore

Commodore CDTV User manual

Commodore PC 10-1 User manual

Commodore

Commodore PC 10-1 User manual

Commodore Plus 4 User manual

Commodore

Commodore Plus 4 User manual

Commodore Plus 4 User manual

Commodore

Commodore Plus 4 User manual

Commodore 64C User manual

Commodore

Commodore 64C User manual

Commodore 4016 User manual

Commodore

Commodore 4016 User manual

Commodore PC User manual

Commodore

Commodore PC User manual

Commodore SX-65 Portable User manual

Commodore

Commodore SX-65 Portable User manual

Commodore A500 PLUS User manual

Commodore

Commodore A500 PLUS User manual

Popular Desktop manuals by other brands

StarTech.com ARMSTSL manual

StarTech.com

StarTech.com ARMSTSL manual

Dell Inspiron 5720 quick start guide

Dell

Dell Inspiron 5720 quick start guide

GÜDE WERKBANK GW 6/2 XL Translation of the original instructions

GÜDE

GÜDE WERKBANK GW 6/2 XL Translation of the original instructions

Lenovo ThinkCentre M62z Vodič za uporabnika

Lenovo

Lenovo ThinkCentre M62z Vodič za uporabnika

Lenovo ThinkCentre M71z user guide

Lenovo

Lenovo ThinkCentre M71z user guide

Fujitsu ESPRIMO C7xx operating manual

Fujitsu

Fujitsu ESPRIMO C7xx operating manual

Bosch DCU 130 operating instructions

Bosch

Bosch DCU 130 operating instructions

Zotac VR GO quick start guide

Zotac

Zotac VR GO quick start guide

HP 260 G2 DM Product End-of-Life Disassembly Instructions

HP

HP 260 G2 DM Product End-of-Life Disassembly Instructions

Sony VAIO VGC-LS21 Specifications

Sony

Sony VAIO VGC-LS21 Specifications

HP ProOne 400 G1 specification

HP

HP ProOne 400 G1 specification

IBM PS/2 60 Hardware maintenance service

IBM

IBM PS/2 60 Hardware maintenance service

Acer Aspire SA60 Service guide

Acer

Acer Aspire SA60 Service guide

Lenovo ThinkCentre M71z Uživatelská příručka

Lenovo

Lenovo ThinkCentre M71z Uživatelská příručka

IBM Aptiva 2198 reference guide

IBM

IBM Aptiva 2198 reference guide

Sony PCV-LX810 - Vaio Slimtop Computer System reference manual

Sony

Sony PCV-LX810 - Vaio Slimtop Computer System reference manual

Dell Precision U3525 Quick reference guide

Dell

Dell Precision U3525 Quick reference guide

MicroTouch IC-215P-AW2 user guide

MicroTouch

MicroTouch IC-215P-AW2 user guide

manuals.online logo
manuals.online logoBrands
  • About & Mission
  • Contact us
  • Privacy Policy
  • Terms and Conditions

Copyright 2025 Manuals.Online. All Rights Reserved.

(It commodore
COMPUTER
==-
FIRST EDITION
THIRD PRINTING-1983
Copyright @ 1982 by Commodore Business Machines, Inc.
All rights reserved.
This manual is copyrighted and contains proprietary information. No part of this publica-
tion may be reproduced, stored in a retrieval system, or transmitted in any form or by any
means, eledronic, mechanical, photocopying, recording, or otherwise, without the prior
written permission of COMMODORE BUSINESS MACHINES, Inc.
ii
TABLE OF CONTENTS
INTRODUCTION. ....................................... ix
.What's Included? .................................... x
.How to Use This Reference Guide.... ................" xi
.Commodore 64 ApplicationsGuide. . .. .. . .. .. . .. .. . .. .. xii
.CommodoreInformation Network. . . . . . . . . . . . . . . . . . . . . .. xvii
1. BASIC PROGRAMMING RULES 1
.Introduction 2
. ScreenDisplay Codes (BASIC Character Set) ............. 2
The Operating System(OS) 2
.Programming Numbers and Variables 4
Integer, Floating-Point and String Constants.. . . . . . . . . . 4
Integer, Floating-Point and String Variables. . . . . . . . . . . 7
Integer, Floating-Point and String Arrays 8
. Expressionsand Operators.... ..... ..... .... ..... .... . 9
Arithmetic Expressions.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Arithmetic Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Relational Operators 12
Logical Operators ................................. ~3
Hierarchy of Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Stri ng Operations 16
String Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 17
.Programming Techniques 18
Data Conversions.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Using the INPUT Statement 18
Using the GETStatement. . . . . . . . . . . . . . . . . . . . . . . . . .. 22
How to Crunch BASIC Programs 24
2. BASIC LANGUAGE VOCABULARY... ............... 29
.Introduction 30
. BASIC Keywords,Abbreviations, and Function Types 31
.Description of BASIC Keywords (Alphabetical) 35
. The Commodore 64 Keyboard and Features 93
. Screen Editor.. ..................................... 94
iii
3. PROGRAMMING GRAPHICS ON THE
COMMODORE64 ... 99
·Graphics Overview 100
Character Display Modes ........................... 100
Bit Map Modes 100
Sprites 100
· GraphicsLocations 101
VideoBankSelection... ... ... ... .. ... ... .. ... ... .. 101
Screen Memory 102
ColorMemory .1.. . . .. . . .. . . .. 103
Character Memory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 103
.Standard CharacterMode. . . . . . . . . . . . . . . . . . . . . . . . . . .. 107
Character Definitions 107
·Programmable Characters 108
.Multi-Color Mode Graphics 115
Multi-Color Mode Bit 115
.Extended Background Color Mode 120
. BitMappedGraphics... .... .... ... ..... ..... .'" .... 121
Standard High-Resolution Bit Map Mode. . ... . ... . 122
HowItWorks. . ... .. ... ... .... . ... .. ... .... . .. 122
.Multi-ColorBitMap Mode. . .. . .. . . . . . . . . . . .. . . .. . . ... 127
. SmoothScrolling 128
. Sprites 131
Defining a Sprite 131
Sprite Poi nters .................................... 133
Turning Sprites On 134
Turning Sprites Off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 135
Colors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 135
Multi-Color Mode 135
Setting a Sprite to Multi-ColorMode. . . . . . .. . . ... . ... 136
Expanded Sprites 136
Sprite Positioning 137
Sprite PositioningSummary.. . . . . . . . . . . . . . . . . . . . . . .. 143
SpriteDisplayPriorities.... .. ... .. ... ... .. ... .. .... 144
Collision Detects 144
.Other Graphics Features 150
Screen Blanking 150
Raster Reg ister .................................... 150
Interrupt Status Register. . . . . . . . . . . . . . . . . . . . . . . . . . .. 151
Suggested Screen and Character Color Combinations... 152
iv
.Programming Sprites-Another Look 153
Making Sprites in BASIC-A Short Program. ... . .. . . .. 153
Crunching Your Sprite Programs 156
Positioning Sprites on the Screen 157
Sprite Priorities .. ................................. 161
Drawing a Sprite 162
Creating a Sprite ...Step by Step 163
Moving YourSprite on the Screen. . .. . . .. . . .. . ... . . .. 165
VerticalScrolling.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 166
The Dancing Mouse-A Sprite Program Example. . . . . .. 166
EasySpritemakingChart.. . ... . ... . . .. . ... . . ... 176
SpritemakingNotes.. . .. . . .. . ... . . .. . . .. . . .. . ... . .. 177
4. PROGRAMMING SOUND AND MUSIC
ON YOUR COMMODORE 64 183
.Introduction 184
Volume Control 186
Frequencies of Sound Waves. . ...................... 186
.UsingMultipleVoices... . .. . .... . ... .. ... ... . 187
Controlling Multiple Voices 191
.Changing Waveforms ................................ 192
UnderstandingWaveforms..... .... . . ... .... 194
.The EnvelopeGenerator. . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 196
.Filtering 199
.Advanced Techniques. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 202
.Synchronization and Ring Modulation 207
5. BASICTOMACHINELANGUAGE 209
.What is Machine Language? ... ... ..... .... ..... ... ... 210
What Does Machine Code Look Like? ................. 211
Simple Memory Map of the Commodore 64 ............ 212
The Registers Inside the 6510 Microprocessor 213
.How Do You Write Machine Language Programs? 214
64MON 215
.HexadecimalNotation..... ... .... ..... .... .... .. 215
Your First Machine Language Instruction 218
Writing Your First Program 220
. Addressing Modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 221
Zero Page 221
The Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 222
v
.Indexing 223
Indirect Indexed 223
Indexed Indirect 224
Branches and Testing. . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 226
.Subroutines 228
.Useful Tips for the Beginner 229
. Approaching a Large Task. . . . . . . . . . . . . . . . . . . . . . . . . . .. 230
.MCS6510 Microprocessor Instruction Set-
Alphabetic Sequence "'.. . . . . . . . . . . . . . . . . . . . . . . .. 232
Instruction Addressing Modes and
Related Execution Times. . . . . . . . . . . . . . . . . . . . . . . . .. 254
.Memory Management on the Commodore 64 ............. 260
.The KERNAL.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 268
.KERNALPower-Up Activities. . . . . . . . . . . . . . . . . . . . . . . . . .. 269
Howto Use the KERNAL.. . . . . . . . . . . . . . . . . . . . . . . . . .. 270
User Callable KERNALRoutines 272
Error Codes 306
.Using Machine Language From BASIC 307
Where to Put Machine Language Routines.. . . . . . . . . . .. 309
How to Enter Machine Language 309
. Commodore 64 MemoryMap ... ..... . ... .. 310
Commodore 64 Input/Output Assignments. . . . . . . . . . . . .. 320
6. INPUT/OUTPUT GUIDE... ........................... 335
.Introduction 336
.Output to the TV .................................... 336
.Output to Other Devices. . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 337
Output to Printer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 338
Output to Modem 339
WorkingWithCassetteTape. . ... .. ... ... .. ... .. .... 340
Data Storage on Floppy Diskettes. . . . . . . . . . . . . . . . . . .. 342
.The Game Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 343
Paddles 346
Light Pen 348
.RS-232 Interface Description 348
General Outline 348
Opening an RS-232 Channel 349
Getting Data From an RS-232 Channel 352
Sending Data to an RS-232 Channel 353
Closing an RS-232 Data Channel 354
Sample BASIC Programs. . . . . . . . . . . . . . . . . . . . . . . . . . .. 356
vi
Receiver/Transmitter Buffer Base Location Pointers 357
Zero-Page Memory Locations and Usage
for RS-232System Interface. . . . . . . . . . . . . . . . . . . . . .. 358
Nonzero-Page Memory Locations and Usage
for RS-232System Interface.. . . . . . . . . . . . . . . . . . . . .. 358
.The User Port. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 359
Port Pin Description 359
.The Serial Bus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 362
Serial Bus Pinouts ................................. 363
.The Expansion Port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 366
.Z-80MicroprocessorCartridge. . . . . . . . . . . . . . . . . . . . . . . .. 368
Using Commodore CP/M@ ........................... 369
Running Commodore CP/M@ ......................... 369
APPENDICES ........................................... 373
A. Abbreviations for BASICKeywords. . . . . . . . . . . . . . . . . . .. 374
B. Screen Display Codes 376
C. ASCIIand CHR$Codes. . . . . . . . . . . . . . . . . . . . . . . . . . . .. 379
D. Screen and Color MemoryMaps. . . . . . . . . . . . . . . . . . . . .. 382
E. Music Note Values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 384
F. Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 388
G. VIC Chip Register Map 391
H. Deriving Mathematical Functions 394
I. Pinouts for Input/Output Devices. . . . . . . . . . . . . . . . . . . . .. 395
J. Converting Standard BASIC Programs to
Commodore 64 BASIC 398
K. Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 400
L. 6510 Microprocessol Chip Specifications 402
M. 6526 Complex Interface Adapter (CIA)
Chip Specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 419
N. 6566/6567 (VIC-II)Chip Specifications. . . . . . . . . . . . . . . .. 436
O. 6581 Sound Interface Device (SID) Chip Specifications. .. 457
P. Glossary 482
INDEX 483
COMMODORE 64 QUICK REFERENCECARD 487
SCHEMATIC DIAGRAM OF THE COMMODORE 64 . . ... 491
vii
INTRODUCTION
The COMMODORE64 PROGRAMMER'SREFERENCEGUIDE has been
developed as a working tool and reference source for those of you who
want to maximize your use of the built-in capabilities of your COMMO-
DORE64. Thismanual contains the information you need for your pro-
grams, from the simplest example all the way to the most complex. The
PROGRAMMER'SREFERENCEGUIDE is designed so that everyone from
the beginning BASIC programmer to the professional experienced in
6502 machine language can get information to develop his or her own
creative programs. At the same time this book shows you how clever
your COMMODORE 64 really is.
This REFERENCEGUIDE is not designed to teach the BASICpro-
gramming language or the 6502 machine language. There is, however,
an extensive glossary of terms and a "semi-tutorial" approach to many
of the sections in the book. If you don't already have a working knowl-
edge of BASIC and how to use it to program, we suggest that you study
the COMMODORE64 USER'SGUIDE that came with your computer. The
USER'SGUIDE gives you an easy to read introduction to the BASICpro-
gramming language. If you still have difficulty understanding how to use
BASIC then turn to the back of this book (or Appendix N in the USER'S
GUIDE) and check out the Bibliography.
The COMMODORE 64 PROGRAMMER'SREFERENCEGUIDE is just
that; a reference. Like most reference books, your ability to apply the
information creatively really depends on how much knowledge you have
about the subject. In other words if you are a novice programmer you
will not be able to use all the facts and figures in this book until you
expand your current programming knowledge.
ix
What you can do with this book is to find a considerable amount of
valuable programming reference information written in easy to read,
plain English with the programmer's jargon explained. On the other
hand the programming professional will find all the information needed
to use the capabilities of the COMMODORE64 effectively.
WHAT'S INCLUDED?
. Our complete "BASIC dictionary" includes Commodore BASIC lan-
guage commands, statements and functions listed in alphabetical
order. We've created a "quick list" which contains all the words
and their abbreviations. This is followed by a section containing a
more detailed definition of each word along with sample BASIC
programs to illustrate how they work.
. If you need an introduction to using machine language with BASIC
programs our layman's overview will get you started.
. A powerful feature of all Commodore computers is called the KER-
NAL. It helps insure that the programs you write today can also be
used on your Commodore computer of tomorrow.
. The Input/Output Programming section gives you the opportunity to
use your computer to the limit. It describes how to hook-up and use
everything from lightpens and joysticks to disk drives, printers, and
telecommunication devices called modems.
.You can explore the world of SPRITES,programmable characters,
and high resolution graphics for the most detailed and advanced
animated pictures in the microcomputer industry.
. You can also enter the world of music synthesis and create your
own songs and sound effects with the best built-in synthesizer
available in any personal computer.
. If you're an experienced programmer, the soft load language sec-
tion gives you information about the COMMODORE64's ability to
run CP/M* and high level languages. This is in addition to BASIC.
Think of your COMMODORE64 PROGRAMMER'SREFERENCEGUIDE
as a useful tool to help you and you will enjoy the hours of programming
ahead of you.
.CP/M is a registered trademark of Digital Research, Inc.
x INTRODUCTION