From 17832182b4f11b44b170145076463c5a80360414 Mon Sep 17 00:00:00 2001 From: FlightControl Date: Thu, 21 Jan 2021 19:51:09 +0100 Subject: [PATCH] Documented and cleaned up verlib.h and veralib.c --- src/main/kc/include/veralib.h | 14 ++++++++------ src/main/kc/lib/veralib.c | 28 ++++++++++++---------------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/main/kc/include/veralib.h b/src/main/kc/include/veralib.h index e38ffb6a8..c2393af5f 100644 --- a/src/main/kc/include/veralib.h +++ b/src/main/kc/include/veralib.h @@ -35,17 +35,19 @@ byte* vera_layer_hscroll_h[2] = {VERA_L0_HSCROLL_H, VERA_L1_HSCROLL_H}; byte vera_layer_textcolor[2] = {WHITE, WHITE}; byte vera_layer_backcolor[2] = {BLUE, BLUE}; +byte hscale[4] = {0,128,64,32}; + // --- VERA addressing --- -void vera_vram_bank_offset(byte bank, word offset, byte incr); -void vera_vram_address0(dword bankaddr, byte incr); -void vera_vram_address1(dword bankaddr, byte incr); +inline void vera_vram_bank_offset(byte bank, word offset, byte incr); +inline void vera_vram_address0(dword bankaddr, byte incr); +inline void vera_vram_address1(dword bankaddr, byte incr); // --- VERA active display management --- -void vera_display_set_scale_none(); -void vera_display_set_scale_double(); -void vera_display_set_scale_triple(); +inline void vera_display_set_scale_none(); +inline void vera_display_set_scale_double(); +inline void vera_display_set_scale_triple(); byte vera_display_get_hscale(); byte vera_display_get_vscale(); word vera_display_get_height(); diff --git a/src/main/kc/lib/veralib.c b/src/main/kc/lib/veralib.c index 023021e59..74fd95727 100644 --- a/src/main/kc/lib/veralib.c +++ b/src/main/kc/lib/veralib.c @@ -13,7 +13,7 @@ // --- VERA addressing --- -void vera_vram_bank_offset(byte bank, word offset, byte incr) { +inline void vera_vram_bank_offset(byte bank, word offset, byte incr) { // Select DATA0 *VERA_CTRL &= ~VERA_ADDRSEL; // Set address @@ -22,41 +22,37 @@ void vera_vram_bank_offset(byte bank, word offset, byte incr) { *VERA_ADDRX_H = bank | incr; } -void vera_vram_address0(dword bankaddr, byte incr) { - word* word_l = &(bankaddr); +inline void vera_vram_address0(dword bankaddr, byte incr) { // Select DATA0 *VERA_CTRL &= ~VERA_ADDRSEL; // Set address - *VERA_ADDRX_L = <(*word_l); - *VERA_ADDRX_M = >(*word_l); - *VERA_ADDRX_H = <(*word_h) | incr; + *VERA_ADDRX_L = <((bankaddr) | incr; } -void vera_vram_address1(dword bankaddr, byte incr) { - word* word_l = &(bankaddr); +inline void vera_vram_address1(dword bankaddr, byte incr) { // Select DATA1 *VERA_CTRL |= VERA_ADDRSEL; // Set address - *VERA_ADDRX_L = <(*word_l); - *VERA_ADDRX_M = >(*word_l); - *VERA_ADDRX_H = <(*word_h) | incr; + *VERA_ADDRX_L = <((bankaddr) | incr; } // --- VERA active display management --- -void vera_display_set_scale_none() { +inline void vera_display_set_scale_none() { *VERA_DC_HSCALE = 128; *VERA_DC_VSCALE = 128; } -void vera_display_set_scale_double() { +inline void vera_display_set_scale_double() { *VERA_DC_HSCALE = 64; *VERA_DC_VSCALE = 64; } -void vera_display_set_scale_triple() { +inline void vera_display_set_scale_triple() { *VERA_DC_HSCALE = 32; *VERA_DC_VSCALE = 32; }