Jump to content
Sign in to follow this  
EvoMikeUK

SaveKey for Beginners

Recommended Posts

Hi All,

 

I need to integrate the SaveKey into my game currently into development, does anyone have any good intro tutorials on SaveKey integration into bB games?

 

Thank you, Michael

Edited by EvoMikeUK

Share this post


Link to post
Share on other sites

Does anyone know why I get this error when including the driver asm? 
 

bbavox-eeprom-file.asm (381): error: Unknown Mnemonic 'I2C_SUBS'

Share this post


Link to post
Share on other sites

Even using this example.... The console doesnt display the saved data (yet doesnt throw the error either of a red background), yet stella does?

 

rem ** the bB score as regular variables...
dim sc1=score
dim sc2=score+1
dim sc3=score+2
 
rem ** randomize the first score byte...
sc1=5
 
rem ** write the first score byte to AtariVox location $3001
rem ** if the write is successful, temp1=0, else temp1=$ff
rem **
rem ** We don't care about the return value, but we need to use
rem ** "temp2=" to keep bB's syntax checker happy.
rem **
temp2=AVoxWriteByte($30,$01,sc1)
 
rem ** check if the write worked. If not, we won't support AtariVox...
rem **
if temp1<>0 then COLUBK=$44:goto main
 
 
rem ** Stick a drawscreen between your AtariVox reads/writes. Otherwise
rem ** you'll use too many cycles...
rem **
drawscreen
 
rem ** read from AtariVox location $3001, and store the result in the sc3 var.
rem ** if the read is successful, temp1=0, else temp1=$ff
rem **
sc3=AVoxReadByte($30,$01)
 
COLUBK=$0
drawscreen
 
rem ** loop forever...
main
scorecolor=$0f
drawscreen
goto main
 
rem ** include the AtariVox wrapper and driver code...
asm
include "bbavox-eeprom-static.asm"
end

Share this post


Link to post
Share on other sites

This example might be a little confusing because it does not attempt to load data saved between sessions, but saves from one score byte, and reads to another in the same session. Of you see the same number repeated in the score, then it worked. After running it once, if you want to see if the previously-saved byte was successfully retrieved, you can modify the code to take out the randomization and the first write to see the same number when you run it every session after that, e.g.:

 

 rem ** the bB score as regular variables...
 dim sc1=score
 dim sc2=score+1
 dim sc3=score+2
 
 rem ** randomize the first score byte...
 sc1=5
 
 rem ** write the first score byte to AtariVox location $3001
 rem ** if the write is successful, temp1=0, else temp1=$ff
 rem **
 rem ** We don't care about the return value, but we need to use
 rem ** "temp2=" to keep bB's syntax checker happy.
 rem **
 ; temp2=AVoxWriteByte($30,$01,sc1)
 
 rem ** check if the write worked. If not, we won't support AtariVox...
 rem **
 if temp1<>0 then COLUBK=$44:goto main
 
 
 rem ** Stick a drawscreen between your AtariVox reads/writes. Otherwise
 rem ** you'll use too many cycles...
 rem **
 drawscreen
 
 rem ** read from AtariVox location $3001, and store the result in the sc3 var.
 rem ** if the read is successful, temp1=0, else temp1=$ff
 rem **
 sc3=AVoxReadByte($30,$01)
 
 COLUBK=$0
 drawscreen
 
 rem ** loop forever...
main
 scorecolor=$0f
 drawscreen
 goto main
 
 rem ** include the AtariVox wrapper and driver code...
 asm
 include "bbavox-eeprom-static.asm"
end

 

Share this post


Link to post
Share on other sites

Working perfect now! Thank you!

Ok, it was dry joints on the controller port! Sorry to bother you all, feel a bit embarrassed now lol

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...