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; …
Schlagwort-Archive: borrow flag
Borrow and Carry Bit for Subtraction
Similar to the usage of the carry bit when adding there are mechanisms for subtracting that allow to integrate the result of subtraction of the lower bits into the subtraction of the next higher block of bits, where necessary. There are two ways to do this, that are trivially equivalent by a simple not operation: …