Add some std library functions
This commit is contained in:
parent
df18dc273e
commit
e7b0d17a83
|
@ -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__)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue