Fully solved problem book
ALU and condition flags
Set 9 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 0257
For A=11011111 and B=00101111, 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 →
- Treat A=11011111 and B=00101111 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 223 − 47 = 176.
- Reduce the result modulo 256: 176.
- The eight output bits are 10110000.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=1, because the most significant output bit is 1.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -33 and 47; their true signed result is -80.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -80 is inside the 8-bit signed range.
- The flags do not change the stored byte 10110000; they help later control logic interpret the outcome.
Final answer: 10110000; Z0 N1 C1 V0
ALU diagnostics · Problem 0258
For A=11011111 and B=10010110, 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 →
- Treat A=11011111 and B=10010110 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 223 + 150 = 373.
- Reduce the result modulo 256: 117.
- The eight output bits are 01110101.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=0, because the most significant output bit is 0.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -33 and -106; their true signed result is -139.
- The signed result range is −128 through 127.
- Overflow flag V=1; signed result -139 is outside the 8-bit signed range.
- The flags do not change the stored byte 01110101; they help later control logic interpret the outcome.
Final answer: 01110101; Z0 N0 C1 V1
ALU diagnostics · Problem 0259
For A=11100000 and B=01000010, 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 →
- Treat A=11100000 and B=01000010 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 224 + 66 = 290.
- Reduce the result modulo 256: 34.
- The eight output bits are 00100010.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=0, because the most significant output bit is 0.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -32 and 66; their true signed result is 34.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 34 is inside the 8-bit signed range.
- The flags do not change the stored byte 00100010; they help later control logic interpret the outcome.
Final answer: 00100010; Z0 N0 C1 V0
ALU diagnostics · Problem 0260
For A=11100000 and B=01001111, 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 →
- Treat A=11100000 and B=01001111 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 224 + 79 = 303.
- Reduce the result modulo 256: 47.
- The eight output bits are 00101111.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=0, because the most significant output bit is 0.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -32 and 79; their true signed result is 47.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 47 is inside the 8-bit signed range.
- The flags do not change the stored byte 00101111; they help later control logic interpret the outcome.
Final answer: 00101111; Z0 N0 C1 V0
ALU diagnostics · Problem 0261
For A=11100000 and B=10011010, 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 →
- Treat A=11100000 and B=10011010 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 224 + 154 = 378.
- Reduce the result modulo 256: 122.
- The eight output bits are 01111010.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=0, because the most significant output bit is 0.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -32 and -102; their true signed result is -134.
- The signed result range is −128 through 127.
- Overflow flag V=1; signed result -134 is outside the 8-bit signed range.
- The flags do not change the stored byte 01111010; they help later control logic interpret the outcome.
Final answer: 01111010; Z0 N0 C1 V1
ALU diagnostics · Problem 0262
For A=11100000 and B=10110001, 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 →
- Treat A=11100000 and B=10110001 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 224 + 177 = 401.
- Reduce the result modulo 256: 145.
- The eight output bits are 10010001.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=1, because the most significant output bit is 1.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -32 and -79; their true signed result is -111.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -111 is inside the 8-bit signed range.
- The flags do not change the stored byte 10010001; they help later control logic interpret the outcome.
Final answer: 10010001; Z0 N1 C1 V0
ALU diagnostics · Problem 0263
For A=11100010 and B=10101011, 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 →
- Treat A=11100010 and B=10101011 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 226 + 171 = 397.
- Reduce the result modulo 256: 141.
- The eight output bits are 10001101.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=1, because the most significant output bit is 1.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -30 and -85; their true signed result is -115.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -115 is inside the 8-bit signed range.
- The flags do not change the stored byte 10001101; they help later control logic interpret the outcome.
Final answer: 10001101; Z0 N1 C1 V0
ALU diagnostics · Problem 0264
For A=11100011 and B=10100110, 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 →
- Treat A=11100011 and B=10100110 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 227 + 166 = 393.
- Reduce the result modulo 256: 137.
- The eight output bits are 10001001.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=1, because the most significant output bit is 1.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -29 and -90; their true signed result is -119.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -119 is inside the 8-bit signed range.
- The flags do not change the stored byte 10001001; they help later control logic interpret the outcome.
Final answer: 10001001; Z0 N1 C1 V0
ALU diagnostics · Problem 0265
For A=11100101 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 →
- Treat A=11100101 and B=01101010 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 229 + 106 = 335.
- Reduce the result modulo 256: 79.
- The eight output bits are 01001111.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=0, because the most significant output bit is 0.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -27 and 106; their true signed result is 79.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 79 is inside the 8-bit signed range.
- The flags do not change the stored byte 01001111; they help later control logic interpret the outcome.
Final answer: 01001111; Z0 N0 C1 V0
ALU diagnostics · Problem 0266
For A=11100101 and B=01111110, 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 →
- Treat A=11100101 and B=01111110 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 229 − 126 = 103.
- Reduce the result modulo 256: 103.
- The eight output bits are 01100111.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=0, because the most significant output bit is 0.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -27 and 126; their true signed result is -153.
- The signed result range is −128 through 127.
- Overflow flag V=1; signed result -153 is outside the 8-bit signed range.
- The flags do not change the stored byte 01100111; they help later control logic interpret the outcome.
Final answer: 01100111; Z0 N0 C1 V1
ALU diagnostics · Problem 0267
For A=11100110 and B=11110111, 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 →
- Treat A=11100110 and B=11110111 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 230 + 247 = 477.
- Reduce the result modulo 256: 221.
- The eight output bits are 11011101.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=1, because the most significant output bit is 1.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -26 and -9; their true signed result is -35.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -35 is inside the 8-bit signed range.
- The flags do not change the stored byte 11011101; they help later control logic interpret the outcome.
Final answer: 11011101; Z0 N1 C1 V0
ALU diagnostics · Problem 0268
For A=11100111 and B=00000111, 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 →
- Treat A=11100111 and B=00000111 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 231 − 7 = 224.
- Reduce the result modulo 256: 224.
- The eight output bits are 11100000.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=1, because the most significant output bit is 1.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -25 and 7; their true signed result is -32.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -32 is inside the 8-bit signed range.
- The flags do not change the stored byte 11100000; they help later control logic interpret the outcome.
Final answer: 11100000; Z0 N1 C1 V0
ALU diagnostics · Problem 0269
For A=11100111 and B=01110100, 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 →
- Treat A=11100111 and B=01110100 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 231 − 116 = 115.
- Reduce the result modulo 256: 115.
- The eight output bits are 01110011.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=0, because the most significant output bit is 0.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -25 and 116; their true signed result is -141.
- The signed result range is −128 through 127.
- Overflow flag V=1; signed result -141 is outside the 8-bit signed range.
- The flags do not change the stored byte 01110011; they help later control logic interpret the outcome.
Final answer: 01110011; Z0 N0 C1 V1
ALU diagnostics · Problem 0270
For A=11100111 and B=11101100, 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 →
- Treat A=11100111 and B=11101100 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 231 − 236 = -5.
- Reduce the result modulo 256: 251.
- The eight output bits are 11111011.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=1, because the most significant output bit is 1.
- Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -25 and -20; their true signed result is -5.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -5 is inside the 8-bit signed range.
- 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 0271
For A=11100111 and B=11111110, 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 →
- Treat A=11100111 and B=11111110 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 231 − 254 = -23.
- Reduce the result modulo 256: 233.
- The eight output bits are 11101001.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=1, because the most significant output bit is 1.
- Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -25 and -2; their true signed result is -23.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -23 is inside the 8-bit signed range.
- The flags do not change the stored byte 11101001; they help later control logic interpret the outcome.
Final answer: 11101001; Z0 N1 C0 V0
ALU diagnostics · Problem 0272
For A=11101000 and B=00011101, 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 →
- Treat A=11101000 and B=00011101 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 232 + 29 = 261.
- Reduce the result modulo 256: 5.
- The eight output bits are 00000101.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=0, because the most significant output bit is 0.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -24 and 29; their true signed result is 5.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 5 is inside the 8-bit signed range.
- The flags do not change the stored byte 00000101; they help later control logic interpret the outcome.
Final answer: 00000101; Z0 N0 C1 V0
ALU diagnostics · Problem 0273
For A=11101000 and B=11010010, 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 →
- Treat A=11101000 and B=11010010 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 232 + 210 = 442.
- Reduce the result modulo 256: 186.
- The eight output bits are 10111010.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=1, because the most significant output bit is 1.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -24 and -46; their true signed result is -70.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -70 is inside the 8-bit signed range.
- The flags do not change the stored byte 10111010; they help later control logic interpret the outcome.
Final answer: 10111010; Z0 N1 C1 V0
ALU diagnostics · Problem 0274
For A=11101000 and B=11010100, 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 →
- Treat A=11101000 and B=11010100 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 232 − 212 = 20.
- Reduce the result modulo 256: 20.
- The eight output bits are 00010100.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=0, because the most significant output bit is 0.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -24 and -44; their true signed result is 20.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 20 is inside the 8-bit signed range.
- The flags do not change the stored byte 00010100; they help later control logic interpret the outcome.
Final answer: 00010100; Z0 N0 C1 V0
ALU diagnostics · Problem 0275
For A=11101000 and B=11101000, 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 →
- Treat A=11101000 and B=11101000 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 232 + 232 = 464.
- Reduce the result modulo 256: 208.
- The eight output bits are 11010000.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=1, because the most significant output bit is 1.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -24 and -24; their true signed result is -48.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -48 is inside the 8-bit signed range.
- The flags do not change the stored byte 11010000; they help later control logic interpret the outcome.
Final answer: 11010000; Z0 N1 C1 V0
ALU diagnostics · Problem 0276
For A=11101001 and B=01000011, 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 →
- Treat A=11101001 and B=01000011 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 233 + 67 = 300.
- Reduce the result modulo 256: 44.
- The eight output bits are 00101100.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=0, because the most significant output bit is 0.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -23 and 67; their true signed result is 44.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 44 is inside the 8-bit signed range.
- The flags do not change the stored byte 00101100; they help later control logic interpret the outcome.
Final answer: 00101100; Z0 N0 C1 V0
ALU diagnostics · Problem 0277
For A=11101100 and B=10101111, 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 →
- Treat A=11101100 and B=10101111 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 236 + 175 = 411.
- Reduce the result modulo 256: 155.
- The eight output bits are 10011011.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=1, because the most significant output bit is 1.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -20 and -81; their true signed result is -101.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -101 is inside the 8-bit signed range.
- The flags do not change the stored byte 10011011; they help later control logic interpret the outcome.
Final answer: 10011011; Z0 N1 C1 V0
ALU diagnostics · Problem 0278
For A=11101101 and B=10011100, 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 →
- Treat A=11101101 and B=10011100 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 237 + 156 = 393.
- Reduce the result modulo 256: 137.
- The eight output bits are 10001001.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=1, because the most significant output bit is 1.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -19 and -100; their true signed result is -119.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -119 is inside the 8-bit signed range.
- The flags do not change the stored byte 10001001; they help later control logic interpret the outcome.
Final answer: 10001001; Z0 N1 C1 V0
ALU diagnostics · Problem 0279
For A=11101110 and B=00001010, 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 →
- Treat A=11101110 and B=00001010 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 238 − 10 = 228.
- Reduce the result modulo 256: 228.
- The eight output bits are 11100100.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=1, because the most significant output bit is 1.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -18 and 10; their true signed result is -28.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -28 is inside the 8-bit signed range.
- The flags do not change the stored byte 11100100; they help later control logic interpret the outcome.
Final answer: 11100100; Z0 N1 C1 V0
ALU diagnostics · Problem 0280
For A=11101110 and B=11011010, 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 →
- Treat A=11101110 and B=11011010 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 238 + 218 = 456.
- Reduce the result modulo 256: 200.
- The eight output bits are 11001000.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=1, because the most significant output bit is 1.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -18 and -38; their true signed result is -56.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -56 is inside the 8-bit signed range.
- The flags do not change the stored byte 11001000; they help later control logic interpret the outcome.
Final answer: 11001000; Z0 N1 C1 V0
ALU diagnostics · Problem 0281
For A=11101111 and B=10000010, 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 →
- Treat A=11101111 and B=10000010 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 239 − 130 = 109.
- Reduce the result modulo 256: 109.
- The eight output bits are 01101101.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=0, because the most significant output bit is 0.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -17 and -126; their true signed result is 109.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 109 is inside the 8-bit signed range.
- The flags do not change the stored byte 01101101; they help later control logic interpret the outcome.
Final answer: 01101101; Z0 N0 C1 V0
ALU diagnostics · Problem 0282
For A=11110000 and B=00001111, 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 →
- Treat A=11110000 and B=00001111 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 240 + 15 = 255.
- Reduce the result modulo 256: 255.
- The eight output bits are 11111111.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=1, because the most significant output bit is 1.
- Carry flag C=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -16 and 15; their true signed result is -1.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -1 is inside the 8-bit signed range.
- The flags do not change the stored byte 11111111; they help later control logic interpret the outcome.
Final answer: 11111111; Z0 N1 C0 V0
ALU diagnostics · Problem 0283
For A=11110000 and B=01011110, 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 →
- Treat A=11110000 and B=01011110 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 240 + 94 = 334.
- Reduce the result modulo 256: 78.
- The eight output bits are 01001110.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=0, because the most significant output bit is 0.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -16 and 94; their true signed result is 78.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 78 is inside the 8-bit signed range.
- The flags do not change the stored byte 01001110; they help later control logic interpret the outcome.
Final answer: 01001110; Z0 N0 C1 V0
ALU diagnostics · Problem 0284
For A=11110001 and B=01101011, 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 →
- Treat A=11110001 and B=01101011 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 241 − 107 = 134.
- Reduce the result modulo 256: 134.
- The eight output bits are 10000110.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=1, because the most significant output bit is 1.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -15 and 107; their true signed result is -122.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -122 is inside the 8-bit signed range.
- The flags do not change the stored byte 10000110; they help later control logic interpret the outcome.
Final answer: 10000110; Z0 N1 C1 V0
ALU diagnostics · Problem 0285
For A=11110001 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 →
- Treat A=11110001 and B=10101110 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 241 − 174 = 67.
- Reduce the result modulo 256: 67.
- The eight output bits are 01000011.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=0, because the most significant output bit is 0.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -15 and -82; their true signed result is 67.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 67 is inside the 8-bit signed range.
- The flags do not change the stored byte 01000011; they help later control logic interpret the outcome.
Final answer: 01000011; Z0 N0 C1 V0
ALU diagnostics · Problem 0286
For A=11110001 and B=11111001, 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 →
- Treat A=11110001 and B=11111001 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 241 + 249 = 490.
- Reduce the result modulo 256: 234.
- The eight output bits are 11101010.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=1, because the most significant output bit is 1.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -15 and -7; their true signed result is -22.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -22 is inside the 8-bit signed range.
- The flags do not change the stored byte 11101010; they help later control logic interpret the outcome.
Final answer: 11101010; Z0 N1 C1 V0
ALU diagnostics · Problem 0287
For A=11110010 and B=01100111, 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 →
- Treat A=11110010 and B=01100111 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 242 + 103 = 345.
- Reduce the result modulo 256: 89.
- The eight output bits are 01011001.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=0, because the most significant output bit is 0.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -14 and 103; their true signed result is 89.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 89 is inside the 8-bit signed range.
- The flags do not change the stored byte 01011001; they help later control logic interpret the outcome.
Final answer: 01011001; Z0 N0 C1 V0
ALU diagnostics · Problem 0288
For A=11110010 and B=01110001, 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 →
- Treat A=11110010 and B=01110001 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 242 + 113 = 355.
- Reduce the result modulo 256: 99.
- The eight output bits are 01100011.
- Zero flag Z=0, because the stored output is nonzero.
- Negative flag N=0, because the most significant output bit is 0.
- Carry flag C=1 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -14 and 113; their true signed result is 99.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 99 is inside the 8-bit signed range.
- The flags do not change the stored byte 01100011; they help later control logic interpret the outcome.
Final answer: 01100011; Z0 N0 C1 V0