[FEAT] substr

This commit is contained in:
2021-12-13 14:52:38 +01:00
parent 0421f7f154
commit 788c5d6c6e
3 changed files with 17 additions and 2 deletions

View File

@@ -423,9 +423,9 @@ int rnd(int x) {
srand(x);
}*/
char tostr_tmp[256];
char str_tmp[256];
const char* tostr(float val) {
return SDL_itoa(val, tostr_tmp, 10);
return SDL_itoa(val, str_tmp, 10);
}
void debug_set_prompt() {
@@ -489,6 +489,12 @@ const char* chr(uint8_t ascii) {
return chr_trans;
}
const char* substr(const char* str, uint8_t start, uint8_t length) {
memcpy(str_tmp, &str[start], length);
str_tmp[length] = '\0';
return str_tmp;
}
void setchar(uint8_t index, uint8_t b0, uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4, uint8_t b5, uint8_t b6, uint8_t b7) {
mem[MEM_CHAR_OFFSET+index*8] = b0;
mem[MEM_CHAR_OFFSET+index*8+1] = b1;