Login
You're viewing the front-end.social public feed.
  • Apr 27, 2026, 8:56 AM

    Related lazyweb question: is there a way to ask #ghidra to turn the 6502 add and add carry instructions into 16-bit math in the decompilation window? It does it sometimes with pointers, but not with shorts.

    screenshot from ghidra:
  
  bVar1 = len - 1;
  do {
    VecRamPtr[bVar1] = vec_src_buf[bVar1];
    bVar1 = bVar1 - 1;
  } while (-1 < (char)bVar1);
  if (CARRY1(len,(byte)VecRamPtr)) {
    VecRamPtr._1_1_ = VecRamPtr._1_1_ + 1;
  }
  VecRamPtr = (undefined *)CONCAT11(VecRamPtr._1_1_,len + (byte)VecRamPtr);
  if (CARRY1(len,(byte)vec_src_buf)) {
    vec_src_buf._1_1_ = vec_src_buf._1_1_ + '\x01';
  }
  vec_src_buf = (byte *)CONCAT11(vec_src_buf._1_1_,len + (byte)vec_src_buf);
  return;
    💬 1🔄 0⭐ 0

Replies

  • Apr 27, 2026, 9:49 AM

    @th Ugh, I remember wanting exactly this for a different 8bit arch, and no, there's no easy way. If you like pain, you can edit the sleigh cpu spec to recognize and lift bitpatterns that span multiple instructions as fake 16 bit alu instructions. IIRC that didn't turn out to help as much as I wanted though.

    💬 0🔄 0⭐ 0