home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaDemoCD1.iso / DEMOS / EXODUS-PsycedIssue3b.DMS / EXODUS-PsycedIssue3b.adf / 8.4 < prev    next >
Encoding:
Text File  |  1987-05-07  |  7.0 KB  |  2 lines

  1.                                                                                            ¾               Number Systems                                                                                                                                  ²                    by                                                                                                                                         ·               Axl of Exodus                                                                                                                                                                                                         One of the most important things in coding must be the number systems.Im        here to explain a little about them.Lets start with Binary numbers.                                                                                             Binary numbers consist of only 2 numbers 0 and 1.Binary numbers can be used     to create sprites or even text cursors (See Amos,code at the end of this).      Looking at 0100 on the screen can be confusing to the beginner so im sure       that you would feel better and a bit more confident if you knew what the        actual binary number was in decimal.Well heres how to convert your binary       numbers into decimal.                                                                                                                                           Take the binary number 1011.Heres the equation.                                 Binary has a radix of 2                                                           ¾                                                                             1 * 2³ + 0 * 2² + 1 * 2¹ + 1 * 2°=Decimal                                         ²                                                                                                                                                                                                                                             When worked out it looks like this                                                ·                                                                             8+0+2+1 = 11.                                                                     ²                                                                             What your doing is splitting the binary number into 4 digits.                                                                                                   How about converting a hex number into decimal,but first you`ll need to         know the hex number table.                                                        ¾                                                                             Decimal:                                                                          ·                                                                             1  2  3  4  5  6  7  8  9 10 11 12 13 14 15                                       ¾                                                                             Hex:                                                                              ·                                                                             $1 $2 $3 $4 $5 $6 $7 $8 $9 $a $b $c $d $e $f                                      ²                                                                             Hex must have the $ sign before it,otherwise it will be understood as a         decimal.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Ok now lets convert a hex number to decimal.                                    Hex numbers use a radix of 16.                                                    ¾                                                                             10 hex = 1 * 16¹ + 0 * 16°=decimal                                                ²                                                                             Thus it looks like this.                                                          ¾                                                                             16+0 = 16 decimal                                                                 ·                                                                             Another example                                                                   ¾                                                                             1C hex is the numbers 1 and 12 because $c = 12 decimal                            ·                                                                             $1C = 1*16¹+12*16 to the power of 0 = decimal                                     ¾                                                                             16+12=28 decimal so $1C = 28 decimal                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ²                                                                             Now heres that bit of Amos code to change your text cursor in Amos.               ¾                                                                             L1=%11111111                                                                    L2=%11111111                                                                    L3=%11111111                                                                    L4=%11111111                                                                    L5=%11111111                                                                    L6=%11111111                                                                    L7=%11111111                                                                    L8=%11111111                                                                      ·                                                                             Set curs L1,L2,L3,L4,L5,L6,L7,L8                                                  ²                                                                             A 1 stands for a pixel while a 0 stands for a blank pixel.                        ¾                                                                             End.                                                                           
  2.