From 62a1f1cec488fedae5c96c3423400f12370d9eb5 Mon Sep 17 00:00:00 2001 From: Janne Johansson Date: Thu, 6 Jan 2022 18:04:34 +0000 Subject: [PATCH] Add function to clear pixels in c64-bitmap.c. --- src/main/kc/include/c64-bitmap.h | 3 +++ src/main/kc/lib/c64-bitmap.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/main/kc/include/c64-bitmap.h b/src/main/kc/include/c64-bitmap.h index 322fbd11a..0b840435b 100644 --- a/src/main/kc/include/c64-bitmap.h +++ b/src/main/kc/include/c64-bitmap.h @@ -12,5 +12,8 @@ void bitmap_clear(char bgcol, char fgcol); /// Plot a single dot in the bitmap void bitmap_plot(unsigned int x, char y); +/// Clear a single dot in the bitmap +void bitmap_unplot(unsigned int x, char y); + /// Draw a line on the bitmap using bresenhams algorithm void bitmap_line(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2); diff --git a/src/main/kc/lib/c64-bitmap.c b/src/main/kc/lib/c64-bitmap.c index 9c4c7886f..87539bb8d 100644 --- a/src/main/kc/lib/c64-bitmap.c +++ b/src/main/kc/lib/c64-bitmap.c @@ -50,6 +50,12 @@ void bitmap_plot(unsigned int x, char y) { *plotter |= bitmap_plot_bit[BYTE0(x)]; } +void bitmap_unplot(unsigned int x, char y) { + char* plotter = (char*) MAKEWORD( bitmap_plot_yhi[y], bitmap_plot_ylo[y] ); + plotter += ( x & $fff8 ); + *plotter &= ~(bitmap_plot_bit[BYTE0(x)]); +} + // Draw a line on the bitmap using bresenhams algorithm void bitmap_line(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2) { unsigned int x = x1;