Esempio n. 1
0
int main(void)
{
  consoleDemoInit();

  iprintf("Phase#01 Sandbox\n");

  // run scheme
  // allocate 3.5MB memory for scheme
  // 1.5MB used for a stack
  // 2.0MB used for a heap
  int memory_size = 3670016;
  void* scheme_memory = malloc(memory_size);
  if (scheme_memory == NULL)
  {
    iprintf("ERROR: Couldn't allocate memory for scheme");

    while(1) {
      swiWaitForVBlank();
    }
  }

  int taggedResult = scheme_entry(scheme_memory, memory_size);
  int result = taggedResult >> 3;

  iprintf("scheme_entry returned: %i", result);

  while(1) {
    swiWaitForVBlank();
  }
}
Esempio n. 2
0
int main(int argc, char** argv) {
  int stack_size = 16 * 4096; // 16K byte
  int heap_size = (4 * 16 * 4096);
  char* stack_base = allocate_protected_space(stack_size);
  char* stack_top = stack_base + stack_size;
  char* heap_base = allocate_protected_space(heap_size);
  char* heap_top = heap_base + heap_size;

  /*printf("heap base:%u\n", (unsigned int)heap_base);*/
  context ctx;
  print_ptr(scheme_entry(&ctx, stack_top, heap_base));
  deallocate_protected_space(stack_base, stack_size);
  deallocate_protected_space(heap_base, heap_size);
  return 0;
}
Esempio n. 3
0
int main(int argc, char** argv){
  long long val = scheme_entry();
  if ((val & fixnum_mask) == fixnum_tag) {
    // printf("%lld\n", val >> fixnum_shift);
    printf("%lld", val >> fixnum_shift);
  } else if (val == empty_list) {