47 static const unsigned pitch2freq[]={
48 0x8d03, 0x8603, 0x7d03, 0x7703, 0x7003, 0x6a03, 0x6303, 0x5e03,
49 0x5903, 0x5403, 0x4f03, 0x4a03, 0x4603, 0x4203, 0xfd83, 0xee83,
50 0xe083, 0xd483, 0xc783, 0xbc83, 0xb283, 0xa883, 0x9e83, 0x9583,
51 0x8d83, 0x8583, 0x7e83, 0x7683, 0x7083, 0x6983, 0x6383, 0x5e83,
52 0x5983, 0x5383, 0x4f83, 0x4a83, 0x4683, 0x4283, 0xfc02, 0xee02,
53 0xe102, 0xd402, 0xc802, 0xbd02, 0xb202, 0xa802, 0x9e02, 0x9502,
54 0x8d02, 0x8502, 0xfc82, 0xee82, 0xe082, 0xd482, 0xc882, 0xbd82,
55 0xb282, 0xa882, 0x9e82, 0x9682, 0x8d82, 0x8582, 0x7e82, 0x7682,
56 0x7082, 0x6982, 0x6382, 0x5e82, 0x5882, 0x5382, 0x4f82, 0x4a82,
57 0x4682, 0x4282, 0xfc01, 0xee01, 0xe001, 0xd401, 0xc801, 0xbd01,
58 0xb201, 0xa801, 0x9e01, 0x9501, 0x8d01, 0x8501, 0x7e01, 0x7601,
59 0x7001, 0x6901, 0x6301, 0x5e01, 0x5801, 0x5301, 0x4f01, 0x4a01,
64 static const note_t sys_beep[]={
78 static volatile int internote;
88 static inline void play_freq(
unsigned freq) {
89 unsigned char CKSmask = freq & 0xff;
90 unsigned char match = freq >> 8;
110 static inline void play_pause() {
122 #ifdef CONF_RCX_COMPILER 127 void dsound_core(
void) {
139 if(dsound_next_note) {
140 unsigned char pitch =dsound_next_note->
pitch;
144 play_freq(pitch2freq[pitch]);
193 #endif // CONF_DSOUND #define PITCH_PAUSE
specify a pause (rest)
Internal Interface: H8/3297 processor registers.
const note_t * dsound_system_sounds[]
system sound data
Interface: console input / output.
#define DSOUND_DEFAULT_internote_ms
default duration internote spacing in ms
void dsound_stop(void)
stop playing sound
unsigned dsound_internote_ms
length of internote spacing in ms
Internal Interface: H8/300 bit operations.
#define DSOUND_DEFAULT_16th_ms
default duration of 1/16th note in ms
unsigned dsound_16th_ms
length of 1/16 note in ms
volatile unsigned char T0_CSR
timer 0 control / status register
time_t get_system_up_time(void)
retrieve the current system time
#define bit_load(mask, bit)
load a single bit from a mask to the carry flag
Internal Interface: task management.
the note structure describing a single note.
unsigned char pitch
note pitch, 0 ^= A_0 (~55 Hz)
void dsound_handler()
sound handler, called from system timer interrupt
#define PITCH_MAX
maximum pitch value
HANDLER_WRAPPER("lcd_refresh_next_byte","lcd_refresh_next_byte_core")
lcd refresh handler, called from system timer interrupt
#define PITCH_END
mark the end of a list of note_t entries
wakeup_t dsound_finished(wakeup_t data)
sound finished event wakeup function
void dsound_init()
initialize sound driver
unsigned long wakeup_t
wakeup data area type
unsigned long time_t
time type
unsigned char T0_CR
timer 0 control register
void dsound_shutdown()
shutdown sound driver
unsigned char length
note length in 1/16ths
static int dsound_playing(void)
returns nonzero value if a sound is playing
volatile time_t dsound_next_time
when to play next note
Internal Interface: direct sound control.
volatile note_t * dsound_next_note
pointer to current note
unsigned char STCR
serial / timer control register
Internal LNP Interface: RCX redirected IRQ vectors.
unsigned char T0_CORA
timer 0 constant A register
#define bit_store(byte, bit)
store the carry flag to a single single bit in memory
volatile unsigned char T0_CNT
timer 0 counter register