add ISPTSP

This commit is contained in:
Zack Buhman 2024-12-27 09:06:47 -06:00
parent 013592dac1
commit c22c2581e1
4 changed files with 151 additions and 18 deletions

View File

@ -1,5 +1,7 @@
python gen_decoder.py > c/decode.inc.c
python regs/holly.py ../dreamcast/regs/holly.csv > sega/dreamcast/holly/Holly.java
python regs/core_bits.py ../dreamcast/regs/core_bits.csv > sega/dreamcast/holly/HollyBits.java
python regs/ta_bits.py ../dreamcast/regs/ta_bits.csv > sega/dreamcast/holly/TABits.java
python regs/bits_gen.py ../dreamcast/regs/core_bits.csv holly CoreBits > sega/dreamcast/holly/CoreBits.java
python regs/bits_gen.py ../dreamcast/regs/ta_bits.csv holly TABits > sega/dreamcast/holly/TABits.java
python regs/bits_gen.py ../dreamcast/regs/isp_tsp.csv holly ISPTSP > sega/dreamcast/holly/ISPTSP.java

View File

@ -9,7 +9,9 @@ from bits_java import generate_registers
if __name__ == "__main__":
rows = read_input(sys.argv[1])
package_name = sys.argv[2]
class_name = sys.argv[3]
group = group_by_register_enum(map(parse_row, rows))
render, out = renderer(indent_length=4)
render(generate_registers("holly", "CoreBits", group))
render(generate_registers(package_name, class_name, group))
sys.stdout.write(out.getvalue())

View File

@ -1,15 +0,0 @@
import sys
from csv_input import read_input
from generate import renderer
from bits import parse_row
from bits import group_by_register_enum
from bits_java import generate_registers
if __name__ == "__main__":
rows = read_input(sys.argv[1])
group = group_by_register_enum(map(parse_row, rows))
render, out = renderer(indent_length=4)
render(generate_registers("holly", "TABits", group))
sys.stdout.write(out.getvalue())

View File

@ -0,0 +1,144 @@
package sega.dreamcast.holly;
public class ISPTSP {
public static int isp_tsp_instruction_word__depth_compare_mode__never(int n) {
return (n >> 29) & 7;
}
public static final int isp_tsp_instruction_word__depth_compare_mode__less = 1 << 29;
public static final int isp_tsp_instruction_word__depth_compare_mode__equal = 2 << 29;
public static final int isp_tsp_instruction_word__depth_compare_mode__less_or_equal = 3 << 29;
public static final int isp_tsp_instruction_word__depth_compare_mode__greater = 4 << 29;
public static final int isp_tsp_instruction_word__depth_compare_mode__greater_or_equal = 5 << 29;
public static final int isp_tsp_instruction_word__depth_compare_mode__not_equal = 6 << 29;
public static final int isp_tsp_instruction_word__depth_compare_mode__always = 7 << 29;
public static int isp_tsp_instruction_word__volume_instruction__normal_polygon(int n) {
return (n >> 29) & 7;
}
public static final int isp_tsp_instruction_word__volume_instruction__inside_last_polygon = 1 << 29;
public static final int isp_tsp_instruction_word__volume_instruction__outside_last_polygon = 2 << 29;
public static int isp_tsp_instruction_word__culling_mode__no_culling(int n) {
return (n >> 27) & 3;
}
public static final int isp_tsp_instruction_word__culling_mode__cull_if_small = 1 << 27;
public static final int isp_tsp_instruction_word__culling_mode__cull_if_negative = 2 << 27;
public static final int isp_tsp_instruction_word__culling_mode__cull_if_positive = 3 << 27;
public static final int isp_tsp_instruction_word__z_write_disable = 1 << 26;
public static final int isp_tsp_instruction_word__texture = 1 << 25;
public static final int isp_tsp_instruction_word__offset = 1 << 24;
public static final int isp_tsp_instruction_word__gouraud_shading = 1 << 23;
public static final int isp_tsp_instruction_word__16bit_uv = 1 << 22;
public static final int isp_tsp_instruction_word__cache_bypass = 1 << 21;
public static final int isp_tsp_instruction_word__dcalc_ctrl = 1 << 20;
public static int tsp_instruction_word__src_alpha_instr__zero(int n) {
return (n >> 29) & 7;
}
public static final int tsp_instruction_word__src_alpha_instr__one = 1 << 29;
public static final int tsp_instruction_word__src_alpha_instr__other_color = 2 << 29;
public static final int tsp_instruction_word__src_alpha_instr__inverse_other_color = 3 << 29;
public static final int tsp_instruction_word__src_alpha_instr__src_alpha = 4 << 29;
public static final int tsp_instruction_word__src_alpha_instr__inverse_src_alpha = 5 << 29;
public static final int tsp_instruction_word__src_alpha_instr__dst_alpha = 6 << 29;
public static final int tsp_instruction_word__src_alpha_instr__inverse_dst_alpha = 7 << 29;
public static int tsp_instruction_word__dst_alpha_instr__zero(int n) {
return (n >> 26) & 7;
}
public static final int tsp_instruction_word__dst_alpha_instr__one = 1 << 26;
public static final int tsp_instruction_word__dst_alpha_instr__other_color = 2 << 26;
public static final int tsp_instruction_word__dst_alpha_instr__inverse_other_color = 3 << 26;
public static final int tsp_instruction_word__dst_alpha_instr__src_alpha = 4 << 26;
public static final int tsp_instruction_word__dst_alpha_instr__inverse_src_alpha = 5 << 26;
public static final int tsp_instruction_word__dst_alpha_instr__dst_alpha = 6 << 26;
public static final int tsp_instruction_word__dst_alpha_instr__inverse_dst_alpha = 7 << 26;
public static int tsp_instruction_word__src_select__primary_accumulation_buffer(int n) {
return (n >> 25) & 1;
}
public static final int tsp_instruction_word__src_select__secondary_accumulation_buffer = 1 << 25;
public static int tsp_instruction_word__dst_select__primary_accumulation_buffer(int n) {
return (n >> 24) & 1;
}
public static final int tsp_instruction_word__dst_select__secondary_accumulation_buffer = 1 << 24;
public static int tsp_instruction_word__fog_control__look_up_table(int n) {
return (n >> 22) & 3;
}
public static final int tsp_instruction_word__fog_control__per_vertex = 1 << 22;
public static final int tsp_instruction_word__fog_control__no_fog = 2 << 22;
public static final int tsp_instruction_word__fog_control__look_up_table_mode_2 = 3 << 22;
public static final int tsp_instruction_word__color_clamp = 1 << 21;
public static final int tsp_instruction_word__use_alpha = 1 << 20;
public static final int tsp_instruction_word__ignore_texture_alpha = 1 << 19;
public static final int tsp_instruction_word__super_sample_texture = 1 << 12;
public static int tsp_instruction_word__mip_map_d_adjust(int n) {
return (n & 15) << 8;
}
public static int tsp_instruction_word__palette_selector4(int n) {
return (n & 63) << 21;
}
public static int tsp_instruction_word__palette_selector8(int n) {
return (n & 3) << 25;
}
public static int tsp_instruction_word__stride_select(int n) {
return (n >> 25) & 1;
}
public static int tsp_instruction_word__texture_address(int n) {
return (n & 2097151) << 0;
}
public static int tsp_instruction_word__flip_uv__none(int n) {
return (n >> 17) & 3;
}
public static final int tsp_instruction_word__flip_uv__v = 1 << 17;
public static final int tsp_instruction_word__flip_uv__u = 2 << 17;
public static final int tsp_instruction_word__flip_uv__uv = 3 << 17;
public static int tsp_instruction_word__clamp_uv__none(int n) {
return (n >> 15) & 3;
}
public static final int tsp_instruction_word__clamp_uv__v = 1 << 15;
public static final int tsp_instruction_word__clamp_uv__u = 2 << 15;
public static final int tsp_instruction_word__clamp_uv__uv = 3 << 15;
public static int tsp_instruction_word__filter_mode__point_sampled(int n) {
return (n >> 13) & 3;
}
public static final int tsp_instruction_word__filter_mode__bilinear_filter = 1 << 13;
public static final int tsp_instruction_word__filter_mode__trilinear_pass_a = 2 << 13;
public static final int tsp_instruction_word__filter_mode__trilinear_pass_b = 3 << 13;
public static int tsp_instruction_word__texture_shading_instruction__decal(int n) {
return (n >> 6) & 3;
}
public static final int tsp_instruction_word__texture_shading_instruction__modulate = 1 << 6;
public static final int tsp_instruction_word__texture_shading_instruction__decal_alpha = 2 << 6;
public static final int tsp_instruction_word__texture_shading_instruction__modulate_alpha = 3 << 6;
public static int tsp_instruction_word__texture_u_size__8(int n) {
return (n >> 3) & 7;
}
public static final int tsp_instruction_word__texture_u_size__16 = 1 << 3;
public static final int tsp_instruction_word__texture_u_size__32 = 2 << 3;
public static final int tsp_instruction_word__texture_u_size__64 = 3 << 3;
public static final int tsp_instruction_word__texture_u_size__128 = 4 << 3;
public static final int tsp_instruction_word__texture_u_size__256 = 5 << 3;
public static final int tsp_instruction_word__texture_u_size__512 = 6 << 3;
public static final int tsp_instruction_word__texture_u_size__1024 = 7 << 3;
public static int tsp_instruction_word__texture_v_size__8(int n) {
return (n >> 0) & 7;
}
public static final int tsp_instruction_word__texture_v_size__16 = 1 << 0;
public static final int tsp_instruction_word__texture_v_size__32 = 2 << 0;
public static final int tsp_instruction_word__texture_v_size__64 = 3 << 0;
public static final int tsp_instruction_word__texture_v_size__128 = 4 << 0;
public static final int tsp_instruction_word__texture_v_size__256 = 5 << 0;
public static final int tsp_instruction_word__texture_v_size__512 = 6 << 0;
public static final int tsp_instruction_word__texture_v_size__1024 = 7 << 0;
public static int tsp_instruction_word__pixel_format__1555(int n) {
return (n >> 27) & 7;
}
public static final int tsp_instruction_word__pixel_format__565 = 1 << 27;
public static final int tsp_instruction_word__pixel_format__4444 = 2 << 27;
public static final int tsp_instruction_word__pixel_format__yuv422 = 3 << 27;
public static final int tsp_instruction_word__pixel_format__bump_map = 4 << 27;
public static final int tsp_instruction_word__pixel_format__4bpp_palette = 5 << 27;
public static final int tsp_instruction_word__pixel_format__8bpp_palette = 6 << 27;
public static int tsp_instruction_word__scan_order__twiddled(int n) {
return (n >> 26) & 1;
}
public static final int tsp_instruction_word__scan_order__non_twiddled = 1 << 26;
public static final int texture_control_word__mip_mapped = 1 << 31;
public static final int texture_control_word__vq_compressed = 1 << 30;
}