In a similar way as the carry bit for addition it is possible to recover the borrow bit for substraction, just based on the highest bits of three numbers that we deal with during the operation. With this program, a subtraction operation of an 8-bit CPU can be simulated exhaustively #!/usr/bin/perl my $x, $x, $bi; my %tab = (); for ($bi = 0; $bi 7; my $zs = $z >> 7; …