Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2017-02-28 15:48:02

MS-DOS1999
New member
Registered: 2017-02-28
Posts: 5

New on this forum and nvram help !

Hi all, I'm Julien, 17 years old programmer !

I have been watching gbdev forum for some time.

I make an RPG with gbdk, no problem for gameplay programming ^^

but i have no solution for saving into non-volatile RAM.

I've follow two "tutorial" (not really tutorial, more like script) : this http://www.devrs.com/gb/files/sram.txt and this http://www.devrs.com/gb/files/saveram.txt

For the first tutorial with "extern" the value is not saved and .sav is not created.

And for the second with "RAMPtr" the hex value is always 0xFFFF and .sav is not created.

Someone can help me ? Or have another script for example ?

Thank you in advance smile

Sorry if my english is bad.

Offline

 

#2 2017-02-28 19:03:45

AntonioND
Member
Registered: 2014-06-17
Posts: 134
Website

Re: New on this forum and nvram help !

You need to set the header information correctly. The ram size byte should be non-0, and the mbc type should be one of the types that have a battery. http://bgb.bircd.org/pandocs.htm#thecartridgeheader There are some flags for gbdk to generate a rom with that characteristics, I don't remember them. If you can't find them, you could use rgbfix in your ROM to fill in the correct values. https://github.com/rednex/rgbds

Offline

 

#3 2017-02-28 19:05:05

AntonioND
Member
Registered: 2014-06-17
Posts: 134
Website

Re: New on this forum and nvram help !

Actually, the second link says what to do:

Code:

Here are the important linker commands:


  -Wl-yo#  Number of rom banks (default: 2)

  -Wl-ya#  Number of ram banks (default: 0)

  -Wl-yt#  MBC type (default: no MBC)


Here are the MBC types (stolen from RGBDS sources) - I dunno if all are

supported by GBDK, but the one I use, #2, is:

   ;--------

   ;0 - ROM ONLY

   ;1 - ROM+MBC1

   ;2 - ROM+MBC1+RAM

   ;3 - ROM+MBC1+RAM+BATTERY

   ;5 - ROM+MBC2

   ;6 - ROM+MBC2+BATTERY

Last edited by AntonioND (2017-02-28 19:07:08)

Offline

 

#4 2017-03-01 04:56:15

MS-DOS1999
New member
Registered: 2017-02-28
Posts: 5

Re: New on this forum and nvram help !

Thanks, yeah i know it, i think i compile my game with good parameter but not working, look at this screen :

https://image.noelshack.com/fichiers/2017/09/1488361573-capture-du-2017-03-01-10-40-50.png

And i've try the tutorial in links with the good parameter sad

For the tutorial with pointer i use : lcc -Wl-yt2 -Wl-yo4 -Wl-ya4 -o mygame.gb mygame.c

And for the tutorial with extern variable i compile my "savevars" file with it : lcc -Wa-l -Wf-ba0 -c -o savevars.o savevars.c then i compile the main file of my game with it : lcc -c -o mygame.o mygame.c

And i make the gb file with it lcc -Wl-m -Wl-yt2 -Wl-yo4 -Wl-ya4 -o mygame.gb mygame.o savevars.o

But... nothing work sad the game not create the save file.

Last edited by MS-DOS1999 (2017-03-01 04:56:58)

Offline

 

#5 2017-03-01 05:24:38

MS-DOS1999
New member
Registered: 2017-02-28
Posts: 5

Re: New on this forum and nvram help !

Yeah problem solved ! The problem was the game have no battery (i thought the game just needed RAM because in the tutorial it's that)! I have changed "-Wl-yt2" to "-Wl-yt3" for add the battery and it work ! So there is an error in the tutorial...

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson