In this page...


Index
home

Usage

c128lib is a set of libraries that can be used in assembly programs written with Kick Assembler. Each library has one or more source files that can be then imported in your Kick Assembler program. The most convenient is using Gradle.

Setting up Gradle

If you don’t have Gradle in you system, you have to install it first. So, you need two step:

Check specific documentation for these two steps.

If everything went well, you should open command prompt in your project folder (or a terminal window if you use Visual Studio Code) and type:

C:\project>gradle wrapper

Then, you should edit (or create) your build.gradle, that is a sort of settings file for your project. Your file should be like this:

plugins {
    id "com.github.c64lib.retro-assembler" version "1.5.1"
}

retroProject {
    dialect = "KickAssembler"
    dialectVersion = "5.25"
    libDirs = [".ra/deps/c128lib"]

    libFromGitHub "c128lib/common", "0.5.0"
    libFromGitHub "c128lib/chipset", "0.4.0"
}

plugins refers to Retro Build Tool. The complete manual for Retro Build Tool is available here.

retroProject contains details about your project:

Importing c128lib projects and libraries

Importing libraries is quite simple and it’s made by using an import directive like this:

#import "vic2.asm"

Labels are available by using this syntax:

lda <c128lib-namespace>.<module-namespace>.<label-name>

For example, if you need x-coordinate of sprite 2, you can use:

lda c128lib.Vic2.SPRITE_2_X

This would be translated to:

lda $D004

Unfortunately, macros cannot be accessed directly, so them are exposed with a prefix like c128lib_, through a *\_global.asm file. So if you need a macro, you need to use:

#import "vic2_global.asm"

and use macros like this:

c128lib_setRaster(100)

Did you find any errors or would you like to suggest an improvement? Open an issue