Skip to content

Commit 77cb3b5

Browse files
committed
re-enabled custom board file. higher clock rate, minor fixes
1 parent 0fc0115 commit 77cb3b5

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

CMakeLists.txt

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,23 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
99
# Initialise pico_sdk from installed location
1010
# (note this can come from environment, CMake cache etc)
1111

12-
# == DO NEVER EDIT THE NEXT LINES for Raspberry Pi Pico VS Code Extension to work ==
13-
if(WIN32)
14-
set(USERHOME $ENV{USERPROFILE})
15-
else()
16-
set(USERHOME $ENV{HOME})
17-
endif()
18-
set(sdkVersion 2.0.0)
19-
set(toolchainVersion 13_3_Rel1)
20-
set(picotoolVersion 2.0.0)
21-
set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)
22-
if (EXISTS ${picoVscode})
23-
include(${picoVscode})
24-
endif()
12+
# == DO NEVER EDIT THE NEXT LINES for Raspberry Pi Pico VS Code Extension to work ==
13+
if(WIN32)
14+
set(USERHOME $ENV{USERPROFILE})
15+
else()
16+
set(USERHOME $ENV{HOME})
17+
endif()
18+
set(sdkVersion 2.0.0)
19+
set(toolchainVersion 13_3_Rel1)
20+
set(picotoolVersion 2.0.0)
21+
set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)
22+
if (EXISTS ${picoVscode})
23+
include(${picoVscode})
24+
endif()
2525
# ====================================================================================
26-
set(PICO_BOARD pico CACHE STRING "Board type")
26+
27+
set(PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR}/src/boards )
28+
set(PICO_BOARD "pico9918_v04" CACHE STRING "Board type")
2729

2830
# Pull in Raspberry Pi Pico SDK (must be before project)
2931
include(pico_sdk_import.cmake)

src/boards/pico9918_v04.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
// This header may be included by other board headers as "boards/pico.h"
1313

14-
#ifndef _BOARDS_PICO_H
15-
#define _BOARDS_PICO_H
14+
#pragma once
1615

1716
// For board detection
1817
#define PICO9918
@@ -95,5 +94,3 @@
9594
#ifndef PICO_VSYS_PIN
9695
#define PICO_VSYS_PIN 29
9796
#endif
98-
99-
#endif

src/gpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ static void triggerGpuDma()
9797
uint32_t params = tms9918->vram[0x8007];
9898
*(uint16_t*)(tms9918->vram + 0x8008) = 0;
9999

100-
int32_t srcInc = params & 0x01 ? 0 : (params & 0x02 ? -1 : 1);
101100
int32_t dstInc = params & 0x02 ? -1 : 1;
101+
int32_t srcInc = params & 0x01 ? 0 : dstInc;
102102

103103
uint8_t *srcPtr = tms9918->vram + srcVramAddr;
104104
uint8_t *dstPtr = tms9918->vram + dstVramAddr;

src/main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@
107107

108108
#define TMS_CRYSTAL_FREQ_HZ 10738635.0f
109109

110-
#define PICO_CLOCK_PLL 604000000
111-
#define PICO_CLOCK_PLL_DIV1 2
110+
#define PICO_CLOCK_PLL 1512000000
111+
#define PICO_CLOCK_PLL_DIV1 4
112112
#define PICO_CLOCK_PLL_DIV2 1
113113
#define PICO_CLOCK_HZ (PICO_CLOCK_PLL / PICO_CLOCK_PLL_DIV1 / PICO_CLOCK_PLL_DIV2)
114114

@@ -758,6 +758,7 @@ void proc1Entry()
758758
*/
759759
int main(void)
760760
{
761+
vreg_set_voltage(VREG_VOLTAGE_1_30);
761762
/* currently, VGA hard-coded to 640x480@60Hz. We want a high clock frequency
762763
* that comes close to being divisible by 25.175MHz. 302.0 is close... enough :)
763764
* I do have code which sets the best clock baased on the chosen VGA mode,

src/vga/vga.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static bool buildSyncData()
141141
rgbDataBuffer[2][i] = 0x0f00;
142142
#endif
143143

144-
vgaParams.params.pioDivider = roundflt(sysClockKHz / (float)minClockKHz);
144+
vgaParams.params.pioDivider = (sysClockKHz / (float)minClockKHz);
145145
vgaParams.params.pioFreqKHz = sysClockKHz / vgaParams.params.pioDivider;
146146

147147
vgaParams.params.pioClocksPerPixel = vgaParams.params.pioFreqKHz / (float)vgaParams.params.pixelClockKHz;

0 commit comments

Comments
 (0)