# Multiply an 8-bit value by 16 and store as a 16-bit value
This is used in NES games (at least [[Faxanadu]]) to take a value and turn it into a ROM offset for a 16-byte span.
For this:
* Input:
* `value` = Starting value
* Output:
* `A` = Low byte of value
* `tempvar` = High byte of value
```asm
LDA value
LDY 0
STY tempvar
ASL value
ROL tempvar
ASL value
ROL tempvar
ASL value
ROL tempvar
ASL value
ROL tempvar
```
This is equivalent to:
```c
new_lower = (lower << 4) & 0xFF
new_upper = (lower >> 4) & 0xFF
```
# Multiply a 16-bit value by 16
This is similar to the above, but you're multiplying a 16-bit value instead:
For this:
* Input:
* `lower` = Lower starting value
* `upper` = Upper starting value
* Output:
* `A` = Lower value
* `tempvar` = Upper value
```asm
LDA lower
STA tempvar
LDA upper
ASL tempvar
ROL A
ASL tempvar
ROL A
ASL tempvar
ROL A
ASL tempvar
ROL A
```
Only difference is that we're pre-populating `tempvar` with a specific upper value.
```c
new_lower = (lower << 4) & 0xFF
new_upper = ((upper << 4) | (lower >> 4)) & 0xFF
```