From 4ab6d879d2efbb25898818f1a086d750aafb0d23 Mon Sep 17 00:00:00 2001 From: xrip Date: Wed, 20 Dec 2023 23:44:05 +0300 Subject: [PATCH] optimizations --- drivers/vga-nextgen/vga.c | 10 +++++----- src/audio/sn76489.c | 2 +- src/cpu.c | 6 +++--- src/main.cpp | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/vga-nextgen/vga.c b/drivers/vga-nextgen/vga.c index 8380eb9..47b500f 100644 --- a/drivers/vga-nextgen/vga.c +++ b/drivers/vga-nextgen/vga.c @@ -28,7 +28,7 @@ const struct pio_program pio_program_VGA = { }; -static uint32_t* lines_pattern[4]; +static uint32_t* __scratch_y("lines_pattern") lines_pattern[4]; static uint32_t* lines_pattern_data = NULL; static int _SM_VGA = -1; @@ -56,9 +56,9 @@ static bool is_flash_line = false; static bool is_flash_frame = false; //буфер 1к графической палитры -static uint16_t palette[2][256]; +static uint16_t __scratch_y("vga_driver_palette") palette[2][256]; -static uint32_t bg_color[2]; +static uint32_t __scratch_y("vga_driver_bgpalette") bg_color[2]; static uint16_t palette16_mask = 0; static uint8_t* text_buffer; @@ -67,7 +67,7 @@ static uint8_t* text_buf_color; static uint text_buffer_width = 0; static uint text_buffer_height = 0; -static uint16_t txt_palette[16]; +static uint16_t __scratch_y("vga_driver_txtpalette") txt_palette[16]; //буфер 2К текстовой палитры для быстрой работы static uint16_t* txt_palette_fast = NULL; @@ -77,7 +77,7 @@ enum graphics_mode_t graphics_mode; extern volatile bool manager_started; -void __not_in_flash_func(dma_handler_VGA)() { +void __scratch_y("vga_driver") dma_handler_VGA() { dma_hw->ints0 = 1u << dma_chan_ctrl; static uint32_t frame_number = 0; static uint32_t screen_line = 0; diff --git a/src/audio/sn76489.c b/src/audio/sn76489.c index cb79a1b..c75ba43 100644 --- a/src/audio/sn76489.c +++ b/src/audio/sn76489.c @@ -24,7 +24,7 @@ */ uint32_t clock = 3579545; const uint16_t samplerate = SOUND_FREQUENCY; -uint8_t quality = 0; +#define quality 0 uint32_t base_incr = 0; diff --git a/src/cpu.c b/src/cpu.c index 1d1d3df..9563ac1 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -670,7 +670,7 @@ INLINE void writerm8(uint8_t rmval, uint8_t value) { uint8_t tandy_hack = 0; -static void intcall86(uint8_t intnum) { +static void __time_critical_func(intcall86)(uint8_t intnum) { uint32_t tempcalc, memloc, n; switch (intnum) { #ifdef EMS_DRIVER @@ -3982,7 +3982,7 @@ void exec86(uint32_t execloops) { } // array of function pointers separated by 800h (32K) pages (less gradation to be implemented by "if" conditions) -static write_fn_ptr write_funtions[256] = { 0 }; +static write_fn_ptr __scratch_x("write_funcs") write_funtions[256] = { 0 }; static inline void write8video(uint32_t addr32, uint8_t v) { VIDEORAM[(ega_plane_offset + addr32 - VIDEORAM_START32) % VIDEORAM_SIZE] = v; @@ -4086,7 +4086,7 @@ static void write16low_swap(uint32_t addr32, uint16_t v) { } // array of function pointers separated by 800h (32K) pages (less gradation to be implemented by "if" conditions) -static read_fn_ptr read_funtions[256] = { 0 }; +static read_fn_ptr __scratch_x("write16_funtions") read_funtions[256] = { 0 }; uint8_t read8nothng(uint32_t addr32) { return 0; diff --git a/src/main.cpp b/src/main.cpp index 5cfdee7..c1bf7dc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -58,7 +58,7 @@ uint16_t true_covox = 0; struct semaphore vga_start_semaphore; /* Renderer loop on Pico's second core */ -void __time_critical_func(render_core)() { +void __scratch_y("second_core") second_core() { #ifdef SOUND_ENABLED #ifdef I2S_SOUND i2s_config.sample_freq = SOUND_FREQUENCY; @@ -262,7 +262,7 @@ int main() { keyboard_init(); sem_init(&vga_start_semaphore, 0, 1); - multicore_launch_core1(render_core); + multicore_launch_core1(second_core); sem_release(&vga_start_semaphore); sleep_ms(50);