Skip to content

Commit

Permalink
Merge pull request #72 from EremusOne/psram
Browse files Browse the repository at this point in the history
1.3 hotfixes
EremusOne authored Oct 7, 2024
2 parents 103b75b + 867d85d commit b26b0d4
Showing 3 changed files with 49 additions and 36 deletions.
49 changes: 30 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -11,13 +11,16 @@ This project is based on David Crespo excellent work on [ZX-ESPectrum-Wiimote](h
## Features

- ZX Spectrum 48K, 128K and Pentagon 128K 100% cycle accurate emulation (no PSRAM needed).
- Microdigital TK90X and TK95 models (w/Microdigital ULA at 50 and 60hz) emulation.
- State of the art Z80 emulation (Authored by [José Luis Sánchez](https://github.com/jsanchezv/z80cpp))
- Selectable Sinclair 48K, Sinclair 128K and Amstrad +2 english and spanish ROMs.
- Possibility of using one 48K and one 128K custom ROM with easy flashing procedure from SD card.
- Selectable TK90X v1, v2 and v3 (Rodolfo Guerra) ROMs.
- Possibility of using one 48K, one 128K and one TK90X custom ROM with easy flashing procedure from SD card.
- ZX81+ IF2 ROM by courtesy Paul Farrow with .P file loading from SD card.
- 6 bpp VGA output in three modes: Standard VGA (60 and 70hz), VGA 50hz and CRT 15khz 50hz.
- 6 bpp VGA output in three modes: Standard VGA (60 and 70hz), VGA with every machine real vertical frequency and CRT 15khz with real vert. freq. also.
- VGA fake scanlines effect.
- Support for two aspect ratios: 16:9 or 4:3 monitors (using 360x200 or 320x240 modes)
- Complete overscan supported in CRT 15Khz mode (at 352x272 resolution for 50hz machines and 352x224 for 60hz ones).
- Multicolor attribute effects emulated (Bifrost*2, Nirvana and Nirvana+ engines).
- Border effects emulated (Aquaplane, The Sentinel, Overscan demo).
- Floating bus effect emulated (Arkanoid, Sidewize).
@@ -28,15 +31,15 @@ This project is based on David Crespo excellent work on [ZX-ESPectrum-Wiimote](h
- Dual PS/2 keyboard support: you can connect two devices using PS/2 protocol at the same time.
- PS/2 Joystick emulation (Cursor, Sinclair, Kempston and Fuller).
- Two real joysticks support (Up to 8 button joysticks) using [ESPjoy adapter](https://antoniovillena.es/store/product/espjoy-for-espectrum/) or DIY DB9 to PS/2 converter.
- Emulation of Betadisk interface with four drives and TRD (read and write) and SCL (read only) support.
- Emulation of Betadisk interface with reset to tr-dos option, four drives and TRD (read and write) and SCL (read only) support.
- Realtime (with OSD) TZX and TAP file loading.
- Flashload of TAP files.
- Rodolfo Guerra's ROMs fast load routines support with on the fly standard speed blocks translation.
- TAP file saving to SD card.
- SNA and Z80 snapshot loading.
- Virtual tape system with support for SAVE command and block renaming, deleting and moving.
- SNA, Z80 and SP snapshot loading.
- Snapshot saving and loading.
- Complete file navigation system with autoindexing, folder support and search functions.
- Complete OSD menu in two languages: English & Spanish.
- Complete OSD menu in three languages: English, Spanish and Portuguese.
- BMP screen capture to SD Card (thanks David Crespo 😉).

## Work in progress
@@ -81,7 +84,7 @@ There's also no need to sort files using external utilities: the emulator create
## PS/2 Keyboard functions

- F1 Main menu
- F2 Load (SNA,Z80,P)
- F2 Load (SNA,Z80, SP, P)
- F3 Load custom snapshot
- F4 Save customn snapshot
- F5 Select TAP file
@@ -92,20 +95,24 @@ There's also no need to sort files using external utilities: the emulator create
- F10 Volume up
- F11 Hard reset
- F12 Reset ESP32
- CTRL + F1 Hardware info
- CTRL + F2 Turbo mode
- CTRL + F1 Show current machine keyboard layout
- CTRL + F2 Cycle turbo modes -> 100% speed (blue OSD), 125% speed (red OSD), 150% speed (magenta OSD) and MAX speed (black speed and no sound)
- CTRL + F5..F8 Screen centering in CRT 15K/50hz mode
- CTRL + F9 Input poke
- CTRL + F10 NMI
- CTRL + F11 Reset to TR-DOS
- SHIFT + F1 Hardware info
- SHIFT + F6 Eject tape
- Pause Pause
- ScrollLock Switch "Cursor keys as joy" setting
- PrntScr BMP screen capture (Folder /.c at SDCard)

## ZX Keyboard functions

Press CAPS SHIFT + SYMBOL SHIFT and:

- 1 Main menu
- 2 Load (SNA,Z80,P)
- 2 Load (SNA,Z80, SP, P)
- 3 Load custom snapshot
- 4 Save custom snapshot
- 5 Select TAP file
@@ -116,29 +123,32 @@ Press CAPS SHIFT + SYMBOL SHIFT and:
- 0 Volume up
- Q Hard reset
- W Reset ESP32
- E Eject tape
- R Reset to TR-DOS
- T Cycle turbo modes -> 100% speed (blue OSD), 125% speed (red OSD), 150% speed (magenta OSD) and MAX speed (black speed and no sound)
- I Hardware info
- T Turbo mode
- Z,X,C,V Screen centering in CRT 15K/50hz mode
- O Input poke
- N NMI
- P Pause
- S BMP screen capture (Folder /.c at SDCard)
- K Show current machine keyboard layout
- Z,X,C,V Screen centering in CRT 15K mode
- B BMP screen capture (Folder /.c at SDCard)
- N NMI

## How to flash custom ROMs

Two custom ROMs can be installed: one for the 48K architecture and another for the 128K architecture.
Three custom ROMs can be installed: one for the 48K architecture, another for the 128K architecture and another one for TK90X.

The "Update firmware" option is now changed to the "Update" menu with three options: firmware, custom ROM 48K, and custom ROM 128K.
The "Update firmware" option is now changed to the "Update" menu with four options: firmware, custom ROM 48K, custom ROM 128K and custom ROM TK90X.

Just like updating the firmware requires a file named "firmware.bin" in the root directory of the SD card, for the emulator to install the custom ROMs, the files must be placed in the mentioned root directory and named as "48custom.rom" and "128custom.rom" respectively.
You can put the ROM files (.rom extension) anywhere and select it with the browser.

For the 48K architecture, the ROM file size must be 16384 bytes.
For the 48K and TK90X architectures, the ROM file size must be 16384 bytes.

For the 128K architecture, it can be either 16kb or 32kb. If it's 16kb, the second bank of the custom ROM will be flashed with the second bank of the standard Sinclair 128K ROM.

It is important to note that for custom ROMs, fast loading of taps can be used, but the loading should be started manually, considering the possibility that the "traps" of the ROM loading routine might not work depending on the flashed ROM. For example, with Rodolfo Guerra's ROMs, both loading and recording traps using the SAVE command work perfectly.

Finally, keep in mind that when updating the firmware, you will need to re-flash the custom ROMs afterward, so I recommend leaving the files "48custom.rom" and "128custom.rom" on the card for the custom ROMs you wish to use.
Finally, keep in mind that when updating the firmware, you will need to re-flash the custom ROMs afterward, so I recommend leaving ROM files you wish to use on the SD card.

## Hardware configuration and pinout

@@ -174,6 +184,7 @@ Pin assignment in `hardpins.h` is set to match the boards we've tested emulator
- [Ackerman](https://github.com/rpsubc8/ESP32TinyZXSpectrum) for his code and ideas.
- [Mark Woodmass](https://specemu.zxe.io) and [Juan Carlos González Amestoy](https://www.retrovirtualmachine.org) for his excellent emulators and his help with wd1793 emulation and many other things.
- [Rodolfo Guerra](https://sites.google.com/view/rodolfoguerra) for his wonderful enhanced ROMs and his help for adding tape load turbo mode support to the emulator.
- [Juanjo Ponteprino](https://github.com/SplinterGU) for his help and contributions to ESPectrum
- Weiv and [MartianGirl](https://github.com/MartianGirl) for his detailed analysis of Snow effect.
- [Antonio Villena](https://antoniovillena.es/store) for creating the ESPectrum board.
- Tsvetan Usunov from [Olimex Ltd](https://www.olimex.com).
2 changes: 1 addition & 1 deletion include/messages_pt.h
Original file line number Diff line number Diff line change
@@ -133,7 +133,7 @@ visit https://zxespectrum.speccy.org/contacto

#define MENU_SNA_PT \
"Menu snapshots\n"\
"Carregar (SNA,Z80,SP,P) \t(F2) >\n"\
"Carregar (SNA,Z80,SP,P)\t(F2) >\n"\
"Carregar snapshot\t(F3) >\n"\
"Salvar snapshot\t(F4) >\n"

34 changes: 18 additions & 16 deletions src/Snapshot.cpp
Original file line number Diff line number Diff line change
@@ -378,20 +378,20 @@ bool FileSNA::load(string sna_fn, string force_arch, string force_romset, uint8_
VIDEO::borderColor = readByteFile(file);
VIDEO::brd = VIDEO::border32[VIDEO::borderColor];

if (Z80Ops::is48 && sna_size == SNA_48K_WITH_ROM_SIZE) {
// Load ROM if present
readBlockFile(file, MemESP::ram[1], 0x4000);
MemESP::ramCurrent[0] = MemESP::ram[1];
MemESP::SPRom = true;
}

// read 48K memory
readBlockFile(file, MemESP::ram[5], 0x4000);
readBlockFile(file, MemESP::ram[2], 0x4000);
readBlockFile(file, MemESP::ram[0], 0x4000);

if (Z80Ops::is48) {

// Load ROM if present
if (sna_size == SNA_48K_WITH_ROM_SIZE) {
readBlockFile(file, MemESP::ram[1], 0x4000);
MemESP::ramCurrent[0] = MemESP::ram[1];
MemESP::SPRom = true;
}

// in 48K mode, pop PC from stack
uint16_t SP = Z80::getRegSP();
Z80::setRegPC(MemESP::readword(SP));
@@ -589,6 +589,15 @@ bool FileSNA::save(string sna_file, bool blockMode) {
uint8_t bordercol = VIDEO::borderColor;
writeByteFile(bordercol, file);

// write 16K ROM page if we've loaded it previously

if (Z80Ops::is48 && MemESP::SPRom) {
if (!writeMemPage(1, file, blockMode)) {
fclose(file);
return false;
}
}

// write RAM pages in 48K address space (0x4000 - 0xFFFF)
uint8_t pages[3] = {5, 2, 0};

@@ -603,13 +612,6 @@ bool FileSNA::save(string sna_file, bool blockMode) {
}
}

if (Z80Ops::is48 && MemESP::SPRom) {
if (!writeMemPage(1, file, blockMode)) {
fclose(file);
return false;
}
}

if (Z80Ops::is128 || Z80Ops::isPentagon) {
// if (Config::arch != "48K") {

@@ -1617,8 +1619,8 @@ bool FileSP::load(string sp_fn) {
Z80::setRegDE(readWordFileLE(file));
Z80::setRegHL(readWordFileLE(file));

Z80::setRegA(readByteFile(file));
Z80::setFlags(readByteFile(file));
Z80::setRegA(readByteFile(file));

Z80::setRegIX(readWordFileLE(file));
Z80::setRegIY(readWordFileLE(file));
@@ -1627,8 +1629,8 @@ bool FileSP::load(string sp_fn) {
Z80::setRegDEx(readWordFileLE(file));
Z80::setRegHLx(readWordFileLE(file));

Z80::setRegAx(readByteFile(file));
Z80::setRegFx(readByteFile(file));
Z80::setRegAx(readByteFile(file));

Z80::setRegR(readByteFile(file));

0 comments on commit b26b0d4

Please sign in to comment.