Esempio n. 1
0
static label_entry dumpAsmLabel( label_entry l_entry, section_ptr sec,
                                 orl_sec_offset curr_pos, orl_sec_offset end,
                                 unsigned_8 *contents, char *buffer )
{
    int         raw;
    int         is_masm;

    end = end;

    raw = buffer && contents;

    is_masm = IsMasmOutput();

    while( l_entry != NULL
        && ( l_entry->type == LTYP_ABSOLUTE || l_entry->offset <= curr_pos ) ) {
        switch( l_entry->type ) {
        case( LTYP_ABSOLUTE ):
            // no print any absolute label here
            break;
        case( LTYP_SECTION ):
            if( is_masm )
                break;
            /* fall through */
        case( LTYP_NAMED ):
            if( strcmp( l_entry->label.name, sec->name ) == 0 )
                break;
            /* fall through */
        case( LTYP_UNNAMED ):

            if( raw ) {
                strncpy( buffer, (char *)contents + curr_pos, sizeof( unsigned_32 ) );
            }
            if( l_entry->type == LTYP_UNNAMED ) {
                if( !(DFormat & DFF_ASM) ) {
                    BufferStore( "\t     %04X\t%c$%d:", LabelChar, curr_pos,
                                 l_entry->label.number );
                    if( raw ) {
                        printRawAndAddress( buffer, curr_pos );
                    }
                } else {
                    if( l_entry->offset != curr_pos ) {
                        BufferStore( "%c$%d equ $-%d", LabelChar, l_entry->label.number, (int)( curr_pos - l_entry->offset ) );
                    } else {
                        BufferStore( "%c$%d:", LabelChar, l_entry->label.number );
                    }
                }
            } else {
                if( !(DFormat & DFF_ASM) ) {
                    BufferStore( "\t     %04X\t%s:", curr_pos,
                                 l_entry->label.name );
                    if( raw ) {
                        printRawAndAddress( buffer, curr_pos );
                    }
                } else {
                    if( l_entry->offset != curr_pos ) {
                        BufferStore( "%s equ $-%d", l_entry->label.name, (int)( curr_pos - l_entry->offset ) );
                    } else {
                        BufferStore( "%s:", l_entry->label.name );
                    }
                }
            }
            BufferConcatNL();
            BufferPrint();
        }
        l_entry = l_entry->next;
    }
    return( l_entry );
}
Esempio n. 2
0
static label_entry dumpAsmLabel( label_entry l_entry, section_ptr section,
                                 dis_sec_offset curr_pos, dis_sec_offset end,
                                 unsigned_8 *contents, char *buffer )
{
    bool        raw;
    bool        is_masm;

    /* unused parameters */ (void)end;

    raw = ( buffer != NULL && contents != NULL );

    is_masm = IsMasmOutput();

    for( ; l_entry != NULL && ( l_entry->type == LTYP_ABSOLUTE || l_entry->offset <= curr_pos ); l_entry = l_entry->next ) {
        switch( l_entry->type ) {
        case LTYP_ABSOLUTE:
            // no print any absolute label here
            break;
        case LTYP_SECTION:
            if( is_masm )
                break;
            /* fall through */
        case LTYP_NAMED:
            if( strcmp( l_entry->label.name, section->name ) == 0 )
                break;
            /* fall through */
        case LTYP_UNNAMED:
            if( raw ) {
                strncpy( buffer, (char *)contents + curr_pos, sizeof( unsigned_32 ) );
            }
            if( l_entry->type == LTYP_UNNAMED ) {
                if( (DFormat & DFF_ASM) == 0 ) {
                    BufferStore( "\t     %04X\t%c$%d:", LabelChar, curr_pos, l_entry->label.number );
                    if( raw ) {
                        printRawAndAddress( buffer, curr_pos );
                    }
                } else {
                    if( l_entry->offset != curr_pos ) {
                        BufferStore( "%c$%d equ $-%d", LabelChar, l_entry->label.number, (int)( curr_pos - l_entry->offset ) );
                    } else {
                        BufferStore( "%c$%d:", LabelChar, l_entry->label.number );
                    }
                }
            } else {
                if( (DFormat & DFF_ASM) == 0 ) {
                    BufferStore( "\t     %04X\t%s:", curr_pos, l_entry->label.name );
                    if( raw ) {
                        printRawAndAddress( buffer, curr_pos );
                    }
                } else {
                    if( l_entry->offset != curr_pos ) {
                        BufferStore( "%s equ $-%d", l_entry->label.name, (int)( curr_pos - l_entry->offset ) );
                    } else {
                        BufferStore( "%s:", l_entry->label.name );
                    }
                }
            }
            BufferConcatNL();
            BufferPrint();
        }
    }
    return( l_entry );
}