01How Computers Work

Fully solved problem book

ALU and condition flags

Set 4 of 10 · 32 worked questions. Predict your result before expanding the solution.

These worked traces are meant to build fluency through controlled variation. If several answers feel identical, try the next difficult value and look for the point where a carry, sign, branch, or selected memory address changes the outcome.

ALU diagnostics · Problem 0097

For A=01010011 and B=01110101, run SUB; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01010011 and B=01110101 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 83 − 117 = -34.
  4. Reduce the result modulo 256: 222.
  5. The eight output bits are 11011110.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=1, because the most significant output bit is 1.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 83 and 117; their true signed result is -34.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result -34 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 11011110; they help later control logic interpret the outcome.

Final answer: 11011110; Z0 N1 C0 V0

ALU diagnostics · Problem 0098

For A=01010100 and B=01001001, run SUB; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01010100 and B=01001001 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 84 − 73 = 11.
  4. Reduce the result modulo 256: 11.
  5. The eight output bits are 00001011.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=0, because the most significant output bit is 0.
  8. Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 84 and 73; their true signed result is 11.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 11 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 00001011; they help later control logic interpret the outcome.

Final answer: 00001011; Z0 N0 C1 V0

ALU diagnostics · Problem 0099

For A=01010100 and B=11100010, run SUB; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01010100 and B=11100010 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 84 − 226 = -142.
  4. Reduce the result modulo 256: 114.
  5. The eight output bits are 01110010.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=0, because the most significant output bit is 0.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 84 and -30; their true signed result is 114.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 114 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 01110010; they help later control logic interpret the outcome.

Final answer: 01110010; Z0 N0 C0 V0

ALU diagnostics · Problem 0100

For A=01010110 and B=00010110, run ADD; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01010110 and B=00010110 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 86 + 22 = 108.
  4. Reduce the result modulo 256: 108.
  5. The eight output bits are 01101100.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=0, because the most significant output bit is 0.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 86 and 22; their true signed result is 108.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 108 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 01101100; they help later control logic interpret the outcome.

Final answer: 01101100; Z0 N0 C0 V0

ALU diagnostics · Problem 0101

For A=01010110 and B=00110011, run ADD; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01010110 and B=00110011 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 86 + 51 = 137.
  4. Reduce the result modulo 256: 137.
  5. The eight output bits are 10001001.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=1, because the most significant output bit is 1.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 86 and 51; their true signed result is 137.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=1; signed result 137 is outside the 8-bit signed range.
  12. The flags do not change the stored byte 10001001; they help later control logic interpret the outcome.

Final answer: 10001001; Z0 N1 C0 V1

ALU diagnostics · Problem 0102

For A=01011000 and B=11100010, run ADD; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01011000 and B=11100010 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 88 + 226 = 314.
  4. Reduce the result modulo 256: 58.
  5. The eight output bits are 00111010.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=0, because the most significant output bit is 0.
  8. Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 88 and -30; their true signed result is 58.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 58 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 00111010; they help later control logic interpret the outcome.

Final answer: 00111010; Z0 N0 C1 V0

ALU diagnostics · Problem 0103

For A=01011010 and B=00101011, run ADD; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01011010 and B=00101011 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 90 + 43 = 133.
  4. Reduce the result modulo 256: 133.
  5. The eight output bits are 10000101.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=1, because the most significant output bit is 1.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 90 and 43; their true signed result is 133.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=1; signed result 133 is outside the 8-bit signed range.
  12. The flags do not change the stored byte 10000101; they help later control logic interpret the outcome.

Final answer: 10000101; Z0 N1 C0 V1

ALU diagnostics · Problem 0104

For A=01011010 and B=10001100, run SUB; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01011010 and B=10001100 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 90 − 140 = -50.
  4. Reduce the result modulo 256: 206.
  5. The eight output bits are 11001110.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=1, because the most significant output bit is 1.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 90 and -116; their true signed result is 206.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=1; signed result 206 is outside the 8-bit signed range.
  12. The flags do not change the stored byte 11001110; they help later control logic interpret the outcome.

Final answer: 11001110; Z0 N1 C0 V1

ALU diagnostics · Problem 0105

For A=01011011 and B=11110101, run ADD; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01011011 and B=11110101 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 91 + 245 = 336.
  4. Reduce the result modulo 256: 80.
  5. The eight output bits are 01010000.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=0, because the most significant output bit is 0.
  8. Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 91 and -11; their true signed result is 80.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 80 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 01010000; they help later control logic interpret the outcome.

Final answer: 01010000; Z0 N0 C1 V0

ALU diagnostics · Problem 0106

For A=01011111 and B=00110010, run ADD; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01011111 and B=00110010 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 95 + 50 = 145.
  4. Reduce the result modulo 256: 145.
  5. The eight output bits are 10010001.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=1, because the most significant output bit is 1.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 95 and 50; their true signed result is 145.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=1; signed result 145 is outside the 8-bit signed range.
  12. The flags do not change the stored byte 10010001; they help later control logic interpret the outcome.

Final answer: 10010001; Z0 N1 C0 V1

ALU diagnostics · Problem 0107

For A=01100000 and B=00111001, run ADD; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01100000 and B=00111001 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 96 + 57 = 153.
  4. Reduce the result modulo 256: 153.
  5. The eight output bits are 10011001.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=1, because the most significant output bit is 1.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 96 and 57; their true signed result is 153.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=1; signed result 153 is outside the 8-bit signed range.
  12. The flags do not change the stored byte 10011001; they help later control logic interpret the outcome.

Final answer: 10011001; Z0 N1 C0 V1

ALU diagnostics · Problem 0108

For A=01100001 and B=00101100, run SUB; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01100001 and B=00101100 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 97 − 44 = 53.
  4. Reduce the result modulo 256: 53.
  5. The eight output bits are 00110101.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=0, because the most significant output bit is 0.
  8. Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 97 and 44; their true signed result is 53.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 53 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 00110101; they help later control logic interpret the outcome.

Final answer: 00110101; Z0 N0 C1 V0

ALU diagnostics · Problem 0109

For A=01100010 and B=00101110, run ADD; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01100010 and B=00101110 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 98 + 46 = 144.
  4. Reduce the result modulo 256: 144.
  5. The eight output bits are 10010000.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=1, because the most significant output bit is 1.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 98 and 46; their true signed result is 144.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=1; signed result 144 is outside the 8-bit signed range.
  12. The flags do not change the stored byte 10010000; they help later control logic interpret the outcome.

Final answer: 10010000; Z0 N1 C0 V1

ALU diagnostics · Problem 0110

For A=01100010 and B=10010011, run SUB; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01100010 and B=10010011 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 98 − 147 = -49.
  4. Reduce the result modulo 256: 207.
  5. The eight output bits are 11001111.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=1, because the most significant output bit is 1.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 98 and -109; their true signed result is 207.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=1; signed result 207 is outside the 8-bit signed range.
  12. The flags do not change the stored byte 11001111; they help later control logic interpret the outcome.

Final answer: 11001111; Z0 N1 C0 V1

ALU diagnostics · Problem 0111

For A=01100100 and B=11100000, run SUB; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01100100 and B=11100000 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 100 − 224 = -124.
  4. Reduce the result modulo 256: 132.
  5. The eight output bits are 10000100.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=1, because the most significant output bit is 1.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 100 and -32; their true signed result is 132.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=1; signed result 132 is outside the 8-bit signed range.
  12. The flags do not change the stored byte 10000100; they help later control logic interpret the outcome.

Final answer: 10000100; Z0 N1 C0 V1

ALU diagnostics · Problem 0112

For A=01100101 and B=00100110, run SUB; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01100101 and B=00100110 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 101 − 38 = 63.
  4. Reduce the result modulo 256: 63.
  5. The eight output bits are 00111111.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=0, because the most significant output bit is 0.
  8. Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 101 and 38; their true signed result is 63.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 63 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 00111111; they help later control logic interpret the outcome.

Final answer: 00111111; Z0 N0 C1 V0

ALU diagnostics · Problem 0113

For A=01100101 and B=01101010, run ADD; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01100101 and B=01101010 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 101 + 106 = 207.
  4. Reduce the result modulo 256: 207.
  5. The eight output bits are 11001111.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=1, because the most significant output bit is 1.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 101 and 106; their true signed result is 207.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=1; signed result 207 is outside the 8-bit signed range.
  12. The flags do not change the stored byte 11001111; they help later control logic interpret the outcome.

Final answer: 11001111; Z0 N1 C0 V1

ALU diagnostics · Problem 0114

For A=01100101 and B=10001110, run ADD; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01100101 and B=10001110 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 101 + 142 = 243.
  4. Reduce the result modulo 256: 243.
  5. The eight output bits are 11110011.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=1, because the most significant output bit is 1.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 101 and -114; their true signed result is -13.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result -13 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 11110011; they help later control logic interpret the outcome.

Final answer: 11110011; Z0 N1 C0 V0

ALU diagnostics · Problem 0115

For A=01100101 and B=10110011, run ADD; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01100101 and B=10110011 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 101 + 179 = 280.
  4. Reduce the result modulo 256: 24.
  5. The eight output bits are 00011000.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=0, because the most significant output bit is 0.
  8. Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 101 and -77; their true signed result is 24.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 24 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 00011000; they help later control logic interpret the outcome.

Final answer: 00011000; Z0 N0 C1 V0

ALU diagnostics · Problem 0116

For A=01100101 and B=10111100, run SUB; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01100101 and B=10111100 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 101 − 188 = -87.
  4. Reduce the result modulo 256: 169.
  5. The eight output bits are 10101001.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=1, because the most significant output bit is 1.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 101 and -68; their true signed result is 169.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=1; signed result 169 is outside the 8-bit signed range.
  12. The flags do not change the stored byte 10101001; they help later control logic interpret the outcome.

Final answer: 10101001; Z0 N1 C0 V1

ALU diagnostics · Problem 0117

For A=01100111 and B=10101110, run SUB; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01100111 and B=10101110 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 103 − 174 = -71.
  4. Reduce the result modulo 256: 185.
  5. The eight output bits are 10111001.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=1, because the most significant output bit is 1.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 103 and -82; their true signed result is 185.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=1; signed result 185 is outside the 8-bit signed range.
  12. The flags do not change the stored byte 10111001; they help later control logic interpret the outcome.

Final answer: 10111001; Z0 N1 C0 V1

ALU diagnostics · Problem 0118

For A=01100111 and B=11011011, run SUB; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01100111 and B=11011011 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 103 − 219 = -116.
  4. Reduce the result modulo 256: 140.
  5. The eight output bits are 10001100.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=1, because the most significant output bit is 1.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 103 and -37; their true signed result is 140.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=1; signed result 140 is outside the 8-bit signed range.
  12. The flags do not change the stored byte 10001100; they help later control logic interpret the outcome.

Final answer: 10001100; Z0 N1 C0 V1

ALU diagnostics · Problem 0119

For A=01101000 and B=00110101, run SUB; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01101000 and B=00110101 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 104 − 53 = 51.
  4. Reduce the result modulo 256: 51.
  5. The eight output bits are 00110011.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=0, because the most significant output bit is 0.
  8. Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 104 and 53; their true signed result is 51.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 51 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 00110011; they help later control logic interpret the outcome.

Final answer: 00110011; Z0 N0 C1 V0

ALU diagnostics · Problem 0120

For A=01101000 and B=10101100, run SUB; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01101000 and B=10101100 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 104 − 172 = -68.
  4. Reduce the result modulo 256: 188.
  5. The eight output bits are 10111100.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=1, because the most significant output bit is 1.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 104 and -84; their true signed result is 188.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=1; signed result 188 is outside the 8-bit signed range.
  12. The flags do not change the stored byte 10111100; they help later control logic interpret the outcome.

Final answer: 10111100; Z0 N1 C0 V1

ALU diagnostics · Problem 0121

For A=01101010 and B=11111000, run SUB; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01101010 and B=11111000 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 106 − 248 = -142.
  4. Reduce the result modulo 256: 114.
  5. The eight output bits are 01110010.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=0, because the most significant output bit is 0.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 106 and -8; their true signed result is 114.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 114 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 01110010; they help later control logic interpret the outcome.

Final answer: 01110010; Z0 N0 C0 V0

ALU diagnostics · Problem 0122

For A=01101010 and B=11111010, run ADD; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01101010 and B=11111010 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 106 + 250 = 356.
  4. Reduce the result modulo 256: 100.
  5. The eight output bits are 01100100.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=0, because the most significant output bit is 0.
  8. Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 106 and -6; their true signed result is 100.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 100 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 01100100; they help later control logic interpret the outcome.

Final answer: 01100100; Z0 N0 C1 V0

ALU diagnostics · Problem 0123

For A=01101011 and B=00110011, run SUB; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01101011 and B=00110011 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 107 − 51 = 56.
  4. Reduce the result modulo 256: 56.
  5. The eight output bits are 00111000.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=0, because the most significant output bit is 0.
  8. Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 107 and 51; their true signed result is 56.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 56 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 00111000; they help later control logic interpret the outcome.

Final answer: 00111000; Z0 N0 C1 V0

ALU diagnostics · Problem 0124

For A=01101011 and B=01101010, run ADD; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01101011 and B=01101010 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 107 + 106 = 213.
  4. Reduce the result modulo 256: 213.
  5. The eight output bits are 11010101.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=1, because the most significant output bit is 1.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 107 and 106; their true signed result is 213.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=1; signed result 213 is outside the 8-bit signed range.
  12. The flags do not change the stored byte 11010101; they help later control logic interpret the outcome.

Final answer: 11010101; Z0 N1 C0 V1

ALU diagnostics · Problem 0125

For A=01101100 and B=01011111, run SUB; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01101100 and B=01011111 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 108 − 95 = 13.
  4. Reduce the result modulo 256: 13.
  5. The eight output bits are 00001101.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=0, because the most significant output bit is 0.
  8. Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 108 and 95; their true signed result is 13.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 13 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 00001101; they help later control logic interpret the outcome.

Final answer: 00001101; Z0 N0 C1 V0

ALU diagnostics · Problem 0126

For A=01101110 and B=10110011, run ADD; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01101110 and B=10110011 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 110 + 179 = 289.
  4. Reduce the result modulo 256: 33.
  5. The eight output bits are 00100001.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=0, because the most significant output bit is 0.
  8. Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 110 and -77; their true signed result is 33.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 33 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 00100001; they help later control logic interpret the outcome.

Final answer: 00100001; Z0 N0 C1 V0

ALU diagnostics · Problem 0127

For A=01101110 and B=11010011, run SUB; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01101110 and B=11010011 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 110 − 211 = -101.
  4. Reduce the result modulo 256: 155.
  5. The eight output bits are 10011011.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=1, because the most significant output bit is 1.
  8. Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 110 and -45; their true signed result is 155.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=1; signed result 155 is outside the 8-bit signed range.
  12. The flags do not change the stored byte 10011011; they help later control logic interpret the outcome.

Final answer: 10011011; Z0 N1 C0 V1

ALU diagnostics · Problem 0128

For A=01110000 and B=01010100, run SUB; find the low byte and Z, N, C, V.

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Treat A=01110000 and B=01010100 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 112 − 84 = 28.
  4. Reduce the result modulo 256: 28.
  5. The eight output bits are 00011100.
  6. Zero flag Z=0, because the stored output is nonzero.
  7. Negative flag N=0, because the most significant output bit is 0.
  8. Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 112 and 84; their true signed result is 28.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 28 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 00011100; they help later control logic interpret the outcome.

Final answer: 00011100; Z0 N0 C1 V0