Compare commits

...

2 Commits

2 changed files with 25 additions and 29 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)
{
static const uint8_t * jvm_bin = (const uint8_t *)"JVM.BIN;1";
int jvm_bin_length = 9;
static const uint8_t * jvm_bin = (const uint8_t *)"0JVM.BIN;1";
int jvm_bin_length = 10;
if (length_of_file_identifier != jvm_bin_length)
return false;
@ -230,10 +230,10 @@ void load_jvm_bin(const iso9660::directory_record * dr)
__data_length = dr->data_length.get();
}
void walk_directory_record(const iso9660::directory_record * dr)
bool walk_directory_record(const iso9660::directory_record * dr)
{
if (dr_is_self_or_parent(dr))
return;
return false;
if ((dr->file_flags & FILE_FLAGS__DIRECTORY) == 0) {
serial::string(" [regular file] ");
@ -248,8 +248,10 @@ void walk_directory_record(const iso9660::directory_record * dr)
if ((dr->file_flags & FILE_FLAGS__DIRECTORY) == 0) {
if (is_jvm_bin(dr->file_identifier, dr->length_of_file_identifier)) {
load_jvm_bin(dr);
return true;
}
}
return false;
}
void walk_directory(uint16_t * buf, int extent, int num_extents)
@ -269,7 +271,9 @@ void walk_directory(uint16_t * buf, int extent, int num_extents)
if (dr->length_of_directory_record == 0)
break;
walk_directory_record(dr);
bool jvm_loaded = walk_directory_record(dr);
if (jvm_loaded)
break;
offset += dr->length_of_directory_record;
}
@ -305,6 +309,10 @@ void main()
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]);
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(" standard_identifier: ");
serial::string(pvd->standard_identifier, 5);

36
ip.mk
View File

@ -1,16 +1,15 @@
IP_OBJ = \
systemid.o \
toc.o \
sg/sg_sec.o \
sg_arejp.o \
sg_areus.o \
sg_areec.o \
sg_are00.o \
sg_are01.o \
sg_are02.o \
sg_are03.o \
sg_are04.o \
$(START_OBJ)
$(LIB)/systemid.o \
$(LIB)/toc.o \
$(LIB)/sg/sg_sec.o \
$(LIB)/sg_arejp.o \
$(LIB)/sg_areus.o \
$(LIB)/sg_areec.o \
$(LIB)/sg_are00.o \
$(LIB)/sg_are01.o \
$(LIB)/sg_are02.o \
$(LIB)/sg_are03.o \
$(LIB)/sg_are04.o
SERIAL_LOAD_OBJ = \
example/serial_transfer.o \
@ -20,21 +19,10 @@ SERIAL_LOAD_OBJ = \
font/portfolio_6x8/portfolio_6x8.data.o \
crc32.o
GDROM_JVM_BOOT_OBJ = \
example/gdrom_jvm_boot.o \
sh7091/serial.o \
crc32.o
%.o: %.obj
$(OBJCOPY) -g \
--rename-section IP=.text.$* \
$< $@
serial_load_ip.elf: $(IP_OBJ) $(SERIAL_LOAD_OBJ)
serial_load_ip.elf: $(IP_OBJ) $(START_OBJ) $(SERIAL_LOAD_OBJ)
$(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