Compare commits
3 Commits
9f90e5e3f6
...
c2e41d28d4
Author | SHA1 | Date | |
---|---|---|---|
c2e41d28d4 | |||
eb38cd5b9d | |||
43312f2e4d |
2
base.mk
2
base.mk
@ -2,7 +2,7 @@ DEBUG = -g -gdwarf-4
|
|||||||
|
|
||||||
AFLAGS += --fatal-warnings
|
AFLAGS += --fatal-warnings
|
||||||
|
|
||||||
CFLAGS += -falign-functions=4 -ffunction-sections -fdata-sections -fshort-enums -ffreestanding -nostdlib -fno-builtin -finline-stringops
|
CFLAGS += -falign-functions=4 -ffunction-sections -fdata-sections -fshort-enums -ffreestanding -nostdlib -fno-builtin
|
||||||
CFLAGS += -Wall -Werror -Wfatal-errors
|
CFLAGS += -Wall -Werror -Wfatal-errors
|
||||||
CFLAGS += -Wno-array-bounds
|
CFLAGS += -Wno-array-bounds
|
||||||
#CFLAGS += -Wno-error=narrowing -Wno-error=unused-variable -Wno-error=array-bounds=
|
#CFLAGS += -Wno-error=narrowing -Wno-error=unused-variable -Wno-error=array-bounds=
|
||||||
|
@ -19,6 +19,7 @@ extern void * _binary_start __asm("_binary_example_arm_sh4_interrupt_bin_start")
|
|||||||
extern void * _binary_size __asm("_binary_example_arm_sh4_interrupt_bin_size");
|
extern void * _binary_size __asm("_binary_example_arm_sh4_interrupt_bin_size");
|
||||||
|
|
||||||
constexpr uint32_t mcipd__sh4_interrupt = (1 << 5);
|
constexpr uint32_t mcipd__sh4_interrupt = (1 << 5);
|
||||||
|
constexpr uint32_t miceb__sh4_interrupt = (1 << 5);
|
||||||
constexpr uint32_t scipd__arm_interrupt = (1 << 5);
|
constexpr uint32_t scipd__arm_interrupt = (1 << 5);
|
||||||
|
|
||||||
constexpr uint32_t sectors_per_chunk = 16;
|
constexpr uint32_t sectors_per_chunk = 16;
|
||||||
@ -64,7 +65,7 @@ void aica_init(uint32_t& chunk_index, const uint32_t * src_chunk)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
chunk = reinterpret_cast<decltype (chunk)>(&aica_wave_memory[0x001f0000 / 4]);
|
chunk = reinterpret_cast<decltype (chunk)>(&aica_wave_memory[0x00100000 / 4]);
|
||||||
|
|
||||||
serial::integer<uint32_t>(reinterpret_cast<uint32_t>(&(*chunk)[0][0]));
|
serial::integer<uint32_t>(reinterpret_cast<uint32_t>(&(*chunk)[0][0]));
|
||||||
serial::integer<uint32_t>(reinterpret_cast<uint32_t>(&(*chunk)[1][0]));
|
serial::integer<uint32_t>(reinterpret_cast<uint32_t>(&(*chunk)[1][0]));
|
||||||
@ -83,9 +84,8 @@ void aica_init(uint32_t& chunk_index, const uint32_t * src_chunk)
|
|||||||
|
|
||||||
void aica_step(uint32_t& chunk_index, const uint32_t * src_chunk)
|
void aica_step(uint32_t& chunk_index, const uint32_t * src_chunk)
|
||||||
{
|
{
|
||||||
aica_wait_read();
|
|
||||||
{ // wait for interrupt from arm
|
{ // wait for interrupt from arm
|
||||||
while ((aica_sound.common.MCIPD() & mcipd__sh4_interrupt) == 0) { aica_wait_read(); };
|
while ((system.ISTEXT & (1 << 1)) == 0);
|
||||||
aica_wait_write(); aica_sound.common.mcire = mcipd__sh4_interrupt;
|
aica_wait_write(); aica_sound.common.mcire = mcipd__sh4_interrupt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,6 +372,8 @@ void main()
|
|||||||
|
|
||||||
aica_init(chunk_index, &gdrom_buf[0]);
|
aica_init(chunk_index, &gdrom_buf[0]);
|
||||||
|
|
||||||
|
aica_sound.common.MCIEB(miceb__sh4_interrupt);
|
||||||
|
|
||||||
//serial::string("aica wave memory:\n");
|
//serial::string("aica wave memory:\n");
|
||||||
//while (aica_wave_memory[0] == 0xeaffffff) { aica_wait_read(); };
|
//while (aica_wave_memory[0] == 0xeaffffff) { aica_wait_read(); };
|
||||||
//aica_wait_read(); serial::integer<uint32_t>(aica_wave_memory[0]);
|
//aica_wait_read(); serial::integer<uint32_t>(aica_wave_memory[0]);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
ram : ORIGIN = 0x00000000, LENGTH = 0x1f0000
|
ram : ORIGIN = 0x00000000, LENGTH = 0x100000
|
||||||
buffers : ORIGIN = 0x001f0000, LENGTH = 0x10000
|
buffers : ORIGIN = 0x00100000, LENGTH = 0x100000
|
||||||
}
|
}
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
|
@ -45,8 +45,8 @@ void main()
|
|||||||
aica_sound.channel[0].RR(0x1f);
|
aica_sound.channel[0].RR(0x1f);
|
||||||
aica_sound.channel[0].AR(0x1f);
|
aica_sound.channel[0].AR(0x1f);
|
||||||
|
|
||||||
aica_sound.channel[0].OCT(0xf);
|
aica_sound.channel[0].OCT(-1);
|
||||||
aica_sound.channel[0].FNS(0x7d);
|
aica_sound.channel[0].FNS(0x0);
|
||||||
aica_sound.channel[0].DISDL(0xf);
|
aica_sound.channel[0].DISDL(0xf);
|
||||||
aica_sound.channel[0].DIPAN(0x0);
|
aica_sound.channel[0].DIPAN(0x0);
|
||||||
|
|
||||||
@ -72,6 +72,8 @@ void main()
|
|||||||
dram[0] = reinterpret_cast<uint32_t>(&chunk[0][0]);
|
dram[0] = reinterpret_cast<uint32_t>(&chunk[0][0]);
|
||||||
dram[1] = reinterpret_cast<uint32_t>(&chunk[1][0]);
|
dram[1] = reinterpret_cast<uint32_t>(&chunk[1][0]);
|
||||||
|
|
||||||
|
request_chunk();
|
||||||
|
|
||||||
aica_sound.channel[0].SA(reinterpret_cast<const uint32_t>(&chunk[0][0]));
|
aica_sound.channel[0].SA(reinterpret_cast<const uint32_t>(&chunk[0][0]));
|
||||||
aica_sound.channel[0].KYONEX(1);
|
aica_sound.channel[0].KYONEX(1);
|
||||||
|
|
||||||
@ -99,16 +101,18 @@ void main()
|
|||||||
request_chunk();
|
request_chunk();
|
||||||
|
|
||||||
uint32_t sample = 0;
|
uint32_t sample = 0;
|
||||||
const uint32_t target = 16384 + (16384 * 10 / 12);
|
constexpr uint32_t samples_per_sample = 2;
|
||||||
constexpr uint32_t sample_interval = (1 << 10);
|
constexpr uint32_t target = chunk_size / 2 * samples_per_sample;
|
||||||
|
constexpr uint32_t scire__sample_interval = (1 << 10);
|
||||||
|
constexpr uint32_t scipd__sample_interval = (1 << 10);
|
||||||
while (sample < target) {
|
while (sample < target) {
|
||||||
//aica_sound.common.tactl_tima = aica::tactl_tima::TACTL(tactl)
|
//aica_sound.common.tactl_tima = aica::tactl_tima::TACTL(tactl)
|
||||||
// | aica::tactl_tima::TIMA(tima);
|
// | aica::tactl_tima::TIMA(tima);
|
||||||
|
|
||||||
//while (!(aica_sound.common.SCIPD() & timer_a_interrupt));
|
//while (!(aica_sound.common.SCIPD() & timer_a_interrupt));
|
||||||
//aica_sound.common.scire = timer_a_interrupt;
|
//aica_sound.common.scire = timer_a_interrupt;
|
||||||
while (!(aica_sound.common.SCIPD() & sample_interval));
|
while (!(aica_sound.common.SCIPD() & scipd__sample_interval));
|
||||||
aica_sound.common.scire = sample_interval;
|
aica_sound.common.scire = scire__sample_interval;
|
||||||
|
|
||||||
sample++;
|
sample++;
|
||||||
}
|
}
|
||||||
|
@ -82,11 +82,11 @@ out_filename = sys.argv[2]
|
|||||||
|
|
||||||
with open(in_filename, 'rb') as f:
|
with open(in_filename, 'rb') as f:
|
||||||
buf = f.read()
|
buf = f.read()
|
||||||
#pvrt = parse_pvrt_header(buf)
|
pvrt = parse_pvrt_header(buf)
|
||||||
#canvas = decode_vq_indices(pvrt.codebook, pvrt.indices, pvrt.width, pvrt.height)
|
canvas = decode_vq_indices(pvrt.codebook, pvrt.indices, pvrt.width, pvrt.height)
|
||||||
canvas = decode_vq_indices(buf[:256 * 4 * 2], buf[256*4*2:], 128, 64)
|
#canvas = decode_vq_indices(buf[:256 * 4 * 2], buf[256*4*2:], 256, 256)
|
||||||
|
print(pvrt.texture_data_size, pvrt.texture_type, pvrt.width, pvrt.height)
|
||||||
#palimage = Image.new('RGB', (pvrt.width, pvrt.height))
|
palimage = Image.new('RGB', (pvrt.width, pvrt.height))
|
||||||
palimage = Image.new('RGB', (128, 64))
|
#palimage = Image.new('RGB', (256, 256))
|
||||||
palimage.putdata(canvas)
|
palimage.putdata(canvas)
|
||||||
palimage.save(out_filename)
|
palimage.save(out_filename)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user