Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
bebb94738c
32
.travis.yml
32
.travis.yml
@ -1,32 +0,0 @@
|
|||||||
language: generic
|
|
||||||
os: linux
|
|
||||||
dist: trusty
|
|
||||||
sudo: required
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- g++-7
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
- CORE=sameboy
|
|
||||||
- COMPILER_NAME=gcc CXX=g++-7 CC=gcc-7
|
|
||||||
matrix:
|
|
||||||
- PLATFORM=linux_x64
|
|
||||||
before_script:
|
|
||||||
- pwd
|
|
||||||
- mkdir -p ~/bin
|
|
||||||
- ln -s /usr/bin/gcc-7 ~/bin/gcc
|
|
||||||
- ln -s /usr/bin/g++-7 ~/bin/g++
|
|
||||||
- ln -s /usr/bin/cpp-7 ~/bin/cpp
|
|
||||||
- export PATH=~/bin:$PATH
|
|
||||||
- ls -l ~/bin
|
|
||||||
- echo $PATH
|
|
||||||
- g++-7 --version
|
|
||||||
- g++ --version
|
|
||||||
script:
|
|
||||||
- cd ~/
|
|
||||||
- git clone --depth=50 https://github.com/libretro/libretro-super
|
|
||||||
- cd libretro-super/travis
|
|
||||||
- ./build.sh
|
|
@ -80,14 +80,14 @@ Start:
|
|||||||
; Play first sound
|
; Play first sound
|
||||||
ld a, $83
|
ld a, $83
|
||||||
call PlaySound
|
call PlaySound
|
||||||
ld b, 15
|
ld b, 5
|
||||||
call WaitBFrames
|
call WaitBFrames
|
||||||
; Play second sound
|
; Play second sound
|
||||||
ld a, $c1
|
ld a, $c1
|
||||||
call PlaySound
|
call PlaySound
|
||||||
|
|
||||||
; Wait ~2.5 seconds
|
; Wait ~1.15 seconds
|
||||||
ld b, 150
|
ld b, 70
|
||||||
call WaitBFrames
|
call WaitBFrames
|
||||||
|
|
||||||
; Set registers to match the original DMG boot
|
; Set registers to match the original DMG boot
|
||||||
@ -123,9 +123,13 @@ DoubleBitsAndWriteRow:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
WaitFrame:
|
WaitFrame:
|
||||||
ldh a, [$44]
|
push hl
|
||||||
cp $90
|
ld hl, $FF0F
|
||||||
jr nz, WaitFrame
|
res 0, [hl]
|
||||||
|
.wait
|
||||||
|
bit 0, [hl]
|
||||||
|
jr z, .wait
|
||||||
|
pop hl
|
||||||
ret
|
ret
|
||||||
|
|
||||||
WaitBFrames:
|
WaitBFrames:
|
||||||
|
Binary file not shown.
Binary file not shown.
31
Core/apu.c
31
Core/apu.c
@ -27,11 +27,11 @@ static void update_sample(GB_gameboy_t *gb, unsigned index, uint8_t value, unsig
|
|||||||
if (gb->apu_output.sample_rate) {
|
if (gb->apu_output.sample_rate) {
|
||||||
unsigned left_volume = 0;
|
unsigned left_volume = 0;
|
||||||
if (gb->io_registers[GB_IO_NR51] & (1 << index)) {
|
if (gb->io_registers[GB_IO_NR51] & (1 << index)) {
|
||||||
left_volume = gb->io_registers[GB_IO_NR50] & 7;
|
left_volume = (gb->io_registers[GB_IO_NR50] & 7) + 1;
|
||||||
}
|
}
|
||||||
unsigned right_volume = 0;
|
unsigned right_volume = 0;
|
||||||
if (gb->io_registers[GB_IO_NR51] & (0x10 << index)) {
|
if (gb->io_registers[GB_IO_NR51] & (0x10 << index)) {
|
||||||
right_volume = (gb->io_registers[GB_IO_NR50] >> 4) & 7;
|
right_volume = ((gb->io_registers[GB_IO_NR50] >> 4) & 7) + 1;
|
||||||
}
|
}
|
||||||
GB_sample_t output = {(0xf - value) * left_volume, (0xf - value) * right_volume};
|
GB_sample_t output = {(0xf - value) * left_volume, (0xf - value) * right_volume};
|
||||||
if (*(uint32_t *)&(gb->apu_output.current_sample[index]) != *(uint32_t *)&output) {
|
if (*(uint32_t *)&(gb->apu_output.current_sample[index]) != *(uint32_t *)&output) {
|
||||||
@ -575,6 +575,14 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value)
|
|||||||
gb->apu.square_channels[index].sample_countdown = (gb->apu.square_channels[index].sample_length ^ 0x7FF) * 2 + 4 - gb->apu.lf_div;
|
gb->apu.square_channels[index].sample_countdown = (gb->apu.square_channels[index].sample_length ^ 0x7FF) * 2 + 4 - gb->apu.lf_div;
|
||||||
}
|
}
|
||||||
gb->apu.square_channels[index].current_volume = gb->io_registers[index == GB_SQUARE_1 ? GB_IO_NR12 : GB_IO_NR22] >> 4;
|
gb->apu.square_channels[index].current_volume = gb->io_registers[index == GB_SQUARE_1 ? GB_IO_NR12 : GB_IO_NR22] >> 4;
|
||||||
|
|
||||||
|
/* The volume changes caused by NRX4 sound start take effect instantly (i.e. the effect the previously
|
||||||
|
started sound). The playback itself is not instant which is why we don't update the sample for other
|
||||||
|
cases. */
|
||||||
|
if (gb->apu.is_active[index]) {
|
||||||
|
update_square_sample(gb, index);
|
||||||
|
}
|
||||||
|
|
||||||
gb->apu.square_channels[index].volume_countdown = gb->io_registers[index == GB_SQUARE_1 ? GB_IO_NR12 : GB_IO_NR22] & 7;
|
gb->apu.square_channels[index].volume_countdown = gb->io_registers[index == GB_SQUARE_1 ? GB_IO_NR12 : GB_IO_NR22] & 7;
|
||||||
|
|
||||||
if ((gb->io_registers[index == GB_SQUARE_1 ? GB_IO_NR12 : GB_IO_NR22] & 0xF8) != 0) {
|
if ((gb->io_registers[index == GB_SQUARE_1 ? GB_IO_NR12 : GB_IO_NR22] & 0xF8) != 0) {
|
||||||
@ -599,7 +607,6 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value)
|
|||||||
if (!gb->apu.square_sweep_countdown) gb->apu.square_sweep_countdown = 8;
|
if (!gb->apu.square_sweep_countdown) gb->apu.square_sweep_countdown = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note that we don't change the sample just yet! This was verified on hardware. */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* APU glitch - if length is enabled while the DIV-divider's LSB is 1, tick the length once. */
|
/* APU glitch - if length is enabled while the DIV-divider's LSB is 1, tick the length once. */
|
||||||
@ -718,7 +725,10 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value)
|
|||||||
}
|
}
|
||||||
else if (gb->apu.is_active[GB_NOISE]){
|
else if (gb->apu.is_active[GB_NOISE]){
|
||||||
nrx2_glitch(&gb->apu.noise_channel.current_volume, value, gb->io_registers[reg]);
|
nrx2_glitch(&gb->apu.noise_channel.current_volume, value, gb->io_registers[reg]);
|
||||||
update_square_sample(gb, GB_NOISE);
|
update_sample(gb, GB_NOISE,
|
||||||
|
(gb->apu.noise_channel.lfsr & 1) ?
|
||||||
|
gb->apu.noise_channel.current_volume : 0,
|
||||||
|
0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -757,6 +767,17 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gb->apu.noise_channel.current_volume = gb->io_registers[GB_IO_NR42] >> 4;
|
gb->apu.noise_channel.current_volume = gb->io_registers[GB_IO_NR42] >> 4;
|
||||||
|
|
||||||
|
/* The volume changes caused by NRX4 sound start take effect instantly (i.e. the effect the previously
|
||||||
|
started sound). The playback itself is not instant which is why we don't update the sample for other
|
||||||
|
cases. */
|
||||||
|
if (gb->apu.is_active[GB_NOISE]) {
|
||||||
|
update_sample(gb, GB_NOISE,
|
||||||
|
(gb->apu.noise_channel.lfsr & 1) ?
|
||||||
|
gb->apu.noise_channel.current_volume : 0,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
|
||||||
gb->apu.noise_channel.volume_countdown = gb->io_registers[GB_IO_NR42] & 7;
|
gb->apu.noise_channel.volume_countdown = gb->io_registers[GB_IO_NR42] & 7;
|
||||||
|
|
||||||
if ((gb->io_registers[GB_IO_NR42] & 0xF8) != 0) {
|
if ((gb->io_registers[GB_IO_NR42] & 0xF8) != 0) {
|
||||||
@ -767,8 +788,6 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value)
|
|||||||
gb->apu.noise_channel.pulse_length = 0x40;
|
gb->apu.noise_channel.pulse_length = 0x40;
|
||||||
gb->apu.noise_channel.length_enabled = false;
|
gb->apu.noise_channel.length_enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note that we don't change the sample just yet! This was verified on hardware. */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* APU glitch - if length is enabled while the DIV-divider's LSB is 1, tick the length once. */
|
/* APU glitch - if length is enabled while the DIV-divider's LSB is 1, tick the length once. */
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
|
|
||||||
#ifdef GB_INTERNAL
|
#ifdef GB_INTERNAL
|
||||||
/* Divides nicely and never overflows with 4 channels and 8 volume levels */
|
/* Divides nicely and never overflows with 4 channels and 8 (1-8) volume levels */
|
||||||
#define MAX_CH_AMP 0x1FFE
|
#define MAX_CH_AMP 0x1FE0
|
||||||
#define CH_STEP (MAX_CH_AMP/0xF/7)
|
#define CH_STEP (MAX_CH_AMP/0xF/8)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* APU ticks are 2MHz, triggered by an internal APU clock. */
|
/* APU ticks are 2MHz, triggered by an internal APU clock. */
|
||||||
|
BIN
SDL/drop.bmp
BIN
SDL/drop.bmp
Binary file not shown.
Before Width: | Height: | Size: 68 KiB |
@ -6,6 +6,8 @@ ifneq ($(GIT_VERSION)," unknown")
|
|||||||
CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
|
CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
CFLAGS += -DSAMEBOY_CORE_VERSION=\"$(VERSION)\"
|
||||||
|
|
||||||
ifeq ($(platform),)
|
ifeq ($(platform),)
|
||||||
platform = unix
|
platform = unix
|
||||||
ifeq ($(shell uname -a),)
|
ifeq ($(shell uname -a),)
|
||||||
@ -139,7 +141,7 @@ CFLAGS += -Wall -D__LIBRETRO__ $(fpic) $(INCFLAGS) -std=gnu11 -D_GNU_SOURCE -D
|
|||||||
|
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
$(CORE_DIR)/libretro/%_boot.c: $(CORE_DIR)/BootROMs/prebuilt/%_boot.bin
|
$(CORE_DIR)/libretro/%_boot.c: $(CORE_DIR)/build/bin/BootROMs/%_boot.bin
|
||||||
echo "/* AUTO-GENERATED */" > $@
|
echo "/* AUTO-GENERATED */" > $@
|
||||||
echo "const unsigned char $(notdir $(@:%.c=%))[] = {" >> $@
|
echo "const unsigned char $(notdir $(@:%.c=%))[] = {" >> $@
|
||||||
hexdump -v -e '/1 "0x%02x, "' $< >> $@
|
hexdump -v -e '/1 "0x%02x, "' $< >> $@
|
||||||
|
Loading…
Reference in New Issue
Block a user