alloc pamięć
This commit is contained in:
parent
0c913190f0
commit
5e402eff2a
Binary file not shown.
|
@ -14,7 +14,7 @@ _start:
|
||||||
# Clear the bss segment
|
# Clear the bss segment
|
||||||
la a0, __bss_start
|
la a0, __bss_start
|
||||||
la a1, __BSS_END__
|
la a1, __BSS_END__
|
||||||
|
j finish_bss
|
||||||
clear_bss:
|
clear_bss:
|
||||||
bgeu a0, a1, finish_bss
|
bgeu a0, a1, finish_bss
|
||||||
sb x0, 0(a0)
|
sb x0, 0(a0)
|
||||||
|
|
Binary file not shown.
|
@ -1,8 +1,5 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
char * ptr1 = "janek";
|
|
||||||
char * ptr2 = "kowalskii";
|
|
||||||
|
|
||||||
int strlen(char *s)
|
int strlen(char *s)
|
||||||
{
|
{
|
||||||
char *p = s;
|
char *p = s;
|
||||||
|
@ -39,35 +36,13 @@ char *alloc(int n)
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
char * s = "mpabi";
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t wynik =0;
|
|
||||||
wynik = strlen (s);
|
|
||||||
|
|
||||||
asm("nop");
|
struct key{
|
||||||
|
char *word;
|
||||||
|
int8_t count;
|
||||||
char * p1 = alloc(strlen(ptr1));
|
} keytab[10];
|
||||||
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);
|
|
||||||
|
|
||||||
|
struct key * Ptr = (struct key *) alloc(100);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue