mirror of
https://github.com/fruit-bat/pico-zxspectrum.git
synced 2025-04-19 00:04:01 +03:00
Merge pull request #200 from svofski/feature/cvbs
Implement 50Hz CVBS output #39
This commit is contained in:
commit
d862d5080a
33
docs/ZxSpectrumCVBS.md
Normal file
33
docs/ZxSpectrumCVBS.md
Normal file
@ -0,0 +1,33 @@
|
||||
### 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 |
|
||||
|
BIN
docs/cvbs_grayscale.png
Executable file
BIN
docs/cvbs_grayscale.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
@ -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}
|
||||
@ -106,6 +127,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 +162,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
|
||||
########################################################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user