go6502 homepage

Commodore 64 Programming


Writing 6502 code is pretty simple but writing GOOD code is challenging. Writing good 6502 assembly language code requires a good Assembler. Some people code using the mini-assembler in a ML monitor, such as Jim Butterfield's SuperMon, but that only works for relatively short programs. A full-featured macro-assembler can remove the barriers which scare timid people away from programming. It will do all the grunt work and leave you free to concentrate on your creation. There are many assemblers to choose from, and few really good ones

    Assemblers

  • The Commodore Lanugages List is a fairly comprehensive overview of the programming packages which have been available over the years
  • Computer Station has Dr. Glen Bredon's EXCELLENT Merlin 128 Macro Assembler. It's a full-featured assembler for the 128-mode of the C-128. I use Merlin and I'll go into it in some detail later
  • TRANS DATA SYSTEMS has Merlin 64 for sale. It's a 64-mode version of Merlin-128 with all the features you need to make good programs. While still a good assembler, it can't offer all the features of Merlin 128 due to memory restrictions and lack of an 80-column display
  • Centsible Software sells a few assemblers including GeoProgrammer, which can be used for standard KERNAL-based programming as well as GEOS. I've got GeoProgrammer and looks very powerful, but for now Merlin serves my needs. Perhaps if I turn to GEOS programming I'll make the switch
  • Maurice Randall develops and supports a new version of GeoProgrammer called Concept. He is currently developing a 65816 version for creating SuperCPU programs! :-))
  • Fairlight.To is where Bacchus hosts the Turbo Assembler package and docs, X-Ass and TronMon as well as links to some important programming references on the web
Occasionally some good-hearted individuals have shared their experiences with specific development packages by posting reviews in the newsgroups. I've collected links to some of these words of wisdom on a page titled Inside the UseNet
Do you know how to program in 6502 Assembly language? If you don't you'll want to learn. A little BASIC knowledge is a good place to start, but assembly language requires more discipline. I can answer questions by email and now you can read my new 6502 Machine Language page! Better yet, I can give you links to the best Online Resources for C-64 programmers.

Here you will find etexts describing important techniques, tutorials which demonstrate real coding and real tools you can learn with. Many pages also contain source code which you can examine and use in your own programs. Spend some time studying other peoples progams so you can see how real coders apply the principles described in the reference books. When you get the hang of using an ML monitor you can use it to disassemble programs in your C-64's memory. The first programs I recommend you disassemble are the Commodore KERNAL and BASIC ROMs. View the disassembled code and compare it to the comments listed in the books and online references to learn as much as you can about the inner workings of the C-64

    Online Resources

  • Commodore Hacking is the premiere e-magazine dedicated to coding and hacking Commodore computers. Topics discussed are quite advanced (and some go over my head) but if you're serious about learning to program you'll want to learn these secrets from the pros
  • The Fridge is a repository of interesting ML routines. There are many ways to skin a cat but sometimes the best path is the one most travelled. In other words, why re-invent the wheel?
  • The Commodore Knowledge Base has many articles about programming the C-64 and its peripherals
  • LoadStar.Com has posted a few articles about programming including an ML tutorial. LoadStar continues to publish lots of interesting, useful and fun programming tools. In the world of disk magazines, LoadStar reigns supreme as the longest-running, best known and most respected. A LoadStar subscription is a worthwhile investment for any Commodore programmer but they also offer some of their best tools in a disk collection
  • !!!Commodore Fun Page!!! - Tutorials, technical documents and other goodies abound here
  • Driven is the web home of C-64 demo coders. Here they share their secrets
  • TND Web Site contains a decent assembly language tutorial
  • UDI - Coding texts, tutorials and tools a-plenty here
  • iDOC= is an archive containing many references and technical documents, mostly in German
  • Finally, the Funet archive is a cornucopia of Commodore technical knowledge. It is the single largest concentration of Commodore coding/hacking resources on the internet

    Online Reference Guides

  • All_About_Your_64 by Ninja/The Dreams
  • The Commodore 64 Super Reference by White Flame
  • Marko Makela has memory maps and ROM disassemblies of the C-64 and 1541 on his web site
  • Todd Elliott has begun a reference page for GEOS and Wheels programmers
  • Constructing 64 is an archive with dozens of reference documents covering every aspect of C-64 programming
  • Frank Kontros has posted a list of the KERNAL routines by address and name. Would be one of the best but Frank hasn't updated since 1999 :'(
  • Sami Rautiainen has begun an HTML version of the Commodore 64 Programmer's Reference Guide, although its incomplete and hasn't been worked on in a couple years :'(
A number of useful Online Reference Guides have sprouted up on the web. Frequently they aren't as complete as a paper book might be, but they still provide important information and cover the topics vital to C-64 programming.
The brain of the C-64 is the 6510 microprocessor. It is supported by two 6526 CIA I/O chips, one 6566/6567 VIC-II video chip, a 6581 SID sound chip and a custom PLA to tie it all together. These integrated circuits were designed primarily for use in Commodore computers by MOS Technology (later CSG) the designers of the 6502. From a programmer's perspective these chips are all very similar to the 6502 and the rest of the 65xx series

Why is that important? Well, as an assembly language programmer you'll be working directly with these chips through their memory-mapped I/O addresses. Most of these I/O Registers appear in the $D000-$DFFF range of the 6510 address space. First you'll learn the 6502 command set and addressing modes, probably closely followed by the VIC registers and operating modes and how it ties into the rest of the system. Eventually you'll want to play with the CIAs and you'll probably want to use SID if you write any games or demos

Having a good working knowledge of the Chipset of your C-64 is crucial to writing meaningful programs. Everytime you get a keypress, put a character on the screen or perform disk I/O you're accessing one or more I/O suppport chips. Usually these functions are done through the ROM KERNAL interface but sometimes you need more control than these routines provide. Just as an example, you must directly access the VIC registers to change the border color because there is no KERNAL routine provided to do this. As you become more intimate with the intricate details of the chipset, you'll be writing increasingly more sophisticated and more efficient programs

    Chipset and I/O Hardware

  • 6502.Org is a centralized web resource repository for 6502 programmers of all stripes
  • Programmers Heaven has documents pertaining to the 65xx chipset and C-64
  • Rich Cini's Classic Computing has manufacturers data sheets and programming information for the 65xx series from MOS, Rockwell and Synertek
  • Western Design Center is the designer of the 65c02 and 65816 processors which are software compatible with the 6502
  • A Brief Description Of Graphic Modes by DMAgic
  • Andreas Grützmann C64 Section contains documents detailing the VIC-II hardware and its modes
  • ec64: technical has Datasheets and Schematics of the C64 & C1541 Hardware
  • MayhemUK presents us with an illustrated history of the C-64's design as well as a good overview of the C-64 architecture
  • Classic-Games.Com has documents pertaining to the C-64 architecture which were compiled for the V.I.C.E. emulator project
  • SID 6581 Homepage - SID programming information is available here ... but Micro$oft Internet Explorer users are disallowed from accessing the page
There have been far too many books about C-64/6502 assembly language published over the years to list here. First, there are a few Essential Programming References which are required to do useful programming for the C-64. These books are invaluable to every Commodore programmer and I can't overstate the importance of having them at hand. With these prime references, and the requisite tools, you'll have everything required to get started programming. If you buy no other books, at least get these!

    Essential Programming References

  • Commodore 64 Programmer's Reference Guide - Commodore
  • Mapping the C-64 by Sheldon Leemon - Compute! Publications
  • Anatomy of the Commodore 64 by Angerhausen/Becker/English/Gerits - Abacus Books

    Other References and Tutorials

  • Programming the Commodore 64 by Raeto Collin West - Compute! Publications
  • Machine Language for the Commodore 64 by Jim Butterfield - Brady Publications
  • Machine Language Book of the Commodore 64 by Lothar Englisch - Abacus Books
  • Advanced Machine Language for the C-64 by Lothar Englisch - Abacus Books
  • 6502 Assembly Language Programming by Lance Leventhal - Osborne
  • Assembly Language Programming with the Commodore 64 by Marvin De Jong - Brady Publications
  • The Graphics Book for the Commodore 64 by Axel Plenge - Abacus Books
  • Tool Kit BASIC by Dan Heeb - Compute! Publications
  • Tool Kit KERNAL by Dan Heeb - Compute! Publications
  • Machine Language for Beginners by Richard Mansfield - Compute! Publications
  • The Second Book of Machine Lanuguage by Richard Mansfield - Compute! Publications
  • The Commodore Inner Space Anthology by Karl Hildon - Transactor Publishing
There are several Other References and Tutorials which have been very helpful to me. These are not required, but they provide more detail on some subjects which may be glossed over in the prime references. After you begin programming and you've tackled a few small projects, you'll learn which topics you want to explore more deeply and then you'll want to purchase some of these. If that's not enough, I've found it very helpful to examine disassemblies and source code of Apple II programs, such as the Apple II Monitor ROM itself. Apple II programmers developed some techniques which became universal in the 6502 world
You'll want to learn about the 1541 disk drive because many good programs must deal with it at some time. Many even include a custom DOS for the 1541 and you'll enounter alot of these if you examine C-64 games which have been sold over the years. For these reasons, you should look for these Essential 1541 References

    Essential 1541 References

  • Inside Commodore DOS by Richard Immers - Datamost
  • 1541 User's Guide by Gerald Neufeld - Datamost
  • Anatomy of the 1541 by Lothar Englisch - Abacus Software
You probably won't find many of these books at your local book store although you may find a few of them at large local libraries. The best place to find C-64 books is on the web. Here are Dealers in Commodore Books who carry some of the ones listed here
Believe it or not, many of the large Book Distributors and Resellers still have copies of these books warehoused. Some can also find them used or through special order services. Try going to all the places below and search for "Commodore Programming", "Commodore Book" or "C-64"
More great books I recommend! Are there other topics you'd like to see on this page? Is there something you'd like to see explained in more depth? If you have specific questions about C-64 programming, type them up and email me

My Commodore Books

Compute! Publications
Programming the Commodore 64: The Definative GuideRaeto C. West
Programming the PET/CBMRaeto C. West
Commodore 128 Programmer's Reference GuideCompute! Editors
Mapping the Commodore 64Sheldon Leemon
Mapping the Commodore 128Ottis Cowper
VIC-20 and C-64 Toolkit: BASICDan Heeb
VIC-20 and C-64 Toolkit: KERNALDan Heeb
All About the Commodore 64 Vol. 1Craig Chamberlain
All About the Commodore 64 Vol. 2Craig Chamberlain
Beginner's Guide to Commodore 64 SoundJohn Heilborn
Reference Guide to Commmodore 64 GraphicsJohn Heilborn
Machine Language for BeginnersRichard Mansfeild
Second Book of Machine LanguageRichard Mansfeild
Commodore 128 Machine Language for BeginnersRichard Mansfeild
First Book of Commodore 64 (Apps, Utilities etc.)
Second Book of the Commodore 64
Third Book of the Commodore 64
First Book of the Commodore 128
Commodore Collection Vol. 1
Commodore Collection Vol. 2
First Book of C-64 Sound and Graphics
First Book of Commodore 64 Games
Machine Language Games for the C-64
Machine Language Routines for the C-64
Computer Peripherals User's GuideKnott/Prochnow
Creating Arcade Games on the Commodore 64Robert Camp
40 Flight SimulatorsC. Gulick
Complete Commodore 64
User's Guide to GeoPaint/GeoWriteNeil Salkind

Abacus Books
Anatomy of the Commodore 64Angerhausen/Becker/Englisch/Gerits
Machine Language Book of the Commodore 64Lothar Englisch
Advanced Machine Language for the Commodore 64Lothar Englisch
Graphics Book for the Commodore 64Axel Plenge
Peeks and Pokes for the Commodore 64H.J. Liesert
Ideas for Use on your Commodore 64Ranier Bartel
Commodore 128 Tricks and Tips (C-128 #3)Weltner/Hornig/Trapp
1571 Internals (C-128 #4)Ranier Ellinger
Commodore 128 Peeks and Pokes (C-128 #7)Liesert/Linden
Anatomy of the 1541Englisch/Szczepanowski
Anatomy of the 1541 2'nd EditionEnglisch/Szczepanowski
1541 Repair and Maintenance HandbookReinhold Herrman
Compiler Design and ImplementationVolker Sasse
Geos Inside and OutTornsdorf/Kerkloh
Geos Tips and TricksTornsdorf/Kerkloh
C-128 CP/M User's GuideSchieb/Weiler

Datamost Books
Elementary Commodore 64Lou Sanders
Inside Commodore DOSRichard Immers and Gerald Neufeld
1541 User's GuideGerald Neufeld
Musical CommodoreHal Glicksman

Howard Sams/Sams Computerfacts
Commodore 128 Reference Guide for ProgrammersDavid Heiserman
1541 Troubleshooting and RepairM. Peltier
1581 Technical Service Data
Commodore 64 Troubleshooting & Repair GuideRobert C. Brenner

TAB Books
Commodore 64 Graphics and Sound ProgrammingStan Krute
Commodore 64 Graphics and Sound Programming 2'nd EditionStan Krute

Brady Books
Machine Language for the C-64 and Other Commodore ComputersJim Butterfeild
Machine Language for the C-64, C-128 and Other Commodore Computers 2'nd EditionJim Butterfeild
Assembly Language Programming With the Commodore 64Marvin L. DeJong

Osborne Books
6502 Assembly Language ProgrammingLance Leventhal
PET/CBM Personal Computer Guide 2'nd EditionAdam Osborne and Carroll Donahue
Your Commodore 64John Heilborn and Ron Talbott

Other Publishers
Using the Commodore 64Len LyonsAddison Wesley Microcomputer Books
Transactor Bits and Pieces #1 Transactor Publishing
Commodore 64 Color Graphics Beginners GuideShaffer and ShafferReston Publishing
Commodore 64 User's HandbookWSI StaffWebster Systems
Introducing Commodore 64 Machine CodeIan SinclairSpectrum/Prentice Hall


HOME

This page was last updated March 20, 2007
© Dredd Productions, Ltd
Hosting by WebRing.