Controlling the TT sound system.

News,announcements,programming,fixes,game patches & discussions.

Moderator: troed

Post Reply
User avatar
stephen_usher
Posts: 5580
Joined: Mon Nov 13, 2017 7:19 pm
Location: Oxford, UK.
Contact:

Controlling the TT sound system.

Post by stephen_usher »

I'm currently writing a game menu program to sit in the AUTO folder which will then list the available games allow a user to select and run them.

I've got the basics working but because it runs before the sound control panel has started the sound defaults to maximum volume with the internal speaker turned on.

What I would like to do is allow the program's configuration file to contain the default volume and whether the internal speaker is enabled.

I think I can probably work out how to use the Microwire interface to control the volume from C but I've found no documentation about how to control the internal speaker. The Atari TT release notes don't mention it and merely say that the DMA sound system is the same as the STe's. I'm guessing that it would be the same on the Mega STe.

Does anyone know?
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Posts: 5580
Joined: Mon Nov 13, 2017 7:19 pm
Location: Oxford, UK.
Contact:

Re: Controlling the TT sound system.

Post by stephen_usher »

Someone on the Atari Forum pointed me at the XCONTROL.ACC source file 'block2.c' which uses the following to control the TT speaker:
void
Set_Speaker( void )
{
if( IsSpeaker() )
{
if( cur_value.TT_Speaker )
Offgibit( 0xBf ); /* Turn off Speaker */
else
Ongibit( 0x40 ); /* Turn on Speaker */

}
}
Now, I've put this in my code and it makes not a darned bit of difference, as you can see here with my broken for some reason volume setting code...
#include <osbind.h>
#include <string.h>

#define MICROWIRE_DATA_ADDR 0xff8922
#define MICROWIRE_MASK_ADDR 0xff8924

unsigned short *mw_mask = MICROWIRE_MASK_ADDR;
unsigned short *mw_data = MICROWIRE_DATA_ADDR;

unsigned short value;

void do_microwire();

void set_volume(int volume)
{
value = 0x0400 + volume;

Supexec(do_microwire);

return;
}

void do_microwire()
{
int i;
unsigned short mask = 0x07ff;

*mw_mask = mask;

while(*mw_mask != mask) i++;

*mw_data = value;
}

void set_speaker(int onoff)
{
if (onoff == 0)
Offgibit(0x8f);
else
Ongibit(0x40);

return;
}
What fun the STe/TT sound system is, not!

P.S. I think I've seen why my volume setting might be broken, I should use 0x04c0 rather than 0x0400 to add to the volume level (0 -> 40).
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Posts: 5580
Joined: Mon Nov 13, 2017 7:19 pm
Location: Oxford, UK.
Contact:

Re: Controlling the TT sound system.

Post by stephen_usher »

Doh! I've just re-read the TT Release Notes again and found what it says is the speaker on/off:
PROGRAMMABLE SOUND GENERATOR
(also provides bi-directional parallel printer port and miscellaneous output latch)
8800 RO xxxx xxxx ---- ---- PSG Read Data
8800 WO 0000 0000 ---- ---- PSG Register Select
8802 WO xxxx xxxx ---- ---- PSG Write Data
Port A Bit Assignments
7 *LAN Select (0 routes SCC Port A to LAN connector)
6 *Speaker Disable (0 disables internal speaker)
5 Printer Port Strobe
4 *DTR (MFP-ST serial port)
3 *RTS (MFP-ST serial port)
2 *Floppy 1 Select
1 *Floppy 0 Select
0 *Floppy Side 0 Select
I'm guessing that the '*' means TT only, but that doesn't fit with the bits 0-3 definitions.

Still Ongibit(6) and Offgibit(6) still don't do anything for the speaker.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Posts: 5580
Joined: Mon Nov 13, 2017 7:19 pm
Location: Oxford, UK.
Contact:

Re: Controlling the TT sound system.

Post by stephen_usher »

Oh well, it turns out Ongibit(0x40) was working to turn off the speaker but the game I was testing all the time, "Bubble Bobble" (or the hard disk loader) seems to reset the PSG Port A for some unknown reason.

I only found this out after trying many things including upgrading mintlibs to patchlevel 46 from 44, making sure that the argument passed was an unsigned short etc.

I'd given up and moved onto the machine detection part. Then I tried "Chaos Engine" and amazingly there was no sound from the speaker!

So, the final job will be turning off the CPU caches if the machine is a TT.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Posts: 5580
Joined: Mon Nov 13, 2017 7:19 pm
Location: Oxford, UK.
Contact:

Re: Controlling the TT sound system.

Post by stephen_usher »

Just in case you're interested I've finished my game menu program and you can download it here:

http://www.lingula.org.uk/~steve/downlo ... enu.tar.gz
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Posts: 5580
Joined: Mon Nov 13, 2017 7:19 pm
Location: Oxford, UK.
Contact:

Re: Controlling the TT sound system.

Post by stephen_usher »

Darn! The board won't allow the attachment of *.zoo files. So, here's a link to the binary download...

http://www.lingula.org.uk/~steve/downloads/gamemenu.zoo
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Posts: 5580
Joined: Mon Nov 13, 2017 7:19 pm
Location: Oxford, UK.
Contact:

Re: Controlling the TT sound system.

Post by stephen_usher »

ZOO is one of the old standard formats for the Atari, along with LHarc.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
exxos
Site Admin
Site Admin
Posts: 23499
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: Controlling the TT sound system.

Post by exxos »

I can't even remember last time I saw a zoo file. I never added it into the forum support list. Most users will download on PC first , so easier to use zip as easily supported on ST and PC IMO :)
https://www.exxosforum.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxosforum.co.uk/atari/store2/ - All my hardware mods for sale - Please help support by making a purchase.
viewtopic.php?f=17&t=1585 Have you done the Mandatory Fixes ?
Just because a lot of people agree on something, doesn't make it a fact. ~exxos ~
People should find solutions to problems, not find problems with solutions.
User avatar
stephen_usher
Posts: 5580
Joined: Mon Nov 13, 2017 7:19 pm
Location: Oxford, UK.
Contact:

Re: Controlling the TT sound system.

Post by stephen_usher »

exxos wrote: Tue May 29, 2018 7:31 pm I can't even remember last time I saw a zoo file. I never added it into the forum support list. Most users will download on PC first , so easier to use zip as easily supported on ST and PC IMO :)
I'm not sure I have something as modern as zip or unzip on any of my Ataris. :lol:

Hey! I'm still using GCC 2.5.8 and mintlib pl. 46 after all. :D
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
exxos
Site Admin
Site Admin
Posts: 23499
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: Controlling the TT sound system.

Post by exxos »

stephen_usher wrote: Tue May 29, 2018 7:38 pm I'm not sure I have something as modern as zip or unzip on any of my Ataris. :lol:
Easy to do ;)
https://www.exxosforum.co.uk/forum/viewt ... ?f=25&t=58
https://www.exxosforum.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxosforum.co.uk/atari/store2/ - All my hardware mods for sale - Please help support by making a purchase.
viewtopic.php?f=17&t=1585 Have you done the Mandatory Fixes ?
Just because a lot of people agree on something, doesn't make it a fact. ~exxos ~
People should find solutions to problems, not find problems with solutions.
Post Reply

Return to “SOFTWARE PROGRAMMING & DISCUSSION”