P
PyBoy•6mo ago
pkr895

Extracting score from memory

Hi, I'm trying to make an RL agent for gameboy tennis. I need a way to get the score after each point. One method is by processing the pixel data but I thought it would be more efficient/reliable to read it directly from memory. I'm not really sure where to start. I've installed visualboyadvance-m which has a memory viewer but a lot of values change so no idea how to narrow it down. Any help would be appreciated.
17 Replies
capnspacehook
capnspacehook•6mo ago
Pyboy has a tetris game wrapper that may do this already as well
BET Adsorption
BET Adsorption•6mo ago
Finding a disassembly of the ROM would be likely helpful as well. Pokemon Red has really-well-documented disassemblies, which proved vital for success.
pkr895
pkr895OP•6mo ago
unfortunately tennis doesn't seem to be popular enough for someone to have posted a RAM map or made a wrapper
capnspacehook
capnspacehook•6mo ago
Oh my bad misread that as tetris
pkr895
pkr895OP•6mo ago
is this a lot of effort? I've been screen recording the memory as I play and I've identified some values that correlate with movement/winning games obv that's prone to errors but this project is about RL algorithms so i'd rather not waste time on this stuff
BET Adsorption
BET Adsorption•6mo ago
finding the disassembly is minimal effort. disassembling yourself? that's maximal effort i'm porting the atari 2600 game enduro to c. i found one disassembly, but it's only just the assembly itself. and it has been minimally edited. needless to say, 3000 lines of
lda timeCycle ;
and #$3f ;
cmp #$08 ;
bcs Lf419 ;
lda carsRemainingLo ;
ora carsRemainingHi ; cars remaining?
beq Lf419 ; no, skip
lda timeCycle ;
and #$3f ;
cmp #$08 ;
bcs Lf419 ;
lda carsRemainingLo ;
ora carsRemainingHi ; cars remaining?
beq Lf419 ; no, skip
is difficult at best to utilize amazing what fits into 3kb tho
pkr895
pkr895OP•6mo ago
Can you give me a brief overview of the steps needed https://github.com/mattcurrie/mgbdis?origin=serp_auto Disassemble with something like this Then look through the assembly for variables related to score?
GitHub
GitHub - mattcurrie/mgbdis: Game Boy ROM disassembler with RGBDS co...
Game Boy ROM disassembler with RGBDS compatible output - mattcurrie/mgbdis
BET Adsorption
BET Adsorption•6mo ago
no clue. 😭 maybe someone else here has better knowledge @Sky
Bækalfen
Bækalfen•6mo ago
It's a good start if you've already identified some memory areas. That's not the same as an actual disassembly.
Bækalfen
Bækalfen•6mo ago
If there's always something on the screen that tells you the score, you can also go that way
pkr895
pkr895OP•6mo ago
Not yet but looks helpful The score appears and disappears after each point And I doubt the scores are stored as 15/30/40 in memory
Sky
Sky•6mo ago
Unfortunately I never digged into using disassembling tools on gb, at most I relied on good old memory scanning. My x86 asm reversing period on games, ended like 13 years ago 😅
pkr895
pkr895OP•6mo ago
Forgot to say but I managed to find the memory address manually after not too long. It's 0xC0DD for player score and 0xC0DE for cpu. Also found out you can pause the game at any time to check score so I could have read it like in the Tetris example. Thanks all of you for your help.
BET Adsorption
BET Adsorption•6mo ago
you could say you found the C0DE wonder if that was on purpose??

Did you find this page helpful?