consolidate duplicated code into read_rom_header()