hexadecimal link

This commit is contained in:
sejo 2021-07-24 20:44:48 -05:00
parent a60427ec16
commit 5e639fea2e
2 changed files with 43 additions and 1 deletions

42
src/hexadecimal.gmo Normal file
View File

@ -0,0 +1,42 @@
# hexadecimal
numeral system in base 16: it uses 16 digits, from 0 to 9 and from 'a' to 'f'.
there's a direct mapping between each possible combination of 4 bits (nibble), and an hexadecimal (hex) digit:
+ <table>
+ <tr><th>binary</th><th>hex</th><th>dec</th></tr>
+ <tr><td>0000</td><td>0</td><td>0</td></tr>
+ <tr><td>0001</td><td>1</td><td>1</td></tr>
+ <tr><td>0010</td><td>2</td><td>2</td></tr>
+ <tr><td>0011</td><td>3</td><td>3</td></tr>
+ <tr><td>0100</td><td>4</td><td>4</td></tr>
+ <tr><td>0101</td><td>5</td><td>5</td></tr>
+ <tr><td>0110</td><td>6</td><td>6</td></tr>
+ <tr><td>0111</td><td>7</td><td>7</td></tr>
+ <tr><td>1000</td><td>8</td><td>8</td></tr>
+ <tr><td>1001</td><td>9</td><td>9</td></tr>
+ <tr><td>1010</td><td>a</td><td>10</td></tr>
+ <tr><td>1011</td><td>b</td><td>11</td></tr>
+ <tr><td>1100</td><td>c</td><td>12</td></tr>
+ <tr><td>1101</td><td>d</td><td>13</td></tr>
+ <tr><td>1110</td><td>e</td><td>14</td></tr>
+ <tr><td>1111</td><td>f</td><td>15</td></tr>
+ </table>
& * 0000 is 0
& * 0001 is 1
& * 0010 is 2
& * 0011 is 3
& * 0100 is 4
& * 0101 is 5
& * 0110 is 6
& * 0111 is 7
& * 1000 is 8
& * 1001 is 9
& * 1010 is a
& * 1011 is b
& * 1100 is c
& * 1101 is d
& * 1110 is e
& * 1111 is f

View File

@ -109,7 +109,7 @@ binary words of 8-bits, also known as bytes, are the basic elements of data enco
uxn can also handle binary words of 16-bits (2 bytes), also known as shorts, by concatenating two consecutive bytes. we'll talk more about this in the second day of the tutorial.
numbers in uxn are expressed using the hexadecimal system (base 16), where each digit (nibble) goes from 0 to 9 and then from 'a' to 'f' (in lower case).
numbers in uxn are expressed using the {hexadecimal} system (base 16), where each digit (nibble) goes from 0 to 9 and then from 'a' to 'f' (in lower case).
a byte needs two hexadecimal digits (nibbles) to be expressed, and a short needs four.