add HollyBits
This commit is contained in:
parent
aa7bac0367
commit
b9db301334
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,6 +6,7 @@
|
||||
*.class
|
||||
*.out
|
||||
*.elf
|
||||
*.bin
|
||||
main
|
||||
print_class
|
||||
__pycache__
|
@ -48,14 +48,15 @@ LIBGCC_OBJ = \
|
||||
libgcc/_div_table.o
|
||||
|
||||
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/lang/Integer.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 \
|
||||
java/misc/Memory.class.o
|
||||
sega/dreamcast/holly/HollyBits.class.o
|
||||
|
||||
main.elf: LDSCRIPT = $(LIB)/main.lds
|
||||
main.elf: $(START_OBJ) $(OBJ) $(MAIN_OBJ) $(MAIN_DREAMCAST_OBJ) $(LIBGCC_OBJ) $(CLASS_FILES)
|
||||
|
@ -7,32 +7,33 @@
|
||||
|
||||
#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/lang/Integer.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 "p/DreamcastVideo2.class.h"
|
||||
#include "sega/dreamcast/holly/Holly.class.h"
|
||||
#include "sega/dreamcast/holly/HollyBits.class.h"
|
||||
|
||||
void main()
|
||||
{
|
||||
scif_init(0);
|
||||
|
||||
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_lang_Integer_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_p_DreamcastVideo2_class_start,
|
||||
(const uint8_t *)&_binary_sega_dreamcast_holly_Holly_class_start,
|
||||
};
|
||||
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 class_hash_table_length;
|
||||
|
@ -1,3 +1,4 @@
|
||||
python gen_decoder.py > c/decode.inc.c
|
||||
|
||||
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
15
p/DreamcastVideo2.class.h
Normal 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
27
p/DreamcastVideo2.java
Normal file
@ -0,0 +1,27 @@
|
||||
package p;
|
||||
|
||||
import sega.dreamcast.holly.Holly;
|
||||
import sega.dreamcast.holly.HollyBits;
|
||||
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 =
|
||||
HollyBits.fb_r_ctrl__vclk_div__pclk_vclk_1
|
||||
| HollyBits.fb_r_ctrl__fb_depth__0888_rgb_32bit
|
||||
| HollyBits.fb_r_ctrl__fb_enable;
|
||||
Memory.putU4(Holly.FB_R_CTRL, fb_r_ctrl);
|
||||
|
||||
int blue = 0x000077ff;
|
||||
int fb = 0xa5000000 + Memory.getU4(Holly.FB_R_SOF1);
|
||||
for (int i = 0; i < 640 * 480; i++) {
|
||||
Memory.putU4(fb + (i * 4), red);
|
||||
}
|
||||
}
|
||||
}
|
@ -2,16 +2,22 @@ from bits import sign_extend
|
||||
from bits import mask_from_bits
|
||||
|
||||
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:
|
||||
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 "}"
|
||||
elif bit.value:
|
||||
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:
|
||||
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:
|
||||
yield f"return (n & {sign_extend(mask_from_bits(bit.bits), 32)}) << {min(bit.bits)};"
|
||||
else:
|
||||
@ -29,16 +35,15 @@ def generate_enums(enum_group):
|
||||
if enum_name == "":
|
||||
yield from generate_bits(bits)
|
||||
else:
|
||||
yield f"public class {enum_name} {{"
|
||||
#yield f"public class {enum_name} {{"
|
||||
yield from generate_bits(bits)
|
||||
yield "}"
|
||||
#yield "}"
|
||||
|
||||
def generate_registers(package_name, class_name, group):
|
||||
yield f"package sega.dreamcast.{package_name};"
|
||||
yield ""
|
||||
yield f"public class {class_name} {{"
|
||||
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 "}"
|
||||
#yield "}"
|
||||
yield "}"
|
||||
|
@ -8,7 +8,6 @@ def generate_register(base_address, register):
|
||||
|
||||
def generate_classes(package_name, base_address, blocks):
|
||||
yield f"package sega.dreamcast.{package_name};"
|
||||
yield ""
|
||||
for block, registers in blocks:
|
||||
yield f"public class {block.capitalize()} {{"
|
||||
for register in registers:
|
||||
|
@ -1,6 +1,5 @@
|
||||
package sega.dreamcast.holly;
|
||||
|
||||
|
||||
public class Holly {
|
||||
public static final int ID = 0xa05f8000;
|
||||
public static final int REVISION = 0xa05f8004;
|
||||
|
15
sega/dreamcast/holly/HollyBits.class.h
Normal file
15
sega/dreamcast/holly/HollyBits.class.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern uint32_t _binary_sega_dreamcast_holly_HollyBits_class_start __asm("_binary_sega_dreamcast_holly_HollyBits_class_start");
|
||||
extern uint32_t _binary_sega_dreamcast_holly_HollyBits_class_end __asm("_binary_sega_dreamcast_holly_HollyBits_class_end");
|
||||
extern uint32_t _binary_sega_dreamcast_holly_HollyBits_class_size __asm("_binary_sega_dreamcast_holly_HollyBits_class_size");
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user