Skip to content

Commit

Permalink
tv-link palette
Browse files Browse the repository at this point in the history
optimizations
  • Loading branch information
xrip committed Apr 21, 2024
1 parent ef5915d commit af8c4e1
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ const MenuItem menu_items[] = {
{"Swap AB <> BA: %s", ARRAY, &settings.swap_ab, nullptr, 1, {"NO ", "YES"}},
{},
{ "Ghosting pix: %i ", INT, &settings.ghosting, nullptr, 8 },
{ "Palette: %i ", INT, &settings.palette, nullptr, SV_COLOR_SCHEME_COUNT },
{ "Palette: %i ", INT, &settings.palette, nullptr, SV_COLOR_SCHEME_COUNT-1 },
#if VGA
{ "Keep aspect ratio: %s", ARRAY, &settings.aspect_ratio, nullptr, 1, {"NO ", "YES"}},
#endif
Expand Down Expand Up @@ -768,7 +768,7 @@ int frame_timer_start = 0;
static int audio_buffer[AUDIO_FREQ / 60] = { 0 };
static uint8_t buffer[AUDIO_BUFFER_SIZE] = { 0 };

int main() {
int __time_critical_func(main)() {
overclock();

sem_init(&vga_start_semaphore, 0, 1);
Expand Down
14 changes: 11 additions & 3 deletions src/potator/gpu.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma GCC optimize("Ofast")
#include "pico/platform.h"
#include "pico/platform.h"
#include "gpu.h"

Expand Down Expand Up @@ -189,10 +191,16 @@ static const uint8 palettes[SV_COLOR_SCHEME_COUNT][12] = {
0x48, 0x28, 0x10,
},
{ /* SV_COLOR_SCHEME_VIRTUAL_BOY */
0xE3, 0x00, 0x00,
0x95, 0x00, 0x00,
0x56, 0x00, 0x00,
0xE3, 0x00, 0x00,
0x95, 0x00, 0x00,
0x56, 0x00, 0x00,
0x00, 0x00, 0x00,
},
{ /* SV_TVLINK */
0x00, 0x00, 0x00,
0x00, 0x48, 0x55,
0x00, 0x91, 0xaa,
0xff, 0xff, 0xff,
},
};

Expand Down
4 changes: 3 additions & 1 deletion src/potator/m6502/m6502.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma GCC optimize("Ofast")
#include "pico/platform.h"
/** M65C02: portable 65C02 emulator **************************/
/** **/
/** M65C02.c **/
Expand Down Expand Up @@ -250,7 +252,7 @@ void Int6502(M6502 *R, byte Type)
/** returns INT_QUIT. It will return the PC at which **/
/** emulation stopped, and current register values in R. **/
/*************************************************************/
word Run6502(M6502 *R)
word __time_critical_func(Run6502)(M6502 *R)
{
register pair J, K;
register byte I;
Expand Down
2 changes: 1 addition & 1 deletion src/potator/memorymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void memorymap_set_dma_finished(void)
check_irq();
}

void memorymap_set_timer_shot(void)
inline void memorymap_set_timer_shot(void)
{
timer_shot = TRUE;
check_irq();
Expand Down
2 changes: 1 addition & 1 deletion src/potator/supervision.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ enum SV_COLOR {
, SV_COLOR_SCHEME_TI_83
, SV_COLOR_SCHEME_TRAVEL_WOOD
, SV_COLOR_SCHEME_VIRTUAL_BOY

,SV_TVLINK
, SV_COLOR_SCHEME_COUNT
};

Expand Down
4 changes: 3 additions & 1 deletion src/potator/timer.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma GCC optimize("Ofast")
#include "pico/platform.h"
#include "timer.h"

#include "memorymap.h"
Expand All @@ -21,7 +23,7 @@ void timer_write(uint8 data)
timer_activated = TRUE;
}

void timer_exec(uint32 cycles)
void __time_critical_func(timer_exec)(uint32 cycles)
{
if (timer_activated) {
timer_cycles -= cycles;
Expand Down
4 changes: 3 additions & 1 deletion src/potator/watara.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma GCC optimize("Ofast")
#include "pico/platform.h"

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
Expand Down Expand Up @@ -70,7 +72,7 @@ BOOL supervision_load(const uint8 *rom, uint32 romSize)
return TRUE;
}

void supervision_exec_ex(uint8 *backbuffer, int16 backbufferWidth, BOOL skipFrame)
void __time_critical_func(supervision_exec_ex)(uint8 *backbuffer, int16 backbufferWidth, BOOL skipFrame)
{
uint32 i, scan;
uint8 *regs = memorymap_getRegisters();
Expand Down

0 comments on commit af8c4e1

Please sign in to comment.