commit 0d40873b426ce95884cdf8557636c0ed973c379b Author: lysyoli Date: Thu May 23 09:42:15 2024 +0000 pozdrawiam diff --git a/_rvmain.cpp b/_rvmain.cpp new file mode 100644 index 0000000..48eac9d --- /dev/null +++ b/_rvmain.cpp @@ -0,0 +1,72 @@ +#include + +char * ptr1 = "Oliwier"; +char * ptr2 = "Florjanczyk"; +int strlen(char *s) +{ + cha *p = s; + while (*p != '\0') + p++; + return p - s; +} + +void strcpy(char *s, char *t) +{ + while (*s++ = *t++); +} + + +#define ALLOCSIZE 10000 + +static char allocbuf[ALLOCSIZE]; +static char *allocp = allocbuf; + +char *alloc(int n) +{ + + if (n % 4 != 0) { + n += 4 - (n % 4); + } + + + if (allocbuf + ALLOCSIZE - allocp >= n) { + allocp += n; + return allocp - n; + } else + return 0; +} + +int main() { + + char * s = "mpabi"; + + + uint8_t wynik =0; + wynik = strlen (s); + + asm("nop"); + + + char * p1 = alloc(strlen(ptr1)); + strcpy (p1, ptr1); + asm("nop"); + + char * p2 = alloc(strlen(ptr2)); + strcpy (p2, ptr2); + asm("nop"); + + struct point { + int16_t x; + int16_t y; + }; + + struct point * ptrS = (struct point *) alloc(sizeof(point)); + ptrS->x=0x10; + ptrS->y=0x20; + asm("nop"); + + (*ptrS).y= strlen (p1)+ strlen(p2); + + return 1; +} +