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.

  • Apparently everyone believes this is too simplistic a question to bother answering? I guess I'll just have to keep 'plugging away' at it until I get an 'Aha' moment.
    – TheStarman
    Mar 23, 2023 at 17:52

1 Answer 1


Although I would still very much like to know the significance of each of the values in the .idc script file I displayed above, and how to edit it for 128 KiB, 256 KiB or even files larger than 512 KiB, when it comes to 64 KiB or smaller files, there's really no point in using such a script file! We can simply load them with the "Loading" and "Offset" addresses in IDA's initial configuration window: 0xF000 (for loading segment) and either an Offset of 0xE000, 0xC000, 0x8000 or 0x0000 for 8, 16, 32 or 64 KiB, respectively; which is what I decided to show on my webpage here: https://thestarman.pcministry.com/asm/bios/ida7/index.html#ibm1rom

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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