Permalink
Browse files

Now you can change the sample rate of PCM instruments

  • Loading branch information...
Javier Degirolmo
Javier Degirolmo committed Apr 22, 2013
1 parent 40459d3 commit eecc39834949e6affbf3268cb5405a296cd12216
Showing with 462 additions and 256 deletions.
  1. +10 −6 README
  2. BIN built/prog-z80-1.1.bin
  3. BIN built/prog-z80.bin
  4. +43 −4 c/echo.c
  5. +9 −2 c/echo.h
  6. +253 −237 c/echoblob.h
  7. +32 −1 doc/api-asm.68k
  8. +34 −1 doc/api-c.txt
  9. +49 −4 src-68k/echo.68k
  10. +4 −0 src-z80/core/main.z80
  11. +27 −0 src-z80/player/pcm.z80
  12. +1 −1 tester/core/entry.68k
View
16 README
@@ -7,12 +7,12 @@
| | |_ |_ ___ | | | | | | | |
| |_______ |_ |___| _| | | | | |_ |_____| _|
|___________| |________| |___| |___| |_________|
___ ___ _ _ ___ __ ___ ___ ___ _ ___ ___ _ _
| _| | | | | \ | _| | _| | | _| | | | |
| |_| | | | | | | | | | |_| | | |_| | | | |_ _ _ ___ ___ | | | |
|_ | | | | | | | | | | _| | | | | | | | _| | | | __| _ \ | | | |
_| | | | | | | | | | | |_| | | | | | | | |_ | | | __| /_ | |_| |
|___|___|___|_|_|__/ |___|_|_|___|_|_|_|___| \_/|___|_|_\_| |_|_|_|
___ ___ _ _ ___ __ ___ ___ ___ _ ___ ___ _ ___
| _| | | | | \ | _| | _| | | _| | | |_ |
| |_| | | | | | | | | | |_| | | |_| | | | |_ _ _ ___ ___ | | _| |
|_ | | | | | | | | | | _| | | | | | | | _| | | | __| _ \ | | | _|
_| | | | | | | | | | | |_| | | | | | | | |_ | | | __| /_ | |_| |_
|___|___|___|_|_|__/ |___|_|_|___|_|_|_|___| \_/|___|_|_\_| |_|_|___|
=============================================================================
@@ -95,4 +95,8 @@ THANKS FOR TESTING:
* Flygon (sorry for your headphones :P)
* djcouchycouch (for using an API I didn't even check if it worked)
OTHER THANKS:
* Titan (yay demoscene!)
=============================================================================
View
Binary file not shown.
View
Binary file not shown.
View
@@ -97,14 +97,14 @@ void echo_send_command(uint8_t cmd) {
}
//***************************************************************************
// echo_send_command_ex
// echo_send_command_addr
// Sends a raw command to Echo. An address parameter is taken.
//---------------------------------------------------------------------------
// param cmd: command to send
// param addr: address parameter
//***************************************************************************
void echo_send_command_ex(uint8_t cmd, const void *addr) {
void echo_send_command_addr(uint8_t cmd, const void *addr) {
// Since we need to split the address into multiple bytes we put it in an
// integer. This is a bad practice in general, period, but since we don't
// care about portability here we can afford to do it this time.
@@ -134,6 +134,34 @@ void echo_send_command_ex(uint8_t cmd, const void *addr) {
Z80_RELEASE();
}
//***************************************************************************
// echo_send_command_byte
// Sends a raw command to Echo. A byte parameter is taken.
//---------------------------------------------------------------------------
// param cmd: command to send
// param byte: parameter
//***************************************************************************
void echo_send_command_byte(uint8_t cmd, uint8_t byte) {
// We need access to Z80 bus
Z80_REQUEST();
// Is Echo busy yet?
while (z80_ram[0x1FFF] != 0x00) {
Z80_RELEASE();
int16_t i;
for (i = 0x3FF; i >= 0; i--);
Z80_REQUEST();
}
// Write the command
z80_ram[0x1FFF] = cmd;
z80_ram[0x1FFC] = byte;
// Done with the Z80
Z80_RELEASE();
}
//***************************************************************************
// echo_play_bgm
// Starts playing background music.
@@ -142,7 +170,7 @@ void echo_send_command_ex(uint8_t cmd, const void *addr) {
//***************************************************************************
void echo_play_bgm(const void *ptr) {
echo_send_command_ex(ECHO_CMD_PLAYBGM, ptr);
echo_send_command_addr(ECHO_CMD_PLAYBGM, ptr);
}
//***************************************************************************
@@ -171,7 +199,7 @@ void echo_resume_bgm(void) {
//***************************************************************************
void echo_play_sfx(const void *ptr) {
echo_send_command_ex(ECHO_CMD_PLAYSFX, ptr);
echo_send_command_addr(ECHO_CMD_PLAYSFX, ptr);
}
//***************************************************************************
@@ -183,6 +211,17 @@ void echo_stop_sfx(void) {
echo_send_command(ECHO_CMD_STOPSFX);
}
//***************************************************************************
// echo_set_pcm_rate
// Changes the playback rate of PCM.
//---------------------------------------------------------------------------
// param rate: new rate (timer A value)
//***************************************************************************
void echo_set_pcm_rate(uint8_t rate) {
echo_send_command_byte(ECHO_CMD_SETPCMRATE, rate);
}
//***************************************************************************
// echo_get_status
// Retrieves Echo's current status.
View
@@ -12,7 +12,8 @@ enum {
ECHO_CMD_STOPSFX, /* 0x03 - Stop SFX playback */
ECHO_CMD_PLAYBGM, /* 0x04 - Play a BGM */
ECHO_CMD_STOPBGM, /* 0x05 - Stop BGM playback */
ECHO_CMD_RESUMEBGM /* 0x06 - Resume BGM playback */
ECHO_CMD_RESUMEBGM, /* 0x06 - Resume BGM playback */
ECHO_CMD_SETPCMRATE, /* 0x07 - Set PCM rate */
};
/* Echo status flags */
@@ -27,8 +28,14 @@ void echo_stop_bgm(void);
void echo_resume_bgm(void);
void echo_play_sfx(const void *);
void echo_stop_sfx(void);
void echo_set_pcm_rate(uint8_t);
uint16_t echo_get_status(void);
void echo_send_command(uint8_t);
void echo_send_command_ex(uint8_t, const void *);
void echo_send_command_addr(uint8_t, const void *);
void echo_send_command_byte(uint8_t, uint8_t);
/* Deprecated functions */
static void (* const echo_send_command_ex)(uint8_t, const void *) =
echo_send_command_addr;
#endif
Oops, something went wrong.

0 comments on commit eecc398

Please sign in to comment.