diff --git a/include/conio.c b/include/conio.c index a99ad3d..805e0bf 100644 --- a/include/conio.c +++ b/include/conio.c @@ -323,10 +323,7 @@ void putch(char c) void clrscr(void) { - __asm - { - jsr bsinit - } + putrch(147); } void textcursor(bool show) @@ -350,6 +347,24 @@ void textcolor(char c) *(volatile char *)0x0286 = c; } +void bgcolor(char c) +{ + *(volatile char *)0xd021 = c; +} + +void bordercolor(char c) +{ + *(volatile char *)0xd020 = c; +} + +void revers(char r) +{ + if (r) + putrch(18); + else + putrch(18 + 128); +} + char wherex(void) { #if defined(__C128__) || defined(__C128B__) || defined(__C128E__) diff --git a/include/conio.h b/include/conio.h index a401398..60ed66f 100644 --- a/include/conio.h +++ b/include/conio.h @@ -43,6 +43,26 @@ void dispmode80col(void); #define PETSCII_F7 0x88 #define PETSCII_F8 0x8c +enum ConioColors +{ + COLOR_BLACK, + COLOR_WHITE, + COLOR_RED, + COLOR_CYAN, + COLOR_PURPLE, + COLOR_GREEN, + COLOR_BLUE, + COLOR_YELLOW, + + COLOR_ORANGE, + COLOR_BROWN, + COLOR_LT_RED, + COLOR_DARK_GREY, + COLOR_MED_GREY, + COLOR_LT_GREEN, + COLOR_LT_BLUE, + COLOR_LT_GREY +}; // Lowlevel console in/out // using petscii translation @@ -74,6 +94,12 @@ void gotoxy(char x, char y); inline void textcolor(char c); +inline void bgcolor(char c); + +inline void bordercolor(char c); + +inline void revers(char r); + inline char wherex(void); inline char wherey(void); diff --git a/include/stdio.c b/include/stdio.c index 634e939..3bdf8ed 100644 --- a/include/stdio.c +++ b/include/stdio.c @@ -417,7 +417,7 @@ char * sformat(char * buff, const char * fmt, int * fps, bool print) si.precision = i; } - if (c == 'd' || c == p'd') + if (c == 'd' || c == p'd' || c == 'i' || c == p'i') { bi = nformi(&si, bp, *fps++, true); } diff --git a/include/string.c b/include/string.c index c711a98..6a4a5a5 100644 --- a/include/string.c +++ b/include/string.c @@ -138,6 +138,20 @@ char * cpycat(char * dst, const char * src) #pragma native(cpycat) +char* strchr( const char* str, int ch ) +{ + char * p = (char *)str; + + while (*p != (char)ch) + { + if (!*p) + return nullptr; + p++; + } + return p; +} + + void * memset(void * dst, int value, int size) { __asm diff --git a/include/string.h b/include/string.h index 29ac884..c28bfb0 100644 --- a/include/string.h +++ b/include/string.h @@ -21,6 +21,8 @@ int memcmp(const void * ptr1, const void * ptr2, int size); void * memmove(void * dst, const void * src, int size); +char* strchr( const char* str, int ch ); + #pragma intrinsic(strcpy) #pragma intrinsic(memcpy)