Assembly Language 8086 decimal fraction

How to store fraction decimal in 8086 registers? For example,

mov ax,0.5
mov bx,0.5
add ax,bx

Solution 1:

Registers like AX and BX can store values in the range of [0,65535]. At first this excludes numbers like 0.5 or 7.25, but you could chose a register layout that suits your needs!

You could opt to store the integer part in the high byte, and store the fraction in the low byte. Now as long as you remember this layout you can do all the usual arithmetic on these numbers.

mov ax, 0080h  ;integer in AH=0, fraction in AL=128 which represents 0.5 (256/2)
mov bx, 0740h  ;integer in BH=7, fraction in BL=64 which represents 0.25 (256/4)
add ax, bx

Now AX=07C0h which represents 7.75

Solution 2:

you can implement arrays that hold such point float or double float numbers, and even calculate sine and cosine , I did such a project using that method. basically its easiest with 2 variables of 16 bit

and just implement functions like multiplication and addition using that method with 2 variables . or more. this is not assembly its pseudo , just to give a glimpse of my solution

low_x=1000
high_x=0

divide low_x , 10000 (a div operation that stores quotient and a remainder)

add high_x,quotient
mov low_x,remainder

x=0.1