This readme describes the modifications made to the original DEFCON 16 Badge Firmware. These modifications were made by Patrick Cruce and Michael McGraw-Herdeg. Since rule 110 is Turing complete, and we've added I/O functions, these modifications constitute an operating system for the DEFCON 16 Badge. Contact me at pcruce (at) gmail (dot) com if you have any questions/comments or you can check out my web site at http://ssl.berkeley.edu/~pcruce/ If you are missing and of the conference materials, feel free to contact me and I can send them to you. The following subroutines were added by Michael and I to main.c: fromHex toHex DC16_write_alife DC16_Life_Init DC16_Life_Rules DC16_Life_Mode We also made some minor modifications in the main function, to the global variables, and to DC16.h The firmware modifications were made so that the badge can process Wolfram style Cellular Automata. The simulations can be up to a size of 1536 Bytes(1.5 KB) They are read off the SD card on power-up and can be saved by entering Badge mode 4. Badge Modes && LED codes are as follows: #0 If no SD/file : 0xAA indicates no read If SD and file: 0x88 indicate beginning to read Lower 8 bits of length read will be displayed after read #1 Receive (Night rider Original) #2 Transmit (Two dots moving back and forth or read count Original) #3 Cellular Automata Simulation: Displays middle byte of simulation #4 Save Simulation, 0x0F = Before Save, 0xF0 = after save Change badge modes by pressing button. Configurations are stored in a file called CONFIG.TXT, all configuration information is written on a single line using hexidecimal ascii codes. (Do not indlude '0x') The first two characters indicate the rule that should be used. The next 2N characters indicate up to N bytes of automaton state. If less than 1536 Bytes of state are specified, the length of the simulation will be limited to that length. If you only specify 8 bytes(16 characters) of state, the simulation will not ever use more that 8 bytes of state. Files should be a maximum of 3074 Characters. Here is an example config.txt: 20AAAAAAAA This will run rule 32 on a 4 Byte state. It will display an alternating patterns of 0s and 1s which will switch from 1 to 0 and vice versa on each iteration. Step 1: ....10101010.... Step 2: ....01010101.... If no config.txt is available, the initial state is set to rule 30(0x1E), uses the entire set of available memory, and has a single bit set to 1 at the middle of the cellular automaton state. If the config.txt is read, but not saved, it will be removed from the SD card. This behavior is currently considered to be "bug/feature" territory. I'm not sure how to stop this, whether this is the correct behavior of the SD Fat driver, and it may simplify saves, so I'm not stressin it. Information about cellular automata can be found online. Try googling "rule 30" or "rule 110". You can also read "A New Kind of Science" by Stephen Wolfram which is also available online. That said, a basic explanation of how rules transform the state is described here. Each rule is 8 bits, each of these bits indicate whether a 1 or a 0 is placed in the subsequent state if a bit pattern is matched in the current state. A table summarizing the bit patterns follows, with examples of the rule which generates 1's only for that bit pattern.(and none of the others) Bit Pat Dec. Hex 000 1 01 001 2 02 010 4 04 011 8 08 100 16 10 101 32 20 110 64 40 111 128 80 Here are a few examples of transformations: Rule 6 = 0x02 | 0x04 Transforms 0010 to 0110 Rule 32(0x20) transforms 01010101 into 10101010 Rule 30 = (0x02 | 0x04 | 0x08 | 0x10) = 00011110 So these transformation rules apply 000 -> 0 001 -> 1 010 -> 1 011 -> 1 100 -> 1 101 -> 0 110 -> 0 111 -> 0 Applying this rule to the following state: 000101100111 leads to: 101101011100 The modifications we've made should not interfere with the original badge functions and config.txt files could even be transimitted using IR, but little to no testing has been done on this. If a config.txt were received, a full power cycle would need to be done so that the file will be loaded into memory. (Files are loaded only during startup). Real time interaction via IR would be an interesting extension of the current code-base. Another neat option would be to allow the speed of the simulation to be controlled with the thermometer on the chip or with the IR receiver. Our experiments into performing these modifications have not been successful. But perhaps ya'll will have better luck. Documentation on the THERMOMETER can be found in the data sheets that came on the DEFCON 16 CD and also in the example code. There is one example in particular that uses ADC.c and ADC.h . Modification of this code would probably allow the use of the thermometer. Finally, here are a few tips on getting the PC software working with the Badge. #1 Install Codewarrior and the Bootloader. Codewarrior expires on the 20th of august 2008, but I've played around with it a bit and think you can probably trick the software by setting the clock on your computer back before you install. The license file is an 8KB file that should be included with the conference materials. Replace the license.dat in the install directory, with the new one to activate the license. You need the licensed version of codewarrior if you want to recompile or make modifications because this program is bigger than the limits on the free software. If you just want to load our cellular automaton software(and not recompile/modify), then just worry about the bootloader. #2 Drivers. There are two drivers. The driver for talking to a hyperterminal during normal operation(for debugging can be found in the DC16 Badge Development Environment directory. It is called: DC16Badge.inf & SofTecBDC08.dll The second driver, the important one for flashing the badge memory, can be found in the directory that the bootloader is installed in. For example: C:\Program Files\Freescale\Freescale JM60 GUI\JM60 USB Driver\Windows XP SP2 #3 Bootloader mode. Getting the badge into bootloader mode requires removing the battery and then holding down the button when you replace the battery. If it enters the bootloader mode the LED will display: 0x81 Then you should plug in a mini-usb cable and activate the bootloader software. Select the *.s19 file you want to load onto the Badge. For example dc16.abs.s19, use only erase, program, and verify to flash the software. The Blank Check and Checksum functions seem to have problems. After you load the software, unplug the badge and cycle the power again. We're done. Good Luck!