Esempio n. 1
0
static void do_init_stuff( char **cmdline )
/*****************************************/
{
    char        *env;
    char        buff[80];

    if( !MsgInit() )
        exit(1);

    AsmInit( -1, -1, -1, -1 );                // initialize hash table
    strcpy( buff, "__WASM__=" BANSTR( _BANVER ) );
    add_constant( buff );
    ForceInclude = getenv( "FORCE" );
    do_envvar_cmdline( "WASM" );
    parse_cmdline( cmdline );
    set_build_target();
    get_os_include();
    env = getenv( "INCLUDE" );
    if( env != NULL )
        AddStringToIncludePath( env );
    if( !Options.quiet && !Options.banner_printed ) {
        Options.banner_printed = TRUE;
        trademark();
    }
    open_files();
    PushLineQueue();
    AsmLookup( "$" );    // create "$" symbol for current segment counter
}
Esempio n. 2
0
void PragmaInit( void )
/*********************/
{
    int         cpu;
    int         fpu;

    pragmaAuxInfoInit();

    AsmFuncNum = 0;
    switch( GET_CPU( ProcRevision ) ) {
    case CPU_86:    cpu = 0; break;
    case CPU_186:   cpu = 1; break;
    case CPU_286:   cpu = 2; break;
    case CPU_386:   cpu = 3; break;
    case CPU_486:   cpu = 4; break;
    case CPU_586:   cpu = 5; break;
    case CPU_686:   cpu = 6; break;
#if _CPU == 8086
    default:        cpu = 0; break;
#else
    default:        cpu = 3; break;
#endif
    }
    switch( GET_FPU_LEVEL( ProcRevision ) ) {
    case FPU_NONE:  fpu = 0; break;
    case FPU_87:    fpu = 1; break;
//    case FPU_287:   fpu = 2; break;
    case FPU_387:   fpu = 3; break;
    case FPU_586:   fpu = 3; break;
    case FPU_686:   fpu = 3; break;
#if _CPU == 8086
    default:        fpu = 1; break;
#else
    default:        fpu = 3; break;
#endif
    }

#if _CPU == 8086
    AsmInit( 0, cpu, fpu, GET_FPU_EMU( ProcRevision ) );
#else
    AsmInit( 1, cpu, fpu, FALSE );
#endif
}
Esempio n. 3
0
static void assemblerInit(      // INITIALIZATION OF ASSEMBLER
    INITFINI* defn )            // - definition
{
    int         cpu;
    int         fpu;

    defn = defn;
    switch( GET_CPU( CpuSwitches ) ) {
    case CPU_86:    cpu = 0; break;
    case CPU_186:   cpu = 1; break;
    case CPU_286:   cpu = 2; break;
    case CPU_386:   cpu = 3; break;
    case CPU_486:   cpu = 4; break;
    case CPU_586:   cpu = 5; break;
    case CPU_686:   cpu = 6; break;
#if _CPU == 8086
    default:        cpu = 0; break;
#else
    default:        cpu = 3; break;
#endif
    }
    switch( GET_FPU_LEVEL( CpuSwitches ) ) {
    case FPU_NONE:  fpu = 0; break;
    case FPU_87:    fpu = 1; break;
//    case FPU_287:   fpu = 2; break;
    case FPU_387:   fpu = 3; break;
    case FPU_586:   fpu = 3; break;
    case FPU_686:   fpu = 3; break;
#if _CPU == 8086
    default:        fpu = 1; break;
#else
    default:        fpu = 3; break;
#endif
    }
#if _CPU == 8086
    AsmInit( 0, cpu, fpu, GET_FPU_EMU( CpuSwitches ) );
#else
    AsmInit( 1, cpu, fpu, FALSE );
#endif
}
Esempio n. 4
0
void main( void ) {
//*****************

    int         ctr;
    char        in_str[80];
    asmreloc    *reloc, *next;

    TRMemOpen();

    AsmInit();
    curLine = 0;
    AsmCodeBuffer = (unsigned char*)buffer;
    AsmCodeAddress = 0;
    printf( "AsmCodeAddress = %u.\n", (unsigned)AsmCodeAddress );
    gets( in_str );
    while( strcmp( in_str, "q" ) != 0 ) {
        curLine++;
        AsmLine( in_str );
        printf( "AsmCodeAddress = %u.\n", (unsigned)AsmCodeAddress );
        // AsmCodeAddress is now updated, and code is filled from
        // AsmCodeBuffer[0] to AsmCodeBuffer[AsmCodeAddress/ins_size-1]
        // inclusive.
        gets( in_str );
    }

    printf( "Generated [before internal fixup]:\n" );
    for( ctr = 0; ctr < AsmCodeAddress / sizeof( buffer[0] ); ctr++ ) {
        printf( " [%#010x]\n", buffer[ctr] );
    }
    AsmFini();
    printf( "Generated [after internal fixup]:\n" );
    for( ctr = 0; ctr < AsmCodeAddress / sizeof( buffer[0] ); ctr++ ) {
        printf( " [%#010x]\n", buffer[ctr] );
    }

    for( reloc = AsmRelocs; reloc; reloc = next ) {
        next = reloc->next;
        printf( "Reloc:\tname = %s\n"
                "\toffset = %#010x\n"
                "\ttype = %s\n",
                reloc->name, reloc->offset, typeName[reloc->type] );
        AsmFree( reloc->name );
        AsmFree( reloc );
    }

#ifdef TRMEM
    TRMemPrtList();
#endif
    TRMemClose();
}