Skip to content

Commit

Permalink
Removed unused tms9918 code from pico-56
Browse files Browse the repository at this point in the history
  • Loading branch information
visrealm committed Jun 8, 2024
1 parent c638a22 commit 7a86b84
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 270 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ target_link_libraries(${PROGRAM} PUBLIC
vrEmuTms9918Util)

add_subdirectory(pio-utils)
add_subdirectory(tms9918)
add_subdirectory(vga)
27 changes: 19 additions & 8 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ static uint8_t __aligned(4) tmsScanlineBuffer[TMS9918_PIXELS_X];
*/
void __time_critical_func(gpioExclusiveCallbackProc1)()
{
sio_hw->gpio_oe_clr = GPIO_CD_MASK;
uint32_t gpios = sio_hw->gpio_in;

if ((gpios & GPIO_CSR_MASK) == 0) /* read? */
Expand All @@ -138,11 +137,11 @@ void __time_critical_func(gpioExclusiveCallbackProc1)()
vrEmuTms9918ReadData(tms);
}
}
else if ((gpios & GPIO_CSW_MASK) == 0) /* write */
else if ((gpios & GPIO_CSW_MASK) == 0) /* write? */
{
uint8_t value = reversed[(sio_hw->gpio_in >> GPIO_CD0) & 0xff];

if (gpios & GPIO_MODE_MASK) /* write register */
if (gpios & GPIO_MODE_MASK) /* write register/address */
{
vrEmuTms9918WriteAddr(tms, value);

Expand All @@ -154,9 +153,15 @@ void __time_critical_func(gpioExclusiveCallbackProc1)()
vrEmuTms9918WriteData(tms, value);
}
}
else /* both CSR and CSW are high (inactive). Go High-Z */
{
sio_hw->gpio_oe_clr = GPIO_CD_MASK;
}

/* update read-ahead */
nextValue = reversed[vrEmuTms9918ReadDataNoInc(tms)] << GPIO_CD0;

/* interrupt handled */
iobank0_hw->intr[GPIO_CSR >> 3u] = iobank0_hw->proc1_irq_ctrl.ints[GPIO_CSR >> 3u];
}

Expand All @@ -176,8 +181,8 @@ void proc1Entry()

// set up gpio interrupts
irq_set_exclusive_handler(IO_IRQ_BANK0, gpioExclusiveCallbackProc1);
gpio_set_irq_enabled(GPIO_CSW, GPIO_IRQ_EDGE_FALL, true);
gpio_set_irq_enabled(GPIO_CSR, GPIO_IRQ_EDGE_FALL, true);
gpio_set_irq_enabled(GPIO_CSW, GPIO_IRQ_EDGE_FALL | GPIO_IRQ_EDGE_RISE, true);
gpio_set_irq_enabled(GPIO_CSR, GPIO_IRQ_EDGE_FALL | GPIO_IRQ_EDGE_RISE, true);
irq_set_enabled(IO_IRQ_BANK0, true);

// wait until everything else is ready, then run the vga loop
Expand Down Expand Up @@ -267,12 +272,18 @@ uint initClock(uint gpio, float freqHz)
return clkSm;
}


/* main entry point */
/*
* main entry point
*/
int main(void)
{
/* currently, VGA hard-coded to 640x480@60Hz. We want a high clock frequency
* that comes close to being divisible by 25.175MHz. 252.0 is close... enough :)
* I do have code which sets the best clock baased on the chosen VGA mode,
* but this'll do for now. */
set_sys_clock_khz(252000, false);

/* we need one of these. it's the main guy */
tms = vrEmuTms9918New();

/* set up the GPIO pins and interrupt handler */
Expand All @@ -282,7 +293,7 @@ int main(void)
initClock(GPIO_GROMCL, TMS_CRYSTAL_FREQ_HZ / 24.0f);
initClock(GPIO_CPUCL, TMS_CRYSTAL_FREQ_HZ / 3.0f);

/* Then set up VGA output */
/* then set up VGA output */
VgaInitParams params = { 0 };
params.params = vgaGetParams(VGA_640_480_60HZ, 2);
params.scanlineFn = tmsScanline;
Expand Down
19 changes: 0 additions & 19 deletions src/tms9918/CMakeLists.txt

This file was deleted.

202 changes: 0 additions & 202 deletions src/tms9918/tms9918.c

This file was deleted.

27 changes: 0 additions & 27 deletions src/tms9918/tms9918.h

This file was deleted.

File renamed without changes.
6 changes: 3 additions & 3 deletions src/tms9918/vga/vga-modes.c → src/vga/vga-modes.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* Project: pico-56 - vga
* Project: pico9918 - vga
*
* Copyright (c) 2023 Troy Schrapel
* Copyright (c) 2024 Troy Schrapel
*
* This code is licensed under the MIT license
*
* https://github.com/visrealm/pico-56
* https://github.com/visrealm/pico9918
*
*/

Expand Down
6 changes: 3 additions & 3 deletions src/tms9918/vga/vga-modes.h → src/vga/vga-modes.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* Project: pico-56 - vga
* Project: pico9918 - vga
*
* Copyright (c) 2023 Troy Schrapel
* Copyright (c) 2024 Troy Schrapel
*
* This code is licensed under the MIT license
*
* https://github.com/visrealm/pico-56
* https://github.com/visrealm/pico9918
*
*/

Expand Down
6 changes: 3 additions & 3 deletions src/tms9918/vga/vga.c → src/vga/vga.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* Project: pico-56 - vga
* Project: pico9918 - vga
*
* Copyright (c) 2023 Troy Schrapel
* Copyright (c) 2024 Troy Schrapel
*
* This code is licensed under the MIT license
*
* https://github.com/visrealm/pico-56
* https://github.com/visrealm/pico9918
*
*/

Expand Down
4 changes: 2 additions & 2 deletions src/tms9918/vga/vga.h → src/vga/vga.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Project: pico-56 - vga
* Project: pico9918 - vga
*
* Copyright (c) 2023 Troy Schrapel
* Copyright (c) 2024 Troy Schrapel
*
* This code is licensed under the MIT license
*
Expand Down
Loading

0 comments on commit 7a86b84

Please sign in to comment.