Hacker News new | ask | show | jobs
by windenntw 21 days ago
Here is one in plain 68000 assembler.

  move.b #200,d0
  move.b #100,d1
  add.b  d0,d1   ; 8th bit goes to X flag
  subx.b d0,d0   ; d0 = $00 or $ff depending on X flag
  or.b   d0,d1   ; d1 = 255 if there was saturation
You can do the same with all others that somehow store the 8th bit carry somewhere then allow using it for substraction.