Commodore 64 Programmer’s Reference Guide [First ed.] 0-672-22056-3

Game cartridge compatibility... spectacular sound... arcade style graphics... and high caliber computing capabilities ma

623 114 14MB

English Pages 514 Year 1983

Report DMCA / Copyright

DOWNLOAD FILE

Polecaj historie

Commodore 64 Programmer’s Reference Guide [First ed.]
 0-672-22056-3

Table of contents :
TABLE OF CONTENTS

INTRODUCTION ................................................... ix
o What's Included? .......................................... x
o How to Use This Reference Guide ........................... xi
o Commodore 64 Applications Guide ........................... xii
o Commodore Information Network ............................. xvii

1. BASIC PROGRAMMING RULES ..................................... 1
o Introduction .............................................. 2
o Screen Display Codes (BASIC Character Set) ................ 2
o Programming Numbers and Variables ......................... 4
o Expressions and Operators ................................. 9
o Programming Techniques .................................... 18

2. BASIC LANGUAGE VOCABULARY ................................... 29
o Introduction .............................................. 30
o BASIC Keywords, Abbreviations, and Function Types ......... 31
o Description of BASIC Keywords (Alphabetical) .............. 35
o The Commodore 64 Keyboard and Features .................... 93
o Screen Editor ............................................. 94

3. PROGRAMMING GRAPHICS ON THE
COMMODORE 64 ................................................ 99
o Graphics Overview ......................................... 100
o Graphics locations ........................................ 101
o Standard Character Mode ................................... 107
o Programmable Characters ................................... 108
o Multi-Color Mode Graphics ................................. 115
o Extended Background Color Mode ............................ 120
o Bit Mapped Graphics ....................................... 121
o Multi-Color Bit Map Mode .................................. 127
o Smooth Scrolling .......................................... 128
o Sprites ................................................... 131
o Other Graphics Features ................................... 150
o Programming Sprites-Another Look .......................... 153

4. PROGRAMMING SOUND AND MUSIC
ON YOUR COMMODORE 64 ........................................ 183
o Introduction .............................................. 184
o Using Multiple Voices ..................................... 187
o Changing Waveforms ........................................ 192
o The Envelope Generator .................................... 196
o Filtering ................................................. 199
o Advanced Techniques ....................................... 202
o Synchronization and Ring Modulation ....................... 207

5. BASIC TO MACHINE LANGUAGE ................................... 209
o What is Machine Language? ................................. 210
o How Do You Write Machine Language Programs? ............... 214
o Hexadecimal Notation ...................................... 215
o Addressing Modes .......................................... 221
o Indexing .................................................. 223
o Subroutines ............................................... 228
o Useful Tips for the Beginner .............................. 229
o Approaching a Large Task .................................. 230
o MCS6510 Microprocessor Instruction Set .................... 232
o Memory Management on the Commodore 64 ..................... 260
o The KERNAL ................................................ 268
o KERNAL Power-Up Activities ................................ 269
o Using Machine Language From BASIC ......................... 307
o Commodore 64 Memory Map ................................... 310

6. INPUT/OUTPUT GUIDE .......................................... 335
o Introduction .............................................. 336
o Output to the TV .......................................... 336
o Output to Other Devices ................................... 337
o The Game Ports ............................................ 343
o RS-232 Interface Description .............................. 348
o The User Port ............................................. 359
o The Serial Bus ............................................ 362
o The Expansion Port ........................................ 366
o Z-80 Microprocessor Cartridge ............................. 368

APPENDICES ..................................................... 373
A. Abbreviations for BASIC Keywords ........................ 374
B. Screen Display Codes .................................... 376
C. ASCII and CHR$ Codes .................................... 379
D. Screen and Color Memory Maps ............................ 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 Microprocessor Chip Specifications ................. 402
M. 6526 Complex Interface Adapter (CIA)
Chip Specifications ................................... 419
N. 6566/6567 (VIC-II) Chip Specifications .................. 436
0. 6581 Sound Interface Device (SID) Chip Specifications ... 457
P. Glossary ................................................ 482

INDEX .......................................................... 483

COMMODORE 64 QUICK REFERENCE CARD .............................. 487

SCHEMATIC DIAGRAM OF THE COMMODORE 64 .......................... 491

Citation preview

J

C=COMPUTER

commodore

ABOUT THE COMMODORE 64 PROG R'S REFERENCE GUIDE .. . ■

style graphics ... and high caliber computing capabilities make the Commodore 64 the most advanced personal computer in its class for home, business and educational use. The COMMODORE 64 PROGRAMMER' S REFERENCE GUIDE tells you everything you need to know about your Commodore 64. The perfect companion to your Commodore 64 User 's Guide, this manual presents detailed information on everything from graphics and sound to advanced machine language techniques . This book is a must for everyone from the beginner to the advanced programmer. For the beginner, the most complicated topics are explained with many sample programs and an easy -to-read writing style. For the advanced programmer , this book has been subjected to heavy pre-testing with your needs in mind . And it's designed so that you can easily get the most out of your Commodore 64's extensive capabilities.

0 LI it

LI LI commodore C= COMPUTER Commodore Business Machines , Inc.-Computer Systems Division, 487 Devon Park Drive, Wayne, PA 19087 DISTRIBUTED BY

Howard W. Sams & Co., Inc. 4300 W. 62nd Street , Indianapolis , Indiana 46268 USA

$19.95/22056

ISBN 0-672-22056-3