The system I’m working with, has four registers: al, bl, cl, dl and values can be stored only as hex.
I am reading from keyboard 2 digits, e.g. 9 and 1.
I would like to store this number in the BL register, as 5B which is the hex value for 91 (decimal).
I’ve been thinking of ways to solve this, but I can’t find any. My main mistake was I was multiply 9 by 10, and add 1, result is 91, but I’ve forgot that actually 91 is in hex, which translated to decimal becomes 145 (which is not my number)
So, how do I store the two digits (9 and 1, which form 91) as hex value (5B) into some register or in RAM.
Please advise.
Many thanks,
V
That’s not a mistake. As long as you are multiplying by 10 (decimal) and not 10h (hex, which is 16 decimal), then you’ll get the answer you are looking for.
Values stored in CPU registers are just binary numbers, they aren’t “in hex” or “in decimal”.
Note that you may occasionally run into BCD, which aren’t binary numbers but are another thing entirely.