Some more optimizations.
diff --git a/contiki-cpc/Makefile.cpc b/contiki-cpc/Makefile.cpc
index d2a303f..49b5ce7 100644
--- a/contiki-cpc/Makefile.cpc
+++ b/contiki-cpc/Makefile.cpc
@@ -64,7 +64,6 @@
./arch/clock.o \
./loader/dir.o \
./loader/loader-arch-cpc.o \
- ./arch/putchar.o \
./apps/directory-dsc.o \
../contiki/apps/processes-dsc.o \
../contiki/apps/program-handler.o \
diff --git a/contiki-cpc/arch/conio.s b/contiki-cpc/arch/conio.s
index c070b6f..c6c8bfd 100644
--- a/contiki-cpc/arch/conio.s
+++ b/contiki-cpc/arch/conio.s
@@ -7,9 +7,6 @@
;; cpc uses coordinates between 1..width, 1..height
-
-
-
; void clrscr (void);
; Clear the whole screen and put the cursor into the top left corner
; TESTED
@@ -115,21 +112,20 @@
; void cputcxy (unsigned char x, unsigned char y, char c)
; Same as "gotoxy (x, y); cputc (c);"
-.globl _cputcxy
+.globl _cputcyx
-_cputcxy::
- ld hl,#4
- add hl,sp
- ld e,(hl)
- dec hl
- ld a,(hl)
- dec hl
- ld h,(hl)
- ld l,a
+_cputcyx::
+ pop de ; RV
+ pop hl ; XY
+
inc h
inc l
call 0xBB75 ; TXT SET CURSOR
- ld a,e
+
+ dec sp
+ pop af ; C
+ push de
+
jp 0xbb5d
; void cputsn(char *str, unsigned char len);
@@ -207,10 +203,7 @@
.globl _chline
_chline::
- ld a,l
- or a
- ret z
- ld b,a
+ ld b,l
dochline$:
ld c,#0x09a
chlineloop$:
@@ -247,20 +240,14 @@
.globl _cvline
_cvline::
- ld a,l
- or a
- ret z
- ld b,a
+ ld b,l
call 0xBB78 ; TXT GET CURSOR
docvline$:
- ld c,#0x095
cvloop$:
push hl
push bc
call 0xBB75 ; TXT SET CURSOR
- pop bc
- push bc
- ld a,c
+ ld a,#0x095
call 0xbb5d
pop bc
pop hl
@@ -306,19 +293,18 @@
.globl _screensize
_screensize::
- pop bc ; RV
+ pop hl ; RV
pop de ; ptr1
- pop hl ; ptr2
ld a,#40 ; X Size
ld (de),a
+ pop de ; ptr2
ld a,#25 ; Y Size
- ld (hl),a
+ ld (de),a
- push hl
push de
- push bc
+ push de
- ret
+ jp (hl)
diff --git a/contiki-cpc/arch/contiki.lnk b/contiki-cpc/arch/contiki.lnk
index e88efb9..ebf8a1e 100644
--- a/contiki-cpc/arch/contiki.lnk
+++ b/contiki-cpc/arch/contiki.lnk
@@ -23,5 +23,4 @@
../contiki/apps/processes-dsc.o
./arch/main.o
./arch/arch.o
-./arch/putchar.o
-e
diff --git a/contiki-cpc/arch/putchar.s b/contiki-cpc/arch/putchar.s
deleted file mode 100644
index 91e42af..0000000
--- a/contiki-cpc/arch/putchar.s
+++ /dev/null
@@ -1,19 +0,0 @@
-;; File: putchar.s
-;; Modified to suit execution on the Amstrad CPC
-;; by H. Hansen 2003
-;; Original lines has been marked out!
-
- .area _CODE
-_putchar::
- ld hl,#2
- add hl,sp
-
- ld a,(hl)
-
- ld bc,#0xef00
- out (c),c
- or #0x80
- out (c),a
-
- ret
-
diff --git a/contiki-cpc/ctk/conio.h b/contiki-cpc/ctk/conio.h
index 0bdb257..9532b15 100644
--- a/contiki-cpc/ctk/conio.h
+++ b/contiki-cpc/ctk/conio.h
@@ -35,7 +35,8 @@
void cputc (char c) __z88dk_fastcall;
-void cputcxy (unsigned char x, unsigned char y, char c);
+void cputcyx (unsigned char y, unsigned char x, char c) __z88dk_callee;
+#define cputcxy(x,y,c) cputcyx(y,x,c)
void cputs (char* s) __z88dk_fastcall;
void cputsn(char *str, unsigned char len) __z88dk_callee;