Example #1
0
int main(int argc, const char **argv)
{
  int opt;

#if 0
  if (argc != 2)
    {
      fprintf(stderr, "Usage: motlle `smottle`\n");
      exit(2);
    }
  sscanf(argv[1], "%p", &load_address);
#endif

  for (;;)
    switch (getopt(argc, argv, "+d"))
      {
      case 'd':
	debug_lvl = 2;
	break;
      case '?':
	break;
      case -1:
	goto done;
      }
 done:

  signal(SIGALRM, silly_sig);

  garbage_init();
  interpret_init();
  stack_init();
  runtime_init();
  call_init();
  parser_init();
  compile_init();
  mcompile_init();
  context_init();
  ports_init();
  if (optind < argc)
    make_global_state(argc - optind, argv + optind);
  else
    make_global_state(0, NULL);
  mudio_init();
  print_init();

  if (optind < argc)
    mload(argv[optind]);
  else
    push_repl();

  for (;;)
    motlle_run1();
}
Example #2
0
File: mudlle.c Project: MUME/mudlle
void mudlle_init(void)
{
  garbage_init();
  global_init();
  strbuf_init();
  print_init();
  stack_init();
  module_init();
  runtime_init();
  compile_init();
  mcompile_init();
  interpret_init();
  error_init();
  ports_init();
  context_init();
}
Example #3
0
int main(int argc, char **argv)
{
printf("\33[0;40;33m\n");	
printf("    FemtoForth  Copyright (C) 2014 Victor Yurkovsky\n");
printf("    This program comes with ABSOLUTELY NO WARRANTY'.\n");
printf("    This is free software, and you are welcome to redistribute it\n");
printf("    under certain conditions; type 'license' for details.\n\n");
color(COLOR_RESET);color(FORE_WHITE);
//---------------------------------------------------------------------
// Data segment.  Houses var at the bottom...  
//
        // memmap data segment
        U8* data_base = mmap((void*)0x04000000,
                 CODE_SIZE,
                 PROT_READ+PROT_WRITE+PROT_EXEC,
                 MAP_ANONYMOUS|MAP_PRIVATE|MAP_FIXED,
                 0,0);
        //var structure is placed into bottom RESERVED (512) bytes of data!
        lay = (sMemLayout*)data_base;           // HOST_RESERVED bytes 
        var = (sVar*)(data_base+HOST_RESERVED); // SYS_RESERVED bytes 
        
        // install system var structure at bottom
        lay->data_bottom = data_base;
        lay->data_top = data_base + CODE_SIZE;
        //
        var->data_ptr = lay->data_bottom + HOST_RESERVED + SYS_RESERVED;

        printf("data at %p->%p ",lay->data_bottom,lay->data_top);

//---------------------------------------------------------------------
// Table - runtime 
//
        lay->table_bottom = mmap((U8**)(CODE_ADDRESS/4),
                 sizeof(TINDEX)*TABLE_SIZE,
                 PROT_READ+PROT_WRITE+PROT_EXEC,
                 MAP_ANONYMOUS|MAP_SHARED|MAP_FIXED,
                 0,0);
        printf("TABLE at %p ",lay->table_bottom);
        lay->table_top = (U8*)lay->table_bottom + sizeof(TINDEX)*TABLE_SIZE;
       // var->table_ptr = (U8**)var->table_bottom;
       // *var->table_ptr++ = 0 ; //first table entry is always 0 !
      
//---------------------------------------------------------------------
// DSP
//
// 
        lay->dsp_bottom = (U8*)malloc(DSP_SIZE);
        lay->dsp_top = lay->dsp_bottom + DSP_SIZE;
 printf("DSP at %p ",lay->dsp_top);
//---------------------------------------------------------------------
// RSP
        lay->rsp_bottom = (U8*)malloc(RSP_SIZE);
        lay->rsp_top = lay->rsp_bottom + RSP_SIZE;
        var->sp_meow = (sRegsMM*)lay->rsp_top;
 printf("RSP at %p ",lay->rsp_top);
//---------------------------------------------------------------------
// HEAD
        lay->head_bottom = (U8*)malloc(HEAD_SIZE);
        lay->head_top = lay->head_bottom + HEAD_SIZE;
        var->head_ptr = lay->head_bottom;
 printf("HEAD at %p \n",lay->head_bottom);
//---------------------------------------------------------------------
// SRC 
        lay->src_bottom =  (char*)malloc(256);
        src_reset(); 
      
        head_build();
     
//  printf("data pointer is now at %p\n",var->data_ptr);
        kernel_load();
//  printf("data pointer is now at %p\n",var->data_ptr);
  
        cmd_init();
        lang_init();

//        int i;
//for(i=0;i<20;i++)

      
// U32 qqq = xxx(0x3456,0x1234);
// printf("bindings returns %x\n",1);
    interpret_init();
// src_error("ass");
//  call_meow();
  
 
   while(1)
      interpret_outer();
 // line();
//        int z = armFunction(99);
//        printf("assembly returnst %d\n",z);       
        exit(0);
}