Fully solved problem book
ALU and condition flags
Set 8 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 0225
For A=11000110 and B=11110110, 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=11000110 and B=11110110 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 198 − 246 = -48.
- 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=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -58 and -10; 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 C0 V0
ALU diagnostics · Problem 0226
For A=11000111 and B=11001100, 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=11000111 and B=11001100 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 199 − 204 = -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 -57 and -52; 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 0227
For A=11001000 and B=00000000, 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=11001000 and B=00000000 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 200 + 0 = 200.
- 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=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -56 and 0; 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 C0 V0
ALU diagnostics · Problem 0228
For A=11001000 and B=01101111, 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=11001000 and B=01101111 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 200 − 111 = 89.
- 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 -56 and 111; their true signed result is -167.
- The signed result range is −128 through 127.
- Overflow flag V=1; signed result -167 is outside 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 V1
ALU diagnostics · Problem 0229
For A=11001001 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=11001001 and B=00001111 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 201 + 15 = 216.
- Reduce the result modulo 256: 216.
- The eight output bits are 11011000.
- 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 -55 and 15; their true signed result is -40.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -40 is inside the 8-bit signed range.
- 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 0230
For A=11001100 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=11001100 and B=01000011 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 204 + 67 = 271.
- Reduce the result modulo 256: 15.
- The eight output bits are 00001111.
- 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 -52 and 67; their true signed result is 15.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 15 is inside the 8-bit signed range.
- The flags do not change the stored byte 00001111; they help later control logic interpret the outcome.
Final answer: 00001111; Z0 N0 C1 V0
ALU diagnostics · Problem 0231
For A=11001100 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=11001100 and B=11110111 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 204 + 247 = 451.
- Reduce the result modulo 256: 195.
- The eight output bits are 11000011.
- 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 -52 and -9; their true signed result is -61.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -61 is inside the 8-bit signed range.
- The flags do not change the stored byte 11000011; they help later control logic interpret the outcome.
Final answer: 11000011; Z0 N1 C1 V0
ALU diagnostics · Problem 0232
For A=11001111 and B=00100100, 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=11001111 and B=00100100 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 207 + 36 = 243.
- Reduce the result modulo 256: 243.
- The eight output bits are 11110011.
- 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 -49 and 36; their true signed result is -13.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -13 is inside the 8-bit signed range.
- 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 0233
For A=11001111 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 →
- Treat A=11001111 and B=00100110 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 207 − 38 = 169.
- Reduce the result modulo 256: 169.
- The eight output bits are 10101001.
- 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 -49 and 38; their true signed result is -87.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -87 is inside the 8-bit signed range.
- The flags do not change the stored byte 10101001; they help later control logic interpret the outcome.
Final answer: 10101001; Z0 N1 C1 V0
ALU diagnostics · Problem 0234
For A=11001111 and B=01101110, 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=11001111 and B=01101110 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 207 − 110 = 97.
- Reduce the result modulo 256: 97.
- The eight output bits are 01100001.
- 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 -49 and 110; their true signed result is -159.
- The signed result range is −128 through 127.
- Overflow flag V=1; signed result -159 is outside the 8-bit signed range.
- The flags do not change the stored byte 01100001; they help later control logic interpret the outcome.
Final answer: 01100001; Z0 N0 C1 V1
ALU diagnostics · Problem 0235
For A=11010000 and B=00000110, 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=11010000 and B=00000110 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 208 − 6 = 202.
- Reduce the result modulo 256: 202.
- The eight output bits are 11001010.
- 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 -48 and 6; their true signed result is -54.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -54 is inside the 8-bit signed range.
- The flags do not change the stored byte 11001010; they help later control logic interpret the outcome.
Final answer: 11001010; Z0 N1 C1 V0
ALU diagnostics · Problem 0236
For A=11010000 and B=01100001, 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=11010000 and B=01100001 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 208 + 97 = 305.
- Reduce the result modulo 256: 49.
- The eight output bits are 00110001.
- 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 -48 and 97; their true signed result is 49.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 49 is inside the 8-bit signed range.
- The flags do not change the stored byte 00110001; they help later control logic interpret the outcome.
Final answer: 00110001; Z0 N0 C1 V0
ALU diagnostics · Problem 0237
For A=11010000 and B=01111111, 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=11010000 and B=01111111 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 208 − 127 = 81.
- Reduce the result modulo 256: 81.
- The eight output bits are 01010001.
- 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 -48 and 127; their true signed result is -175.
- The signed result range is −128 through 127.
- Overflow flag V=1; signed result -175 is outside the 8-bit signed range.
- The flags do not change the stored byte 01010001; they help later control logic interpret the outcome.
Final answer: 01010001; Z0 N0 C1 V1
ALU diagnostics · Problem 0238
For A=11010001 and B=00101001, 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=11010001 and B=00101001 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 209 + 41 = 250.
- Reduce the result modulo 256: 250.
- The eight output bits are 11111010.
- 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 -47 and 41; their true signed result is -6.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -6 is inside the 8-bit signed range.
- The flags do not change the stored byte 11111010; they help later control logic interpret the outcome.
Final answer: 11111010; Z0 N1 C0 V0
ALU diagnostics · Problem 0239
For A=11010010 and B=00010110, 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=11010010 and B=00010110 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 210 − 22 = 188.
- Reduce the result modulo 256: 188.
- The eight output bits are 10111100.
- 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 -46 and 22; their true signed result is -68.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -68 is inside the 8-bit signed range.
- The flags do not change the stored byte 10111100; they help later control logic interpret the outcome.
Final answer: 10111100; Z0 N1 C1 V0
ALU diagnostics · Problem 0240
For A=11010010 and B=10010001, 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=11010010 and B=10010001 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 210 + 145 = 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 -46 and -111; their true signed result is -157.
- The signed result range is −128 through 127.
- Overflow flag V=1; signed result -157 is outside 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 V1
ALU diagnostics · Problem 0241
For A=11010010 and B=10100100, 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=11010010 and B=10100100 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 210 − 164 = 46.
- Reduce the result modulo 256: 46.
- The eight output bits are 00101110.
- 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 -46 and -92; their true signed result is 46.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 46 is inside the 8-bit signed range.
- The flags do not change the stored byte 00101110; they help later control logic interpret the outcome.
Final answer: 00101110; Z0 N0 C1 V0
ALU diagnostics · Problem 0242
For A=11010011 and B=00010010, 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=11010011 and B=00010010 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 211 − 18 = 193.
- Reduce the result modulo 256: 193.
- The eight output bits are 11000001.
- 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 -45 and 18; their true signed result is -63.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -63 is inside the 8-bit signed range.
- The flags do not change the stored byte 11000001; they help later control logic interpret the outcome.
Final answer: 11000001; Z0 N1 C1 V0
ALU diagnostics · Problem 0243
For A=11010011 and B=11000100, 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=11010011 and B=11000100 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 211 + 196 = 407.
- Reduce the result modulo 256: 151.
- The eight output bits are 10010111.
- 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 -45 and -60; their true signed result is -105.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -105 is inside the 8-bit signed range.
- The flags do not change the stored byte 10010111; they help later control logic interpret the outcome.
Final answer: 10010111; Z0 N1 C1 V0
ALU diagnostics · Problem 0244
For A=11010011 and B=11111101, 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=11010011 and B=11111101 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 211 + 253 = 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 -45 and -3; 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 0245
For A=11010101 and B=00111000, 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=11010101 and B=00111000 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 213 − 56 = 157.
- Reduce the result modulo 256: 157.
- The eight output bits are 10011101.
- 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 -43 and 56; 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 10011101; they help later control logic interpret the outcome.
Final answer: 10011101; Z0 N1 C1 V0
ALU diagnostics · Problem 0246
For A=11010101 and B=00111110, 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=11010101 and B=00111110 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 213 − 62 = 151.
- Reduce the result modulo 256: 151.
- The eight output bits are 10010111.
- 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 -43 and 62; their true signed result is -105.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -105 is inside the 8-bit signed range.
- The flags do not change the stored byte 10010111; they help later control logic interpret the outcome.
Final answer: 10010111; Z0 N1 C1 V0
ALU diagnostics · Problem 0247
For A=11010101 and B=01101010, 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=11010101 and B=01101010 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 213 − 106 = 107.
- Reduce the result modulo 256: 107.
- The eight output bits are 01101011.
- 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 -43 and 106; their true signed result is -149.
- The signed result range is −128 through 127.
- Overflow flag V=1; signed result -149 is outside the 8-bit signed range.
- The flags do not change the stored byte 01101011; they help later control logic interpret the outcome.
Final answer: 01101011; Z0 N0 C1 V1
ALU diagnostics · Problem 0248
For A=11010101 and B=11011101, 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=11010101 and B=11011101 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 213 + 221 = 434.
- Reduce the result modulo 256: 178.
- The eight output bits are 10110010.
- 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 -43 and -35; 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 10110010; they help later control logic interpret the outcome.
Final answer: 10110010; Z0 N1 C1 V0
ALU diagnostics · Problem 0249
For A=11010110 and B=01000000, 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=11010110 and B=01000000 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 214 − 64 = 150.
- Reduce the result modulo 256: 150.
- The eight output bits are 10010110.
- 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 -42 and 64; their true signed result is -106.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -106 is inside the 8-bit signed range.
- The flags do not change the stored byte 10010110; they help later control logic interpret the outcome.
Final answer: 10010110; Z0 N1 C1 V0
ALU diagnostics · Problem 0250
For A=11010110 and B=10000100, 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=11010110 and B=10000100 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 214 − 132 = 82.
- Reduce the result modulo 256: 82.
- The eight output bits are 01010010.
- 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 -42 and -124; their true signed result is 82.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 82 is inside the 8-bit signed range.
- The flags do not change the stored byte 01010010; they help later control logic interpret the outcome.
Final answer: 01010010; Z0 N0 C1 V0
ALU diagnostics · Problem 0251
For A=11010110 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 →
- Treat A=11010110 and B=10111110 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 214 + 190 = 404.
- Reduce the result modulo 256: 148.
- The eight output bits are 10010100.
- 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 -42 and -66; their true signed result is -108.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -108 is inside the 8-bit signed range.
- The flags do not change the stored byte 10010100; they help later control logic interpret the outcome.
Final answer: 10010100; Z0 N1 C1 V0
ALU diagnostics · Problem 0252
For A=11011001 and B=10110101, 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=11011001 and B=10110101 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 217 + 181 = 398.
- Reduce the result modulo 256: 142.
- The eight output bits are 10001110.
- 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 -39 and -75; their true signed result is -114.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -114 is inside the 8-bit signed range.
- The flags do not change the stored byte 10001110; they help later control logic interpret the outcome.
Final answer: 10001110; Z0 N1 C1 V0
ALU diagnostics · Problem 0253
For A=11011011 and B=00110100, 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=11011011 and B=00110100 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 219 − 52 = 167.
- Reduce the result modulo 256: 167.
- The eight output bits are 10100111.
- 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 -37 and 52; 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 10100111; they help later control logic interpret the outcome.
Final answer: 10100111; Z0 N1 C1 V0
ALU diagnostics · Problem 0254
For A=11011101 and B=01011111, 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=11011101 and B=01011111 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 221 + 95 = 316.
- Reduce the result modulo 256: 60.
- The eight output bits are 00111100.
- 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 -35 and 95; their true signed result is 60.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 60 is inside the 8-bit signed range.
- The flags do not change the stored byte 00111100; they help later control logic interpret the outcome.
Final answer: 00111100; Z0 N0 C1 V0
ALU diagnostics · Problem 0255
For A=11011101 and B=11010000, 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=11011101 and B=11010000 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 221 − 208 = 13.
- Reduce the result modulo 256: 13.
- The eight output bits are 00001101.
- 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 -35 and -48; their true signed result is 13.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 13 is inside the 8-bit signed range.
- 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 0256
For A=11011110 and B=00011000, 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=11011110 and B=00011000 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 222 + 24 = 246.
- Reduce the result modulo 256: 246.
- The eight output bits are 11110110.
- 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 -34 and 24; their true signed result is -10.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -10 is inside the 8-bit signed range.
- The flags do not change the stored byte 11110110; they help later control logic interpret the outcome.
Final answer: 11110110; Z0 N1 C0 V0