add CoreBits

This commit is contained in:
Zack Buhman 2024-12-27 08:08:44 -06:00
parent aa7bac0367
commit 18b63947bf
13 changed files with 560 additions and 656 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@
*.class *.class
*.out *.out
*.elf *.elf
*.bin
main main
print_class print_class
__pycache__ __pycache__

View File

@ -48,14 +48,15 @@ LIBGCC_OBJ = \
libgcc/_div_table.o libgcc/_div_table.o
CLASS_FILES = \ CLASS_FILES = \
p/DreamcastVideo.class.o \
java/lang/String.class.o \
java/lang/Integer.class.o \
java/lang/System.class.o \
java/io/PrintStream.class.o \ java/io/PrintStream.class.o \
java/lang/Integer.class.o \
java/lang/Object.class.o \ java/lang/Object.class.o \
java/lang/String.class.o \
java/lang/System.class.o \
java/misc/Memory.class.o \
p/DreamcastVideo2.class.o \
sega/dreamcast/holly/Holly.class.o \ sega/dreamcast/holly/Holly.class.o \
java/misc/Memory.class.o sega/dreamcast/holly/CoreBits.class.o
main.elf: LDSCRIPT = $(LIB)/main.lds main.elf: LDSCRIPT = $(LIB)/main.lds
main.elf: $(START_OBJ) $(OBJ) $(MAIN_OBJ) $(MAIN_DREAMCAST_OBJ) $(LIBGCC_OBJ) $(CLASS_FILES) main.elf: $(START_OBJ) $(OBJ) $(MAIN_OBJ) $(MAIN_DREAMCAST_OBJ) $(LIBGCC_OBJ) $(CLASS_FILES)

View File

@ -7,32 +7,34 @@
#include "sh7091_scif.h" #include "sh7091_scif.h"
#include "p/DreamcastVideo.class.h"
#include "java/lang/String.class.h"
#include "java/lang/Integer.class.h"
#include "java/lang/System.class.h"
#include "java/io/PrintStream.class.h" #include "java/io/PrintStream.class.h"
#include "java/lang/Integer.class.h"
#include "java/lang/Object.class.h" #include "java/lang/Object.class.h"
#include "sega/dreamcast/holly/Holly.class.h" #include "java/lang/String.class.h"
#include "java/lang/System.class.h"
#include "java/misc/Memory.class.h" #include "java/misc/Memory.class.h"
#include "p/DreamcastVideo2.class.h"
#include "sega/dreamcast/holly/Holly.class.h"
#include "sega/dreamcast/holly/CoreBits.class.h"
void main() void main()
{ {
scif_init(0); scif_init(0);
const uint8_t * class_file_buffers[] = { const uint8_t * class_file_buffers[] = {
(const uint8_t *)&_binary_p_DreamcastVideo_class_start,
(const uint8_t *)&_binary_java_lang_String_class_start,
(const uint8_t *)&_binary_java_lang_Integer_class_start,
(const uint8_t *)&_binary_java_lang_System_class_start,
(const uint8_t *)&_binary_java_io_PrintStream_class_start, (const uint8_t *)&_binary_java_io_PrintStream_class_start,
(const uint8_t *)&_binary_java_lang_Integer_class_start,
(const uint8_t *)&_binary_java_lang_Object_class_start, (const uint8_t *)&_binary_java_lang_Object_class_start,
(const uint8_t *)&_binary_sega_dreamcast_holly_Holly_class_start, (const uint8_t *)&_binary_java_lang_String_class_start,
(const uint8_t *)&_binary_java_lang_System_class_start,
(const uint8_t *)&_binary_java_misc_Memory_class_start, (const uint8_t *)&_binary_java_misc_Memory_class_start,
(const uint8_t *)&_binary_p_DreamcastVideo2_class_start,
(const uint8_t *)&_binary_sega_dreamcast_holly_Holly_class_start,
(const uint8_t *)&_binary_sega_dreamcast_holly_CoreBits_class_start,
}; };
int class_file_buffers_length = (sizeof (class_file_buffers)) / (sizeof (class_file_buffers[0])); int class_file_buffers_length = (sizeof (class_file_buffers)) / (sizeof (class_file_buffers[0]));
const uint8_t * main_class = (const uint8_t *)"p/DreamcastVideo"; const uint8_t * main_class = (const uint8_t *)"p/DreamcastVideo2";
int main_class_length = string_length((const char *)main_class); int main_class_length = string_length((const char *)main_class);
int class_hash_table_length; int class_hash_table_length;

View File

@ -1,3 +1,4 @@
python gen_decoder.py > c/decode.inc.c python gen_decoder.py > c/decode.inc.c
python regs/holly.py ../dreamcast/regs/holly.csv > sega/dreamcast/holly/Holly.java python regs/holly.py ../dreamcast/regs/holly.csv > sega/dreamcast/holly/Holly.java
python regs/holly_bits.py ../dreamcast/regs/core_bits.csv > sega/dreamcast/holly/HollyBits.java

15
p/DreamcastVideo2.class.h Normal file
View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_p_DreamcastVideo2_class_start __asm("_binary_p_DreamcastVideo2_class_start");
extern uint32_t _binary_p_DreamcastVideo2_class_end __asm("_binary_p_DreamcastVideo2_class_end");
extern uint32_t _binary_p_DreamcastVideo2_class_size __asm("_binary_p_DreamcastVideo2_class_size");
#ifdef __cplusplus
}
#endif

27
p/DreamcastVideo2.java Normal file
View File

@ -0,0 +1,27 @@
package p;
import sega.dreamcast.holly.Holly;
import sega.dreamcast.holly.CoreBits;
import java.misc.Memory;
class DreamcastVideo2 {
public static void main() {
System.out.print("FB_R_SOF1: ");
System.out.println(Memory.getU4(Holly.FB_R_SOF1));
System.out.print("FB_R_CTRL: ");
System.out.println(Memory.getU4(Holly.FB_R_CTRL));
int fb_r_ctrl =
CoreBits.fb_r_ctrl__vclk_div__pclk_vclk_1
| CoreBits.fb_r_ctrl__fb_depth__0888_rgb_32bit
| CoreBits.fb_r_ctrl__fb_enable;
Memory.putU4(Holly.FB_R_CTRL, fb_r_ctrl);
int red = 0x00ff7700;
int fb = 0xa5000000 + Memory.getU4(Holly.FB_R_SOF1);
for (int i = 0; i < 640 * 480; i++) {
Memory.putU4(fb + (i * 4), red);
}
}
}

View File

@ -2,16 +2,22 @@ from bits import sign_extend
from bits import mask_from_bits from bits import mask_from_bits
def generate_bit(bit): def generate_bit(bit):
#name = bit.bit_name
if bit.enum_name == "":
name = f"{bit.register_name}__{bit.bit_name}".lower()
else:
name = f"{bit.register_name}__{bit.enum_name}__{bit.bit_name}".lower()
if not bit.value and not bit.mask: if not bit.value and not bit.mask:
yield f"public static int {bit.bit_name}(int n) {{" yield f"public static int {name}(int n) {{"
yield f"return (n >> {min(bit.bits)}) & {sign_extend(mask_from_bits(bit.bits), 32)};" yield f"return (n >> {min(bit.bits)}) & {sign_extend(mask_from_bits(bit.bits), 32)};"
yield "}" yield "}"
elif bit.value: elif bit.value:
assert (bit.value is None) ^ (bit.mask is None), bit assert (bit.value is None) ^ (bit.mask is None), bit
yield f"public static final int {bit.bit_name} = {bit.value << min(bit.bits)};" yield f"public static final int {name} = {bit.value} << {min(bit.bits)};"
elif bit.mask: elif bit.mask:
assert (bit.value is None) ^ (bit.mask is None), bit assert (bit.value is None) ^ (bit.mask is None), bit
yield f"public static int {bit.bit_name}(int n) {{" yield f"public static int {name}(int n) {{"
if type(bit.mask) is str: if type(bit.mask) is str:
yield f"return (n & {sign_extend(mask_from_bits(bit.bits), 32)}) << {min(bit.bits)};" yield f"return (n & {sign_extend(mask_from_bits(bit.bits), 32)}) << {min(bit.bits)};"
else: else:
@ -29,16 +35,15 @@ def generate_enums(enum_group):
if enum_name == "": if enum_name == "":
yield from generate_bits(bits) yield from generate_bits(bits)
else: else:
yield f"public class {enum_name} {{" #yield f"public class {enum_name} {{"
yield from generate_bits(bits) yield from generate_bits(bits)
yield "}" #yield "}"
def generate_registers(package_name, class_name, group): def generate_registers(package_name, class_name, group):
yield f"package sega.dreamcast.{package_name};" yield f"package sega.dreamcast.{package_name};"
yield ""
yield f"public class {class_name} {{" yield f"public class {class_name} {{"
for register_name, enum_group in group.items(): for register_name, enum_group in group.items():
yield f"public class {register_name} {{" #yield f"public class {register_name.lower()} {{"
yield from generate_enums(enum_group) yield from generate_enums(enum_group)
yield "}" #yield "}"
yield "}" yield "}"

View File

@ -11,5 +11,5 @@ if __name__ == "__main__":
rows = read_input(sys.argv[1]) rows = read_input(sys.argv[1])
group = group_by_register_enum(map(parse_row, rows)) group = group_by_register_enum(map(parse_row, rows))
render, out = renderer(indent_length=4) render, out = renderer(indent_length=4)
render(generate_registers("holly", "HollyBits", group)) render(generate_registers("holly", "CoreBits", group))
sys.stdout.write(out.getvalue()) sys.stdout.write(out.getvalue())

View File

@ -8,7 +8,6 @@ def generate_register(base_address, register):
def generate_classes(package_name, base_address, blocks): def generate_classes(package_name, base_address, blocks):
yield f"package sega.dreamcast.{package_name};" yield f"package sega.dreamcast.{package_name};"
yield ""
for block, registers in blocks: for block, registers in blocks:
yield f"public class {block.capitalize()} {{" yield f"public class {block.capitalize()} {{"
for register in registers: for register in registers:

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_sega_dreamcast_holly_CoreBits_class_start __asm("_binary_sega_dreamcast_holly_CoreBits_class_start");
extern uint32_t _binary_sega_dreamcast_holly_CoreBits_class_end __asm("_binary_sega_dreamcast_holly_CoreBits_class_end");
extern uint32_t _binary_sega_dreamcast_holly_CoreBits_class_size __asm("_binary_sega_dreamcast_holly_CoreBits_class_size");
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,468 @@
package sega.dreamcast.holly;
public class CoreBits {
public static int id__device_id(int n) {
return (n >> 16) & 65535;
}
public static int id__vendor_id(int n) {
return (n >> 0) & 65535;
}
public static int revision__chip_revision(int n) {
return (n >> 0) & 65535;
}
public static final int softreset__sdram_if_soft_reset = 1 << 2;
public static final int softreset__pipeline_soft_reset = 1 << 1;
public static final int softreset__ta_soft_reset = 1 << 0;
public static final int startrender__start_render = 1 << 0;
public static int test_select__diagdb_data(int n) {
return (n >> 5) & 31;
}
public static int test_select__diagda_data(int n) {
return (n >> 0) & 31;
}
public static int param_base__base_address(int n) {
return (n & 15728640) << 0;
}
public static int region_base__base_address(int n) {
return (n & 16777212) << 0;
}
public static final int span_sort_cfg__cache_bypass = 1 << 16;
public static final int span_sort_cfg__offset_sort_enable = 1 << 8;
public static final int span_sort_cfg__span_sort_enable = 1 << 0;
public static int vo_border_col__chroma(int n) {
return (n & 1) << 24;
}
public static int vo_border_col__red(int n) {
return (n & 255) << 16;
}
public static int vo_border_col__green(int n) {
return (n & 255) << 8;
}
public static int vo_border_col__blue(int n) {
return (n & 255) << 0;
}
public static int fb_r_ctrl__vclk_div__pclk_vclk_2(int n) {
return (n >> 23) & 1;
}
public static final int fb_r_ctrl__vclk_div__pclk_vclk_1 = 1 << 23;
public static final int fb_r_ctrl__fb_strip_buf_en = 1 << 22;
public static int fb_r_ctrl__fb_stripsize(int n) {
return (n & 62) << 16;
}
public static int fb_r_ctrl__fb_chroma_threshold(int n) {
return (n & 255) << 8;
}
public static int fb_r_ctrl__fb_concat(int n) {
return (n & 3) << 4;
}
public static final int fb_r_ctrl__fb_line_double = 1 << 1;
public static final int fb_r_ctrl__fb_enable = 1 << 0;
public static int fb_r_ctrl__fb_depth__0555_rgb_16bit(int n) {
return (n >> 2) & 3;
}
public static final int fb_r_ctrl__fb_depth__565_rgb_16bit = 1 << 2;
public static final int fb_r_ctrl__fb_depth__888_rgb_24bit_packed = 2 << 2;
public static final int fb_r_ctrl__fb_depth__0888_rgb_32bit = 3 << 2;
public static int fb_w_ctrl__fb_alpha_threshold(int n) {
return (n & 255) << 16;
}
public static int fb_w_ctrl__fb_kval(int n) {
return (n & 255) << 8;
}
public static final int fb_w_ctrl__fb_dither = 1 << 3;
public static int fb_w_ctrl__fb_packmode__0555_krgb_16bit(int n) {
return (n >> 0) & 7;
}
public static final int fb_w_ctrl__fb_packmode__565_rgb_16bit = 1 << 0;
public static final int fb_w_ctrl__fb_packmode__4444_argb_16bit = 2 << 0;
public static final int fb_w_ctrl__fb_packmode__1555_argb_16bit = 3 << 0;
public static final int fb_w_ctrl__fb_packmode__888_rgb_24bit_packed = 4 << 0;
public static final int fb_w_ctrl__fb_packmode__0888_krgb_32bit = 5 << 0;
public static final int fb_w_ctrl__fb_packmode__8888_argb_32bit = 6 << 0;
public static int fb_w_linestride__fb_line_stride(int n) {
return (n & 255) << 0;
}
public static int fb_r_sof1__frame_buffer_read_address_frame_1(int n) {
return (n & 16777212) << 0;
}
public static int fb_r_sof2__frame_buffer_read_address_frame_2(int n) {
return (n & 16777212) << 0;
}
public static int fb_r_size__fb_modulus(int n) {
return (n & 1023) << 20;
}
public static int fb_r_size__fb_y_size(int n) {
return (n & 1023) << 10;
}
public static int fb_r_size__fb_x_size(int n) {
return (n & 1023) << 0;
}
public static int fb_w_sof1__frame_buffer_write_address_frame_1(int n) {
return (n & 33554428) << 0;
}
public static int fb_w_sof2__frame_buffer_write_address_frame_2(int n) {
return (n & 33554428) << 0;
}
public static int fb_x_clip__fb_x_clip_max(int n) {
return (n & 2047) << 16;
}
public static int fb_x_clip__fb_x_clip_min(int n) {
return (n & 2047) << 0;
}
public static int fb_y_clip__fb_y_clip_max(int n) {
return (n & 1023) << 16;
}
public static int fb_y_clip__fb_y_clip_min(int n) {
return (n & 1023) << 0;
}
public static int fpu_shad_scale__simple_shadow_enable__parameter_selection_volume_mode(int n) {
return (n >> 8) & 1;
}
public static final int fpu_shad_scale__simple_shadow_enable__intensity_volume_mode = 1 << 8;
public static int fpu_shad_scale__scale_factor_for_shadows(int n) {
return (n & 255) << 0;
}
public static int fpu_cull_val__culling_comparison_value(int n) {
return (n & 2147483647) << 0;
}
public static int fpu_param_cfg__region_header_type__type_1(int n) {
return (n >> 21) & 1;
}
public static final int fpu_param_cfg__region_header_type__type_2 = 1 << 21;
public static int fpu_param_cfg__tsp_parameter_burst_threshold(int n) {
return (n & 63) << 14;
}
public static int fpu_param_cfg__isp_parameter_burst_threshold(int n) {
return (n & 63) << 8;
}
public static int fpu_param_cfg__pointer_burst_size(int n) {
return (n & 15) << 4;
}
public static int fpu_param_cfg__pointer_first_burst_size(int n) {
return (n & 15) << 0;
}
public static final int half_offset__tsp_texel_sampling_position__top_left = 1 << 2;
public static final int half_offset__tsp_texel_sampling_position__center = 1 << 2;
public static final int half_offset__tsp_pixel_sampling_position__top_left = 1 << 1;
public static final int half_offset__tsp_pixel_sampling_position__center = 1 << 1;
public static final int half_offset__fpu_pixel_sampling_position__top_left = 1 << 0;
public static final int half_offset__fpu_pixel_sampling_position__center = 1 << 0;
public static int fpu_perp_val__perpendicular_triangle_compare(int n) {
return (n & 2147483647) << 0;
}
public static int isp_backgnd_d__background_plane_depth(int n) {
return (n & 268435455) << 4;
}
public static final int isp_backgnd_t__cache_bypass = 1 << 28;
public static final int isp_backgnd_t__shadow = 1 << 27;
public static int isp_backgnd_t__skip(int n) {
return (n & 7) << 24;
}
public static int isp_backgnd_t__tag_address(int n) {
return (n & 2097151) << 3;
}
public static int isp_backgnd_t__tag_offset(int n) {
return (n & 7) << 0;
}
public static int isp_feed_cfg__cache_size_for_translucency(int n) {
return (n & 1023) << 14;
}
public static int isp_feed_cfg__punch_through_chunk_size(int n) {
return (n & 1023) << 4;
}
public static final int isp_feed_cfg__discard_mode = 1 << 3;
public static final int isp_feed_cfg__pre_sort_mode = 1 << 0;
public static int sdram_refresh__refresh_counter_value(int n) {
return (n & 255) << 0;
}
public static int sdram_arb_cfg__override_value__priority_only(int n) {
return (n >> 18) & 15;
}
public static final int sdram_arb_cfg__override_value__rendered_data = 1 << 18;
public static final int sdram_arb_cfg__override_value__texture_vq_index = 2 << 18;
public static final int sdram_arb_cfg__override_value__texture_normal_data_and_vq_codebook = 3 << 18;
public static final int sdram_arb_cfg__override_value__tile_accelerator_isp_tsp_data = 4 << 18;
public static final int sdram_arb_cfg__override_value__tile_accelerator_pointers = 5 << 18;
public static final int sdram_arb_cfg__override_value__sh4 = 6 << 18;
public static final int sdram_arb_cfg__override_value__tsp_parameters = 7 << 18;
public static final int sdram_arb_cfg__override_value__tsp_region_data = 8 << 18;
public static final int sdram_arb_cfg__override_value__isp_pointer_data = 9 << 18;
public static final int sdram_arb_cfg__override_value__isp_parameters = 10 << 18;
public static final int sdram_arb_cfg__override_value__crt_controller = 11 << 18;
public static int sdram_arb_cfg__arbiter_priority_control__priority_arbitration_only(int n) {
return (n >> 16) & 3;
}
public static final int sdram_arb_cfg__arbiter_priority_control__override_value_field = 1 << 16;
public static final int sdram_arb_cfg__arbiter_priority_control__round_robin_counter = 2 << 16;
public static int sdram_arb_cfg__arbiter_crt_page_break_latency_count_value(int n) {
return (n & 255) << 8;
}
public static int sdram_arb_cfg__arbiter_page_break_latency_count_value(int n) {
return (n & 255) << 0;
}
public static int sdram_cfg__read_command_to_returned_data_delay(int n) {
return (n & 7) << 26;
}
public static int sdram_cfg__cas_latency_value(int n) {
return (n & 7) << 23;
}
public static int sdram_cfg__activate_to_activate_period(int n) {
return (n & 3) << 21;
}
public static int sdram_cfg__read_to_write_period(int n) {
return (n & 7) << 18;
}
public static int sdram_cfg__refresh_to_activate_period(int n) {
return (n & 15) << 14;
}
public static int sdram_cfg__pre_charge_to_activate_period(int n) {
return (n & 3) << 10;
}
public static int sdram_cfg__activate_to_pre_charge_period(int n) {
return (n & 15) << 6;
}
public static int sdram_cfg__activate_to_read_write_command_period(int n) {
return (n & 3) << 4;
}
public static int sdram_cfg__write_to_pre_charge_period(int n) {
return (n & 3) << 2;
}
public static int sdram_cfg__read_to_pre_charge_period(int n) {
return (n & 3) << 0;
}
public static int fog_col_ram__red(int n) {
return (n & 255) << 16;
}
public static int fog_col_ram__green(int n) {
return (n & 255) << 8;
}
public static int fog_col_ram__blue(int n) {
return (n & 255) << 0;
}
public static int fog_col_vert__red(int n) {
return (n & 255) << 16;
}
public static int fog_col_vert__green(int n) {
return (n & 255) << 8;
}
public static int fog_col_vert__blue(int n) {
return (n & 255) << 0;
}
public static int fog_density__fog_scale_mantissa(int n) {
return (n & 255) << 8;
}
public static int fog_density__fog_scale_exponent(int n) {
return (n & 255) << 0;
}
public static int fog_clamp_max__alpha(int n) {
return (n & 255) << 24;
}
public static int fog_clamp_max__red(int n) {
return (n & 255) << 16;
}
public static int fog_clamp_max__green(int n) {
return (n & 255) << 8;
}
public static int fog_clamp_max__blue(int n) {
return (n & 255) << 0;
}
public static int fog_clamp_min__alpha(int n) {
return (n & 255) << 24;
}
public static int fog_clamp_min__red(int n) {
return (n & 255) << 16;
}
public static int fog_clamp_min__green(int n) {
return (n & 255) << 8;
}
public static int fog_clamp_min__blue(int n) {
return (n & 255) << 0;
}
public static int spg_trigger_pos__trigger_v_count(int n) {
return (n >> 16) & 1023;
}
public static int spg_trigger_pos__trigger_h_count(int n) {
return (n >> 0) & 1023;
}
public static int spg_hblank_int__hblank_in_interrupt(int n) {
return (n >> 16) & 1023;
}
public static int spg_hblank_int__line_comp_val(int n) {
return (n & 1023) << 0;
}
public static int spg_hblank_int__hblank_int_mode__output_equal_line_comp_val(int n) {
return (n >> 12) & 3;
}
public static final int spg_hblank_int__hblank_int_mode__output_every_line_comp_val = 1 << 12;
public static final int spg_hblank_int__hblank_int_mode__output_every_line = 2 << 12;
public static int spg_vblank_int__vblank_out_interrupt_line_number(int n) {
return (n & 1023) << 16;
}
public static int spg_vblank_int__vblank_in_interrupt_line_number(int n) {
return (n & 1023) << 0;
}
public static int spg_control__csync_on_h__hsync(int n) {
return (n >> 9) & 1;
}
public static final int spg_control__csync_on_h__csync = 1 << 9;
public static int spg_control__sync_direction__input(int n) {
return (n >> 8) & 1;
}
public static final int spg_control__sync_direction__output = 1 << 8;
public static final int spg_control__pal = 1 << 7;
public static final int spg_control__ntsc = 1 << 6;
public static final int spg_control__force_field2 = 1 << 5;
public static final int spg_control__interlace = 1 << 4;
public static final int spg_control__spg_lock = 1 << 3;
public static int spg_control__mcsync_pol__active_low(int n) {
return (n >> 2) & 1;
}
public static final int spg_control__mcsync_pol__active_high = 1 << 2;
public static int spg_control__mvsync_pol__active_low(int n) {
return (n >> 1) & 1;
}
public static final int spg_control__mvsync_pol__active_high = 1 << 1;
public static int spg_control__mhsync_pol__active_low(int n) {
return (n >> 0) & 1;
}
public static final int spg_control__mhsync_pol__active_high = 1 << 0;
public static int spg_hblank__hbend(int n) {
return (n & 1023) << 16;
}
public static int spg_hblank__hbstart(int n) {
return (n & 1023) << 0;
}
public static int spg_load__vcount(int n) {
return (n & 1023) << 16;
}
public static int spg_load__hcount(int n) {
return (n & 1023) << 0;
}
public static int spg_vblank__vbend(int n) {
return (n & 1023) << 16;
}
public static int spg_vblank__vbstart(int n) {
return (n & 1023) << 0;
}
public static int spg_width__eqwidth(int n) {
return (n & 1023) << 22;
}
public static int spg_width__bpwidth(int n) {
return (n & 1023) << 12;
}
public static int spg_width__vswidth(int n) {
return (n & 15) << 8;
}
public static int spg_width__hswidth(int n) {
return (n & 127) << 0;
}
public static int text_control__code_book_endian__little_endian(int n) {
return (n >> 17) & 1;
}
public static final int text_control__code_book_endian__big_endian = 1 << 17;
public static int text_control__index_endian__little_endian(int n) {
return (n >> 16) & 1;
}
public static final int text_control__index_endian__big_endian = 1 << 16;
public static int text_control__bank_bit(int n) {
return (n & 31) << 8;
}
public static int text_control__stride(int n) {
return (n & 31) << 0;
}
public static final int vo_control__pclk_delay_reset = 1 << 21;
public static int vo_control__pclk_delay(int n) {
return (n & 31) << 16;
}
public static final int vo_control__pixel_double = 1 << 8;
public static final int vo_control__blank_video = 1 << 3;
public static int vo_control__field_mode__use_field_flag_from_spg(int n) {
return (n >> 4) & 15;
}
public static final int vo_control__field_mode__use_inverse_of_field_flag_from_spg = 1 << 4;
public static final int vo_control__field_mode__field_1_fixed = 2 << 4;
public static final int vo_control__field_mode__field_2_fixed = 3 << 4;
public static final int vo_control__field_mode__field_1_when_the_active_edges_of_hsync_and_vsync_match = 4 << 4;
public static final int vo_control__field_mode__field_2_when_the_active_edges_of_hsync_and_vsync_match = 5 << 4;
public static final int vo_control__field_mode__field_1_when_hsync_becomes_active_in_the_middle_of_the_vsync_active_edge = 6 << 4;
public static final int vo_control__field_mode__field_2_when_hsync_becomes_active_in_the_middle_of_the_vsync_active_edge = 7 << 4;
public static final int vo_control__field_mode__inverted_at_the_active_edge_of_vsync = 8 << 4;
public static int vo_control__blank_pol__active_low(int n) {
return (n >> 2) & 1;
}
public static final int vo_control__blank_pol__active_high = 1 << 2;
public static int vo_control__vsync_pol__active_low(int n) {
return (n >> 1) & 1;
}
public static final int vo_control__vsync_pol__active_high = 1 << 1;
public static int vo_control__hsync_pol__active_low(int n) {
return (n >> 0) & 1;
}
public static final int vo_control__hsync_pol__active_high = 1 << 0;
public static int vo_startx__horizontal_start_position(int n) {
return (n & 1023) << 0;
}
public static int vo_starty__vertical_start_position_on_field_2(int n) {
return (n & 1023) << 16;
}
public static int vo_starty__vertical_start_position_on_field_1(int n) {
return (n & 1023) << 0;
}
public static int scaler_ctl__field_select__field_1(int n) {
return (n >> 18) & 1;
}
public static final int scaler_ctl__field_select__field_2 = 1 << 18;
public static final int scaler_ctl__interlace = 1 << 17;
public static final int scaler_ctl__horizontal_scaling_enable = 1 << 16;
public static int scaler_ctl__vertical_scale_factor(int n) {
return (n & 65535) << 0;
}
public static int pal_ram_ctrl__pixel_format__argb1555(int n) {
return (n >> 0) & 3;
}
public static final int pal_ram_ctrl__pixel_format__rgb565 = 1 << 0;
public static final int pal_ram_ctrl__pixel_format__argb4444 = 2 << 0;
public static final int pal_ram_ctrl__pixel_format__argb8888 = 3 << 0;
public static int spg_status__vsync(int n) {
return (n >> 13) & 1;
}
public static int spg_status__hsync(int n) {
return (n >> 12) & 1;
}
public static int spg_status__blank(int n) {
return (n >> 11) & 1;
}
public static int spg_status__fieldnum(int n) {
return (n >> 10) & 1;
}
public static int spg_status__scanline(int n) {
return (n >> 0) & 1023;
}
public static int fb_burstctrl__wr_burst(int n) {
return (n & 15) << 16;
}
public static int fb_burstctrl__vid_lat(int n) {
return (n & 127) << 8;
}
public static int fb_burstctrl__vid_burst(int n) {
return (n & 63) << 0;
}
public static int fb_c_sof__frame_buffer_current_read_address(int n) {
return (n >> 0) & 16777215;
}
public static int y_coeff__coefficient_1(int n) {
return (n & 255) << 8;
}
public static int y_coeff__coefficient_0_2(int n) {
return (n & 255) << 0;
}
public static int pt_alpha_ref__alpha_reference_for_punch_through(int n) {
return (n & 255) << 0;
}
public static int fog_table__fog_table_data(int n) {
return (n & 65535) << 0;
}
public static int palette_ram__palette_data(int n) {
return (n & -1) << 0;
}
}

View File

@ -1,6 +1,5 @@
package sega.dreamcast.holly; package sega.dreamcast.holly;
public class Holly { public class Holly {
public static final int ID = 0xa05f8000; public static final int ID = 0xa05f8000;
public static final int REVISION = 0xa05f8004; public static final int REVISION = 0xa05f8004;

View File

@ -1,629 +0,0 @@
package sega.dreamcast.holly;
public class HollyBits {
public class ID {
public static int device_id(int n) {
return (n >> 16) & 65535;
}
public static int vendor_id(int n) {
return (n >> 0) & 65535;
}
}
public class REVISION {
public static int chip_revision(int n) {
return (n >> 0) & 65535;
}
}
public class SOFTRESET {
public static final int sdram_if_soft_reset = 4;
public static final int pipeline_soft_reset = 2;
public static final int ta_soft_reset = 1;
}
public class STARTRENDER {
public static final int start_render = 1;
}
public class TEST_SELECT {
public static int diagdb_data(int n) {
return (n >> 5) & 31;
}
public static int diagda_data(int n) {
return (n >> 0) & 31;
}
}
public class PARAM_BASE {
public static int base_address(int n) {
return (n & 15728640) << 0;
}
}
public class REGION_BASE {
public static int base_address(int n) {
return (n & 16777212) << 0;
}
}
public class SPAN_SORT_CFG {
public static final int cache_bypass = 65536;
public static final int offset_sort_enable = 256;
public static final int span_sort_enable = 1;
}
public class VO_BORDER_COL {
public static int chroma(int n) {
return (n & 1) << 24;
}
public static int red(int n) {
return (n & 255) << 16;
}
public static int green(int n) {
return (n & 255) << 8;
}
public static int blue(int n) {
return (n & 255) << 0;
}
}
public class FB_R_CTRL {
public class vclk_div {
public static int pclk_vclk_2(int n) {
return (n >> 23) & 1;
}
public static final int pclk_vclk_1 = 8388608;
}
public static final int fb_strip_buf_en = 4194304;
public static int fb_stripsize(int n) {
return (n & 62) << 16;
}
public static int fb_chroma_threshold(int n) {
return (n & 255) << 8;
}
public static int fb_concat(int n) {
return (n & 3) << 4;
}
public static final int fb_line_double = 2;
public static final int fb_enable = 1;
public class fb_depth {
public static int _0555_rgb_16bit(int n) {
return (n >> 2) & 3;
}
public static final int _0565_rgb_16bit = 4;
public static final int _888_rgb_24bit_packed = 8;
public static final int _0888_rgb_32bit = 12;
}
}
public class FB_W_CTRL {
public static int fb_alpha_threshold(int n) {
return (n & 255) << 16;
}
public static int fb_kval(int n) {
return (n & 255) << 8;
}
public static final int fb_dither = 8;
public class fb_packmode {
public static int _0555_krgb_16bit(int n) {
return (n >> 0) & 7;
}
public static final int _565_rgb_16bit = 1;
public static final int _4444_argb_16bit = 2;
public static final int _1555_argb_16bit = 3;
public static final int _888_rgb_24bit_packed = 4;
public static final int _0888_krgb_32bit = 5;
public static final int _8888_argb_32bit = 6;
}
}
public class FB_W_LINESTRIDE {
public static int fb_line_stride(int n) {
return (n & 255) << 0;
}
}
public class FB_R_SOF1 {
public static int frame_buffer_read_address_frame_1(int n) {
return (n & 16777212) << 0;
}
}
public class FB_R_SOF2 {
public static int frame_buffer_read_address_frame_2(int n) {
return (n & 16777212) << 0;
}
}
public class FB_R_SIZE {
public static int fb_modulus(int n) {
return (n & 1023) << 20;
}
public static int fb_y_size(int n) {
return (n & 1023) << 10;
}
public static int fb_x_size(int n) {
return (n & 1023) << 0;
}
}
public class FB_W_SOF1 {
public static int frame_buffer_write_address_frame_1(int n) {
return (n & 33554428) << 0;
}
}
public class FB_W_SOF2 {
public static int frame_buffer_write_address_frame_2(int n) {
return (n & 33554428) << 0;
}
}
public class FB_X_CLIP {
public static int fb_x_clip_max(int n) {
return (n & 2047) << 16;
}
public static int fb_x_clip_min(int n) {
return (n & 2047) << 0;
}
}
public class FB_Y_CLIP {
public static int fb_y_clip_max(int n) {
return (n & 1023) << 16;
}
public static int fb_y_clip_min(int n) {
return (n & 1023) << 0;
}
}
public class FPU_SHAD_SCALE {
public class simple_shadow_enable {
public static int parameter_selection_volume_mode(int n) {
return (n >> 8) & 1;
}
public static final int intensity_volume_mode = 256;
}
public static int scale_factor_for_shadows(int n) {
return (n & 255) << 0;
}
}
public class FPU_CULL_VAL {
public static int culling_comparison_value(int n) {
return (n & 2147483647) << 0;
}
}
public class FPU_PARAM_CFG {
public class region_header_type {
public static int type_1(int n) {
return (n >> 21) & 1;
}
public static final int type_2 = 2097152;
}
public static int tsp_parameter_burst_threshold(int n) {
return (n & 63) << 14;
}
public static int isp_parameter_burst_threshold(int n) {
return (n & 63) << 8;
}
public static int pointer_burst_size(int n) {
return (n & 15) << 4;
}
public static int pointer_first_burst_size(int n) {
return (n & 15) << 0;
}
}
public class HALF_OFFSET {
public class tsp_texel_sampling_position {
public static final int top_left = 4;
public static final int center = 4;
}
public class tsp_pixel_sampling_position {
public static final int top_left = 2;
public static final int center = 2;
}
public class fpu_pixel_sampling_position {
public static final int top_left = 1;
public static final int center = 1;
}
}
public class FPU_PERP_VAL {
public static int perpendicular_triangle_compare(int n) {
return (n & 2147483647) << 0;
}
}
public class ISP_BACKGND_D {
public static int background_plane_depth(int n) {
return (n & 268435455) << 4;
}
}
public class ISP_BACKGND_T {
public static final int cache_bypass = 268435456;
public static final int shadow = 134217728;
public static int skip(int n) {
return (n & 7) << 24;
}
public static int tag_address(int n) {
return (n & 2097151) << 3;
}
public static int tag_offset(int n) {
return (n & 7) << 0;
}
}
public class ISP_FEED_CFG {
public static int cache_size_for_translucency(int n) {
return (n & 1023) << 14;
}
public static int punch_through_chunk_size(int n) {
return (n & 1023) << 4;
}
public static final int discard_mode = 8;
public static final int pre_sort_mode = 1;
}
public class SDRAM_REFRESH {
public static int refresh_counter_value(int n) {
return (n & 255) << 0;
}
}
public class SDRAM_ARB_CFG {
public class override_value {
public static int priority_only(int n) {
return (n >> 18) & 15;
}
public static final int rendered_data = 262144;
public static final int texture_vq_index = 524288;
public static final int texture_normal_data_and_vq_codebook = 786432;
public static final int tile_accelerator_isp_tsp_data = 1048576;
public static final int tile_accelerator_pointers = 1310720;
public static final int sh4 = 1572864;
public static final int tsp_parameters = 1835008;
public static final int tsp_region_data = 2097152;
public static final int isp_pointer_data = 2359296;
public static final int isp_parameters = 2621440;
public static final int crt_controller = 2883584;
}
public class arbiter_priority_control {
public static int priority_arbitration_only(int n) {
return (n >> 16) & 3;
}
public static final int override_value_field = 65536;
public static final int round_robin_counter = 131072;
}
public static int arbiter_crt_page_break_latency_count_value(int n) {
return (n & 255) << 8;
}
public static int arbiter_page_break_latency_count_value(int n) {
return (n & 255) << 0;
}
}
public class SDRAM_CFG {
public static int read_command_to_returned_data_delay(int n) {
return (n & 7) << 26;
}
public static int cas_latency_value(int n) {
return (n & 7) << 23;
}
public static int activate_to_activate_period(int n) {
return (n & 3) << 21;
}
public static int read_to_write_period(int n) {
return (n & 7) << 18;
}
public static int refresh_to_activate_period(int n) {
return (n & 15) << 14;
}
public static int pre_charge_to_activate_period(int n) {
return (n & 3) << 10;
}
public static int activate_to_pre_charge_period(int n) {
return (n & 15) << 6;
}
public static int activate_to_read_write_command_period(int n) {
return (n & 3) << 4;
}
public static int write_to_pre_charge_period(int n) {
return (n & 3) << 2;
}
public static int read_to_pre_charge_period(int n) {
return (n & 3) << 0;
}
}
public class FOG_COL_RAM {
public static int red(int n) {
return (n & 255) << 16;
}
public static int green(int n) {
return (n & 255) << 8;
}
public static int blue(int n) {
return (n & 255) << 0;
}
}
public class FOG_COL_VERT {
public static int red(int n) {
return (n & 255) << 16;
}
public static int green(int n) {
return (n & 255) << 8;
}
public static int blue(int n) {
return (n & 255) << 0;
}
}
public class FOG_DENSITY {
public static int fog_scale_mantissa(int n) {
return (n & 255) << 8;
}
public static int fog_scale_exponent(int n) {
return (n & 255) << 0;
}
}
public class FOG_CLAMP_MAX {
public static int alpha(int n) {
return (n & 255) << 24;
}
public static int red(int n) {
return (n & 255) << 16;
}
public static int green(int n) {
return (n & 255) << 8;
}
public static int blue(int n) {
return (n & 255) << 0;
}
}
public class FOG_CLAMP_MIN {
public static int alpha(int n) {
return (n & 255) << 24;
}
public static int red(int n) {
return (n & 255) << 16;
}
public static int green(int n) {
return (n & 255) << 8;
}
public static int blue(int n) {
return (n & 255) << 0;
}
}
public class SPG_TRIGGER_POS {
public static int trigger_v_count(int n) {
return (n >> 16) & 1023;
}
public static int trigger_h_count(int n) {
return (n >> 0) & 1023;
}
}
public class SPG_HBLANK_INT {
public static int hblank_in_interrupt(int n) {
return (n >> 16) & 1023;
}
public static int line_comp_val(int n) {
return (n & 1023) << 0;
}
public class hblank_int_mode {
public static int output_equal_line_comp_val(int n) {
return (n >> 12) & 3;
}
public static final int output_every_line_comp_val = 4096;
public static final int output_every_line = 8192;
}
}
public class SPG_VBLANK_INT {
public static int vblank_out_interrupt_line_number(int n) {
return (n & 1023) << 16;
}
public static int vblank_in_interrupt_line_number(int n) {
return (n & 1023) << 0;
}
}
public class SPG_CONTROL {
public class csync_on_h {
public static int hsync(int n) {
return (n >> 9) & 1;
}
public static final int csync = 512;
}
public class sync_direction {
public static int input(int n) {
return (n >> 8) & 1;
}
public static final int output = 256;
}
public static final int pal = 128;
public static final int ntsc = 64;
public static final int force_field2 = 32;
public static final int interlace = 16;
public static final int spg_lock = 8;
public class mcsync_pol {
public static int active_low(int n) {
return (n >> 2) & 1;
}
public static final int active_high = 4;
}
public class mvsync_pol {
public static int active_low(int n) {
return (n >> 1) & 1;
}
public static final int active_high = 2;
}
public class mhsync_pol {
public static int active_low(int n) {
return (n >> 0) & 1;
}
public static final int active_high = 1;
}
}
public class SPG_HBLANK {
public static int hbend(int n) {
return (n & 1023) << 16;
}
public static int hbstart(int n) {
return (n & 1023) << 0;
}
}
public class SPG_LOAD {
public static int vcount(int n) {
return (n & 1023) << 16;
}
public static int hcount(int n) {
return (n & 1023) << 0;
}
}
public class SPG_VBLANK {
public static int vbend(int n) {
return (n & 1023) << 16;
}
public static int vbstart(int n) {
return (n & 1023) << 0;
}
}
public class SPG_WIDTH {
public static int eqwidth(int n) {
return (n & 1023) << 22;
}
public static int bpwidth(int n) {
return (n & 1023) << 12;
}
public static int vswidth(int n) {
return (n & 15) << 8;
}
public static int hswidth(int n) {
return (n & 127) << 0;
}
}
public class TEXT_CONTROL {
public class code_book_endian {
public static int little_endian(int n) {
return (n >> 17) & 1;
}
public static final int big_endian = 131072;
}
public class index_endian {
public static int little_endian(int n) {
return (n >> 16) & 1;
}
public static final int big_endian = 65536;
}
public static int bank_bit(int n) {
return (n & 31) << 8;
}
public static int stride(int n) {
return (n & 31) << 0;
}
}
public class VO_CONTROL {
public static final int pclk_delay_reset = 2097152;
public static int pclk_delay(int n) {
return (n & 31) << 16;
}
public static final int pixel_double = 256;
public static final int blank_video = 8;
public class field_mode {
public static int use_field_flag_from_spg(int n) {
return (n >> 4) & 15;
}
public static final int use_inverse_of_field_flag_from_spg = 16;
public static final int field_1_fixed = 32;
public static final int field_2_fixed = 48;
public static final int field_1_when_the_active_edges_of_hsync_and_vsync_match = 64;
public static final int field_2_when_the_active_edges_of_hsync_and_vsync_match = 80;
public static final int field_1_when_hsync_becomes_active_in_the_middle_of_the_vsync_active_edge = 96;
public static final int field_2_when_hsync_becomes_active_in_the_middle_of_the_vsync_active_edge = 112;
public static final int inverted_at_the_active_edge_of_vsync = 128;
}
public class blank_pol {
public static int active_low(int n) {
return (n >> 2) & 1;
}
public static final int active_high = 4;
}
public class vsync_pol {
public static int active_low(int n) {
return (n >> 1) & 1;
}
public static final int active_high = 2;
}
public class hsync_pol {
public static int active_low(int n) {
return (n >> 0) & 1;
}
public static final int active_high = 1;
}
}
public class VO_STARTX {
public static int horizontal_start_position(int n) {
return (n & 1023) << 0;
}
}
public class VO_STARTY {
public static int vertical_start_position_on_field_2(int n) {
return (n & 1023) << 16;
}
public static int vertical_start_position_on_field_1(int n) {
return (n & 1023) << 0;
}
}
public class SCALER_CTL {
public class field_select {
public static int field_1(int n) {
return (n >> 18) & 1;
}
public static final int field_2 = 262144;
}
public static final int interlace = 131072;
public static final int horizontal_scaling_enable = 65536;
public static int vertical_scale_factor(int n) {
return (n & 65535) << 0;
}
}
public class PAL_RAM_CTRL {
public class pixel_format {
public static int argb1555(int n) {
return (n >> 0) & 3;
}
public static final int rgb565 = 1;
public static final int argb4444 = 2;
public static final int argb8888 = 3;
}
}
public class SPG_STATUS {
public static int vsync(int n) {
return (n >> 13) & 1;
}
public static int hsync(int n) {
return (n >> 12) & 1;
}
public static int blank(int n) {
return (n >> 11) & 1;
}
public static int fieldnum(int n) {
return (n >> 10) & 1;
}
public static int scanline(int n) {
return (n >> 0) & 1023;
}
}
public class FB_BURSTCTRL {
public static int wr_burst(int n) {
return (n & 15) << 16;
}
public static int vid_lat(int n) {
return (n & 127) << 8;
}
public static int vid_burst(int n) {
return (n & 63) << 0;
}
}
public class FB_C_SOF {
public static int frame_buffer_current_read_address(int n) {
return (n >> 0) & 16777215;
}
}
public class Y_COEFF {
public static int coefficient_1(int n) {
return (n & 255) << 8;
}
public static int coefficient_0_2(int n) {
return (n & 255) << 0;
}
}
public class PT_ALPHA_REF {
public static int alpha_reference_for_punch_through(int n) {
return (n & 255) << 0;
}
}
public class FOG_TABLE {
public static int fog_table_data(int n) {
return (n & 65535) << 0;
}
}
public class PALETTE_RAM {
public static int palette_data(int n) {
return (n & -1) << 0;
}
}
}