Fully solved problem book
ALU and condition flags
Set 5 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 0129
For A=01110000 and B=01010110, 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=01110000 and B=01010110 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 112 + 86 = 198.
- Reduce the result modulo 256: 198.
- The eight output bits are 11000110.
- 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 112 and 86; their true signed result is 198.
- The signed result range is −128 through 127.
- Overflow flag V=1; signed result 198 is outside the 8-bit signed range.
- The flags do not change the stored byte 11000110; they help later control logic interpret the outcome.
Final answer: 11000110; Z0 N1 C0 V1
ALU diagnostics · Problem 0130
For A=01110011 and B=10001011, 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=01110011 and B=10001011 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 115 + 139 = 254.
- Reduce the result modulo 256: 254.
- The eight output bits are 11111110.
- 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 115 and -117; their true signed result is -2.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -2 is inside the 8-bit signed range.
- The flags do not change the stored byte 11111110; they help later control logic interpret the outcome.
Final answer: 11111110; Z0 N1 C0 V0
ALU diagnostics · Problem 0131
For A=01110100 and B=01011011, 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=01110100 and B=01011011 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 116 − 91 = 25.
- Reduce the result modulo 256: 25.
- The eight output bits are 00011001.
- 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 116 and 91; their true signed result is 25.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 25 is inside the 8-bit signed range.
- The flags do not change the stored byte 00011001; they help later control logic interpret the outcome.
Final answer: 00011001; Z0 N0 C1 V0
ALU diagnostics · Problem 0132
For A=01110101 and B=10011101, 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=01110101 and B=10011101 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 117 + 157 = 274.
- Reduce the result modulo 256: 18.
- The eight output bits are 00010010.
- 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 117 and -99; their true signed result is 18.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 18 is inside the 8-bit signed range.
- The flags do not change the stored byte 00010010; they help later control logic interpret the outcome.
Final answer: 00010010; Z0 N0 C1 V0
ALU diagnostics · Problem 0133
For A=01110101 and B=10011110, 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=01110101 and B=10011110 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 117 + 158 = 275.
- Reduce the result modulo 256: 19.
- The eight output bits are 00010011.
- 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 117 and -98; their true signed result is 19.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 19 is inside the 8-bit signed range.
- The flags do not change the stored byte 00010011; they help later control logic interpret the outcome.
Final answer: 00010011; Z0 N0 C1 V0
ALU diagnostics · Problem 0134
For A=01110101 and B=11011010, 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=01110101 and B=11011010 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 117 − 218 = -101.
- 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=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are 117 and -38; their true signed result is 155.
- The signed result range is −128 through 127.
- Overflow flag V=1; signed result 155 is outside 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 C0 V1
ALU diagnostics · Problem 0135
For A=01110110 and B=00010101, 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=01110110 and B=00010101 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 118 − 21 = 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 118 and 21; their true signed result is 97.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 97 is inside 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 V0
ALU diagnostics · Problem 0136
For A=01110111 and B=00010110, run ADD; find the low byte and Z, N, C, V.
Try it on paper first. The worked answer is hidden below.
Reveal detailed solution →
- Treat A=01110111 and B=00010110 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 119 + 22 = 141.
- 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=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are 119 and 22; 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 10001101; they help later control logic interpret the outcome.
Final answer: 10001101; Z0 N1 C0 V1
ALU diagnostics · Problem 0137
For A=01111001 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=01111001 and B=10101111 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 121 + 175 = 296.
- Reduce the result modulo 256: 40.
- The eight output bits are 00101000.
- 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 121 and -81; 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 00101000; they help later control logic interpret the outcome.
Final answer: 00101000; Z0 N0 C1 V0
ALU diagnostics · Problem 0138
For A=01111001 and B=11101101, 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=01111001 and B=11101101 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 121 + 237 = 358.
- Reduce the result modulo 256: 102.
- The eight output bits are 01100110.
- 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 121 and -19; their true signed result is 102.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 102 is inside the 8-bit signed range.
- The flags do not change the stored byte 01100110; they help later control logic interpret the outcome.
Final answer: 01100110; Z0 N0 C1 V0
ALU diagnostics · Problem 0139
For A=01111010 and B=01110101, run SUB; find the low byte and Z, N, C, V.
Try it on paper first. The worked answer is hidden below.
Reveal detailed solution →
- Treat A=01111010 and B=01110101 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 122 − 117 = 5.
- 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 122 and 117; 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 0140
For A=01111011 and B=00110110, 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=01111011 and B=00110110 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 123 + 54 = 177.
- Reduce the result modulo 256: 177.
- The eight output bits are 10110001.
- 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 123 and 54; their true signed result is 177.
- The signed result range is −128 through 127.
- Overflow flag V=1; signed result 177 is outside the 8-bit signed range.
- The flags do not change the stored byte 10110001; they help later control logic interpret the outcome.
Final answer: 10110001; Z0 N1 C0 V1
ALU diagnostics · Problem 0141
For A=01111101 and B=00111100, 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=01111101 and B=00111100 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 125 + 60 = 185.
- Reduce the result modulo 256: 185.
- The eight output bits are 10111001.
- 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 125 and 60; their true signed result is 185.
- The signed result range is −128 through 127.
- Overflow flag V=1; signed result 185 is outside the 8-bit signed range.
- The flags do not change the stored byte 10111001; they help later control logic interpret the outcome.
Final answer: 10111001; Z0 N1 C0 V1
ALU diagnostics · Problem 0142
For A=01111110 and B=01110101, run SUB; find the low byte and Z, N, C, V.
Try it on paper first. The worked answer is hidden below.
Reveal detailed solution →
- Treat A=01111110 and B=01110101 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 126 − 117 = 9.
- Reduce the result modulo 256: 9.
- The eight output bits are 00001001.
- 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 126 and 117; their true signed result is 9.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result 9 is inside the 8-bit signed range.
- The flags do not change the stored byte 00001001; they help later control logic interpret the outcome.
Final answer: 00001001; Z0 N0 C1 V0
ALU diagnostics · Problem 0143
For A=10000000 and B=00011010, 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=10000000 and B=00011010 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 128 + 26 = 154.
- Reduce the result modulo 256: 154.
- The eight output bits are 10011010.
- 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 -128 and 26; their true signed result is -102.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -102 is inside the 8-bit signed range.
- 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 0144
For A=10000000 and B=10100111, 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=10000000 and B=10100111 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 128 − 167 = -39.
- Reduce the result modulo 256: 217.
- The eight output bits are 11011001.
- 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 -128 and -89; their true signed result is -39.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -39 is inside the 8-bit signed range.
- 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 0145
For A=10000001 and B=11010001, 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=10000001 and B=11010001 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 129 − 209 = -80.
- 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=0 under the selected convention (ADD uses carry-out; SUB uses no-borrow).
- Signed readings are -127 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 C0 V0
ALU diagnostics · Problem 0146
For A=10000010 and B=01100011, 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=10000010 and B=01100011 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 130 − 99 = 31.
- Reduce the result modulo 256: 31.
- The eight output bits are 00011111.
- 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 -126 and 99; their true signed result is -225.
- The signed result range is −128 through 127.
- Overflow flag V=1; signed result -225 is outside the 8-bit signed range.
- The flags do not change the stored byte 00011111; they help later control logic interpret the outcome.
Final answer: 00011111; Z0 N0 C1 V1
ALU diagnostics · Problem 0147
For A=10000011 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 →
- Treat A=10000011 and B=10010000 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 131 + 144 = 275.
- Reduce the result modulo 256: 19.
- The eight output bits are 00010011.
- 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 -125 and -112; their true signed result is -237.
- The signed result range is −128 through 127.
- Overflow flag V=1; signed result -237 is outside the 8-bit signed range.
- The flags do not change the stored byte 00010011; they help later control logic interpret the outcome.
Final answer: 00010011; Z0 N0 C1 V1
ALU diagnostics · Problem 0148
For A=10000011 and B=11000001, 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=10000011 and B=11000001 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 131 + 193 = 324.
- Reduce the result modulo 256: 68.
- The eight output bits are 01000100.
- 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 -125 and -63; their true signed result is -188.
- The signed result range is −128 through 127.
- Overflow flag V=1; signed result -188 is outside the 8-bit signed range.
- The flags do not change the stored byte 01000100; they help later control logic interpret the outcome.
Final answer: 01000100; Z0 N0 C1 V1
ALU diagnostics · Problem 0149
For A=10000100 and B=01100111, 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=10000100 and B=01100111 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 132 − 103 = 29.
- Reduce the result modulo 256: 29.
- The eight output bits are 00011101.
- 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 -124 and 103; their true signed result is -227.
- The signed result range is −128 through 127.
- Overflow flag V=1; signed result -227 is outside the 8-bit signed range.
- The flags do not change the stored byte 00011101; they help later control logic interpret the outcome.
Final answer: 00011101; Z0 N0 C1 V1
ALU diagnostics · Problem 0150
For A=10000101 and B=11010010, 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=10000101 and B=11010010 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 133 − 210 = -77.
- Reduce the result modulo 256: 179.
- The eight output bits are 10110011.
- 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 -123 and -46; their true signed result is -77.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -77 is inside the 8-bit signed range.
- The flags do not change the stored byte 10110011; they help later control logic interpret the outcome.
Final answer: 10110011; Z0 N1 C0 V0
ALU diagnostics · Problem 0151
For A=10000110 and B=01111111, 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=10000110 and B=01111111 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 134 + 127 = 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 -122 and 127; 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 0152
For A=10000110 and B=11110100, 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=10000110 and B=11110100 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 134 + 244 = 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 -122 and -12; 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 0153
For A=10001001 and B=01100010, 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=10001001 and B=01100010 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 137 − 98 = 39.
- Reduce the result modulo 256: 39.
- The eight output bits are 00100111.
- 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 -119 and 98; their true signed result is -217.
- The signed result range is −128 through 127.
- Overflow flag V=1; signed result -217 is outside the 8-bit signed range.
- The flags do not change the stored byte 00100111; they help later control logic interpret the outcome.
Final answer: 00100111; Z0 N0 C1 V1
ALU diagnostics · Problem 0154
For A=10001001 and B=11100001, 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=10001001 and B=11100001 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 137 − 225 = -88.
- Reduce the result modulo 256: 168.
- The eight output bits are 10101000.
- 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 -119 and -31; their true signed result is -88.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -88 is inside the 8-bit signed range.
- The flags do not change the stored byte 10101000; they help later control logic interpret the outcome.
Final answer: 10101000; Z0 N1 C0 V0
ALU diagnostics · Problem 0155
For A=10001010 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=10001010 and B=01000011 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 138 + 67 = 205.
- Reduce the result modulo 256: 205.
- The eight output bits are 11001101.
- 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 -118 and 67; their true signed result is -51.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -51 is inside the 8-bit signed range.
- The flags do not change the stored byte 11001101; they help later control logic interpret the outcome.
Final answer: 11001101; Z0 N1 C0 V0
ALU diagnostics · Problem 0156
For A=10001100 and B=10000110, 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=10001100 and B=10000110 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 140 − 134 = 6.
- Reduce the result modulo 256: 6.
- The eight output bits are 00000110.
- 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 -116 and -122; 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 00000110; they help later control logic interpret the outcome.
Final answer: 00000110; Z0 N0 C1 V0
ALU diagnostics · Problem 0157
For A=10001100 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 →
- Treat A=10001100 and B=10011010 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 140 − 154 = -14.
- Reduce the result modulo 256: 242.
- The eight output bits are 11110010.
- 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 -116 and -102; their true signed result is -14.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -14 is inside the 8-bit signed range.
- The flags do not change the stored byte 11110010; they help later control logic interpret the outcome.
Final answer: 11110010; Z0 N1 C0 V0
ALU diagnostics · Problem 0158
For A=10001100 and B=11010001, 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=10001100 and B=11010001 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 140 − 209 = -69.
- Reduce the result modulo 256: 187.
- The eight output bits are 10111011.
- 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 -116 and -47; their true signed result is -69.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -69 is inside the 8-bit signed range.
- The flags do not change the stored byte 10111011; they help later control logic interpret the outcome.
Final answer: 10111011; Z0 N1 C0 V0
ALU diagnostics · Problem 0159
For A=10001100 and B=11111011, 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=10001100 and B=11111011 as the input bit patterns.
- Execute ADD; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 140 + 251 = 391.
- Reduce the result modulo 256: 135.
- The eight output bits are 10000111.
- 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 -116 and -5; their true signed result is -121.
- The signed result range is −128 through 127.
- Overflow flag V=0; signed result -121 is inside the 8-bit signed range.
- The flags do not change the stored byte 10000111; they help later control logic interpret the outcome.
Final answer: 10000111; Z0 N1 C1 V0
ALU diagnostics · Problem 0160
For A=10001110 and B=01100001, 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=10001110 and B=01100001 as the input bit patterns.
- Execute SUB; compute the mathematical integer expression using the input patterns.
- The ordinary unsigned calculation yields 142 − 97 = 45.
- Reduce the result modulo 256: 45.
- The eight output bits are 00101101.
- 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 -114 and 97; their true signed result is -211.
- The signed result range is −128 through 127.
- Overflow flag V=1; signed result -211 is outside the 8-bit signed range.
- The flags do not change the stored byte 00101101; they help later control logic interpret the outcome.
Final answer: 00101101; Z0 N0 C1 V1