GB Corp. by Dr. Ludos. MIT source release 2.0; built locally. GBT Player by Antonio Niño Díaz, BSD-2-Clause. Music In The Town by krümel, public domain, GB Studio Community Assets. Leaf Arcade uses binjgb by Ben Smith (MIT); adapters MIT. Original authors retain copyright. MIT License Copyright (c) 2021 Dr. Ludos Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ; -------------------------------------------------------------- ; --- --- ; --- --- ; --- GBT PLAYER v2.1.1 --- ; --- --- ; --- --- ; --- Copyright (C) 2009-2015 Antonio Niño Díaz --- ; --- All rights reserved. --- ; -------------------------------------------------------------- ; ; antonio_nd@outlook.com .NR10 = 0xFF10 .NR11 = 0xFF11 .NR12 = 0xFF12 .NR13 = 0xFF13 .NR14 = 0xFF14 .NR21 = 0xFF16 .NR22 = 0xFF17 .NR23 = 0xFF18 .NR24 = 0xFF19 .NR30 = 0xFF1A .NR31 = 0xFF1B .NR32 = 0xFF1C .NR33 = 0xFF1D .NR34 = 0xFF1E .NR41 = 0xFF20 .NR42 = 0xFF21 .NR43 = 0xFF22 .NR44 = 0xFF23 .NR50 = 0xFF24 .NR51 = 0xFF25 .NR52 = 0xFF26 .area _DATA gbt_playing:: .ds 1 gbt_song:: ; pointer to the pointer array .ds 2 gbt_bank:: ; bank with the data .ds 1 gbt_speed:: ; playing speed .ds 1 ; Up to 12 bytes per step are copied here to be handled in bank 1 gbt_temp_play_data:: .ds 12 gbt_loop_enabled:: .ds 1 gbt_ticks_elapsed:: .ds 1 gbt_current_step:: .ds 1 gbt_current_pattern:: .ds 1 gbt_current_step_data_ptr:: ; pointer to next step data .ds 2 gbt_channels_enabled:: .ds 1 gbt_pan:: ; Ch 1-4 .ds 4*1 gbt_vol:: ; Ch 1-4 .ds 4*1 gbt_instr:: ; Ch 1-4 .ds 4*1 gbt_freq:: ; Ch 1-3 .ds 3*2 gbt_channel3_loaded_instrument:: ; current loaded instrument ($FF if none) .ds 1 ; Arpeggio -> Ch 1-3 gbt_arpeggio_freq_index:: .ds 3*3 ; { base index, base index + x, base index + y } * 3 gbt_arpeggio_enabled:: .ds 3*1 ; if 0, disabled gbt_arpeggio_tick:: .ds 3*1 ; Cut note gbt_cut_note_tick:: .ds 4*1 ; If tick == gbt_cut_note_tick, stop note. ; Last step of last pattern this is set to 1 gbt_have_to_stop_next_step:: .ds 1 gbt_update_pattern_pointers:: .ds 1 ; set to 1 by jump effects ; ----------------------------------------------------------------------- .area _CODE ; ----------------------------------------------------------------------- gbt_get_pattern_ptr:: ; a = pattern number ; loads a pointer to pattern a into gbt_current_step_data_ptr ld e,a ld d,#0 ld a,(gbt_bank) ld (#0x2000),a ; MBC1, MBC3, MBC5 - Set bank ld hl,#gbt_song ld a,(hl+) ld l,(hl) ld h,a ; hl = pointer to list of pointers ; de = pattern number add hl,de add hl,de ; hl = pointer to pattern a pointer ld a,(hl+) ld h,(hl) ld l,a ; hl = pointer to pattern a data ld a,l ld (gbt_current_step_data_ptr),a ld a,h ld (gbt_current_step_data_ptr+1),a ret ; ----------------------------------------------------------------------- _gbt_play:: push bc lda hl,4(sp) ld e,(hl) inc hl ld d,(hl) inc hl ld c,(hl) inc hl ld b,(hl) ; de = data ; b = speed , c = bank ld hl,#gbt_song ld (hl),d inc hl ld (hl),e ld a,c ld (gbt_bank),a ld a,b ld (gbt_speed),a ld a,#0 call gbt_get_pattern_ptr xor a,a ld (gbt_current_step),a ld (gbt_current_pattern),a ld (gbt_ticks_elapsed),a ld (gbt_loop_enabled),a ld (gbt_have_to_stop_next_step),a ld (gbt_update_pattern_pointers),a ld a,#0xFF ld (gbt_channel3_loaded_instrument),a ld a,#0x0F ld (gbt_channels_enabled),a ld hl,#gbt_pan ld a,#0x11 ; L and R ld (hl+),a sla a ld (hl+),a sla a ld (hl+),a sla a ld (hl),a ld hl,#gbt_vol ld a,#0xF0 ; 100% ld (hl+),a ld (hl+),a ld a,#0x20 ; 100% ld (hl+),a ld a,#0xF0 ; 100% ld (hl+),a ld a,#0 ld hl,#gbt_instr ld (hl+),a ld (hl+),a ld (hl+),a ld (hl+),a ld hl,#gbt_freq ld (hl+),a ld (hl+),a ld (hl+),a ld (hl+),a ld (hl+),a ld (hl+),a ld (gbt_arpeggio_enabled+0),a ld (gbt_arpeggio_enabled+1),a ld (gbt_arpeggio_enabled+2),a ld a,#0xFF Copyright (c) 2016 Ben Smith Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.