Skip to content

Commit

Permalink
dynamic mem working less go
Browse files Browse the repository at this point in the history
  • Loading branch information
marceldobehere committed Oct 31, 2022
1 parent d5b14f6 commit fff01a7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions MAAL/bin/Debug/test.maal
Original file line number Diff line number Diff line change
@@ -1,10 +1,35 @@
loc MAIN:
char* test;
malloc 4 &test;
*((char*)((ulong)test + 0)) = 'H';
*((char*)((ulong)test + 1)) = 'I';
*((char*)((ulong)test + 2)) = '!';
*((char*)((ulong)test + 3)) = (char)0;

print "\nTEST 1: ";
print (ulong)test;

malloc 5 &test;
print "\nTEST 2: ";
print (ulong)test;

((ulong)test + 0) = 'H';
((ulong)test + 1) = 'O';
((ulong)test + 2) = 'I';
((ulong)test + 3) = '!';
((ulong)test + 4) = (char)0;

print "\nTEST 3: ";
print (ulong)test;

print "\nSTR: \"";
print test;
print "\"";

free test;

malloc 10 &test;
print "\nTEST 4: ";
print (ulong)test;

malloc 10 &test;
print "\nTEST 4 2: ";
print (ulong)test;


exit;
Binary file modified MAAL/bin/Debug/test.maal.maab
Binary file not shown.

0 comments on commit fff01a7

Please sign in to comment.