Version of Robotron arcade game using LPC1768, a Gameduino shield, a serial EEPROM (for high scores), two microswitch joysticks and two buttons plus a box to put it in. 20 levels of mayhem.
Dependencies: 25LCxxx_SPI CommonTypes Gameduino mbed
BCDNumber.h@4:673eb9735d44, 2013-06-08 (annotated)
- Committer:
- RichardE
- Date:
- Sat Jun 08 11:24:05 2013 +0000
- Revision:
- 4:673eb9735d44
Pulled in more code. Now panel controls are working. Level 0 (attract mode) now goes round an endless loop sending state of panel controls up serial port to PC.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RichardE | 4:673eb9735d44 | 1 | /* |
RichardE | 4:673eb9735d44 | 2 | * SOURCE FILE : BCDNumber.h |
RichardE | 4:673eb9735d44 | 3 | * |
RichardE | 4:673eb9735d44 | 4 | * A 4 byte unsigned BCD integer. |
RichardE | 4:673eb9735d44 | 5 | * |
RichardE | 4:673eb9735d44 | 6 | */ |
RichardE | 4:673eb9735d44 | 7 | |
RichardE | 4:673eb9735d44 | 8 | #ifndef BCDNumberIncluded |
RichardE | 4:673eb9735d44 | 9 | |
RichardE | 4:673eb9735d44 | 10 | #define BCDNumberIncluded |
RichardE | 4:673eb9735d44 | 11 | |
RichardE | 4:673eb9735d44 | 12 | #include "Types.h" |
RichardE | 4:673eb9735d44 | 13 | |
RichardE | 4:673eb9735d44 | 14 | class BCDNumber { |
RichardE | 4:673eb9735d44 | 15 | |
RichardE | 4:673eb9735d44 | 16 | public : |
RichardE | 4:673eb9735d44 | 17 | |
RichardE | 4:673eb9735d44 | 18 | enum { |
RichardE | 4:673eb9735d44 | 19 | ByteCount = 4, // Number of bytes used to store number. |
RichardE | 4:673eb9735d44 | 20 | }; |
RichardE | 4:673eb9735d44 | 21 | |
RichardE | 4:673eb9735d44 | 22 | /***********************/ |
RichardE | 4:673eb9735d44 | 23 | /* ADD TWO BCD NUMBERS */ |
RichardE | 4:673eb9735d44 | 24 | /***********************/ |
RichardE | 4:673eb9735d44 | 25 | // Pass first number in A. |
RichardE | 4:673eb9735d44 | 26 | // Pass second number in B. |
RichardE | 4:673eb9735d44 | 27 | // Pass pointer to result in result. |
RichardE | 4:673eb9735d44 | 28 | // Pass carry flag in carry. |
RichardE | 4:673eb9735d44 | 29 | // Remember numbers are BCD coded so 0x99999999 means 9 million, |
RichardE | 4:673eb9735d44 | 30 | // 9 hundred and 99 thousand, 9 hundred and 99. |
RichardE | 4:673eb9735d44 | 31 | // Returns carry flag. If this is set then overflow occurred. |
RichardE | 4:673eb9735d44 | 32 | static bool Add( UInt32 numA, UInt32 numB, UInt32 *result, bool carry = false ); |
RichardE | 4:673eb9735d44 | 33 | |
RichardE | 4:673eb9735d44 | 34 | }; |
RichardE | 4:673eb9735d44 | 35 | |
RichardE | 4:673eb9735d44 | 36 | #endif |
RichardE | 4:673eb9735d44 | 37 | |
RichardE | 4:673eb9735d44 | 38 | /* END of BCDNumber.h */ |
RichardE | 4:673eb9735d44 | 39 |