ESP32/ESP8266 port?
Hello Gary. Thks a lot for porting this to the Arduino IDE. I try to compile the source for the ESP32 and i cant. I think that the problem is that you put in the emulator assembly code for the atMega328 architecture...
Im trying to port the emulator for this architecture the esp32 and/or esp8266 and my head crashes a lot in the journey. Can you give me a hint of what i need to do for porting this code or the mcuGotchi to this plataforms?
Maybe a pure c++ or c emulator like the mcugotchi?
Hi,
I didn't use any assembly in this project, it is a pure C implementation. There is one Arduino directive I used, "PROGMEM", it will force the compiler to put static variable into FLASH instead of RAM.
Also, to reduce the program size, I used U8g2 library to handle graphics. Due to the complex paging mechanism in U8g2, the graphical routine is very hard to understand.
I suggest you can start your porting with TamaTool, the original emulator created by TamaLib creator.
Ok I have it working now in the ESP32... And using a Nokia display... I made a few changes in the code to make it work. Are you interested in the code?
I have problems with the resolution but now i can see the egg trying to hatch :)
Also I noted that you hardcoded the Buttons and the Speaker pins.... So i made a change in the code so you can select the pinmap using #define in the main file

Please noted that I disabled all the CPU clock speed emulation code to improve the speed and program size. If you are using ESP32, you have to add back the clock speed emulation parts.
static void hal_sleep_until(timestamp_t ts) { ... }
static timestamp_t hal_get_timestamp(void) { ... }
Tks Gary.
Now I'm reading the code for the graphics. Now i have to solder some buttons to see the icons. But now i resized the pixel size and centered in the screen. I have modiefied the code so no blank spaces between the pixels. Tks a lot!
BTW... this screen (nokia 1100) consumes less than 1mA without the Back-Light, so the battery will least longer!

Is there a way to update the screen dynamically? I noted that the emulator update the screen every defined time... If we can update the screen only when the image is changed we can get some time for other things like the emulation itself.
It can't. But I can direct you the location to tune the graphics refresh rate and CPU speed: tamalib.c
- tamalib_mainloop_step_by_step()
cpu.c
- Search the variable "CPU_SPEED_RATIO"
ArduinoGotchi.ino
- hal_sleep_until()
- hal_get_timestamp()
Hey Gary, can I get your email? I am trying to replicate your tamagotchi project as a gift for my girlfriend, yet I cant find an available ROM anywhere. Care to provide me with some info? [email protected]