| Arithmetic: multiplication | |||||||||||||
| UB multiplication also follows the same rules as ordinary arithmetic | |||||||||||||
| carry | 0 | 1 | 1 | 1 | 0 | 0 | decimal | ||||||
| 0 | 1 | 0 | 1 | 5 | |||||||||
| 0 | 1 | 1 | 1 | 7 | |||||||||
| 0 | 1 | 0 | 1 | ||||||||||
| 0 | 1 | 0 | 1 | ||||||||||
| 0 | 1 | 0 | 1 | ||||||||||
| 0 | 0 | 0 | 0 | ||||||||||
| result | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 35 | |||||
| Notice that the operations can be carried out using just add and shift | |||||||||||||
| 2C multiplication: sign bit must be extended to get proper answer | |||||||||||||
| carry | 2 | 2 | 2 | 1 | 1 | 0 | 0 | ||||||
| 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | -3 | |||||
| 0 | 1 | 1 | 1 | 7 | |||||||||
| 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | ||||||
| 1 | 1 | 1 | 1 | 1 | 0 | 1 | |||||||
| 1 | 1 | 1 | 1 | 0 | 1 | ||||||||
| 0 | 0 | 0 | 0 | 0 | |||||||||
| result | 1 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | -21 | ||||