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

Go to the source code of this file.

Macros

#define PROGRAM_FREQUENCY(c, f)
#define PROGRAM_FREQUENCY_V(c, f)
#define PROGRAM_FREQUENCY_SV(c, f)
#define PROGRAM_DURATION(c, d)
#define WAIT_DURATION(c)
#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_NOISE(c)
#define PROGRAM_NOISE_V(c, p)
#define PROGRAM_NOISE_SV(c)
#define PROGRAM_SAW(c)
#define PROGRAM_SAW_V(c)
#define PROGRAM_SAW_SV(c)
#define PROGRAM_TRIANGLE(c)
#define PROGRAM_TRIANGLE_V(c)
#define PROGRAM_TRIANGLE_SV(c)
#define PROGRAM_SAW_TRIANGLE(c)
#define PROGRAM_SAW_TRIANGLE_V(c)
#define PROGRAM_SAW_TRIANGLE_SV(c)
#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)

Functions

void ay8910_initialization (Environment *_environment)
void ay8910_finalization (Environment *_environment)
void ay8910_start (Environment *_environment, int _channels)
void ay8910_set_volume (Environment *_environment, int _channels, int _volume)
void ay8910_set_program (Environment *_environment, int _channels, int _program)
void ay8910_set_parameter (Environment *_environment, int _channels, int _parameter, int _value)
void ay8910_set_frequency (Environment *_environment, int _channels, int _frequency)
void ay8910_set_pitch (Environment *_environment, int _channels, int _pitch)
void ay8910_set_note (Environment *_environment, int _channels, int _note)
void ay8910_stop (Environment *_environment, int _channels)
void ay8910_start_var (Environment *_environment, char *_channels)
void ay8910_set_volume_vars (Environment *_environment, char *_channels, char *_volume)
void ay8910_set_volume_semi_var (Environment *_environment, char *_channel, int _volume)
void ay8910_set_program_semi_var (Environment *_environment, char *_channels, int _program)
void ay8910_set_frequency_vars (Environment *_environment, char *_channels, char *_frequency)
void ay8910_set_pitch_vars (Environment *_environment, char *_channels, char *_pitch)
void ay8910_set_note_vars (Environment *_environment, char *_channels, char *_note)
void ay8910_stop_vars (Environment *_environment, char *_channels)
void ay8910_music (Environment *_environment, char *_music, int _size, int _loop)
void ay8910_set_duration (Environment *_environment, int _channel, int _duration)
void ay8910_wait_duration (Environment *_environment, int _channel)
void ay8910_set_duration_vars (Environment *_environment, char *_channel, char *_duration)
void ay8910_wait_duration_vars (Environment *_environment, char *_channel)

Macro Definition Documentation

◆ PROGRAM_ATTACK_DECAY

#define PROGRAM_ATTACK_DECAY ( c,
a,
d )
Value:
outline1("LD A, $%2.2x", ( a & 0x0f ) ); \
outline0("LD E, A" ); \
outline1("LD A, $%2.2x", ( d & 0x0f ) ); \
outline0("LD D, A" ); \
if ( ( c & 0x01 ) ) \
outline0("CALL AY8910PROGAD0" ); \
if ( ( c & 0x02 ) ) \
outline0("CALL AY8910PROGAD1" ); \
if ( ( c & 0x04 ) ) \
outline0("CALL AY8910PROGAD2" );
#define outline1(s, a)
Definition ugbc.h:4253

Definition at line 380 of file ay8910.c.

◆ PROGRAM_ATTACK_DECAY_SV

#define PROGRAM_ATTACK_DECAY_SV ( c,
a,
d )
Value:
outline1("LD A, $%2.2x", ( a & 0x0f ) ); \
outline0("LD E, A" ); \
outline1("LD A, $%2.2x", ( d & 0x0f ) ); \
outline0("LD D, A" ); \
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910PROGAD" );

Definition at line 404 of file ay8910.c.

◆ PROGRAM_ATTACK_DECAY_V

#define PROGRAM_ATTACK_DECAY_V ( c,
a,
d )
Value:
outline1("LD A, %s", a ); \
outline0("LD E, A" ); \
outline1("LD A, %s", d ); \
outline0("LD D, A" ); \
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910PROGAD" );

Definition at line 392 of file ay8910.c.

◆ PROGRAM_DURATION

#define PROGRAM_DURATION ( c,
d )
Value:
outline1("LD A, $%2.2x", ( d & 0xff ) ); \
outline0("LD E, A" ); \
outline1("LD A, $%2.2x", ( ( d >> 8 ) & 0xff ) ); \
outline0("LD D, A" ); \
if ( ( c & 0x01 ) ) \
outline0("CALL AY8910PROGDUR0" ); \
if ( ( c & 0x02 ) ) \
outline0("CALL AY8910PROGDUR1" ); \
if ( ( c & 0x04 ) ) \
outline0("CALL AY8910PROGDUR2" ); \
if ( ( c & 0x08 ) ) \
outline0("CALL AY8910PROGDURN0" );

Definition at line 162 of file ay8910.c.

◆ PROGRAM_FREQUENCY

#define PROGRAM_FREQUENCY ( c,
f )
Value:
outline1("LD A, $%2.2x", ( f & 0xff ) ); \
outline0("LD E, A" ); \
outline1("LD A, $%2.2x", ( ( f >> 8 ) & 0xff ) ); \
outline0("LD D, A" ); \
if ( ( c & 0x01 ) ) \
outline0("CALL AY8910PROGFREQ0" ); \
if ( ( c & 0x02 ) ) \
outline0("CALL AY8910PROGFREQ1" ); \
if ( ( c & 0x04 ) ) \
outline0("CALL AY8910PROGFREQ2" ); \
if ( ( c & 0x08 ) ) \
outline0("CALL AY8910PROGFREQN0" );

Definition at line 124 of file ay8910.c.

◆ PROGRAM_FREQUENCY_SV

#define PROGRAM_FREQUENCY_SV ( c,
f )
Value:
outline1("LD A, $%2.2x", ( f & 0xff ) ); \
outline0("LD E, A" ); \
outline1("LD A, $%2.2x", ( ( f >> 8 ) & 0xff ) ); \
outline0("LD D, A" ); \
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910FREQ2" );

Definition at line 150 of file ay8910.c.

◆ PROGRAM_FREQUENCY_V

#define PROGRAM_FREQUENCY_V ( c,
f )
Value:
outline1("LD A, (%s)", f ); \
outline0("LD E, A" ); \
outline1("LD A, (%s)", address_displacement(_environment, f, "1") ); \
outline0("LD D, A" ); \
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910FREQ" );
char * address_displacement(Environment *_environment, char *_address, char *_displacement)

Definition at line 138 of file ay8910.c.

◆ PROGRAM_NOISE

#define PROGRAM_NOISE ( c)
Value:
outline0("LD A, $82" ); \
outline0("LD B, A" ); \
if ( ( c & 0x01 ) ) \
outline0("CALL AY8910PROGCTR0" ); \
if ( ( c & 0x02 ) ) \
outline0("CALL AY8910PROGCTR1" ); \
if ( ( c & 0x04 ) ) \
outline0("CALL AY8910PROGCTR2" );
#define outline0(s)
Definition ugbc.h:4252

Definition at line 260 of file ay8910.c.

◆ PROGRAM_NOISE_SV

#define PROGRAM_NOISE_SV ( c)
Value:
outline0("LD A, $82" ); \
outline0("LD B, A" ); \
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910PROGCTR" );

Definition at line 280 of file ay8910.c.

◆ PROGRAM_NOISE_V

#define PROGRAM_NOISE_V ( c,
p )
Value:
outline0("LD A, $82" ); \
outline0("LD B, A" ); \
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910PROGCTR" );

Definition at line 270 of file ay8910.c.

◆ PROGRAM_PITCH

#define PROGRAM_PITCH ( c,
f )
Value:
outline1("LD A, $%2.2x", ( f & 0xff ) ); \
outline0("LD E, A" ); \
outline1("LD A, $%2.2x", ( ( f >> 8 ) & 0xff ) ); \
outline0("LD D, A" ); \
if ( ( c & 0x01 ) ) \
outline0("CALL AY8910PROGFREQ0" ); \
if ( ( c & 0x02 ) ) \
outline0("CALL AY8910PROGFREQ1" ); \
if ( ( c & 0x04 ) ) \
outline0("CALL AY8910PROGFREQ2" ); \
if ( ( c & 0x08 ) ) \
outline0("CALL AY8910PROGFREQN0" );

Definition at line 186 of file ay8910.c.

◆ PROGRAM_PITCH_SV

#define PROGRAM_PITCH_SV ( c,
f )
Value:
outline1("LD A, $%2.2x", ( f & 0xff ) ); \
outline0("LD E, A" ); \
outline1("LD A, $%2.2x", ( ( f >> 8 ) & 0xff ) ); \
outline0("LD D, A" ); \
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910PROGFREQ" );

Definition at line 212 of file ay8910.c.

◆ PROGRAM_PITCH_V

#define PROGRAM_PITCH_V ( c,
f )
Value:
outline1("LD A, (%s)", f ); \
outline0("LD E, A" ); \
outline1("LD A, (%s)", address_displacement(_environment, f, "1") ); \
outline0("LD D, A" ); \
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910PROGFREQ" );

Definition at line 200 of file ay8910.c.

◆ PROGRAM_PULSE

#define PROGRAM_PULSE ( c,
p )
Value:
outline1("LD A, $%2.2x", ( p & 0xff ) ); \
outline0("LD E, A" ); \
outline1("LD A, $%2.2x", ( ( p >> 8 ) & 0xff ) ); \
outline0("LD D, A" ); \
if ( ( c & 0x01 ) ) \
outline0("CALL AY8910PROGPULSE0" ); \
if ( ( c & 0x02 ) ) \
outline0("CALL AY8910PROGPULSE1" ); \
if ( ( c & 0x04 ) ) \
outline0("CALL AY8910PROGPULSE2" );

Definition at line 224 of file ay8910.c.

◆ PROGRAM_PULSE_SV

#define PROGRAM_PULSE_SV ( c,
p )
Value:
outline1("LD A, $%2.2x", ( p & 0xff ) ); \
outline0("LD E, A" ); \
outline1("LD A, $%2.2x", ( ( p >> 8 ) & 0xff ) ); \
outline0("LD D, A" ); \
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910PROGPULSE" );

Definition at line 248 of file ay8910.c.

◆ PROGRAM_PULSE_V

#define PROGRAM_PULSE_V ( c,
p )
Value:
outline1("LD A, (%s)", p ); \
outline0("LD E, A" ); \
outline1("LD A, (%s)", address_displacement(_environment, p, "1") ); \
outline0("LD D, A" ); \
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910PROGPULSE" );

Definition at line 236 of file ay8910.c.

◆ PROGRAM_SAW

#define PROGRAM_SAW ( c)
Value:
outline0("LD A, $22" ); \
outline0("LD B, A" ); \
if ( ( c & 0x01 ) ) \
outline0("CALL AY8910PROGCTR0" ); \
if ( ( c & 0x02 ) ) \
outline0("CALL AY8910PROGCTR1" ); \
if ( ( c & 0x04 ) ) \
outline0("CALL AY8910PROGCTR2" );

Definition at line 290 of file ay8910.c.

◆ PROGRAM_SAW_SV

#define PROGRAM_SAW_SV ( c)
Value:
outline0("LD A, $22" ); \
outline0("LD B, A" ); \
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910PROGCTR" );

Definition at line 310 of file ay8910.c.

◆ PROGRAM_SAW_TRIANGLE

#define PROGRAM_SAW_TRIANGLE ( c)
Value:
outline0("LD A, $32" ); \
outline0("LD B, A" ); \
if ( ( c & 0x01 ) ) \
outline0("CALL AY8910PROGCTR0" ); \
if ( ( c & 0x02 ) ) \
outline0("CALL AY8910PROGCTR1" ); \
if ( ( c & 0x04 ) ) \
outline0("CALL AY8910PROGCTR2" );

Definition at line 350 of file ay8910.c.

◆ PROGRAM_SAW_TRIANGLE_SV

#define PROGRAM_SAW_TRIANGLE_SV ( c)
Value:
outline0("LD A, $32" ); \
outline0("LD B, A" ); \
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910PROGCTR" );

Definition at line 370 of file ay8910.c.

◆ PROGRAM_SAW_TRIANGLE_V

#define PROGRAM_SAW_TRIANGLE_V ( c)
Value:
outline0("LD A, $32" ); \
outline0("LD B, A" ); \
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910PROGCTR" );

Definition at line 360 of file ay8910.c.

◆ PROGRAM_SAW_V

#define PROGRAM_SAW_V ( c)
Value:
outline0("LD A, $22" ); \
outline0("LD B, A" ); \
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910PROGCTR" );

Definition at line 300 of file ay8910.c.

◆ PROGRAM_SUSTAIN_RELEASE

#define PROGRAM_SUSTAIN_RELEASE ( c,
s,
r )
Value:
outline1("LD A, $%2.2x", ( s & 0x0f ) ); \
outline0("LD E, A" ); \
outline1("LD A, $%2.2x", ( r & 0x0f ) ); \
outline0("LD D, A" ); \
if ( ( c & 0x01 ) ) \
outline0("CALL AY8910PROGSR0" ); \
if ( ( c & 0x02 ) ) \
outline0("CALL AY8910PROGSR1" ); \
if ( ( c & 0x04 ) ) \
outline0("CALL AY8910PROGSR2" );

Definition at line 416 of file ay8910.c.

◆ PROGRAM_SUSTAIN_RELEASE_SV

#define PROGRAM_SUSTAIN_RELEASE_SV ( c,
s,
r )
Value:
outline1("LD A, $%2.2x", ( s & 0x0f ) ); \
outline0("LD E, A" ); \
outline1("LD A, $%2.2x", ( r & 0x0f ) ); \
outline0("LD D, A" ); \
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910PROGSR" );

Definition at line 440 of file ay8910.c.

◆ PROGRAM_SUSTAIN_RELEASE_V

#define PROGRAM_SUSTAIN_RELEASE_V ( c,
s,
r )
Value:
outline1("LD A, %s", s ); \
outline0("LD E, A" ); \
outline1("LD A, %s", r ); \
outline0("LD D, A" ); \
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910PROGSR" );

Definition at line 428 of file ay8910.c.

◆ PROGRAM_TRIANGLE

#define PROGRAM_TRIANGLE ( c)
Value:
outline0("LD A, $12" ); \
outline0("LD B, A" ); \
if ( ( c & 0x01 ) ) \
outline0("CALL AY8910PROGCTR0" ); \
if ( ( c & 0x02 ) ) \
outline0("CALL AY8910PROGCTR1" ); \
if ( ( c & 0x04 ) ) \
outline0("CALL AY8910PROGCTR2" );

Definition at line 320 of file ay8910.c.

◆ PROGRAM_TRIANGLE_SV

#define PROGRAM_TRIANGLE_SV ( c)
Value:
outline0("LD A, $12" ); \
outline0("LD B, A" ); \
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910PROGCTR" );

Definition at line 340 of file ay8910.c.

◆ PROGRAM_TRIANGLE_V

#define PROGRAM_TRIANGLE_V ( c)
Value:
outline0("LD A, $12" ); \
outline0("LD B, A" ); \
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910PROGCTR" );

Definition at line 330 of file ay8910.c.

◆ STOP_FREQUENCY

#define STOP_FREQUENCY ( c)
Value:
if ( ( c & 0x01 ) ) \
outline0("CALL AY8910STOP0" ); \
if ( ( c & 0x02 ) ) \
outline0("CALL AY8910STOP1" ); \
if ( ( c & 0x04 ) ) \
outline0("CALL AY8910STOP2" ); \
if ( ( c & 0x08 ) ) \
outline0("CALL AY8910STOPN0" );

Definition at line 452 of file ay8910.c.

◆ STOP_FREQUENCY_SV

#define STOP_FREQUENCY_SV ( c)
Value:
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910STOP" );

Definition at line 470 of file ay8910.c.

◆ STOP_FREQUENCY_V

#define STOP_FREQUENCY_V ( c)
Value:
if ( c == NULL ) { \
outline0("LD A, $7"); \
} else { \
outline1("LD A, (%s)", c ); \
} \
outline0("CALL AY8910STOP" );

Definition at line 462 of file ay8910.c.

◆ WAIT_DURATION

#define WAIT_DURATION ( c)
Value:
if ( ( c & 0x01 ) ) \
outline0("CALL AY8910WAITDUR0" ); \
if ( ( c & 0x02 ) ) \
outline0("CALL AY8910WAITDUR1" ); \
if ( ( c & 0x04 ) ) \
outline0("CALL AY8910WAITDUR2" ); \
if ( ( c & 0x08 ) ) \
outline0("CALL AY8910WAITDURN0" );

Definition at line 176 of file ay8910.c.

Function Documentation

◆ ay8910_finalization()

void ay8910_finalization ( Environment * _environment)

Definition at line 83 of file ay8910.c.

◆ ay8910_initialization()

void ay8910_initialization ( Environment * _environment)

Definition at line 49 of file ay8910.c.

◆ ay8910_music()

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

Definition at line 1046 of file ay8910.c.

◆ ay8910_set_duration()

void ay8910_set_duration ( Environment * _environment,
int _channel,
int _duration )

Definition at line 1066 of file ay8910.c.

◆ ay8910_set_duration_vars()

void ay8910_set_duration_vars ( Environment * _environment,
char * _channel,
char * _duration )

Definition at line 1084 of file ay8910.c.

◆ ay8910_set_frequency()

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

Definition at line 684 of file ay8910.c.

◆ ay8910_set_frequency_vars()

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

Definition at line 969 of file ay8910.c.

◆ ay8910_set_note()

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

Definition at line 702 of file ay8910.c.

◆ ay8910_set_note_vars()

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

Definition at line 1007 of file ay8910.c.

◆ ay8910_set_parameter()

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

Definition at line 680 of file ay8910.c.

◆ ay8910_set_pitch()

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

Definition at line 693 of file ay8910.c.

◆ ay8910_set_pitch_vars()

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

Definition at line 988 of file ay8910.c.

◆ ay8910_set_program()

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

Definition at line 478 of file ay8910.c.

◆ ay8910_set_program_semi_var()

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

Definition at line 767 of file ay8910.c.

◆ ay8910_set_volume()

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

Definition at line 112 of file ay8910.c.

◆ ay8910_set_volume_semi_var()

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

Definition at line 751 of file ay8910.c.

◆ ay8910_set_volume_vars()

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

Definition at line 731 of file ay8910.c.

◆ ay8910_start()

void ay8910_start ( Environment * _environment,
int _channels )

Definition at line 92 of file ay8910.c.

◆ ay8910_start_var()

void ay8910_start_var ( Environment * _environment,
char * _channels )

Definition at line 717 of file ay8910.c.

◆ ay8910_stop()

void ay8910_stop ( Environment * _environment,
int _channels )

Definition at line 708 of file ay8910.c.

◆ ay8910_stop_vars()

void ay8910_stop_vars ( Environment * _environment,
char * _channels )

Definition at line 1036 of file ay8910.c.

◆ ay8910_wait_duration()

void ay8910_wait_duration ( Environment * _environment,
int _channel )

Definition at line 1075 of file ay8910.c.

◆ ay8910_wait_duration_vars()

void ay8910_wait_duration_vars ( Environment * _environment,
char * _channel )

Definition at line 1104 of file ay8910.c.