Help with getting RomWBW to recognise sound cards and 'tune.com'

393 views
Skip to first unread message

Gary Hammond

unread,
Aug 13, 2021, 3:56:42 AM8/13/21
to RC2014-Z80
Hi,
I have built the LiNC Ay/YM sound card and configured it for port D8. Using the example BASIC code at the Github page for the card, I can get the card to play music fine so I know the card is working. I used port D8 as it seems to be the port that the sound card driver is looking for (see below)

I have built a custom image for the sound card and I don't seem to be able to get RomWBW 3v3.1.1-pre.101 to recognise the card. The output from the start up message is:

RomWBW HBIOS v3.1.1-pre.101, 2021-08-13

RC2014 Z80 @ 14.745MHz
0 MEM W/S, 1 I/O W/S, INT MODE 1, Z2 MMU
512KB ROM, 512KB RAM
ROM VERIFY: 00 00 00 00 PASS

AY: IO=0xD8 NOT PRESENT
ACIA0: IO=0x80 ACIA MODE=115200,8,N,1
MD: UNITS=2 ROMDISK=384KB RAMDISK=256KB
IDE: IO=0x10 MODE=RC
IDE0: 8-BIT LBA BLOCKS=0x0001E900 SIZE=61MB
IDE1: NO MEDIA


I have added the following 3 lines to my custom config file:

AY38910ENABLE    .SET    TRUE        ; AY: AY-3-8910 / YM2149 SOUND DRIVER
AY_CLK        .SET    CPUOSC / 4    ; DEFAULT TO CPUOSC / 4
AYMODE        .SET    AYMODE_RCZ80    ; AY: DRIVER MODE: AYMODE_[SCG/N8/RCZ80/RCZ180]

Have I missed some other setting that needs to be changed/added?
Is it possible to specify the sound card IO port address?

When I run 'tune.com' I get the following:

Tune Player for RomWBW v3.2, 03-Sep-2020

Hardware error, sound chip not detected!

I am not expecting tune.com to work until at least the card is recognised at boot.

On a separate note, I have also built up an SN76489 sound card (J B Langston) and RomWBW doesn't recognise that either. I haven't validated that this card is OK but now that I know there is a problem with the LiNC Ay/YM sound card not being recognised, I will find a way to validate the SN76489 sound card operation via a different mechanism.

Any help or pointers appreciated.

BTW, I am using the AY sound card (Z50Bus) in an SC109 Z50Bus to RC80 bus back-plane connected to an SC112 back-plane. The Z80 is clocked at 14.745MHz but I have also tried getting the card to work with the system running at 7.372MHz.

Also a big plug here for the dtronixs CPU card. I can flick between the 7.372MHz bus CLK, 14.745MHz crystal and 20.000MHz oscillator with the change of a jumper. And it has a rock solid reset circuit on it.

Phillip Summers

unread,
Aug 13, 2021, 7:57:27 AM8/13/21
to RC2014-Z80
hi,

regarding your ay issues

when you select AYMODE_RCZ80 mode, the driver expect the "register select" port on d8 and "register data" port on d0

reading the the linc80 page, it appears when you set d8 it is setting "register select" port on d8 and "register data" port on d9

to match your hardware try changing the aymode_rcz80 section of the ay38910.asm driver to

ay_rsel .equ $d8
ayrdat .equ $d9
ay_rin .equ ay_rsel

i would expect that 14Mhz is too fast so would try at lower speeds first.

hope that helps.

Wayne Warthen

unread,
Aug 13, 2021, 1:20:54 PM8/13/21
to RC2014-Z80
As fate would have it, I am in the process of adding support for the Linc Z50AYMSound Card.  So, I am happy to look at supporting other cards at this time.

First of all, Phil's comments are exactly right.  The default sound card support for RCZ80 is for the official RC2014 sound card which places the ports at 0xD0 (data) and 0xD8 (select).

On Friday, August 13, 2021 at 12:56:42 AM UTC-7 gfha...@gmail.com wrote:
I have built the LiNC Ay/YM sound card and configured it for port D8. Using the example BASIC code at the Github page for the card, I can get the card to play music fine so I know the card is working. I used port D8 as it seems to be the port that the sound card driver is looking for (see below)

The 0xD8 below refers to the data port.  As mentioned above, the select port is assumed to be at 0xD0 for the standard RC2014 sound card.  Based on Phil's comments, there is still a port mismatch (for at least one of the ports, maybe both).

I am not expecting tune.com to work until at least the card is recognised at boot.

The TUNE application has it's own sound card hardware detection mechanism.  It is table driven and probes for the sound card at typical locations.  I just need to add the LiNC card's ports to a table.  So, this is a different code change, but similar in concept to the OS.

I am under the impression that the default port addresses for the LiNC card are 0x32 (data) and 0x33 (select).  I was planning to use these port addresses when I add support for the LiNC sound card.  Will this work for you?

On a separate note, I have also built up an SN76489 sound card (J B Langston) and RomWBW doesn't recognise that either. I haven't validated that this card is OK but now that I know there is a problem with the LiNC Ay/YM sound card not being recognised, I will find a way to validate the SN76489 sound card operation via a different mechanism.

The J B Langston sound card is a bit different as it is based on the SN76489.  RomWBW has support for it, but you will need to enable support for this card in the RomWBW config.  In your config file, you will need to add:

SN76489ENABLE .SET TRUE

BTW, I am using the AY sound card (Z50Bus) in an SC109 Z50Bus to RC80 bus back-plane connected to an SC112 back-plane. The Z80 is clocked at 14.745MHz but I have also tried getting the card to work with the system running at 7.372MHz. 

Also a big plug here for the dtronixs CPU card. I can flick between the 7.372MHz bus CLK, 14.745MHz crystal and 20.000MHz oscillator with the change of a jumper. And it has a rock solid reset circuit on it.

So, this can all work (in theory), but I am a little confused.  The SC109 is a Z180 CPU board.  However, your boot messages from RomWBW seem to indicate you are running a Z80 CPU.  I guess the boot messages are from the DTRONIXS CPU board?  Couple things.  With the Z180, I/O wait states can be added on-the-fly.  So, the Z180 can run at 18 MHz and still be compatible with the sound card.  With the Z80, you will need to keep the CPU clock low enough that the sound card can handle it (as Phil pointed out).  The standard 7.372MHz should be OK.  Using a cross-connected backplane can add noise to the bus and cause some issues.

Thanks,

Wayne

 

Gary Hammond

unread,
Aug 13, 2021, 4:38:42 PM8/13/21
to RC2014-Z80
Thanks for the quick responses and suggestions. I have reset the IO address back to the default 0x32.

I have made the change to the ay38910.asm file. The changes need to go in the #AYMODE area as per the mode chosen in the the config file which in my case is RCZ80.
#IF (AYMODE == AYMODE_RCZ80)
;AY_RSEL        .EQU    $D8
;AY_RDAT        .EQU    $D0
;AY_RIN        .EQU    AY_RSEL+AY_RCSND
AY_RSEL        .EQU    $32
AY_RDAT        .EQU    $33
AY_RIN        .EQU    AY_RSEL
#ENDIF


My config file has:
AY38910ENABLE    .SET    TRUE        ; AY: AY-3-8910 / YM2149 SOUND DRIVER
AY_CLK        .SET    CPUOSC / 4    ; DEFAULT TO CPUOSC / 4
AYMODE        .SET    AYMODE_RCZ80    ; AY: DRIVER MODE: AYMODE_[SCG/N8/RCZ80/RCZ180]


Processor clock has been set back to 7.372MHz and the boot message says:
RomWBW HBIOS v3.1.1-pre.101, 2021-08-14

RC2014 Z80 @ 7.372MHz

0 MEM W/S, 1 I/O W/S, INT MODE 1, Z2 MMU
512KB ROM, 512KB RAM
ROM VERIFY: 00 00 00 00 PASS

AY: IO=0x32 NOT PRESENT

So I have correctly changed the IO address but it is still not being recognised.
I have changed the IO addresses on the card and have been using the following sample BASIC program to check my IO address settings are working.
1 REM Output ascending and descending "siren" using all three channels
2 REM Addresses 0x32 (data) and 0x33 (register) = 50, 51 decimal:
3 REM Mixer value for A+B+C Tone, no Noise, IO as OUT = 248 decimal/0xFE hex
10 R=51
20 D=50
30 OUT R,  7
40 OUT D,248
41 OUT R,  8
42 OUT D, 15
43 OUT R,  9
44 OUT D, 15
45 OUT R, 10
46 OUT D, 15
50 FOR N = 32 TO 250
55 M = 251 - N
56 O = ABS(M-N)
60 OUT R,  0
61 OUT D,  N
62 OUT R,  2
63 OUT D,  M
64 OUT R,  4
65 OUT D,  O
70 GOSUB 200
80 NEXT
90 GOTO 50
200 FOR X=1 TO 64
210 NEXT
220 RETURN


When running the BASIC program, I get the stereo siren sound all ok. BTW, the only difference between 7, 14 and 20MHz clock speeds is how fast the siren ramps up and down. The sounds pitch remains the same.

My test system is a Frankenstein of various parts. From left to right it is an SC109 back-plane plugged in to an SC112 back-plane.
The cards from left to right are:
Z50Bus - Empty
Z50Bus - LiNC sound card
RC80   - MG001 7 seg display module
RC80   - Rotten Snow missing link module (serial and CF)
RC80   - SC129 Digital IO
--------
RC80   - SC137 I2C bus master (for LCD)
RC80   - Rotten Snow RAM/ROM module
RC80   - Empty
RC80   - Dtronixs Z80 CPU module
RC80   - Empty
RC80   - Empty

20210814_065258 (2).jpg
*Note: The photo has the original IO settings on the LiNC sound card. They are now set to:
A7 - Off
A6 - Off
A5 - On
A4 - On
A3 - Off
A2 - Off
A1 - On
A0 - Off

The system is powered from a high power USB hub that has dedicated 2.1A power only outlets. When I first started experimenting with different clock speeds, I had no end of problems due to powering via the 5V from the FTDI adapter which I soon learnt was a BAD idea!

The board with the LED's in the background is a little comms breakout board in made up which enables at a glance to see whats happening on the coms port and has a jumper for easy enable/disable 5V to the system. Gotta have blinkenlights. ;)

If anyone wants the STL files for the SC109 and SC112 back-plane bases to 3D print their own, let me know.

Wayne Warthen

unread,
Aug 13, 2021, 5:29:45 PM8/13/21
to RC2014-Z80
On Friday, August 13, 2021 at 1:38:42 PM UTC-7 gfha...@gmail.com wrote:
I have made the change to the ay38910.asm file. The changes need to go in the #AYMODE area as per the mode chosen in the the config file which in my case is RCZ80.
#IF (AYMODE == AYMODE_RCZ80)
;AY_RSEL        .EQU    $D8
;AY_RDAT        .EQU    $D0
;AY_RIN        .EQU    AY_RSEL+AY_RCSND
AY_RSEL        .EQU    $32
AY_RDAT        .EQU    $33
AY_RIN        .EQU    AY_RSEL
#ENDIF

If I understand the board correctly, I think AY_RIN should be set to AY_DAT, not AY_RSEL. 

The hardware detection algorithm depends on the ability to read register data back which probably doesn't work with these settings.

Your test program does not need to read registers, so that would explain why it works, yet the hardware is still undetected at this point.

-Wayne

Gary Hammond

unread,
Aug 13, 2021, 6:40:42 PM8/13/21
to RC2014-Z80
Success!
I now get an ~1 sec beep on boot and the boot message is:
RomWBW HBIOS v3.1.1-pre.101, 2021-08-14

RC2014 Z80 @ 7.372MHz
0 MEM W/S, 1 I/O W/S, INT MODE 1, Z2 MMU
512KB ROM, 512KB RAM
ROM VERIFY: 00 00 00 00 PASS

AY: IO=0x33

I did have to invert the ports though after including your suggested change for AY_RIN. My settings are:
AY_RSEL        .EQU    $33
AY_RDAT        .EQU    $32
AY_RIN        .EQU    AY_RDAT

I have confirmed that it also works at 14MHz (I get the startup beep) but does NOT work at 20MHz.

Tune doesn't recognise the card though and I still get the 'Hardware error, sound chip not detected!' message.
Cheers,
Gary


Gary Hammond

unread,
Aug 13, 2021, 7:03:48 PM8/13/21
to RC2014-Z80
Success with tunes.com!

I modified the config table entry in tunes.asm as follows:
;    .DB    $07,    $D1,    $D0,    $D0,    $FF,    $FF    ; RCZ80 W/ RC SOUND MODULE (MF)
;    .DW    HWSTR_RCMF
    .DB    $07,    $33,    $32,    $32,    $FF,    $FF    ; RCZ80 W/ RC SOUND MODULE (MF)
    .DW    HWSTR_RCMF


Now I get to explore some 80's music files.
Cheers,
Gary

PS. I tried the original tune.com with the IO port set to D0 and it works fine.

Wayne Warthen

unread,
Aug 13, 2021, 7:55:31 PM8/13/21
to RC2014-Z80
This is great Gary.

The TUNE application will be updated in my next check-in so it should automatically find the card (using your tested parameters).

Thanks,

Wayne

Wayne Warthen

unread,
Aug 14, 2021, 5:36:48 PM8/14/21
to RC2014-Z80
OK, I have checked in the changes to RomWBW (dev branch) to support the LiNC sound card.  This includes both the HBIOS driver as well as the TUNE application.

Thanks,

Wayne

Gary Hammond

unread,
Aug 15, 2021, 2:33:44 AM8/15/21
to RC2014-Z80
Hi Wayne,
I have cloned to the tip of dev, copied my config files across and built a new ROM. The only change I needed to make was to change the AYMODE to AYMODE_LINC. I have left the IO settings for the card at the defaults of 0x32 and 0x33.

Confirmed the card is detected at boot and I get the beep.
Confirmed that 'TUNE' detects the card with the default IO settings plays all ok.
(This is with a 14MHz clock on a Z80)

Thanks and cheers,
Gary

Wayne Warthen

unread,
Aug 15, 2021, 7:31:14 PM8/15/21
to RC2014-Z80
On Saturday, August 14, 2021 at 11:33:44 PM UTC-7 gfha...@gmail.com wrote:
Hi Wayne,
I have cloned to the tip of dev, copied my config files across and built a new ROM. The only change I needed to make was to change the AYMODE to AYMODE_LINC. I have left the IO settings for the card at the defaults of 0x32 and 0x33.

Confirmed the card is detected at boot and I get the beep.
Confirmed that 'TUNE' detects the card with the default IO settings plays all ok.
(This is with a 14MHz clock on a Z80)

Very good.  Thanks for letting me know.

-Wayne 

Gary Hammond

unread,
Aug 17, 2021, 5:47:40 AM8/17/21
to RC2014-Z80
I now have the SN76489 working with HBIOS and tune. It took me a little while to figure out that one of the SN76489 chips wasn't seated properly and that I needed the --hbios option in tune.

To get it to work with the default settings as described at JB Langs github project https://github.com/jblang/SN76489, I needed to modify sn76489.asm.
;SN76489_PORT_LEFT    .EQU    $FC    ; PORTS FOR ACCESSING THE SN76489 CHIP (LEFT)
;SN76489_PORT_RIGHT    .EQU    $F8    ; PORTS FOR ACCESSING THE SN76489 CHIP (RIGHT)
SN76489_PORT_LEFT    .EQU    $FF    ; PORTS FOR ACCESSING THE SN76489 CHIP (LEFT)
SN76489_PORT_RIGHT    .EQU    $FB    ; PORTS FOR ACCESSING THE SN76489 CHIP (RIGHT)


BTW, when the song has finished playing, the last note played is not cancelled/muted.
Cheers,
Gary

Wayne Warthen

unread,
Aug 17, 2021, 3:05:31 PM8/17/21
to RC2014-Z80
Hi Gary,

On Tuesday, August 17, 2021 at 2:47:40 AM UTC-7 gfha...@gmail.com wrote:
I now have the SN76489 working with HBIOS and tune. It took me a little while to figure out that one of the SN76489 chips wasn't seated properly and that I needed the --hbios option in tune.

Glad to hear it is all working.  Yeah, I am trying to catch up on documentation and the --hbios option in TUNE is a bit hidden right now.  Glad you found it.  Frankly, it amazes me that playing sound through the HBIOS interface works at all.  There is a lot of overhead in the HBIOS calls.  Dean Netherton and Phil Summers did some good work on this.

To get it to work with the default settings as described at JB Langs github project https://github.com/jblang/SN76489, I needed to modify sn76489.asm.
;SN76489_PORT_LEFT    .EQU    $FC    ; PORTS FOR ACCESSING THE SN76489 CHIP (LEFT)
;SN76489_PORT_RIGHT    .EQU    $F8    ; PORTS FOR ACCESSING THE SN76489 CHIP (RIGHT)
SN76489_PORT_LEFT    .EQU    $FF    ; PORTS FOR ACCESSING THE SN76489 CHIP (LEFT)
SN76489_PORT_RIGHT    .EQU    $FB    ; PORTS FOR ACCESSING THE SN76489 CHIP (RIGHT)

I'm surprised that RomWBW seems to have the wrong ports.  It should use the defaults as you suggest.  I am going to see if I can figure out what happened here.  Most likely, I will adopt your port changes.
 
BTW, when the song has finished playing, the last note played is not cancelled/muted.

Well, that is undesirable.  I will take a look.

-Wayne 

Wayne Warthen

unread,
Aug 17, 2021, 4:18:03 PM8/17/21
to RC2014-Z80
On Tuesday, August 17, 2021 at 12:05:31 PM UTC-7 Wayne Warthen wrote:

To get it to work with the default settings as described at JB Langs github project https://github.com/jblang/SN76489, I needed to modify sn76489.asm.
;SN76489_PORT_LEFT    .EQU    $FC    ; PORTS FOR ACCESSING THE SN76489 CHIP (LEFT)
;SN76489_PORT_RIGHT    .EQU    $F8    ; PORTS FOR ACCESSING THE SN76489 CHIP (RIGHT)
SN76489_PORT_LEFT    .EQU    $FF    ; PORTS FOR ACCESSING THE SN76489 CHIP (LEFT)
SN76489_PORT_RIGHT    .EQU    $FB    ; PORTS FOR ACCESSING THE SN76489 CHIP (RIGHT)

I'm surprised that RomWBW seems to have the wrong ports.  It should use the defaults as you suggest.  I am going to see if I can figure out what happened here.  Most likely, I will adopt your port changes.

Well, I have a Rev. 1 card.  It appears that this card does not provide the same port address resolution as the current cards and so it allowed a range of possible addresses.  From what I can tell, you are correct about the proper addresses.  The proper addresses work just fine on my card, so I will make this change in the source.

BTW, when the song has finished playing, the last note played is not cancelled/muted.

Well, that is undesirable.  I will take a look.

Yeah, it looks like this happens when playing via HBIOS.  Should be easy to fix.  Although I see the problem in the source, I have been unable to replicate the problem in real life.  I want to be able to test my changes.  Can you tell me what tune file you used to demonstrate the issue?  Also, did you let it play to the end or did you abort it prior to the end?

Thanks,

Wayne 

Gary Hammond

unread,
Aug 17, 2021, 7:00:52 PM8/17/21
to RC2014-Z80
Hi Wayne,

On Wednesday, August 18, 2021 at 8:18:03 AM UTC+12 wwar...@gmail.com wrote:

Yeah, it looks like this happens when playing via HBIOS.  Should be easy to fix.  Although I see the problem in the source, I have been unable to replicate the problem in real life.  I want to be able to test my changes.  Can you tell me what tune file you used to demonstrate the issue?  Also, did you let it play to the end or did you abort it prior to the end?

If you abort the tune then the last note continues to play, but I would expect this to be the case as there would be no chance for tune to perform tidy up tasks.
So far, the only tune that it is reproducible with ease is sanxion.pt3.
 

Thanks,

Wayne 
Cheers,
Gary

Wayne Warthen

unread,
Aug 17, 2021, 7:35:20 PM8/17/21
to RC2014-Z80
On Tuesday, August 17, 2021 at 4:00:52 PM UTC-7 gfha...@gmail.com wrote:
If you abort the tune then the last note continues to play, but I would expect this to be the case as there would be no chance for tune to perform tidy up tasks.
So far, the only tune that it is reproducible with ease is sanxion.pt3.

Thanks Gary.  As far as I can tell from my testing, it is fixed in the latest check-in.  The fix was in the TUNE.COM application itself.

-Wayne 

Augusto Baffa

unread,
Dec 7, 2022, 5:01:03 PM12/7/22
to RC2014-Z80
Hi, 
  does tune have support to SN76489 or it's still under developement?
   Is it possible to also support VGM format? (like vgmplayer that uses both ay-3-8910 and  SN76489)

best,

Augusto Baffa

Wayne Warthen

unread,
Dec 8, 2022, 2:11:45 PM12/8/22
to RC2014-Z80
Hi Augusto,


Thanks,

Wayne

On Wednesday, December 7, 2022 at 2:01:03 PM UTC-8 augb...@gmail.com wrote:
Hi, 
  does tune have support to SN76489 or it's still under developement?

In short, yes, but I need to explain a bit.  The TUNE app has native hardware support for the AY-3-8910 only.  It will find the AY-3-8910 hardware and play tune files on it regardless of whether RomWBW HBIOS knows about it.  However, the TUNE app has an alternative way to play tune files -- it can play them via the RomWBW HBIOS.  RomWBW HBIOS has drivers for the AY-3-8910 and the SN76489.  So, IF you have your RomWBW built with support for your SN76489, you can use TUNE on that chip.  To determine if you have support for the SN76489 in your RomWBW build, you can look at the boot messages for a reference to SN76489.  For example:

SN76489: LEFT IO=0xFF, RIGHT IO=0xFB

You can build a custom ROM if needed to add this support.  To use TUNE with HBIOS, you add the "--HBIOS" switch on the command line.  For example:

TUNE BADMICE.PT3 --HBIOS

All of this will require use of the current development branch of RomWBW.
 
   Is it possible to also support VGM format? (like vgmplayer that uses both ay-3-8910 and  SN76489)

Adding VGM support to the TUNE app is a long-term goal, but that work is not yet in progress.  Phil Summers has a port of VGMPLAY in the development branch of RomWBW.  It works, but would need to be custom built for the RC2014 environment.  I got it to work, but had to tweak some stuff to get it to build.

Thanks,

Wayne

Phillip Summers

unread,
Dec 8, 2022, 4:46:32 PM12/8/22
to RC2014-Z80
Hi Augusto,

Wayne is right, the vgmplayer in romwbw is not very refined.

I could do some more work on it.

If you send me your processor speed and your port addresses for your 76489 and ay38910 I can build and share a copy for you to try.

Best wishes Phil
Reply all
Reply to author
Forward
0 new messages