Compare commits

..

No commits in common. "7cd65dbfd25819dc79a3b24ba2124a8fbd57c9f8" and "58def35f449a257faddbc26bc4c41e2c5c6758ea" have entirely different histories.

2 changed files with 29 additions and 25 deletions

View File

@ -153,8 +153,8 @@ bool dr_is_self_or_parent(const iso9660::directory_record * dr)
bool is_jvm_bin(const uint8_t * file_identifier, int length_of_file_identifier) bool is_jvm_bin(const uint8_t * file_identifier, int length_of_file_identifier)
{ {
static const uint8_t * jvm_bin = (const uint8_t *)"0JVM.BIN;1"; static const uint8_t * jvm_bin = (const uint8_t *)"JVM.BIN;1";
int jvm_bin_length = 10; int jvm_bin_length = 9;
if (length_of_file_identifier != jvm_bin_length) if (length_of_file_identifier != jvm_bin_length)
return false; return false;
@ -230,10 +230,10 @@ void load_jvm_bin(const iso9660::directory_record * dr)
__data_length = dr->data_length.get(); __data_length = dr->data_length.get();
} }
bool walk_directory_record(const iso9660::directory_record * dr) void walk_directory_record(const iso9660::directory_record * dr)
{ {
if (dr_is_self_or_parent(dr)) if (dr_is_self_or_parent(dr))
return false; return;
if ((dr->file_flags & FILE_FLAGS__DIRECTORY) == 0) { if ((dr->file_flags & FILE_FLAGS__DIRECTORY) == 0) {
serial::string(" [regular file] "); serial::string(" [regular file] ");
@ -248,10 +248,8 @@ bool walk_directory_record(const iso9660::directory_record * dr)
if ((dr->file_flags & FILE_FLAGS__DIRECTORY) == 0) { if ((dr->file_flags & FILE_FLAGS__DIRECTORY) == 0) {
if (is_jvm_bin(dr->file_identifier, dr->length_of_file_identifier)) { if (is_jvm_bin(dr->file_identifier, dr->length_of_file_identifier)) {
load_jvm_bin(dr); load_jvm_bin(dr);
return true;
} }
} }
return false;
} }
void walk_directory(uint16_t * buf, int extent, int num_extents) void walk_directory(uint16_t * buf, int extent, int num_extents)
@ -271,9 +269,7 @@ void walk_directory(uint16_t * buf, int extent, int num_extents)
if (dr->length_of_directory_record == 0) if (dr->length_of_directory_record == 0)
break; break;
bool jvm_loaded = walk_directory_record(dr); walk_directory_record(dr);
if (jvm_loaded)
break;
offset += dr->length_of_directory_record; offset += dr->length_of_directory_record;
} }
@ -309,10 +305,6 @@ void main()
auto pvd = reinterpret_cast<const iso9660::primary_volume_descriptor *>(&buf[0]); auto pvd = reinterpret_cast<const iso9660::primary_volume_descriptor *>(&buf[0]);
auto root_dr = reinterpret_cast<const iso9660::directory_record *>(&pvd->directory_record_for_root_directory[0]); auto root_dr = reinterpret_cast<const iso9660::directory_record *>(&pvd->directory_record_for_root_directory[0]);
for (int i = 0; i < 16; i++) {
serial::integer<uint8_t, string::dec_type>(((uint8_t *)buf)[i], ' ');
}
serial::string("primary volume descriptor:\n"); serial::string("primary volume descriptor:\n");
serial::string(" standard_identifier: "); serial::string(" standard_identifier: ");
serial::string(pvd->standard_identifier, 5); serial::string(pvd->standard_identifier, 5);

36
ip.mk
View File

@ -1,15 +1,16 @@
IP_OBJ = \ IP_OBJ = \
$(LIB)/systemid.o \ systemid.o \
$(LIB)/toc.o \ toc.o \
$(LIB)/sg/sg_sec.o \ sg/sg_sec.o \
$(LIB)/sg_arejp.o \ sg_arejp.o \
$(LIB)/sg_areus.o \ sg_areus.o \
$(LIB)/sg_areec.o \ sg_areec.o \
$(LIB)/sg_are00.o \ sg_are00.o \
$(LIB)/sg_are01.o \ sg_are01.o \
$(LIB)/sg_are02.o \ sg_are02.o \
$(LIB)/sg_are03.o \ sg_are03.o \
$(LIB)/sg_are04.o sg_are04.o \
$(START_OBJ)
SERIAL_LOAD_OBJ = \ SERIAL_LOAD_OBJ = \
example/serial_transfer.o \ example/serial_transfer.o \
@ -19,10 +20,21 @@ SERIAL_LOAD_OBJ = \
font/portfolio_6x8/portfolio_6x8.data.o \ font/portfolio_6x8/portfolio_6x8.data.o \
crc32.o crc32.o
GDROM_JVM_BOOT_OBJ = \
example/gdrom_jvm_boot.o \
sh7091/serial.o \
crc32.o
%.o: %.obj %.o: %.obj
$(OBJCOPY) -g \ $(OBJCOPY) -g \
--rename-section IP=.text.$* \ --rename-section IP=.text.$* \
$< $@ $< $@
serial_load_ip.elf: $(IP_OBJ) $(START_OBJ) $(SERIAL_LOAD_OBJ) serial_load_ip.elf: $(IP_OBJ) $(SERIAL_LOAD_OBJ)
$(LD) --orphan-handling=error --print-memory-usage -T $(LIB)/ip.lds $^ -o $@ $(LD) --orphan-handling=error --print-memory-usage -T $(LIB)/ip.lds $^ -o $@
gdrom_jvm_boot_ip.elf: $(IP_OBJ) $(GDROM_JVM_BOOT_OBJ)
$(LD) --orphan-handling=error --print-memory-usage -T $(LIB)/ip.lds $^ -o $@
gdrom-jvm-boot-ip-bin: gdrom_jvm_boot_ip.bin
cp $< ip.bin