1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-28 01:29:44 +00:00

Documented and cleaned up verlib.h and veralib.c

This commit is contained in:
FlightControl 2021-01-21 19:51:09 +01:00
parent 5157db5844
commit 17832182b4
2 changed files with 20 additions and 22 deletions

View File

@ -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();

View File

@ -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);
word* word_h = &(>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);
*VERA_ADDRX_M = >(<bankaddr);
*VERA_ADDRX_H = <(>bankaddr) | incr;
}
void vera_vram_address1(dword bankaddr, byte incr) {
word* word_l = &(<bankaddr);
word* word_h = &(>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);
*VERA_ADDRX_M = >(<bankaddr);
*VERA_ADDRX_H = <(>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;
}