liberis
|
Controls the KING processor. More...
#include <eris/types.h>
Go to the source code of this file.
Defines | |
#define | KING_CODE(off, type, rot, bg, nop) |
KING microprogram opcode generator. | |
Enumerations | |
enum | king_opcode { KING_CODE_BG0_CG_0 = KING_CODE(0, 0, 0, 0, 0), KING_CODE_BG0_CG_1 = KING_CODE(1, 0, 0, 0, 0), KING_CODE_BG0_CG_2 = KING_CODE(2, 0, 0, 0, 0), KING_CODE_BG0_CG_3 = KING_CODE(3, 0, 0, 0, 0), KING_CODE_BG0_CG_4 = KING_CODE(4, 0, 0, 0, 0), KING_CODE_BG0_CG_5 = KING_CODE(5, 0, 0, 0, 0), KING_CODE_BG0_CG_6 = KING_CODE(6, 0, 0, 0, 0), KING_CODE_BG0_CG_7 = KING_CODE(7, 0, 0, 0, 0), KING_CODE_BG0_BATCG_0 = KING_CODE(0, 1, 0, 0, 0), KING_CODE_BG0_BATCG_1 = KING_CODE(1, 1, 0, 0, 0), KING_CODE_BG0_BATCG_2 = KING_CODE(2, 1, 0, 0, 0), KING_CODE_BG0_BATCG_3 = KING_CODE(3, 1, 0, 0, 0), KING_CODE_BG0_BATCG_4 = KING_CODE(4, 1, 0, 0, 0), KING_CODE_BG0_BATCG_5 = KING_CODE(5, 1, 0, 0, 0), KING_CODE_BG0_BATCG_6 = KING_CODE(6, 1, 0, 0, 0), KING_CODE_BG0_BATCG_7 = KING_CODE(7, 1, 0, 0, 0), KING_CODE_BG0_BAT_0 = KING_CODE(0, 2, 0, 0, 0), KING_CODE_BG0_BAT_1 = KING_CODE(1, 2, 0, 0, 0), KING_CODE_BG0_BAT_2 = KING_CODE(2, 2, 0, 0, 0), KING_CODE_BG0_BAT_3 = KING_CODE(3, 2, 0, 0, 0), KING_CODE_BG0_BAT_4 = KING_CODE(4, 2, 0, 0, 0), KING_CODE_BG0_BAT_5 = KING_CODE(5, 2, 0, 0, 0), KING_CODE_BG0_BAT_6 = KING_CODE(6, 2, 0, 0, 0), KING_CODE_BG0_BAT_7 = KING_CODE(7, 2, 0, 0, 0), KING_CODE_BG1_CG_0 = KING_CODE(0, 0, 0, 1, 0), KING_CODE_BG1_CG_1 = KING_CODE(1, 0, 0, 1, 0), KING_CODE_BG1_CG_2 = KING_CODE(2, 0, 0, 1, 0), KING_CODE_BG1_CG_3 = KING_CODE(3, 0, 0, 1, 0), KING_CODE_BG1_CG_4 = KING_CODE(4, 0, 0, 1, 0), KING_CODE_BG1_CG_5 = KING_CODE(5, 0, 0, 1, 0), KING_CODE_BG1_CG_6 = KING_CODE(6, 0, 0, 1, 0), KING_CODE_BG1_CG_7 = KING_CODE(7, 0, 0, 1, 0), KING_CODE_BG1_BATCG_0 = KING_CODE(0, 1, 0, 1, 0), KING_CODE_BG1_BATCG_1 = KING_CODE(1, 1, 0, 1, 0), KING_CODE_BG1_BATCG_2 = KING_CODE(2, 1, 0, 1, 0), KING_CODE_BG1_BATCG_3 = KING_CODE(3, 1, 0, 1, 0), KING_CODE_BG1_BATCG_4 = KING_CODE(4, 1, 0, 1, 0), KING_CODE_BG1_BATCG_5 = KING_CODE(5, 1, 0, 1, 0), KING_CODE_BG1_BATCG_6 = KING_CODE(6, 1, 0, 1, 0), KING_CODE_BG1_BATCG_7 = KING_CODE(7, 1, 0, 1, 0), KING_CODE_BG1_BAT_0 = KING_CODE(0, 2, 0, 1, 0), KING_CODE_BG1_BAT_1 = KING_CODE(1, 2, 0, 1, 0), KING_CODE_BG1_BAT_2 = KING_CODE(2, 2, 0, 1, 0), KING_CODE_BG1_BAT_3 = KING_CODE(3, 2, 0, 1, 0), KING_CODE_BG1_BAT_4 = KING_CODE(4, 2, 0, 1, 0), KING_CODE_BG1_BAT_5 = KING_CODE(5, 2, 0, 1, 0), KING_CODE_BG1_BAT_6 = KING_CODE(6, 2, 0, 1, 0), KING_CODE_BG1_BAT_7 = KING_CODE(7, 2, 0, 1, 0), KING_CODE_BG2_CG_0 = KING_CODE(0, 0, 0, 2, 0), KING_CODE_BG2_CG_1 = KING_CODE(1, 0, 0, 2, 0), KING_CODE_BG2_CG_2 = KING_CODE(2, 0, 0, 2, 0), KING_CODE_BG2_CG_3 = KING_CODE(3, 0, 0, 2, 0), KING_CODE_BG2_CG_4 = KING_CODE(4, 0, 0, 2, 0), KING_CODE_BG2_CG_5 = KING_CODE(5, 0, 0, 2, 0), KING_CODE_BG2_CG_6 = KING_CODE(6, 0, 0, 2, 0), KING_CODE_BG2_CG_7 = KING_CODE(7, 0, 0, 2, 0), KING_CODE_BG2_BATCG_0 = KING_CODE(0, 1, 0, 2, 0), KING_CODE_BG2_BATCG_1 = KING_CODE(1, 1, 0, 2, 0), KING_CODE_BG2_BATCG_2 = KING_CODE(2, 1, 0, 2, 0), KING_CODE_BG2_BATCG_3 = KING_CODE(3, 1, 0, 2, 0), KING_CODE_BG2_BATCG_4 = KING_CODE(4, 1, 0, 2, 0), KING_CODE_BG2_BATCG_5 = KING_CODE(5, 1, 0, 2, 0), KING_CODE_BG2_BATCG_6 = KING_CODE(6, 1, 0, 2, 0), KING_CODE_BG2_BATCG_7 = KING_CODE(7, 1, 0, 2, 0), KING_CODE_BG2_BAT_0 = KING_CODE(0, 2, 0, 2, 0), KING_CODE_BG2_BAT_1 = KING_CODE(1, 2, 0, 2, 0), KING_CODE_BG2_BAT_2 = KING_CODE(2, 2, 0, 2, 0), KING_CODE_BG2_BAT_3 = KING_CODE(3, 2, 0, 2, 0), KING_CODE_BG2_BAT_4 = KING_CODE(4, 2, 0, 2, 0), KING_CODE_BG2_BAT_5 = KING_CODE(5, 2, 0, 2, 0), KING_CODE_BG2_BAT_6 = KING_CODE(6, 2, 0, 2, 0), KING_CODE_BG2_BAT_7 = KING_CODE(7, 2, 0, 2, 0), KING_CODE_BG3_CG_0 = KING_CODE(0, 0, 0, 3, 0), KING_CODE_BG3_CG_1 = KING_CODE(1, 0, 0, 3, 0), KING_CODE_BG3_CG_2 = KING_CODE(2, 0, 0, 3, 0), KING_CODE_BG3_CG_3 = KING_CODE(3, 0, 0, 3, 0), KING_CODE_BG3_CG_4 = KING_CODE(4, 0, 0, 3, 0), KING_CODE_BG3_CG_5 = KING_CODE(5, 0, 0, 3, 0), KING_CODE_BG3_CG_6 = KING_CODE(6, 0, 0, 3, 0), KING_CODE_BG3_CG_7 = KING_CODE(7, 0, 0, 3, 0), KING_CODE_BG3_BATCG_0 = KING_CODE(0, 1, 0, 3, 0), KING_CODE_BG3_BATCG_1 = KING_CODE(1, 1, 0, 3, 0), KING_CODE_BG3_BATCG_2 = KING_CODE(2, 1, 0, 3, 0), KING_CODE_BG3_BATCG_3 = KING_CODE(3, 1, 0, 3, 0), KING_CODE_BG3_BATCG_4 = KING_CODE(4, 1, 0, 3, 0), KING_CODE_BG3_BATCG_5 = KING_CODE(5, 1, 0, 3, 0), KING_CODE_BG3_BATCG_6 = KING_CODE(6, 1, 0, 3, 0), KING_CODE_BG3_BATCG_7 = KING_CODE(7, 1, 0, 3, 0), KING_CODE_BG3_BAT_0 = KING_CODE(0, 2, 0, 3, 0), KING_CODE_BG3_BAT_1 = KING_CODE(1, 2, 0, 3, 0), KING_CODE_BG3_BAT_2 = KING_CODE(2, 2, 0, 3, 0), KING_CODE_BG3_BAT_3 = KING_CODE(3, 2, 0, 3, 0), KING_CODE_BG3_BAT_4 = KING_CODE(4, 2, 0, 3, 0), KING_CODE_BG3_BAT_5 = KING_CODE(5, 2, 0, 3, 0), KING_CODE_BG3_BAT_6 = KING_CODE(6, 2, 0, 3, 0), KING_CODE_BG3_BAT_7 = KING_CODE(7, 2, 0, 3, 0), KING_CODE_ROTATE = KING_CODE(0, 0, 1, 0, 0), KING_CODE_NOP = KING_CODE(0, 0, 0, 0, 1) } |
KING microprogram opcodes. More... | |
enum | king_bgmode { KING_BGMODE_4_PAL = 0x1, KING_BGMODE_16_PAL = 0x2, KING_BGMODE_256_PAL = 0x3, KING_BGMODE_64K = 0x4, KING_BGMODE_16M = 0x5, KING_BGMODE_BAT = 0x8, KING_BGMODE_64K_BAT_EXTDOT = 0xE, KING_BGMODE_16M_BAT_EXTDOT = 0xF } |
Color mode for a KING background. More... | |
enum | king_bgprio { KING_BGPRIO_HIDE = 0, KING_BGPRIO_0 = 1, KING_BGPRIO_1 = 2, KING_BGPRIO_2 = 3, KING_BGPRIO_3 = 4 } |
Background priority. More... | |
enum | king_bgsize { KING_BGSIZE_8 = 3, KING_BGSIZE_16 = 4, KING_BGSIZE_32 = 5, KING_BGSIZE_64 = 6, KING_BGSIZE_128 = 7, KING_BGSIZE_256 = 8, KING_BGSIZE_512 = 9, KING_BGSIZE_1024 = 10 } |
Background axis size. More... | |
enum | king_bg { KING_BG0 = 0, KING_BG0SUB = 1, KING_BG1 = 2, KING_BG2 = 3, KING_BG3 = 4 } |
KING background. More... | |
Functions | |
void | eris_king_init (void) |
Initialize KING. | |
void | eris_king_set_kram_read (u32 addr, int incr) |
Set KRAM read address. | |
void | eris_king_set_kram_write (u32 addr, int incr) |
Set KRAM write address. | |
u16 | eris_king_kram_read (void) |
Read from KRAM. | |
void | eris_king_kram_write (u16 data) |
Write to KRAM. | |
void | eris_king_set_kram_pages (u8 scsi, u8 bg, u8 rainbow, u8 adpcm) |
Set the KRAM page for various peripherals. | |
void | eris_king_set_bg_mode (king_bgmode bg0, king_bgmode bg1, king_bgmode bg2, king_bgmode bg3) |
Set color modes for the backgrounds. | |
void | eris_king_set_bg_prio (king_bgprio bg0, king_bgprio bg1, king_bgprio bg2, king_bgprio bg3, int bgrot) |
Set priorities for the backgrounds. | |
void | eris_king_set_bg_size (king_bg bg, king_bgsize h, king_bgsize w, king_bgsize sub_h, king_bgsize sub_w) |
Set background sizes. | |
void | eris_king_set_bat_cg_addr (king_bg bg, u32 bat, u32 cg) |
Set background BAT and CG addresses. | |
void | eris_king_set_scroll (king_bg bg, s16 x, s16 y) |
Set background scrolling. | |
void | eris_king_write_microprogram (u16 *data, u8 addr, u8 len) |
Write the KING microprogram. | |
void | eris_king_fill_microprogram (u16 data, u8 addr, u8 len) |
Write the KING microprogram. | |
void | eris_king_enable_microprogram (void) |
Enable the KING microprogram. | |
void | eris_king_disable_microprogram (void) |
Disable the KING microprogram. |
Controls the KING processor.
#define KING_CODE | ( | off, | |
type, | |||
rot, | |||
bg, | |||
nop | |||
) |
(((off & 7) << 0) | ((type & 3) << 3) | ((rot & 1) << 5) | \ ((bg & 3) << 6) | ((nop & 1) << 8))
KING microprogram opcode generator.
off Offset. type Type of access. rot Rotate processing. bg Which background to operate on. nop Whether this is a NOP opcode or not.
enum king_bg |
enum king_bgmode |
Color mode for a KING background.
enum king_bgprio |
enum king_bgsize |
enum king_opcode |
KING microprogram opcodes.
Write the KING microprogram.
data | Opcode to fill microprogram with. |
addr | Address to start writing the microprogram. |
len | How many opcodes to write. |
u16 eris_king_kram_read | ( | void | ) |
Read from KRAM.
void eris_king_kram_write | ( | u16 | data | ) |
Write to KRAM.
data | Value to write to KRAM. |
Set background BAT and CG addresses.
bg | Which background to set the size of. |
bat | The KRAM address for the BAT. |
cg | The KRAM address of the CG. |
void eris_king_set_bg_mode | ( | king_bgmode | bg0, |
king_bgmode | bg1, | ||
king_bgmode | bg2, | ||
king_bgmode | bg3 | ||
) |
Set color modes for the backgrounds.
bg0 | Color mode for background 0. |
bg1 | Color mode for background 1. |
bg2 | Color mode for background 2. |
bg3 | Color mode for background 3. |
void eris_king_set_bg_prio | ( | king_bgprio | bg0, |
king_bgprio | bg1, | ||
king_bgprio | bg2, | ||
king_bgprio | bg3, | ||
int | bgrot | ||
) |
Set priorities for the backgrounds.
bg0 | Priority for background 0. |
bg1 | Priority for background 1. |
bg2 | Priority for background 2. |
bg3 | Priority for background 3. |
bgrot | Background 0 rotation enable. |
void eris_king_set_bg_size | ( | king_bg | bg, |
king_bgsize | h, | ||
king_bgsize | w, | ||
king_bgsize | sub_h, | ||
king_bgsize | sub_w | ||
) |
Set background sizes.
bg | Which background to set the size of (BG0SUB is not allowed). |
h | Height of the background. |
w | Width of the background. |
sub_h | Height of the sub background (BG0 only). |
sub_w | Width of the sub background (BG0 only). |
Set the KRAM page for various peripherals.
scsi | The KRAM page used for SCSI. (0 ~ 1) |
bg | The KRAM page used for backgrounds. (0 ~ 1) |
rainbow | The KRAM page used for RAINBOW. (0 ~ 1) |
adpcm | The KRAM page used for the ADPCM. (0 ~ 1) |
void eris_king_set_kram_read | ( | u32 | addr, |
int | incr | ||
) |
Set KRAM read address.
addr | New read address. |
incr | How many 16bit words to increase on every read. |
void eris_king_set_kram_write | ( | u32 | addr, |
int | incr | ||
) |
Set KRAM write address.
addr | New write address. |
incr | How many 16bit words to increase on every write. |
Set background scrolling.
bg | Which background to scroll (BG0SUB is not allowed). |
x | Signed X value correlating to the upper-left corner of the BG. |
y | Signed Y value correlating to the upper-left corner of the BG. |