Dual SID on Replica 1.

13 posts / 0 new
Last post
Offline
Last seen: 2 years 9 months ago
Joined: Jan 5 2021 - 19:59
Posts: 8
Dual SID on Replica 1.
AttachmentSize
Image icon Capture.PNG775.02 KB

So I recently came up with a design that will allow for twin SID chips to work on the Replica 1.  I already have a single SID variant working.  The dual model still needs to be tested, however.  These cards allow for the SID chip(s) to be controlled via the WOZ monitor as well as Apple Basic.  It would be more useful if an external tracker could be used to write music.  I was wondering if someone with more software experience could tell me how difficult they think it would be to modify C64 tracker files to work on the memory addresses of the Apple 1.  the first SID occupies memory location $B000 and the second is on $8400.  I was wondering if it seemed feasible to create an automatic utility for converting the files.  I have some experience in software development, but my strenghts lie more in hardware.  

Offline
Last seen: 3 months 3 weeks ago
Joined: Apr 9 2021 - 04:31
Posts: 90
Converting the files ist not

Converting the files ist not the biggest problem the lake of CIA (timing) and IRQ is a problem.The Apple I is not even a VIC-20 it's even less. I would not say it's not doable but there is more to be done, to get the the .SID play routines working propperly even more in Stereo config.

Best you redesign your board to contain a CIA and a switchable 50/60 Hz clocksource.Here is a lik to some who already tried that: http://sampopeltonen.github.io/Vicious/

I think the bad Apple I design could be easily fixed to correctly decode the PIA and not to waste 4K $D000-$DFFF.

After doing this SID could be mapped to it's supposed location $D400-$D41F (SteroSid uses usually $D040-$D05F).

This will also give the oportunity to map the CIA to it's correct place: $DC00-$DCFF 

It's recommanded that you have atleast 8K and the second half not configured to $E000-$EFFF (Standard for Apple-1) better have a 16K or 32K mod or expansion.

So better to use a modern replica (like the Replica 1) than a 1:1 replica or even an Apple 1, because the have usually a Basic ROM and 32K RAM.

.SID files that use $C000-$CFFF need either memory at that location (no ACI!) or need to be relocated and sometime aditionally patched when the player has this location hardcoded.

Of cause you can do that without that but the result would be a quite useless card as only software you write yourself will be able to use the SIDs..SID files are not a fixed format the file can contain any C64 sond player combined with the actual song data, tha varies from .SID file to .SID file.In other words you can't just write a player.Sid Player on other platforms emulate a 6502, a CIA, one or more SIDs and execute the embedded player software.

For data transfer you can use the Jukebox or CFFA1 alternativly you create some tool for the Commodore C64 that creates apple compatible tape files.Alternatively you can do that on a PC with this tool: https://github.com/datajerk/c2t, you may need to remove the header.

  

Offline
Last seen: 2 years 9 months ago
Joined: Jan 5 2021 - 19:59
Posts: 8
Dual SID on Replica 1.

Thank you so much for the reply! I'll take a look at how the c64 implements the CIA in relation to the SID and see if i can implement it into the card.  The replica that I designed was based off the Rplica 1 so it also has 32k ram.

Offline
Last seen: 2 years 9 months ago
Joined: Jan 5 2021 - 19:59
Posts: 8
CIA

So, I was looking at the Commodore 64 schematic, and I'm not super knowledgeable of that system on a deep technical standpoint.  It seemed to me that from the schematic that the CIA doesn't directly connect to the SID. Is this accurate?  It looks like its IRQ line goes directly into the processor.  I guess my question is does it directly interact with the SID or is it its interaction with the other components what creates the desired timing?  Sorry if any of these questions sound dumb, I'm a recent grad who just started getting into pcb design and I've been wanting to learn more about these old machines.

Offline
Last seen: 3 months 3 weeks ago
Joined: Apr 9 2021 - 04:31
Posts: 90
Yes you analysis is correct.

Yes you analysis is correct. IRQ needs to go to the CPU. The CIA Complex Interface Adapter could theoretically also do the job of PIA Peripheral Interface Adapter as it is an enhanced version did not check how compatible the registers are.

Beside the PIA Part the CIA has timers and an timercontrolled interrupt generator.

The player routines usually run in an interupt routine so the sound is played in the background while the CPU is working on other things.

Apple I does not have hardware interrupts impemented at all, but the CPU Pins are availible on the I/O connector.

The Apple I is one of the most simple designs you can imagine.

It's Jut 4+4K RAM 256 Byte of ROM 6502 CPU and PIA with 1 Input port for Keyboard and one Output Port to TV Typewriter (40x24 textbuffer with autark display hardware)

While the C64 is quite complex the 64K RAM need to be multiplexed with 16K ROM and IO to get everything inside (total 84K RAM/ROM + 4K IO + 1K ColorRAM).

Don't forget the year that are between this systems.

Your man problem was (is?) you have been thinking .SID is something like .MOD from Amiga, but it's not.

A .SID ist not a standard it's more like .ogg a container it can hold any Player Routine and Song data, neither the Player nor the Songdata needs to follow a defined structure.

There fore the device that should play the .SID needs to be ablet to execute C64 6510 code, including IRQ routines.

Also the IRQ and CIA Timer needs to present or emulated.

The VIC-II is producing a blanking Interrupt of either 50 Hz PAL or 60 Hz NTSC this needs to be replicated, it can be derivated from AC frequency or selectable by any kind of 50/60 Hz generator.

If you keep your board as it is you can't play .SID files unless you figure out how the integrated player is working and create you own player that cares for the correct timing to pump the song data into the SID.

As more less each composer had his own player and data format, so this will be a tormendos task if you want to be compatible to a large number of existing .SIDs.

Most deices that use the SID chip to create music use MIDI instead. 

 

 

Offline
Last seen: 2 years 9 months ago
Joined: Jan 5 2021 - 19:59
Posts: 8
CIA

Thank you for all the great info.  If I want to create a consistent way of getting song files onto the Apple maybe the best way would be to focus on a format that is consistent like the output files from the Deflemask tracker or something similar.  Do you think if I implemented the timing hardware, there would be a way to convert tracker files to work on the system?

Offline
Last seen: 3 months 3 weeks ago
Joined: Apr 9 2021 - 04:31
Posts: 90
You could connect an arduino

You could connect an arduino to a C64 and dump all notes information that go to the SID.

So you will get a 100% playable file, you just need to playback the dump same speed.

Problem is this dump is a coupe of KB larger that the .SID as it's not a tracker and loops are flattend.

So if you can analyze the file and find loops you can compress it by saving each detected loop ones and repreat it as needed.

Or you find a way to convert the dump to DefleMask.

Another idea is to compress the dump on a PC let's say to ZIP and embedd the decompressor in the player.

Not sure what algo will be good and has a light wight uncompressor the 6502 can handle.

Offline
Last seen: 2 years 9 months ago
Joined: Jan 5 2021 - 19:59
Posts: 8
Timing.

Do you know of any good resources that explain the operation of the CIA and the timing used in the system?

Offline
Last seen: 3 months 3 weeks ago
Joined: Apr 9 2021 - 04:31
Posts: 90
Here is a german page with

Here is a german page with some kinks to english datasheets: https://www.c64-wiki.de/wiki/CIA

But I would look at some players what features they setup and use and only replicate that.

It should be possible with some mod to use a CIA in the PIA socket and use the Ports for Keyboard and Display and the Timers and IRQ for CPU and SID Player.

 

Offline
Last seen: 2 years 9 months ago
Joined: Jan 5 2021 - 19:59
Posts: 8
IRQ

Do you know if the IRQ would need to be supported by the WOZ monitor or Integer basic?  Or is it a hardware thing that wouldn't require rewriting those programs?

Offline
Last seen: 3 months 3 weeks ago
Joined: Apr 9 2021 - 04:31
Posts: 90
The ASM play routine is

The ASM play routine is interrupt driven and works in the background.

It need to be initialized and called by either WozMon or Basic.

Than you can do what ever you want like write a text on the screen play a game or what ever the left memory gives you as option.

Have a look here: https://www.youtube.com/watch?v=EZAcD8aXVm4

 

Offline
Last seen: 3 months 3 weeks ago
Joined: Apr 9 2021 - 04:31
Posts: 90
I remember that the .SID

I remember that the .SID files from contest that where printed in magazins as hex dump usually had the little missing part the interrupt routine also included you so could start them with one sys statement. Usually it was sys 49152.

Offline
Last seen: 2 years 9 months ago
Joined: Jan 5 2021 - 19:59
Posts: 8
Thank you

Thank you for the resources! I'll see what I can do with the info!

Log in or register to post comments