Human68k CUI emulator with sound.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test-mem.c 926B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include <stdio.h>
  2. #include "v68.h"
  3. #include "v68mem.h"
  4. int main(int argc, char **argv, char **envp) {
  5. struct v68 v;
  6. v68_init(16000000, 2 * 1024 * 1024, 44100);
  7. v68_mem_dump();
  8. uint32_t m1 = v68_mem_alloc(1024, 0);
  9. printf("Allocated 1024B @0x%08x\n", m1);
  10. v68_mem_dump();
  11. uint32_t m2 = v68_mem_alloc(4096, 0);
  12. printf("Allocated 4096B @0x%08x\n", m2);
  13. v68_mem_dump();
  14. uint32_t m3 = v68_mem_alloc(2048, 0);
  15. printf("Allocated 2048B @0x%08x\n", m3);
  16. v68_mem_dump();
  17. uint32_t f = v68_mem_free(m2, 0);
  18. printf("Freed 0x%06x %d\n", m2, f);
  19. v68_mem_dump();
  20. f = v68_mem_free(m1, 0);
  21. printf("Freed 0x%06x %d\n", m1, f);
  22. v68_mem_dump();
  23. uint32_t m4 = v68_mem_alloc(1024, 0);
  24. printf("Allocated 1024B @0x%08x\n", m4);
  25. v68_mem_dump();
  26. f = v68_mem_free(m1, 0);
  27. printf("Freed 0x%06x %d\n", m1, f);
  28. v68_mem_dump();
  29. f = v68_mem_free(m3, 0);
  30. printf("Freed 0x%06x %d\n", m3, f);
  31. v68_mem_dump();
  32. return 0;
  33. }