From a9e9a15ed44d350f509572c2147d107b124bd936 Mon Sep 17 00:00:00 2001 From: Troy Schrapel Date: Sun, 18 Aug 2024 14:46:47 +0930 Subject: [PATCH 1/3] VGA: Fixed scale multiplier when not 1 --- src/vga/vga-modes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vga/vga-modes.c b/src/vga/vga-modes.c index 16aa118..4764516 100644 --- a/src/vga/vga-modes.c +++ b/src/vga/vga-modes.c @@ -135,7 +135,7 @@ bool setVgaParamsScaleX(VgaParams* params, int pixelScale) if (!params || pixelScale < 1) return false; params->hPixelScale = pixelScale; - params->hVirtualPixels = (params->hSyncParams.displayPixels / 1);//params->hPixelScale); + params->hVirtualPixels = (params->hSyncParams.displayPixels / params->hPixelScale); return true; } @@ -144,7 +144,7 @@ bool setVgaParamsScaleY(VgaParams* params, int pixelScale) if (!params || pixelScale < 1) return false; params->vPixelScale = pixelScale; - params->vVirtualPixels = (params->vSyncParams.displayPixels / 2);//params->vPixelScale); + params->vVirtualPixels = (params->vSyncParams.displayPixels / params->vPixelScale); return true; } From add86708e5fdc20a2de351d7b2db9f8a8708be11 Mon Sep 17 00:00:00 2001 From: Troy Schrapel Date: Tue, 20 Aug 2024 14:04:17 +0930 Subject: [PATCH 2/3] Improve status register update responsiveness --- CMakeLists.txt | 3 --- src/CMakeLists.txt | 4 ++++ src/main.c | 49 ++++++++++++++++++----------------------- submodules/vrEmuTms9918 | 2 +- test/CMakeLists.txt | 2 +- 5 files changed, 28 insertions(+), 32 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b540d0..20cb083 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,10 +16,7 @@ set(PICO_BOARD "pico9918_v04") project(${PROJECT} C CXX) add_definitions(-DPICO_BUILD=1) -add_definitions(-DPICO_DISABLE_SHARED_IRQ_HANDLERS=1) add_definitions(-DVR_EMU_TMS9918_SINGLE_INSTANCE=1) -add_definitions(-DPICO_PANIC_FUNCTION=) -add_definitions(-DPICO_TIME_DEFAULT_ALARM_POOL_DISABLED=1) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 49b3a20..295562d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,6 +19,10 @@ pico_enable_stdio_uart(${PROGRAM} 0) pico_set_binary_type(${PROGRAM} copy_to_ram) # TOO SLOW TO BOOT +add_definitions(-DPICO_DISABLE_SHARED_IRQ_HANDLERS=1) +add_definitions(-DPICO_TIME_DEFAULT_ALARM_POOL_DISABLED=1) +add_definitions(-DPICO_PANIC_FUNCTION=) + target_link_libraries(${PROGRAM} PUBLIC pico_stdlib pico_multicore diff --git a/src/main.c b/src/main.c index dc9b643..41c3485 100644 --- a/src/main.c +++ b/src/main.c @@ -111,7 +111,7 @@ static uint8_t nextValue = 0; /* TMS9918A read-ahead value */ static bool currentInt = false; /* current interrupt state */ -static uint8_t currentStatus = 0; /* current status register value */ +static uint8_t currentStatus = 0x1f; /* current status register value */ static uint8_t __aligned(4) tmsScanlineBuffer[TMS9918_PIXELS_X]; @@ -164,7 +164,7 @@ void __not_in_flash_func(pio_irq_handler)() } else // read status { - currentStatus = 0; + currentStatus = 0x1f; vrEmuTms9918SetStatusImpl(currentStatus); currentInt = false; gpio_put(GPIO_INT, !currentInt); @@ -269,12 +269,6 @@ static void __time_critical_func(tmsScanline)(uint16_t y, VgaParams* params, uin y -= vBorder; - /*** left border ***/ - for (int x = 0; x < hBorder; ++x) - { - pixels[x] = bg; - } - /*** main display region ***/ /* generate the scanline */ @@ -286,6 +280,25 @@ static void __time_critical_func(tmsScanline)(uint16_t y, VgaParams* params, uin tempStatus |= STATUS_INT; } + disableTmsPioInterrupts(); + if ((currentStatus & STATUS_INT) == 0) + { + currentStatus = (currentStatus & 0xe0) | tempStatus; + + vrEmuTms9918SetStatusImpl(currentStatus); + updateTmsReadAhead(); + + currentInt = vrEmuTms9918InterruptStatusImpl(); + gpio_put(GPIO_INT, !currentInt); + } + enableTmsPioInterrupts(); + + /*** left border ***/ + for (int x = 0; x < hBorder; ++x) + { + pixels[x] = bg; + } + /* convert from palette to bgr12 */ int tmsX = 0; if (tmsScanlineBuffer[0] & 0xf0) @@ -305,31 +318,13 @@ static void __time_critical_func(tmsScanline)(uint16_t y, VgaParams* params, uin } } + /*** right border ***/ for (int x = hBorder + TMS9918_PIXELS_X * 2; x < VIRTUAL_PIXELS_X; ++x) { pixels[x] = bg; } - disableTmsPioInterrupts(); - if ((currentStatus & STATUS_INT) == 0) - { - if ((currentStatus & STATUS_5S) != 0) - { - currentStatus |= tempStatus & 0xe0; - } - else - { - currentStatus |= tempStatus; - } - - vrEmuTms9918SetStatusImpl(currentStatus); - updateTmsReadAhead(); - - currentInt = vrEmuTms9918InterruptStatusImpl(); - gpio_put(GPIO_INT, !currentInt); - } - enableTmsPioInterrupts(); } /* diff --git a/submodules/vrEmuTms9918 b/submodules/vrEmuTms9918 index 6597e55..6305e2d 160000 --- a/submodules/vrEmuTms9918 +++ b/submodules/vrEmuTms9918 @@ -1 +1 @@ -Subproject commit 6597e55c5485b5702b9190c717d6ecab57fab4ea +Subproject commit 6305e2d95f82482dc3f398242e175c787747c692 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 69c65bc..7b1bb63 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.12) add_subdirectory(host) -#add_subdirectory(qc) +add_subdirectory(qc) From 589384f59454a1b3f87831b784e70e8261c1edb9 Mon Sep 17 00:00:00 2001 From: Troy Schrapel Date: Wed, 21 Aug 2024 14:35:58 +0930 Subject: [PATCH 3/3] v0.4.1 --- src/res/splash.png | Bin 290 -> 297 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/res/splash.png b/src/res/splash.png index b5e4c1b054d7d0a906a67efa914b83061d52acc8..8ff1767d3432e367a8aae1f89c8d409bc7e7de6e 100644 GIT binary patch delta 211 zcmV;^04)Ea0;vL!7zqRe0002*BWVPYAxeL#NklxB=e(kXx|C zFtz*Fw&MiFXGA*&K6;XDGad)#jJ}L!^?T+SRSjk`XCB#wiU~P~+3coN6^-4IzoAiX z5`BB3;F9T6l}3NjAbQ7w;l9MS?q(G&>{~UDf}GG$;1TUGL>&1Zt8_G83qn__dU-$c zjnBGksL_MLx(ZFTV+@-My#~){@XYt++iR%O%eMl*kajh>t?{PGA@&W;pkt;AlNP}1wSG1sLgajCQWK(E^`TwFl zg7#L9RPIen>hncMk*I>_IV?mhN4U2OT|4#TWYLn~M(f=Kq5>-#yOZcuG7WhM9+Nmu z=X0$bJl-O;