01How Computers Work (online)

Fully solved problem book

ALU and condition flags

Set 1 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 0001

For A=00000000 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=00000000 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 0 + 51 = 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=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 0 and 51; 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 C0 V0

ALU diagnostics · Problem 0002

For A=00000000 and B=11100101, 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=00000000 and B=11100101 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 0 − 229 = -229.
  4. Reduce the result modulo 256: 27.
  5. The eight output bits are 00011011.
  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 0 and -27; their true signed result is 27.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 27 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 00011011; they help later control logic interpret the outcome.

Final answer: 00011011; Z0 N0 C0 V0

ALU diagnostics · Problem 0003

For A=00000010 and B=10011000, 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=00000010 and B=10011000 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 2 − 152 = -150.
  4. Reduce the result modulo 256: 106.
  5. The eight output bits are 01101010.
  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 2 and -104; their true signed result is 106.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 106 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 01101010; they help later control logic interpret the outcome.

Final answer: 01101010; Z0 N0 C0 V0

ALU diagnostics · Problem 0004

For A=00000010 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=00000010 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 2 − 224 = -222.
  4. Reduce the result modulo 256: 34.
  5. The eight output bits are 00100010.
  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 2 and -32; 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 00100010; they help later control logic interpret the outcome.

Final answer: 00100010; Z0 N0 C0 V0

ALU diagnostics · Problem 0005

For A=00000100 and B=00101000, 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=00000100 and B=00101000 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 4 + 40 = 44.
  4. Reduce the result modulo 256: 44.
  5. The eight output bits are 00101100.
  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 4 and 40; their true signed result is 44.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 44 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 00101100; they help later control logic interpret the outcome.

Final answer: 00101100; Z0 N0 C0 V0

ALU diagnostics · Problem 0006

For A=00000101 and B=01011010, 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=00000101 and B=01011010 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 5 + 90 = 95.
  4. Reduce the result modulo 256: 95.
  5. The eight output bits are 01011111.
  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 5 and 90; their true signed result is 95.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 95 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 01011111; they help later control logic interpret the outcome.

Final answer: 01011111; Z0 N0 C0 V0

ALU diagnostics · Problem 0007

For A=00000101 and B=10001100, 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=00000101 and B=10001100 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 5 + 140 = 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 5 and -116; their true signed result is -111.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result -111 is inside 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 V0

ALU diagnostics · Problem 0008

For A=00000111 and B=00110110, 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=00000111 and B=00110110 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 7 − 54 = -47.
  4. Reduce the result modulo 256: 209.
  5. The eight output bits are 11010001.
  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 7 and 54; their true signed result is -47.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result -47 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 11010001; they help later control logic interpret the outcome.

Final answer: 11010001; Z0 N1 C0 V0

ALU diagnostics · Problem 0009

For A=00000111 and B=00111001, 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=00000111 and B=00111001 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 7 − 57 = -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 7 and 57; their true signed result is -50.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result -50 is inside 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 V0

ALU diagnostics · Problem 0010

For A=00001011 and B=00100000, 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=00001011 and B=00100000 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 11 + 32 = 43.
  4. Reduce the result modulo 256: 43.
  5. The eight output bits are 00101011.
  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 11 and 32; their true signed result is 43.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 43 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 00101011; they help later control logic interpret the outcome.

Final answer: 00101011; Z0 N0 C0 V0

ALU diagnostics · Problem 0011

For A=00001100 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=00001100 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 12 − 51 = -39.
  4. Reduce the result modulo 256: 217.
  5. The eight output bits are 11011001.
  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 12 and 51; their true signed result is -39.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result -39 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 11011001; they help later control logic interpret the outcome.

Final answer: 11011001; Z0 N1 C0 V0

ALU diagnostics · Problem 0012

For A=00001100 and B=01110010, 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=00001100 and B=01110010 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 12 − 114 = -102.
  4. Reduce the result modulo 256: 154.
  5. The eight output bits are 10011010.
  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 12 and 114; their true signed result is -102.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result -102 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 10011010; they help later control logic interpret the outcome.

Final answer: 10011010; Z0 N1 C0 V0

ALU diagnostics · Problem 0013

For A=00001101 and B=00010100, 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=00001101 and B=00010100 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 13 − 20 = -7.
  4. Reduce the result modulo 256: 249.
  5. The eight output bits are 11111001.
  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 13 and 20; their true signed result is -7.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result -7 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 11111001; they help later control logic interpret the outcome.

Final answer: 11111001; Z0 N1 C0 V0

ALU diagnostics · Problem 0014

For A=00001110 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=00001110 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 14 − 211 = -197.
  4. Reduce the result modulo 256: 59.
  5. The eight output bits are 00111011.
  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 14 and -45; their true signed result is 59.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 59 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 00111011; they help later control logic interpret the outcome.

Final answer: 00111011; Z0 N0 C0 V0

ALU diagnostics · Problem 0015

For A=00010000 and B=01101100, 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=00010000 and B=01101100 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 16 + 108 = 124.
  4. Reduce the result modulo 256: 124.
  5. The eight output bits are 01111100.
  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 16 and 108; their true signed result is 124.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 124 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 01111100; they help later control logic interpret the outcome.

Final answer: 01111100; Z0 N0 C0 V0

ALU diagnostics · Problem 0016

For A=00010011 and B=10010000, 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=00010011 and B=10010000 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 19 + 144 = 163.
  4. Reduce the result modulo 256: 163.
  5. The eight output bits are 10100011.
  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 19 and -112; their true signed result is -93.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result -93 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 10100011; they help later control logic interpret the outcome.

Final answer: 10100011; Z0 N1 C0 V0

ALU diagnostics · Problem 0017

For A=00010101 and B=00101001, 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=00010101 and B=00101001 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 21 − 41 = -20.
  4. Reduce the result modulo 256: 236.
  5. The eight output bits are 11101100.
  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 21 and 41; their true signed result is -20.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result -20 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 11101100; they help later control logic interpret the outcome.

Final answer: 11101100; Z0 N1 C0 V0

ALU diagnostics · Problem 0018

For A=00010101 and B=11011001, 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=00010101 and B=11011001 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 21 − 217 = -196.
  4. Reduce the result modulo 256: 60.
  5. The eight output bits are 00111100.
  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 21 and -39; their true signed result is 60.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 60 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 00111100; they help later control logic interpret the outcome.

Final answer: 00111100; Z0 N0 C0 V0

ALU diagnostics · Problem 0019

For A=00010111 and B=11100001, 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=00010111 and B=11100001 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 23 + 225 = 248.
  4. Reduce the result modulo 256: 248.
  5. The eight output bits are 11111000.
  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 23 and -31; their true signed result is -8.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result -8 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 11111000; they help later control logic interpret the outcome.

Final answer: 11111000; Z0 N1 C0 V0

ALU diagnostics · Problem 0020

For A=00010111 and B=11100100, 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=00010111 and B=11100100 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 23 + 228 = 251.
  4. Reduce the result modulo 256: 251.
  5. The eight output bits are 11111011.
  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 23 and -28; their true signed result is -5.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result -5 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 11111011; they help later control logic interpret the outcome.

Final answer: 11111011; Z0 N1 C0 V0

ALU diagnostics · Problem 0021

For A=00011001 and B=00011000, 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=00011001 and B=00011000 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 25 − 24 = 1.
  4. Reduce the result modulo 256: 1.
  5. The eight output bits are 00000001.
  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 25 and 24; their true signed result is 1.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 1 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 00000001; they help later control logic interpret the outcome.

Final answer: 00000001; Z0 N0 C1 V0

ALU diagnostics · Problem 0022

For A=00011010 and B=01111101, 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=00011010 and B=01111101 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 26 + 125 = 151.
  4. Reduce the result modulo 256: 151.
  5. The eight output bits are 10010111.
  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 26 and 125; their true signed result is 151.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=1; signed result 151 is outside the 8-bit signed range.
  12. The flags do not change the stored byte 10010111; they help later control logic interpret the outcome.

Final answer: 10010111; Z0 N1 C0 V1

ALU diagnostics · Problem 0023

For A=00011010 and B=10111110, 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=00011010 and B=10111110 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 26 + 190 = 216.
  4. Reduce the result modulo 256: 216.
  5. The eight output bits are 11011000.
  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 26 and -66; their true signed result is -40.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result -40 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 11011000; they help later control logic interpret the outcome.

Final answer: 11011000; Z0 N1 C0 V0

ALU diagnostics · Problem 0024

For A=00011011 and B=11000000, 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=00011011 and B=11000000 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 27 + 192 = 219.
  4. Reduce the result modulo 256: 219.
  5. The eight output bits are 11011011.
  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 27 and -64; their true signed result is -37.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result -37 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 11011011; they help later control logic interpret the outcome.

Final answer: 11011011; Z0 N1 C0 V0

ALU diagnostics · Problem 0025

For A=00011101 and B=10011010, 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=00011101 and B=10011010 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 29 − 154 = -125.
  4. Reduce the result modulo 256: 131.
  5. The eight output bits are 10000011.
  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 29 and -102; their true signed result is 131.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=1; signed result 131 is outside the 8-bit signed range.
  12. The flags do not change the stored byte 10000011; they help later control logic interpret the outcome.

Final answer: 10000011; Z0 N1 C0 V1

ALU diagnostics · Problem 0026

For A=00011110 and B=01101101, 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=00011110 and B=01101101 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 30 + 109 = 139.
  4. Reduce the result modulo 256: 139.
  5. The eight output bits are 10001011.
  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 30 and 109; their true signed result is 139.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=1; signed result 139 is outside the 8-bit signed range.
  12. The flags do not change the stored byte 10001011; they help later control logic interpret the outcome.

Final answer: 10001011; Z0 N1 C0 V1

ALU diagnostics · Problem 0027

For A=00011111 and B=10100011, 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=00011111 and B=10100011 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 31 − 163 = -132.
  4. Reduce the result modulo 256: 124.
  5. The eight output bits are 01111100.
  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 31 and -93; their true signed result is 124.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 124 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 01111100; they help later control logic interpret the outcome.

Final answer: 01111100; Z0 N0 C0 V0

ALU diagnostics · Problem 0028

For A=00100000 and B=10110101, 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=00100000 and B=10110101 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 32 − 181 = -149.
  4. Reduce the result modulo 256: 107.
  5. The eight output bits are 01101011.
  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 32 and -75; their true signed result is 107.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 107 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 01101011; they help later control logic interpret the outcome.

Final answer: 01101011; Z0 N0 C0 V0

ALU diagnostics · Problem 0029

For A=00100010 and B=00001100, 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=00100010 and B=00001100 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 34 + 12 = 46.
  4. Reduce the result modulo 256: 46.
  5. The eight output bits are 00101110.
  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 34 and 12; their true signed result is 46.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 46 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 00101110; they help later control logic interpret the outcome.

Final answer: 00101110; Z0 N0 C0 V0

ALU diagnostics · Problem 0030

For A=00100010 and B=00010011, 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=00100010 and B=00010011 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 34 + 19 = 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=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
  9. Signed readings are 34 and 19; 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 C0 V0

ALU diagnostics · Problem 0031

For A=00100010 and B=11110100, 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=00100010 and B=11110100 as the input bit patterns.
  2. Execute SUB; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 34 − 244 = -210.
  4. Reduce the result modulo 256: 46.
  5. The eight output bits are 00101110.
  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 34 and -12; their true signed result is 46.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 46 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 00101110; they help later control logic interpret the outcome.

Final answer: 00101110; Z0 N0 C0 V0

ALU diagnostics · Problem 0032

For A=00100011 and B=00111101, 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=00100011 and B=00111101 as the input bit patterns.
  2. Execute ADD; compute the mathematical integer expression using the input patterns.
  3. The ordinary unsigned calculation yields 35 + 61 = 96.
  4. Reduce the result modulo 256: 96.
  5. The eight output bits are 01100000.
  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 35 and 61; their true signed result is 96.
  10. The signed result range is −128 through 127.
  11. Overflow flag V=0; signed result 96 is inside the 8-bit signed range.
  12. The flags do not change the stored byte 01100000; they help later control logic interpret the outcome.

Final answer: 01100000; Z0 N0 C0 V0