GdromTest: directory listing
This commit is contained in:
parent
13c11391e0
commit
7e954e060c
@ -1,6 +1,12 @@
|
|||||||
#include "example/DreamcastVideo2.class.h"
|
#include "example/DreamcastVideo2.class.h"
|
||||||
#include "example/DreamcastVideo.class.h"
|
#include "example/DreamcastVideo.class.h"
|
||||||
|
#include "example/GdromExtentReader.class.h"
|
||||||
#include "example/GdromTest.class.h"
|
#include "example/GdromTest.class.h"
|
||||||
|
#include "filesystem/iso9660/ByteParser.class.h"
|
||||||
|
#include "filesystem/iso9660/DirectoryRecord.class.h"
|
||||||
|
#include "filesystem/iso9660/ExtentReader.class.h"
|
||||||
|
#include "filesystem/iso9660/PrimaryVolumeDescriptor.class.h"
|
||||||
|
#include "filesystem/iso9660/VolumeParser.class.h"
|
||||||
#include "java/io/PrintStream.class.h"
|
#include "java/io/PrintStream.class.h"
|
||||||
#include "java/lang/Boolean.class.h"
|
#include "java/lang/Boolean.class.h"
|
||||||
#include "java/lang/Byte.class.h"
|
#include "java/lang/Byte.class.h"
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
(const uint8_t *)&_binary_example_DreamcastVideo2_class_start,
|
(const uint8_t *)&_binary_example_DreamcastVideo2_class_start,
|
||||||
(const uint8_t *)&_binary_example_DreamcastVideo_class_start,
|
(const uint8_t *)&_binary_example_DreamcastVideo_class_start,
|
||||||
|
(const uint8_t *)&_binary_example_GdromExtentReader_class_start,
|
||||||
(const uint8_t *)&_binary_example_GdromTest_class_start,
|
(const uint8_t *)&_binary_example_GdromTest_class_start,
|
||||||
|
(const uint8_t *)&_binary_filesystem_iso9660_ByteParser_class_start,
|
||||||
|
(const uint8_t *)&_binary_filesystem_iso9660_DirectoryRecord_class_start,
|
||||||
|
(const uint8_t *)&_binary_filesystem_iso9660_ExtentReader_class_start,
|
||||||
|
(const uint8_t *)&_binary_filesystem_iso9660_PrimaryVolumeDescriptor_class_start,
|
||||||
|
(const uint8_t *)&_binary_filesystem_iso9660_VolumeParser_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_Boolean_class_start,
|
(const uint8_t *)&_binary_java_lang_Boolean_class_start,
|
||||||
(const uint8_t *)&_binary_java_lang_Byte_class_start,
|
(const uint8_t *)&_binary_java_lang_Byte_class_start,
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
CLASS_PATH = \
|
CLASS_PATH = \
|
||||||
example/DreamcastVideo2.class.o \
|
example/DreamcastVideo2.class.o \
|
||||||
example/DreamcastVideo.class.o \
|
example/DreamcastVideo.class.o \
|
||||||
|
example/GdromExtentReader.class.o \
|
||||||
example/GdromTest.class.o \
|
example/GdromTest.class.o \
|
||||||
|
filesystem/iso9660/ByteParser.class.o \
|
||||||
|
filesystem/iso9660/DirectoryRecord.class.o \
|
||||||
|
filesystem/iso9660/ExtentReader.class.o \
|
||||||
|
filesystem/iso9660/PrimaryVolumeDescriptor.class.o \
|
||||||
|
filesystem/iso9660/VolumeParser.class.o \
|
||||||
java/io/PrintStream.class.o \
|
java/io/PrintStream.class.o \
|
||||||
java/lang/Boolean.class.o \
|
java/lang/Boolean.class.o \
|
||||||
java/lang/Byte.class.o \
|
java/lang/Byte.class.o \
|
||||||
|
15
example/GdromExtentReader.class.h
Normal file
15
example/GdromExtentReader.class.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern C {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern uint32_t _binary_example_GdromExtentReader_class_start __asm("_binary_example_GdromExtentReader_class_start");
|
||||||
|
extern uint32_t _binary_example_GdromExtentReader_class_end __asm("_binary_example_GdromExtentReader_class_end");
|
||||||
|
extern uint32_t _binary_example_GdromExtentReader_class_size __asm("_binary_example_GdromExtentReader_class_size");
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
@ -3,6 +3,17 @@ package example;
|
|||||||
import sega.dreamcast.gdrom.GdromProtocol;
|
import sega.dreamcast.gdrom.GdromProtocol;
|
||||||
import sega.dreamcast.gdrom.G1IF;
|
import sega.dreamcast.gdrom.G1IF;
|
||||||
import java.misc.Memory;
|
import java.misc.Memory;
|
||||||
|
import filesystem.iso9660.VolumeParser;
|
||||||
|
import filesystem.iso9660.ExtentReader;
|
||||||
|
|
||||||
|
class GdromExtentReader implements ExtentReader {
|
||||||
|
public void readInto(byte[] buf, int extent) {
|
||||||
|
int starting_address = extent + 150;
|
||||||
|
System.out.print("starting_address: ");
|
||||||
|
System.out.println(starting_address);
|
||||||
|
GdromProtocol.cdReadPIO(buf, starting_address, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class GdromTest {
|
class GdromTest {
|
||||||
static byte[] buf;
|
static byte[] buf;
|
||||||
@ -29,15 +40,20 @@ class GdromTest {
|
|||||||
|
|
||||||
int data_track_fad = GdromProtocol.tocGetDataTrackFad();
|
int data_track_fad = GdromProtocol.tocGetDataTrackFad();
|
||||||
|
|
||||||
int primary_volume_descriptor = data_track_fad + 16;
|
//GdromProtocol.cdReadPIO(buf, primary_volume_descriptor, 1);
|
||||||
|
|
||||||
GdromProtocol.cdReadPIO(buf, primary_volume_descriptor, 1);
|
|
||||||
|
|
||||||
|
GdromExtentReader reader = new GdromExtentReader();
|
||||||
|
VolumeParser parser = new VolumeParser(data_track_fad - 150, reader);
|
||||||
|
System.out.println("::parser parse::");
|
||||||
|
parser.parse();
|
||||||
|
/*
|
||||||
System.out.println("data:");
|
System.out.println("data:");
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
System.out.print(buf[i]);
|
System.out.print(((int)buf[i]) & 0xff);
|
||||||
System.out.print(' ');
|
System.out.print(" ");
|
||||||
}
|
}
|
||||||
System.out.println();
|
System.out.println();
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
filesystem/iso9660/ByteParser.class.h
Normal file
15
filesystem/iso9660/ByteParser.class.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern C {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern uint32_t _binary_filesystem_iso9660_ByteParser_class_start __asm("_binary_filesystem_iso9660_ByteParser_class_start");
|
||||||
|
extern uint32_t _binary_filesystem_iso9660_ByteParser_class_end __asm("_binary_filesystem_iso9660_ByteParser_class_end");
|
||||||
|
extern uint32_t _binary_filesystem_iso9660_ByteParser_class_size __asm("_binary_filesystem_iso9660_ByteParser_class_size");
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
15
filesystem/iso9660/DirectoryRecord.class.h
Normal file
15
filesystem/iso9660/DirectoryRecord.class.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern C {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern uint32_t _binary_filesystem_iso9660_DirectoryRecord_class_start __asm("_binary_filesystem_iso9660_DirectoryRecord_class_start");
|
||||||
|
extern uint32_t _binary_filesystem_iso9660_DirectoryRecord_class_end __asm("_binary_filesystem_iso9660_DirectoryRecord_class_end");
|
||||||
|
extern uint32_t _binary_filesystem_iso9660_DirectoryRecord_class_size __asm("_binary_filesystem_iso9660_DirectoryRecord_class_size");
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
15
filesystem/iso9660/ExtentReader.class.h
Normal file
15
filesystem/iso9660/ExtentReader.class.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern C {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern uint32_t _binary_filesystem_iso9660_ExtentReader_class_start __asm("_binary_filesystem_iso9660_ExtentReader_class_start");
|
||||||
|
extern uint32_t _binary_filesystem_iso9660_ExtentReader_class_end __asm("_binary_filesystem_iso9660_ExtentReader_class_end");
|
||||||
|
extern uint32_t _binary_filesystem_iso9660_ExtentReader_class_size __asm("_binary_filesystem_iso9660_ExtentReader_class_size");
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
@ -1,5 +1,5 @@
|
|||||||
package filesystem.iso9660;
|
package filesystem.iso9660;
|
||||||
|
|
||||||
interface ExtentReader {
|
public interface ExtentReader {
|
||||||
public abstract void readInto(byte[] buf, int extent);
|
public abstract void readInto(byte[] buf, int extent);
|
||||||
}
|
}
|
||||||
|
15
filesystem/iso9660/PrimaryVolumeDescriptor.class.h
Normal file
15
filesystem/iso9660/PrimaryVolumeDescriptor.class.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern C {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern uint32_t _binary_filesystem_iso9660_PrimaryVolumeDescriptor_class_start __asm("_binary_filesystem_iso9660_PrimaryVolumeDescriptor_class_start");
|
||||||
|
extern uint32_t _binary_filesystem_iso9660_PrimaryVolumeDescriptor_class_end __asm("_binary_filesystem_iso9660_PrimaryVolumeDescriptor_class_end");
|
||||||
|
extern uint32_t _binary_filesystem_iso9660_PrimaryVolumeDescriptor_class_size __asm("_binary_filesystem_iso9660_PrimaryVolumeDescriptor_class_size");
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
@ -6,7 +6,6 @@ import java.io.IOException;
|
|||||||
|
|
||||||
class TestExtentReader implements ExtentReader {
|
class TestExtentReader implements ExtentReader {
|
||||||
byte[] all_bytes;
|
byte[] all_bytes;
|
||||||
|
|
||||||
public TestExtentReader() {
|
public TestExtentReader() {
|
||||||
try {
|
try {
|
||||||
all_bytes = Files.readAllBytes(Paths.get("classes/classes.iso"));
|
all_bytes = Files.readAllBytes(Paths.get("classes/classes.iso"));
|
||||||
|
15
filesystem/iso9660/VolumeParser.class.h
Normal file
15
filesystem/iso9660/VolumeParser.class.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern C {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern uint32_t _binary_filesystem_iso9660_VolumeParser_class_start __asm("_binary_filesystem_iso9660_VolumeParser_class_start");
|
||||||
|
extern uint32_t _binary_filesystem_iso9660_VolumeParser_class_end __asm("_binary_filesystem_iso9660_VolumeParser_class_end");
|
||||||
|
extern uint32_t _binary_filesystem_iso9660_VolumeParser_class_size __asm("_binary_filesystem_iso9660_VolumeParser_class_size");
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
@ -2,9 +2,9 @@ package filesystem.iso9660;
|
|||||||
|
|
||||||
import filesystem.iso9660.PrimaryVolumeDescriptor;
|
import filesystem.iso9660.PrimaryVolumeDescriptor;
|
||||||
import filesystem.iso9660.DirectoryRecord;
|
import filesystem.iso9660.DirectoryRecord;
|
||||||
import filesystem.iso9660.TestExtentReader;
|
|
||||||
|
|
||||||
public class VolumeParser {
|
public class VolumeParser {
|
||||||
|
int fad;
|
||||||
byte[] buf;
|
byte[] buf;
|
||||||
DirectoryRecord dr;
|
DirectoryRecord dr;
|
||||||
ExtentReader reader;
|
ExtentReader reader;
|
||||||
@ -102,8 +102,10 @@ public class VolumeParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void parse() {
|
public void parse() {
|
||||||
int pvd_extent = 16;
|
int pvd_extent = this.fad + 16;
|
||||||
|
|
||||||
|
System.out.print("pvd_extent: ");
|
||||||
|
System.out.println(pvd_extent);
|
||||||
reader.readInto(buf, pvd_extent);
|
reader.readInto(buf, pvd_extent);
|
||||||
|
|
||||||
printStandardIdentifier();
|
printStandardIdentifier();
|
||||||
@ -119,15 +121,20 @@ public class VolumeParser {
|
|||||||
walkDirectory(extent, num_extents, 0);
|
walkDirectory(extent, num_extents, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VolumeParser(ExtentReader reader) {
|
public VolumeParser(int fad, ExtentReader reader) {
|
||||||
|
this.fad = fad;
|
||||||
this.reader = reader;
|
this.reader = reader;
|
||||||
this.buf = new byte[2048];
|
this.buf = new byte[2048];
|
||||||
this.dr = new DirectoryRecord(this.buf, 0);
|
this.dr = new DirectoryRecord(this.buf, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
import filesystem.iso9660.TestExtentReader;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
TestExtentReader reader = new TestExtentReader();
|
TestExtentReader reader = new TestExtentReader();
|
||||||
VolumeParser parser = new VolumeParser(reader);
|
VolumeParser parser = new VolumeParser(reader);
|
||||||
parser.parse();
|
parser.parse();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
function make_class () {
|
function java_to_class () {
|
||||||
while read line; do
|
while read line; do
|
||||||
echo "${line%.java}.class"
|
echo "${line%.java}.class"
|
||||||
done
|
done
|
||||||
@ -68,10 +68,20 @@ function classpath_h () {
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
find sega/ java/ -name '*.class' -exec rm -f {} \;
|
function find_classes () {
|
||||||
make -j$(nproc) -f Makefile.dreamcast.mk $(find model/ example/ sega/ java/ -name '*.java' | make_class)
|
find model/ example/ sega/ java/ filesystem/ -name '*.class' -not -name 'Test*' | sort
|
||||||
find model/ example/ sega/ java/ -name '*.class' | sort | rename_class_files
|
}
|
||||||
find model/ example/ sega/ java/ -name '*.class' | sort | classpath_mk
|
|
||||||
find model/ example/ sega/ java/ -name '*.class' | sort | classpath_inc_c
|
function find_sources () {
|
||||||
find model/ example/ sega/ java/ -name '*.class' | sort | make_header
|
find model/ example/ sega/ java/ filesystem/ -name '*.java' -not -name 'Test*' | sort
|
||||||
find model/ example/ sega/ java/ -name '*.class' | sort | classpath_h
|
}
|
||||||
|
|
||||||
|
find sega/ java/ filesystem/ -name '*.class' -exec rm -f {} \;
|
||||||
|
|
||||||
|
make -j$(nproc) -f Makefile.dreamcast.mk $(find_sources | java_to_class)
|
||||||
|
|
||||||
|
find_classes | rename_class_files
|
||||||
|
find_classes | classpath_mk
|
||||||
|
find_classes | classpath_inc_c
|
||||||
|
find_classes | make_header
|
||||||
|
find_classes | classpath_h
|
||||||
|
@ -24,6 +24,10 @@ public class PrintStream
|
|||||||
write(String.valueOf(b));
|
write(String.valueOf(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void print(char c) {
|
||||||
|
write(String.valueOf(c));
|
||||||
|
}
|
||||||
|
|
||||||
public void print(int i) {
|
public void print(int i) {
|
||||||
write(String.valueOf(i));
|
write(String.valueOf(i));
|
||||||
}
|
}
|
||||||
@ -58,6 +62,11 @@ public class PrintStream
|
|||||||
write(newline);
|
write(newline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void println(char c) {
|
||||||
|
write(String.valueOf(c));
|
||||||
|
write(newline);
|
||||||
|
}
|
||||||
|
|
||||||
public void println(int i) {
|
public void println(int i) {
|
||||||
write(String.valueOf(i));
|
write(String.valueOf(i));
|
||||||
write(newline);
|
write(newline);
|
||||||
|
@ -31,6 +31,10 @@ public class String {
|
|||||||
return b ? "true" : "false";
|
return b ? "true" : "false";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String valueOf(char c) {
|
||||||
|
return new String(new byte[] { (byte)c });
|
||||||
|
}
|
||||||
|
|
||||||
public static String valueOf(int i) {
|
public static String valueOf(int i) {
|
||||||
return Integer.toString(i);
|
return Integer.toString(i);
|
||||||
}
|
}
|
||||||
|
@ -36,13 +36,13 @@ public class GdromProtocol {
|
|||||||
|
|
||||||
Memory.putU1(Gdrom.command, GdromBits.command__code__packet_command);
|
Memory.putU1(Gdrom.command, GdromBits.command__code__packet_command);
|
||||||
|
|
||||||
System.out.println("words:");
|
//System.out.println("words:");
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
int i0 = command.getByte(i * 2);
|
int i0 = command.getByte(i * 2);
|
||||||
int i1 = command.getByte(i * 2 + 1);
|
int i1 = command.getByte(i * 2 + 1);
|
||||||
// little endian
|
// little endian
|
||||||
int word = ((i1 & 0xff) << 8) | (i0 & 0xff);
|
int word = ((i1 & 0xff) << 8) | (i0 & 0xff);
|
||||||
System.out.println(word);
|
//System.out.println(word);
|
||||||
Memory.putU2(Gdrom.data, word);
|
Memory.putU2(Gdrom.data, word);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,18 +56,18 @@ public class GdromProtocol {
|
|||||||
public static void readData(byte[] buf, int length) {
|
public static void readData(byte[] buf, int length) {
|
||||||
for (int i = 0; i < (length >> 1); i++) {
|
for (int i = 0; i < (length >> 1); i++) {
|
||||||
int data = Memory.getU2(Gdrom.data);
|
int data = Memory.getU2(Gdrom.data);
|
||||||
buf[i * 2] = (byte)((data >> 8) & 0xff);
|
buf[i * 2] = (byte)(data);
|
||||||
buf[i * 2 + 1] = (byte)(data & 0xff);
|
buf[i * 2 + 1] = (byte)(data >> 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getFad(byte[] buf, int i) {
|
public static int getFad(byte[] buf, int i) {
|
||||||
int i0 = buf[0];
|
//int i0 = ((int)buf[i * 4 + 0]) & 0xff;
|
||||||
int i1 = buf[1];
|
int i1 = ((int)buf[i * 4 + 1]) & 0xff;
|
||||||
int i2 = buf[2];
|
int i2 = ((int)buf[i * 4 + 2]) & 0xff;
|
||||||
//int i3 = low & 0xff;
|
int i3 = ((int)buf[i * 4 + 3]) & 0xff;
|
||||||
|
|
||||||
return (i2 << 16) | (i1 << 8) | i0;
|
return (i1 << 16) | (i2 << 8) | (i3 << 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int tocGetDataTrackFad() {
|
public static int tocGetDataTrackFad() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user