-
Notifications
You must be signed in to change notification settings - Fork 53
/
CMakeLists.txt
355 lines (308 loc) · 8.44 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
########################################################################
# VGA 1111 on breadboard with PS/2 keyboard
########################################################################
set(picomputer_vga_defines
#PICO_CORE1_STACK_SIZE=0x800
# Tell FATFS we want to find files
FF_USE_FIND=1
# Configure the SPI sd card to use SPI0
#SDCARD_PIO=pio1
#SDCARD_PIO_SM=1
SDCARD_PIN_SPI0_CS=5
SDCARD_PIN_SPI0_SCK=2
SDCARD_PIN_SPI0_MOSI=3
SDCARD_PIN_SPI0_MISO=4
# Use stdio
USE_STDIO
)
set(zxspectrum_vga_640x480x60Hz_defines
# Set the resolution of the menu screen
PCS_COLS=80
PCS_ROWS=30
# Set the VGA timing
VGA_MODE=vga_mode_640x240_60
# The display resolution
DISPLAY_WIDTH_PIXELS=640
DISPLAY_HEIGHT_PIXELS=480
# The default interrupt source
ZX_SPECTRUM_INT_SRC=SyncToCpu
# TODO work what this is
PICO_SCANVIDEO_MAX_SCANLINE_BUFFER_WORDS=700
)
set(zxspectrum_vga_720x576x50Hz_defines
# Set the resolution of the menu screen
PCS_COLS=90
PCS_ROWS=30
SZ_FRAME_X=5
# Set the VGA timing
VGA_MODE=vga_mode_720x288_50
# The display resolution
DISPLAY_WIDTH_PIXELS=720
DISPLAY_HEIGHT_PIXELS=576
# 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
)
add_executable(${target}
${zxspectrum_common_src}
${zxspectrum_scanvideo_src}
main.cpp
)
target_link_libraries(${target}
${zxspectrum_common_libs}
pico_emu_utils
pico_scanvideo_dpi
tinyusb_host
tinyusb_board
hardware_pio
hardware_pwm
pico_scanvideo_menu
)
pico_generate_pio_header(${target}
${zxspectrum_ear_in_pio}
)
pico_enable_stdio_usb(${target} 0)
pico_enable_stdio_uart(${target} 1)
# create map/bin/hex file etc.
pico_add_extra_outputs(${target})
endforeach()
set(ZxSpectrum4PinAudioVga1111Ps2_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
# 4 pin audio
BZR_PIN=21
EAR_PIN=11
AY8912_A_PIN=20
AY8912_B_PIN=26
AY8912_C_PIN=27
# Enable the PS/2 keyboard
USE_PS2_KBD
)
target_compile_definitions(ZxSpectrum4PinAudioVga1111Ps2_720x576x50Hz PRIVATE
${picomputer_vga_defines}
${ZxSpectrum4PinAudioVga1111Ps2_defines}
${zxspectrum_vga_720x576x50Hz_defines}
)
target_compile_definitions(ZxSpectrum4PinAudioVga1111Ps2_640x480x60Hz PRIVATE
${picomputer_vga_defines}
${ZxSpectrum4PinAudioVga1111Ps2_defines}
${zxspectrum_vga_640x480x60Hz_defines}
)
########################################################################
# VGA 222 on breadboard with PS/2 keyboard
########################################################################
set(ZxSpectrum4PinAudioVga222Ps2_defines
${picomputer_vga_defines}
#VGA 222
VGA_ENC_RGB_222
VGA_GPIO_SYNC=18
VGA_GPIO_OUTNUM=6
# 4 pin audio
BZR_PIN=21
AY8912_A_PIN=20
AY8912_B_PIN=26
AY8912_C_PIN=27
# Enable the PS/2 keyboard
USE_PS2_KBD
)
target_compile_definitions(ZxSpectrum4PinAudioVga222Ps2_720x576x50Hz PRIVATE
${ZxSpectrum4PinAudioVga222Ps2_defines}
${zxspectrum_vga_720x576x50Hz_defines}
)
target_compile_definitions(ZxSpectrum4PinAudioVga222Ps2_640x480x60Hz PRIVATE
${ZxSpectrum4PinAudioVga222Ps2_defines}
${zxspectrum_vga_640x480x60Hz_defines}
)
#
# Inital attempt at PicoMiteVGA support:-
#
# Stuff to do:
#
# 1) May need to move out from here
# 2) May need code modifications for joystick handling
# 3) PIN definitions not updated
# 6) RGBY is probably the wrong order
# 7) c-sync vs h-sync and v-sync
# 8) May be better off basing this on the Murulator build
#
set(ZxSpectrumPicoMiteVGA_defines
# Configure the SPI sd card to use SPI0
SDCARD_PIN_SPI0_CS=10
SDCARD_PIN_SPI0_SCK=12
SDCARD_PIN_SPI0_MOSI=11
SDCARD_PIN_SPI0_MISO=13
# VGA 1111
VGA_ENC_BGYR_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=18u
# 4 pin audio
BZR_PIN=6
SPK_PIN=7
# Enable the PS/2 keyboard
USE_PS2_KBD
USE_MRMLTR_PS2_KBD
# Use stdio
USE_STDIO
)
foreach(target
ZxSpectrumPicoMiteVGA_640x480x60Hz
ZxSpectrumPicoMiteVGA_720x576x50Hz
ZX-MURMULATOR_VGA_PWM_AUDIO_640x480x60Hz
ZX-MURMULATOR_VGA_PWM_AUDIO_720x576x50Hz
ZX-MURMULATOR_VGA_I2S_AUDIO_640x480x60Hz
ZX-MURMULATOR_VGA_I2S_AUDIO_720x576x50Hz
)
add_executable(${target}
${zxspectrum_common_src}
${zxspectrum_rgb_src}
${murmulator_common_src}
${zxspectrum_scanvideo_src}
main.cpp
)
target_link_libraries(${target}
${zxspectrum_common_libs}
pico_emu_utils
pico_scanvideo_dpi
pico_scanvideo_menu
pico_nespad
tinyusb_host
tinyusb_board
hardware_pio
hardware_pwm
)
pico_generate_pio_header(${target}
${zxspectrum_ear_in_pio}
)
pico_generate_pio_header(${target}
${murmulator_ps2kbd_pio}
)
pico_enable_stdio_usb(${target} 0)
# create map/bin/hex file etc.
pico_add_extra_outputs(${target})
endforeach()
foreach(target
ZxSpectrumPicoMiteVGA_640x480x60Hz
ZxSpectrumPicoMiteVGA_720x576x50Hz
)
pico_enable_stdio_uart(${target} 1)
endforeach()
target_compile_definitions(ZxSpectrumPicoMiteVGA_720x576x50Hz PRIVATE
${ZxSpectrumPicoMiteVGA_defines}
${zxspectrum_vga_720x576x50Hz_defines}
)
target_compile_definitions(ZxSpectrumPicoMiteVGA_640x480x60Hz PRIVATE
${ZxSpectrumPicoMiteVGA_defines}
${zxspectrum_vga_640x480x60Hz_defines}
)
#========================================================
# ZX MURMULATOR
#========================================================
set(ZX-MURMULATOR_VGA_defines
MURMULATOR
# Configure the SPI sd card to use SPI0
SDCARD_PIN_SPI0_CS=5
SDCARD_PIN_SPI0_SCK=2
SDCARD_PIN_SPI0_MOSI=3
SDCARD_PIN_SPI0_MISO=4
#VGA 222 vith VSYNC
VGA_ENC_RGB_222
VGA_VSYNC
PICO_SCANVIDEO_COLOR_PIN_COUNT=6u
PICO_SCANVIDEO_DPI_PIXEL_RCOUNT=2u
PICO_SCANVIDEO_DPI_PIXEL_GCOUNT=2u
PICO_SCANVIDEO_DPI_PIXEL_BCOUNT=3u
PICO_SCANVIDEO_DPI_PIXEL_RSHIFT=4u
PICO_SCANVIDEO_DPI_PIXEL_GSHIFT=2u
PICO_SCANVIDEO_DPI_PIXEL_BSHIFT=0u
PICO_SCANVIDEO_COLOR_PIN_BASE=6u
# Use the alternate volume map
AY8912_ALT_VOL_MAP
# Tape audio in
EAR_PIN=22
# Enable the PS/2 keyboard
USE_PS2_KBD
USE_MRMLTR_PS2_KBD
# Pins for dual NES joypads, pio1 SM ?
NESPAD_DATA_PIN_BASE=16
NESPAD_CLK_PIN_BASE=14
NESPAD_PIO=pio1
NESPAD_IRQ=PIO1_IRQ_0
NESPAD_ENABLE
)
set(ZX-MURMULATOR_VGA_PWM_Audio_defines
# Speaker pin audio
SPK_PIN=28
# Buzzer audio out
# BZR_PIN=28
# STEREO AY audio
AY8912_ABC_STEREO
# Left chanel audio out
AY8912_A_PIN=27
# Right chanel audio out
AY8912_C_PIN=26
)
set (ZX-MURMULATOR_VGA_I2S_Audio_defines
# 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
)
foreach(target
ZX-MURMULATOR_VGA_PWM_AUDIO_640x480x60Hz
ZX-MURMULATOR_VGA_PWM_AUDIO_720x576x50Hz
ZX-MURMULATOR_VGA_I2S_AUDIO_640x480x60Hz
ZX-MURMULATOR_VGA_I2S_AUDIO_720x576x50Hz
)
pico_enable_stdio_uart(${target} 0)
endforeach()
foreach(target
ZX-MURMULATOR_VGA_I2S_AUDIO_640x480x60Hz
ZX-MURMULATOR_VGA_I2S_AUDIO_720x576x50Hz
)
pico_generate_pio_header(${target}
${zxspectrum_audio_i2s_pio}
)
endforeach()
target_compile_definitions(ZX-MURMULATOR_VGA_PWM_AUDIO_640x480x60Hz PRIVATE
${ZX-MURMULATOR_VGA_defines}
${ZX-MURMULATOR_VGA_PWM_Audio_defines}
${zxspectrum_vga_640x480x60Hz_defines}
)
target_compile_definitions(ZX-MURMULATOR_VGA_PWM_AUDIO_720x576x50Hz PRIVATE
${ZX-MURMULATOR_VGA_defines}
${ZX-MURMULATOR_VGA_PWM_Audio_defines}
${zxspectrum_vga_720x576x50Hz_defines}
)
target_compile_definitions(ZX-MURMULATOR_VGA_I2S_AUDIO_640x480x60Hz PRIVATE
${ZX-MURMULATOR_VGA_defines}
${ZX-MURMULATOR_VGA_I2S_Audio_defines}
${zxspectrum_vga_640x480x60Hz_defines}
)
target_compile_definitions(ZX-MURMULATOR_VGA_I2S_AUDIO_720x576x50Hz PRIVATE
${ZX-MURMULATOR_VGA_defines}
${ZX-MURMULATOR_VGA_I2S_Audio_defines}
${zxspectrum_vga_720x576x50Hz_defines}
)