mirror of
https://github.com/fruit-bat/pico-zxspectrum.git
synced 2025-04-19 00:04:01 +03:00
Merge pull request #201 from fruit-bat/feature/CVBS
Implement 50Hz CVBS output
This commit is contained in:
commit
7b85902026
@ -23,6 +23,10 @@ This project is intended to be relatively easy to breadboard or prototype in som
|
||||
|
||||
## Updates
|
||||
|
||||
28/12/24
|
||||
|
||||
* Added a build with CVBS 50Hz output - credit to [svofski](https://github.com/svofski)
|
||||
|
||||
27/12/24
|
||||
|
||||
* Additions for Murmulator 2 (only mono PWM audio for now)
|
||||
@ -111,6 +115,7 @@ Click on the images below for more information ...
|
||||
| [MURMULATOR](docs/MURMULATOR.md) | Micro with VGA/HDMI and more |
|
||||
| [MURMULATOR2](docs/MURMULATOR2.md) | Micro with VGA/HDMI and more |
|
||||
| [RP2040-PiZero](docs/ZxSpectrumPiZero.md) | Waveshare RP2040-PiZero Development Board |
|
||||
| [CVBS 50Hz](docs/ZxSpectrumCVBS.md) | Unknown/breadboard with 50Hz CVBS output |
|
||||
|
||||
## Screen shots
|
||||
<img src="docs/screenshots/48k_boot_screen.png" height="200px"/> <img src="docs/screenshots/128k_boot_screen.png" height="200px"/> <img src="docs/screenshots/the_swarm_is_coming_1.png" height="200px"/> <img src="docs/screenshots/the_swarm_is_coming_2.png" height="200px"/> <img src="docs/screenshots/the_goblin_1.png" height="200px"/> <img src="docs/screenshots/the_goblin_2.png" height="200px"/> <img src="docs/screenshots/menu_main_vol.png" height="200px"/>
|
||||
|
38
docs/ZxSpectrumCVBS.md
Normal file
38
docs/ZxSpectrumCVBS.md
Normal file
@ -0,0 +1,38 @@
|
||||
### ZxSpectrumI2SAudioVga1111Ps2_CVBSx50Hz
|
||||
|
||||
This is a target based on ZxSpectrum4PinAudioVga1111Ps2 but it generates timings compatible with composite PAL TV.<br/>
|
||||
|
||||
It can be connected to a black and white set with a help of this schematic:
|
||||

|
||||
Alternatively RGBI outputs can be connected to a PAL modulator.
|
||||
|
||||
It supports the following:
|
||||
* USB keyboard
|
||||
* PS/2 keyboard (untested)
|
||||
* USB joysticks
|
||||
* VGA video (RGBY1111)
|
||||
* I2S sound
|
||||
* SPI SD card
|
||||
* Serial port debug
|
||||
|
||||
This target uses I2S DAC (PCM5102).
|
||||
| Pin | Function |
|
||||
| - | - |
|
||||
| 2 | SD SCK |
|
||||
| 3 | SD MOSI |
|
||||
| 4 | SD MISO |
|
||||
| 5 | SD CS |
|
||||
| 12 | RED |
|
||||
| 13 | GREEN |
|
||||
| 14 | BLUE |
|
||||
| 15 | INTENSITY |
|
||||
| 16 | CSYNC |
|
||||
| 26 | I2S DATA |
|
||||
| 27 | I2S BCLK |
|
||||
| 28 | I2S LRCK |
|
||||
|
||||
#### Firmware
|
||||
|
||||
| Display | Audio | Firmware Pico | Firmware Pico 2 |
|
||||
| - | - | - | - |
|
||||
| CVBS 50Hz | I2S | [ZxSpectrumI2SAudioVga1111Ps2_CVBSx50Hz](/uf2-rp2040/ZxSpectrumI2SAudioVga1111Ps2_CVBSx50Hz.uf2) |
|
BIN
docs/cvbs_grayscale.png
Executable file
BIN
docs/cvbs_grayscale.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
@ -171,7 +171,8 @@ add_dependencies (ZxSpectrumBreadboard
|
||||
ZxSpectrum4PinAudioVga1111Ps2_640x480x60Hz
|
||||
ZxSpectrum4PinAudioVga1111Ps2_720x576x50Hz
|
||||
ZxSpectrum4PinAudioVga222Ps2_640x480x60Hz
|
||||
ZxSpectrum4PinAudioVga222Ps2_720x576x50Hz
|
||||
ZxSpectrum4PinAudioVga222Ps2_720x576x50Hz
|
||||
ZxSpectrumI2SAudioVga1111Ps2_CVBSx50Hz
|
||||
)
|
||||
if ((${PICO_BOARD} STREQUAL "pico") OR (${PICO_BOARD} STREQUAL "pico2"))
|
||||
message("Relevant target: ZxSpectrumBreadboard")
|
||||
|
@ -78,13 +78,92 @@ const scanvideo_mode_t vga_mode_720x288_50 =
|
||||
.yscale = 2,
|
||||
};
|
||||
|
||||
#if CVBS_13_5MHZ
|
||||
// timing definition based on 13.5MHz pixel clock (270MHz core)
|
||||
// 312 lines, 50.08 frames per second (matches 48K specs)
|
||||
const scanvideo_timing_t cvbs_timing_50hz_13_5MHz =
|
||||
{
|
||||
.clock_freq = 13500000,
|
||||
|
||||
.h_active = 720,
|
||||
.v_active = 288,
|
||||
|
||||
.h_front_porch = 14,
|
||||
.h_pulse = 68,
|
||||
.h_total = 864,
|
||||
.h_sync_polarity = 1 | CSYNC_EXTEND, // fill in vsync with eq pulses
|
||||
|
||||
.v_front_porch = 5,
|
||||
.v_pulse = 5,
|
||||
.v_total = 312,
|
||||
.v_sync_polarity = 1,
|
||||
|
||||
.enable_clock = 0,
|
||||
.clock_polarity = 0,
|
||||
|
||||
.enable_den = 0
|
||||
};
|
||||
|
||||
const scanvideo_mode_t cvbs_mode_50 =
|
||||
{
|
||||
.default_timing = &cvbs_timing_50hz_13_5MHz,
|
||||
.pio_program = &video_24mhz_composable,
|
||||
.width = 720,
|
||||
.height = 256,
|
||||
.xscale = 1,
|
||||
.yscale = 1,
|
||||
};
|
||||
#endif
|
||||
|
||||
#if CVBS_12MHZ
|
||||
// timing definition based on 12MHz pixel clock (240MHz core)
|
||||
// 312 lines, 50.08 frames per second (matches 48K specs)
|
||||
const scanvideo_timing_t cvbs_timing_50hz_12MHz =
|
||||
{
|
||||
.clock_freq = 12000000,
|
||||
|
||||
.h_active = 640, // visible area 64+512+64
|
||||
.v_active = 288, // visible area 16+256+16
|
||||
|
||||
.h_front_porch = 12,
|
||||
.h_pulse = 60,
|
||||
.h_total = 768,
|
||||
.h_sync_polarity = 1 | CSYNC_EXTEND, // fill in vsync with eq pulses
|
||||
|
||||
.v_front_porch = 5,
|
||||
.v_pulse = 5,
|
||||
.v_total = 312,
|
||||
.v_sync_polarity = 1,
|
||||
|
||||
.enable_clock = 0,
|
||||
.clock_polarity = 0,
|
||||
|
||||
.enable_den = 0
|
||||
};
|
||||
|
||||
const scanvideo_mode_t cvbs_mode_50 =
|
||||
{
|
||||
.default_timing = &cvbs_timing_50hz_12MHz,
|
||||
.pio_program = &video_24mhz_composable,
|
||||
.width = 640,
|
||||
.height = 256,
|
||||
.xscale = 1,
|
||||
.yscale = 1,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef VGA_MODE
|
||||
#define VGA_MODE vga_mode_640x240_60
|
||||
#endif
|
||||
|
||||
void ZxScanlineVgaRenderLoopInit()
|
||||
{
|
||||
#if (CVBS_12MHZ || CVBS_13_5MHZ)
|
||||
set_sys_clock_khz(2 * VGA_MODE.default_timing->clock_freq / 100, true);
|
||||
#else
|
||||
set_sys_clock_khz(VGA_MODE.default_timing->clock_freq / 100, true);
|
||||
#endif
|
||||
sleep_ms(10);
|
||||
}
|
||||
|
||||
|
@ -49,11 +49,32 @@ set(zxspectrum_vga_720x576x50Hz_defines
|
||||
PICO_SCANVIDEO_MAX_SCANLINE_BUFFER_WORDS=800
|
||||
)
|
||||
|
||||
set(zxspectrum_vga_CVBSx50Hz_defines
|
||||
# Set the resolution of the menu screen
|
||||
PCS_COLS=80
|
||||
PCS_ROWS=30
|
||||
SZ_FRAME_X=5
|
||||
# Set the VGA timing
|
||||
VGA_MODE=cvbs_mode_50
|
||||
# different pixel clock variants, pick one
|
||||
#CVBS_13_5MHZ=1
|
||||
CVBS_12MHZ=1
|
||||
# The display resolution
|
||||
DISPLAY_WIDTH_PIXELS=640
|
||||
DISPLAY_HEIGHT_PIXELS=576 # halved to 288
|
||||
# The default interrupt source
|
||||
ZX_SPECTRUM_INT_SRC=SyncToDisplay
|
||||
# TODO work what this is
|
||||
PICO_SCANVIDEO_MAX_SCANLINE_BUFFER_WORDS=800
|
||||
)
|
||||
|
||||
|
||||
foreach(target
|
||||
ZxSpectrum4PinAudioVga1111Ps2_640x480x60Hz
|
||||
ZxSpectrum4PinAudioVga1111Ps2_720x576x50Hz
|
||||
ZxSpectrum4PinAudioVga222Ps2_640x480x60Hz
|
||||
ZxSpectrum4PinAudioVga222Ps2_720x576x50Hz
|
||||
ZxSpectrumI2SAudioVga1111Ps2_CVBSx50Hz
|
||||
)
|
||||
add_executable(${target}
|
||||
${zxspectrum_common_src}
|
||||
@ -84,6 +105,15 @@ foreach(target
|
||||
|
||||
endforeach()
|
||||
|
||||
foreach(target
|
||||
ZxSpectrumI2SAudioVga1111Ps2_CVBSx50Hz
|
||||
)
|
||||
pico_generate_pio_header(${target}
|
||||
${zxspectrum_audio_i2s_pio}
|
||||
)
|
||||
|
||||
endforeach()
|
||||
|
||||
set(ZxSpectrum4PinAudioVga1111Ps2_defines
|
||||
# VGA 1111
|
||||
VGA_ENC_RGBY_1111
|
||||
@ -106,6 +136,29 @@ set(ZxSpectrum4PinAudioVga1111Ps2_defines
|
||||
USE_PS2_KBD
|
||||
)
|
||||
|
||||
set(ZxSpectrumI2SAudioVga1111Ps2_defines
|
||||
# VGA 1111
|
||||
VGA_ENC_RGBY_1111
|
||||
PICO_SCANVIDEO_COLOR_PIN_COUNT=4u
|
||||
PICO_SCANVIDEO_DPI_PIXEL_RCOUNT=2u
|
||||
PICO_SCANVIDEO_DPI_PIXEL_GCOUNT=1u
|
||||
PICO_SCANVIDEO_DPI_PIXEL_BCOUNT=1u
|
||||
PICO_SCANVIDEO_DPI_PIXEL_RSHIFT=2u
|
||||
PICO_SCANVIDEO_DPI_PIXEL_GSHIFT=1u
|
||||
PICO_SCANVIDEO_DPI_PIXEL_BSHIFT=0u
|
||||
PICO_SCANVIDEO_COLOR_PIN_BASE=12u
|
||||
|
||||
# Configure the I2S audio, pio1 SM ?
|
||||
PICO_AUDIO_I2S=1
|
||||
PICO_AUDIO_I2S_PIO=pio1
|
||||
PICO_AUDIO_I2S_PIO_FUNC=GPIO_FUNC_PIO1
|
||||
PICO_AUDIO_I2S_DATA=26
|
||||
PICO_AUDIO_I2S_BCLK=27
|
||||
|
||||
# Enable the PS/2 keyboard
|
||||
USE_PS2_KBD
|
||||
)
|
||||
|
||||
target_compile_definitions(ZxSpectrum4PinAudioVga1111Ps2_720x576x50Hz PRIVATE
|
||||
${picomputer_vga_defines}
|
||||
${ZxSpectrum4PinAudioVga1111Ps2_defines}
|
||||
@ -118,6 +171,12 @@ target_compile_definitions(ZxSpectrum4PinAudioVga1111Ps2_640x480x60Hz PRIVATE
|
||||
${zxspectrum_vga_640x480x60Hz_defines}
|
||||
)
|
||||
|
||||
target_compile_definitions(ZxSpectrumI2SAudioVga1111Ps2_CVBSx50Hz PRIVATE
|
||||
${picomputer_vga_defines}
|
||||
${ZxSpectrumI2SAudioVga1111Ps2_defines}
|
||||
${zxspectrum_vga_CVBSx50Hz_defines}
|
||||
)
|
||||
|
||||
########################################################################
|
||||
# VGA 222 on breadboard with PS/2 keyboard
|
||||
########################################################################
|
||||
|
BIN
uf2-rp2040/ZxSpectrumI2SAudioVga1111Ps2_CVBSx50Hz.uf2
Normal file
BIN
uf2-rp2040/ZxSpectrumI2SAudioVga1111Ps2_CVBSx50Hz.uf2
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user