Jump to content
Songbird

EEPROM library

Recommended Posts

Sorry to revive an old thread, but I need some advice on the EEPROM code in CC65.

First-of-all, while there are codes for 93C46, 93C66, 93C86, the only available function seems to be a modified version of the 93C46 code.

When trying to call lynx_eeprom_write(0, 1), the program just hangs in Handy (the SAGE fixed version). Am I supposed to initialize something before calling this function?

Share this post


Link to post
Share on other sites

Is the flag in the LNX header set up ?

Also, you may need an EEProm file created before to run the ROM, IIRC.

Share this post


Link to post
Share on other sites
1 hour ago, Fadest said:

Is the flag in the LNX header set up ?

Is that a compilation flag for building the CC65 Lynx Lib? (the eeprom functions seems to get included by default in the makefile)
You must mean something else, but I can't figure out what.

1 hour ago, Fadest said:

Also, you may need an EEProm file created before to run the ROM, IIRC.

I cannot understand what this means. Do you mean some kind of .incbin in CC65, or something relating to Handy?

Share this post


Link to post
Share on other sites

The eeprom functions are in the lynx.lib. If you just use them in your code they get automatically included in the build.

 

But you can of course override this behaviour by making a local asm file and linking it in before the lynx.lib is found on the command line. In this way you can replace any driver by your modified copy.

 

The idea has been to tell the emulator what kind of eeproms are used in a game by setting bits in the lnx header.

But the header is not part of the rom. In some games people try to support the old SD cart and the code may hand in waiting for response.

Share this post


Link to post
Share on other sites
1 hour ago, 8bit-Dude said:

Sorry to revive an old thread, but I need some advice on the EEPROM code in CC65.

First-of-all, while there are codes for 93C46, 93C66, 93C86, the only available function seems to be a modified version of the 93C46 code.

When trying to call lynx_eeprom_write(0, 1), the program just hangs in Handy (the SAGE fixed version). Am I supposed to initialize something before calling this function?

Actually almost everyone is using the 93C46 as an eeprom if the game supports it. This was the first eeprom implemented. There may be some experimental carts using some other eeprom chip. But no games use anything except 93C46 afaik.

 

I plan to make a run with the 24AA512 chip in a week or so. Perhaps it will be used by some game in the future.

Share this post


Link to post
Share on other sites
1 hour ago, 8bit-Dude said:

Is that a compilation flag for building the CC65 Lynx Lib? (the eeprom functions seems to get included by default in the makefile)
You must mean something else, but I can't figure out what.

I don't know how to setup things in cc65 as I'm still using "old" BLL kit, but if you look at this page, you see that there is a flag in LNX header to tell emulators that EEProm should be used.

https://atarigamer.com/lynx/lnxhdrgen

 

Edited by Fadest

Share this post


Link to post
Share on other sites

yeah, depending on the emulator used.

 

but the emulator does not crash, an neither does the eeprom code, it will just return FF (or 00)

Share this post


Link to post
Share on other sites

are you using (new)cc65 (from BLL times) or the "new one" (cc65).

 

Share this post


Link to post
Share on other sites

I use the official CC65 maintained by Oliver Schmidt and crew (head revision).

Thanks for the LNX header link, I will study that info and see how to get the flag set in my version of CC65.

  • Like 1

Share this post


Link to post
Share on other sites
17 minutes ago, sage said:

yeah, depending on the emulator used.

 

but the emulator does not crash, an neither does the eeprom code, it will just return FF (or 00)

For Handy modified version in order to emulate EEProm, IIRC, you must create a .sav file before, no ?

Edited by Fadest

Share this post


Link to post
Share on other sites
4 hours ago, Fadest said:

For Handy modified version in order to emulate EEProm, IIRC, you must create a .sav file before, no ?

no

Share this post


Link to post
Share on other sites

Thanks for the advice, I got the EEPROM Read/Write code working in Handy after setting the Header byte to 1!

  • Like 1

Share this post


Link to post
Share on other sites
On 1/16/2021 at 6:30 AM, 8bit-Dude said:

Thanks for the advice, I got the EEPROM Read/Write code working in Handy after setting the Header byte to 1!

BTW, it is a pity that you use a lot of other peoples stuff but do not credit them.

Share this post


Link to post
Share on other sites
On 1/27/2021 at 7:59 PM, 42bs said:

BTW, it is a pity that you use a lot of other peoples stuff but do not credit them.

I have been adding credits in source files over past year or so, including to Karri. Please let me know the offending files you spotted, I will add credit accordingly.

Edited by 8bit-Dude
  • Thanks 1

Share this post


Link to post
Share on other sites
1 minute ago, 8bit-Dude said:

I started adding credits in source files, including to Karri. Please let me know the offending files you spotted, I will add credit accordingly.

I'd say the most of the files in "utils" aren't your work so you should add a huge credits file.

Share this post


Link to post
Share on other sites
1 hour ago, 42bs said:

I'd say the most of the files in "utils" aren't your work so you should add a huge credits file.

All the Python files in the Scripts/ folder are my work. I guess you are talking about the rest: CC65, emulators, trackers and various .exe files not yet converted to Python scripts... I will improve the credits in the installer, but it is hard to track down everyone's name. So sometimes generic credits like "cc65 team" are used.

Share this post


Link to post
Share on other sites

Does anyone have a Lynx program to read and display the EEPROM contents, like a memdump tool? Even better would be a utility to dump the EEPROM so I can examine with a hex editor.

Share this post


Link to post
Share on other sites
4 hours ago, Songbird said:

Does anyone have a Lynx program to read and display the EEPROM contents, like a memdump tool? Even better would be a utility to dump the EEPROM so I can examine with a hex editor.

See new_bll: demos/i2c_test.o

It dumps the contents to screen, now _just_ add sending it and your are done.

Share this post


Link to post
Share on other sites
7 hours ago, Songbird said:

Does anyone have a Lynx program to read and display the EEPROM contents, like a memdump tool? Even better would be a utility to dump the EEPROM so I can examine with a hex editor.

Do you have Bernd's Flashcard ?

It has options to manage EEProm (erase, write, read and send to terminal...). Very useful while testing and debugging.

Share this post


Link to post
Share on other sites
9 hours ago, Songbird said:

Does anyone have a Lynx program to read and display the EEPROM contents, like a memdump tool? Even better would be a utility to dump the EEPROM so I can examine with a hex editor.

yes

  • Haha 1

Share this post


Link to post
Share on other sites

Does anyone have Can anyone provide such a program to me? :D

 

The issue is I have a game I flashed during manufacturing which appears to have a corrupted save. I also know from other carts I have built for this game that the problem will go away (and no longer reproduce) if I simply erase the EEPROM using the in-game function. Thus I want to display or dump the contents of the EEPROM on this cart to compare against a known good version.

 

@42bs Thanks for the tip; I see that program works in Handy. Will it boot from ROM? If not, then I admit I am forgetful here: what tool will convert a *.o to a *.lyx or *.lnx? I'm sure I could write a simple bootloader if needed...

 

 

Share this post


Link to post
Share on other sites
Posted (edited)

Can't you download .o files via ComLynx?

 

Edit: I checked, and most of the files in new_bll/demo cannot "just" put into a card version as they start somewhere due to the BEGIN_MEM/END_MEM to store variables.

Edited by 42bs

Share this post


Link to post
Share on other sites

Excellent, just what I needed and now I have dumped good and bad versions of the EEPROM for comparison purposes. Thanks, @42bs! Still supporting the Lynx since, what, 1993? That precedes me by a couple years. ;)

 

 

Share this post


Link to post
Share on other sites
19 minutes ago, Songbird said:

Still supporting the Lynx since, what, 1993

Yes, and still have fun with it!

  • Like 1

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.
Note: Your post will require moderator approval before it will be visible.

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...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...