Skip to content

Commit 4361997

Browse files
authored
Merge pull request #8 from visrealm/dev
v0.4.1
2 parents dc73003 + 589384f commit 4361997

File tree

7 files changed

+30
-34
lines changed

7 files changed

+30
-34
lines changed

CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ set(PICO_BOARD "pico9918_v04")
1616
project(${PROJECT} C CXX)
1717

1818
add_definitions(-DPICO_BUILD=1)
19-
add_definitions(-DPICO_DISABLE_SHARED_IRQ_HANDLERS=1)
2019
add_definitions(-DVR_EMU_TMS9918_SINGLE_INSTANCE=1)
21-
add_definitions(-DPICO_PANIC_FUNCTION=)
22-
add_definitions(-DPICO_TIME_DEFAULT_ALARM_POOL_DISABLED=1)
2320

2421
set(CMAKE_C_STANDARD 11)
2522
set(CMAKE_CXX_STANDARD 17)

src/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ pico_enable_stdio_uart(${PROGRAM} 0)
1919

2020
pico_set_binary_type(${PROGRAM} copy_to_ram) # TOO SLOW TO BOOT
2121

22+
add_definitions(-DPICO_DISABLE_SHARED_IRQ_HANDLERS=1)
23+
add_definitions(-DPICO_TIME_DEFAULT_ALARM_POOL_DISABLED=1)
24+
add_definitions(-DPICO_PANIC_FUNCTION=)
25+
2226
target_link_libraries(${PROGRAM} PUBLIC
2327
pico_stdlib
2428
pico_multicore

src/main.c

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111

112112
static uint8_t nextValue = 0; /* TMS9918A read-ahead value */
113113
static bool currentInt = false; /* current interrupt state */
114-
static uint8_t currentStatus = 0; /* current status register value */
114+
static uint8_t currentStatus = 0x1f; /* current status register value */
115115

116116
static uint8_t __aligned(4) tmsScanlineBuffer[TMS9918_PIXELS_X];
117117

@@ -164,7 +164,7 @@ void __not_in_flash_func(pio_irq_handler)()
164164
}
165165
else // read status
166166
{
167-
currentStatus = 0;
167+
currentStatus = 0x1f;
168168
vrEmuTms9918SetStatusImpl(currentStatus);
169169
currentInt = false;
170170
gpio_put(GPIO_INT, !currentInt);
@@ -269,12 +269,6 @@ static void __time_critical_func(tmsScanline)(uint16_t y, VgaParams* params, uin
269269

270270
y -= vBorder;
271271

272-
/*** left border ***/
273-
for (int x = 0; x < hBorder; ++x)
274-
{
275-
pixels[x] = bg;
276-
}
277-
278272
/*** main display region ***/
279273

280274
/* generate the scanline */
@@ -286,6 +280,25 @@ static void __time_critical_func(tmsScanline)(uint16_t y, VgaParams* params, uin
286280
tempStatus |= STATUS_INT;
287281
}
288282

283+
disableTmsPioInterrupts();
284+
if ((currentStatus & STATUS_INT) == 0)
285+
{
286+
currentStatus = (currentStatus & 0xe0) | tempStatus;
287+
288+
vrEmuTms9918SetStatusImpl(currentStatus);
289+
updateTmsReadAhead();
290+
291+
currentInt = vrEmuTms9918InterruptStatusImpl();
292+
gpio_put(GPIO_INT, !currentInt);
293+
}
294+
enableTmsPioInterrupts();
295+
296+
/*** left border ***/
297+
for (int x = 0; x < hBorder; ++x)
298+
{
299+
pixels[x] = bg;
300+
}
301+
289302
/* convert from palette to bgr12 */
290303
int tmsX = 0;
291304
if (tmsScanlineBuffer[0] & 0xf0)
@@ -305,31 +318,13 @@ static void __time_critical_func(tmsScanline)(uint16_t y, VgaParams* params, uin
305318
}
306319
}
307320

321+
308322
/*** right border ***/
309323
for (int x = hBorder + TMS9918_PIXELS_X * 2; x < VIRTUAL_PIXELS_X; ++x)
310324
{
311325
pixels[x] = bg;
312326
}
313327

314-
disableTmsPioInterrupts();
315-
if ((currentStatus & STATUS_INT) == 0)
316-
{
317-
if ((currentStatus & STATUS_5S) != 0)
318-
{
319-
currentStatus |= tempStatus & 0xe0;
320-
}
321-
else
322-
{
323-
currentStatus |= tempStatus;
324-
}
325-
326-
vrEmuTms9918SetStatusImpl(currentStatus);
327-
updateTmsReadAhead();
328-
329-
currentInt = vrEmuTms9918InterruptStatusImpl();
330-
gpio_put(GPIO_INT, !currentInt);
331-
}
332-
enableTmsPioInterrupts();
333328
}
334329

335330
/*

src/res/splash.png

7 Bytes
Loading

src/vga/vga-modes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ bool setVgaParamsScaleX(VgaParams* params, int pixelScale)
135135
if (!params || pixelScale < 1) return false;
136136

137137
params->hPixelScale = pixelScale;
138-
params->hVirtualPixels = (params->hSyncParams.displayPixels / 1);//params->hPixelScale);
138+
params->hVirtualPixels = (params->hSyncParams.displayPixels / params->hPixelScale);
139139
return true;
140140
}
141141

@@ -144,7 +144,7 @@ bool setVgaParamsScaleY(VgaParams* params, int pixelScale)
144144
if (!params || pixelScale < 1) return false;
145145

146146
params->vPixelScale = pixelScale;
147-
params->vVirtualPixels = (params->vSyncParams.displayPixels / 2);//params->vPixelScale);
147+
params->vVirtualPixels = (params->vSyncParams.displayPixels / params->vPixelScale);
148148
return true;
149149
}
150150

submodules/vrEmuTms9918

test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.12)
22

33
add_subdirectory(host)
4-
#add_subdirectory(qc)
4+
add_subdirectory(qc)
55

0 commit comments

Comments
 (0)