|
1 | | -# reSID |
| 1 | +# winreSID |
2 | 2 |
|
3 | 3 | ## MOS 6581 / 8580 SID software emulation |
4 | 4 |
|
5 | | -This repository is intended to become the official source for the |
6 | | -reSID MOS6581 / MOS8580 SID emulator. However for now, I recommend |
7 | | -fetching reSID from [VICE](https://vice-emu.sourceforge.io/) :-) |
8 | | - |
9 | | -reSID is widely used in two different incarnations - reSID 0.16, which |
10 | | -was released in 2004, and a reSID 1.0 prerelease, which was included |
11 | | -in VICE in 2010 - 2011, and has been patched by others since |
12 | | -then. Unfortunately I never got around to make an official reSID 1.0 |
13 | | -release. |
14 | | - |
15 | | -I put in a lot of work to further reverse engineer the SID chip and |
16 | | -advance the state of the art of SID emulation in 2010 - 2011. This |
17 | | -work was in large part based on [SID die |
18 | | -shots](https://retronn.de/imports/commodore_chips.html), photographed |
19 | | -and stitched by Michael Huth, and revectorized and annotated by Tommi |
20 | | -Lempinen, with some further analysis by Frank Wolf. Several |
21 | | -improvements were made in the digital domain, however the major |
22 | | -achievement was vastly more accurate emulation in the analog domain by |
23 | | -simulation of the actual analog circuits, using detailed models of |
24 | | -DACs, VCRs, and op-amps. Op-amp transfer functions were obtained by |
25 | | -feeding and measuring voltages directly on SID filter capacitor pins |
26 | | -(with capacitors removed). |
27 | | - |
28 | | -A few years later, in 2016, Leandro Nini (drfiemost) started the |
29 | | -thread ["Understanding the SID"](http://forum.6502.org/viewtopic.php?f=8&t=4150) |
30 | | -on [forum.6502.org](http://forum.6502.org). The goal was to do a |
31 | | -*complete* reverse engineering of the SID chip, based on the same die |
32 | | -shots I had worked with earlier. Dieter Mueller (ttlworks) was a major |
33 | | -contributor to the reverse engineering effort. Leandro Nini's and |
34 | | -Dieter Mueller's work resulted in detailed |
35 | | -[SID internals documentation](https://sourceforge.net/p/sidplay-residfp/wiki/SID%20internals/) |
36 | | -and transistor level |
37 | | -[SID schematics](https://github.com/libsidplayfp/SID_schematics). |
38 | | -Leandro Nini even went as far as to create a complete transistor level |
39 | | -simulation of the digital parts of the SID chip called |
40 | | -[perfect6581](https://github.com/libsidplayfp/perfect6581), |
41 | | -based on |
42 | | -[perfect6502](https://github.com/mist64/perfect6502). |
43 | | - |
44 | | -In this repository I am going to pick up from where I left some ten |
45 | | -years ago, cherry picking from the reverse engineering mentioned |
46 | | -above, patches in VICE, and my own research, with the goal of making |
47 | | -reSID even better. |
48 | | - |
49 | | -I also plan to use a refined reSID as the basis for an FPGA Verilog |
50 | | -implementation for my take on a hardware SID replacement, the [reDIP |
51 | | -SID](https://github.com/daglem/reDIP-SID). |
| 5 | +This repository is a fork of the venerable reSID MOS6581 / MOS8580 |
| 6 | +SID emulator by Dag Lem, widely used in different incarnations. |
| 7 | + |
| 8 | +## Windows library |
| 9 | + |
| 10 | +winreSID adds a simple C wrapper interface around reSID (C++) that |
| 11 | +makes it possible to conveniently use it in different emulators and |
| 12 | +applications as an optional DLL add-on. |
| 13 | + |
| 14 | +## Interface |
| 15 | + |
| 16 | +### sidCreate(unsigned int clock_type, unsigned int model, unsigned int replayFreq) |
| 17 | + |
| 18 | +Create a SID instance with given clock_type (master clock frequency), model and |
| 19 | +replay frequency. |
| 20 | + |
| 21 | +### sidDestroy() |
| 22 | + |
| 23 | +Destroy the SID instance |
| 24 | + |
| 25 | +### sidSetSampleRate(unsigned int sampleRate_) |
| 26 | + |
| 27 | +Change replay frequency to sampleRate_. Note, this is the sound replay frequency of |
| 28 | +the host application. |
| 29 | + |
| 30 | +### sidSetModel(unsigned int model) |
| 31 | + |
| 32 | +Set SID model to either 6581 (=0) or 8580 (!=0). |
| 33 | + |
| 34 | +### sidReset() |
| 35 | + |
| 36 | +Resets the SID. |
| 37 | +### sidPause() |
| 38 | + |
| 39 | +Pause the engine |
| 40 | + |
| 41 | +### sidWriteReg(unsigned int reg, unsigned char value) |
| 42 | + |
| 43 | +Write 'value' to the SID register 'reg'. |
| 44 | + |
| 45 | +### unsigned char sidReadReg(unsigned int reg) |
| 46 | + |
| 47 | +Read SID register 'reg'. Note, some SID registers are write-only. |
| 48 | +The A/D ports are not implemented. |
| 49 | + |
| 50 | +### sidCalcSamples(short* buf, long count) |
| 51 | + |
| 52 | +Render 'count' samples to the sound buffer provided. |
| 53 | + |
| 54 | +### short sidCalcSample() |
| 55 | + |
| 56 | +Clock the SID engine and return one SID sound sample with the original SID frequency. |
| 57 | + |
| 58 | +### sidSetAmp(unsigned int amp) |
| 59 | + |
| 60 | +Set the amplification. Original SID output will be right shifted by this amount. |
| 61 | + |
| 62 | +### const char* sidGetLibVersion() |
| 63 | + |
| 64 | +Get the reSID library version string. |
| 65 | + |
| 66 | +## Future plans |
| 67 | + |
| 68 | +Plans include: |
| 69 | +- implement support for multiple instances |
| 70 | +- make it work as a Linux library |
| 71 | +- add proper library support for cycle based rendering into a buffer |
0 commit comments