Modification of the MCUME zx81 emulator (Jean MarcHarvengt) to TTGO VGA32 v1.0, v1.1, v1.2 and v1.4 with ESP32.
- No PSRAM is used, running on ESP32 with 520 KB RAM (TTGO VGA32 v1.x).
- Use of a single core
- Low-resource OSD.
- Created project compatible with Arduino IDE and Platform IO.
- Any digital pin can be used for video (hardware.h).
- Emulation video speed menu, VGA, keyboard.
- Support for 64-color (6-bit DAC) and 8-color (3-bit DAC) modes.
- VGA 320x200 and 360x200 bitluni, as well as 320x200 with fabgl parameters.
- Option to remove IEEE rounding calculation (double) from VGA
- Uploading of pfiles.
- The complete bitluni library is not required. I have reduced to the minimum, saving RAM and FLASH, based on Ricardo Massaro's library.
- Hi-res and pseudo hi-res mode support.
- Support CVBS PAL NTSC Black and White on TTGO VGA32 board (pin 26 CLK PS/2)
- The default CVBS mode has no border and comes out in inverted color mode, so that it can be viewed on the largest number of TVs without problems.
- Web Editor and ArduinoDroid (6.3.1) compatible project with tool makeandroid.bat
- The OSD is brought up with the F1 key.
- Added keyboard support from usb serial terminal, VStudio monitor or putty.
-
keyboard mapped
//Keyboard Matrix // Port____Line____Bit__0____1____2____3____4__ // FEFEh 0 (A8) SHIFT Z X C V // FDFEh 1 (A9) A S D F G // FBFEh 2 (A10) Q W E R T // F7FEh 3 (A11) 1 2 3 4 5 // EFFEh 4 (A12) 0 9 8 7 6 // DFFEh 5 (A13) P O I U Y // BFFEh 6 (A14) ENTER L K J H // 7FFEh 7 (A15) SPC . M N B
https://github.com/rpsubc8/ESP32TinyMCUMEesp81/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 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)
- Visual Studio 1.66.1 PLATFORMIO 2.5.0 Espressif32 v3.5.0
- Arduino IDE 1.8.11
- Arduino bitluni 0.3.3 reduced library (included in project)
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.
The project is now ready, so no bitluni or fabgl libraries are needed. We must deactivate the PSRAM option, and in case of exceeding 1 MB of binary, select 4 MB of partition when uploading. Although the code does not use PSRAM, if the option is active and our ESP32 does not have it, an exception will be generated and it will restart in loop mode.
- TAB key or F2 key: Display OSD
- Space: Space bar
- ENTER: Send ENTER on the ZX81
- +: Send ALT_GR
- -: Send SHIFT LEFT
- .: Send .
- Up: SHIFT + 7 and Kempston Up
- Down: SHIFT + 6 and Kempston Down
- Right: Kempston right
- Left: Kempston left
- A..Z, a..z: a..z
- 0..9: 0..9
- 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).
- use_lib_log_serial: Logs are sent by usb serial port
- use_lib_keyboard_poll_milis: The number of polling milliseconds for the keyboard must be specified.
- gb_delay_emulate_ms: Milliseconds of waiting for each completed frame.
- use_lib_delay_tick_cpu_auto: If set to 1, the CPU autotunes itself to 20 ms per frame.
- use_lib_delay_tick_cpu_milis: If use_lib_delay_tick_cpu_auto is set to 0, whatever we define here will be the wait in milliseconds per frame.
- FIX_PERIBOARD_NOT_INITING: Solution made by dcrespo3D for initialization on some keyboards.
- use_lib_cvbs_bitluni: If it is active, it does not use VGA code, nor does it generate VGA output. Use the modified CVBS Bitluni library. If it is commented out, use all the VGA code. In the TTGO VGA32 package, pin 26 is being used, that is, the CLK of the PS/2 connector of the mouse.
- use_lib_cvbs_bitluni_not_backbuffer: Does not use double buffering in CVBS, saving memory. May cause visual defects (flickering).
- use_lib_cvbs_pal: If it is activated together with use_lib_cvbs_bitluni, the video output will be in PAL standard, if not NTSC.
- use_lib_cvbs_ttgo_vga32: The TTGO VGA32 board uses a 5 volt output, instead of 3v. Therefore, said line must be uncommented if the TV output is used, in order to reduce the DAC output to 1 volt.
- use_lib_cvbs_ttgo_vga32_bright: If the DAC output on the 5v TTGO VGA32 is very low, activating this option can increase the brightness a bit. Use with care, as the CVBS standard is 1 volt.
- use_lib_invert_color_default_value: It allows color inversion, that is, white for black. In CVBS mode, it is inverted by default. Its values are 1 or 0.
- use_lib_stats_time_unified Allows you to view serial port traces with fps, as well as current, minimum and maximum microseconds per frame. The same for video.
- use_lib_fix_double_precision It doesn't use the VGA video frequency calculation with the ESP32 itself, avoiding possible accuracy problems with the mantissa. This is useful for ESP32's that miscalculate the frequency.
- use_lib_debug_i2s Plot with video mode calculations.
- use_lib_vga360x200x70hz_bitluni 360x200 video mode with bitluni parameters.
- use_lib_vga320x200x70hz_bitluni 320x200 video mode with bitluni parameters.
- use_lib_vga320x200x70hz_fabgl 320x200 mode with fabgl parameters.
- use_lib_border_x Scrolls the screen in multiples of 4 pixels, useful for 360x200 video mode. Do not exceed a value of 10, as this will overflow the buffer.
- use_lib_keyboard_uart: Allows you to use the PC keyboard from the PC via the VStudio monitor terminal or from putty, without having to have a keyboard. Useful for not having to use the physical PS/2 keyboard and for development.
//ESP32 Pin 26 //DAC - Voltaje // 0 - 0.06 // 38 - 0.52 // 77 - 1 //255 - 3.17The maximum values when writing to the video buffer on an ESP32 board is 54, while for TTGO VGA32 v1.x it would be 35.#include <Arduino.h> #include <driver/dac.h>
const int arrayValue[4]={0,38,77,255}; unsigned char cont=0;
void setup() { Serial.begin(115200); dac_output_enable(DAC_CHANNEL_2); }
void loop() { dac_output_voltage(DAC_CHANNEL_2, arrayValue[cont]); Serial.printf("%d\n",arrayValue[cont]); delay(4000); cont++; cont &= 0x03; }
Tool p2h
input/ pfile/ output/ dataFlash/ pfile/Afterwards we must copy the dataFlash directory into the project TinyMCUMEesp81ttgovga32\MECUMEesp81 overwriting the previous dataFlash folder.It is recommended to clean the project and recompile.
This tool is very simple, and does not control errors, so it is recommended to leave the files with very simple names and as simple as possible. simple names and as simple as possible.
The project in PLATFORM.IO is prepared for 2 MB 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 Partition Scheme (Huge APP) option.