You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(208) |
Nov
(108) |
Dec
(114) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(160) |
Feb
(184) |
Mar
(149) |
Apr
(148) |
May
(168) |
Jun
(144) |
Jul
(194) |
Aug
(47) |
Sep
(40) |
Oct
(44) |
Nov
(54) |
Dec
(30) |
| 2005 |
Jan
(77) |
Feb
(77) |
Mar
(69) |
Apr
(22) |
May
(21) |
Jun
(4) |
Jul
(3) |
Aug
(1) |
Sep
(11) |
Oct
(26) |
Nov
|
Dec
(10) |
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(7) |
Jun
(11) |
Jul
(59) |
Aug
(51) |
Sep
(34) |
Oct
(6) |
Nov
(4) |
Dec
(24) |
| 2007 |
Jan
(102) |
Feb
(69) |
Mar
(50) |
Apr
(56) |
May
(198) |
Jun
(119) |
Jul
(51) |
Aug
(48) |
Sep
(49) |
Oct
(87) |
Nov
(107) |
Dec
(79) |
| 2008 |
Jan
(46) |
Feb
(32) |
Mar
(60) |
Apr
(15) |
May
(39) |
Jun
(60) |
Jul
(30) |
Aug
(26) |
Sep
(11) |
Oct
(26) |
Nov
(50) |
Dec
(56) |
| 2009 |
Jan
(55) |
Feb
(7) |
Mar
(8) |
Apr
(21) |
May
(15) |
Jun
(13) |
Jul
(20) |
Aug
(14) |
Sep
(19) |
Oct
(6) |
Nov
(3) |
Dec
(7) |
| 2010 |
Jan
(4) |
Feb
(9) |
Mar
(1) |
Apr
|
May
(13) |
Jun
(1) |
Jul
(4) |
Aug
(11) |
Sep
(11) |
Oct
(23) |
Nov
(16) |
Dec
(33) |
| 2011 |
Jan
(49) |
Feb
(33) |
Mar
(12) |
Apr
(73) |
May
(44) |
Jun
(71) |
Jul
(14) |
Aug
(3) |
Sep
(12) |
Oct
|
Nov
(44) |
Dec
(25) |
| 2012 |
Jan
(36) |
Feb
(28) |
Mar
(7) |
Apr
|
May
(21) |
Jun
(14) |
Jul
(7) |
Aug
|
Sep
(8) |
Oct
(18) |
Nov
(25) |
Dec
(59) |
| 2013 |
Jan
(30) |
Feb
(30) |
Mar
(14) |
Apr
(7) |
May
(91) |
Jun
(11) |
Jul
(5) |
Aug
(4) |
Sep
(21) |
Oct
(6) |
Nov
|
Dec
(4) |
| 2014 |
Jan
(6) |
Feb
(5) |
Mar
(3) |
Apr
(2) |
May
(7) |
Jun
|
Jul
(3) |
Aug
(2) |
Sep
(6) |
Oct
|
Nov
(1) |
Dec
(8) |
| 2015 |
Jan
(7) |
Feb
(2) |
Mar
(77) |
Apr
(23) |
May
(69) |
Jun
(26) |
Jul
(2) |
Aug
(4) |
Sep
(2) |
Oct
(7) |
Nov
(9) |
Dec
(17) |
| 2016 |
Jan
(5) |
Feb
(1) |
Mar
(18) |
Apr
(57) |
May
(134) |
Jun
(96) |
Jul
(52) |
Aug
(76) |
Sep
(26) |
Oct
(49) |
Nov
(44) |
Dec
(23) |
| 2017 |
Jan
(72) |
Feb
(13) |
Mar
(29) |
Apr
(19) |
May
(61) |
Jun
(75) |
Jul
(58) |
Aug
(165) |
Sep
(62) |
Oct
(23) |
Nov
(41) |
Dec
(11) |
| 2018 |
Jan
(18) |
Feb
(16) |
Mar
(20) |
Apr
(56) |
May
(28) |
Jun
(49) |
Jul
(37) |
Aug
(15) |
Sep
(32) |
Oct
(11) |
Nov
(10) |
Dec
(11) |
| 2019 |
Jan
(50) |
Feb
(12) |
Mar
(26) |
Apr
(12) |
May
(6) |
Jun
|
Jul
(6) |
Aug
|
Sep
(10) |
Oct
(1) |
Nov
(1) |
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(12) |
Oct
|
Nov
|
Dec
|
| 2021 |
Jan
|
Feb
(39) |
Mar
(31) |
Apr
|
May
(2) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2023 |
Jan
(1) |
Feb
(1) |
Mar
(19) |
Apr
(2) |
May
(4) |
Jun
(14) |
Jul
(11) |
Aug
(7) |
Sep
(7) |
Oct
(18) |
Nov
(5) |
Dec
|
| 2024 |
Jan
(2) |
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
(7) |
Nov
|
Dec
|
|
From: <sba...@us...> - 2023-10-21 10:28:53
|
This is an automated email from the git hooks/post-receive-user script.
sbaldovi pushed a change to branch master
in repository fuse.
from f8046953 Distribute sp0256.h and uspeech.h in source tarballs
new ce0a650e Fix SCAN bug in uPD765 FDC
new 84f7feba Add debugging info in uPD765 FDC
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
peripherals/disk/upd_fdc.c | 162 +++++++++++++++++++++++++++++++++++++++++++--
peripherals/disk/upd_fdc.h | 7 +-
2 files changed, 164 insertions(+), 5 deletions(-)
|
|
From: <sba...@us...> - 2023-10-08 06:16:56
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/f80469535c8fa61531b1108fba5da5b23133406c/ The following commit(s) were added to refs/heads/master by this push: new f8046953 Distribute sp0256.h and uspeech.h in source tarballs f8046953 is described below commit f80469535c8fa61531b1108fba5da5b23133406c Author: Sergio Baldoví <ser...@gm...> AuthorDate: Sun Oct 8 08:16:31 2023 +0200 Distribute sp0256.h and uspeech.h in source tarballs --- peripherals/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/peripherals/Makefile.am b/peripherals/Makefile.am index 336123a3..0e8d7050 100644 --- a/peripherals/Makefile.am +++ b/peripherals/Makefile.am @@ -90,7 +90,9 @@ noinst_HEADERS += \ peripherals/sound/covox.h \ peripherals/sound/fuller.h \ peripherals/sound/melodik.h \ + peripherals/sound/sp0256.h \ peripherals/sound/specdrum.h \ + peripherals/sound/uspeech.h \ peripherals/disk/beta.h \ peripherals/disk/crc.h \ peripherals/disk/didaktik.h \ |
|
From: <sba...@us...> - 2023-10-08 05:31:52
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/eacc10071ed98d6da148bf145030154cd1ac4e4f/ The following commit(s) were added to refs/heads/master by this push: new eacc1007 Group empty memory mapping of Spectrum 16K on debugger eacc1007 is described below commit eacc10071ed98d6da148bf145030154cd1ac4e4f Author: Sergio Baldoví <ser...@gm...> AuthorDate: Sun Oct 8 07:31:29 2023 +0200 Group empty memory mapping of Spectrum 16K on debugger --- machines/spec16.c | 1 + 1 file changed, 1 insertion(+) diff --git a/machines/spec16.c b/machines/spec16.c index ef7b108a..acee8f62 100644 --- a/machines/spec16.c +++ b/machines/spec16.c @@ -78,6 +78,7 @@ ensure_empty_mapping( void ) for( i = 0; i < MEMORY_PAGES_IN_16K; i++ ) { memory_page *page = &empty_mapping[i]; page->page = empty_chunk + i * MEMORY_PAGE_SIZE; + page->offset = i * MEMORY_PAGE_SIZE; page->writable = 0; page->contended = 0; page->source = memory_source_none; |
|
From: <sba...@us...> - 2023-10-08 05:11:38
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse-utils. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse-utils/ci/99101d6964c169410d4c730d4ca201de99a85c07/ The following commit(s) were added to refs/heads/master by this push: new 99101d6 Add uSpeech block to snapdump 99101d6 is described below commit 99101d6964c169410d4c730d4ca201de99a85c07 Author: Sergio Baldoví <ser...@gm...> AuthorDate: Sun Oct 8 07:11:16 2023 +0200 Add uSpeech block to snapdump --- snapdump.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/snapdump.c b/snapdump.c index 7e04d2e..313e10f 100644 --- a/snapdump.c +++ b/snapdump.c @@ -531,6 +531,16 @@ dump_ulaplus( libspectrum_snap *snap ) libspectrum_snap_ulaplus_ff_register( snap ) ); } +static void +dump_uspeech( libspectrum_snap *snap ) +{ + if( !libspectrum_snap_uspeech_active( snap ) ) + return; + + printf( "\nuSpeech\n" ); + printf( "uSpeech paged: %d\n", libspectrum_snap_uspeech_paged( snap ) ); +} + static void dump_zxatasp( libspectrum_snap *snap ) { @@ -606,6 +616,7 @@ static const snap_periph_t periph_list[] = { { libspectrum_snap_dock_active, NULL, "Timex Dock cartridge" }, { libspectrum_snap_ulaplus_active, dump_ulaplus, "ULAplus" }, { libspectrum_snap_usource_active, NULL, "uSource" }, + { libspectrum_snap_uspeech_active, dump_uspeech, "uSpeech" }, { libspectrum_snap_zxatasp_active, dump_zxatasp, "ZXATASP" }, { libspectrum_snap_zxcf_active, dump_zxcf, "ZXCF" }, { libspectrum_snap_zxmmc_active, NULL, "ZXMMC" }, |
|
From: <sba...@us...> - 2023-10-08 04:59:36
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/c80f3d9b705e7bd724bf1139f4eab7ed64415a86/ commit c80f3d9b705e7bd724bf1139f4eab7ed64415a86 Merge: 7718c3a4 7d00e36b Author: Sergio Baldoví <ser...@gm...> AuthorDate: Sun Oct 8 06:57:53 2023 +0200 Merge branch 'patches-142-currah-uspeech' ChangeLog | 4 + README | 4 +- data/shell-completion/bash/fuse | 14 +- fuse.c | 2 + infrastructure/startup_manager.h | 1 + machines/machines_periph.c | 1 + man/fuse.1 | 62 +- memory_pages.c | 34 +- menu.c | 8 +- menu_data.dat | 8 +- periph.h | 1 + peripherals/Makefile.am | 2 + peripherals/sound/sp0256.c | 1544 ++++++++++++++++++++++++++++++++++++++ peripherals/sound/sp0256.h | 42 ++ peripherals/sound/uspeech.c | 443 +++++++++++ peripherals/sound/uspeech.h | 46 ++ settings.dat | 4 + settings.pl | 8 +- sound.c | 36 + sound.h | 2 + ui/options.dat | 2 + unittests/unittests.c | 2 + z80/coretest.c | 9 + z80/z80_checks.h | 1 + z80/z80_ops.c | 9 + 25 files changed, 2268 insertions(+), 21 deletions(-) |
|
From: <sba...@us...> - 2023-10-08 04:59:35
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/7d00e36bbe234ec7e6410cd88a64777feb96a341/ commit 7d00e36bbe234ec7e6410cd88a64777feb96a341 Author: Sergio Baldoví <ser...@gm...> AuthorDate: Sun Oct 8 06:43:49 2023 +0200 List Currah uSpeech as a supported peripheral --- ChangeLog | 4 ++++ README | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c7b3a29a..0feb6c5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,10 @@ * Fuse 1.?.? released. + * New features: + * Add Currah µSpeech emulation (Stuart Brady, Vic Chwe and Sergio + Baldoví). + * Emulation core improvements: * Speed up reading emulated memory locations (Jindřich Makovička). diff --git a/README b/README index 5193c1ae..afe4c6a3 100644 --- a/README +++ b/README @@ -26,8 +26,8 @@ What Fuse does have: rollback and 'competition mode'. * Emulation of the Currah µSource, Interface 1, Kempston mouse, Multiface One/128/3 and TTX2000S interfaces. -* Emulation of the Covox, Fuller audio box, Melodik and SpecDrum audio - interfaces. +* Emulation of the Covox, Currah µSpeech, Fuller audio box, Melodik and + SpecDrum audio interfaces. * Emulation of the DivIDE, DivMMC, Spectrum +3e, ZXATASP, ZXCF and ZXMMC storage interfaces. * Emulation of the Beta 128, +D, Didaktik 80/40, DISCiPLE and Opus Discovery |
|
From: <sba...@us...> - 2023-10-08 04:59:34
|
This is an automated email from the git hooks/post-receive-user script.
sbaldovi pushed a change to branch master
in repository fuse.
from 7718c3a4 Merge request #25: GitHub test and nightly builds
add e09eeec1 Initial support for Currah uSpeech peripheral
add 8fd74510 Add UI elements to manage SP0256 ROM file location
add 32768808 Enhanced Currah uSpeech paging logic: - Memory read/write at 0x38 should page the ROM in/out - ROM is mapped to the first 4 Kb only
add a263ed4d Enable snapshot support for Currah uSpeech
add b5830f37 Document SP0256 ROM option and uSpeech memory source
add 4ac12898 Fix ROM entries order in menu.c
add 47275acc Do ZX Spectrum ROM inaccessible while uSpeech is paged
add 2324c3dd Add memory address mirroring and more I/O ports to uSpeech
add adc07599 Fix audio glitches in SP0256 samples
add 8813734d Update SP0256 code from upstream
add a92e319a Beautify uSpeech code with uncrustify
add efffc400 Document uSpeech volume option
add 1bb5a4cf Add uSpeech page/unpage events to debugger
add bd36f290 Limit uSpeech to 48K machines
add 404a9b53 uSpeech intonation changes SP0256 clock frequency
add 0302d3b9 Avoid the use of 64-bit integers
add bd5c569d Disable debugging macros
add bf896c0d Declare missing function prototypes and unused parameters
add c8f12246 Fusify C99 variable types (we are still C89)
add 03924f62 Document sp0256 ROM
new 7d00e36b List Currah uSpeech as a supported peripheral
new c80f3d9b Merge branch 'patches-142-currah-uspeech'
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
ChangeLog | 4 +
README | 4 +-
data/shell-completion/bash/fuse | 14 +-
fuse.c | 2 +
infrastructure/startup_manager.h | 1 +
machines/machines_periph.c | 1 +
man/fuse.1 | 62 +-
memory_pages.c | 34 +-
menu.c | 8 +-
menu_data.dat | 8 +-
periph.h | 1 +
peripherals/Makefile.am | 2 +
peripherals/sound/sp0256.c | 1544 ++++++++++++++++++++++++++++
bitmap.h => peripherals/sound/sp0256.h | 35 +-
peripherals/sound/uspeech.c | 443 ++++++++
peripherals/{usource.h => sound/uspeech.h} | 28 +-
settings.dat | 4 +
settings.pl | 8 +-
sound.c | 36 +
sound.h | 2 +
ui/options.dat | 2 +
unittests/unittests.c | 2 +
z80/coretest.c | 9 +
z80/z80_checks.h | 1 +
z80/z80_ops.c | 9 +
25 files changed, 2213 insertions(+), 51 deletions(-)
create mode 100644 peripherals/sound/sp0256.c
copy bitmap.h => peripherals/sound/sp0256.h (60%)
create mode 100644 peripherals/sound/uspeech.c
copy peripherals/{usource.h => sound/uspeech.h} (61%)
|
|
From: <sba...@us...> - 2023-10-08 04:55:50
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository libspectrum. View the commit online: https://sourceforge.net/p/fuse-emulator/libspectrum/ci/e85c934f585cb8caff5eeab55899617b606abfeb/ commit e85c934f585cb8caff5eeab55899617b606abfeb Merge: 8b374cb 1ec4c7d Author: Sergio Baldoví <ser...@gm...> AuthorDate: Sun Oct 8 06:55:03 2023 +0200 Merge branch 'patches-142-currah-uspeech' doc/libspectrum.txt | 3 +++ dsnap.c | 4 ++++ sna.c | 4 ++++ snap_accessors.txt | 4 ++++ szx.c | 43 ++++++++++++++++++++++++++++++++++++++++++- z80.c | 4 ++++ 6 files changed, 61 insertions(+), 1 deletion(-) |
|
From: <sba...@us...> - 2023-10-08 04:55:48
|
This is an automated email from the git hooks/post-receive-user script.
sbaldovi pushed a change to branch master
in repository libspectrum.
from 8b374cb Merge request #13: Fixed unittest checks that require gzip
add 88532db Enable SZX support for Currah uSpeech
add 1ec4c7d Note info loss of uSpeech when writing dsnap, sna or z80 snapshots
new e85c934 Merge branch 'patches-142-currah-uspeech'
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
doc/libspectrum.txt | 3 +++
dsnap.c | 4 ++++
sna.c | 4 ++++
snap_accessors.txt | 4 ++++
szx.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
z80.c | 4 ++++
6 files changed, 61 insertions(+), 1 deletion(-)
|
|
From: <sba...@us...> - 2023-10-01 06:42:04
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch patches-142-currah-uspeech in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/c8f12246f576e14d869217d7cbcdcf9f1d07d902/ commit c8f12246f576e14d869217d7cbcdcf9f1d07d902 Author: Sergio Baldoví <ser...@gm...> AuthorDate: Sun Oct 1 06:31:43 2023 +0200 Fusify C99 variable types (we are still C89) --- peripherals/sound/sp0256.c | 124 ++++++++++++++++++++++---------------------- peripherals/sound/sp0256.h | 10 ++-- peripherals/sound/uspeech.c | 4 +- 3 files changed, 71 insertions(+), 67 deletions(-) diff --git a/peripherals/sound/sp0256.c b/peripherals/sound/sp0256.c index e1134d3d..57f18f48 100644 --- a/peripherals/sound/sp0256.c +++ b/peripherals/sound/sp0256.c @@ -82,25 +82,25 @@ #define FIFO_ADDR ( 0x1800 << 3 ) /* SP0256 address of speech FIFO. */ typedef struct lpc12_t { - int rpt, cnt; /* Repeat counter, Period down-counter. */ - uint32_t per, rng; /* Period, Amplitude, Random Number Generator */ + int rpt, cnt; /* Repeat counter, Period down-counter. */ + libspectrum_dword per, rng; /* Period, Amplitude, Random Number Generator */ int amp; - int16_t f_coef[6]; /* F0 through F5. */ - int16_t b_coef[6]; /* B0 through B5. */ - int16_t z_data[6][2]; /* Time-delay data for the */ - /* filter stages. */ - uint8_t r[16]; /* The encoded register set. */ + libspectrum_signed_word f_coef[6]; /* F0 through F5. */ + libspectrum_signed_word b_coef[6]; /* B0 through B5. */ + libspectrum_signed_word z_data[6][2]; /* Time-delay data for the */ + /* filter stages. */ + libspectrum_byte r[16]; /* The encoded register set. */ int interp; } lpc12_t; typedef struct sp0256_t { - int silent; /* Flag: SP0256 is silent. */ + int silent; /* Flag: SP0256 is silent. */ - int16_t *scratch; /* Scratch buffer for audio. */ - uint32_t sc_head; /* Head/Tail pointer into scratch circular buf */ - uint32_t sc_tail; /* Head/Tail pointer into scratch circular buf */ - int32_t sound_current; + libspectrum_signed_word *scratch; /* Scratch buffer for audio. */ + libspectrum_dword sc_head; /* Head/Tail pointer into scratch circular buf */ + libspectrum_dword sc_tail; /* Head/Tail pointer into scratch circular buf */ + libspectrum_signed_dword sound_current; lpc12_t filt; /* 12-pole filter */ int lrq; /* Load ReQuest. == 0 if we can accept a load */ @@ -109,18 +109,18 @@ typedef struct sp0256_t { int stack; /* Microcontroller's PC stack. */ int fifo_sel; /* True when executing from FIFO. */ int halted; /* True when CPU is halted. */ - uint32_t mode; /* Mode register. */ - uint32_t page; /* Page set by SETPAGE */ + libspectrum_dword mode; /* Mode register. */ + libspectrum_dword page; /* Page set by SETPAGE */ - uint32_t fifo_head; /* FIFO head pointer (where new data goes). */ - uint32_t fifo_tail; /* FIFO tail pointer (where data comes from). */ - uint32_t fifo_bitp; /* FIFO bit-pointer (for partial decles). */ - uint16_t fifo[64]; /* The 64-decle FIFO. */ + libspectrum_dword fifo_head; /* FIFO head pointer (where new data goes). */ + libspectrum_dword fifo_tail; /* FIFO tail pointer (where data comes from). */ + libspectrum_dword fifo_bitp; /* FIFO bit-pointer (for partial decles). */ + libspectrum_word fifo[64]; /* The 64-decle FIFO. */ - const uint8_t *rom[16]; /* 4K ROM pages. */ + const libspectrum_byte *rom[16]; /* 4K ROM pages. */ - uint32_t clock; /* Clock - crystal frequency */ - unsigned int clock_per_samp; /* Sample duration in Z80 tstates */ + libspectrum_dword clock; /* Clock - crystal frequency */ + unsigned int clock_per_samp; /* Sample duration in Z80 tstates */ } sp0256_t; @@ -128,38 +128,39 @@ typedef struct sp0256_t { /* sp0256_run -- Where the magic happens. Generate voice data for */ /* our good friend, the SP0256. */ /* ======================================================================== */ -static uint32_t sp0256_run( sp0256_t *s, uint32_t len ); +static libspectrum_dword sp0256_run( sp0256_t *s, libspectrum_dword len ); /* ======================================================================== */ /* sp0256_read_lrq -- Handle reads of the SP0256 LRQ line. */ /* ======================================================================== */ -static uint32_t sp0256_read_lrq( sp0256_t *s ); +static libspectrum_dword sp0256_read_lrq( sp0256_t *s ); /* ======================================================================== */ /* sp0256_write_ald -- Handle writes to the SP0256's Address Load FIFO. */ /* ======================================================================== */ -static void sp0256_write_ald( sp0256_t *s, uint32_t data ); +static void sp0256_write_ald( sp0256_t *s, libspectrum_dword data ); /* ======================================================================== */ /* sp0256_do_init -- Makes a new SP0256. */ /* ======================================================================== */ -static int sp0256_do_init( sp0256_t *s, uint8_t *sp0256rom ); +static int sp0256_do_init( sp0256_t *s, libspectrum_byte *sp0256rom ); /* ======================================================================== */ /* Internal function prototypes. */ /* ======================================================================== */ -static inline int16_t limit( int16_t s ); -static inline uint32_t bitrev( uint32_t val ); -static int lpc12_update( lpc12_t *f, int, int16_t *, uint32_t * ); +static inline libspectrum_signed_word limit( libspectrum_signed_word s ); +static inline libspectrum_dword bitrev( libspectrum_dword val ); +static int lpc12_update( lpc12_t *f, int, libspectrum_signed_word *, + libspectrum_dword * ); static void lpc12_regdec( lpc12_t *f ); -static uint32_t sp0256_getb( sp0256_t *s, int len ); +static libspectrum_dword sp0256_getb( sp0256_t *s, int len ); static void sp0256_micro( sp0256_t *s ); /* ======================================================================== */ /* qtbl -- Coefficient Quantization Table. This comes from a */ /* SP0250 data sheet, and should be correct for SP0256. */ /* ======================================================================== */ -static const int16_t qtbl[128] = { +static const libspectrum_signed_word qtbl[128] = { 0, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, 105, 113, 121, 129, 137, 145, 153, 161, 169, 177, 185, @@ -181,8 +182,8 @@ static const int16_t qtbl[128] = { /* ======================================================================== */ /* limit -- Limiter function for digital sample output. */ /* ======================================================================== */ -static inline int16_t -limit( int16_t s ) +static inline libspectrum_signed_word +limit( libspectrum_signed_word s ) { #ifdef HIGH_QUALITY /* Higher quality than the original, but who cares? */ if( s > 8191 ) return 8191; @@ -198,7 +199,7 @@ limit( int16_t s ) /* amp_decode -- Decode amplitude register */ /* ======================================================================== */ static int -amp_decode( uint8_t a ) +amp_decode( libspectrum_byte a ) { /* -------------------------------------------------------------------- */ /* Amplitude has 3 bits of exponent and 5 bits of mantissa. This */ @@ -226,10 +227,11 @@ amp_decode( uint8_t a ) /* lpc12_update -- Update the 12-pole filter, outputting samples. */ /* ======================================================================== */ static int -lpc12_update( lpc12_t *f, int num_samp, int16_t *out, uint32_t *optr ) +lpc12_update( lpc12_t *f, int num_samp, libspectrum_signed_word *out, + libspectrum_dword *optr ) { int i, j; - int16_t samp; + libspectrum_signed_word samp; int do_int, bit; int oidx = *optr; @@ -396,7 +398,7 @@ lpc12_regdec( lpc12_t *f ) enum { AM = 0, PR, B0, F0, B1, F1, B2, F2, B3, F3, B4, F4, B5, F5, IA, IP }; -static const uint16_t sp0256_datafmt[] = { +static const libspectrum_word sp0256_datafmt[] = { /* -------------------------------------------------------------------- */ /* OPCODE 1111: PAUSE */ /* -------------------------------------------------------------------- */ @@ -687,7 +689,7 @@ static const uint16_t sp0256_datafmt[] = { /* 190 */ CR( 8, 0, IP, 0, 0, 0, 0), /* Pit Interp */ }; -static const int16_t sp0256_df_idx[16 * 8] = { +static const libspectrum_signed_word sp0256_df_idx[16 * 8] = { /* OPCODE 0000 */ -1, -1, -1, -1, -1, -1, -1, -1, /* OPCODE 1000 */ -1, -1, -1, -1, -1, -1, -1, -1, /* OPCODE 0100 */ 17, 22, 17, 24, 25, 30, 25, 32, @@ -709,8 +711,8 @@ static const int16_t sp0256_df_idx[16 * 8] = { /* ======================================================================== */ /* bitrev -- Bit-reverse a 32-bit number. */ /* ======================================================================== */ -static inline uint32_t -bitrev( uint32_t val ) +static inline libspectrum_dword +bitrev( libspectrum_dword val ) { val = ( ( val & 0xffff0000 ) >> 16 ) | ( ( val & 0x0000ffff ) << 16 ); val = ( ( val & 0xff00ff00 ) >> 8 ) | ( ( val & 0x00ff00ff ) << 8 ); @@ -724,11 +726,11 @@ bitrev( uint32_t val ) /* ======================================================================== */ /* sp0256_getb -- Get up to 8 bits at the current PC. */ /* ======================================================================== */ -static uint32_t +static libspectrum_dword sp0256_getb( sp0256_t *s, int len ) { - uint32_t data = 0; - uint32_t d0, d1; + libspectrum_dword data = 0; + libspectrum_dword d0, d1; /* -------------------------------------------------------------------- */ /* Fetch data from the FIFO or from the MASK */ @@ -792,9 +794,9 @@ sp0256_getb( sp0256_t *s, int len ) static void sp0256_micro( sp0256_t *s ) { - uint8_t immed4; - uint8_t opcode; - uint16_t cr; + libspectrum_byte immed4; + libspectrum_byte opcode; + libspectrum_word cr; int ctrl_xfer = 0; int repeat = 0; int i, idx0, idx1; @@ -862,7 +864,7 @@ sp0256_micro( sp0256_t *s ) /* -------------------------------------------------------- */ /* Otherwise, this is an RTS / HLT. */ /* -------------------------------------------------------- */ - uint32_t btrg; + libspectrum_dword btrg; /* ---------------------------------------------------- */ /* Figure out our branch target. */ @@ -1135,11 +1137,11 @@ sp0256_micro( sp0256_t *s ) /* sp0256_run -- Where the magic happens. Generate voice data for */ /* our good friend, the SP0256. */ /* ======================================================================== */ -static uint32_t -sp0256_run( sp0256_t *s, uint32_t len ) +static libspectrum_dword +sp0256_run( sp0256_t *s, libspectrum_dword len ) { - int32_t sp0256_now = s->sound_current; - int32_t until = sp0256_now + len; + libspectrum_signed_dword sp0256_now = s->sound_current; + libspectrum_signed_dword until = sp0256_now + len; int samples, did_samp, old_idx; /* -------------------------------------------------------------------- */ @@ -1232,7 +1234,7 @@ sp0256_run( sp0256_t *s, uint32_t len ) /* ======================================================================== */ /* sp0256_read_lrq -- Handle reads from the SP0256. */ /* ======================================================================== */ -static uint32_t +static libspectrum_dword sp0256_read_lrq( sp0256_t *s ) { return s->lrq; @@ -1242,7 +1244,7 @@ sp0256_read_lrq( sp0256_t *s ) /* sp0256_write_ald -- Handle writes to the SP0256's Address LoaD FIFO. */ /* ======================================================================== */ static void -sp0256_write_ald( sp0256_t *s, uint32_t data ) +sp0256_write_ald( sp0256_t *s, libspectrum_dword data ) { if( !s->lrq ) return; @@ -1287,7 +1289,7 @@ sp0256_do_reset( sp0256_t *s ) /* sp0256_do_init -- Makes a new SP0256. */ /* ======================================================================== */ static int -sp0256_do_init( sp0256_t *s, uint8_t *sp0256rom ) +sp0256_do_init( sp0256_t *s, libspectrum_byte *sp0256rom ) { /* -------------------------------------------------------------------- */ /* First, lets zero out the structure to be safe. */ @@ -1302,7 +1304,7 @@ sp0256_do_init( sp0256_t *s, uint8_t *sp0256rom ) /* -------------------------------------------------------------------- */ /* Allocate a scratch buffer for generating 10kHz samples. */ /* -------------------------------------------------------------------- */ - s->scratch = calloc( SCBUF_SIZE, sizeof( int16_t ) ); + s->scratch = calloc( SCBUF_SIZE, sizeof( libspectrum_signed_word ) ); s->sc_head = s->sc_tail = 0; if( !s->scratch ) @@ -1418,13 +1420,13 @@ static const struct allophone_t al2_allophones[ 64 ] = { static sp0256_t sp0256; int -sp0256_init( uint8_t *sp0256rom ) +sp0256_init( libspectrum_byte *sp0256rom ) { return sp0256_do_init( &sp0256, sp0256rom ); } int -sp0256_reset( uint8_t *sp0256rom ) +sp0256_reset( libspectrum_byte *sp0256rom ) { /* Lazy init, if necessary */ if( !sp0256.scratch ) { @@ -1449,10 +1451,10 @@ sp0256_end() static void sp0256_run_to( sp0256_t *s, libspectrum_dword t ) { - uint32_t periph_step; + libspectrum_dword periph_step; - while( s->sound_current < (int32_t) t ) { - int32_t len = t - s->sound_current; + while( s->sound_current < (libspectrum_signed_dword) t ) { + libspectrum_signed_dword len = t - s->sound_current; if( len > 14934 ) len = 14934; periph_step = sp0256_run( s, len ); @@ -1493,7 +1495,7 @@ sp0256_play( int a ) } void -sp0256_set_clock( uint32_t clock ) +sp0256_set_clock( libspectrum_dword clock ) { unsigned int samples; libspectrum_dword processor_speed; @@ -1526,7 +1528,7 @@ sp0256_set_clock( uint32_t clock ) } void -sp0256_change_clock( uint32_t clock ) +sp0256_change_clock( libspectrum_dword clock ) { if( sp0256.clock != clock ) { sp0256_run_to( &sp0256, tstates ); diff --git a/peripherals/sound/sp0256.h b/peripherals/sound/sp0256.h index 6185db43..cfd64d85 100644 --- a/peripherals/sound/sp0256.h +++ b/peripherals/sound/sp0256.h @@ -27,13 +27,15 @@ #ifndef FUSE_SP0256_H #define FUSE_SP0256_H -int sp0256_init( uint8_t *sp0256rom ); -int sp0256_reset( uint8_t *sp0256rom ); +#include "libspectrum.h" + +int sp0256_init( libspectrum_byte *sp0256rom ); +int sp0256_reset( libspectrum_byte *sp0256rom ); void sp0256_end( void ); void sp0256_play( int allophone ); -void sp0256_set_clock( uint32_t clock ); -void sp0256_change_clock( uint32_t clock ); +void sp0256_set_clock( libspectrum_dword clock ); +void sp0256_change_clock( libspectrum_dword clock ); int sp0256_busy( void ); void sp0256_do_frame( void ); diff --git a/peripherals/sound/uspeech.c b/peripherals/sound/uspeech.c index a83598d8..5325306e 100644 --- a/peripherals/sound/uspeech.c +++ b/peripherals/sound/uspeech.c @@ -56,7 +56,7 @@ static int empty_mapping_allocated = 0; static int uspeech_memory_source; -static uint8_t *sp0256rom = NULL; +static libspectrum_byte *sp0256rom = NULL; int uspeech_active = 0; int uspeech_available = 0; @@ -253,7 +253,7 @@ uspeech_load_sp0256_rom( void ) return -1; } - sp0256rom = libspectrum_new( uint8_t, SP0256_ROM_SIZE * 2 ); + sp0256rom = libspectrum_new( libspectrum_byte, SP0256_ROM_SIZE * 2 ); if( !sp0256rom ) { utils_close_file( &rom ); |
|
From: <sba...@us...> - 2023-10-01 06:42:04
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch patches-142-currah-uspeech in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/03924f6234a7c45dd96cb4477fdf8aa7ad68cb83/ commit 03924f6234a7c45dd96cb4477fdf8aa7ad68cb83 Author: Sergio Baldoví <ser...@gm...> AuthorDate: Sun Oct 1 06:39:38 2023 +0200 Document sp0256 ROM --- man/fuse.1 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/man/fuse.1 b/man/fuse.1 index d72c32d5..719619e1 100644 --- a/man/fuse.1 +++ b/man/fuse.1 @@ -5397,6 +5397,19 @@ section for more details on supported disk file formats. .\" .\"------------------------------------------------------------------ .\" +.SH CURRAH \(mcSPEECH +.PP +Currah \(mcSpeech interface is an allophone speech synthesiser. +This interface use a SP0256-AL2 chip that has an internal ROM with +commands to make english allophones. Fuse needs this ROM named as +sp0256-al2.rom in your ROMs directory and its CRC-32 is b504ac15. +.PP +An alternative authorised ROM is distributed by Joe Zbiciak with +CRC-32 df8de0b0. In this case, bit ordering in data bytes is reversed +and need to be adjusted. +.\" +.\"------------------------------------------------------------------ +.\" .SH OPUS DISCOVERY EMULATION .PP By default, Fuse emulates the Opus Discovery interface with the optional 2k RAM |
|
From: <sba...@us...> - 2023-10-01 06:42:01
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch patches-142-currah-uspeech in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/bf896c0de1a438331470743ccee54b30d47eae93/ commit bf896c0de1a438331470743ccee54b30d47eae93 Author: Sergio Baldoví <ser...@gm...> AuthorDate: Thu Sep 28 07:11:19 2023 +0200 Declare missing function prototypes and unused parameters --- peripherals/sound/uspeech.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/peripherals/sound/uspeech.c b/peripherals/sound/uspeech.c index b05cf5f7..a83598d8 100644 --- a/peripherals/sound/uspeech.c +++ b/peripherals/sound/uspeech.c @@ -74,6 +74,8 @@ static void uspeech_port_intonation_normal( libspectrum_word port, static void uspeech_port_intonation_high( libspectrum_word port, libspectrum_byte data ); +static int uspeech_load_sp0256_rom( void ); +static int uspeech_sp0256_reset( void ); static void uspeech_reset( int hard_reset ); static void uspeech_memory_map( void ); @@ -114,7 +116,8 @@ static const char * const event_type_string = "uspeech"; static int page_event, unpage_event; static libspectrum_byte -uspeech_port_play_read( libspectrum_word port, libspectrum_byte *attached ) +uspeech_port_play_read( libspectrum_word port GCC_UNUSED, + libspectrum_byte *attached ) { if( !uspeech_active ) return 0xff; @@ -125,7 +128,8 @@ uspeech_port_play_read( libspectrum_word port, libspectrum_byte *attached ) } static void -uspeech_port_play_write( libspectrum_word port, libspectrum_byte data ) +uspeech_port_play_write( libspectrum_word port GCC_UNUSED, + libspectrum_byte data ) { if( !uspeech_active ) return; @@ -134,7 +138,8 @@ uspeech_port_play_write( libspectrum_word port, libspectrum_byte data ) } static void -uspeech_port_intonation_normal( libspectrum_word port, libspectrum_byte data ) +uspeech_port_intonation_normal( libspectrum_word port GCC_UNUSED, + libspectrum_byte data GCC_UNUSED ) { if( !uspeech_active ) return; @@ -143,7 +148,8 @@ uspeech_port_intonation_normal( libspectrum_word port, libspectrum_byte data ) } static void -uspeech_port_intonation_high( libspectrum_word port, libspectrum_byte data ) +uspeech_port_intonation_high( libspectrum_word port GCC_UNUSED, + libspectrum_byte data GCC_UNUSED ) { if( !uspeech_active ) return; @@ -175,7 +181,7 @@ ensure_empty_mapping( void ) } static int -uspeech_init( void *context ) +uspeech_init( void *context GCC_UNUSED ) { int i; @@ -221,7 +227,7 @@ uspeech_register_startup( void ) } static int -uspeech_load_sp0256_rom() +uspeech_load_sp0256_rom( void ) { int error; char *filename; @@ -264,7 +270,7 @@ uspeech_load_sp0256_rom() } static int -uspeech_sp0256_reset() +uspeech_sp0256_reset( void ) { if( !sp0256rom && uspeech_load_sp0256_rom() ) { return -1; @@ -346,7 +352,8 @@ uspeech_toggle_read( libspectrum_word port GCC_UNUSED, } static void -uspeech_toggle_write( libspectrum_word port GCC_UNUSED, libspectrum_byte val ) +uspeech_toggle_write( libspectrum_word port GCC_UNUSED, + libspectrum_byte val GCC_UNUSED ) { if( !uspeech_available ) return; |
|
From: <sba...@us...> - 2023-10-01 06:42:00
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch patches-142-currah-uspeech in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/bd5c569d9447fb6f42fd85b0d5bdffdeb352e1f0/ commit bd5c569d9447fb6f42fd85b0d5bdffdeb352e1f0 Author: Sergio Baldoví <ser...@gm...> AuthorDate: Tue Sep 26 06:37:22 2023 +0200 Disable debugging macros and refactor to ease enabling debugging macros --- peripherals/sound/sp0256.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/peripherals/sound/sp0256.c b/peripherals/sound/sp0256.c index 979fdb2b..e1134d3d 100644 --- a/peripherals/sound/sp0256.c +++ b/peripherals/sound/sp0256.c @@ -63,11 +63,16 @@ * system view from the SP0256's perspective is documented elsewhere. */ -#define dfprintf(x) +#undef DEBUG_AL2_ALLOPHONE +#undef DEBUG_SP0256 +#undef DEBUG_FIFO + +#ifdef DEBUG_SP0256 +#define debug_printf(x) printf x ; fflush(stdout) +#else #define debug_printf(x) -#define jzp_printf(x, ...) +#endif /* #ifdef DEBUG_SP0256 */ -#define DEBUG_USPEECH_ALLOPHONE #define HIGH_QUALITY #define SCBUF_SIZE ( 4096 ) /* Must be power of 2 */ #define SCBUF_MASK ( SCBUF_SIZE - 1 ) @@ -735,7 +740,7 @@ sp0256_getb( sp0256_t *s, int len ) data = ( ( d1 << 10 ) | d0 ) >> s->fifo_bitp; #ifdef DEBUG_FIFO - dfprintf( ( "SP0256: RD_FIFO %.3X %d.%d %d\n", data & ( ( 1u << len ) - 1 ), + debug_printf( ( "SP0256: RD_FIFO %.3X %d.%d %d\n", data & ( ( 1u << len ) - 1 ), s->fifo_tail, s->fifo_bitp, s->fifo_head ) ); #endif @@ -1331,7 +1336,7 @@ sp0256_do_init( sp0256_t *s, uint8_t *sp0256rom ) return 0; } -#ifdef DEBUG_USPEECH_ALLOPHONE +#ifdef DEBUG_AL2_ALLOPHONE struct allophone_t { const char *name; int length; @@ -1408,7 +1413,7 @@ static const struct allophone_t al2_allophones[ 64 ] = { { "/BB2/", 50 }, /* (bb) */ }; -#endif /* #ifdef DEBUG_USPEECH_ALLOPHONE */ +#endif /* #ifdef DEBUG_AL2_ALLOPHONE */ static sp0256_t sp0256; @@ -1421,7 +1426,6 @@ sp0256_init( uint8_t *sp0256rom ) int sp0256_reset( uint8_t *sp0256rom ) { - debug_printf( "sp0256_reset\n" ); /* Lazy init, if necessary */ if( !sp0256.scratch ) { if( sp0256_do_init( &sp0256, sp0256rom ) ) { @@ -1472,7 +1476,7 @@ sp0256_do_frame( void ) void sp0256_play( int a ) { -#ifdef DEBUG_USPEECH_ALLOPHONE +#ifdef DEBUG_AL2_ALLOPHONE if( a >= 5 && a < 64 ) { if( al2_allophones[ a ].name ) { printf( "sp0256: allophone written: 0x%02x, %s\n", a, @@ -1482,7 +1486,7 @@ sp0256_play( int a ) } fflush( stdout ); } -#endif /* #ifdef DEBUG_USPEECH_ALLOPHONE */ +#endif /* #ifdef DEBUG_AL2_ALLOPHONE */ sp0256_run_to( &sp0256, tstates ); sp0256_write_ald( &sp0256, a ); |
|
From: <sba...@us...> - 2023-10-01 06:41:59
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch patches-142-currah-uspeech in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/0302d3b972810d37d74f9adf03e7ccf56a1b441f/ commit 0302d3b972810d37d74f9adf03e7ccf56a1b441f Author: Sergio Baldoví <ser...@gm...> AuthorDate: Tue Sep 26 05:35:26 2023 +0200 Avoid the use of 64-bit integers We don't need an ever increasing tstate counter. Decrease it at the end of spectrum frames. --- peripherals/sound/sp0256.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/peripherals/sound/sp0256.c b/peripherals/sound/sp0256.c index 222d8595..979fdb2b 100644 --- a/peripherals/sound/sp0256.c +++ b/peripherals/sound/sp0256.c @@ -76,9 +76,6 @@ #define FIFO_ADDR ( 0x1800 << 3 ) /* SP0256 address of speech FIFO. */ -uint64_t sp0256_tstates; -uint64_t sp0256_now; - typedef struct lpc12_t { int rpt, cnt; /* Repeat counter, Period down-counter. */ uint32_t per, rng; /* Period, Amplitude, Random Number Generator */ @@ -98,7 +95,7 @@ typedef struct sp0256_t { int16_t *scratch; /* Scratch buffer for audio. */ uint32_t sc_head; /* Head/Tail pointer into scratch circular buf */ uint32_t sc_tail; /* Head/Tail pointer into scratch circular buf */ - uint64_t sound_current; + int32_t sound_current; lpc12_t filt; /* 12-pole filter */ int lrq; /* Load ReQuest. == 0 if we can accept a load */ @@ -1136,10 +1133,9 @@ sp0256_micro( sp0256_t *s ) static uint32_t sp0256_run( sp0256_t *s, uint32_t len ) { - /* TODO: use 32-bit types only */ - uint64_t until = sp0256_now + len; + int32_t sp0256_now = s->sound_current; + int32_t until = sp0256_now + len; int samples, did_samp, old_idx; - int n = 0; /* -------------------------------------------------------------------- */ /* If the rest of the machine hasn't caught up to us, just return. */ @@ -1212,10 +1208,9 @@ sp0256_run( sp0256_t *s, uint32_t len ) if( did_samp ) { int i; for( i = 0; i < did_samp; i++ ) { - sound_sp0256_write( sp0256_tstates + ( ( n + i ) * s->clock_per_samp ), + sound_sp0256_write( s->sound_current + ( i * s->clock_per_samp ), s->scratch[( i + old_idx ) & SCBUF_MASK] ); } - n += did_samp; } s->sound_current += did_samp * s->clock_per_samp; @@ -1448,17 +1443,16 @@ sp0256_end() } static void -sp0256_run_to( sp0256_t *s, uint64_t t ) +sp0256_run_to( sp0256_t *s, libspectrum_dword t ) { - int64_t periph_step; + uint32_t periph_step; + + while( s->sound_current < (int32_t) t ) { + int32_t len = t - s->sound_current; + if( len > 14934 ) len = 14934; - while( sp0256_tstates < t ) { - int64_t n = t - sp0256_tstates; - if( n > 14934 ) n = 14934; + periph_step = sp0256_run( s, len ); - periph_step = sp0256_run( s, n ); - sp0256_tstates += abs( periph_step ); - sp0256_now += abs( periph_step ); if( !periph_step ) { return; } @@ -1471,7 +1465,8 @@ sp0256_do_frame( void ) /* No op if it wasn't initialised yet */ if( !sp0256.scratch ) return; sp0256_run_to( &sp0256, machine_current->timings.tstates_per_frame ); - sp0256_tstates -= machine_current->timings.tstates_per_frame; + + sp0256.sound_current -= machine_current->timings.tstates_per_frame; } void |
|
From: <sba...@us...> - 2023-10-01 06:41:57
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch patches-142-currah-uspeech in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/404a9b53743d15f7d5e37e3c4407ba5f8695946b/ commit 404a9b53743d15f7d5e37e3c4407ba5f8695946b Author: Sergio Baldoví <ser...@gm...> AuthorDate: Tue Sep 26 04:11:55 2023 +0200 uSpeech intonation changes SP0256 clock frequency This patch improves intonation as Kio and Thomas Busse determined that oscillator frequency for low intonation is about 3.05 MHz and high intonation is 7% higher, i.e., 3.26 MHz. As SP0256 and Z80 have different clocks, sample duration is based on Z80 processor speed to ease synchronisation with spectrum frames. --- peripherals/sound/sp0256.c | 63 +++++++++++++++++++++++++++++++++++---------- peripherals/sound/sp0256.h | 3 ++- peripherals/sound/uspeech.c | 17 +++++++++--- 3 files changed, 64 insertions(+), 19 deletions(-) diff --git a/peripherals/sound/sp0256.c b/peripherals/sound/sp0256.c index b47f75b7..222d8595 100644 --- a/peripherals/sound/sp0256.c +++ b/peripherals/sound/sp0256.c @@ -116,6 +116,9 @@ typedef struct sp0256_t { uint16_t fifo[64]; /* The 64-decle FIFO. */ const uint8_t *rom[16]; /* 4K ROM pages. */ + + uint32_t clock; /* Clock - crystal frequency */ + unsigned int clock_per_samp; /* Sample duration in Z80 tstates */ } sp0256_t; @@ -140,8 +143,6 @@ static void sp0256_write_ald( sp0256_t *s, uint32_t data ); /* ======================================================================== */ static int sp0256_do_init( sp0256_t *s, uint8_t *sp0256rom ); -static int factor = 358; - /* ======================================================================== */ /* Internal function prototypes. */ /* ======================================================================== */ @@ -1164,7 +1165,8 @@ sp0256_run( sp0256_t *s, uint32_t len ) /* Calculate the number of samples required at ~10kHz. */ /* (Actually, on NTSC this is 3579545 / 358, or 9998.73 Hz). */ /* ---------------------------------------------------------------- */ - samples = ( (int)( until - s->sound_current + factor - 1 ) ) / factor; + samples = ( (int)( until - s->sound_current + s->clock_per_samp - 1 ) ) + / s->clock_per_samp; /* ---------------------------------------------------------------- */ /* Process the current set of filter coefficients as long as the */ @@ -1210,13 +1212,13 @@ sp0256_run( sp0256_t *s, uint32_t len ) if( did_samp ) { int i; for( i = 0; i < did_samp; i++ ) { - sound_sp0256_write( sp0256_tstates + ( ( n + i ) * factor ), + sound_sp0256_write( sp0256_tstates + ( ( n + i ) * s->clock_per_samp ), s->scratch[( i + old_idx ) & SCBUF_MASK] ); } n += did_samp; } - s->sound_current += did_samp * factor; + s->sound_current += did_samp * s->clock_per_samp; } if( s->sound_current < sp0256_now ) { @@ -1325,11 +1327,15 @@ sp0256_do_init( sp0256_t *s, uint8_t *sp0256rom ) ROM for "page" 1 only */ s->rom[1] = sp0256rom; + /* Set nominal crystal clock at 3.12 MHz */ + s->clock = 3120000; + + /* Nominal sample duration of 350 tstates on a Z80 3.50 MHz */ + s->clock_per_samp = 350; + return 0; } -static int current_intonation = 0; - #ifdef DEBUG_USPEECH_ALLOPHONE struct allophone_t { const char *name; @@ -1488,15 +1494,44 @@ sp0256_play( int a ) } void -sp0256_set_intonation( int intonation ) +sp0256_set_clock( uint32_t clock ) +{ + unsigned int samples; + libspectrum_dword processor_speed; + + /* CPC wiki states: + The SP0256 is (usually) driven by a 3.12MHz oscillator, and it uses + 7bit PWM output, which is clocked at 3.12MHz/2, to obtain a 10kHz + sample rate, the chip issues some dummy steps with constant LOW level + additionally to the 128 steps needed for 7bit PWM, making it a total + number of 156 steps per sample. + */ + sp0256.clock = clock; + + /* SP0256 sample rate: + A nominal 3.12 MHz XTAL would produce 10000 samples (10 kHz). + With uSpeech (normal intonation), a 3.05 MHz XTAL would produce 9775 samples. + With uSpeech (high intonation), a 3.26 MHz XTAL would produce 10448 samples. + */ + samples = sp0256.clock / 312.0; + + processor_speed = ( machine_current == NULL ) ? 3500000 : + machine_current->timings.processor_speed; + + /* Z80 sample rate (examples with Z80 clocked at 3.5 MHz): + - A SP0256 sample at 3.12 MHz would last 350 (Z80) t-states. + - A SP0256 sample at 3.05 MHz would last 358 (Z80) t-states. + - A SP0256 sample at 3.26 MHz would last 334 (Z80) t-states. + */ + sp0256.clock_per_samp = processor_speed / samples; +} + +void +sp0256_change_clock( uint32_t clock ) { - if( intonation != current_intonation ) { + if( sp0256.clock != clock ) { sp0256_run_to( &sp0256, tstates ); - debug_printf( ( "sp0256: intonation %s\n", - intonation ? "high" : "normal" ) ); - current_intonation = intonation; - /* 358 - 1/8th = 314 */ - factor = intonation ? 314 : 358; + sp0256_set_clock( clock ); } } diff --git a/peripherals/sound/sp0256.h b/peripherals/sound/sp0256.h index afde6f87..6185db43 100644 --- a/peripherals/sound/sp0256.h +++ b/peripherals/sound/sp0256.h @@ -32,7 +32,8 @@ int sp0256_reset( uint8_t *sp0256rom ); void sp0256_end( void ); void sp0256_play( int allophone ); -void sp0256_set_intonation( int intonation ); +void sp0256_set_clock( uint32_t clock ); +void sp0256_change_clock( uint32_t clock ); int sp0256_busy( void ); void sp0256_do_frame( void ); diff --git a/peripherals/sound/uspeech.c b/peripherals/sound/uspeech.c index aae1b91a..b05cf5f7 100644 --- a/peripherals/sound/uspeech.c +++ b/peripherals/sound/uspeech.c @@ -43,6 +43,11 @@ #define SP0256_ROM_SIZE 2048 +/* Intonation on uSpeech changes SP0256 clock/oscillator frequency. + These values are based on a Kio's simulation and Thomas Busse tests. */ +#define SP0256_XTAL_NORMAL 3050000 +#define SP0256_XTAL_HIGH 3260000 + /* A 2 KiB memory chunk accessible by the Z80 when /ROMCS is low * (mirrored when active) */ static memory_page uspeech_memory_map_romcs[ MEMORY_PAGES_IN_2K ]; @@ -134,7 +139,7 @@ uspeech_port_intonation_normal( libspectrum_word port, libspectrum_byte data ) if( !uspeech_active ) return; /* Address 0x3000 can also be accessed via I/O (only write) */ - sp0256_set_intonation( 0 ); + sp0256_change_clock( SP0256_XTAL_NORMAL ); } static void @@ -143,7 +148,7 @@ uspeech_port_intonation_high( libspectrum_word port, libspectrum_byte data ) if( !uspeech_active ) return; /* Address 0x3001 can also be accessed via I/O (only write) */ - sp0256_set_intonation( 1 ); + sp0256_change_clock( SP0256_XTAL_HIGH ); } static void @@ -187,6 +192,8 @@ uspeech_init( void *context ) periph_register_paging_events( event_type_string, &page_event, &unpage_event ); + sp0256_set_clock( SP0256_XTAL_NORMAL ); + return 0; } @@ -293,6 +300,8 @@ uspeech_reset( int hard_reset GCC_UNUSED ) return; } + sp0256_set_clock( SP0256_XTAL_NORMAL ); + machine_current->ram.romcs = 0; uspeech_available = 1; @@ -354,11 +363,11 @@ uspeech_write( libspectrum_word address, libspectrum_byte b ) break; case 0x3000: /* This address is mirrored at 0011XXXX XXXXXXX0 */ - sp0256_set_intonation( 0 ); + sp0256_change_clock( SP0256_XTAL_NORMAL ); break; case 0x3001: /* This address is mirrored at 0011XXXX XXXXXXX1 */ - sp0256_set_intonation( 1 ); + sp0256_change_clock( SP0256_XTAL_HIGH ); break; } } |
|
From: <sba...@us...> - 2023-10-01 06:41:55
|
This is an automated email from the git hooks/post-receive-user script.
sbaldovi pushed a change to branch patches-142-currah-uspeech
in repository fuse.
from bd36f290 Limit uSpeech to 48K machines
new 404a9b53 uSpeech intonation changes SP0256 clock frequency
new 0302d3b9 Avoid the use of 64-bit integers
new bd5c569d Disable debugging macros
new bf896c0d Declare missing function prototypes and unused parameters
new c8f12246 Fusify C99 variable types (we are still C89)
new 03924f62 Document sp0256 ROM
The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
man/fuse.1 | 13 +++
peripherals/sound/sp0256.c | 218 ++++++++++++++++++++++++++------------------
peripherals/sound/sp0256.h | 9 +-
peripherals/sound/uspeech.c | 44 ++++++---
4 files changed, 176 insertions(+), 108 deletions(-)
|
|
From: <sba...@us...> - 2023-09-19 03:51:00
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch patches-142-currah-uspeech in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/bd36f290be5581a1392ce3daa1740ac3a8a152ed/ commit bd36f290be5581a1392ce3daa1740ac3a8a152ed Author: Sergio Baldoví <ser...@gm...> AuthorDate: Tue Sep 19 05:36:24 2023 +0200 Limit uSpeech to 48K machines (thanks, Vic Chwe) --- machines/machines_periph.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/machines/machines_periph.c b/machines/machines_periph.c index 2533c409..3223b36e 100644 --- a/machines/machines_periph.c +++ b/machines/machines_periph.c @@ -205,7 +205,6 @@ base_peripherals_48_128( void ) periph_set_present( PERIPH_TYPE_PLUSD, PERIPH_PRESENT_OPTIONAL ); periph_set_present( PERIPH_TYPE_SPECDRUM, PERIPH_PRESENT_OPTIONAL ); periph_set_present( PERIPH_TYPE_USOURCE, PERIPH_PRESENT_OPTIONAL ); - periph_set_present( PERIPH_TYPE_USPEECH, PERIPH_PRESENT_OPTIONAL ); } /* The set of peripherals available on the 48K and similar machines */ @@ -220,6 +219,7 @@ machines_periph_48( void ) periph_set_present( PERIPH_TYPE_ZXPRINTER, PERIPH_PRESENT_OPTIONAL ); periph_set_present( PERIPH_TYPE_DIDAKTIK80, PERIPH_PRESENT_OPTIONAL ); periph_set_present( PERIPH_TYPE_DISCIPLE, PERIPH_PRESENT_OPTIONAL ); + periph_set_present( PERIPH_TYPE_USPEECH, PERIPH_PRESENT_OPTIONAL ); } /* The set of peripherals available on the 128K and similar machines */ |
|
From: <sba...@us...> - 2023-09-19 03:50:58
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch patches-142-currah-uspeech in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/1bb5a4cf498f2e777c7f1b7ce02b62c9b30c4c30/ commit 1bb5a4cf498f2e777c7f1b7ce02b62c9b30c4c30 Author: Sergio Baldoví <ser...@gm...> AuthorDate: Tue Sep 19 05:26:06 2023 +0200 Add uSpeech page/unpage events to debugger --- man/fuse.1 | 7 +++++++ peripherals/sound/uspeech.c | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/man/fuse.1 b/man/fuse.1 index 8a9bb025..d72c32d5 100644 --- a/man/fuse.1 +++ b/man/fuse.1 @@ -4930,6 +4930,13 @@ tape:stop The emulated tape starts or stops playing. .RE .br +uspeech:page +.br +uspeech:unpage +.RS +The \(mcSpeech interface is paged into or out of memory. +.RE +.br zxatasp:page .br zxatasp:unpage diff --git a/peripherals/sound/uspeech.c b/peripherals/sound/uspeech.c index f995c94a..aae1b91a 100644 --- a/peripherals/sound/uspeech.c +++ b/peripherals/sound/uspeech.c @@ -28,6 +28,7 @@ #include "libspectrum.h" #include "compat.h" +#include "debugger/debugger.h" #include "infrastructure/startup_manager.h" #include "machine.h" #include "memory.h" @@ -103,6 +104,10 @@ static const periph_t uspeech_periph = { /* .activate = */ NULL }; +/* Debugger events */ +static const char * const event_type_string = "uspeech"; +static int page_event, unpage_event; + static libspectrum_byte uspeech_port_play_read( libspectrum_word port, libspectrum_byte *attached ) { @@ -179,6 +184,9 @@ uspeech_init( void *context ) periph_register( PERIPH_TYPE_USPEECH, &uspeech_periph ); + periph_register_paging_events( event_type_string, &page_event, + &unpage_event ); + return 0; } @@ -196,6 +204,7 @@ void uspeech_register_startup( void ) { startup_manager_module dependencies[] = { + STARTUP_MANAGER_MODULE_DEBUGGER, STARTUP_MANAGER_MODULE_MEMORY, STARTUP_MANAGER_MODULE_SETUID, }; @@ -295,6 +304,11 @@ uspeech_toggle( void ) uspeech_active = !uspeech_active; machine_current->ram.romcs = uspeech_active; machine_current->memory_map(); + + if( uspeech_active ) + debugger_event( page_event ); + else + debugger_event( unpage_event ); } static void |
|
From: <sba...@us...> - 2023-09-19 03:50:57
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch patches-142-currah-uspeech in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/efffc4008488bdb9357d00a2c52215e2ea2f9dd2/ commit efffc4008488bdb9357d00a2c52215e2ea2f9dd2 Author: Sergio Baldoví <ser...@gm...> AuthorDate: Wed Aug 30 23:08:44 2023 +0200 Document uSpeech volume option and add new options to shell completion --- data/shell-completion/bash/fuse | 14 ++++++++------ man/fuse.1 | 9 +++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/data/shell-completion/bash/fuse b/data/shell-completion/bash/fuse index 7c710184..f0f1f013 100644 --- a/data/shell-completion/bash/fuse +++ b/data/shell-completion/bash/fuse @@ -172,7 +172,7 @@ _fuse() --sdl-fullscreen-mode|--snet|--sound-device|-d| \ --sound-freq|-f|--speccyboot-tap|--speed| \ --teletext-addr-[1-4]|--teletext-port-[1-4]|--volume-ay| \ - --volume-beeper|--volume-covox|--volume-specdrum) + --volume-beeper|--volume-covox|--volume-specdrum|--volume-uspeech) # argument required but no completions available return 0 ;; @@ -244,7 +244,8 @@ _fuse() --no-sound-force-8bit --no-speccyboot --no-specdrum --no-spectranet --no-spectranet-disable --no-statusbar --no-strict-aspect-hint --no-traps --no-ttx2000s --no-unittests - --no-usource --no-writable-roms --no-zxatasp --no-zxatasp-upload + --no-usource --no-uspeech --no-writable-roms + --no-zxatasp --no-zxatasp-upload --no-zxatasp-write-protect --no-zxcf --no-zxcf-upload --no-zxmmc --no-zxprinter --opus --opusdisk --pal-tv2x --phantom-typist-mode --playback --plus3-detect-speedlock --plus3disk --plusd --plusddisk @@ -261,10 +262,10 @@ _fuse() --rom-plus2a-2 --rom-plus2a-3 --rom-plus3-0 --rom-plus3-1 --rom-plus3-2 --rom-plus3-3 --rom-plus3e-0 --rom-plus3e-1 --rom-plus3e-2 --rom-plus3e-3 --rom-plusd --rom-scorpion-0 - --rom-scorpion-1 --rom-scorpion-2 --rom-scorpion-3 + --rom-scorpion-1 --rom-scorpion-2 --rom-scorpion-3 --rom-sp0256 --rom-speccyboot --rom-spec-se-0 --rom-spec-se-1 --rom-tc2048 --rom-tc2068-0 --rom-tc2068-1 --rom-ts2068-0 - --rom-ts2068-1 --rom-ttx2000s --rom-usource + --rom-ts2068-1 --rom-ttx2000s --rom-usource --rom-uspeech --rs232-handshake --rs232-rx --rs232-tx --rzx-autosaves --sdl-fullscreen-mode --separation --simpleide --simpleide-masterfile --simpleide-slavefile --slt @@ -275,8 +276,9 @@ _fuse() --teletext-addr-1 --teletext-addr-2 --teletext-addr-3 --teletext-addr-4 --teletext-port-1 --teletext-port-2 --teletext-port-3 --teletext-port-4 --textfile --traps --ttx2000s - --unittests --usource --version --volume-ay - --volume-beeper --volume-covox --volume-specdrum --writable-roms + --unittests --usource --uspeech --version --volume-ay + --volume-beeper --volume-covox --volume-specdrum --volume-uspeech + --writable-roms --zxatasp --zxatasp-masterfile --zxatasp-slavefile --zxatasp-upload --zxatasp-write-protect --zxcf --zxcf-cffile --zxcf-upload --zxmmc --zxmmc-file --zxprinter' -- "$cur" ) ) diff --git a/man/fuse.1 b/man/fuse.1 index af4a14e7..8a9bb025 100644 --- a/man/fuse.1 +++ b/man/fuse.1 @@ -1979,6 +1979,15 @@ Same as the Sound Options dialog's option. .RE .PP +.B \-\-volume\-uspeech +.I volume +.RS +Sets the relative volume of the \(mcSpeech from a range of 0\(en100%. +Same as the Sound Options dialog's +.I "uSpeech volume" +option. +.RE +.PP .B \-\-writable\-roms .RS Allow Spectrum programs to overwrite the ROM(s). The same as the |
|
From: <sba...@us...> - 2023-09-19 03:50:55
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch patches-142-currah-uspeech in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/a92e319a33989309d9de60c6edf212146c6a821e/ commit a92e319a33989309d9de60c6edf212146c6a821e Author: Sergio Baldoví <ser...@gm...> AuthorDate: Wed Aug 30 22:51:07 2023 +0200 Beautify uSpeech code with uncrustify --- peripherals/sound/sp0256.c | 551 ++++++++++++++++++++++---------------------- peripherals/sound/sp0256.h | 2 - peripherals/sound/uspeech.c | 14 +- 3 files changed, 279 insertions(+), 288 deletions(-) diff --git a/peripherals/sound/sp0256.c b/peripherals/sound/sp0256.c index b30282a3..b47f75b7 100644 --- a/peripherals/sound/sp0256.c +++ b/peripherals/sound/sp0256.c @@ -1,8 +1,6 @@ /* sp0256.c: SP0256 speech synthesis emulation Copyright (c) 1998-2000 Jospeh Zbicaik, 2007-2015 Stuart Brady - $Id$ - This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -39,9 +37,8 @@ #include "libspectrum.h" +/* from jzintv-config.h */ #include <assert.h> - -// from jzintv-config.h #include <stdarg.h> #include <stdlib.h> #include <unistd.h> @@ -72,55 +69,53 @@ #define DEBUG_USPEECH_ALLOPHONE #define HIGH_QUALITY -#define SCBUF_SIZE (4096) /* Must be power of 2 */ -#define SCBUF_MASK (SCBUF_SIZE - 1) -#define PER_PAUSE (64) /* Equiv timing period for pauses. */ -#define PER_NOISE (64) /* Equiv timing period for noise. */ +#define SCBUF_SIZE ( 4096 ) /* Must be power of 2 */ +#define SCBUF_MASK ( SCBUF_SIZE - 1 ) +#define PER_PAUSE ( 64 ) /* Equiv timing period for pauses. */ +#define PER_NOISE ( 64 ) /* Equiv timing period for noise. */ -#define FIFO_ADDR (0x1800 << 3) /* SP0256 address of speech FIFO. */ +#define FIFO_ADDR ( 0x1800 << 3 ) /* SP0256 address of speech FIFO. */ uint64_t sp0256_tstates; uint64_t sp0256_now; -typedef struct lpc12_t -{ - int rpt, cnt; /* Repeat counter, Period down-counter. */ - uint32_t per, rng; /* Period, Amplitude, Random Number Generator */ - int amp; +typedef struct lpc12_t { + int rpt, cnt; /* Repeat counter, Period down-counter. */ + uint32_t per, rng; /* Period, Amplitude, Random Number Generator */ + int amp; int16_t f_coef[6]; /* F0 through F5. */ int16_t b_coef[6]; /* B0 through B5. */ int16_t z_data[6][2]; /* Time-delay data for the */ - /* filter stages. */ - uint8_t r[16]; /* The encoded register set. */ - int interp; + /* filter stages. */ + uint8_t r[16]; /* The encoded register set. */ + int interp; } lpc12_t; -typedef struct sp0256_t -{ - int silent; /* Flag: SP0256 is silent. */ - - int16_t *scratch; /* Scratch buffer for audio. */ - uint32_t sc_head; /* Head/Tail pointer into scratch circular buf */ - uint32_t sc_tail; /* Head/Tail pointer into scratch circular buf */ - uint64_t sound_current; - - lpc12_t filt; /* 12-pole filter */ - int lrq; /* Load ReQuest. == 0 if we can accept a load */ - int ald; /* Address LoaD. < 0 if no command pending. */ - int pc; /* Microcontroller's PC value. */ - int stack; /* Microcontroller's PC stack. */ - int fifo_sel; /* True when executing from FIFO. */ - int halted; /* True when CPU is halted. */ - uint32_t mode; /* Mode register. */ - uint32_t page; /* Page set by SETPAGE */ - - uint32_t fifo_head; /* FIFO head pointer (where new data goes). */ - uint32_t fifo_tail; /* FIFO tail pointer (where data comes from). */ - uint32_t fifo_bitp; /* FIFO bit-pointer (for partial decles). */ - uint16_t fifo[64]; /* The 64-decle FIFO. */ - - const uint8_t *rom[16]; /* 4K ROM pages. */ +typedef struct sp0256_t { + int silent; /* Flag: SP0256 is silent. */ + + int16_t *scratch; /* Scratch buffer for audio. */ + uint32_t sc_head; /* Head/Tail pointer into scratch circular buf */ + uint32_t sc_tail; /* Head/Tail pointer into scratch circular buf */ + uint64_t sound_current; + + lpc12_t filt; /* 12-pole filter */ + int lrq; /* Load ReQuest. == 0 if we can accept a load */ + int ald; /* Address LoaD. < 0 if no command pending. */ + int pc; /* Microcontroller's PC value. */ + int stack; /* Microcontroller's PC stack. */ + int fifo_sel; /* True when executing from FIFO. */ + int halted; /* True when CPU is halted. */ + uint32_t mode; /* Mode register. */ + uint32_t page; /* Page set by SETPAGE */ + + uint32_t fifo_head; /* FIFO head pointer (where new data goes). */ + uint32_t fifo_tail; /* FIFO tail pointer (where data comes from). */ + uint32_t fifo_bitp; /* FIFO bit-pointer (for partial decles). */ + uint16_t fifo[64]; /* The 64-decle FIFO. */ + + const uint8_t *rom[16]; /* 4K ROM pages. */ } sp0256_t; @@ -128,17 +123,17 @@ typedef struct sp0256_t /* sp0256_run -- Where the magic happens. Generate voice data for */ /* our good friend, the SP0256. */ /* ======================================================================== */ -static uint32_t sp0256_run(sp0256_t *s, uint32_t len); +static uint32_t sp0256_run( sp0256_t *s, uint32_t len ); /* ======================================================================== */ /* sp0256_read_lrq -- Handle reads of the SP0256 LRQ line. */ /* ======================================================================== */ -static uint32_t sp0256_read_lrq(sp0256_t *s); +static uint32_t sp0256_read_lrq( sp0256_t *s ); /* ======================================================================== */ /* sp0256_write_ald -- Handle writes to the SP0256's Address Load FIFO. */ /* ======================================================================== */ -static void sp0256_write_ald(sp0256_t *s, uint32_t data); +static void sp0256_write_ald( sp0256_t *s, uint32_t data ); /* ======================================================================== */ /* sp0256_do_init -- Makes a new SP0256. */ @@ -150,12 +145,12 @@ static int factor = 358; /* ======================================================================== */ /* Internal function prototypes. */ /* ======================================================================== */ -static inline int16_t limit (int16_t s); -static inline uint32_t bitrev(uint32_t val); -static int lpc12_update(lpc12_t *f, int, int16_t *, uint32_t *); -static void lpc12_regdec(lpc12_t *f); -static uint32_t sp0256_getb(sp0256_t *s, int len); -static void sp0256_micro(sp0256_t *s); +static inline int16_t limit( int16_t s ); +static inline uint32_t bitrev( uint32_t val ); +static int lpc12_update( lpc12_t *f, int, int16_t *, uint32_t * ); +static void lpc12_regdec( lpc12_t *f ); +static uint32_t sp0256_getb( sp0256_t *s, int len ); +static void sp0256_micro( sp0256_t *s ); /* ======================================================================== */ /* qtbl -- Coefficient Quantization Table. This comes from a */ @@ -184,14 +179,14 @@ static const int16_t qtbl[128] = { /* limit -- Limiter function for digital sample output. */ /* ======================================================================== */ static inline int16_t -limit(int16_t s) +limit( int16_t s ) { #ifdef HIGH_QUALITY /* Higher quality than the original, but who cares? */ - if (s > 8191) return 8191; - if (s < -8192) return -8192; + if( s > 8191 ) return 8191; + if( s < -8192 ) return -8192; #else - if (s > 127) return 127; - if (s < -128) return -128; + if( s > 127 ) return 127; + if( s < -128 ) return -128; #endif return s; } @@ -200,14 +195,14 @@ limit(int16_t s) /* amp_decode -- Decode amplitude register */ /* ======================================================================== */ static int -amp_decode(uint8_t a) +amp_decode( uint8_t a ) { /* -------------------------------------------------------------------- */ /* Amplitude has 3 bits of exponent and 5 bits of mantissa. This */ /* contradicts USP 4,296,269 but matches the SP0250 Apps Manual. */ /* -------------------------------------------------------------------- */ - int expn = (a & 0xe0) >> 5; - int mant = (a & 0x1f); + int expn = ( a & 0xe0 ) >> 5; + int mant = ( a & 0x1f ); int ampl = mant << expn; /* -------------------------------------------------------------------- */ @@ -217,8 +212,8 @@ amp_decode(uint8_t a) /* this seems dubious. */ /* -------------------------------------------------------------------- */ #if 0 - if (mant & 1) - ampl |= (1u << expn) - 1; + if( mant & 1 ) + ampl |= ( 1u << expn ) - 1; #endif return ampl; @@ -228,7 +223,7 @@ amp_decode(uint8_t a) /* lpc12_update -- Update the 12-pole filter, outputting samples. */ /* ======================================================================== */ static int -lpc12_update(lpc12_t *f, int num_samp, int16_t *out, uint32_t *optr) +lpc12_update( lpc12_t *f, int num_samp, int16_t *out, uint32_t *optr ) { int i, j; int16_t samp; @@ -239,17 +234,17 @@ lpc12_update(lpc12_t *f, int num_samp, int16_t *out, uint32_t *optr) /* Iterate up to the desired number of samples. We actually may */ /* break out early if our repeat count expires. */ /* -------------------------------------------------------------------- */ - for (i = 0; i < num_samp; i++) { + for( i = 0; i < num_samp; i++ ) { /* ---------------------------------------------------------------- */ /* Generate a series of periodic impulses, or random noise. */ /* ---------------------------------------------------------------- */ do_int = 0; samp = 0; bit = f->rng & 1; - f->rng = (f->rng >> 1) ^ (bit ? 0x4001 : 0); + f->rng = ( f->rng >> 1 ) ^ ( bit ? 0x4001 : 0 ); - if (--f->cnt <= 0) { - if (f->rpt-- <= 0) { /* Stop if we expire the repeat counter */ + if( --f->cnt <= 0 ) { + if( f->rpt-- <= 0 ) { /* Stop if we expire the repeat counter */ f->cnt = f->rpt = 0; break; } @@ -259,17 +254,17 @@ lpc12_update(lpc12_t *f, int num_samp, int16_t *out, uint32_t *optr) do_int = f->interp; } - if (!f->per) + if( !f->per ) samp = bit ? -f->amp : f->amp; /* ---------------------------------------------------------------- */ /* If we need to, process the interpolation registers. */ /* ---------------------------------------------------------------- */ - if (do_int) { + if( do_int ) { f->r[0] += f->r[14]; f->r[1] += f->r[15]; - f->amp = amp_decode(f->r[0]); + f->amp = amp_decode( f->r[0] ); f->per = f->r[1]; do_int = 0; @@ -303,9 +298,9 @@ lpc12_update(lpc12_t *f, int num_samp, int16_t *out, uint32_t *optr) /* +-----------[B]<---------+ */ /* */ /* ---------------------------------------------------------------- */ - for (j = 0; j < 6; j++) { - samp += (((int)f->b_coef[j] * (int)f->z_data[j][1]) >> 9); - samp += (((int)f->f_coef[j] * (int)f->z_data[j][0]) >> 8); + for( j = 0; j < 6; j++ ) { + samp += ( ( (int)f->b_coef[j] * (int)f->z_data[j][1] ) >> 9 ); + samp += ( ( (int)f->f_coef[j] * (int)f->z_data[j][0] ) >> 8 ); f->z_data[j][1] = f->z_data[j][0]; f->z_data[j][0] = samp; @@ -315,9 +310,9 @@ lpc12_update(lpc12_t *f, int num_samp, int16_t *out, uint32_t *optr) the limit of a signed 16 bits sample */ #ifdef HIGH_QUALITY /* Higher quality than the original, but who cares? */ - out[oidx++ & SCBUF_MASK] = limit(samp) * 4; + out[oidx++ & SCBUF_MASK] = limit( samp ) * 4; #else - out[oidx++ & SCBUF_MASK] = (limit(samp >> 4) * 256); + out[oidx++ & SCBUF_MASK] = ( limit( samp >> 4 ) * 256 ); #endif } @@ -335,7 +330,7 @@ static const int stage_map[6] = { 0, 1, 2, 3, 4, 5 }; /* lpc12_regdec -- Decode the register set in the filter bank. */ /* ======================================================================== */ static void -lpc12_regdec(lpc12_t *f) +lpc12_regdec( lpc12_t *f ) { int i; @@ -343,18 +338,18 @@ lpc12_regdec(lpc12_t *f) /* Decode the Amplitude and Period registers. Force cnt to 0 to get */ /* the initial impulse. (Redundant?) */ /* -------------------------------------------------------------------- */ - f->amp = amp_decode(f->r[0]); + f->amp = amp_decode( f->r[0] ); f->cnt = 0; f->per = f->r[1]; /* -------------------------------------------------------------------- */ /* Decode the filter coefficients from the quant table. */ /* -------------------------------------------------------------------- */ - for (i = 0; i < 6; i++) { - #define IQ(x) (((x) & 0x80) ? qtbl[0x7f & -(x)] : -qtbl[(x)]) + for( i = 0; i < 6; i++ ) { + #define IQ( x ) ( ( ( x ) & 0x80 ) ? qtbl[0x7f & -( x )] : -qtbl[( x )] ) - f->b_coef[stage_map[i]] = IQ(f->r[2 + 2*i]); - f->f_coef[stage_map[i]] = IQ(f->r[3 + 2*i]); + f->b_coef[stage_map[i]] = IQ( f->r[2 + 2 * i] ); + f->f_coef[stage_map[i]] = IQ( f->r[3 + 2 * i] ); } /* -------------------------------------------------------------------- */ @@ -377,8 +372,8 @@ lpc12_regdec(lpc12_t *f) /* clrall 1 bit Clear all before doing this update */ /* ======================================================================== */ -#define CR(l,s,p,d,f,c5,ca) \ - ( \ +#define CR(l,s,p,d,f,c5,ca) \ + ( \ (((l) & 15) << 0) | \ (((s) & 15) << 4) | \ (((p) & 15) << 8) | \ @@ -689,8 +684,6 @@ static const uint16_t sp0256_datafmt[] = { /* 190 */ CR( 8, 0, IP, 0, 0, 0, 0), /* Pit Interp */ }; - - static const int16_t sp0256_df_idx[16 * 8] = { /* OPCODE 0000 */ -1, -1, -1, -1, -1, -1, -1, -1, /* OPCODE 1000 */ -1, -1, -1, -1, -1, -1, -1, -1, @@ -714,13 +707,13 @@ static const int16_t sp0256_df_idx[16 * 8] = { /* bitrev -- Bit-reverse a 32-bit number. */ /* ======================================================================== */ static inline uint32_t -bitrev(uint32_t val) +bitrev( uint32_t val ) { - val = ((val & 0xffff0000) >> 16) | ((val & 0x0000ffff) << 16); - val = ((val & 0xff00ff00) >> 8) | ((val & 0x00ff00ff) << 8); - val = ((val & 0xf0f0f0f0) >> 4) | ((val & 0x0f0f0f0f) << 4); - val = ((val & 0xcccccccc) >> 2) | ((val & 0x33333333) << 2); - val = ((val & 0xaaaaaaaa) >> 1) | ((val & 0x55555555) << 1); + val = ( ( val & 0xffff0000 ) >> 16 ) | ( ( val & 0x0000ffff ) << 16 ); + val = ( ( val & 0xff00ff00 ) >> 8 ) | ( ( val & 0x00ff00ff ) << 8 ); + val = ( ( val & 0xf0f0f0f0 ) >> 4 ) | ( ( val & 0x0f0f0f0f ) << 4 ); + val = ( ( val & 0xcccccccc ) >> 2 ) | ( ( val & 0x33333333 ) << 2 ); + val = ( ( val & 0xaaaaaaaa ) >> 1 ) | ( ( val & 0x55555555 ) << 1 ); return val; } @@ -729,7 +722,7 @@ bitrev(uint32_t val) /* sp0256_getb -- Get up to 8 bits at the current PC. */ /* ======================================================================== */ static uint32_t -sp0256_getb(sp0256_t *s, int len) +sp0256_getb( sp0256_t *s, int len ) { uint32_t data = 0; uint32_t d0, d1; @@ -737,15 +730,15 @@ sp0256_getb(sp0256_t *s, int len) /* -------------------------------------------------------------------- */ /* Fetch data from the FIFO or from the MASK */ /* -------------------------------------------------------------------- */ - if (s->fifo_sel) { - d0 = s->fifo[(s->fifo_tail ) & 63]; - d1 = s->fifo[(s->fifo_tail + 1) & 63]; + if( s->fifo_sel ) { + d0 = s->fifo[( s->fifo_tail ) & 63]; + d1 = s->fifo[( s->fifo_tail + 1 ) & 63]; - data = ((d1 << 10) | d0) >> s->fifo_bitp; + data = ( ( d1 << 10 ) | d0 ) >> s->fifo_bitp; #ifdef DEBUG_FIFO - dfprintf(("SP0256: RD_FIFO %.3X %d.%d %d\n", data & ((1u << len) - 1), - s->fifo_tail, s->fifo_bitp, s->fifo_head)); + dfprintf( ( "SP0256: RD_FIFO %.3X %d.%d %d\n", data & ( ( 1u << len ) - 1 ), + s->fifo_tail, s->fifo_bitp, s->fifo_head ) ); #endif /* ---------------------------------------------------------------- */ @@ -754,7 +747,7 @@ sp0256_getb(sp0256_t *s, int len) /* what happens, but that's roughly how it behaves.) */ /* ---------------------------------------------------------------- */ s->fifo_bitp += len; - if (s->fifo_bitp >= 10) { + if( s->fifo_bitp >= 10 ) { s->fifo_tail++; s->fifo_bitp -= 10; } @@ -764,18 +757,18 @@ sp0256_getb(sp0256_t *s, int len) /* adjacent bytes. The byte we're interested in is extracted */ /* from the appropriate bit-boundary between them. */ /* ---------------------------------------------------------------- */ - int idx0 = (s->pc ) >> 3, page0 = idx0 >> 12; - int idx1 = (s->pc + 8) >> 3, page1 = idx1 >> 12; + int idx0 = ( s->pc ) >> 3, page0 = idx0 >> 12; + int idx1 = ( s->pc + 8 ) >> 3, page1 = idx1 >> 12; idx0 &= 0xfff; idx1 &= 0xfff; d0 = d1 = 0; - if (s->rom[page0]) d0 = s->rom[page0][idx0]; - if (s->rom[page1]) d1 = s->rom[page1][idx1]; + if( s->rom[page0] ) d0 = s->rom[page0][idx0]; + if( s->rom[page1] ) d1 = s->rom[page1][idx1]; - data = ((d1 << 8) | d0) >> (s->pc & 7); + data = ( ( d1 << 8 ) | d0 ) >> ( s->pc & 7 ); s->pc += len; } @@ -783,7 +776,7 @@ sp0256_getb(sp0256_t *s, int len) /* -------------------------------------------------------------------- */ /* Mask data to the requested length. */ /* -------------------------------------------------------------------- */ - data &= ((1u << len) - 1); + data &= ( ( 1u << len ) - 1 ); return data; } @@ -794,43 +787,43 @@ sp0256_getb(sp0256_t *s, int len) /* the sequencer gets halted by a RTS to 0. */ /* ======================================================================== */ static void -sp0256_micro(sp0256_t *s) +sp0256_micro( sp0256_t *s ) { - uint8_t immed4; - uint8_t opcode; + uint8_t immed4; + uint8_t opcode; uint16_t cr; - int ctrl_xfer = 0; - int repeat = 0; - int i, idx0, idx1; + int ctrl_xfer = 0; + int repeat = 0; + int i, idx0, idx1; /* -------------------------------------------------------------------- */ /* Only execute instructions while the filter is not busy. */ /* -------------------------------------------------------------------- */ - while (s->filt.rpt <= 0 && s->filt.cnt <= 0) { + while( s->filt.rpt <= 0 && s->filt.cnt <= 0 ) { /* ---------------------------------------------------------------- */ /* If the CPU is halted, see if we have a new command pending */ /* in the Address LoaD buffer. */ /* ---------------------------------------------------------------- */ - if (s->halted && !s->lrq) { - s->pc = s->ald | (0x1000 << 3); + if( s->halted && !s->lrq ) { + s->pc = s->ald | ( 0x1000 << 3 ); s->fifo_sel = 0; s->halted = 0; s->lrq = 1; s->ald = 0; -/* for (i = 0; i < 16; i++)*/ -/* s->filt.r[i] = 0;*/ + /* for( i = 0; i < 16; i++ ) */ + /* s->filt.r[i] = 0; */ } /* ---------------------------------------------------------------- */ /* If we're still halted, do nothing. */ /* ---------------------------------------------------------------- */ - if (s->halted) { + if( s->halted ) { s->filt.rpt = 1; s->filt.cnt = 0; s->lrq = 1; s->ald = 0; -/* for (i = 0; i < 16; i++)*/ -/* s->filt.r[i] = 0;*/ + /* for( i = 0; i < 16; i++ ) */ + /* s->filt.r[i] = 0; */ return; } @@ -838,21 +831,21 @@ sp0256_micro(sp0256_t *s) /* Fetch the first 8 bits of the opcode, which are always in the */ /* same approximate format -- immed4 followed by opcode. */ /* ---------------------------------------------------------------- */ - immed4 = sp0256_getb(s, 4); - opcode = sp0256_getb(s, 4); + immed4 = sp0256_getb( s, 4 ); + opcode = sp0256_getb( s, 4 ); repeat = 0; ctrl_xfer = 0; - debug_printf(("$%.4X.%.1X: OPCODE %d%d%d%d.%d%d\n", - (s->pc >> 3) - 1, s->pc & 7, - !!(opcode & 1), !!(opcode & 2), - !!(opcode & 4), !!(opcode & 8), - !!(s->mode&4), !!(s->mode&2))); + debug_printf( ( "$%.4X.%.1X: OPCODE %d%d%d%d.%d%d\n", + ( s->pc >> 3 ) - 1, s->pc & 7, + !!( opcode & 1 ), !!( opcode & 2 ), + !!( opcode & 4 ), !!( opcode & 8 ), + !!( s->mode & 4 ), !!( s->mode & 2 ) ) ); /* ---------------------------------------------------------------- */ /* Handle the special cases for specific opcodes. */ /* ---------------------------------------------------------------- */ - switch (opcode) { + switch( opcode ) { /* ------------------------------------------------------------ */ /* OPCODE 0000: RTS / SETPAGE */ /* ------------------------------------------------------------ */ @@ -860,33 +853,33 @@ sp0256_micro(sp0256_t *s) /* -------------------------------------------------------- */ /* If immed4 != 0, then this is a SETPAGE instruction. */ /* -------------------------------------------------------- */ - if (immed4) { /* SETPAGE */ - s->page = bitrev(immed4) >> 13; + if( immed4 ) { /* SETPAGE */ + s->page = bitrev( immed4 ) >> 13; } else { - /* -------------------------------------------------------- */ - /* Otherwise, this is an RTS / HLT. */ - /* -------------------------------------------------------- */ - uint32_t btrg; - - /* ---------------------------------------------------- */ - /* Figure out our branch target. */ - /* ---------------------------------------------------- */ - btrg = s->stack; - - s->stack = 0; - - /* ---------------------------------------------------- */ - /* If the branch target is zero, this is a HLT. */ - /* Otherwise, it's an RTS, so set the PC. */ - /* ---------------------------------------------------- */ - if (!btrg) { - s->halted = 1; - s->pc = 0; - ctrl_xfer = 1; - } else { - s->pc = btrg; - ctrl_xfer = 1; - } + /* -------------------------------------------------------- */ + /* Otherwise, this is an RTS / HLT. */ + /* -------------------------------------------------------- */ + uint32_t btrg; + + /* ---------------------------------------------------- */ + /* Figure out our branch target. */ + /* ---------------------------------------------------- */ + btrg = s->stack; + + s->stack = 0; + + /* ---------------------------------------------------- */ + /* If the branch target is zero, this is a HLT. */ + /* Otherwise, it's an RTS, so set the PC. */ + /* ---------------------------------------------------- */ + if( !btrg ) { + s->halted = 1; + s->pc = 0; + ctrl_xfer = 1; + } else { + s->pc = btrg; + ctrl_xfer = 1; + } } break; @@ -904,16 +897,16 @@ sp0256_micro(sp0256_t *s) /* Figure out our branch target. */ /* -------------------------------------------------------- */ btrg = s->page | - (bitrev(immed4) >> 17) | - (bitrev(sp0256_getb(s, 8)) >> 21); + ( bitrev( immed4 ) >> 17 ) | + ( bitrev( sp0256_getb( s, 8 ) ) >> 21 ); ctrl_xfer = 1; /* -------------------------------------------------------- */ /* If this is a JSR, push our return address on the */ /* stack. Make sure it's byte aligned. */ /* -------------------------------------------------------- */ - if (opcode == 0xd) - s->stack = (s->pc + 7) & ~7; + if( opcode == 0xd ) + s->stack = ( s->pc + 7 ) & ~7; /* -------------------------------------------------------- */ /* Jump to the new location! */ @@ -926,8 +919,8 @@ sp0256_micro(sp0256_t *s) /* OPCODE 1000: SETMODE Set the Mode and Repeat MSBs */ /* ------------------------------------------------------------ */ case 0x1: - s->mode = ((immed4 & 8) >> 2) | (immed4 & 4) | - ((immed4 & 3) << 4); + s->mode = ( ( immed4 & 8 ) >> 2 ) | ( immed4 & 4 ) | + ( ( immed4 & 3 ) << 4 ); break; /* ------------------------------------------------------------ */ @@ -945,17 +938,17 @@ sp0256_micro(sp0256_t *s) /* OPCODE 1111: PAUSE Silent pause */ /* ------------------------------------------------------------ */ default: - repeat = immed4 | (s->mode & 0x30); + repeat = immed4 | ( s->mode & 0x30 ); break; } - if (opcode != 1) s->mode &= 0xf; + if( opcode != 1 ) s->mode &= 0xf; /* ---------------------------------------------------------------- */ /* If this was a control transfer, handle setting "fifo_sel" */ /* and all that ugliness. */ /* ---------------------------------------------------------------- */ - if (ctrl_xfer) { - debug_printf(("jumping to $%.4X.%.1X: ", s->pc >> 3, s->pc & 7)); + if( ctrl_xfer ) { + debug_printf( ( "jumping to $%.4X.%.1X: ", s->pc >> 3, s->pc & 7 ) ); /* ------------------------------------------------------------ */ /* Set our "FIFO Selected" flag based on whether we're going */ @@ -963,21 +956,21 @@ sp0256_micro(sp0256_t *s) /* ------------------------------------------------------------ */ s->fifo_sel = s->pc == FIFO_ADDR; - debug_printf(("%s ", s->fifo_sel ? "FIFO" : "ROM")); + debug_printf( ( "%s ", s->fifo_sel ? "FIFO" : "ROM" ) ); /* ------------------------------------------------------------ */ /* Control transfers to the FIFO cause it to discard the */ /* partial decle that's at the front of the FIFO. */ /* ------------------------------------------------------------ */ - if (s->fifo_sel && s->fifo_bitp) { - debug_printf(("bitp = %d -> Flush", s->fifo_bitp)); + if( s->fifo_sel && s->fifo_bitp ) { + debug_printf( ( "bitp = %d -> Flush", s->fifo_bitp ) ); - /* Discard partially-read decle. */ - if (s->fifo_tail < s->fifo_head) s->fifo_tail++; - s->fifo_bitp = 0; + /* Discard partially-read decle. */ + if( s->fifo_tail < s->fifo_head ) s->fifo_tail++; + s->fifo_bitp = 0; } - debug_printf(("\n")); + debug_printf( ( "\n" ) ); continue; } @@ -986,32 +979,32 @@ sp0256_micro(sp0256_t *s) /* Otherwise, if we have a repeat count, then go grab the data */ /* block and feed it to the filter. */ /* ---------------------------------------------------------------- */ - if (!repeat) continue; + if( !repeat ) continue; s->filt.rpt = repeat; - debug_printf(("repeat = %d\n", repeat)); + debug_printf( ( "repeat = %d\n", repeat ) ); /* clear delay line on new opcode */ - for (i = 0; i < 6; i++) + for( i = 0; i < 6; i++ ) s->filt.z_data[i][0] = s->filt.z_data[i][1] = 0; - i = (opcode << 3) | (s->mode & 6); + i = ( opcode << 3 ) | ( s->mode & 6 ); idx0 = sp0256_df_idx[i++]; idx1 = sp0256_df_idx[i ]; - assert(idx0 >= 0 && idx1 >= 0 && idx1 >= idx0); + assert( idx0 >= 0 && idx1 >= 0 && idx1 >= idx0 ); /* ---------------------------------------------------------------- */ /* If we're in one of the 10-pole modes (x0), clear F5/B5. */ /* ---------------------------------------------------------------- */ - if ((s->mode & 2) == 0) + if( ( s->mode & 2 ) == 0 ) s->filt.r[F5] = s->filt.r[B5] = 0; /* ---------------------------------------------------------------- */ /* Step through control words in the description for data block. */ /* ---------------------------------------------------------------- */ - for (i = idx0; i <= idx1; i++) { + for( i = idx0; i <= idx1; i++ ) { int len, shf, delta, field, prm, clrL; libspectrum_signed_byte value; @@ -1020,21 +1013,21 @@ sp0256_micro(sp0256_t *s) /* ------------------------------------------------------------ */ cr = sp0256_datafmt[i]; - len = CR_LEN(cr); - shf = CR_SHF(cr); - prm = CR_PRM(cr); + len = CR_LEN( cr ); + shf = CR_SHF( cr ); + prm = CR_PRM( cr ); clrL = cr & CR_CLRL; delta = cr & CR_DELTA; field = cr & CR_FIELD; value = 0; - debug_printf(("$%.4X.%.1X: len=%2d shf=%2d prm=%2d d=%d f=%d ", - s->pc >> 3, s->pc & 7, len, shf, prm, !!delta, !!field)); + debug_printf( ( "$%.4X.%.1X: len=%2d shf=%2d prm=%2d d=%d f=%d ", + s->pc >> 3, s->pc & 7, len, shf, prm, !!delta, + !!field ) ); /* ------------------------------------------------------------ */ /* Clear any registers that were requested to be cleared. */ /* ------------------------------------------------------------ */ - if (clrL) - { + if( clrL ) { s->filt.r[F0] = s->filt.r[B0] = 0; s->filt.r[F1] = s->filt.r[B1] = 0; s->filt.r[F2] = s->filt.r[B2] = 0; @@ -1043,74 +1036,73 @@ sp0256_micro(sp0256_t *s) /* ------------------------------------------------------------ */ /* If this entry has a bitfield with it, grab the bitfield. */ /* ------------------------------------------------------------ */ - if (len) { - value = sp0256_getb(s, len); + if( len ) { + value = sp0256_getb( s, len ); } else { - debug_printf((" (no update)\n")); - continue; + debug_printf( ( " (no update)\n" ) ); + continue; } /* ------------------------------------------------------------ */ /* Sign extend if this is a delta update. */ /* ------------------------------------------------------------ */ - if (delta) { /* Sign extend */ - if (value & (1u << (len - 1))) value |= -(1u << len); + if( delta ) { /* Sign extend */ + if( value & ( 1u << ( len - 1 ) ) ) value |= -( 1u << len ); } /* ------------------------------------------------------------ */ /* Shift the value to the appropriate precision. */ /* ------------------------------------------------------------ */ - if (shf) { - value = value < 0 ? -(-value << shf) : (value << shf); + if( shf ) { + value = value < 0 ? -( -value << shf ) : ( value << shf ); } - debug_printf(("v=%.2X (%c%.2X) ", value & 0xff, - value & 0x80 ? '-' : '+', - 0xff & (value & 0x80 ? -value : value))); + debug_printf( ( "v=%.2X (%c%.2X) ", value & 0xff, + value & 0x80 ? '-' : '+', + 0xff & ( value & 0x80 ? -value : value ) ) ); s->silent = 0; /* ------------------------------------------------------------ */ /* If this is a field-replace, insert the field. */ /* ------------------------------------------------------------ */ - if (field) { - debug_printf(("--field-> r[%2d] = %.2X -> ", prm, - s->filt.r[prm])); + if( field ) { + debug_printf( ( "--field-> r[%2d] = %.2X -> ", prm, + s->filt.r[prm] ) ); - s->filt.r[prm] &= ~(~0u << shf); /* Clear the old bits. */ - s->filt.r[prm] |= value; /* Merge in the new bits. */ + s->filt.r[prm] &= ~( ~0u << shf ); /* Clear the old bits. */ + s->filt.r[prm] |= value; /* Merge in the new bits. */ - debug_printf(("%.2X\n", s->filt.r[prm])); + debug_printf( ( "%.2X\n", s->filt.r[prm] ) ); - continue; + continue; } /* ------------------------------------------------------------ */ /* If this is a delta update, add to the appropriate field. */ /* ------------------------------------------------------------ */ - if (delta) { - debug_printf(("--delta-> r[%2d] = %.2X -> ", prm, - s->filt.r[prm])); + if( delta ) { + debug_printf( ( "--delta-> r[%2d] = %.2X -> ", prm, + s->filt.r[prm] ) ); - s->filt.r[prm] += value; + s->filt.r[prm] += value; - debug_printf(("%.2X\n", s->filt.r[prm])); + debug_printf( ( "%.2X\n", s->filt.r[prm] ) ); - continue; + continue; } /* ------------------------------------------------------------ */ /* Otherwise, just write the new value. */ /* ------------------------------------------------------------ */ s->filt.r[prm] = value; - debug_printf(("--value-> r[%2d] = %.2X\n", prm, s->filt.r[prm])); + debug_printf( ( "--value-> r[%2d] = %.2X\n", prm, s->filt.r[prm] ) ); } /* ---------------------------------------------------------------- */ /* Most opcodes clear IA, IP. */ /* ---------------------------------------------------------------- */ - if (opcode != 0x1 && opcode != 0x2 && opcode != 0x3) - { + if( opcode != 0x1 && opcode != 0x2 && opcode != 0x3 ) { s->filt.r[IA] = 0; s->filt.r[IP] = 0; } @@ -1118,8 +1110,7 @@ sp0256_micro(sp0256_t *s) /* ---------------------------------------------------------------- */ /* Special case: Set PAUSE's equivalent period. */ /* ---------------------------------------------------------------- */ - if (opcode == 0xf) - { + if( opcode == 0xf ) { s->silent = 1; s->filt.r[AM] = 0; s->filt.r[PR] = PER_PAUSE; @@ -1128,7 +1119,7 @@ sp0256_micro(sp0256_t *s) /* ---------------------------------------------------------------- */ /* Now that we've updated the registers, go decode them. */ /* ---------------------------------------------------------------- */ - lpc12_regdec(&s->filt); + lpc12_regdec( &s->filt ); /* ---------------------------------------------------------------- */ /* Break out since we now have a repeat count. */ @@ -1142,7 +1133,7 @@ sp0256_micro(sp0256_t *s) /* our good friend, the SP0256. */ /* ======================================================================== */ static uint32_t -sp0256_run(sp0256_t *s, uint32_t len) +sp0256_run( sp0256_t *s, uint32_t len ) { /* TODO: use 32-bit types only */ uint64_t until = sp0256_now + len; @@ -1152,17 +1143,17 @@ sp0256_run(sp0256_t *s, uint32_t len) /* -------------------------------------------------------------------- */ /* If the rest of the machine hasn't caught up to us, just return. */ /* -------------------------------------------------------------------- */ - if (until <= s->sound_current) + if( until <= s->sound_current ) return 0; /* -------------------------------------------------------------------- */ /* Iterate the sound engine. */ /* -------------------------------------------------------------------- */ - while (s->sound_current < until) { + while( s->sound_current < until ) { /* ---------------------------------------------------------------- */ /* Renormalize our sc_head and sc_tail. */ /* ---------------------------------------------------------------- */ - while (s->sc_head > SCBUF_SIZE && s->sc_tail > SCBUF_SIZE) { + while( s->sc_head > SCBUF_SIZE && s->sc_tail > SCBUF_SIZE ) { s->sc_head -= SCBUF_SIZE; s->sc_tail -= SCBUF_SIZE; } @@ -1173,7 +1164,7 @@ sp0256_run(sp0256_t *s, uint32_t len) /* Calculate the number of samples required at ~10kHz. */ /* (Actually, on NTSC this is 3579545 / 358, or 9998.73 Hz). */ /* ---------------------------------------------------------------- */ - samples = ((int)(until - s->sound_current + factor - 1)) / factor; + samples = ( (int)( until - s->sound_current + factor - 1 ) ) / factor; /* ---------------------------------------------------------------- */ /* Process the current set of filter coefficients as long as the */ @@ -1181,46 +1172,46 @@ sp0256_run(sp0256_t *s, uint32_t len) /* ---------------------------------------------------------------- */ did_samp = 0; old_idx = s->sc_head; - if (samples > 0) { + if( samples > 0 ) { do { - int do_samp; - - /* ------------------------------------------------------------ */ - /* If our repeat count expired, emulate the microsequencer. */ - /* ------------------------------------------------------------ */ - if (s->filt.rpt <= 0 && s->filt.cnt <= 0) - sp0256_micro(s); - - /* ------------------------------------------------------------ */ - /* Do as many samples as we can. */ - /* ------------------------------------------------------------ */ - do_samp = samples - did_samp; - if (s->sc_head + do_samp - s->sc_tail > SCBUF_SIZE) - do_samp = s->sc_tail + SCBUF_SIZE - s->sc_head; - - if (do_samp == 0) break; - - if (s->silent && - s->filt.rpt <= 0 && s->filt.cnt <= 0) { - int x, y = s->sc_head; - - for (x = 0; x < do_samp; x++) - s->scratch[y++ & SCBUF_MASK] = 0; - s->sc_head += do_samp; - did_samp += do_samp; - } else { - did_samp += lpc12_update(&s->filt, do_samp, - s->scratch, &s->sc_head); - } - } while ((s->filt.rpt > 0 || s->filt.cnt > 0) && - samples > did_samp); + int do_samp; + + /* ------------------------------------------------------------ */ + /* If our repeat count expired, emulate the microsequencer. */ + /* ------------------------------------------------------------ */ + if( s->filt.rpt <= 0 && s->filt.cnt <= 0 ) + sp0256_micro( s ); + + /* ------------------------------------------------------------ */ + /* Do as many samples as we can. */ + /* ------------------------------------------------------------ */ + do_samp = samples - did_samp; + if( s->sc_head + do_samp - s->sc_tail > SCBUF_SIZE ) + do_samp = s->sc_tail + SCBUF_SIZE - s->sc_head; + + if( do_samp == 0 ) break; + + if( s->silent && + s->filt.rpt <= 0 && s->filt.cnt <= 0 ) { + int x, y = s->sc_head; + + for( x = 0; x < do_samp; x++ ) + s->scratch[y++ & SCBUF_MASK] = 0; + s->sc_head += do_samp; + did_samp += do_samp; + } else { + did_samp += lpc12_update( &s->filt, do_samp, + s->scratch, &s->sc_head ); + } + } while ( ( s->filt.rpt > 0 || s->filt.cnt > 0 ) && + samples > did_samp ); } - if (did_samp) { + if( did_samp ) { int i; for( i = 0; i < did_samp; i++ ) { - sound_sp0256_write( sp0256_tstates + ((n + i) * factor), - s->scratch[(i + old_idx) & SCBUF_MASK] ); + sound_sp0256_write( sp0256_tstates + ( ( n + i ) * factor ), + s->scratch[( i + old_idx ) & SCBUF_MASK] ); } n += did_samp; } @@ -1228,7 +1219,7 @@ sp0256_run(sp0256_t *s, uint32_t len) s->sound_current += did_samp * factor; } - if (s->sound_current < sp0256_now) { + if( s->sound_current < sp0256_now ) { return 0; } @@ -1240,7 +1231,7 @@ sp0256_run(sp0256_t *s, uint32_t len) /* sp0256_read_lrq -- Handle reads from the SP0256. */ /* ======================================================================== */ static uint32_t -sp0256_read_lrq(sp0256_t *s) +sp0256_read_lrq( sp0256_t *s ) { return s->lrq; } @@ -1249,9 +1240,9 @@ sp0256_read_lrq(sp0256_t *s) /* sp0256_write_ald -- Handle writes to the SP0256's Address LoaD FIFO. */ /* ======================================================================== */ static void -sp0256_write_ald(sp0256_t *s, uint32_t data) +sp0256_write_ald( sp0256_t *s, uint32_t data ) { - if (!s->lrq) + if( !s->lrq ) return; /* ---------------------------------------------------------------- */ @@ -1260,7 +1251,7 @@ sp0256_write_ald(sp0256_t *s, uint32_t data) /* get the new PC address. */ /* ---------------------------------------------------------------- */ s->lrq = 0; - s->ald = (0xff & data) << 4; + s->ald = ( 0xff & data ) << 4; return; } @@ -1269,14 +1260,14 @@ sp0256_write_ald(sp0256_t *s, uint32_t data) /* sp0256_reset -- Resets the SP0256. */ /* ======================================================================== */ static void -sp0256_do_reset(sp0256_t *s) +sp0256_do_reset( sp0256_t *s ) { /* -------------------------------------------------------------------- */ /* Do a software-style reset of the SP0256. */ /* -------------------------------------------------------------------- */ s->fifo_head = s->fifo_tail = s->fifo_bitp = 0; - memset(&s->filt, 0, sizeof(s->filt)); + memset( &s->filt, 0, sizeof( s->filt ) ); s->halted = 1; s->filt.rpt = -1; s->filt.rng = 1; @@ -1299,7 +1290,7 @@ sp0256_do_init( sp0256_t *s, uint8_t *sp0256rom ) /* -------------------------------------------------------------------- */ /* First, lets zero out the structure to be safe. */ /* -------------------------------------------------------------------- */ - memset(s, 0, sizeof(*s)); + memset( s, 0, sizeof( *s ) ); /* -------------------------------------------------------------------- */ /* Configure our internal variables. */ @@ -1309,10 +1300,10 @@ sp0256_do_init( sp0256_t *s, uint8_t *sp0256rom ) /* -------------------------------------------------------------------- */ /* Allocate a scratch buffer for generating 10kHz samples. */ /* -------------------------------------------------------------------- */ - s->scratch = calloc(SCBUF_SIZE, sizeof(int16_t)); + s->scratch = calloc( SCBUF_SIZE, sizeof( int16_t ) ); s->sc_head = s->sc_tail = 0; - if (!s->scratch) + if( !s->scratch ) return -1; /* -------------------------------------------------------------------- */ @@ -1423,13 +1414,13 @@ static sp0256_t sp0256; int sp0256_init( uint8_t *sp0256rom ) { - return sp0256_do_init(&sp0256, sp0256rom); + return sp0256_do_init( &sp0256, sp0256rom ); } int sp0256_reset( uint8_t *sp0256rom ) { - debug_printf("sp0256_reset\n"); + debug_printf( "sp0256_reset\n" ); /* Lazy init, if necessary */ if( !sp0256.scratch ) { if( sp0256_do_init( &sp0256, sp0256rom ) ) { @@ -1447,22 +1438,22 @@ sp0256_end() if( sp0256.scratch ) { free( sp0256.scratch ); } - memset( &sp0256, 0, sizeof(sp0256) ); + memset( &sp0256, 0, sizeof( sp0256 ) ); } static void -sp0256_run_to(sp0256_t *s, uint64_t t ) +sp0256_run_to( sp0256_t *s, uint64_t t ) { int64_t periph_step; - while ( sp0256_tstates < t ) { + while( sp0256_tstates < t ) { int64_t n = t - sp0256_tstates; if( n > 14934 ) n = 14934; - periph_step = sp0256_run(s, n); - sp0256_tstates += abs(periph_step); - sp0256_now += abs(periph_step); - if (!periph_step) { + periph_step = sp0256_run( s, n ); + sp0256_tstates += abs( periph_step ); + sp0256_now += abs( periph_step ); + if( !periph_step ) { return; } } @@ -1483,7 +1474,8 @@ sp0256_play( int a ) #ifdef DEBUG_USPEECH_ALLOPHONE if( a >= 5 && a < 64 ) { if( al2_allophones[ a ].name ) { - printf( "sp0256: allophone written: 0x%02x, %s\n", a, al2_allophones[ a ].name ); + printf( "sp0256: allophone written: 0x%02x, %s\n", a, + al2_allophones[a].name ); } else { printf( "sp0256: allophone written: 0x%02x\n", a ); } @@ -1491,16 +1483,17 @@ sp0256_play( int a ) } #endif /* #ifdef DEBUG_USPEECH_ALLOPHONE */ - sp0256_run_to(&sp0256, tstates); - sp0256_write_ald(&sp0256, a); + sp0256_run_to( &sp0256, tstates ); + sp0256_write_ald( &sp0256, a ); } void sp0256_set_intonation( int intonation ) { if( intonation != current_intonation ) { - sp0256_run_to(&sp0256, tstates); - debug_printf( ("sp0256: intonation %s\n", intonation ? "high" : "normal") ); + sp0256_run_to( &sp0256, tstates ); + debug_printf( ( "sp0256: intonation %s\n", + intonation ? "high" : "normal" ) ); current_intonation = intonation; /* 358 - 1/8th = 314 */ factor = intonation ? 314 : 358; @@ -1510,6 +1503,6 @@ sp0256_set_intonation( int intonation ) int sp0256_busy( void ) { - sp0256_run_to(&sp0256, tstates); - return !sp0256_read_lrq(&sp0256); + sp0256_run_to( &sp0256, tstates ); + return !sp0256_read_lrq( &sp0256 ); } diff --git a/peripherals/sound/sp0256.h b/peripherals/sound/sp0256.h index 4fcac101..afde6f87 100644 --- a/peripherals/sound/sp0256.h +++ b/peripherals/sound/sp0256.h @@ -2,8 +2,6 @@ Copyright (c) 1998-2000 Joseph Zbiciak Copyright (c) 2007-2013 Stuart Brady - $Id$ - This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or diff --git a/peripherals/sound/uspeech.c b/peripherals/sound/uspeech.c index 5ba725d5..f995c94a 100644 --- a/peripherals/sound/uspeech.c +++ b/peripherals/sound/uspeech.c @@ -56,9 +56,9 @@ int uspeech_active = 0; int uspeech_available = 0; static void uspeech_toggle_write( libspectrum_word port, - libspectrum_byte val ); + libspectrum_byte val ); static libspectrum_byte uspeech_toggle_read( libspectrum_word port, - libspectrum_byte *attached ); + libspectrum_byte *attached ); static libspectrum_byte uspeech_port_play_read( libspectrum_word port, libspectrum_byte *attached ); static void uspeech_port_play_write( libspectrum_word port, @@ -271,14 +271,14 @@ uspeech_reset( int hard_reset GCC_UNUSED ) return; if( machine_load_rom_bank( uspeech_memory_map_romcs, 0, - settings_current.rom_uspeech, - settings_default.rom_uspeech, 0x0800 ) ) { + settings_current.rom_uspeech, + settings_default.rom_uspeech, 0x0800 ) ) { settings_current.uspeech = 0; periph_activate_type( PERIPH_TYPE_USPEECH, 0 ); return; } - if( uspeech_sp0256_reset()) { + if( uspeech_sp0256_reset() ) { settings_current.uspeech = 0; periph_activate_type( PERIPH_TYPE_USPEECH, 0 ); return; @@ -313,7 +313,7 @@ uspeech_memory_map( void ) static libspectrum_byte uspeech_toggle_read( libspectrum_word port GCC_UNUSED, - libspectrum_byte *attached GCC_UNUSED ) + libspectrum_byte *attached GCC_UNUSED ) { if( !uspeech_available ) return 0xff; @@ -409,5 +409,5 @@ uspeech_to_snapshot( libspectrum_snap *snap ) if( !periph_is_active( PERIPH_TYPE_USPEECH ) ) return; libspectrum_snap_set_uspeech_active( snap, 1 ); - libspectrum_snap_set_uspeech_paged ( snap, uspeech_active ); + libspectrum_snap_set_uspeech_paged( snap, uspeech_active ); } |
|
From: <sba...@us...> - 2023-09-19 03:50:54
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch patches-142-currah-uspeech in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/8813734d5183d9b1535905161c4dde6143c4fb92/ commit 8813734d5183d9b1535905161c4dde6143c4fb92 Author: Sergio Baldoví <ser...@gm...> AuthorDate: Wed Aug 30 19:41:36 2023 +0200 Update SP0256 code from upstream Current code is based on jzIntv emulator 1.0-beta4. There is a newer 20200712 version from which have been picked some features: - Use arithmetic operators when using signed data as bitwise operators have undefined behaviour. - sp0256_datafmt table has been extended with an alternate opcode 0001 (LOADALL) as doesn't always update F5/B5. --- peripherals/sound/sp0256.c | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/peripherals/sound/sp0256.c b/peripherals/sound/sp0256.c index 1f96cc42..b30282a3 100644 --- a/peripherals/sound/sp0256.c +++ b/peripherals/sound/sp0256.c @@ -218,7 +218,7 @@ amp_decode(uint8_t a) /* -------------------------------------------------------------------- */ #if 0 if (mant & 1) - ampl |= (1 << expn) - 1; + ampl |= (1u << expn) - 1; #endif return ampl; @@ -315,9 +315,9 @@ lpc12_update(lpc12_t *f, int num_samp, int16_t *out, uint32_t *optr) the limit of a signed 16 bits sample */ #ifdef HIGH_QUALITY /* Higher quality than the original, but who cares? */ - out[oidx++ & SCBUF_MASK] = limit(samp) << 2; + out[oidx++ & SCBUF_MASK] = limit(samp) * 4; #else - out[oidx++ & SCBUF_MASK] = (limit(samp >> 4) << 8); + out[oidx++ & SCBUF_MASK] = (limit(samp >> 4) * 256); #endif } @@ -407,7 +407,7 @@ static const uint16_t sp0256_datafmt[] = { /* -------------------------------------------------------------------- */ /* Opcode 0001: LOADALL */ /* -------------------------------------------------------------------- */ - /* All modes */ + /* Mode modes x1 */ /* 1 */ CR( 8, 0, AM, 0, 0, 0, 0), /* Amplitude */ /* 2 */ CR( 8, 0, PR, 0, 0, 0, 0), /* Period */ /* 3 */ CR( 8, 0, B0, 0, 0, 0, 0), /* B0 */ @@ -422,7 +422,6 @@ static const uint16_t sp0256_datafmt[] = { /* 12 */ CR( 8, 0, F4, 0, 0, 0, 0), /* F4 */ /* 13 */ CR( 8, 0, B5, 0, 0, 0, 0), /* B5 */ /* 14 */ CR( 8, 0, F5, 0, 0, 0, 0), /* F5 */ - /* Mode 01 and 11 only */ /* 15 */ CR( 8, 0, IA, 0, 0, 0, 0), /* Amp Interp */ /* 16 */ CR( 8, 0, IP, 0, 0, 0, 0), /* Pit Interp */ @@ -669,6 +668,25 @@ static const uint16_t sp0256_datafmt[] = { /* SETMSB_3 only */ /* 175 */ CR( 5, 0, IA, 0, 0, 0, 0), /* Ampl. Intr. */ /* 176 */ CR( 5, 0, IP, 0, 0, 0, 0), /* Per. Intr. */ + + /* -------------------------------------------------------------------- */ + /* Opcode 0001: LOADALL */ + /* -------------------------------------------------------------------- */ + /* Mode x0 */ + /* 177 */ CR( 8, 0, AM, 0, 0, 0, 0), /* Amplitude */ + /* 178 */ CR( 8, 0, PR, 0, 0, 0, 0), /* Period */ + /* 179 */ CR( 8, 0, B0, 0, 0, 0, 0), /* B0 */ + /* 180 */ CR( 8, 0, F0, 0, 0, 0, 0), /* F0 */ + /* 181 */ CR( 8, 0, B1, 0, 0, 0, 0), /* B1 */ + /* 182 */ CR( 8, 0, F1, 0, 0, 0, 0), /* F1 */ + /* 183 */ CR( 8, 0, B2, 0, 0, 0, 0), /* B2 */ + /* 184 */ CR( 8, 0, F2, 0, 0, 0, 0), /* F2 */ + /* 185 */ CR( 8, 0, B3, 0, 0, 0, 0), /* B3 */ + /* 186 */ CR( 8, 0, F3, 0, 0, 0, 0), /* F3 */ + /* 187 */ CR( 8, 0, B4, 0, 0, 0, 0), /* B4 */ + /* 188 */ CR( 8, 0, F4, 0, 0, 0, 0), /* F4 */ + /* 189 */ CR( 8, 0, IA, 0, 0, 0, 0), /* Amp Interp */ + /* 190 */ CR( 8, 0, IP, 0, 0, 0, 0), /* Pit Interp */ }; @@ -682,7 +700,7 @@ static const int16_t sp0256_df_idx[16 * 8] = { /* OPCODE 1010 */ 73, 77, 74, 77, 78, 82, 79, 82, /* OPCODE 0110 */ 33, 36, 34, 37, 38, 41, 39, 42, /* OPCODE 1110 */ 127,128, 127,128, 127,128, 127,128, - /* OPCODE 0001 */ 1, 14, 1, 16, 1, 14, 1, 16, + /* OPCODE 0001 */ 177,190, 1, 16, 177,190, 1, 16, /* OPCODE 1001 */ 45, 56, 45, 58, 59, 70, 59, 72, /* OPCODE 0101 */ 161,166, 162,166, 169,174, 170,174, /* OPCODE 1101 */ 111,116, 111,118, 119,124, 119,126, @@ -726,7 +744,7 @@ sp0256_getb(sp0256_t *s, int len) data = ((d1 << 10) | d0) >> s->fifo_bitp; #ifdef DEBUG_FIFO - dfprintf(("SP0256: RD_FIFO %.3X %d.%d %d\n", data & ((1 << len) - 1), + dfprintf(("SP0256: RD_FIFO %.3X %d.%d %d\n", data & ((1u << len) - 1), s->fifo_tail, s->fifo_bitp, s->fifo_head)); #endif @@ -765,7 +783,7 @@ sp0256_getb(sp0256_t *s, int len) /* -------------------------------------------------------------------- */ /* Mask data to the requested length. */ /* -------------------------------------------------------------------- */ - data &= ((1 << len) - 1); + data &= ((1u << len) - 1); return data; } @@ -1036,14 +1054,14 @@ sp0256_micro(sp0256_t *s) /* Sign extend if this is a delta update. */ /* ------------------------------------------------------------ */ if (delta) { /* Sign extend */ - if (value & (1 << (len - 1))) value |= -1 << len; + if (value & (1u << (len - 1))) value |= -(1u << len); } /* ------------------------------------------------------------ */ /* Shift the value to the appropriate precision. */ /* ------------------------------------------------------------ */ if (shf) { - value <<= shf; + value = value < 0 ? -(-value << shf) : (value << shf); } debug_printf(("v=%.2X (%c%.2X) ", value & 0xff, @@ -1059,8 +1077,8 @@ sp0256_micro(sp0256_t *s) debug_printf(("--field-> r[%2d] = %.2X -> ", prm, s->filt.r[prm])); - s->filt.r[prm] &= ~(~0 << shf); /* Clear the old bits. */ - s->filt.r[prm] |= value; /* Merge in the new bits. */ + s->filt.r[prm] &= ~(~0u << shf); /* Clear the old bits. */ + s->filt.r[prm] |= value; /* Merge in the new bits. */ debug_printf(("%.2X\n", s->filt.r[prm])); @@ -1153,7 +1171,7 @@ sp0256_run(sp0256_t *s, uint32_t len) /* ---------------------------------------------------------------- */ /* Calculate the number of samples required at ~10kHz. */ - /* (Actually, this is 3579545 / 358, or 9998.73 Hz). */ + /* (Actually, on NTSC this is 3579545 / 358, or 9998.73 Hz). */ /* ---------------------------------------------------------------- */ samples = ((int)(until - s->sound_current + factor - 1)) / factor; |
|
From: <sba...@us...> - 2023-09-19 03:50:53
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch patches-142-currah-uspeech in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/adc075999816a34c33971d8a911f6f8e8fa1bc96/ commit adc075999816a34c33971d8a911f6f8e8fa1bc96 Author: Sergio Baldoví <ser...@gm...> AuthorDate: Mon Aug 28 14:18:04 2023 +0200 Fix audio glitches in SP0256 samples SP0256 generate signed 16 bits samples in the scratch buffer but Fuse was passing only the most significant byte to sound_sp0256_write(). With this patch SP0256 samples pass directly to the blip buffer. --- peripherals/sound/sp0256.c | 5 ++++- sound.c | 6 +++--- sound.h | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/peripherals/sound/sp0256.c b/peripherals/sound/sp0256.c index 6094eb9b..1f96cc42 100644 --- a/peripherals/sound/sp0256.c +++ b/peripherals/sound/sp0256.c @@ -311,6 +311,9 @@ lpc12_update(lpc12_t *f, int num_samp, int16_t *out, uint32_t *optr) f->z_data[j][0] = samp; } + /* Sergio: low quality samples sound louder as can be scaled closer to + the limit of a signed 16 bits sample */ + #ifdef HIGH_QUALITY /* Higher quality than the original, but who cares? */ out[oidx++ & SCBUF_MASK] = limit(samp) << 2; #else @@ -1199,7 +1202,7 @@ sp0256_run(sp0256_t *s, uint32_t len) int i; for( i = 0; i < did_samp; i++ ) { sound_sp0256_write( sp0256_tstates + ((n + i) * factor), - (s->scratch[(i + old_idx) & SCBUF_MASK]) >> 8 ); + s->scratch[(i + old_idx) & SCBUF_MASK] ); } n += did_samp; } diff --git a/sound.c b/sound.c index db290498..d651da4b 100644 --- a/sound.c +++ b/sound.c @@ -711,14 +711,14 @@ sound_covox_write( libspectrum_word port GCC_UNUSED, libspectrum_byte val ) * as the output is already a digitized waveform */ void -sound_sp0256_write( uint32_t f, libspectrum_byte val ) +sound_sp0256_write( libspectrum_dword at_tstates, libspectrum_signed_word val ) { if( !sound_enabled ) return; - blip_synth_update( left_sp0256_synth, f, ( val - 128) * 128); + blip_synth_update( left_sp0256_synth, at_tstates, val ); if( right_sp0256_synth ) { - blip_synth_update( right_sp0256_synth, f, ( val - 128) * 128); + blip_synth_update( right_sp0256_synth, at_tstates, val ); } } diff --git a/sound.h b/sound.h index e8bf010f..5480d562 100644 --- a/sound.h +++ b/sound.h @@ -37,7 +37,8 @@ void sound_ay_write( int reg, int val, libspectrum_dword now ); void sound_ay_reset( void ); void sound_specdrum_write( libspectrum_word port, libspectrum_byte val ); void sound_covox_write( libspectrum_word port, libspectrum_byte val ); -void sound_sp0256_write( uint32_t f, libspectrum_byte val ); +void sound_sp0256_write( libspectrum_dword at_tstates, + libspectrum_signed_word val ); void sound_frame( void ); void sound_beeper( libspectrum_dword at_tstates, int on ); libspectrum_dword sound_get_effective_processor_speed( void ); |
|
From: <sba...@us...> - 2023-09-19 03:50:51
|
This is an automated email from the git hooks/post-receive-user script.
sbaldovi pushed a change to branch patches-142-currah-uspeech
in repository fuse.
from 2324c3dd Add memory address mirroring and more I/O ports to uSpeech
new adc07599 Fix audio glitches in SP0256 samples
new 8813734d Update SP0256 code from upstream
new a92e319a Beautify uSpeech code with uncrustify
new efffc400 Document uSpeech volume option
new 1bb5a4cf Add uSpeech page/unpage events to debugger
new bd36f290 Limit uSpeech to 48K machines
The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
data/shell-completion/bash/fuse | 14 +-
machines/machines_periph.c | 2 +-
man/fuse.1 | 16 ++
peripherals/sound/sp0256.c | 580 ++++++++++++++++++++--------------------
peripherals/sound/sp0256.h | 2 -
peripherals/sound/uspeech.c | 28 +-
sound.c | 6 +-
sound.h | 3 +-
8 files changed, 348 insertions(+), 303 deletions(-)
|
|
From: <sba...@us...> - 2023-08-21 17:26:24
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository libspectrum. View the commit online: https://sourceforge.net/p/fuse-emulator/libspectrum/ci/56e6f89c696c4d03d93bfbb519e47a7a5136a876/ The following commit(s) were added to refs/heads/master by this push: new 56e6f89 fix: Fixed running unittest checks which require gzip, but gzip was not enabled or available. new 8b374cb Merge request #13: Fixed unittest checks that require gzip 56e6f89 is described below commit 56e6f89c696c4d03d93bfbb519e47a7a5136a876 Author: Miroslav Ďurčík <743...@us...> AuthorDate: Tue Apr 25 22:12:25 2023 +0200 fix: Fixed running unittest checks which require gzip, but gzip was not enabled or available. fix: Fixed running unittest checks which require gzip, but gzip was not enabled or available. In case of writing block, uncompressed size will be checked. In case of reading gzipped files, such tests will be skipped. fix: Fixed core dump in test 39, when 85 (0x55) pages where to be saved, while memory was reserverd for 64. refactor: Internal function for executing such test was modified to return error code in case more pages requested than actually reserved in memory. unittest: Added support for returning TEST_SKIPPED as return value from test function. See also https://sourceforge.net/p/arki55-fuse-mod/tickets/10/ --- libspectrum.c | 4 +-- libspectrum.h.in | 1 + szx.c | 19 ++++++++-- test/szx.c | 106 +++++++++++++++++++++++++++++++++++++++++++------------ test/test.c | 50 +++++++++++++++++++++----- test/test.h | 1 + 6 files changed, 144 insertions(+), 37 deletions(-) diff --git a/libspectrum.c b/libspectrum.c index 55ba4aa..58fa740 100644 --- a/libspectrum.c +++ b/libspectrum.c @@ -840,10 +840,10 @@ libspectrum_uncompress_file( unsigned char **new_buffer, size_t *new_length, #else /* #ifdef HAVE_ZLIB_H */ - libspectrum_print_error( LIBSPECTRUM_ERROR_UNKNOWN, + libspectrum_print_error( LIBSPECTRUM_ERROR_MISSING_ZLIB, "zlib not available to decompress gzipped file" ); if( new_filename ) libspectrum_free( *new_filename ); - return LIBSPECTRUM_ERROR_UNKNOWN; + return LIBSPECTRUM_ERROR_MISSING_ZLIB; #endif /* #ifdef HAVE_ZLIB_H */ diff --git a/libspectrum.h.in b/libspectrum.h.in index 8c11f44..22920ae 100644 --- a/libspectrum.h.in +++ b/libspectrum.h.in @@ -99,6 +99,7 @@ typedef enum libspectrum_error { LIBSPECTRUM_ERROR_SIGNATURE, LIBSPECTRUM_ERROR_SLT, /* .slt data found at end of a .z80 file */ LIBSPECTRUM_ERROR_INVALID, /* Invalid parameter supplied */ + LIBSPECTRUM_ERROR_MISSING_ZLIB, /* Missing or not used zlib.h */ LIBSPECTRUM_ERROR_LOGIC = -1, diff --git a/szx.c b/szx.c index 5889de8..1f9df19 100644 --- a/szx.c +++ b/szx.c @@ -311,7 +311,7 @@ write_atrp_chunk( libspectrum_buffer *buffer, libspectrum_buffer *block_data, static void write_zxcf_chunk( libspectrum_buffer *buffer, libspectrum_buffer *data, libspectrum_snap *snap ); -static void +static libspectrum_error write_cfrp_chunk( libspectrum_buffer *buffer, libspectrum_buffer *block_data, libspectrum_snap *snap, int page, int compress ); static void @@ -2800,7 +2800,11 @@ libspectrum_szx_write( libspectrum_buffer *buffer, int *out_flags, write_zxcf_chunk( buffer, block_data, snap ); for( i = 0; i < libspectrum_snap_zxcf_pages( snap ); i++ ) { - write_cfrp_chunk( buffer, block_data, snap, i, compress ); + error = write_cfrp_chunk( buffer, block_data, snap, i, compress ); + if( error != LIBSPECTRUM_ERROR_NONE ) { + libspectrum_buffer_free( block_data ); + return error; + } } } @@ -3781,14 +3785,23 @@ write_zxcf_chunk( libspectrum_buffer *buffer, libspectrum_buffer *data, write_chunk( buffer, ZXSTBID_ZXCF, data ); } -static void +static libspectrum_error write_cfrp_chunk( libspectrum_buffer *buffer, libspectrum_buffer *block_data, libspectrum_snap *snap, int page, int compress ) { + if( page >= SNAPSHOT_ZXCF_PAGES ) { + libspectrum_print_error( LIBSPECTRUM_ERROR_INVALID, + "%s:write_cfrp_chunk: page number %lu too high", + __FILE__, (unsigned long)page ); + return LIBSPECTRUM_ERROR_INVALID; + } + const libspectrum_byte *data = libspectrum_snap_zxcf_ram( snap, page ); write_ram_page( buffer, block_data, ZXSTBID_ZXCFRAMPAGE, data, 0x4000, page, compress, 0x00 ); + + return LIBSPECTRUM_ERROR_NONE; } #ifdef HAVE_ZLIB_H diff --git a/test/szx.c b/test/szx.c index 83972ef..2c295bc 100644 --- a/test/szx.c +++ b/test/szx.c @@ -104,6 +104,7 @@ szx_write_block_test_with_flags( const char *id, libspectrum_machine machine, { libspectrum_snap *snap; libspectrum_byte *buffer; size_t length; + libspectrum_error error; int out_flags; szx_chunk_t *chunk; size_t i; @@ -117,8 +118,14 @@ szx_write_block_test_with_flags( const char *id, libspectrum_machine machine, length = 0; buffer = NULL; - libspectrum_snap_write( &buffer, &length, &out_flags, snap, + error = libspectrum_snap_write( &buffer, &length, &out_flags, snap, LIBSPECTRUM_ID_SNAPSHOT_SZX, NULL, flags ); + if (error != LIBSPECTRUM_ERROR_NONE) { + fprintf( stderr, "Snap write failed with error %d\n", error ); + if (buffer) + libspectrum_free( buffer ); + return TEST_INCOMPLETE; + } libspectrum_snap_free( snap ); chunk = find_szx_chunk( buffer, length, id ); @@ -144,7 +151,8 @@ szx_write_block_test_with_flags( const char *id, libspectrum_machine machine, } } } else { - fprintf( stderr, "Chunk has wrong length\n" ); + fprintf( stderr, "Chunk has wrong length (expected %lu, got %lu)\n", + (unsigned long)total_length, (unsigned long)chunk->length ); r = TEST_FAIL; } @@ -157,10 +165,10 @@ szx_write_block_test_with_flags( const char *id, libspectrum_machine machine, static test_return_t szx_write_block_test( const char *id, libspectrum_machine machine, void (*setter)( libspectrum_snap* ), - libspectrum_byte *expected, size_t expected_length ) + libspectrum_byte *expected, size_t expected_length, size_t total_length ) { return szx_write_block_test_with_flags( id, machine, 0, setter, - expected, expected_length, expected_length ); + expected, expected_length, total_length ); } static test_return_t @@ -223,7 +231,7 @@ test_return_t test_31( void ) { return szx_write_block_test( "Z80R", LIBSPECTRUM_MACHINE_48, z80r_setter, - test_31_expected, ARRAY_SIZE(test_31_expected) ); + test_31_expected, ARRAY_SIZE(test_31_expected), ARRAY_SIZE(test_31_expected) ); } static void @@ -244,7 +252,7 @@ test_return_t test_32( void ) { return szx_write_block_test( "SPCR", LIBSPECTRUM_MACHINE_PLUS3, spcr_setter, - test_32_expected, ARRAY_SIZE(test_32_expected) ); + test_32_expected, ARRAY_SIZE(test_32_expected), ARRAY_SIZE(test_32_expected) ); } static void @@ -269,7 +277,7 @@ test_return_t test_33( void ) { return szx_write_block_test( "JOY\0", LIBSPECTRUM_MACHINE_48, joy_setter, - test_33_expected, ARRAY_SIZE(test_33_expected) ); + test_33_expected, ARRAY_SIZE(test_33_expected), ARRAY_SIZE(test_33_expected) ); } static void @@ -292,7 +300,7 @@ test_return_t test_34( void ) { return szx_write_block_test( "KEYB", LIBSPECTRUM_MACHINE_48, keyb_setter, - test_34_expected, ARRAY_SIZE(test_34_expected) ); + test_34_expected, ARRAY_SIZE(test_34_expected), ARRAY_SIZE(test_34_expected) ); } static void @@ -310,7 +318,7 @@ test_return_t test_35( void ) { return szx_write_block_test( "ZXPR", LIBSPECTRUM_MACHINE_48, zxpr_setter, - test_35_expected, ARRAY_SIZE(test_35_expected) ); + test_35_expected, ARRAY_SIZE(test_35_expected), ARRAY_SIZE(test_35_expected) ); } static libspectrum_byte @@ -345,7 +353,7 @@ test_return_t test_36( void ) { return szx_write_block_test( "AY\0\0", LIBSPECTRUM_MACHINE_48, ay_setter, - test_36_expected, ARRAY_SIZE(test_36_expected) ); + test_36_expected, ARRAY_SIZE(test_36_expected), ARRAY_SIZE(test_36_expected) ); } static void @@ -364,7 +372,7 @@ test_return_t test_37( void ) { return szx_write_block_test( "SCLD", LIBSPECTRUM_MACHINE_TC2048, scld_setter, - test_37_expected, ARRAY_SIZE(test_37_expected) ); + test_37_expected, ARRAY_SIZE(test_37_expected), ARRAY_SIZE(test_37_expected) ); } static void @@ -393,7 +401,7 @@ test_return_t test_38( void ) { return szx_write_block_test( "ZXAT", LIBSPECTRUM_MACHINE_48, zxat_setter, - test_38_expected, ARRAY_SIZE(test_38_expected) ); + test_38_expected, ARRAY_SIZE(test_38_expected), ARRAY_SIZE(test_38_expected) ); } static void @@ -403,21 +411,21 @@ zxcf_setter( libspectrum_snap *snap ) libspectrum_snap_set_zxcf_upload( snap, 1 ); libspectrum_snap_set_zxcf_memctl( snap, 0x37 ); - libspectrum_snap_set_zxcf_pages( snap, 0x55 ); + libspectrum_snap_set_zxcf_pages( snap, 0x35 ); } static libspectrum_byte test_39_expected[] = { 0x01, 0x00, /* Flags */ 0x37, /* Memory control */ - 0x55 /* Page count */ + 0x35 /* Page count */ }; test_return_t test_39( void ) { return szx_write_block_test( "ZXCF", LIBSPECTRUM_MACHINE_48, zxcf_setter, - test_39_expected, ARRAY_SIZE(test_39_expected) ); + test_39_expected, ARRAY_SIZE(test_39_expected), ARRAY_SIZE(test_39_expected) ); } static void @@ -437,7 +445,7 @@ test_return_t test_40( void ) { return szx_write_block_test( "AMXM", LIBSPECTRUM_MACHINE_48, amxm_setter, - test_40_expected, ARRAY_SIZE(test_40_expected) ); + test_40_expected, ARRAY_SIZE(test_40_expected), ARRAY_SIZE(test_40_expected) ); } static void @@ -453,7 +461,7 @@ test_return_t test_41( void ) { return szx_write_block_test( "SIDE", LIBSPECTRUM_MACHINE_48, side_setter, - empty_chunk_expected, ARRAY_SIZE(empty_chunk_expected) ); + empty_chunk_expected, ARRAY_SIZE(empty_chunk_expected), ARRAY_SIZE(empty_chunk_expected) ); } static void @@ -472,7 +480,7 @@ test_return_t test_42( void ) { return szx_write_block_test( "DRUM", LIBSPECTRUM_MACHINE_48, drum_setter, - test_42_expected, ARRAY_SIZE(test_42_expected) ); + test_42_expected, ARRAY_SIZE(test_42_expected), ARRAY_SIZE(test_42_expected) ); } static void @@ -492,7 +500,7 @@ test_return_t test_43( void ) { return szx_write_block_test( "COVX", LIBSPECTRUM_MACHINE_48, covx_setter, - test_43_expected, ARRAY_SIZE(test_43_expected) ); + test_43_expected, ARRAY_SIZE(test_43_expected), ARRAY_SIZE(test_43_expected) ); } static void @@ -505,7 +513,7 @@ test_return_t test_57( void ) { return szx_write_block_test( "ZMMC", LIBSPECTRUM_MACHINE_48, zmmc_setter, - empty_chunk_expected, ARRAY_SIZE(empty_chunk_expected) ); + empty_chunk_expected, ARRAY_SIZE(empty_chunk_expected), ARRAY_SIZE(empty_chunk_expected) ); } static void @@ -515,6 +523,7 @@ ramp_setter( libspectrum_snap *snap ) libspectrum_snap_set_pages( snap, 0, ram ); } +#ifdef HAVE_ZLIB_H static libspectrum_byte empty_ram_page_expected[] = { 0x01, 0x00, /* Flags */ @@ -526,12 +535,29 @@ empty_ram_page_expected[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xb7, 0x01, 0x40, 0x00, 0x00, 0x01 }; +#else +static libspectrum_byte +empty_ram_page_uncompressed_expected[] = { + 0x00, 0x00, /* Flags */ + 0x00, /* Page number */ + /* 16 Kb of zeros uncompressed */ +}; +#endif test_return_t test_59( void ) { return szx_write_block_test( "RAMP", LIBSPECTRUM_MACHINE_48, ramp_setter, - empty_ram_page_expected, ARRAY_SIZE(empty_ram_page_expected) ); + #ifdef HAVE_ZLIB_H + /* gzip enabled in build, so block written compressed */ + empty_ram_page_expected, ARRAY_SIZE(empty_ram_page_expected), + ARRAY_SIZE(empty_ram_page_expected) + #else + /* gzip not enabled in build, so block written uncompressed */ + empty_ram_page_uncompressed_expected, ARRAY_SIZE(empty_ram_page_uncompressed_expected), + ARRAY_SIZE(empty_ram_page_uncompressed_expected) + 0x4000 + #endif + ); } static void @@ -550,7 +576,16 @@ test_return_t test_61( void ) { return szx_write_block_test( "ATRP", LIBSPECTRUM_MACHINE_48, atrp_setter, - empty_ram_page_expected, ARRAY_SIZE(empty_ram_page_expected) ); + #ifdef HAVE_ZLIB_H + /* gzip enabled in build, so block written compressed */ + empty_ram_page_expected, ARRAY_SIZE(empty_ram_page_expected), + ARRAY_SIZE(empty_ram_page_expected) + #else + /* gzip not enabled in build, so block written uncompressed */ + empty_ram_page_uncompressed_expected, ARRAY_SIZE(empty_ram_page_uncompressed_expected), + ARRAY_SIZE(empty_ram_page_uncompressed_expected) + 0x4000 + #endif + ); } static void @@ -569,7 +604,16 @@ test_return_t test_62( void ) { return szx_write_block_test( "CFRP", LIBSPECTRUM_MACHINE_48, cfrp_setter, - empty_ram_page_expected, ARRAY_SIZE(empty_ram_page_expected) ); + #ifdef HAVE_ZLIB_H + /* gzip enabled in build, so block written compressed */ + empty_ram_page_expected, ARRAY_SIZE(empty_ram_page_expected), + ARRAY_SIZE(empty_ram_page_expected) + #else + /* gzip not enabled in build, so block written uncompressed */ + empty_ram_page_uncompressed_expected, ARRAY_SIZE(empty_ram_page_uncompressed_expected), + ARRAY_SIZE(empty_ram_page_uncompressed_expected) + 0x4000 + #endif + ); } static libspectrum_byte @@ -647,6 +691,10 @@ static test_return_t szx_read_block_from_compressed_snap_test( const char *id, int (*check_fn)( libspectrum_snap* ) ) { + #ifndef HAVE_ZLIB_H + return TEST_SKIPPED; /* gzip not enabled in build */ + #endif + return szx_read_block_test_with_template( id, STATIC_TEST_PATH( "szx-chunks/%s-uncompressed.szx.gz" ), check_fn ); } @@ -951,6 +999,10 @@ ramp_check( libspectrum_snap *snap ) test_return_t test_60( void ) { + #ifndef HAVE_ZLIB_H + return TEST_SKIPPED; /* gzip not enabled in build */ + #endif + return szx_read_block_test( "RAMP", ramp_check ); } @@ -963,6 +1015,10 @@ atrp_check( libspectrum_snap *snap ) test_return_t test_63( void ) { + #ifndef HAVE_ZLIB_H + return TEST_SKIPPED; /* gzip not enabled in build */ + #endif + return szx_read_block_test( "ATRP", atrp_check ); } @@ -975,6 +1031,10 @@ cfrp_check( libspectrum_snap *snap ) test_return_t test_64( void ) { + #ifndef HAVE_ZLIB_H + return TEST_SKIPPED; /* gzip not enabled in build */ + #endif + return szx_read_block_test( "CFRP", cfrp_check ); } diff --git a/test/test.c b/test/test.c index 363e30c..c1a45d3 100644 --- a/test/test.c +++ b/test/test.c @@ -256,6 +256,10 @@ test_3( void ) static test_return_t test_4( void ) { + #ifndef HAVE_ZLIB_H + return TEST_SKIPPED; /* gzip not enabled in build */ + #endif + const char *filename = STATIC_TEST_PATH( "invalid.gz" ); return read_snap( filename, filename, LIBSPECTRUM_ERROR_UNKNOWN ); } @@ -264,6 +268,10 @@ test_4( void ) static test_return_t test_5( void ) { + #ifndef HAVE_ZLIB_H + return TEST_SKIPPED; /* gzip not enabled in build */ + #endif + return read_snap( STATIC_TEST_PATH( "invalid.gz" ), NULL, LIBSPECTRUM_ERROR_UNKNOWN ); } @@ -413,6 +421,10 @@ test_19( void ) static test_return_t test_20( void ) { + #ifndef HAVE_ZLIB_H + return TEST_SKIPPED; /* gzip not enabled in build */ + #endif + const char *filename = STATIC_TEST_PATH( "sp-2000.sna.gz" ); return read_snap( filename, filename, LIBSPECTRUM_ERROR_CORRUPT ); } @@ -420,6 +432,10 @@ test_20( void ) static test_return_t test_21( void ) { + #ifndef HAVE_ZLIB_H + return TEST_SKIPPED; /* gzip not enabled in build */ + #endif + const char *filename = STATIC_TEST_PATH( "sp-ffff.sna.gz" ); return read_snap( filename, filename, LIBSPECTRUM_ERROR_CORRUPT ); } @@ -690,6 +706,10 @@ test_26( void ) static test_return_t test_27( void ) { + #ifndef HAVE_ZLIB_H + return TEST_SKIPPED; /* gzip not enabled in build */ + #endif + const char *filename = STATIC_TEST_PATH( "empty.szx" ); libspectrum_byte *buffer = NULL; size_t filesize = 0; @@ -764,6 +784,10 @@ test_30( void ) static test_return_t test_71( void ) { +#ifndef HAVE_ZLIB_H + return TEST_SKIPPED; /* gzip not enabled in build */ +#endif + const char *filename = STATIC_TEST_PATH( "random.szx" ); libspectrum_byte *buffer = NULL; size_t filesize = 0; @@ -1037,17 +1061,25 @@ main( int argc, char *argv[] ) tests_done++; switch( test->test() ) { case TEST_PASS: - printf( "passed\n" ); - pass++; - break; + /* Test executed completely and passed */ + printf( "passed\n" ); + pass++; + break; case TEST_FAIL: - printf( "FAILED\n" ); - fail++; - break; + /* Test executed completely but failed */ + printf( "FAILED\n" ); + fail++; + break; case TEST_INCOMPLETE: - printf( "NOT COMPLETE\n" ); - incomplete++; - break; + /* Error occurred while executing test */ + printf( "NOT COMPLETE\n" ); + incomplete++; + break; + case TEST_SKIPPED: + /* Not possible to run this test (missing dependencies) */ + printf( "skipped\n" ); + tests_skipped++; + break; } } else { tests_skipped++; diff --git a/test/test.h b/test/test.h index 04bd898..115e12f 100644 --- a/test/test.h +++ b/test/test.h @@ -9,6 +9,7 @@ typedef enum test_return_t { TEST_PASS, TEST_FAIL, TEST_INCOMPLETE, + TEST_SKIPPED, } test_return_t; typedef struct test_edge_sequence_t { |
|
From: <sba...@us...> - 2023-08-21 17:12:59
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/7718c3a4b8bcb41d52ab1bcd90fb809fd64e36f5/ commit 7718c3a4b8bcb41d52ab1bcd90fb809fd64e36f5 Merge: 81efcbce 4b1a7e6f Author: Sergio Baldoví <ser...@gm...> AuthorDate: Mon Aug 21 19:10:50 2023 +0200 Merge request #25: GitHub test and nightly builds Allows to schedule automatic Windows builds on GitHub and publish a package on SourceForge .github/workflows/build_linux.yml | 2 +- .github/workflows/build_macos.yml | 2 +- .github/workflows/build_wii.yml | 2 +- .github/workflows/build_wii_sub.yml | 1 - .github/workflows/build_windows.yml | 7 +- .github/workflows/build_windows_sub.yml | 171 +++++++++++++++-- .github/workflows/nightly_build.yml | 45 +++++ .github/workflows/test_release.yml | 249 +++++++++++++++++++++++++ .github/workflows/test_release_windows_sub.yml | 45 +++++ configure.ac | 30 ++- fuse.c | 23 +++ ui/widget/error.c | 12 +- 12 files changed, 570 insertions(+), 19 deletions(-) |