Jump to content
IGNORED

Half number decimals Atari assembler


Recommended Posts

For me, from a firmware background, it's easiest to use fixed point numbers.  For example, if you have 16 bits, you might have an 8.8, or a 10.6, or 12.4, depending on how much resolution you need.  For these, instead of a decimal point, you have a binary point.  The bits to the right of the binary point are your fractions.  

 

For base 10 (decimal), you have the tenths place, hundredths place, thousandths place, etc.  For base 2 (binary), you have the halves place, quarters place, eights place, etc.

 

Say that you only need 0..15 and you want to have a resolution of 1/16th.  Then you can use a 4.4 fixed place notation.  So $00 = 0.0 and $88 = 8.5, $C9 = 12.5625 (fraction = 9/16) and $FF = 15.9375 (fifteen and 15/16ths).

Likewise, if you only need .25 increments, you could use a 6.2 notation, the above examples become $00 = 0.0, $88 = 34.0, $C9 = 50.25, $FF = 63.75.

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...