writeEEPROM(which address, what value)

From pinHeck Wiki
Revision as of 15:43, 12 September 2015 by Benheck (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Writes a 4 byte long value to the specified EEPROM address.


The Propeller has a removable EEPROM chip. It is 64K. The first 32K is the A/V program itself, which is copied to the Propeller upon boot.

The second 32K is available to the user. It stores high scores, game settings, etc. It is arranged as 8192 longs (four byte values). This allows a score to be stored in a single location.

A long allows you to store a number between 0-4,294,967,295 (0x00000000 - 0xFFFFFFFF)

The PIC32 can use the EEPROM commands to read/write from the Propeller's EEPROM. The PIC32 has an internal simulated EEPROM but its read-write cycles were too low to be of practical use.


Example:

writeEEPROM(0, 2000);

Stores value of 2000 to location 0.

writeEEPROM(8191, (255 << 24) | 128);

Stores two bytes in a single long location. The 255 is the leftmost byte, 128 is rightmost bytes. This is a good way to store values you know will be under 255.


Memory Map

This is the default Memory Map as used by America's Most Haunted. For best results, use these settings and store any additional information in the unused spaces between.

Total EEPROM Range: 0-8191 longs

0 : Version Number and EEPROM programmed flag

1 : Freeplay, Coins Per Credit, balls per game, allow extra balls

2 : Tilt Limit, Spot Pop Bumper Progress, Ball Save Timer Seconds

3 : Allow Match, Video Mode Speed, SFX Default Volume, Music Default Volume

4 : Total games played

5 : Replay Score Value

6 - 9 : Currently unused

10 : Flipper power

11 : Slings power

12 : Pops power

13 : Left VUK power

14 : Right Scoop power

15 : Autolauncher power

16 : Ball Loader power

17 : Drain kicker power

18 - 31 : Currently unused

32 : Coin Door Open/Close warning

33 - 8178 : Currently unused


128 : Game name, first 4 characters

129 : Game name, next 4 characters

130 : Game name, next 4 characters

131 : Game name, last 4 characters


8179 : Top Score

8180 : Top Score initials

8181 : 2nd place

8182 : 2nd place initials

8183 : 3rd place

8184 : 3rd place initials

8185 : 4th place

8186 : 4th place initials

8187 : 5th place

8188 : 5th place initials

8189 : Checksum that indicates presence of high scores (42)

8190 : Checksum that indicates presence of high scores (42)