Z88dk1.9 - 1 bit sound for other targets?

Discussion about other targets
Post Reply
bushy555
Member
Posts: 13
Joined: Tue Jul 16, 2013 9:31 am

Z88dk1.9 - 1 bit sound for other targets?

Post by bushy555 »

Hi All,

Should the Beepfx and Tritone engines, which are located under the _development\sound directory in v1.9 , which , on the surface, appear to be specific for the ZX Spectrum, should these be able to be compiled for other targets?

I'm trying my hardest to get something to compile for the VZ200, but it simply keeps falling over during compilation, and, unfortunately, just do not have enough C knowledge to get it up and running nicely. Specifically, Im just trying to get the examples to compile.

Managed to get William Whites TI Calc 1-bit WAV engine working nicely on the VZ few years back ( http://www.ticalc.org/archives/files/au ... /5683.html ) which may have been a first ever event having a real VZ playing a 1bit WAV sample.

I've also been tinkering with a few of the other 1-bit players and tracker engines for the Z88 and ZX (POWW, Beepola, Houson Tracker, Huby, Mbox, Ntropic, 1tracker - all written in Assembly) on and off for a few years now, and am getting close to finally getting something to actually play on a real VZ through its useless piezo speaker. (Yes , it has taken me this long !)

....it would be wonderful if BeepFX and the Tritone engines - in C - will compile for other targets other than just the Speccy.

thanks,
Dave
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

bushy555 wrote:....it would be wonderful if BeepFX and the Tritone engines - in C - will compile for other targets other than just the Speccy.
In fact they will. All the code is written such that a specific target only has to inform the library via defined constants how the machine generates audio. There is also an attempt in there to compensate for varying cpu speed but this has been temporarily removed because the best way to do this would be with macros, which is a feature that is under development in z80asm. The sound engines were written for the spectrum so they expect a cpu speed of 3.5MHz but anything in that ballpark should have reasonable results. Tritone is particularly sensitive to cpu speed and there will be degradation in quality if speed is too much lower than 3.5MHz but what it sounds like cannot be known without trying it out.

The problem you are probably having is that you're trying to compile using the classic C library. z88dk is undergoing a transition currently and there are a lot of new things in there and one of those is a another completely independent C library which we're calling the new C library and it's the new C library that has the beepfx and tritone engines. That's what's in the _development root. When you compile you can choose to use the classic C library or the new C library. You can also choose to use sccz80 (z88dk's native C compiler) or sdcc to do the C translation but only the new C library is compatible with sdcc.

Here's the part that will get in the way. The new C library only currently supports three targets: cpm, embedded (generic z80) and zx spectrum. You can make vz200 programs using the embedded target but the embedded target is stripped of any target-specific code like sound because it's independent of any specific hardware. So to get at the functions in the new C library, the best route would be to create a vz200 target. If you're willing to help with that I can assist in creating it. Some of the code can probably be borrowed from the classic C library but the two libraries are quite a bit different so many things will have to be done differently. I seem to recall the vz had a difficult memory map so that may make things harder too.
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

Under construction wiki describing the new part of z88dk:
http://www.z88dk.org/wiki/doku.php?id=temp:front

Some description of the new C library:
http://www.z88dk.org/wiki/doku.php?id=t ... erence_new

Making a new target for the new C library:
http://www.z88dk.org/wiki/doku.php?id=t ... g_a_target
bushy555
Member
Posts: 13
Joined: Tue Jul 16, 2013 9:31 am

Post by bushy555 »

Thanks for the reply.

> If you're willing to help with that I can assist in creating it

Heck yeah! I'm more than willing to help out - but I'll be up front and admit that I have near zilch knowledge and experience in creating any sort of a library.
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

bushy555 wrote:Heck yeah! I'm more than willing to help out - but I'll be up front and admit that I have near zilch knowledge and experience in creating any sort of a library.
That's ok... most of the library is suitable for any target. Initially I will just put in a simple optional stdio using the ROM print routines. The new c lib does not have a simple input for stdio like the classic lib but I'll copy that over for a vz target soon. Currently the new c lib's stdio input is independent of os and offers a lot of features but this comes at a cost of a couple of K which is hard on a low-mem target.

I'm wondering if there are standard cartridges for the vz and what sort of loaders you use for machine code programs. Stef has some stuff in appmake for vz now that generates cassette files and it looks like there are two options -- a basic startup mode where the binary loads at $7ae9 and a "direct m/c" mode which loads at $7b00. The basic startup mode consists of a short basic program that pokes the usr address to the bytes following a usr(x) call (the basic and compiled program are in one block with the latter immediately following the former).

What I think may even be better is to have a short loader load into the screen memory so that the binary can be loaded right at the beginning of ram at $7800 so I'm wondering if this is done already. In this mode, no ROM code could be used so there are circumstances where you may not want to do this.
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

Are interrupts not used on the vz? I can see /int and /nmi are run to the edge connector in the schematics so it appears only external peripherals can trigger interrupts. Does anything use those interrupts and does the vz have code at 0x38 and 0x66 to service them?
bushy555
Member
Posts: 13
Joined: Tue Jul 16, 2013 9:31 am

Post by bushy555 »

Sorry for the slack long delay in replying. Interrupts are certainly used .
http://www.vz200.org/bushy/article_vide ... errupt.pdf

As for all the other Q's - I'm really terribly sorry; I wish I could answer those other questions for you. I just do not have the knowledge.
And just about everyone whom did have the knowledge have all long lost interest. Its as though the entire VZ and Laser community has just simply deceased.
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

Thanks, the link was helpful to clarify how maskable interrupts are serviced.

I'm trying to find some time to redo the drivers in the new c lib and once that is done I will try a preliminary vz target.
WauloK
Member
Posts: 63
Joined: Thu Oct 10, 2019 10:45 am

Post by WauloK »

Do you know if there was any progress on this or if there's any other info we can provide? :)
WauloK
Member
Posts: 63
Joined: Thu Oct 10, 2019 10:45 am

Post by WauloK »

Looks like no new library for vz yet?
zcc.exe +vz -pragma-redirect:scrbase=base_graphics -clib=new -o test.vz test
Cannot find definition for -clib=new
User avatar
dom
Well known member
Posts: 1194
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

I think these days it doesn't matter too much which library is used - most of the code is the same.

Since this thread was started, classic has changed a fair bit, pulling in quite a lot of newlib, so that only differences are:

* Classic supports many more targets and has different way of implementing the crt0 startup file
* Classic <stdio.h> is a different implementation that supports file io
* Classic supports multiple floating point libraries for pure sccz80 compilations
* Classic provides cross platform libraries for plotting etc
* Classic tends to be tuned at link time, newlib at library build time
WauloK
Member
Posts: 63
Joined: Thu Oct 10, 2019 10:45 am

Post by WauloK »

Thanks
bushy555
Member
Posts: 13
Joined: Tue Jul 16, 2013 9:31 am

Post by bushy555 »

Hi fella's

Thought you might like to see these two working examples of 1-bit tunes that I've managed to get working for the VZ.

Huby 1-bit engine and Phaser1, both an asm procedure being called from a C program compiled with Z88.
Phaser1 is also using Jason's FoxgloVZ font library. Its really only a proof of concept (is very noisey) but works.



https://youtu.be/4c2oAmSyFmw Huby.
https://youtu.be/D6sdfjPl-Fc Phaser1.

cheers
stefano
Well known member
Posts: 1534
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Interesting results, are you using bit_synth together with bit_fx?
If so you must be the first one :)
bushy555
Member
Posts: 13
Joined: Tue Jul 16, 2013 9:31 am

Post by bushy555 »

Hi Stefano,
Sorry, I should have been clearer.
The two fellow's that are big on the 1-bit scene (Utz and Shiru) now have numerous 1-bit engine player routines in assembly. Somewhere in the order of around 40... which would also include various other modified older engines with their take on them -- -some ripped over the years from very early ZX Spectrum games. I've been playing around with a lot of these over the past ~six months trying to get them working and sounding nice on both a VZ200 emulator and then on real hardware. Have around 26 working, with about ten sounding nice. Unfortunately there is very little in the way of lots of music tunes/songs since there really is a small audience to the whole concept.

With Waulok hinting at wanting to get seriously back into the VZ scene and write a decent game, I thought I'd attempt to start on the learning curve journey to attempt to get these asm players working from a routine that is simply called from, say, main.c and have Z88 compile the lot. A lot of thanks must go to a ZX fellow's blog ( that I randomly found) whom has already done this with about six engines, compiled from Z88 for the ZX Sectrum. However, yes, it is most likley a first though for the VZ.

Unfortunately, and funny enough, Tritone and BeepFX are two of the ~15 players that I can not get to work on the VZ. Many of the players engines and song data are directly linked to the ZX's sound output of bit 4, whereas the VZ utilises bits 0 and 5. I can only do so much with my limited knowledge.

Utz's asm player listings are here : https://github.com/utz82/ZX-Spectrum-1-Bit-Routines

I'm sure that these could easily be integrated into a lot of the other platforms that do support 1-bit sound/music , perhaps even without the need for the new library? Or, somehow add these into with the new library with the same concept as how tritone and beepfx are integrated.

One engine in particular, taken from a Russian author back in the early 1980's, sounds the most clearest and crisp on the VZ (although not quite 100%!), after doing a very simple swap from the ZX 'out $fe,a' opcodes to the VZ's 'ld ($6800), a' latch memory segment. I haven't tried to call this from a C program yet; but will certainly try it. Trantor in the VZ emulator : http://www.youtube.com/watch?v=faSjX_ra6q8

Cheers.
WauloK
Member
Posts: 63
Joined: Thu Oct 10, 2019 10:45 am

Post by WauloK »

If I have tritone data in a .asm file, how do I make this available to my Z88DK c code via a pointer and call the player?
WauloK
Member
Posts: 63
Joined: Thu Oct 10, 2019 10:45 am

Post by WauloK »

figured it out
Post Reply