Avoid a firmware bug in defining custom characters.
Since icons now work everywhere, enable them.
diff --git a/contiki-cpc/conf/ctk-conf.h b/contiki-cpc/conf/ctk-conf.h
index cfe4925..f03c7f9 100644
--- a/contiki-cpc/conf/ctk-conf.h
+++ b/contiki-cpc/conf/ctk-conf.h
@@ -64,10 +64,10 @@
#define CTK_CONF_ICONS 1 /* 107 bytes */
/* Toggles support for icon bitmaps. */
-#define CTK_CONF_ICON_BITMAPS 0
+#define CTK_CONF_ICON_BITMAPS 1
/* Toggles support for icon textmaps. */
-#define CTK_CONF_ICON_TEXTMAPS 1
+#define CTK_CONF_ICON_TEXTMAPS 0
/* Toggles support for movable windows. */
#define CTK_CONF_WINDOWMOVE 1 /* 333 bytes */
diff --git a/contiki-cpc/ctk/ctk-conio-service.c b/contiki-cpc/ctk/ctk-conio-service.c
index fe10cfc..f162681 100644
--- a/contiki-cpc/ctk/ctk-conio-service.c
+++ b/contiki-cpc/ctk/ctk-conio-service.c
@@ -91,8 +91,19 @@
pop hl
push hl
push de
+ ; Can't use SCR SET MATRIX because some of our icons are in RAM under 0x4000.
+ ; SCR SET MATRIX then gets data from the firmware ROM...
+ ld a,#0x19
+ call 0xBB5a
ld a,#0xff
- jp 0xbba8 ; SCR SET MATRIX
+ call 0xBB5a
+ ld b,#8
+00001$:
+ ld a,(hl)
+ call 0xbb5a
+ inc hl
+ djnz 00001$
+ ret
__endasm;
}
@@ -219,7 +230,6 @@
gotoxy(xpos, ypos);
if(w->widget.icon.bitmap != NULL) {
unsigned char* ptr = w->widget.icon.bitmap;
- printf("ICON BMP %p\r\n", ptr);
for(i = 0; i < 3; ++i) {
gotoxy(xpos, ypos);
if(ypos >= clipy1 && ypos < clipy2) {
@@ -299,7 +309,7 @@
/*-----------------------------------------------------------------------------------*/
static void clearrect(unsigned char x2, unsigned char y2,
- unsigned char x1, unsigned char y1)
+ unsigned char x1, unsigned char y1) __naked
{
__asm
ld hl,#2
@@ -341,6 +351,9 @@
i = window->y + 2; // +1 for the border, +1 for ctk > cpc conversion
h = i + window->h;
+ if (i >= clipy2 || h < clipy1)
+ return;
+
if (i < clipy1) i = clipy1;
--clipy2;
if (h > clipy2) h = clipy2;
@@ -509,7 +522,8 @@
ld l,d
ld d,#40
- inc e
+ dec e
+ ;inc e
call 0xBB99 ; TXT GET PAPER
call 0xBC2C ; SCR INK ENCODE