Skip to content
/ c64lib Public

Library of useful Commodore 64 assembly routines

Notifications You must be signed in to change notification settings

barryw/c64lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f15e0d6 · Apr 9, 2020

History

12 Commits
Mar 21, 2020
Apr 9, 2020
Mar 24, 2020
Mar 22, 2020
Mar 26, 2020
Mar 21, 2020
Mar 21, 2020
Mar 25, 2020
Mar 21, 2020
Mar 22, 2020
Mar 21, 2020
Mar 24, 2020
Mar 21, 2020
Mar 22, 2020
Mar 22, 2020
Mar 21, 2020
Mar 25, 2020
Mar 24, 2020
Mar 26, 2020
Mar 21, 2020
Mar 22, 2020
Mar 24, 2020
Apr 9, 2020
Mar 26, 2020
Mar 26, 2020
Mar 21, 2020
Mar 21, 2020
Apr 9, 2020

Repository files navigation

     _____  __ _  _   _      _ _
    / ____|/ /| || | | |    (_) |
   | |    / /_| || |_| |     _| |__
   | |   | '_ \__   _| |    | | '_ \
   | |___| (_) | | | | |____| | |_) |
    \_____\___/  |_| |______|_|_.__/

Introduction

This is a collection of libraries for making C64 development more enjoyable using KickAssembler [http://theweb.dk/KickAssembler/Main.html#frontpage]

It contains pseudocommands, macros, constants and functions.

Using C64Lib

To use from your own project, clone this repository and reference the cloned directory using the -libdir KickAssembler command line parameter.

java –jar kickass.jar your_main.asm -libdir ~/Git/c64lib/

You can also use my KickAssembler docker container:

docker run -v ${PWD}:/workspace barrywalker71/kickassembler:latest /workspace/your_main.asm

Specify the location of the cloned directory in the -libdir parameter. In this example, it's ~/Git/c64lib, but use whatever location you cloned the directory to.

In your your_main.asm file, include either the include_me_full.asm or the include_me_min.asm files:

#include "include_me_full.asm"

or

#include "include_me_min.asm"

The include_me_min.asm file only brings in the pseudocommands, macros and constants. Inclding include_me_full.asm will also bring in sprites, timer and memory routines.

You can also include individual features:

  • include_me_memory.asm
  • include_me_sprites.asm
  • include_me_timers.asm

What's included?

Bringing in the include_me_min.asm file gives you access to:

  • All of the Kernal constants. (kernal namespace)
  • All of the BASIC constants. (basic namespace)
  • All of the VIC-II constants. (vic namespace)
  • The constants for the 32 addresses of the twin CIAs (CIA1 and CIA2). (cia namespace)
  • 29 constants for the SID chip. (sid namespace)
  • A bunch of pseudocommands to make your code easier to write and more consistent.
  • A bunch of macros to further ease development.
  • Constants used by the library that can also be used in your own code.
  • 8 16-bit zeropage pseudo registers modeled after the way the GEOS guys did it (r0, r0L, r0H, etc). NOTE: If you're using BASIC, these registers will conflict with addresses in use by it.

Using include_me_full.asm brings in these additional features:

  • Sprite routines
  • Memory fill and copy routines
  • Timer routines for single-shot and continuous timers

NOTE There is a hardware register version of the sprite routines if you can't spare, or can't use ZP memory. You can include include_me_sprites_r.asm to use it. The sprite macros below will automatically adapt and are called the same way as the pseudo register versions.

I will work on making hardware register versions of the other routines as well.

What's available for sprites?

Start by including include_me_sprites.asm in your project. If you need access to other routines, include include_me_full.asm

Enabling a sprite
SpriteEnable(0, TRUE)

or

SpriteEnable(0, FALSE)
Setting a sprite's priority
SpritePriority(0, SPR_BG)

or

SpritePriority(0, SPR_FG)
Setting a sprite's X/Y expand
SpriteXExpand(0, SPR_NORMAL)

or

SpriteYExpand(0, SPR_EXPAND)
Setting a sprite's color mode
SpriteColorMode(0, SPR_HIRES)

or

SpriteColorMode(0, SPR_MULTICOLOR)
To move a sprite
PositionSprite(0, spr_x_pos, spr_y_pos)

Store the sprite's x position (0-319) in the word at spr_x_pos and the sprite's y position (0-255) in the byte at spr_y_pos.

This routine automatically handles the sprite's MSB when the x position is > 255

About

Library of useful Commodore 64 assembly routines

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published