Port of the FreeChaF retroarch emulator (FairChild Channel F) to the TTGO VGA32 v1.0, v1.1, v1.2 and v1.4 board with ESP32.
- Ported from retroarch to ESP32
- No PSRAM used, running on ESP32 520 KB RAM (TTGO VGA32 v1.x)
- Use of a single core
- Low resource OSD
- Created project compatible with Arduino IDE and Platform IO
- Web Editor and ArduinoDroid (6.3.1) compatible project with tool makeandroid.bat
- Any digital pin can be used for audio (SPEAKER_PIN in hardware.h).
- Any digital pin can be used for video (hardware.h).
- X and Y screen adjustment
- Emulation video speed menu, keyboard
- Support for 64-color mode and 8-color mode.
- VGA 200x150
- VGA 320x200
- The complete bitluni library is not required. I have reduced to the minimum, saving RAM and FLASH, based on Ricardo Massaro's library.
- Support for reading cartridges via WIFI
- Precompiled version (flash download 3.9.2) 200x150
https://github.com/rpsubc8/ESP32TinyFairChild/tree/main/ESP32/precompile
We must choose the ESP32 type: Subsequently, select the files as shown in the attached screenshot, with the same offset values: And we will press start. If everything has been correct, we will only have to restart the ESP32.
- TTGO VGA32 v1.x (1.0, 1.1, 1.2, 1.4) o Single core ESP32
- Visual Studio 1.48.1 PLATFORMIO 2.2.0
- Arduino IDE 1.8.11
- ArduinoDroid (6.3.1)
At the end, the script itself ends up deleting the dataFlash directory.
The script uses fart.exe (find and replace text).
Once, it has been successfully executed, it can be used with the ArduinoDroid.
- System Control: 0,1,2,3
- Control A: Left, Right, Up, Down, o,p
- Control B: a,d,w,s c,v
- use_lib_200x150: Video mode 200x150 is used. You have to choose only one video mode, either 200x150 or 320x200.
- use_lib_320x200: 320x200 video mode is used.
- use_lib_vga8colors: Forces to use RGB 8-color mode (3 pins). Outputs 8 colors, as opposed to 64 in normal mode (6 pins RRGGBB)
- FIX_PERIBOARD_NOT_INITING: In those keyboards that need ECO to initialize. Solution by David Crespo Tascón.
- use_lib_log_serial: It allows to leave traces through the usb serial port. If enabled, it consumes a little more RAM, CPU and FLASH..
- gb_ms_keyboard: The number of polling milliseconds for the keyboard must be specified.
- gb_ms_vga: The number of polling milliseconds for the VGA frame must be specified.
- gb_add_offset_x: Shift to the right of the frame in multiples of 4 pixels.
- gb_add_offset_y: Downward displacement of the frame in pixels.
- use_lib_delay_tick_cpu_auto: If 1, the emulation speed is auto-set to 14914 ticks of 20 millis. If 0, it waits for the millis specified in use_lib_delay_tick_cpu_micros.
- use_lib_delay_tick_cpu_micros: The number of milliseconds to wait for the CPU while use_lib_delay_tick_cpu_auto is 0 must be specified.
- use_lib_wifi: Enable WIFI to be able to load cartridges from a web server. As it requires a lot of RAM, it is advisable to use an http server, instead of https. The network name and password must be entered in the gbWifiConfig.h file.
Tool chf2h
input/ cart/ ColorOrgan.chf output/ dataFlash/ cart/Subsequently we must copy the dataFlash directory into the TinyFairChildttgovga32\fairChild project overwriting the previous dataFlash folder. It is recommended that you clean up the project and recompile.
This tool is very simple, and does not check for errors, so it is recommended to leave the files with very simple names and as simple as possible. The project in PLATFORM.IO is prepared for 1MB of Flash. If we need the 4MB of flash, we will have to modify the entry in the platformio.ini file.
board_build.partitions = huge_app.csvIn the Arduino IDE, we must choose the option Partition Scheme (Huge APP).
By default, it is left pointing to the project's github pages server. RAM consumption with https is higher than with http:
https://rpsubc8.github.io/ESP32TinyFairChild/www/fairchild/output
To activate this mode, you must uncomment the line use_lib_wifi in gbConfig.h
We must configure in the file gbWIFIConfig.h the data:
#define gb_wifi_ssd "nombreDeNuestraRedWIFIdelRooter" #define gb_wifi_pass "passwordDeNuestraRedWIFIdelRooter" //#define gb_wifi_url_base_path "http://192.168.0.36/fairchild/output" #define gb_wifi_url_base_path "https://rpsubc8.github.io/ESP32TinyFairChild/www/fairchild/output" //millisecons delay stream read #define gb_wifi_delay_available 0 #define use_lib_wifi_debug
For the time being, the configuration is set in our gbWIFIConfig.h which we will have to recompile, so that it will only connect to our rooter network. Therefore we must change gb_wifi_ssd and gb_wifi_pass.
The gb_wifi_url_base_path is the path where our outlist and outdat directories are located, which contain the list of files, as well as the files themselves, so this path will be different if we use a local server.
The concept is simple, you have:
outlist --> File with the list of names (length 8) of chf. Limit of 128 files outdat --> The chf files.
For now, to optimize RAM consumption, we have left an 8:3 name length structure, i.e. 8 name characters and 3 extension characters. I leave some intermediate tools to prepare and make the conversion:
build.bat --> Launches all bats, processing input to output data83.bat --> Converts all input files to 8:3 format list.bat --> Generates the outlist (list of files). dsk.exe --> Generates a txt file containing a list of files with name length 8. lowercart.bat --> Convert CHF to .chf extensions
An example of outlist, for example from cart.txt, containing:
AlienInvBaseballBoogie2 Bowling CheckersColorOrgF8NationFninja Football
Whenever a file is added, we must regenerate the list with the list.bat or by calling the whole process build.bat.
Inside is the list of files with a maximum length of 8 characters, which is what will be displayed in the cartridge selection menu in the ESP32. These files, for now, are intended for a maximum of 128 entries, which is equivalent to 1024 bytes (128 x 8).
Each time a request is made to a type, the .TXT file with the list (1024 bytes, 128 names) is loaded. And when it is selected, the request is made to the file in the outdat.
When a file is selected, it will be loaded in outdat with its path. The files must have the extension in lower case.
If you are using an external WEB server, it is possible that policies may prevent you from making consecutive requests, so it is advisable not to make requests too close together.
To debug the WIFI, uncomment use_lib_wifi_debug in the gbWifiConfig.h file.