Skip to content

Instantly share code, notes, and snippets.

@andrzejsliwa
Created April 18, 2022 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrzejsliwa/d3835ddcbbca91591ae009fcb9c3f8db to your computer and use it in GitHub Desktop.
Save andrzejsliwa/d3835ddcbbca91591ae009fcb9c3f8db to your computer and use it in GitHub Desktop.
#include <c64.h>
#include <stdio.h>
unsigned byte* const SCREEN = (char*)$0400;
void main() {
fillscreen(SCREEN, $20);
charset();
}
void charset() {
unsigned byte i = 0;
unsigned byte max = 32 + 32 + 32 + 2;
do {
unsigned byte column = (i % 32) + 4;
unsigned byte row = (i / 32) + 4;
unsigned byte *pointer = SCREEN + (row * 40) + column;
*pointer = i;
//printf("row %u, col %u - %p\n", row, column, pointer);
i++;
} while (i != max);
}
void fillscreen(char* screen, char fill) {
for( char* cursor = screen; cursor < screen+1000; cursor++) {
*cursor = fill;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment