Fix remaining bugs with the CPC ROM version.

- Fix an extra const for the icons that shouldn't be there for the ROM
  version. It is there in the loadable version of the DSC files to
  workaround linker script limitations, but in the ROM it results in
  trying to write to ROM when the icons are added to the desktop
- Fix a bug (broken code generation by the compiler?) that leads to
  vertical lines in windows not stopping where they should and going all
  the way down the screen (clipping was applied when it shouldn't,
  leading to an overflow)
diff --git a/README.md b/README.md
index 773a956..e4fd62a 100644
--- a/README.md
+++ b/README.md
@@ -149,8 +149,8 @@
 leaves more than 41K of free RAM for applications.
 
 Current memory usage (with memstats.prg + desktop.prg running):
-* Heap size: 41424 bytes
-* Free memory: 36962 bytes
+* Heap size: 41392 bytes
+* Free memory: 36930 bytes
 
 Firmware-based CTK driver
 -------------------------
diff --git a/contiki-cpc/Makefile.cpc b/contiki-cpc/Makefile.cpc
index d2b3c68..2b47311 100644
--- a/contiki-cpc/Makefile.cpc
+++ b/contiki-cpc/Makefile.cpc
@@ -38,7 +38,7 @@
 include Makefile.common
 
 CFLAGS:=$(CFLAGSCOMMON) --compile-only \
-        -DWITH_ASCII \
+	-DWITH_ASCII -DBUILDING_FOR_ROM=1 \
 	-DWITH_LOADER_ARCH=1
 
 UIP_OBJ = ../contiki/uip/dhcpc.o \
@@ -105,4 +105,6 @@
 	makebin -p -s 65536 -o 0xC000 < contiki.ihx > contiki.bin
 	cpcfs contiki.dsk f
 	cpcfs contiki.dsk p contiki.bin,256,256 -b -e
+	# Delete directory.dsc so it is rebuilt for the "programs" build with different defines
+	rm -f apps/directory-dsc.o ../contiki/apps/processes-dsc.o
 
diff --git a/contiki-cpc/apps/directory-dsc.c b/contiki-cpc/apps/directory-dsc.c
index caa0b63..e36d606 100644
--- a/contiki-cpc/apps/directory-dsc.c
+++ b/contiki-cpc/apps/directory-dsc.c
@@ -36,7 +36,7 @@
 #include "dsc.h"
 
 /*-----------------------------------------------------------------------------------*/
-const DSC(directory_dsc,
+DSC(directory_dsc,
     "Directory reader",
     "dir.prg",
     directory_init,
@@ -66,6 +66,10 @@
 };
 #endif /* CTK_CONF_ICON_TEXTMAPS */
 
-static const struct ctk_icon directory_icon =
+static
+#if !BUILDING_FOR_ROM
+const
+#endif
+struct ctk_icon directory_icon =
   {CTK_ICON("Directory", directoryicon_bitmap, directoryicon_textmap)};
 /*-----------------------------------------------------------------------------------*/
diff --git a/contiki-cpc/arch/crt0.s b/contiki-cpc/arch/crt0.s
index 325ef30..ce2e55b 100644
--- a/contiki-cpc/arch/crt0.s
+++ b/contiki-cpc/arch/crt0.s
@@ -72,8 +72,6 @@
 	jp	_main
 
 do_nothing:
-	LD A, #'K'
-	CALL #0xBB5A
 	scf
 	ret
 
diff --git a/contiki-cpc/ctk/ctk-conio-service.c b/contiki-cpc/ctk/ctk-conio-service.c
index 08f52c1..c2ea4c0 100644
--- a/contiki-cpc/ctk/ctk-conio-service.c
+++ b/contiki-cpc/ctk/ctk-conio-service.c
@@ -448,13 +448,11 @@
       }
     }
 
-    if(clipy2 < y1 + h) {
-      if(y1 >= clipy2) {
-	h = 0;
-      } else {
-	h = clipy2 - y1;
-      }
-    }
+	if(y1 >= clipy2) {
+		h = 0;
+	} else if(y1 + h > clipy2) {
+		h = clipy2 - y1;
+	}
 
     cvlinexy(x, y1, h);
     cvlinexy(x2, y1, h);  
diff --git a/contiki/apps/processes-dsc.c b/contiki/apps/processes-dsc.c
index 17a98e4..40c1f23 100644
--- a/contiki/apps/processes-dsc.c
+++ b/contiki/apps/processes-dsc.c
@@ -35,9 +35,13 @@
 
 #include "dsc.h"
 
-static const struct ctk_icon processes_icon;
+static
+#if !BUILDING_FOR_ROM
+const
+#endif
+struct ctk_icon processes_icon;
 /*-----------------------------------------------------------------------------------*/
-const DSC(processes_dsc,
+DSC(processes_dsc,
     "Process information",
     "process.prg",
     processes_init,
@@ -68,7 +72,11 @@
 #endif /* CTK_CONF_ICON_TEXTMAPS */
 
 #if CTK_CONF_ICONS
-static const struct ctk_icon processes_icon =
+static
+#if !BUILDING_FOR_ROM
+const
+#endif
+struct ctk_icon processes_icon =
   {CTK_ICON("Processes", processesicon_bitmap, processesicon_textmap)};
 #else
 extern struct ctk_icon processes_icon;