m68k: more reasonable stack pointer value
The sound_cpu example works consistently on all emulators and real hardware now.
This commit is contained in:
parent
8246b94aee
commit
f2b53ee62a
8
Makefile
8
Makefile
@ -74,6 +74,11 @@ scsp/sine-44100-s16be-1ch.pcm:
|
||||
|
||||
scsp/slot.elf: scsp/slot.o scsp/sine-44100-s16be-1ch.pcm.o
|
||||
|
||||
m68k:
|
||||
|
||||
m68k/%.bin: m68k
|
||||
$(MAKE) -C m68k $(notdir $@)
|
||||
|
||||
scsp/sound_cpu.elf: scsp/sound_cpu.o m68k/slot.bin.o
|
||||
|
||||
# clean
|
||||
@ -89,3 +94,6 @@ clean-sh:
|
||||
common/keyboard.cpp \
|
||||
common/keyboard.hpp \
|
||||
wordle/word_list.hpp
|
||||
|
||||
|
||||
PHONY: m68k
|
||||
|
@ -1,5 +0,0 @@
|
||||
extern "C"
|
||||
void start(void)
|
||||
{
|
||||
while (1) {}
|
||||
}
|
@ -10,7 +10,7 @@ void main()
|
||||
{
|
||||
for (long i = 0; i < 807; i++) { asm volatile ("nop"); } // wait for (way) more than 30µs
|
||||
|
||||
scsp.reg.ctrl.MIXER = MIXER__MEM4MB | MIXER__DAC18B | MIXER__MVOL(0xf);
|
||||
scsp.reg.ctrl.MIXER = MIXER__MEM4MB | MIXER__MVOL(0xf);
|
||||
|
||||
const uint32_t sine_start = reinterpret_cast<uint32_t>(&_sine_start);
|
||||
|
||||
|
@ -2,45 +2,35 @@
|
||||
|
||||
#include "smpc.h"
|
||||
#include "scsp.h"
|
||||
#include "vdp2.h"
|
||||
|
||||
#include "../common/copy.hpp"
|
||||
#include "../common/vdp2_func.hpp"
|
||||
|
||||
extern void * _binary_m68k_slot_bin_start __asm("_binary_m68k_slot_bin_start");
|
||||
extern void * _binary_m68k_slot_bin_size __asm("_binary_m68k_slot_bin_size");
|
||||
|
||||
void main()
|
||||
{
|
||||
v_blank_in();
|
||||
/* SEGA SATURN TECHNICAL BULLETIN # 51
|
||||
|
||||
/*
|
||||
while ((smpc.reg.SF & 1) != 0);
|
||||
smpc.reg.SF = 1;
|
||||
smpc.reg.COMREG = COMREG__SNDOFF;
|
||||
while (smpc.reg.oreg[31] != 0b00000111);
|
||||
The document suggests that Sound RAM is (somewhat) preserved
|
||||
during SNDOFF.
|
||||
*/
|
||||
|
||||
while ((smpc.reg.SF & 1) != 0);
|
||||
smpc.reg.SF = 1;
|
||||
smpc.reg.COMREG = COMREG__SNDON;
|
||||
while (smpc.reg.oreg[31] != 0b00000110);
|
||||
*/
|
||||
smpc.reg.COMREG = COMREG__SNDOFF;
|
||||
while (smpc.reg.oreg[31] != OREG31__SNDOFF);
|
||||
|
||||
scsp.reg.ctrl.MIXER = MIXER__MEM4MB | MIXER__DAC18B | MIXER__MVOL(0xf);
|
||||
scsp.reg.ctrl.MIXER = MIXER__MEM4MB;
|
||||
|
||||
uint32_t * m68k_main_start = (uint32_t *)&_binary_m68k_slot_bin_start;
|
||||
uint32_t m68k_main_size = (uint32_t)&_binary_m68k_slot_bin_size;
|
||||
copy<uint32_t>(&scsp.ram.u32[0], m68k_main_start, m68k_main_size);
|
||||
|
||||
while ((smpc.reg.SF & 1) != 0);
|
||||
smpc.reg.SF = 1;
|
||||
smpc.reg.COMREG = COMREG__SNDOFF;
|
||||
while (smpc.reg.oreg[31] != 0b00000111);
|
||||
|
||||
while ((smpc.reg.SF & 1) != 0);
|
||||
smpc.reg.SF = 1;
|
||||
smpc.reg.COMREG = COMREG__SNDON;
|
||||
while (smpc.reg.oreg[31] != 0b00000110);
|
||||
while (smpc.reg.oreg[31] != OREG31__SNDON);
|
||||
|
||||
// do nothing while the sound CPU manipulates the SCSP
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user