import struct, sys, io sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') DUMP = r"C:/Users/vikto/Documents/Claude/rt-4d/radio-spi-dump.bin" data = open(DUMP, "rb").read() def hx(b): return " ".join(f"{x:02X}" for x in b) def parse_bcd(bcd): if all(b==0xFF for b in bcd): return 0 r=0 for bv in reversed(bcd): hi=(bv>>4)&0xF; lo=bv&0xF if hi==0xF: hi=0 if lo==0xF: lo=0 r=r*100+hi*10+lo return r # Are 0x1C000 blocks packed 48B channels identical to main channels 0x4000? print("Compare 0x1C000 first 96 bytes vs main channels 0x4000:") print(" 0x1C000:", hx(data[0x1C000:0x1C000+96])) print(" 0x04000:", hx(data[0x04000:0x04000+96])) print(" match:", data[0x1C000:0x1C000+96]==data[0x04000:0x04000+96]) # Contacts - the two records print("\nCONTACT records decode:") for off in (0x05E000,0x05E020): d=data[off:off+32] print(f"@0x{off:06X}:", hx(d)) print(f" b0={d[0]:02X} b1(type)={d[1]:02X} dmr_id(BCD@2)={parse_bcd(d[2:6])} raw_le@2={struct.unpack('