1

I'm using the following IDC function to copy the RAM Data and Code sections from the packed binary, into the correct runtime locations for my Fujitsu FR system:

static idc_memcpy(source, dest, count, desc)
{
    auto i, val;

    SetCharPrm(INF_GENFLAGS, INFFL_LOADIDC|GetCharPrm(INF_GENFLAGS));
    Message("Copy %a: Start\n", dest);

    for(i = 0; i < count; i = i + 2 )
    {
        val = Word(source + i);
        PatchWord(dest + i, val);
    }

    SetCharPrm(INF_GENFLAGS, ~INFFL_LOADIDC&GetCharPrm(INF_GENFLAGS));

    MakeUnknown(source,count,DOUNK_EXPAND+DOUNK_DELNAMES);

    HideArea(source, source+count-1, desc, "", "", -1);
    SetHiddenArea(source, 1 );
    Message("Copy %a: End\n", dest);

}

But when I go to the source address I see:

ROM:00447E8C ; [0000C878 BYTES: BEGIN OF AREA RAM Data2 Source. PRESS KEYPAD "-" TO COLLAPSE]
ROM:00447E8C unk_447E8C:     .byte 0xFF              ; DATA XREF: Tsk32+176o
ROM:00447E8D                 .byte 0xFF
ROM:00447E8E                 .byte 0xFF
ROM:00447E8F                 .byte 0xFF
ROM:00447E90                 .byte    0
ROM:00447E91                 .byte 0x30 ; 0
ROM:00447E92                 .byte    0
ROM:00447E93                 .byte    0

I was hoping/expecting to have that area hidden, what am I doing wrong. If I press keypad - I get the error message:

IDA failed to display the program in graph mode. Only instructions belonging to functions can be displayed in graph mode.

2

Solved it after trying many things.

I had to change the data area to a byte array with

    MakeByte(source);
    MakeArray(source, byte_count);

after the MakeUnknown, and then call SetHidden with value 0

Also to the Hiding the Area with keyboard, the new default keys are Ctrl+-, the displayed text in IDA is wrong.

thus final code was:

static idc_memcpy(source, dest, byte_count, desc)
{
    auto i, val;

    SetCharPrm(INF_GENFLAGS, INFFL_LOADIDC|GetCharPrm(INF_GENFLAGS));
    Message("Copy %a: Start\n", dest);

    for(i = 0; i < byte_count; i = i + 2 )
    {
        val = Word(source + i);
        PatchWord(dest + i, val);
    }

    SetCharPrm(INF_GENFLAGS, ~INFFL_LOADIDC&GetCharPrm(INF_GENFLAGS));

    MakeUnknown(source,byte_count,DOUNK_EXPAND+DOUNK_DELNAMES);
    MakeByte(source);
    MakeArray(source, byte_count);

    HideArea(source, source+byte_count, desc, "", "", -1);
    SetHiddenArea(source, 0 );
    Message("Copy %a: End\n", dest);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.