-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from jsmolina/feature/alvin_is_great
make ay play in 128k (alvin is great!)
- Loading branch information
Showing
24 changed files
with
3,209 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
misifu_ay | ||
ay_music.c | ||
misifu_ay | ||
ay_music |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
; void ay_vt_init(const void *module_address) __z88dk_fastcall | ||
|
||
SECTION code_crt_common | ||
|
||
PUBLIC _ay_vt_init | ||
|
||
EXTERN VT_INIT | ||
EXTERN asm_z80_push_di, asm0_z80_pop_ei | ||
EXTERN enable_bank_n, restore_bank_0 | ||
|
||
_ay_vt_init: | ||
|
||
call asm_z80_push_di | ||
push ix | ||
push iy | ||
|
||
ld a,0x80 | ||
ld i,a ; point I at uncontended bank | ||
|
||
ex de,hl ; de = module address | ||
ld a,6 | ||
call enable_bank_n ; bank 6 in top 16k, stack moved | ||
ex de,hl ; hl = module address | ||
call VT_INIT | ||
call restore_bank_0 ; bank 0 in top 16k, stack restored | ||
|
||
ld a,0xd0 | ||
ld i,a ; restore I | ||
|
||
pop iy | ||
pop ix | ||
jp asm0_z80_pop_ei | ||
|
||
|
||
; void ay_vt_mute(void) | ||
|
||
SECTION code_crt_common | ||
|
||
PUBLIC _ay_vt_mute | ||
|
||
EXTERN VT_MUTE | ||
EXTERN asm_z80_push_di, asm0_z80_pop_ei | ||
EXTERN enable_bank_n, restore_bank_0 | ||
|
||
_ay_vt_mute: | ||
|
||
call asm_z80_push_di | ||
|
||
ld a,0x80 | ||
ld i,a ; point I at uncontended bank | ||
|
||
ld a,6 | ||
call enable_bank_n ; bank 6 in top 16k, stack moved | ||
call VT_MUTE | ||
call restore_bank_0 ; bank 0 in top 16k, stack restored | ||
|
||
ld a,0xd0 | ||
ld i,a ; restore I | ||
|
||
jp asm0_z80_pop_ei |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
#ifndef _AY_MUSIC | ||
#define _AY_MUSIC | ||
|
||
|
||
#include "vt_sound.h" | ||
|
||
extern void initialize_ay(); | ||
|
||
extern void keep_playing(); | ||
|
||
#endif | ||
#ifndef _AY_MUSIC | ||
#define _AY_MUSIC | ||
|
||
extern unsigned char music_module[]; | ||
|
||
extern void ay_vt_init(const void *module_address) __z88dk_fastcall; | ||
extern void ay_vt_mute(void); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
SECTION rodata_user | ||
|
||
PUBLIC _music_module | ||
|
||
_music_module: | ||
BINARY "alley_cat.pt3" | ||
SECTION BANK_6 | ||
|
||
PUBLIC _music_module | ||
|
||
_music_module: | ||
BINARY "alley_cat.pt3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
The vt_sound library places code and data into sections "code_user" and "data_user". | ||
|
||
We'd like to move that to "BANK_6" so that AY code exists in a separate memory bank. | ||
This is done by getting zobjcopy to rename the sections in the "vt_sound.lib" file. | ||
|
||
zobjcopy vt_sound.lib --section code_user=BANK_6 --section data_user=BANK_6 --global "VT_INIT" --global "VT_MUTE" --global "_vt_play" --global "_vt_play_isr_enabled" vt_sound_6.lib | ||
|
||
Linking the program against "vt_sound_6.lib" will now place all AY-related code into | ||
BANK_6. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,83 @@ | ||
/******************************************************************************* | ||
* Stefan Bylund 2016 | ||
* | ||
* C API for calling the Vortex Tracker II (VT) player in PT3PROM.asm. | ||
* The VT player supports playing of Pro Tracker 3.x (PT3) modules. | ||
* | ||
* The module(s) to be played is created in the following way: | ||
* | ||
* 1. If the module is a PT3 module, it can be played directly by the VT player. | ||
* 2. If the module is not a PT3 module but a module in another format supported | ||
* by Vortex Tracker II, open the module in Vortex Tracker II and save it as | ||
* a PT3 module. | ||
* 3. Create an assembler source file for loading the PT3 module(s). | ||
* Define a read-only data section and load the PT3 module(s) using the | ||
* BINARY directive. Associate each PT3 module with a public label starting | ||
* with an underscore, e.g. _music_module. | ||
* | ||
* How to use: | ||
* | ||
* 1. Make the PT3 module(s) available to your C program by declaring external | ||
* references to their public labels (but without the leading underscore) as | ||
* created in step 3 above, e.g. "extern uint8_t music_module[];". | ||
* 2. Call vt_init(<module_address>) to initialize the VT player with the | ||
* specified module. | ||
* 3. Call vt_play() each 1/50 second or install the vt_play_isr() function as | ||
* an IM2 interrupt service routine. The module will now start playing in the | ||
* background. | ||
******************************************************************************/ | ||
|
||
#ifndef _VT_SOUND_H | ||
#define _VT_SOUND_H | ||
|
||
#include <stdint.h> | ||
|
||
/* | ||
* Returns a pointer to the VT player's setup byte. | ||
* Set bit 0 to disable looping; bit 7 is set after each loop. | ||
*/ | ||
extern uint8_t *vt_get_setup(void); | ||
|
||
/* | ||
* Initializes the VT player with the specified module. | ||
* | ||
* If this function is called during playing of the module, it mutes the sound | ||
* and reinitializes the VT player with the specified module to be played from | ||
* its beginning. | ||
*/ | ||
extern void vt_init(const void *module_address) __z88dk_fastcall; | ||
|
||
/* | ||
* Plays one snippet of the module. Call this function each 1/50 second to play | ||
* the module continuously, e.g. from your interrupt service routine. | ||
*/ | ||
extern void vt_play(void); | ||
|
||
/* | ||
* This function is tailored for installation as a self-contained IM2 interrupt | ||
* service routine to play the module in the background. | ||
*/ | ||
extern void vt_play_isr(void); | ||
|
||
/* | ||
* Enables (enabled = 1) or disables (enabled = 0) the vt_play_isr() interrupt | ||
* service routine. The vt_play_isr() interrupt service routine is initially | ||
* enabled. | ||
*/ | ||
extern void vt_set_play_isr_enabled(int enabled) __z88dk_fastcall; | ||
|
||
/* | ||
* Mutes the sound. Call vt_play() to continue playing again. | ||
* | ||
* If the vt_play_isr() interrupt service routine is used, call | ||
* vt_set_play_isr_enabled(0) before calling vt_mute() to mute the sound. | ||
* Call vt_set_play_isr_enabled(1) to continue playing again. | ||
*/ | ||
extern void vt_mute(void); | ||
|
||
/* | ||
* Returns a pointer to the VT player's current position pointer word. | ||
*/ | ||
extern uint16_t *vt_get_cur_pos(void); | ||
|
||
#endif | ||
/******************************************************************************* | ||
* Stefan Bylund 2016 | ||
* | ||
* C API for calling the Vortex Tracker II (VT) player in PT3PROM.asm. | ||
* The VT player supports playing of Pro Tracker 3.x (PT3) modules. | ||
* | ||
* The module(s) to be played is created in the following way: | ||
* | ||
* 1. If the module is a PT3 module, it can be played directly by the VT player. | ||
* 2. If the module is not a PT3 module but a module in another format supported | ||
* by Vortex Tracker II, open the module in Vortex Tracker II and save it as | ||
* a PT3 module. | ||
* 3. Create an assembler source file for loading the PT3 module(s). | ||
* Define a read-only data section and load the PT3 module(s) using the | ||
* BINARY directive. Associate each PT3 module with a public label starting | ||
* with an underscore, e.g. _music_module. | ||
* | ||
* How to use: | ||
* | ||
* 1. Make the PT3 module(s) available to your C program by declaring external | ||
* references to their public labels (but without the leading underscore) as | ||
* created in step 3 above, e.g. "extern uint8_t music_module[];". | ||
* 2. Call vt_init(<module_address>) to initialize the VT player with the | ||
* specified module. | ||
* 3. Call vt_play() each 1/50 second or install the vt_play_isr() function as | ||
* an IM2 interrupt service routine. The module will now start playing in the | ||
* background. | ||
******************************************************************************/ | ||
|
||
#ifndef _VT_SOUND_H | ||
#define _VT_SOUND_H | ||
|
||
#include <stdint.h> | ||
|
||
/* | ||
* Returns a pointer to the VT player's setup byte. | ||
* Set bit 0 to disable looping; bit 7 is set after each loop. | ||
*/ | ||
extern uint8_t *vt_get_setup(void); | ||
|
||
/* | ||
* Initializes the VT player with the specified module. | ||
* | ||
* If this function is called during playing of the module, it mutes the sound | ||
* and reinitializes the VT player with the specified module to be played from | ||
* its beginning. | ||
*/ | ||
extern void vt_init(const void *module_address) __z88dk_fastcall; | ||
|
||
/* | ||
* Plays one snippet of the module. Call this function each 1/50 second to play | ||
* the module continuously, e.g. from your interrupt service routine. | ||
*/ | ||
extern void vt_play(void); | ||
|
||
/* | ||
* This function is tailored for installation as a self-contained IM2 interrupt | ||
* service routine to play the module in the background. | ||
*/ | ||
extern void vt_play_isr(void); | ||
|
||
/* | ||
* Enables (enabled = 1) or disables (enabled = 0) the vt_play_isr() interrupt | ||
* service routine. The vt_play_isr() interrupt service routine is initially | ||
* enabled. | ||
*/ | ||
extern void vt_set_play_isr_enabled(int enabled) __z88dk_fastcall; | ||
|
||
/* | ||
* Mutes the sound. Call vt_play() to continue playing again. | ||
* | ||
* If the vt_play_isr() interrupt service routine is used, call | ||
* vt_set_play_isr_enabled(0) before calling vt_mute() to mute the sound. | ||
* Call vt_set_play_isr_enabled(1) to continue playing again. | ||
*/ | ||
extern void vt_mute(void); | ||
|
||
/* | ||
* Returns a pointer to the VT player's current position pointer word. | ||
*/ | ||
extern uint16_t *vt_get_cur_pos(void); | ||
|
||
#endif |
Empty file.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.