Skip to content

Latest commit

 

History

History
138 lines (118 loc) · 8.33 KB

readmeEnglish.md

File metadata and controls

138 lines (118 loc) · 8.33 KB

Tiny ESP32 AMSTRAD CPC


Port from Tom Walker's PC emulator (AMSTRAD CPC) to TTGO VGA32 v1.4 board with ESP32.

I have made several modifications:
  • x86 PC to ESP32 port
  • Use of a single core
  • Low-income OSD
  • Created project compatible with Arduino IDE and Platform IO
  • AY8912 emulation (fabgl library) reduced version of dcrespo3d(David Crespo Tascón) version 1.0.9
  • Screen adjustment X
  • Emulation CPU speed menu (AUTO), sound, keyboard
  • Support for 8 and 64 color mode (reduced version by Ricardo Massaro).
  • DSK support with 42 tracks and 11 sectors
  • Supports loading DSK files from SD card (files must be under /dsk).
  • Load ROM files from SD under /rom/[6128|664|464]/ . Both OS.rom and BASIC.rom are needed
  • Emulates only the CRTC 0
  • Supports 0, 1 and 2 video mode
  • VGA 400x300
  • VGA 320x200 with or without borders
  • CPC 464 and 664 emulation
  • CPC 6128 emulation (unstable)
  • AMX Mouse emulation (reduced library by Rob Kent jazzycamel)
  • It is now possible to have 400x300 64 color video mode, 128 KB mode, as well as mouse and sound all active.
  • Green monochrome palette to simulate GT65

Requirements

Required:
  • TTGO VGA32 v1.4
  • Arduino IDE 1.8.11 Espressif System 2.0.7
  • Arduino fabgl 1.0.9 reduced library (included in PLATFORMIO project)
  • Arduino bitluni 0.3.3 reduced library (included in project)


Arduino IDE

The whole project is compatible with the structure of Arduino 1.8.11. We only have to open the CPCem.ino from the CPCem directory.

We must install the spressif extensions in the additional card url manager https://dl.espressif.com/dl/package_esp32_index.json The project is now ready, so no bitluni or fabgl libraries are needed. We must activate the PSRAM option, and in case of exceeding 1 MB of binary, select 4 MB of partition when uploading. In the Arduino IDE, we must choose the option Partition Scheme (Huge APP).

Usability

The following actions are allowed from the menu (key F1):
  • Select Machine allows you to choose CPC 464, 664 or 6128.
  • Select DSK allows to choose the disk.
  • X screen offset
  • Allows you to skip a frame
  • Change the milliseconds of polling for video, keyboard and sound
  • Change the milliseconds of waiting in each frame
  • Sound Volume (100%, 75,%, 50%, 25%, 5%)
  • Sound active or muted
  • CPU wait in AUTO mode (set 20 ms per real frame) or the wait in ms of your choice
  • Mouse Detect, allows to re-initialize the mouse, if it has been disconnected while hot
  • Mouse ON and OFF, allows you to disable the mouse reading. This way the emulation is faster.
There is a basic OSD of low resources, that is to say, very simple, that is visualized by pressing the key F1.


Options

The file gbConfig.h options are selected:
  • use_lib_400x300: 400x300 video mode is used.
  • use_lib_320x200_video_border: 320x200 video mode with borders is used, so the screen size is halved. This mode consumes less RAM than 400x300 and is faster.
  • use_lib_320x200_video_noborder: 320x200 video mode without borders is used. In this mode the screen is not halved, but the borders are lost. This mode consumes less RAM than 400x300 and is faster.
  • 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_sound_ay8912: It uses a 3-channel mixer in dirty mode, emulating the AY8912. It consumes some RAM. It requires the reduced fabgl 0.9.0 library, already included in the project.
  • use_lib_log_serial: Logs are sent by serial port usb
  • usb_lib_optimice_checkchange_bankswitch: Only switches banks when they are different, gaining speed.
  • use_lib_128k: Allows to use 128K mode, including 6128 rom at compilation, as well as 2 blocks of 64KB memory. It is in the testing phase, and as it requires more RAM, you have to use other low RAM consumption configuration options.
  • use_lib_cheat_128k: 128 KB experimental mode.
  • gb_ms_keyboard: You must specify the number of milliseconds of polling for the keyboard.
  • gb_ms_sound: You must specify the number of milliseconds of polling for the sound.
  • gb_frame_crt_skip: If it is 1 it skips a frame.
  • gb_delay_emulate_ms: Millisecond wait for each completed frame.
  • use_lib_amx_mouse: A PS/2 mouse is used as if it were an AMX mouse (emulated). The use of the mouse consumes some CPU and memory.
  • gb_delay_init_ms: Specifies a number of initial milliseconds to wait for the mouse to start up in order to detect it correctly.
  • use_lib_amx_mouse_lefthanded: Left-handed mouse (swaps buttons)
  • gb_ms_mouse: Sampling in milliseconds of each mouse reading.
  • use_lib_lookup_znptable: Uses look-up table in FLASH for BCD calculations. It consumes 256 bytes.
  • use_lib_lookup_znptable16: Uses look-up table in FLASH for BCD calculations. Consumes 64 KBs.

AMX Mouse

In order to use a mouse as if it were an AMX Mouse, it is required to activate the support in the configuration file.

Left-handed mouse configuration is allowed (also from the OSD), as well as sampling times, all in the gbConfig.h file.



Load ROMS

Games in ROM format (16 KB), can be loaded in LOW and HIGH (slot 0 to 15). When the Run ROM option is selected, the name of the ROM to be invoked as RSX command is autowritten. This RSX command matches the name of the rom file that was generated, so we must give it the exact .ROM file name that is invoked.
When we want to load another game, we must reset, either by selecting the Machine menu or Reset.
If we want to launch the game arkanoid , we must choose from the menu Load or Run ROM , then Run ROM and finally it will ask us to select Arkanoid . At the end, we select High ROM (0..15) , where we put for example slot 1, and in a couple of seconds, | arkanoid will be written.
If we choose just Load ROM , it will do the same as above, but without launching the RSX | arkanoid . This file name must match the actual name of the internal game.
If we have several ROMS games, for example 3weeks.rom and 3weeks2.rom , we must load 3weeks.rom in slot 1 and 3weeks2.rom in slot 2, and finally launch the main one, which in this case would be 3weeks.rom

More information about ROMS: https://www.cpcwiki.eu/index.php/ROM_List



Monochrome

In 64-color mode, a choice of 3 types of green monochrome color palette has been added. Since the DAC is 6-bit, only 11 levels of green are allowed in addition to black.

Therefore, we cannot achieve the same quality as a GT65 monitor.



CPM

To execute the CPM Operating System, the DSK is required (not included in this project), and press the key |.

The Tilde key is taken out with the combination SHIFT + F10.