ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
sid.c File Reference
#include "../ugbc.h"

Go to the source code of this file.

Macros

#define WAVEFORM_TRIANGLE   0x10
#define WAVEFORM_SAW   0x20
#define WAVEFORM_RECTANGLE   0x40
#define WAVEFORM_NOISE   0x80
#define PROGRAM_FREQUENCY(c, f)
#define PROGRAM_FREQUENCY_V(c, f)
#define PROGRAM_FREQUENCY_SV(c, f)
#define PROGRAM_PITCH(c, f)
#define PROGRAM_PITCH_V(c, f)
#define PROGRAM_PITCH_SV(c, f)
#define PROGRAM_PULSE(c, p)
#define PROGRAM_PULSE_V(c, p)
#define PROGRAM_PULSE_SV(c, p)
#define PROGRAM_WAVEFORM(c, w)
#define PROGRAM_WAVEFORM_V(c, w, p)
#define PROGRAM_WAVEFORM_VV(c, w, p)
#define PROGRAM_WAVEFORM_SV(c, w)
#define PROGRAM_ATTACK_DECAY(c, a, d)
#define PROGRAM_ATTACK_DECAY_V(c, a, d)
#define PROGRAM_ATTACK_DECAY_SV(c, a, d)
#define PROGRAM_SUSTAIN_RELEASE(c, s, r)
#define PROGRAM_SUSTAIN_RELEASE_V(c, s, r)
#define PROGRAM_SUSTAIN_RELEASE_SV(c, s, r)
#define STOP_FREQUENCY(c)
#define STOP_FREQUENCY_V(c)
#define STOP_FREQUENCY_SV(c)
#define PROGRAM_DURATION(c, d)
#define WAIT_DURATION(c)

Functions

void sid_initialization (Environment *_environment)
void sid_finalization (Environment *_environment)
void sid_start (Environment *_environment, int _channels)
void sid_set_volume (Environment *_environment, int _channels, int _volume)
void sid_attack_decay_sustain_release (Environment *_environment, char *_voice, char *_attack, char *_decay, char *_sustain, char *_release)
void sid_wave (Environment *_environment, char *_voice, char *_bits, char *_pulse)
void sid_set_program (Environment *_environment, int _channels, int _program)
void sid_set_parameter (Environment *_environment, int _channels, int _parameter, int _value)
void sid_set_frequency (Environment *_environment, int _channels, int _frequency)
void sid_set_pitch (Environment *_environment, int _channels, int _pitch)
void sid_set_note (Environment *_environment, int _channels, int _note)
void sid_stop (Environment *_environment, int _channels)
void sid_start_var (Environment *_environment, char *_channels)
void sid_set_volume_vars (Environment *_environment, char *_channels, char *_volume)
void sid_set_volume_semi_var (Environment *_environment, char *_channel, int _volume)
void sid_set_program_semi_var (Environment *_environment, char *_channels, int _program)
void sid_set_frequency_vars (Environment *_environment, char *_channels, char *_frequency)
void sid_set_pitch_vars (Environment *_environment, char *_channels, char *_pitch)
void sid_set_note_vars (Environment *_environment, char *_channels, char *_note)
void sid_stop_vars (Environment *_environment, char *_channels)
void sid_music (Environment *_environment, char *_music, int _size, int _loop)
void sid_set_duration (Environment *_environment, int _channels, int _duration)
void sid_wait_duration (Environment *_environment, int _channels)
void sid_set_duration_vars (Environment *_environment, char *_channels, char *_duration)
void sid_wait_duration_vars (Environment *_environment, char *_channels)
void sid_player_init (Environment *_environment, int _init_address)
void sid_player_play (Environment *_environment, int _play_address)

Macro Definition Documentation

◆ PROGRAM_ATTACK_DECAY

#define PROGRAM_ATTACK_DECAY ( c,
a,
d )
Value:
outline1("LDX #$%2.2x", ( a & 0x0f ) ); \
outline1("LDY #$%2.2x", ( d & 0x0f ) ); \
if ( ( c & 0x01 ) ) \
outline0("JSR SIDPROGAD0" ); \
if ( ( c & 0x02 ) ) \
outline0("JSR SIDPROGAD1" ); \
if ( ( c & 0x04 ) ) \
outline0("JSR SIDPROGAD2" );
#define outline1(s, a)
Definition ugbc.h:4253

Definition at line 187 of file sid.c.

◆ PROGRAM_ATTACK_DECAY_SV

#define PROGRAM_ATTACK_DECAY_SV ( c,
a,
d )
Value:
outline1("LDX #$%2.2x", ( a & 0x0f ) ); \
outline1("LDY #$%2.2x", ( d & 0x0f ) ); \
outline1("LDA %s", ( c == NULL ? "#$7" : c ) ); \
outline0("JSR SIDPROGAD" );

Definition at line 203 of file sid.c.

◆ PROGRAM_ATTACK_DECAY_V

#define PROGRAM_ATTACK_DECAY_V ( c,
a,
d )
Value:
outline1("LDA %s", ( c == NULL ? "#$7" : c ) ); \
outline1("LDX %s", a ); \
outline1("LDY %s", d ); \
outline0("JSR SIDPROGAD" );

Definition at line 197 of file sid.c.

◆ PROGRAM_DURATION

#define PROGRAM_DURATION ( c,
d )
Value:
outline1("LDX #$%2.2x", ( d & 0xff ) ); \
if ( ( c & 0x01 ) ) \
outline0("JSR SIDSETDURATION0" ); \
if ( ( c & 0x02 ) ) \
outline0("JSR SIDSETDURATION1" ); \
if ( ( c & 0x04 ) ) \
outline0("JSR SIDSETDURATION2" ); \

Definition at line 247 of file sid.c.

◆ PROGRAM_FREQUENCY

#define PROGRAM_FREQUENCY ( c,
f )
Value:
outline1("LDX #$%2.2x", ( ( ( f * 0xffff ) / 4000 ) & 0xff ) ); \
outline1("LDY #$%2.2x", ( ( ( ( f * 0xffff ) / 4000 ) >> 8 ) & 0xff ) ); \
if ( ( c & 0x01 ) ) \
outline0("JSR SIDPROGFREQ0" ); \
if ( ( c & 0x02 ) ) \
outline0("JSR SIDPROGFREQ1" ); \
if ( ( c & 0x04 ) ) \
outline0("JSR SIDPROGFREQ2" );

Definition at line 97 of file sid.c.

◆ PROGRAM_FREQUENCY_SV

#define PROGRAM_FREQUENCY_SV ( c,
f )
Value:
outline1("LDX #$%2.2x", ( ( ( f * 0xffff ) / 4000 ) & 0xff ) ); \
outline1("LDY #$%2.2x", ( ( ( ( f * 0xffff ) / 4000 ) >> 8 ) & 0xff ) ); \
outline1("LDA %s", ( c == NULL ? "#$7" : c ) ); \
outline0("JSR SIDFREQ2" );

Definition at line 113 of file sid.c.

◆ PROGRAM_FREQUENCY_V

#define PROGRAM_FREQUENCY_V ( c,
f )
Value:
outline1("LDA %s", ( c == NULL ? "#$7" : c ) ); \
outline1("LDX %s", f ); \
outline1("LDY %s", address_displacement(_environment, f, "1") ); \
outline0("JSR SIDFREQ" );
char * address_displacement(Environment *_environment, char *_address, char *_displacement)

Definition at line 107 of file sid.c.

◆ PROGRAM_PITCH

#define PROGRAM_PITCH ( c,
f )
Value:
outline1("LDX #$%2.2x", ( f & 0xff ) ); \
outline1("LDY #$%2.2x", ( ( f >> 8 ) & 0xff ) ); \
if ( ( c & 0x01 ) ) \
outline0("JSR SIDPROGFREQ0" ); \
if ( ( c & 0x02 ) ) \
outline0("JSR SIDPROGFREQ1" ); \
if ( ( c & 0x04 ) ) \
outline0("JSR SIDPROGFREQ2" );

Definition at line 119 of file sid.c.

◆ PROGRAM_PITCH_SV

#define PROGRAM_PITCH_SV ( c,
f )
Value:
outline1("LDX #$%2.2x", ( f & 0xff ) ); \
outline1("LDY #$%2.2x", ( ( f >> 8 ) & 0xff ) ); \
outline1("LDA %s", ( c == NULL ? "#$7" : c ) ); \
outline0("JSR SIDPROGFREQ" );

Definition at line 135 of file sid.c.

◆ PROGRAM_PITCH_V

#define PROGRAM_PITCH_V ( c,
f )
Value:
outline1("LDA %s", ( c == NULL ? "#$7" : c ) ); \
outline1("LDX %s", f ); \
outline1("LDY %s", address_displacement(_environment, f, "1") ); \
outline0("JSR SIDPROGFREQ" );

Definition at line 129 of file sid.c.

◆ PROGRAM_PULSE

#define PROGRAM_PULSE ( c,
p )
Value:
outline1("LDX #$%2.2x", ( p & 0xff ) ); \
outline1("LDY #$%2.2x", ( ( p >> 8 ) & 0xff ) ); \
if ( ( c & 0x01 ) ) \
outline0("JSR SIDPROGPULSE0" ); \
if ( ( c & 0x02 ) ) \
outline0("JSR SIDPROGPULSE1" ); \
if ( ( c & 0x04 ) ) \
outline0("JSR SIDPROGPULSE2" );

Definition at line 141 of file sid.c.

◆ PROGRAM_PULSE_SV

#define PROGRAM_PULSE_SV ( c,
p )
Value:
outline1("LDX #$%2.2x", ( p & 0xff ) ); \
outline1("LDY #$%2.2x", ( ( p >> 8 ) & 0xff ) ); \
outline1("LDA %s", ( c == NULL ? "#$7" : c ) ); \
outline0("JSR SIDPROGPULSE" );

Definition at line 157 of file sid.c.

◆ PROGRAM_PULSE_V

#define PROGRAM_PULSE_V ( c,
p )
Value:
outline1("LDA %s", ( c == NULL ? "#$7" : c ) ); \
outline1("LDX %s", p ); \
outline1("LDY %s", address_displacement(_environment, p, "1") ); \
outline0("JSR SIDPROGPULSE" );

Definition at line 151 of file sid.c.

◆ PROGRAM_SUSTAIN_RELEASE

#define PROGRAM_SUSTAIN_RELEASE ( c,
s,
r )
Value:
outline1("LDX #$%2.2x", ( s & 0x0f ) ); \
outline1("LDY #$%2.2x", ( r & 0x0f ) ); \
if ( ( c & 0x01 ) ) \
outline0("JSR SIDPROGSR0" ); \
if ( ( c & 0x02 ) ) \
outline0("JSR SIDPROGSR1" ); \
if ( ( c & 0x04 ) ) \
outline0("JSR SIDPROGSR2" );

Definition at line 209 of file sid.c.

◆ PROGRAM_SUSTAIN_RELEASE_SV

#define PROGRAM_SUSTAIN_RELEASE_SV ( c,
s,
r )
Value:
outline1("LDX #$%2.2x", ( s & 0x0f ) ); \
outline1("LDY #$%2.2x", ( r & 0x0f ) ); \
outline1("LDA %s", ( c == NULL ? "#$7" : c ) ); \
outline0("JSR SIDPROGSR" );

Definition at line 225 of file sid.c.

◆ PROGRAM_SUSTAIN_RELEASE_V

#define PROGRAM_SUSTAIN_RELEASE_V ( c,
s,
r )
Value:
outline1("LDA %s", ( c == NULL ? "#$7" : c ) ); \
outline1("LDX %s", s ); \
outline1("LDY %s", r ); \
outline0("JSR SIDPROGSR" );

Definition at line 219 of file sid.c.

◆ PROGRAM_WAVEFORM

#define PROGRAM_WAVEFORM ( c,
w )
Value:
outline1("LDX #$%2.2x", w ); \
if ( ( c & 0x01 ) ) \
outline0("JSR SIDPROGCTR0" ); \
if ( ( c & 0x02 ) ) \
outline0("JSR SIDPROGCTR1" ); \
if ( ( c & 0x04 ) ) \
outline0("JSR SIDPROGCTR2" );

Definition at line 163 of file sid.c.

◆ PROGRAM_WAVEFORM_SV

#define PROGRAM_WAVEFORM_SV ( c,
w )
Value:
outline1("LDX #$%2.2x", w ); \
outline1("LDA %s", ( c == NULL ? "#$7" : c ) ); \
outline0("JSR SIDPROGCTR" );

Definition at line 182 of file sid.c.

◆ PROGRAM_WAVEFORM_V

#define PROGRAM_WAVEFORM_V ( c,
w,
p )
Value:
outline1("LDA %s", ( c == NULL ? "#$7" : c ) ); \
outline1("LDX #$%2.2x", w ); \
outline0("JSR SIDPROGCTR" );

Definition at line 172 of file sid.c.

◆ PROGRAM_WAVEFORM_VV

#define PROGRAM_WAVEFORM_VV ( c,
w,
p )
Value:
outline1("LDA %s", ( c == NULL ? "#$7" : c ) ); \
outline1("LDX %s", w ); \
outline0("JSR SIDPROGCTR" );

Definition at line 177 of file sid.c.

◆ STOP_FREQUENCY

#define STOP_FREQUENCY ( c)
Value:
if ( ( c & 0x01 ) ) \
outline0("JSR SIDSTOP0" ); \
if ( ( c & 0x02 ) ) \
outline0("JSR SIDSTOP1" ); \
if ( ( c & 0x04 ) ) \
outline0("JSR SIDSTOP2" );

Definition at line 231 of file sid.c.

◆ STOP_FREQUENCY_SV

#define STOP_FREQUENCY_SV ( c)
Value:
outline1("LDA %s", ( c == NULL ? "#$7" : c ) ); \
outline0("JSR SIDSTOP" );

Definition at line 243 of file sid.c.

◆ STOP_FREQUENCY_V

#define STOP_FREQUENCY_V ( c)
Value:
outline1("LDA %s", ( c == NULL ? "#$7" : c ) ); \
outline0("JSR SIDSTOP" );

Definition at line 239 of file sid.c.

◆ WAIT_DURATION

#define WAIT_DURATION ( c)
Value:
if ( ( c & 0x01 ) ) \
outline0("JSR SIDWAITDURATION0" ); \
if ( ( c & 0x02 ) ) \
outline0("JSR SIDWAITDURATION1" ); \
if ( ( c & 0x04 ) ) \
outline0("JSR SIDWAITDURATION2" ); \

Definition at line 256 of file sid.c.

◆ WAVEFORM_NOISE

#define WAVEFORM_NOISE   0x80

Definition at line 95 of file sid.c.

◆ WAVEFORM_RECTANGLE

#define WAVEFORM_RECTANGLE   0x40

Definition at line 94 of file sid.c.

◆ WAVEFORM_SAW

#define WAVEFORM_SAW   0x20

Definition at line 93 of file sid.c.

◆ WAVEFORM_TRIANGLE

#define WAVEFORM_TRIANGLE   0x10

Definition at line 92 of file sid.c.

Function Documentation

◆ sid_attack_decay_sustain_release()

void sid_attack_decay_sustain_release ( Environment * _environment,
char * _voice,
char * _attack,
char * _decay,
char * _sustain,
char * _release )

Definition at line 264 of file sid.c.

◆ sid_finalization()

void sid_finalization ( Environment * _environment)

Definition at line 56 of file sid.c.

◆ sid_initialization()

void sid_initialization ( Environment * _environment)

Definition at line 50 of file sid.c.

◆ sid_music()

void sid_music ( Environment * _environment,
char * _music,
int _size,
int _loop )

Definition at line 824 of file sid.c.

◆ sid_player_init()

void sid_player_init ( Environment * _environment,
int _init_address )

Definition at line 899 of file sid.c.

◆ sid_player_play()

void sid_player_play ( Environment * _environment,
int _play_address )

Definition at line 909 of file sid.c.

◆ sid_set_duration()

void sid_set_duration ( Environment * _environment,
int _channels,
int _duration )

Definition at line 846 of file sid.c.

◆ sid_set_duration_vars()

void sid_set_duration_vars ( Environment * _environment,
char * _channels,
char * _duration )

Definition at line 864 of file sid.c.

◆ sid_set_frequency()

void sid_set_frequency ( Environment * _environment,
int _channels,
int _frequency )

Definition at line 473 of file sid.c.

◆ sid_set_frequency_vars()

void sid_set_frequency_vars ( Environment * _environment,
char * _channels,
char * _frequency )

Definition at line 747 of file sid.c.

◆ sid_set_note()

void sid_set_note ( Environment * _environment,
int _channels,
int _note )

Definition at line 491 of file sid.c.

◆ sid_set_note_vars()

void sid_set_note_vars ( Environment * _environment,
char * _channels,
char * _note )

Definition at line 781 of file sid.c.

◆ sid_set_parameter()

void sid_set_parameter ( Environment * _environment,
int _channels,
int _parameter,
int _value )

Definition at line 469 of file sid.c.

◆ sid_set_pitch()

void sid_set_pitch ( Environment * _environment,
int _channels,
int _pitch )

Definition at line 482 of file sid.c.

◆ sid_set_pitch_vars()

void sid_set_pitch_vars ( Environment * _environment,
char * _channels,
char * _pitch )

Definition at line 764 of file sid.c.

◆ sid_set_program()

void sid_set_program ( Environment * _environment,
int _channels,
int _program )

Definition at line 281 of file sid.c.

◆ sid_set_program_semi_var()

void sid_set_program_semi_var ( Environment * _environment,
char * _channels,
int _program )

Definition at line 545 of file sid.c.

◆ sid_set_volume()

void sid_set_volume ( Environment * _environment,
int _channels,
int _volume )

Definition at line 82 of file sid.c.

◆ sid_set_volume_semi_var()

void sid_set_volume_semi_var ( Environment * _environment,
char * _channel,
int _volume )

Definition at line 535 of file sid.c.

◆ sid_set_volume_vars()

void sid_set_volume_vars ( Environment * _environment,
char * _channels,
char * _volume )

Definition at line 520 of file sid.c.

◆ sid_start()

void sid_start ( Environment * _environment,
int _channels )

Definition at line 65 of file sid.c.

◆ sid_start_var()

void sid_start_var ( Environment * _environment,
char * _channels )

Definition at line 506 of file sid.c.

◆ sid_stop()

void sid_stop ( Environment * _environment,
int _channels )

Definition at line 497 of file sid.c.

◆ sid_stop_vars()

void sid_stop_vars ( Environment * _environment,
char * _channels )

Definition at line 810 of file sid.c.

◆ sid_wait_duration()

void sid_wait_duration ( Environment * _environment,
int _channels )

Definition at line 855 of file sid.c.

◆ sid_wait_duration_vars()

void sid_wait_duration_vars ( Environment * _environment,
char * _channels )

Definition at line 884 of file sid.c.

◆ sid_wave()

void sid_wave ( Environment * _environment,
char * _voice,
char * _bits,
char * _pulse )

Definition at line 271 of file sid.c.