Audio-SID

 view release on metacpan or  search on metacpan

SID.pm  view on Meta::CPAN


The "real load address" indicates what is the actual Commodore-64 memory
location where the SID data is going to be loaded into. If I<loadAddress> is
non-zero, then I<loadAddress> is returned here, otherwise it's the first two
bytes of I<data> (read from there in little-endian format).

=item B<$OBJECT>->B<getSpeed>([SCALAR])

Returns the speed of the song number specified by SCALAR. If no SCALAR is
specified, returns the speed of song #1. Speed can be either 0 (indicating a
vertical blank interrupt (50Hz PAL, 60Hz NTSC)), or 1 (indicating CIA 1 timer
interrupt (default is 60Hz)).

For PlaySID specific files the corresponding bit of I<speed> from SCALAR modulo
32 is returned ("wraparound" behavior for songs > 32).

For all other files if SCALAR > 32, then bit #31 (MSB) of the I<speed> field is
returned ("pegged at 32" behavior for songs > 32).

=item B<$OBJECT>->B<getMUSPlayer>()

SID.pm  view on Meta::CPAN

and $OBJECT->I<write>() when either one of them is called without any
arguments. SCALAR can specify either a relative or an absolute pathname to the
file - in fact, it can be anything that can be passed to a B<FileHandle>
type object as a filename.

=item B<$OBJECT>->B<setSpeed>(SCALAR1, SCALAR2)

Changes the speed of the song number specified by SCALAR1 to that of SCALAR2.
SCALAR1 has to be more than 1 and less than the value of the I<songs> field.
SCALAR2 can be either 0 (indicating a vertical blank interrupt (50Hz PAL, 60Hz
NTSC)), or 1 (indicating CIA 1 timer interrupt (default is 60Hz)). An undef is
returned if neither was specified.

For PlaySID specific files if SCALAR1 is greater than 32, the SCALAR1 module 32
bit of the I<speed> field will be set, overwriting whatever value was in that
bit before ("wraparound" behavior for songs > 32).

For all other files if SCALAR1 is greater than 32, then bit #31 (MSB) of the
I<speed> flag will be set, overwriting whatever value was in that bit before
("pegged at 32" behavior for songs > 32).

SID_file_format.txt  view on Meta::CPAN

For version 2NG, 3 and 4 with PlaySID specific flag (+76) cleared, the 'speed'
should be handled as follows:

Each bit in 'speed' specifies the speed for the corresponding tune number,
i.e. bit 0 specifies the speed for tune 1. If there are more than 32 tunes,
the speed specified for tune 32 is also used for all higher numbered tunes.

For all version counts:

A 0 bit specifies vertical blank interrupt (50Hz PAL, 60Hz NTSC), and a 1 bit
specifies CIA 1 timer interrupt (default 60Hz).

Surplus bits in 'speed' should be set to 0.

For RSID files 'speed' must always be set to 0.

Note that if 'play' = 0, the bits in 'speed' should still be set for backwards
compatibility with older SID players. New SID players running in a C64
environment will ignore the speed bits in this case.

WARNING: This field does not work in PlaySID for Amiga like it was intended,

SID_file_format.txt  view on Meta::CPAN

  01 = PAL,
  10 = NTSC,
  11 = PAL and NTSC.

This is a v2NG specific field.

As can be seen from the 'speed' field, it is not possible to specify NTSC C64
playback. This is unfortunate, since the different clock speeds means that a
tune written for the NTSC C64 will be slightly detuned if played back on a PAL
C64. Furthermore, NTSC C64 tunes driven by a vertical blank interrupt have to
be converted to use the CIA 1 timer to fit into this scheme. This can cause
severe problems, as the NTSC refresh rate is once every 17045 cycles, while
the CIA 1 timer A is latched with 17095 cycles. Apart from the difference in
timing itself, the SID ADSR bugs can actually break the tune.

The 'clock' (video standard) field was introduced to circumvent this problem.

- Bits 4-5 specify the SID version (sidModel):
  00 = Unknown,
  01 = MOS6581,
  10 = MOS8580,
  11 = MOS6581 and MOS8580.

SID_file_format.txt  view on Meta::CPAN

Before the data of a SID file is loaded in memory of a C64, certain addresses
and chips must be initialized in order to play the SID tune correctly.

For RSID and PSID files the following address must be set for an emulated
environment:

$02A6 : depending on the PAL/NTSC flag in the SID file header, it is set to
        0x01 for PAL and set to 0x00 for NTSC.

On a real C64, when the speed flag is set to CIA, the value of $02A6 should be
read to setup the CIA timers accordingly (0x4025 for PAL and 0x4295 for NTSC).
When the speed flag is set to CIA, and a NTSC SID tune is played on a PAL
machine or a PAL SID tune is played on a NTSC machine, the player may set up a
CIA timer instead of VBI to run the tune at the correct speed.

The following CIA timer values can be used for:

NTSC tune on PAL machine: 0x3FFB (312 * 63 * 50 / 60 - 1)
PAL tune on NTSC machine: 0x5021 (263 * 65 * 60 / 50 - 1)

The default C64 environment for PSID files is as follows:

VIC           : IRQ set to any raster value less than 0x100. Enabled when
                speed flag is 0, otherwise disabled.
CIA 1 timer A : set to 60Hz (0x4025 for PAL and 0x4295 for NTSC) with the
                counter running. IRQs active when speed flag is 1, otherwise
                IRQs are disabled.
Other timers  : disabled and loaded with 0xFFFF.

When the init and play addresses are called the bank register value must be
written for every call and the value is calculated as follows:

if   address < $A000  -> 0x37 // I/O, Kernal-ROM, Basic-ROM 
else address < $D000  -> 0x36 // I/O, Kernal-ROM
else address >= $E000 -> 0x35 // I/O only
else                  -> 0x34 // RAM only

The default C64 environment for RSID files is as follows:

VIC           : IRQ set to raster 0x137, but not enabled.
CIA 1 timer A : set to 60Hz (0x4025 for PAL and 0x4295 for NTSC) with the
                counter running and IRQs active.
Other timers  : disabled and loaded with 0xFFFF.
Bank register : 0x37

A side effect of the bank register is that init MUST NOT be located under a
ROM/IO memory area (addresses $A000-$BFFF and $D000-$FFFF) or outside the
load image. Since every effort needs to be made to run the tune on a real
C64 the load address of the image MUST NOT be set lower than $07E8.

If the C64 BASIC flag is set, the value at $030C must be set with the song
number to be played (0x00 for song 1).



( run in 1.672 second using v1.01-cache-2.11-cpan-49f99fa48dc )