I made a program that reads the memory of a specific program (VBA-m). But, the method I use is a bit ridiculous.

I have to brute force-find the start location of the WRAM and IRAM by first finding where the BIOS starts. I do this by searching from the start of the memory and searching for a specific value.

This works fine but it fails if I load another game as the addresses shift (apparently). I am wondering if there would be a way to automatically find these memory locations by hooking (?) directly into the program at it's entry point (?).

If anything needs to be explained further, let me know.