I updated an old .idc script so it will now copy 64kb of a 512kb BIOS file to the F000: Segment under IDA Pro (Free) 7 :
#include <idc.idc>
// The script relocates a copy of the highest 64 KiB of a 512 KiB BIOS file to
// Segment: "F000:" for proper disassembly (adapted for use with IDA Pro 7).
static relocate_seg(src, dest)
{
auto ea_src, ea_dest, hi_limit;
hi_limit = src + 0x10000;
ea_dest = dest;
for(ea_src = src; ea_src < hi_limit ; ea_src = ea_src + 4 )
{
PatchDword( ea_dest, Dword(ea_src));
ea_dest = ea_dest + 4;
}
Message("Segment Relocation finished (inside relocate_seg function).\n");
}
static main()
{
Message("Creating F000: Segment (inside main entry point function)...\n");
SegCreate( (0xF000 << 4), (0x10000 << 4), 0xF000, 0, 0, 0);
SegRename( (0xF000 << 4), "F000");
relocate_seg( (0x7000 << 4), (0xF000 << 4) );
}
It works just fine for a 512kb size file. What I haven't been able to figure out: How to alter the script for a BIOS file that is only 8kb, or some size other than 512kb ?? I've tried replacing the "0x10000" with "0x2000" (for 8kb), but haven't been able to figure out what the "0x7000" does!? Can someone please explain what/why the various values are in the script... or at the very least, alter the code for say, an 8kb and 64kb size BIOS file that will make a copy with the last 16 bytes of each file at "F000:FFF0" ?? And any references that actually give actual examples of either a script or using the commands (again for IDA Free 7; so no python plug-ins) to move or copy code in a file to different segments would be great.
TIA, TheStarman.
PS: I'm posting these on my website for Assembly students/hobbyists to use in examining old PC BIOS; I've already posted the one shown here for looking at the VMware Legacy BIOS.440.ROM.