import capstone, struct, sys
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
data=open(r"C:/git/bt411/content/BTL4OPT.EXE","rb").read()
CODE_VA=0x401000; CODE_RA=0xE00
md=capstone.Cs(capstone.CS_ARCH_X86, capstone.CS_MODE_32)
def dump(start,end,lo,hi):
    code=data[CODE_RA+(start-CODE_VA):CODE_RA+(end-CODE_VA)]
    for ins in md.disasm(code,start):
        if lo <= ins.address <= hi:
            print(f"{ins.address:08x}: {ins.mnemonic} {ins.op_str}")
    print("---")
dump(0x4baa88,0x4bad10,0x4bac90,0x4bacf5)
dump(0x4bace8,0x4baf20,0x4bae70,0x4baef5)
