27
Number systems Decimal When we learned to count, we learned the basic Decimal number system. In the Queen’s English this is called the Denary system. The basic numbers are 0 through 9. The number 586 was taught as five groups of a hundred, eight groups of ten, and a group of six. Each digit represented a group ten times larger than the one on its right, and ten times smaller than the one on its left. Binary Computers work in Binary. In this system we only have the numbers 0 and 1. Each digit represents a group that is two times larger than the one on its right, and two times smaller than the one on its left. Counting in Binary looks like this: Binary Decimal 0 0 1 1 One group of 1. 10 2 One group of 2 11 3 One group of 1 and one group of 2 100 4 One group of 4 101 5 One group of 4 and one group of 1 110 6 One group of 4 and one group of 2 111 7 One group of 4, one group of 2, and one group of 1 1000 8 One group of 8 1001 9 One group of 8, and one group of 1. 1010 10 One group of 8, and one group of 2 1011 11 One group of 8, one group of 2, and one group of 1 1100 12 One group of 8, and one group of 4 1101 13 One group of 8, and one group of 4, and one group of 1 1110 14 One group of 8, and one group of 4, and one group of 2 1

Number systems - Slot Techslot-tech.com/interesting_stuff/The Herschel Peeler... · Web viewOur numbers can go from 0 (00000000) to 255 (11111111, that’s 1, plus 2, plus 4, plus

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Number systems - Slot Techslot-tech.com/interesting_stuff/The Herschel Peeler... · Web viewOur numbers can go from 0 (00000000) to 255 (11111111, that’s 1, plus 2, plus 4, plus

Number systems

Decimal

When we learned to count, we learned the basic Decimal number system. In the Queen’s English this is called the Denary system. The basic numbers are 0 through 9. The number 586 was taught as five groups of a hundred, eight groups of ten, and a group of six. Each digit represented a group ten times larger than the one on its right, and ten times smaller than the one on its left.

Binary

Computers work in Binary. In this system we only have the numbers 0 and 1. Each digit represents a group that is two times larger than the one on its right, and two times smaller than the one on its left.

Counting in Binary looks like this:

Binary Decimal0 01 1 One group of 1.10 2 One group of 211 3 One group of 1 and one group of 2100 4 One group of 4101 5 One group of 4 and one group of 1110 6 One group of 4 and one group of 2111 7 One group of 4, one group of 2, and one group of 11000 8 One group of 81001 9 One group of 8, and one group of 1.1010 10 One group of 8, and one group of 21011 11 One group of 8, one group of 2, and one group of 11100 12 One group of 8, and one group of 41101 13 One group of 8, and one group of 4, and one group of 11110 14 One group of 8, and one group of 4, and one group of 21111 15 One group of 8, and one group of 4, one group of 2, and one group of 110000 16 One group of 16

The number 1011 represents 8, plus 2, plus 1, or 11.

Each 1 or 0 is called a Bit (Binary Digit). An 8-bit computer works on data that is 8-bits wide. Our numbers can go from 0 (00000000) to 255 (11111111, that’s 1, plus 2, plus 4, plus 8, plus 16, plus 32, plus 64, plus 128.)

1

Page 2: Number systems - Slot Techslot-tech.com/interesting_stuff/The Herschel Peeler... · Web viewOur numbers can go from 0 (00000000) to 255 (11111111, that’s 1, plus 2, plus 4, plus

An 8-bit value can hold a binary number from 0 to 255.

The far right is usually the Least Significant bit. "1's". As we move to thr left the value of each bit position doubles. As shown on the right, a number "9" would be represented in binary as a "1" in the "8" position and a "1" in the 1's" position. 161 would be 128 + 32 + 1. 88 is 64 + 16 + 8. All "0's" would represent a value of zero. The highest number we could represent in 8 bit positions would be 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1, or 255.

A 16-bit computer works on data that is 16-bits wide. That’s 0000000000000000 to 1111111111111111. That is 0 to 65,535.

Needless to say, this system is fine for machines where a voltage may be on (1) or off (0), but not for people. In order for the computer to talk to a person we need to convert the binary to text a human can read.

Binary is the basic language of all digital computers used in PCs and our games. It is at the binary level that the math and logical operations are done inside the computer chip. A 1 or a 0 might indicate a switch or light that is on or off. Inside the logic, all switches translate to a 1 or 0 in the circuits. All lamps are turned on and off by a 1 or 0 somewhere in the logic. The customer’s credits may be stored in memory as a binary number. All information the game uses, all pictures that get displayed, all reel positions, the customer’s name, everything, is nothing more than a sequence of 1’s and 0’s in the logic.

Octal

In an octal system we break up this long binary number into groups of three bits. Each group may be from a binary 000 to 111 (7). Each digit is eight times more than the one on its left, and eight times more than the one on its right. Counting looks like this:

Binary Oct Dec0 0 01 1 1 One group of 1.10 2 2 One group of 211 3 3 (2 + 1)100 4 4 One group of 4101 5 5 (4 + 1)110 6 6 (4 + 2)

2

Page 3: Number systems - Slot Techslot-tech.com/interesting_stuff/The Herschel Peeler... · Web viewOur numbers can go from 0 (00000000) to 255 (11111111, that’s 1, plus 2, plus 4, plus

111 7 7 (4 + 2 + 1)1 000 10 8 One group of 81 001 11 9 (8 + 1)1 010 12 10 (8 + 2)1 011 13 11 (8 + 2 + 1)1 100 14 12 (8 + 4)1 101 15 13 (8 + 5)1 110 16 14 (8 + 4 + 2)1 111 17 15 (8 + 4 + 2 + 1)10 000 20 16 One group of 16

The 16-bit binary number 1101110111101100 would be presented to the human as,

1 101 110 111 101 1001 5 6 7 5 4 or 1567548

The small “8” indicates that this is a Base-8 (Octal) number so it does not get confused with a decimal number.

The number 1567548 would be 4 groups of 1, plus 5 groups of 8, plus 7 groups of 64, plus 6 groups of 512, plus 5 groups of 4096, plus 1 group of 32768 (or 56,812).

We should get the same answer if we worked it out in binary. 0 ones, 0 twos, 1 group of 4, 1 group of 8, no 16’s, 1 group of 32, one group of 64, one group of 128, one group of 256, no 512’s, one group of 1024, one group of 2048, one group of 4096, no 8192’s, one group of 16384, and one group of 32768.

Some older games (IGT S-Plus, for example) games were of this era. Much of the operation was displayed in octal numbers.

Hexadecimal

All modern games use a hexadecimal system, as does your desktop computer. This method breaks the binary number down into groups of 4 bits. Each digit is 16 times larger than the one on its right and 16 times smaller than the on its left. Unfortunately, we only have 10 numbers in our language. We start with letters of the alphabet when we run out of numbers. Counting looks like this:

Binary Hexa-Decimal0 01 1 One group of 110 2 One group of 211 3 (2 + 1)100 4 One group of 4101 5 (4 + 1)110 6 (4 + 2)

3

Page 4: Number systems - Slot Techslot-tech.com/interesting_stuff/The Herschel Peeler... · Web viewOur numbers can go from 0 (00000000) to 255 (11111111, that’s 1, plus 2, plus 4, plus

111 7 (4 + 2 + 1)1000 8 One group of 81001 9 (8 + 1)1010 A (8 + 2)1011 B (8 + 2 + 1)1100 C (8 + 4)1101 D (8 + 4 + 1)1110 E (8 + 4 + 2)1111 F (8 + 4 + 2 + 1)1 0000 10 One group of 16

The 16-bit binary number 1101110111101100 would be presented to the human as,

1000 1101 1110 1100 8 D E C or 8DEC16, more popular in the industry is 0x8DEC. The 0x indicates that the following number is Hexadecimal.

Binary Coded Decimal

A mixture of hexadecimal and decimal is a system called Binary Coded Decimal. We use the binary and hexadecimal codes of 0 through 9, and have a friendly (Decimal) system that is easily used by people and hardware alike.

0000 0000 000000 0001 010000 0010 020000 0011 030000 0100 040000 0101 050000 0110 060000 0111 070000 1000 080000 1001 090001 0000 100001 0001 110001 0010 120001 0011 130001 0100 14

Most new hardware is designed to use the option of BCD in its math operations.

For the most part there are quite a few good calculators out there that would be useful to you if you were going into programming, or Bench Tech concerns. Look for calculators that have keys labeled “HEX”, “BIN”, and “OCT”. These calculators will allow you to do math in these number systems and convert a number from one base system to another. Nobody but the hard-core Bench Techs do this stuff in their head. Use a calculator.

4

Page 5: Number systems - Slot Techslot-tech.com/interesting_stuff/The Herschel Peeler... · Web viewOur numbers can go from 0 (00000000) to 255 (11111111, that’s 1, plus 2, plus 4, plus

Those are not the only systems in use in digital logic circuits, just to cover a few other oddities, there is:

Bi-Quinary – Counters with two sections in them. One section is a Divide-by-two (“Bi”) and the other is a Divide-by-five (Quinary). It may be used as a Divide by 10 counter with a Binary Coded Decimal output by wiring it to divide by two then five, or it may also be wired with the divide by five section first then the divide by two. The later design is better when the counter is used as a frequency divider.

Excess-3 – This counting system starts from a count of binary three (0011) then counts up.0011 00100 10101 20110 30111 4

1000 51001 61010 71011 81100 9

Excess-3 avoids the conditions 0000 and 1111 which might be present in a system is power were off in an assembly and might give an error of a number.

Grey Code0000 00001 10011 20010 30110 40111 50101 60100 7

1100 81101 91111 A1110 B1010 C1011 D1001 E1000 F

Grey code has the primary characteristic of having only one bit changing state at a time. This is used for rotary encoders. The Channel Selector switches on our radios uses a Grey code. Usually only the numbers 0 through 9 are used, but all sixteen possibilities are specified.

Excess-3 Grey is a combination of Excess-3 and Grey code. It has both advantages of Grey and Excess-3. We start from a Grey code of 3 to represent zero and proceed to a Grey code for nine.Excess-3 - Grey Code0010 00110 10111 20101 30100 41100 51101 61111 7

1110 81010 91011 A1001 B1000 C0000 D0001 E0011 F

5

Page 6: Number systems - Slot Techslot-tech.com/interesting_stuff/The Herschel Peeler... · Web viewOur numbers can go from 0 (00000000) to 255 (11111111, that’s 1, plus 2, plus 4, plus

ASCIIAmerican Standard Code for Information Interchange. Computers only process ones and zeros. In order to communicate more complex language we need to have a binary code that represents language. For the English Speaking we have a standardized code of binary patterns that represents letters of the English (American – English) language. Included in this system is a set of control codes used to control communications devices. Following is a table in Binary, Hexadecimal and Text characters that make up one version of ASCII. Of course, there are a few versions as time evolved the system. This should be usable for us.Each byte (8-bits) is a character. This gives us 256 possible characters and codes. We have lots of room for flexibility here. Usually only seven of the bits are used in any given system, but all eight may be passed in communication. Each byte, transmitted serially, may also have Start bits, 1 or 2 Stop bits, and Odd or Even Parity.

Regarding Slot Machines and system design

Most devices that connect to the MPU through a Serial Port communicate by passing ASCII messages back and forth. Bill Acceptors, Touch Screen Controllers, Message Displays (VFD) and such are most likely to be ASCII devices.For instance, on the Ithaca 850 Ticket printer the MPU can make the printer beep by sending it an ASCII code "07", Bell code. Likewise it controls the printing process by sending it control codes and printable characters to tell the printer what to print, how to print it, and where to print it.ASCII codes beyond 127 (0x7F) are special characters.153 (0x99) is a Trademark symbol.169 (0xA9) is a Copyright symbol.174 (0xAE) is a Registered (R in a circle).176 (0xB0) is a degree symbol (raised small circle).The Group Separator code, 29 (0x1D) is used to put the printer in Landscape Graphics mode.

Drivers

Each type of printer (or any ASCII device) understands a unique set of codes. The software the MPU is running must be compatible to that printer's codes. This software is called a Driver. This is the software interface between the Operating System and the specific piece of hardware. Every device must have an appropriate driver installed in the MPU to communicate with that device.

6

Page 7: Number systems - Slot Techslot-tech.com/interesting_stuff/The Herschel Peeler... · Web viewOur numbers can go from 0 (00000000) to 255 (11111111, that’s 1, plus 2, plus 4, plus

Binary Hex Dec ASCII use and meaning00000000 00 0 Null code, nothing00000001 01 1 SOH – Start of Heading00000010 02 2 STX – Start of Text00000011 03 3 ETX – End of text00000100 04 4 EOT – End of Transmission00000101 05 5 ENQ – Enquiry (Are you there and ready?)00000110 06 6 ACK – Acknowledge (Affirmative answer, yes)00000111 07 7 BEL – Bell (Left over from teletype days)00001000 08 8 BS – Back Space00001001 09 9 HT – Horizontal Tab (across the page to the next tab stop)00001010 0A 10 LF – Line Feed (Advance the paper one line)00001011 0B 11 VT – Vertical Tab (down the page to the next tab stop)00001100 0C 12 FF – Form feed (To the next page of top of the next form)00001101 0D 13 CR – Carriage return (Back to the left side of the current line)00001110 0E 14 SO – Shift Out00001111 0F 15 SI – Shift In00010000 10 16 DLE – Data Link Escape (Break transmission)00010001 11 17 DC1 – Device Control 100010010 12 18 DC2 – Device Control 200010011 13 19 DC3 – Device Control 300010100 14 20 DC4 – Device Control 400010101 15 21 NAK – Negative Acknowledge (No for an answer)00010110 16 22 SYN – Synchronous Idle00010111 17 23 ETB – End of Transmission Block00011000 18 24 CAN – Cancel (cancel last operation code)00011001 19 25 EM – End of Medium (out of paper or tape)00011010 1A 26 SUB – Substitute00011011 1B 27 ESC – Escape (forced end of transmission)00011100 1C 28 FS – File Separator00011101 1D 29 GS – Group Separator00011110 1E 30 RS – Record Separator00011111 1F 31 US – Unit Separator00100000 20 32 SP – (Space)00100001 21 33 ! (Shift – 1)00100010 22 34 “00100011 23 35 # (Shift – 3)00100100 24 36 $ (Shift – 4)00100101 25 37 % (Shift – 5)00100110 26 38 & (Shift – 7)00100111 27 39 ‘00101000 28 40 (00101001 29 41 )00101010 2A 42 *

7

Page 8: Number systems - Slot Techslot-tech.com/interesting_stuff/The Herschel Peeler... · Web viewOur numbers can go from 0 (00000000) to 255 (11111111, that’s 1, plus 2, plus 4, plus

Binary Hex Dec ASCII use and meaning00101011 2B 43 +00101100 2C 44 ,00101101 2D 45 -00101110 2E 46 .00101111 2F 47 /00110000 30 48 000110001 31 49 100110010 32 50 200110011 33 51 300110100 34 521 400110101 35 53 500110110 36 54 600110111 37 55 700111000 38 56 800111001 39 57 900111010 3A 58 :00111011 3B 59 ;00111100 3C 60 <00111101 3D 61 =00111110 3E 62 >00111111 3F 63 ?01000000 40 64 @01000001 41 65 A01000010 42 66 B01000011 43 67 C01000100 44 68 D01000101 45 69 E01000110 46 70 F01000111 47 71 G01001000 48 72 H01001001 49 73 I01001010 4A 74 J01001011 4B 75 K01001100 4C 76 L01001101 4D 77 M01001110 4E 78 N01001111 4F 79 O01010000 50 80 P01010001 51 81 Q01010010 52 82 R01010011 53 83 S01010100 54 84 T01010101 55 85 U01010110 56 86 V

8

Page 9: Number systems - Slot Techslot-tech.com/interesting_stuff/The Herschel Peeler... · Web viewOur numbers can go from 0 (00000000) to 255 (11111111, that’s 1, plus 2, plus 4, plus

Binary Hex Dec ASCII use and meaning01010111 57 87 W01011000 58 88 X01011001 59 89 Y01011010 5A 90 Z01011011 5B 91 [01011100 5C 92 \01011101 5D 93 ]01011110 5E 94 ^ (Carat)01011111 5F 95 _ (Underscore)01100000 60 9601100001 61 97 a01100010 62 98 b01100011 63 99 c01100100 64 100 d01100101 65 101 e01100110 66 102 f01100111 67 103 g01101000 68 104 h01101001 69 105 i01101010 6A 106 j01101011 6B 107 k01101100 6C 108 l01101101 6D 109 m01101110 6E 110 n01101111 6F 111 o01110000 70 112 p01110001 71 113 q01110010 72 114 r01110011 73 115 s01110100 74 116 t01110101 75 117 u01110110 76 118 v01110111 77 119 w01111000 78 120 x01111001 79 121 y01111010 7A 122 z01111011 7B 123 {01111100 7C 124 | (Pipe symbol)01111101 7D 125 }01111110 7E 126 ~ (Tilde symbol)01111111 7F 127 DEL – Delete01000000 40 6401000001 41 6501000010 42 66

9

Page 10: Number systems - Slot Techslot-tech.com/interesting_stuff/The Herschel Peeler... · Web viewOur numbers can go from 0 (00000000) to 255 (11111111, that’s 1, plus 2, plus 4, plus

Binary Hex Dec ASCII use and meaning01000011 43 6701000100 44 6801000101 45 6901000110 46 7001000111 47 7101001000 48 7201001001 49 7301001010 4A 7401001011 4B 7501001100 4C 7601001101 4D 7701001110 4E 7801001111 4F 7901010000 50 8001010001 51 8101010010 52 8201010011 53 8301010100 54 8401010101 55 8501010110 56 8601010111 57 8701011000 58 8801011001 59 8901011010 5A 9001011011 5B 9101011100 5C 9201011101 5D 9301011110 5E 9401011111 5F 9501100000 60 9601100001 61 9701100010 62 9801100011 63 9901100100 64 10001100101 65 10101100110 66 10201100111 67 10301101000 68 10401101001 69 10501101010 6A 10601101011 6B 10701101100 6C 10801101101 6D 10901101110 6E 110

10

Page 11: Number systems - Slot Techslot-tech.com/interesting_stuff/The Herschel Peeler... · Web viewOur numbers can go from 0 (00000000) to 255 (11111111, that’s 1, plus 2, plus 4, plus

Binary Hex Dec ASCII use and meaning01101111 6F 11101110000 70 11201110001 71 11301110010 72 11401110011 73 11501110100 74 11601110101 75 11701110110 76 11801110111 77 11901111000 78 12001111001 79 12101111010 7A 12201111011 7B 12301111100 7C 12401111101 7D 12501111110 7E 12601111111 7F 12710000000 80 12810000001 81 12910000010 82 13010000011 83 13110000100 84 13210000101 85 13310000110 86 13410000111 87 13510001000 88 13610001001 89 13710001010 8A 13810001011 8B 13910001100 8C 14010001101 8D 14110001110 8E 14210001111 8F 14310010000 90 14410010001 91 14510010010 92 14610010011 93 14710010100 94 14810010101 95 14910010110 96 15010010111 97 15110011000 98 15210011001 99 15310011010 9A 154

11

Page 12: Number systems - Slot Techslot-tech.com/interesting_stuff/The Herschel Peeler... · Web viewOur numbers can go from 0 (00000000) to 255 (11111111, that’s 1, plus 2, plus 4, plus

Binary Hex Dec ASCII use and meaning10011011 9B 15510011100 9C 15610011101 9D 15710011110 9E 15810011111 9F 15910100000 A0 16010100001 A1 16110100010 A2 16210100011 A3 16310100100 A4 16410100101 A5 16510100110 A6 16610100111 A7 16710101000 A8 16810101001 A9 16910101010 AA 17010101011 AB 17110101100 AC 17210101101 AD 17310101110 AE 17410101111 AF 17510110000 B0 17610110001 B1 17710110010 B2 17810110011 B3 17910110100 B4 18010110101 B5 18110110110 B6 18210110111 B7 18310111000 B8 18410111001 B9 18510111010 BA 18610111011 BB 18710111100 BC 18810111101 BD 18910111110 BE 19010111111 BF 19111000000 C0 19211000001 C1 19311000010 C2 19411000011 C3 19511000100 C4 19611000101 C5 19711000110 C6 198

12

Page 13: Number systems - Slot Techslot-tech.com/interesting_stuff/The Herschel Peeler... · Web viewOur numbers can go from 0 (00000000) to 255 (11111111, that’s 1, plus 2, plus 4, plus

Binary Hex Dec ASCII use and meaning11000111 C7 19911001000 C8 20011001001 C9 20111001010 CA 20211001011 CB 20311001100 CC 20411001101 CD 20511001110 CE 20611001111 CF 20711010000 D0 20811010001 D1 20911010010 D2 21011010011 D3 21111010100 D4 21211010101 D5 21311010110 D6 21411010111 D7 21511011000 D8 21611011001 D9 21711011010 DA 21811011011 DB 21911011100 DC 22011011101 DD 22111011110 DE 22211011111 DF 22311100000 E0 22411100001 E1 22511100010 E2 22611000011 E3 22711100100 E4 22811100101 E5 22911100110 E6 23011100111 E7 23111101000 E8 23211101001 E9 23311101010 EA 23411101011 EB 23511101100 EC 23611101101 ED 23711101110 EE 23811101111 EF 23911110000 F0 24011110001 F1 24111110010 F2 242

13

Page 14: Number systems - Slot Techslot-tech.com/interesting_stuff/The Herschel Peeler... · Web viewOur numbers can go from 0 (00000000) to 255 (11111111, that’s 1, plus 2, plus 4, plus

110110011 F3 24311110100 F4 24411110101 F5 24511110110 F6 24611110111 F7 24711111000 F8 24811111001 F9 24911111010 FA 25011111011 FB 25111111100 FC 25211111101 FD 25311111110 FE 25411111111 FF 255

This chart should see you through to your programming classes.

These are by no means the only codes available, but they are the more popular ones we will find in use around us in our casino. If you get Binary, Octal and Hexadecimal down fluently you are ready to be a Slot Tech. If you expand to Excess-3, Gray and ASCII you are on your way to being a Bench Tech.

14