Further optimize conio driver

- Use __z88dk_callee where possible.
- Flip parameters around (with macros) for easier getting of params from asm.
- Remove some unused code
- Try to avoid slow C for loops.
diff --git a/contiki-cpc/arch/conio.s b/contiki-cpc/arch/conio.s
index c2107c9..c070b6f 100644
--- a/contiki-cpc/arch/conio.s
+++ b/contiki-cpc/arch/conio.s
@@ -66,20 +66,15 @@
 		inc		a
 		jp	0xBB72	; TXT SET ROW
 
-; void gotoxy (unsigned char x, unsigned char y)
+; void gotoyx (unsigned char y, unsigned char x)
 ; Set the cursor to the specified position 
-; y pushed first, then x
 
-.globl _gotoxy
+.globl _gotoyx
 
-_gotoxy::
-		pop hl
+_gotoyx::
 		pop de
+		pop hl
 		push de
-		push hl
-
-		ld l,d
-		ld h,e
 
 		inc h
 		inc l
@@ -143,12 +138,10 @@
 _cputsn::
 	pop de ; RV
 	pop hl ; str
+	dec sp
 	pop bc ; len
-	push bc
-	push hl
 	push de
 
-	LD B,C
 cputsn$:
 	LD A,(HL)
 	INC HL
@@ -228,24 +221,19 @@
 		djnz    chlineloop$
 		ret
 
-; void chlinexy (unsigned char x, unsigned char y, unsigned char length);
-; Same as "gotoxy (x, y); chline (length);"
+; void chlineyx (unsigned char y, unsigned char x, unsigned char length);
+; Same as "gotoxy (y, x); chline (length);"
 ; TESTED
 
-.globl _chlinexy
+.globl _chlineyx
 
-_chlinexy::
+_chlineyx::
 
-		POP HL ; RV
-		POP DE ; XY
+		POP DE ; RV
+		POP HL ; XY
+		DEC SP
 		POP BC ; L
-		PUSH BC
 		PUSH DE
-		PUSH HL
-
-		ld h,e
-		ld l,d
-		ld b,c
 
 		inc h
 		inc l
@@ -280,22 +268,17 @@
 		djnz	cvloop$
 		ret
 
-; void cvlinexy (unsigned char x, unsigned char y, unsigned char length);
-; Same as "gotoxy (x, y); cvline (length);"
+; void cvlineyx (unsigned char y, unsigned char x, unsigned char length);
+; Same as "gotoyx (y, x); cvline (length);"
 
-.globl _cvlinexy
+.globl _cvlineyx
 
-_cvlinexy::	
-		POP BC ; RV
-		POP DE ; XY
-		POP HL ; L.
-		PUSH HL
+_cvlineyx::	
+		POP DE ; RV
+		POP HL ; XY
+		DEC SP
+		POP BC ; L.
 		PUSH DE
-		PUSH BC
-
-		LD B,L
-		LD L,D
-		LD H,E
 
 		inc 		h
 		inc 		l
@@ -317,38 +300,6 @@
 		djnz	cclearloop$
 		ret
 
-; void cclearxy (unsigned char x, unsigned char y, unsigned char length);
-; Same as "gotoxy (x, y); cclear (length);"
-
-.globl _cclearxy
-
-_cclearxy::
-		ld		hl,#2
-		add		hl,sp
-		ld		d,(hl) ; X
-		inc		hl
-		ld		e,(hl) ; Y
-		inc		hl
-
-		ld		a,(hl) ; Length
-
-		; E is BOTTOM
-		; LEFT TOP
-		ld		h,d
-		ld		l,e
-
-		; RIGHT
-		dec 	a
-		add		d
-		ld		d,a
-
-		; ink mask
-		call	0xBB99 ; TXT GET PAPER
-		call	0xBC2C ; SCR INK ENCODE
-
-		jp	0xBC44 ; SCR FILL BOX
-
-
 ; void screensize (unsigned char* x, unsigned char* y);
 ; Return the current screen size.
 
diff --git a/contiki-cpc/ctk/conio.h b/contiki-cpc/ctk/conio.h
index 67669cf..0bdb257 100644
--- a/contiki-cpc/ctk/conio.h
+++ b/contiki-cpc/ctk/conio.h
@@ -26,7 +26,8 @@
 
 void gotoy (unsigned char y) __z88dk_fastcall;
 
-void gotoxy (unsigned char x, unsigned char y);
+void gotoyx (unsigned char y, unsigned char x) __z88dk_callee;
+#define gotoxy(x,y) gotoyx(y,x)
 
 unsigned char wherex (void);
 
@@ -37,7 +38,7 @@
 void cputcxy (unsigned char x, unsigned char y, char c);
 
 void cputs (char* s) __z88dk_fastcall;
-void cputsn(char *str, unsigned char len);
+void cputsn(char *str, unsigned char len) __z88dk_callee;
 
 char cgetc (void);
 
@@ -51,16 +52,16 @@
 
 void chline (unsigned char length) __z88dk_fastcall;
 
-void chlinexy (unsigned char x, unsigned char y, unsigned char length);
+void chlineyx (unsigned char y, unsigned char x, unsigned char length) __z88dk_callee;
+#define chlinexy(x,y,l) chlineyx(y,x,l)
 
 void cvline (unsigned char length) __z88dk_fastcall;
 
-void cvlinexy (unsigned char x, unsigned char y, unsigned char length);
+void cvlineyx (unsigned char y, unsigned char x, unsigned char length) __z88dk_callee;
+#define cvlinexy(x,y,l) cvlineyx(y,x,l)
 
 void cclear (unsigned char length) __z88dk_fastcall;
 
-void cclearxy (unsigned char x, unsigned char y, unsigned char length);
-
 void screensize (unsigned char* x, unsigned char* y);
 
 #endif /* __conio_h__ */
diff --git a/contiki-cpc/ctk/ctk-conio-service.c b/contiki-cpc/ctk/ctk-conio-service.c
index 0e95530..0a7bff7 100644
--- a/contiki-cpc/ctk/ctk-conio-service.c
+++ b/contiki-cpc/ctk/ctk-conio-service.c
@@ -68,12 +68,11 @@
 /*-----------------------------------------------------------------------------------*/
 
 
-static void customchr(unsigned char* data) __naked
+static void customchr(unsigned char* data) __naked __z88dk_callee
 {
     __asm
 	pop de
 	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...
@@ -476,9 +475,7 @@
   cputcxy(x2, y2, CH_LRCORNER);
   
   /* Clear dialog contents. */
-  for(i = y1; i < y2; ++i) {
-    cclearxy(x1, i, dialog->w);
-  }
+  clearrect(y2 - 1, x1 + dialog->w - 1, y1, x1);
 
   draw_window_contents(dialog, CTK_FOCUS_DIALOG, 0, sizey,
 		       x1, x2, y1, y2);
@@ -488,20 +485,18 @@
 s_ctk_draw_clear(unsigned char y1, unsigned char y2) __naked
 {
   __asm
-		ld		hl,#2
-		add		hl,sp
-		ld		d,(hl) ; Y1
-		inc		hl
-		ld		e,(hl) ; Y2
+	  pop de
+	  pop hl
+	  push hl
+	  push de
 
 		push af
 
+		ld		e,h
 		ld		h,#1
-		ld		l,d
 		ld d,#40
 
 		dec e
-		;inc e
 
 		call	0xBB99 ; TXT GET PAPER
 		call	0xBC2C ; SCR INK ENCODE