├── .github └── workflows │ └── build.yml ├── .gitignore ├── README.md ├── doc ├── driver-format.txt └── internals.md ├── gbdk_example ├── Makefile ├── README.md ├── build.bat └── src │ ├── gbdk_player_example.c │ └── sample_song.c ├── gbs.asm ├── hUGEDriver.asm ├── include ├── hUGE.inc ├── hUGEDriver.h ├── hUGE_note_table.inc └── hardware.inc ├── player.asm ├── rgbds_example ├── README.md ├── build.bat ├── build.sh └── sample_song.asm ├── song.asm └── tools └── rgb2sdas.py /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Package driver distribution 2 | 3 | on: 4 | - push 5 | - pull_request 6 | - workflow_dispatch 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Install build dependencies 13 | shell: bash 14 | run: | 15 | sudo apt -qq update 16 | sudo apt install -yq bison 17 | 18 | wget 'https://github.com/gbdev/rgbds/releases/download/v0.6.1/rgbds-0.6.1.tar.gz' -O- | tar xz rgbds/{include,src,Makefile} 19 | pushd rgbds 20 | make -j4 rgbasm rgblink rgbfix Q= 21 | popd 22 | 23 | wget https://github.com/gbdk-2020/gbdk-2020/releases/download/4.1.1/gbdk-linux64.tar.gz -O- | tar xz 24 | 25 | - name: Check out hUGEDriver 26 | uses: actions/checkout@v4 27 | with: 28 | path: hUGEDriver 29 | 30 | - name: Build distribution 31 | shell: bash 32 | run: | 33 | export PATH=$PATH:`realpath gbdk/bin` 34 | export PATH=$PATH:`realpath rgbds` 35 | 36 | pushd hUGEDriver 37 | rgbasm -DGBDK -ohUGEDriver.obj hUGEDriver.asm 38 | python ./tools/rgb2sdas.py -o hUGEDriver.o hUGEDriver.obj 39 | sdar -ru hUGEDriver.lib hUGEDriver.o 40 | popd 41 | 42 | mkdir packaging 43 | mkdir packaging/rgbds 44 | mkdir packaging/gbdk 45 | 46 | cp hUGEDriver/hUGEDriver.asm packaging/rgbds/ 47 | cp -R hUGEDriver/include/ packaging/ 48 | cp hUGEDriver/hUGEDriver.lib packaging/gbdk/ 49 | 50 | rm packaging/include/hardware.inc 51 | 52 | - name: Store build 53 | uses: actions/upload-artifact@v4 54 | with: 55 | name: hUGEDriver 56 | path: packaging/ 57 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.map 2 | *.gb 3 | *.gbs 4 | *.sym 5 | *.obj 6 | *.o 7 | *.lnk 8 | obj/ 9 | *.htt 10 | *.exe 11 | *.bak 12 | *.lib 13 | 14 | rgbasm 15 | rgbfix 16 | rgblink 17 | 18 | !rgb2sdas.exe -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![hUGEDriver](https://github.com/SuperDisk/hUGEDriver/assets/1688837/a6079751-20b5-4db3-bb48-0e748234f8ca) 2 | === 3 | 4 | This is the repository for hUGEDriver, the music driver for the Game Boy which plays music created in [hUGETracker](https://github.com/SuperDisk/hUGETracker). 5 | 6 | If you want help using the tracker, driver, or just want to chat, join the [hUGETracker Discord server!](https://discord.gg/abbHjEj5WH) 7 | 8 | ## Quick start (RGBDS) 9 | 10 | 1. Export your song in "RGBDS .asm" format in hUGETracker. 11 | 2. Choose a *song descriptor* name. This is what you will refer to the song as in your code. It must be a valid RGBDS symbol. 12 | 3. Place the exported `.asm` file in your RGBDS project. 13 | 4. Load `hl` with your song descriptor name, and `call hUGE_init` 14 | 5. In your game's main loop or in a VBlank interrupt, `call hUGE_dosound` 15 | 6. When assembling your game, be sure to specify your music file and hUGEDriver.asm in your call to `rgbasm`/`rgblink`! 16 | 17 | Be sure to enable sound playback before you start! 18 | 19 | ```asm 20 | ld a, $80 21 | ld [rAUDENA], a 22 | ld a, $FF 23 | ld [rAUDTERM], a 24 | ld a, $77 25 | ld [rAUDVOL], a 26 | ``` 27 | 28 | See the `rgbds_example` directory for a working example! 29 | 30 | ## Quick start (GBDK) 31 | 32 | 1. Export your song in "GBDK .c" format in hUGETracker. 33 | 2. Choose a *song descriptor* name. This is what you will refer to the song as in your code. It must be a valid C variable name. 34 | 3. Place the exported .C file in your GBDK project. 35 | 4. `#include "hUGEDriver.h"` in your game's main file 36 | 5. Define `extern const hUGESong_t your_song_descriptor_here` in your game's main file 37 | 6. Call `hUGE_init(&your_song_descriptor_here)` in your game's main file 38 | 7. In your game's main loop or in a VBlank interrupt, call `hUGE_dosound` 39 | 8. When compiling your game, be sure to specify your music file and `hUGEDriver.o` in your call to `lcc`! 40 | 41 | Be sure to enable sound playback before you start! 42 | 43 | ```c 44 | NR52_REG = 0x80; 45 | NR51_REG = 0xFF; 46 | NR50_REG = 0x77; 47 | ``` 48 | 49 | See `gbdk_example/src/gbdk_player_example.c` for a working example! 50 | 51 | ## Usage 52 | 53 | This driver is suitable for use in homebrew games. hUGETracker exports data representing the various components of a song, as well as a *song descriptor* which is a small block of pointers that tell the driver how to initialize and play a song. 54 | 55 | hUGETracker can export the data and song descriptor as a `.asm` or `.c` for use in RGBDS or GBDK based projects, respectively. Playing a song is as simple as calling hUGE_init with a pointer to your song descriptor, and then calling `hUGE_dosound` at a regular interval (usually on VBlank, the timer interrupt, or simply in your game's main loop) 56 | 57 | In assembly: 58 | ```asm 59 | ld hl, SONG_DESCRIPTOR 60 | call hUGE_init 61 | 62 | ;; Repeatedly 63 | call hUGE_dosound 64 | ``` 65 | 66 | In C: 67 | ```c 68 | extern const hUGESong_t song; 69 | 70 | // In your initializtion code 71 | __critical { 72 | hUGE_init(&song); 73 | add_VBL(hUGE_dosound); 74 | } 75 | ``` 76 | 77 | Check out `player.asm` for a full fledged example of how to use the driver in an RGBDS project, and `gbdk_example/gbdk_player_example.c` for usage with GBDK C likewise. 78 | 79 | ### `hUGE_mute_channel` 80 | 81 | **Caution**: 82 | As an optimization, hUGEDriver avoids loading the same wave present in wave RAM; when "muting" CH3 and loading your own wave, make sure to set `hUGE_current_wave` to `hUGE_NO_WAVE` (a dummy value) to force a refresh. 83 | 84 | ## License 85 | 86 | hUGETracker and hUGEDriver are dedicated to the public domain. 87 | -------------------------------------------------------------------------------- /doc/driver-format.txt: -------------------------------------------------------------------------------- 1 | A hUGEDriver pattern is a series of 64 rows in this format: 2 | 3 | Note Instr Effect 4 | NNNNNNNN, IIIIEEEE, XXXXYYYY 5 | 6 | where 7 | 8 | N = Note code 9 | I = Instrument code 10 | E = Effect code 11 | X = Effect param 1 12 | Y = Effect param 2 13 | 14 | A hUGEDriver table is a series of 16 rows in this format: 15 | 16 | Note Instr Effect 17 | NNNNNNNN, IIIIEEEE, XXXXYYYY 18 | 19 | where 20 | 21 | N = Note code 22 | I = Jump number 23 | E = Effect code 24 | X = Effect param 1 25 | Y = Effect param 2 26 | 27 | If the note code is greater than 71 then it's considered to be an empty note cell. 28 | 29 | 00 is an empty instrument cell. 30 | 31 | 000 is an empty effect cell. 32 | 33 | Effect list 34 | 35 | 0 - Arpeggio 36 | 1 - Slide up 37 | 2 - Slide down 38 | 3 - Toneporta 39 | 4 - Vibrato 40 | 5 - Set master volume 41 | 6 - Call routine 42 | 7 - Note delay 43 | 8 - Set panning 44 | 9 - Set duty cycle 45 | A - Volslide 46 | B - Position jump 47 | C - Set volume 48 | D - Pattern break 49 | E - Note cut 50 | F - Set speed 51 | 52 | Instrument formats 53 | 54 | -=-=-Square-=-=- 55 | 1: Sweep NR10 56 | 2: Length NR11 57 | 3: Envelope NR12 58 | 4: Highmask (%xytttttt) where X is set if it is a trigger note 59 | (should always be 1) and Y is the length enabled flag 60 | and T is the table number 61 | 62 | -=-=-Wave-=-=- 63 | 1: Length NR31 64 | 2: Sound level NR32 65 | 3: Waveform number associated with this instrument 66 | 4: Highmask as shown before 67 | 68 | -=-=-Noise-=-=- 69 | 1: Envelope NR42 70 | 2: Highmask + Length combined; 1 bit for counter step, 1 bit for length enabled, followed by the length itself 71 | 3: Table 72 | -------------------------------------------------------------------------------- /doc/internals.md: -------------------------------------------------------------------------------- 1 | # hUGEDriver internals 2 | 3 | ## Code style 4 | 5 | - Comments are Lisp-style: 6 | - Comments on the same line as code use one semicolon. 7 | - Stand-alone comments within code blocks use two semicolons. 8 | - Stand-alone comments outside of code blocks use three semicolons. 9 | 10 | - Every function should be preceded with a **doc comment**: 11 | - Doc comments use triple backticks (as per above). 12 | - Doc comments begin with a possibly multi-line description of the function's behavior. 13 | - Parameters, if any, follow, with the following format: `;; Param: (condition) WHAT = Descr.`. 14 | `WHAT` can be a register (`B`), a flag (`ZF`), or a memory address (`[param]`). 15 | (For the latter, the description should indicate the variable's size.) 16 | 17 | `Descr.` can be made multi-line if properly aligned (with spaces, of course) to the beginning of its first line. 18 | It must be proper sentences, periods included! 19 | - Return value(s), if any, follow, with the following format: `;; Return: WHAT = Descr.`. 20 | Format is essentially identical to parameters. 21 | - Lastly, if applicable, anything destroyed follows, with the following format: `;; Destroy: WHAT`. 22 | `WHAT` must be a space-separated list of things like for parameters and return values. 23 | 24 | Anything modified that isn't a `Return:` should be considered as destroyed. 25 | 26 | Specifying `F` as destroyed means that all flags are destroyed; otherwise, any flag not listed is preserved. 27 | All variables clobbered need not be documented, but use your best judgement. 28 | - Register and flag names must be uppercase. 29 | 30 | - `hl+` and `hl-`, not `hli` and `hld`. 31 | 32 | - Instructions using A as implicit left-hand operand (`add`, `adc`, `sub`, `sbc`, `cp`, `and`, `or`, `xor`) must not specify A. 33 | -------------------------------------------------------------------------------- /gbdk_example/Makefile: -------------------------------------------------------------------------------- 1 | # If you move this project and don't have GBDK_HOME environment variable set, 2 | # you can change the directory to match your GBDK root directory (ex: GBDK_HOME = "/GBDK/") 3 | 4 | ifndef GBDK_HOME 5 | GBDK_HOME = ../gbdk 6 | endif 7 | 8 | CC = $(GBDK_HOME)/bin/lcc 9 | SDAR = $(GBDK_HOME)/bin/sdar 10 | 11 | # If you move this project and don't have RGBDS_HOME environment variable set, 12 | # you can change the directory to match your RGBDS root directory (ex: RGBDS_HOME = "/RGBDS/" 13 | 14 | ifndef RGBDS_HOME 15 | RGBDS_HOME = ../rgbds 16 | endif 17 | 18 | RGBASM = $(RGBDS_HOME)/rgbasm 19 | 20 | EXAMPLE_DIR = ./build 21 | BUILD_DIR = ./lib 22 | OBJ_DIR = ./obj 23 | 24 | LIB_NAME = hUGEDriver.lib 25 | 26 | TOOLS_DIR = ../tools 27 | 28 | RGB2SDAS = python $(TOOLS_DIR)/rgb2sdas.py 29 | RGB2SDASFLAGS = -b 0 30 | 31 | TARGET = $(BUILD_DIR)/$(LIB_NAME) 32 | OBJS = $(OBJ_DIR)/hUGEDriver.o 33 | 34 | EXAMPLE = $(EXAMPLE_DIR)/gbdk_player_example.gb 35 | 36 | all: directories $(TARGET) $(EXAMPLE) 37 | 38 | directories: $(EXAMPLE_DIR) $(BUILD_DIR) $(OBJ_DIR) 39 | 40 | $(OBJ_DIR): 41 | mkdir -p $(OBJ_DIR) 42 | 43 | $(BUILD_DIR): 44 | mkdir -p $(BUILD_DIR) 45 | 46 | $(EXAMPLE_DIR): 47 | mkdir -p $(EXAMPLE_DIR) 48 | 49 | $(OBJ_DIR)/%.obj: ../%.asm 50 | $(RGBASM) -i.. -DGBDK -o$@ $< 51 | 52 | $(OBJ_DIR)/%.o: $(OBJ_DIR)/%.obj 53 | $(RGB2SDAS) $(RGB2SDASFLAGS) -o$@ $< 54 | 55 | $(TARGET): $(OBJS) 56 | $(SDAR) -ru $@ $^ 57 | 58 | $(EXAMPLE): $(TARGET) 59 | $(CC) -I../include -Wl-l$(TARGET) -o $@ src/gbdk_player_example.c src/sample_song.c 60 | 61 | clean: 62 | @echo "CLEANUP..." 63 | rm -rf $(OBJ_DIR) 64 | rm -rf $(BUILD_DIR) 65 | rm -rf $(EXAMPLE_DIR) 66 | -------------------------------------------------------------------------------- /gbdk_example/README.md: -------------------------------------------------------------------------------- 1 | This is a simple example of how to use hUGEDriver in your GBDK-2020 game. 2 | 3 | Make sure you have both GBDK and RGBDS in your path, then run `build.bat` to build a .gb file which plays some music! 4 | 5 | You can run `build\gbdk_player_example.gb` in your favorite Game Boy emulator. 6 | -------------------------------------------------------------------------------- /gbdk_example/build.bat: -------------------------------------------------------------------------------- 1 | mkdir obj 2 | mkdir build 3 | mkdir lib 4 | 5 | :: Assemble the hUGEDriver source into an RGBDS object file 6 | rgbasm -DGBDK -o./obj/hUGEDriver.obj -i.. ../hUGEDriver.asm 7 | 8 | :: Convert the RGBDS object file into a GBDK object file 9 | python ..\tools\rgb2sdas.py -o obj/hUGEDriver.o obj/hUGEDriver.obj 10 | 11 | :: Make the library 12 | sdar -ru lib/hUGEDriver.lib obj/hUGEDriver.o 13 | 14 | :: Build the rom! 15 | lcc -I../include -Wl-llib/hUGEDriver.lib -o build/gbdk_player_example.gb src/gbdk_player_example.c src/sample_song.c 16 | -------------------------------------------------------------------------------- /gbdk_example/src/gbdk_player_example.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hUGEDriver.h" 3 | 4 | extern const hUGESong_t sample_song; 5 | 6 | UBYTE joy; 7 | UBYTE c0 = 0, c1 = 0, c2 = 0, c3 = 0; 8 | 9 | const unsigned char pattern1[] = {0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x02,0x02,0x01,0x01}; 10 | const unsigned char pattern2[] = {0x00,0x00,0x7E,0x7E,0x40,0x40,0x54,0x54,0x48,0x48,0x54,0x54,0x40,0x40,0x00,0x00}; 11 | const unsigned char map[] = {0x00,0x20}; 12 | 13 | void main(void) { 14 | LCDC_REG = 0xD1; 15 | BGP_REG = 0b11100100; 16 | NR52_REG = 0x80; 17 | NR51_REG = 0xFF; 18 | NR50_REG = 0x77; 19 | 20 | set_bkg_data(0, 1, pattern1); 21 | set_bkg_data(0x20, 1, pattern2); 22 | 23 | __critical { 24 | hUGE_init(&sample_song); 25 | add_VBL(hUGE_dosound); 26 | } 27 | 28 | while(1) { 29 | wait_vbl_done(); 30 | joy = joypad(); 31 | switch (joy) { 32 | case J_UP : c0 ^= 1; hUGE_mute_channel(HT_CH1, c0); set_bkg_tiles(0,0,1,1,&map[c0 & 1]); waitpadup(); break; 33 | case J_DOWN : c1 ^= 1; hUGE_mute_channel(HT_CH2, c1); set_bkg_tiles(1,0,1,1,&map[c1 & 1]); waitpadup(); break; 34 | case J_LEFT : c2 ^= 1; hUGE_mute_channel(HT_CH3, c2); set_bkg_tiles(2,0,1,1,&map[c2 & 1]); waitpadup(); break; 35 | case J_RIGHT : c3 ^= 1; hUGE_mute_channel(HT_CH4, c3); set_bkg_tiles(3,0,1,1,&map[c3 & 1]); waitpadup(); break; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /gbs.asm: -------------------------------------------------------------------------------- 1 | include "include/hardware.inc" 2 | 3 | SECTION "GBS Header", ROM0[$0] 4 | db "GBS" ; magic 5 | db 1 ; version (always 1) 6 | db 1 ; num songs 7 | db 1 ; first song 8 | dw $70+$400 ; load address 9 | dw gbs_init ; init address 10 | dw _hUGE_dosound ; play address 11 | dw $fffe ; stack pointer 12 | db TIMER_MODULO ; timer modulo 13 | db TIMER_CONTROL ; timer control 14 | db "{GBS_TITLE}" 15 | db "{GBS_AUTHOR}" 16 | db "{GBS_COPYRIGHT}" 17 | 18 | ds $400 ; padding bytes that will be removed manually 19 | 20 | SECTION "Code", ROM0[$70+$400] 21 | gbs_init: 22 | ; Enable sound globally 23 | ld a, $80 24 | ld [rAUDENA], a 25 | ; Enable all channels in stereo 26 | ld a, $FF 27 | ld [rAUDTERM], a 28 | ; Set volume 29 | ld a, $77 30 | ld [rAUDVOL], a 31 | 32 | ld hl, SONG_DESCRIPTOR 33 | jp hUGE_init 34 | -------------------------------------------------------------------------------- /hUGEDriver.asm: -------------------------------------------------------------------------------- 1 | include "include/hardware.inc" 2 | include "include/hUGE.inc" 3 | 4 | MACRO add_a_to_r16 5 | add LOW(\1) 6 | ld LOW(\1), a 7 | adc HIGH(\1) 8 | sub LOW(\1) 9 | ld HIGH(\1), a 10 | ENDM 11 | 12 | ;; Thanks PinoBatch! 13 | MACRO sub_from_r16 ;; (high, low, value) 14 | ld a, \2 15 | sub \3 16 | ld \2, a 17 | sbc a ; A = -1 if borrow or 0 if not 18 | add \1 19 | ld \1, a 20 | ENDM 21 | 22 | MACRO retMute 23 | bit \1, a 24 | ret nz 25 | ENDM 26 | 27 | MACRO checkMute 28 | ld a, [mute_channels] 29 | bit \1, a 30 | jr nz, \2 31 | ENDM 32 | 33 | ;; Maximum pattern length 34 | DEF PATTERN_LENGTH EQU 64 35 | 36 | SECTION "Playback variables", WRAM0 37 | ;; Active song descriptor 38 | order_cnt: db 39 | _start_song_descriptor_pointers: 40 | ;; Pointers to the song's current four orders (one per channel) 41 | order1: dw 42 | order2: dw 43 | order3: dw 44 | order4: dw 45 | 46 | ;; Pointers to the instrument tables 47 | duty_instruments: dw 48 | wave_instruments: dw 49 | noise_instruments: dw 50 | 51 | ;; Misc. pointers 52 | routines: dw 53 | waves: dw 54 | _end_song_descriptor_pointers: 55 | 56 | ;; Pointers to the current patterns (sort of a cache) 57 | pattern1: dw 58 | pattern2: dw 59 | pattern3: dw 60 | pattern4: dw 61 | 62 | ;; How long a row lasts in ticks (1 = one row per call to `hUGE_dosound`, etc. 0 translates to 256) 63 | ticks_per_row: db 64 | 65 | _hUGE_current_wave:: 66 | hUGE_current_wave:: 67 | ;; ID of the wave currently loaded into wave RAM 68 | current_wave: db 69 | def hUGE_NO_WAVE equ 100 70 | EXPORT hUGE_NO_WAVE 71 | 72 | ;; Everything between this and `end_zero` is zero-initialized by `hUGE_init` 73 | start_zero: 74 | 75 | _hUGE_mute_mask:: 76 | mute_channels: db 77 | 78 | counter: db 79 | tick: db 80 | row_break: db 81 | next_order: db 82 | row: db 83 | current_order: db 84 | 85 | IF DEF(PREVIEW_MODE) 86 | loop_order: db 87 | single_stepping: db 88 | single_step_stopped: db 89 | ENDC 90 | 91 | channels: 92 | ;;;;;;;;;;; 93 | ;;Channel 1 94 | ;;;;;;;;;;; 95 | channel1: 96 | channel_period1: dw 97 | toneporta_target1: dw 98 | channel_note1: db 99 | highmask1: db 100 | vibrato_tremolo_phase1: db 101 | envelope1: db 102 | table1: dw 103 | table_row1: db 104 | ds 5 105 | 106 | ;;;;;;;;;;; 107 | ;;Channel 2 108 | ;;;;;;;;;;; 109 | channel2: 110 | channel_period2: dw 111 | toneporta_target2: dw 112 | channel_note2: db 113 | highmask2: db 114 | vibrato_tremolo_phase2: db 115 | envelope2: db 116 | table2: dw 117 | table_row2: db 118 | ds 5 119 | 120 | ;;;;;;;;;;; 121 | ;;Channel 3 122 | ;;;;;;;;;;; 123 | channel3: 124 | channel_period3: dw 125 | toneporta_target3: dw 126 | channel_note3: db 127 | highmask3: db 128 | vibrato_tremolo_phase3: db 129 | envelope3: db 130 | table3: dw 131 | table_row3: db 132 | ds 5 133 | 134 | ;;;;;;;;;;; 135 | ;;Channel 4 136 | ;;;;;;;;;;; 137 | channel4: 138 | channel_period4: dw 139 | toneporta_target4: dw 140 | channel_note4: db 141 | highmask4: db 142 | step_width4: db 143 | vibrato_tremolo_phase4: db 144 | envelope4: db 145 | table4: dw 146 | table_row4: db 147 | ds 4 148 | 149 | end_zero: 150 | 151 | SECTION "Sound Driver", ROM0 152 | 153 | IF DEF(GBDK) 154 | _hUGE_init:: 155 | ld h, d 156 | ld l, e 157 | ENDC 158 | 159 | ;;; Sets up hUGEDriver to play a song. 160 | ;;; !!! BE SURE THAT `hUGE_dosound` WILL NOT BE CALLED WHILE THIS RUNS !!! 161 | ;;; Param: HL = Pointer to the "song descriptor" you wish to load (typically exported by hUGETracker). 162 | ;;; Destroys: AF C DE HL 163 | hUGE_init:: 164 | ld a, [hl+] ; tempo 165 | ld [ticks_per_row], a 166 | 167 | ld a, [hl+] 168 | ld e, a 169 | ld a, [hl+] 170 | ld d, a 171 | ld a, [de] 172 | ld [order_cnt], a 173 | 174 | ld c, _end_song_descriptor_pointers - (_start_song_descriptor_pointers) 175 | ld de, order1 176 | 177 | .copy_song_descriptor_loop: 178 | ld a, [hl+] 179 | ld [de], a 180 | inc de 181 | dec c 182 | jr nz, .copy_song_descriptor_loop 183 | 184 | IF !DEF(PREVIEW_MODE) 185 | ;; Zero some ram 186 | ld c, end_zero - start_zero 187 | ld hl, start_zero 188 | xor a 189 | .fill_loop: 190 | ld [hl+], a 191 | dec c 192 | jr nz, .fill_loop 193 | ENDC 194 | 195 | ;; These two are zero-initialized by the loop above, so these two writes must come after 196 | ld a, %11110000 197 | ld [envelope1], a 198 | ld [envelope2], a 199 | 200 | ;; Force loading the next wave 201 | ld a, hUGE_NO_WAVE 202 | ld [current_wave], a 203 | 204 | ;; Preview mode needs to load the order ID from memory 205 | IF !DEF(PREVIEW_MODE) 206 | ld c, 0 207 | ELSE 208 | ld a, [current_order] 209 | ld c, a 210 | ENDC 211 | ;; fallthrough (load the pattern pointers) 212 | 213 | ;;; Sets all 4 pattern pointers from a certain index in the respective 4 orders. 214 | ;;; Param: C = The index (in increments of 2) 215 | ;;; Destroy: AF DE HL 216 | load_patterns: 217 | IF DEF(PREVIEW_MODE) 218 | db $fc ; signal order update to tracker 219 | ENDC 220 | 221 | ld hl, order1 222 | ld de, pattern1 223 | call .load_pattern 224 | 225 | ld hl, order2 226 | call .load_pattern 227 | 228 | ld hl, order3 229 | call .load_pattern 230 | 231 | ld hl, order4 232 | ;; fallthrough 233 | 234 | .load_pattern: 235 | ld a, [hl+] 236 | add c 237 | ld h, [hl] 238 | ld l, a 239 | adc h 240 | sub l 241 | ld h, a 242 | 243 | ld a, [hl+] 244 | ld [de], a 245 | inc de 246 | ld a, [hl] 247 | ld [de], a 248 | inc de 249 | ret 250 | 251 | IF DEF(GBDK) 252 | _hUGE_mute_channel:: 253 | ld b, a 254 | ld c, e 255 | ENDC 256 | 257 | ;;; Sets a channel's muting status. 258 | ;;; Muted channels are left entirely alone by the driver, so that you can repurpose them, 259 | ;;; for example for sound effects, CH3 sample playback, etc. 260 | ;;; If muting the channel, the note being played will be cut. 261 | ;;; Param: B = Which channel to enable; 0 for CH1, 1 for CH2, etc. 262 | ;;; Param: C = 0 to unmute the channel, 1 to mute it 263 | ;;; Destroy: A C E HL 264 | hUGE_mute_channel:: 265 | ld e, $fe 266 | ld a, b 267 | or a 268 | jr z, .enable_cut 269 | .enable_loop: 270 | sla c 271 | rlc e 272 | dec a 273 | jr nz, .enable_loop 274 | .enable_cut: 275 | ld a, [mute_channels] 276 | and e 277 | or c 278 | ld [mute_channels], a 279 | and c 280 | jp nz, note_cut 281 | ret 282 | 283 | 284 | ;;; Reads a pattern's current row. 285 | ;;; Param: BC = Pointer to the pattern 286 | ;;; Param: [row] = Index of the current row 287 | ;;; Return: A = Note ID 288 | ;;; Return: B = Instrument (upper nibble) & effect code (lower nibble) 289 | ;;; Return: C = Effect parameter 290 | ;;; Destroy: HL 291 | get_current_row: 292 | ld a, [row] 293 | .row_in_a: 294 | ld h, a 295 | ;; Multiply by 3 for the note value 296 | add h 297 | add h 298 | 299 | ld h, 0 300 | ld l, a 301 | add hl, bc ; HL now points at the 3rd byte of the note 302 | ld a, [hl+] 303 | ld b, [hl] 304 | inc hl 305 | ld c, [hl] 306 | ret 307 | 308 | ;;; Gets the "period" of a pattern's current note. 309 | ;;; Param: HL = Pointer to the pattern pointer 310 | ;;; Param: [row] = Index of the current row 311 | ;;; Param: DE = Location to write the note's index to, if applicable 312 | ;;; Return: HL = Note's period 313 | ;;; Return: CF = Set if and only if a "valid" note (i.e. not a "rest") 314 | ;;; Return: [DE] = Note's ID, not updated if a "rest" 315 | ;;; Return: B = Instrument (upper nibble) & effect code (lower nibble) 316 | ;;; Return: C = Effect parameter 317 | ;;; Destroy: AF 318 | get_current_note: 319 | ld a, [hl+] 320 | ld c, a 321 | ld b, [hl] 322 | 323 | call get_current_row 324 | ld hl, 0 325 | 326 | ;; If the note we found is greater than LAST_NOTE, then it's not a valid note 327 | ;; and nothing needs to be updated. 328 | cp LAST_NOTE 329 | ret nc 330 | 331 | ;; Store the loaded note value in channel_noteX 332 | ld [de], a 333 | 334 | ;;; Gets a note's "period", i.e. what should be written to NRx3 and NRx4. 335 | ;;; Param: A = Note ID 336 | ;;; Return: HL = Note's period 337 | ;;; Return: CF = 1 338 | ;;; Destroy: AF 339 | get_note_period: 340 | add a ; double it to get index into hi/lo table 341 | add LOW(note_table) 342 | ld l, a 343 | adc HIGH(note_table) 344 | sub l 345 | ld h, a 346 | ld a, [hl+] 347 | ld h, [hl] 348 | ld l, a 349 | 350 | scf 351 | ret 352 | 353 | ;;; Gets a note's "polynomial counter", i.e. what should be written to NR44. 354 | ;;; Param: A = Note ID 355 | ;;; Return: A = Note's poly 356 | ;;; Destroy: F HL 357 | get_note_poly: 358 | ;; Invert the order of the numbers 359 | add 192 ; (255 - 63) 360 | cpl 361 | 362 | ;; Thanks to RichardULZ for this formula 363 | ;; https://docs.google.com/spreadsheets/d/1O9OTAHgLk1SUt972w88uVHp44w7HKEbS/edit#gid=75028951 364 | ; if A > 7 then begin 365 | ; B := (A-4) div 4; 366 | ; C := (A mod 4)+4; 367 | ; A := (C or (B shl 4)) 368 | ; end; 369 | 370 | ; if A < 7 then return 371 | cp 7 372 | ret c 373 | 374 | ld h, a 375 | 376 | ; B := (A-4) div 4; 377 | srl a 378 | srl a 379 | dec a 380 | ld l, a 381 | 382 | ; C := (A mod 4)+4; 383 | ld a, h 384 | and 3 ; mod 4 385 | add 4 386 | 387 | ; A := (C or (B shl 4)) 388 | swap l 389 | or l 390 | ret 391 | 392 | 393 | ;;; Computes the pointer to a member of a channel. 394 | ;;; Param: B = Which channel (0 = CH1, 1 = CH2, etc.) 395 | ;;; Param: D = Offset within the channel struct 396 | ;;; Return: HL = Pointer to the channel's member 397 | ;;; Destroy: AF 398 | ptr_to_channel_member: 399 | ld a, b 400 | swap a 401 | add d 402 | add LOW(channels) 403 | ld l, a 404 | adc HIGH(channels) 405 | sub l 406 | ld h, a 407 | ret 408 | 409 | 410 | ;; TODO: Make this take HL instead of DE 411 | 412 | ;;; Updates a channel's frequency, and possibly restarts it. 413 | ;;; Note that CH4 is *never* restarted by this! 414 | ;;; Param: B = Which channel to update (0 = CH1, 1 = CH2, etc.) 415 | ;;; Param: (for CH4) E = Note ID 416 | ;;; Param: (otherwise) DE = Note period 417 | ;;; Destroy: AF C 418 | ;;; Destroy: (for CH4) HL 419 | update_channel_freq: 420 | ld h, 0 421 | .nonzero_highmask: 422 | ld c, b 423 | ld a, [mute_channels] 424 | dec c 425 | jr z, .update_channel2 426 | dec c 427 | jr z, .update_channel3 428 | dec c 429 | jr z, .update_channel4 430 | 431 | .update_channel1: 432 | retMute 0 433 | 434 | ld a, e 435 | ld [channel_period1], a 436 | ldh [rAUD1LOW], a 437 | ld a, d 438 | ld [channel_period1+1], a 439 | or h 440 | ldh [rAUD1HIGH], a 441 | ret 442 | 443 | .update_channel2: 444 | retMute 1 445 | 446 | ld a, e 447 | ld [channel_period2], a 448 | ldh [rAUD2LOW], a 449 | ld a, d 450 | ld [channel_period2+1], a 451 | or h 452 | ldh [rAUD2HIGH], a 453 | ret 454 | 455 | .update_channel3: 456 | retMute 2 457 | 458 | ld a, e 459 | ld [channel_period3], a 460 | ldh [rAUD3LOW], a 461 | ld a, d 462 | ld [channel_period3+1], a 463 | or h 464 | ldh [rAUD3HIGH], a 465 | ret 466 | 467 | .update_channel4: 468 | retMute 3 469 | 470 | ld d, h 471 | ld a, e 472 | call get_note_poly 473 | ld hl, step_width4 474 | or [hl] 475 | ldh [rAUD4POLY], a 476 | 477 | ld a, d 478 | ldh [rAUD4GO], a 479 | ret 480 | 481 | 482 | play_note_routines: 483 | jr play_ch1_note 484 | jr play_ch2_note 485 | jr play_ch3_note 486 | jr play_ch4_note 487 | 488 | play_ch1_note: 489 | ld a, [mute_channels] 490 | retMute 0 491 | 492 | ;; Play a note on channel 1 (square wave) 493 | ld hl, channel_period1 494 | ld a, [hl+] 495 | ldh [rAUD1LOW], a 496 | 497 | ;; Get the highmask and apply it. 498 | ld a, [highmask1] 499 | or [hl] 500 | ldh [rAUD1HIGH], a 501 | ret 502 | 503 | play_ch2_note: 504 | ld a, [mute_channels] 505 | retMute 1 506 | 507 | ;; Play a note on channel 2 (square wave) 508 | ld hl, channel_period2 509 | ld a, [hl+] 510 | ldh [rAUD2LOW], a 511 | 512 | ;; Get the highmask and apply it. 513 | ld a, [highmask2] 514 | or [hl] 515 | ldh [rAUD2HIGH], a 516 | ret 517 | 518 | play_ch3_note: 519 | ld a, [mute_channels] 520 | retMute 2 521 | 522 | ;; Triggering CH3 while it's reading a byte corrupts wave RAM. 523 | ;; To avoid this, we kill the wave channel (0 → NR30), then re-enable it. 524 | ;; This way, CH3 will be paused when we trigger it by writing to NR34. 525 | ;; TODO: what if `highmask3` bit 7 is not set, though? 526 | 527 | ldh a, [rAUDTERM] 528 | push af 529 | and %10111011 530 | ldh [rAUDTERM], a 531 | 532 | xor a 533 | ldh [rAUD3ENA], a 534 | cpl 535 | ldh [rAUD3ENA], a 536 | 537 | ;; Play a note on channel 3 (waveform) 538 | ld hl, channel_period3 539 | ld a, [hl+] 540 | ldh [rAUD3LOW], a 541 | 542 | ;; Get the highmask and apply it. 543 | ld a, [highmask3] 544 | or [hl] 545 | ldh [rAUD3HIGH], a 546 | 547 | pop af 548 | ldh [rAUDTERM], a 549 | 550 | ret 551 | 552 | play_ch4_note: 553 | ld a, [mute_channels] 554 | retMute 3 555 | 556 | ;; Play a "note" on channel 4 (noise) 557 | ld a, [channel_period4] 558 | ldh [rAUD4POLY], a 559 | 560 | ;; Get the highmask and apply it. 561 | ld a, [highmask4] 562 | ldh [rAUD4GO], a 563 | 564 | ret 565 | 566 | ;;; Executes a row of a table. 567 | ;;; Param: BC = Pointer to which table to run 568 | ;;; Param: [HL] = Which row the table is on 569 | ;;; Param: E = Which channel to run the table on 570 | do_table: 571 | ;; Increment the current row 572 | ld a, [hl] 573 | inc [hl] 574 | push hl 575 | 576 | ;; Grab the cell values, return if no note. 577 | ;; Save BC for doing effects. 578 | call get_current_row.row_in_a 579 | pop hl ; TODO: don't trash HL in the first place 580 | push bc 581 | 582 | ld d, a 583 | 584 | ;; If there's a jump, change the current row 585 | ld a, b 586 | and $F0 587 | bit 7, d 588 | jr z, .no_steal 589 | res 7, d 590 | set 0, a 591 | .no_steal: 592 | swap a 593 | jr z, .no_jump 594 | dec a 595 | ld [hl], a 596 | 597 | .no_jump: 598 | ld a, d 599 | ;; If there's no note, don't update channel frequencies 600 | cp NO_NOTE 601 | jr z, .no_note2 602 | 603 | sub 36 ; bring the number back in the range of -36, +35 604 | 605 | ld b, e 606 | ld e, a 607 | ld d, 4 608 | call ptr_to_channel_member 609 | ld a, e 610 | add [hl] 611 | inc hl 612 | ld d, [hl] 613 | 614 | ;; A = note index 615 | ;; B = channel 616 | ;; D = highmask 617 | ;; pushed = instrument/effect 618 | 619 | ;; If ch4, don't get note period (update_channel_freq gets the poly for us) 620 | ld e, a 621 | inc b 622 | bit 2, b 623 | ld c, d 624 | jr nz, .is_ch4 625 | 626 | call get_note_period 627 | ld d, h 628 | ld e, l 629 | .is_ch4: 630 | ld h, c 631 | res 7, h 632 | dec b 633 | call update_channel_freq.nonzero_highmask 634 | 635 | .no_note: 636 | ld e, b 637 | .no_note2: 638 | pop bc 639 | 640 | ld d, 1 641 | jr do_effect.no_set_offset 642 | 643 | ;;; Performs an effect on a given channel. 644 | ;;; Param: E = Channel ID (0 = CH1, 1 = CH2, etc.) 645 | ;;; Param: B = Effect type (upper 4 bits ignored) 646 | ;;; Param: C = Effect parameters (depend on FX type) 647 | ;;; Destroy: AF BC DE HL 648 | do_effect: 649 | ;; Return immediately if effect is 000 650 | ld d, 0 651 | .no_set_offset: 652 | ld a, b 653 | and $0F 654 | or c 655 | ret z 656 | 657 | ;; Strip the instrument bits off leaving only effect code 658 | ld a, b 659 | and $0F 660 | ;; Multiply by 2 to get offset into table 661 | add a 662 | 663 | add LOW(.jump) 664 | ld l, a 665 | adc HIGH(.jump) 666 | sub l 667 | ld h, a 668 | 669 | ld a, [hl+] 670 | ld h, [hl] 671 | ld l, a 672 | bit 0, d 673 | jr z, .no_offset 674 | inc hl 675 | .no_offset: 676 | ld b, e 677 | ld a, [tick] 678 | or a ; We can return right off the bat if it's tick zero 679 | jp hl 680 | 681 | .jump: 682 | ;; Jump table for effect 683 | dw fx_arpeggio ;0xy 684 | dw fx_porta_up ;1xy 685 | dw fx_porta_down ;2xy 686 | dw fx_toneporta ;3xy 687 | dw fx_vibrato ;4xy 688 | dw fx_set_master_volume ;5xy ; global 689 | dw fx_call_routine ;6xy 690 | dw fx_note_delay ;7xy 691 | dw fx_set_pan ;8xy ; global 692 | dw fx_set_duty ;9xy 693 | dw fx_vol_slide ;Axy 694 | dw fx_pos_jump ;Bxy ; global 695 | dw fx_set_volume ;Cxy 696 | dw fx_pattern_break ;Dxy ; global 697 | dw fx_note_cut ;Exy 698 | dw fx_set_speed ;Fxy ; global 699 | 700 | 701 | ;;; Processes (global) effect 5, "set master volume". 702 | ;;; Param: C = Value to write to NR50 703 | ;;; Param: ZF = Set if and only if on tick 0 704 | ;;; Destroy: A 705 | fx_set_master_volume: 706 | ret nz 707 | 708 | ld a, c 709 | ldh [rAUDVOL], a 710 | ret 711 | 712 | 713 | ;;; Processes effect 6, "call routine". 714 | ;;; Param: B = Current channel ID (0 = CH1, 1 = CH2, etc.) 715 | ;;; Param: C = Routine ID 716 | ;;; Param: A = Current tick 717 | ;;; Param: ZF = Set if and only if on tick 0 718 | ;;; Destroy: Anything the routine does 719 | fx_call_routine: 720 | nop ; In place of `ret cc`. Allows to be used in subpatterns 721 | 722 | ld hl, routines 723 | ld a, $0f 724 | and c 725 | add a 726 | add [hl] 727 | ld e, a 728 | inc hl 729 | ld a, $0 730 | adc [hl] 731 | ld h, a 732 | ld l, e 733 | 734 | ld a, [hl+] 735 | ld h, [hl] 736 | ld l, a 737 | 738 | ld d, b 739 | ld e, c ; SDCC compatibility 740 | 741 | ld a, [tick] 742 | or a ; set zero flag if tick 0 for compatibility 743 | jp hl 744 | 745 | 746 | ;;; Processes (global) effect 8, "set pan". 747 | ;;; Param: B = Current channel ID (0 = CH1, 1 = CH2, etc.) 748 | ;;; Param: C = Value to write to NR51 749 | ;;; Param: ZF = Set if and only if on tick 0 750 | ;;; Destroy: A 751 | fx_set_pan: 752 | ret nz 753 | 754 | ;; Pretty simple. The editor can create the correct value here without a bunch 755 | ;; of bit shifting manually. 756 | ld a, c 757 | ldh [rAUDTERM], a 758 | ret 759 | 760 | 761 | ;;; Processes effect 9, "set duty cycle". 762 | ;;; Param: B = Current channel ID (0 = CH1, anything else = CH2) 763 | ;;; Param: C = Value to write to NRx1 764 | ;;; Param: ZF = Set if and only if on tick 0 765 | ;;; Destroy: AF 766 | fx_set_duty: 767 | ret nz 768 | 769 | ;; $900 = 12.5% 770 | ;; $940 = 25% 771 | ;; $980 = 50% 772 | ;; $9C0 = 75% 773 | 774 | ld a, [mute_channels] 775 | dec b 776 | jr z, .chan2 777 | dec b 778 | jr z, .chan3 779 | dec b 780 | jr z, .chan4 781 | .chan1: 782 | retMute 0 783 | ld a, c 784 | ldh [rAUD1LEN], a 785 | ret 786 | .chan2: 787 | retMute 1 788 | ld a, c 789 | ldh [rAUD2LEN], a 790 | ret 791 | .chan4: 792 | retMute 3 793 | ldh a, [rAUD4POLY] 794 | res 3, a 795 | or c 796 | ldh [rAUD4POLY], a 797 | ret 798 | .chan3: 799 | retMute 2 800 | 801 | ld a, c 802 | ld hl, current_wave 803 | call update_ch3_waveform 804 | 805 | ld b, 2 806 | jp play_note 807 | 808 | update_ch3_waveform: 809 | ld [hl], a 810 | ;; Get pointer to new wave 811 | swap a 812 | ld hl, waves 813 | add [hl] 814 | inc hl 815 | ld h, [hl] 816 | ld l, a 817 | adc h 818 | sub l 819 | ld h, a 820 | 821 | ldh a, [rAUDTERM] 822 | push af 823 | and %10111011 824 | ldh [rAUDTERM], a 825 | 826 | xor a 827 | ldh [rAUD3ENA], a 828 | 829 | FOR OFS, 16 830 | ld a, [hl+] 831 | ldh [_AUD3WAVERAM + OFS], a 832 | ENDR 833 | 834 | ld a, %10000000 835 | ldh [rAUD3ENA], a 836 | 837 | pop af 838 | ldh [rAUDTERM], a 839 | 840 | ret 841 | 842 | ;;; Processes (global) effect F, "set speed". 843 | ;;; Param: C = New amount of ticks per row 844 | ;;; Param: ZF = Set if and only if on tick 0 845 | ;;; Destroy: A 846 | fx_set_speed: 847 | ret nz 848 | 849 | ld a, c 850 | ld [ticks_per_row], a 851 | ret 852 | 853 | 854 | IF DEF(GBDK) 855 | _hUGE_set_position:: 856 | ld c, a 857 | xor a 858 | ENDC 859 | 860 | hUGE_set_position:: 861 | ;;; Processes (global) effect B, "position jump". 862 | ;;; Param: C = ID of the order to jump to 863 | ;;; Destroy: A 864 | fx_pos_jump: 865 | ret nz 866 | 867 | ld hl, row_break 868 | 869 | or [hl] ; a = 0 since we know we're on tick 0 870 | jr nz, .already_broken 871 | ld [hl], 1 872 | .already_broken: 873 | inc hl 874 | ld [hl], c 875 | ret 876 | 877 | 878 | ;;; Processes (global) effect D, "pattern break". 879 | ;;; Param: C = ID of the next order's row to start on 880 | ;;; Destroy: A 881 | fx_pattern_break: 882 | ret nz 883 | 884 | ld a, c 885 | ld [row_break], a 886 | ret 887 | 888 | 889 | ;;; Processes effect E, "note cut". 890 | ;;; Param: B = Current channel ID (0 = CH1, 1 = CH2, etc.) 891 | ;;; Param: C = Tick to cut the note on 892 | ;;; Param: A = Current tick 893 | ;;; Destroy: A 894 | fx_note_cut: 895 | cp c 896 | ret nz 897 | 898 | ;; check channel mute 899 | 900 | ld a, b 901 | ;; 0 → $01, 1 → $02, 2 → $04, 3 → $05 902 | ;; Overall, these two instructions add 1 to the number. 903 | ;; However, the first instruction will generate a carry for inputs of $02 and $03; 904 | ;; the `adc` will pick the carry up, and "separate" 0 / 1 from 2 / 3 by an extra 1. 905 | ;; Luckily, this yields correct results for 0 ($01), 1 ($02), and 2 ($03 + 1 = $04). 906 | ;; We'll see about fixing 3 afterwards. 907 | add -2 908 | adc 3 909 | ;; After being shifted left, the inputs are $02, $04, $08 and $0A; all are valid BCD, 910 | ;; except for $0A. Since we just performed `add a`, DAA will correct the latter to $10. 911 | ;; (This should be correctly emulated everywhere, since the inputs are identical to 912 | ;; "regular" BCD.) 913 | ;; When shifting the results back, we'll thus get $01, $02, $04 and $08! 914 | add a 915 | daa 916 | rra 917 | ld d, a 918 | ld a, [mute_channels] 919 | cpl 920 | and d 921 | ret z 922 | 923 | ;; fallthrough 924 | 925 | 926 | ;;; Cuts note on a channel. 927 | ;;; Param: B = Current channel ID (0 = CH1, 1 = CH2, etc.) 928 | ;;; Destroy: AF HL 929 | note_cut: 930 | ld a, b 931 | add a 932 | add a 933 | add b ; multiply by 5 934 | add LOW(rAUD1ENV) 935 | ld l, a 936 | ld h, HIGH(rAUD1ENV) 937 | xor a 938 | ld [hl+], a 939 | ld a, b 940 | cp 2 941 | ret z ; return early if CH3-- no need to retrigger note 942 | 943 | ;; Retrigger note 944 | inc l ; Not `inc hl` because H stays constant (= $FF) 945 | ld [hl], $FF 946 | ret 947 | 948 | 949 | ;;; Processes effect C, "set volume". 950 | ;;; Param: B = Current channel ID (0 = CH1, 1 = CH2, etc.) 951 | ;;; Param: C = Volume to set the channel to 952 | ;;; Param: ZF = Set if and only if on tick 0 953 | ;;; Destroy: AF BC 954 | fx_set_volume: 955 | ret nz ; Return if we're not on tick zero. 956 | 957 | swap c 958 | ld a, [mute_channels] 959 | dec b 960 | jr z, .set_chn_2_vol 961 | dec b 962 | jr z, .set_chn_3_vol 963 | dec b 964 | jr z, .set_chn_4_vol 965 | 966 | .set_chn_1_vol: 967 | retMute 0 968 | 969 | ldh a, [rAUD1ENV] 970 | and %00001111 971 | or c 972 | ldh [rAUD1ENV], a 973 | jp play_ch1_note 974 | 975 | .set_chn_2_vol: 976 | retMute 1 977 | 978 | ldh a, [rAUD2ENV] 979 | and %00001111 980 | or c 981 | ldh [rAUD2ENV], a 982 | jp play_ch2_note 983 | 984 | .set_chn_3_vol: 985 | retMute 2 986 | 987 | ;; "Quantize" the more finely grained volume control down to one of 4 values. 988 | ld a, c 989 | cp 10 << 4 990 | jr nc, .one 991 | cp 5 << 4 992 | jr nc, .two 993 | or a 994 | jr z, .done ; Zero maps to zero 995 | .three: 996 | ld a, %01100000 997 | jr .done 998 | .two: 999 | ld a, %01000000 1000 | jr .done 1001 | .one: 1002 | ld a, %00100000 1003 | .done: 1004 | ldh [rAUD3LEVEL], a 1005 | ret 1006 | 1007 | .set_chn_4_vol: 1008 | retMute 3 1009 | 1010 | ld a, c 1011 | ldh [rAUD4ENV], a 1012 | jp play_ch4_note 1013 | 1014 | 1015 | ;;; Processes effect 4, "vibrato". 1016 | ;;; Param: B = Current channel ID (0 = CH1, 1 = CH2, etc.) 1017 | ;;; Param: C = FX param 1018 | ;;; Param: ZF = Set if and only if on tick 0 1019 | ;;; Destroy: AF B DE HL 1020 | fx_vibrato: 1021 | ret z 1022 | 1023 | ;; Extremely poor man's vibrato. 1024 | ;; Speed values: 1025 | ;; (0x0 = 1.0) 1026 | ;; (0x1 = 0.5) 1027 | ;; (0x3 = 0.25) 1028 | ;; (0x7 = 0.125) 1029 | ;; (0xf = 0.0625) 1030 | ld d, 4 1031 | call ptr_to_channel_member 1032 | 1033 | ld a, c 1034 | and %11110000 1035 | swap a 1036 | ld e, a 1037 | 1038 | ld a, [counter] 1039 | and e 1040 | ld a, [hl] 1041 | jr z, .go_up 1042 | .restore: 1043 | call get_note_period 1044 | ld d, h 1045 | ld e, l 1046 | jr .finish_vibrato 1047 | .go_up: 1048 | call get_note_period 1049 | ld a, c 1050 | and %00001111 1051 | add l 1052 | ld e, a 1053 | adc h 1054 | sub e 1055 | ld d, a 1056 | .finish_vibrato: 1057 | jp update_channel_freq 1058 | 1059 | 1060 | ;;; Processes effect 0, "arpeggio". 1061 | ;;; Param: B = Current channel ID (0 = CH1, 1 = CH2, etc.) 1062 | ;;; Param: C = Offsets in semitones (each nibble) 1063 | ;;; Param: ZF = Set if and only if on tick 0 1064 | ;;; Destroy: AF B DE HL 1065 | fx_arpeggio: 1066 | nop ; In place of `ret cc`. Allows to be used in subpatterns 1067 | 1068 | ld d, 4 1069 | call ptr_to_channel_member 1070 | ld d, [hl] 1071 | 1072 | ld a, [counter] 1073 | dec a 1074 | 1075 | ;; TODO: A crappy modulo, because it's not a multiple of four :( 1076 | 1077 | jr .test_greater_than_two 1078 | .greater_than_two: 1079 | sub 3 1080 | .test_greater_than_two: 1081 | cp 3 1082 | jr nc, .greater_than_two 1083 | 1084 | ;; Multiply by 2 to get offset into table 1085 | add a 1086 | 1087 | add LOW(.arp_options) 1088 | ld l, a 1089 | adc HIGH(.arp_options) 1090 | sub l 1091 | ld h, a 1092 | jp hl 1093 | 1094 | .arp_options: 1095 | jr .set_arp1 1096 | jr .set_arp2 1097 | ;; No `jr .reset_arp` 1098 | 1099 | .reset_arp: 1100 | ld a, d 1101 | jr .finish_skip_add 1102 | 1103 | .set_arp2: 1104 | ld a, c 1105 | swap a 1106 | db $FE ; cp gobbles next byte 1107 | 1108 | .set_arp1: 1109 | ld a, c 1110 | .finish_arp: 1111 | and %00001111 1112 | add d 1113 | .finish_skip_add: 1114 | call get_note_period 1115 | ld d, h 1116 | ld e, l 1117 | jp update_channel_freq 1118 | 1119 | 1120 | ;;; Processes effect 1, "portamento up". 1121 | ;;; Param: B = Current channel ID (0 = CH1, 1 = CH2, etc.) 1122 | ;;; Param: C = How many units to slide the pitch by per tick 1123 | ;;; Param: ZF = Set if and only if on tick 0 1124 | ;;; Destroy: A B DE HL 1125 | fx_porta_up: 1126 | ret z 1127 | 1128 | ld d, 0 1129 | call ptr_to_channel_member 1130 | 1131 | ;; Add C to 16-bit value at HL 1132 | ld a, [hl+] 1133 | add c 1134 | ld e, a 1135 | adc [hl] 1136 | sub e 1137 | ld d, a 1138 | 1139 | jp update_channel_freq 1140 | 1141 | 1142 | ;;; Processes (global) effect 2, "portamento down". 1143 | ;;; Param: B = Current channel ID (0 = CH1, 1 = CH2, etc.) 1144 | ;;; Param: C = How many units to slide the pitch down by per tick 1145 | ;;; Param: ZF = Set if and only if on tick 0 1146 | ;;; Destroy: A B DE HL 1147 | fx_porta_down: 1148 | ret z 1149 | 1150 | ld d, 0 1151 | call ptr_to_channel_member 1152 | 1153 | ;; Subtract C from 16-bit value at [HL] 1154 | ld a, [hl+] 1155 | sub c 1156 | ld e, a 1157 | sbc a 1158 | add [hl] 1159 | ld d, a 1160 | 1161 | jp update_channel_freq 1162 | 1163 | 1164 | ;;; Processes effect 2, "tone portamento". 1165 | ;;; Param: B = Current channel ID (0 = CH1, 1 = CH2, etc.) 1166 | ;;; Param: C = Target note 1167 | ;;; Param: ZF = Set if and only if on tick 0 1168 | ;;; Destroy: A B DE HL 1169 | fx_toneporta: 1170 | jr z, .setup 1171 | 1172 | ld d, 0 1173 | call ptr_to_channel_member 1174 | push hl 1175 | 1176 | ld a, [hl+] 1177 | ld e, a 1178 | ld a, [hl+] 1179 | ld d, a 1180 | 1181 | ld a, [hl+] 1182 | ld h, [hl] 1183 | ld l, a 1184 | 1185 | ;; Comparing which direction to move the current value 1186 | ;; TODO: Optimize this!!!! 1187 | 1188 | ;; Compare high byte 1189 | ld a, h 1190 | 1191 | cp d 1192 | jr c, .subtract ; target is less than the current period 1193 | jr nz, .add 1194 | .high_byte_same: 1195 | ld a, l 1196 | cp e 1197 | jr c, .subtract ; the target is less than the current period 1198 | jr z, .done ; both nibbles are the same so no portamento 1199 | .add: 1200 | ld a, c 1201 | add_a_to_r16 de 1202 | 1203 | ld a, h 1204 | cp d 1205 | jr c, .set_exact 1206 | jr nz, .done 1207 | ld a, l 1208 | cp e 1209 | jr c, .set_exact 1210 | 1211 | jr .done 1212 | 1213 | .subtract: 1214 | sub_from_r16 d, e, c 1215 | 1216 | bit 7, d ; check for overflow 1217 | jr nz, .set_exact 1218 | 1219 | ld a, d 1220 | cp h 1221 | jr c, .set_exact 1222 | jr nz, .done 1223 | ld a, e 1224 | cp l 1225 | jr c, .set_exact 1226 | 1227 | jr .done 1228 | .set_exact: 1229 | ld d, h 1230 | ld e, l 1231 | .done: 1232 | 1233 | pop hl 1234 | ld a, e 1235 | ld [hl+], a 1236 | ld [hl], d 1237 | 1238 | 1239 | ld a, 4 1240 | add_a_to_r16 hl 1241 | 1242 | ld a, [hl] 1243 | res 7, [hl] 1244 | ld h, a 1245 | ;; B must be preserved for this 1246 | jp update_channel_freq.nonzero_highmask 1247 | 1248 | .setup: 1249 | ;; We're on tick zero, so load the note period into the toneporta target. 1250 | ld d, 4 1251 | call ptr_to_channel_member 1252 | 1253 | ld a, [hl-] 1254 | ld d, h 1255 | ld e, l 1256 | call get_note_period 1257 | ld a, h 1258 | ld [de], a 1259 | dec de 1260 | ld a, l 1261 | ld [de], a 1262 | 1263 | ret_dont_play_note: 1264 | ;; Don't call play_chX_note. This is done by popping the saved AF register and clearing 1265 | ;; the C flag, which relies on the way the caller is implemented!! 1266 | pop hl 1267 | pop af 1268 | and a ; Clear carry to avoid calling `play_chX_note` 1269 | push af 1270 | jp hl 1271 | 1272 | 1273 | ;;; Processes effect A, "volume slide". 1274 | ;;; Param: B = Current channel ID (0 = CH1, 1 = CH2, etc.) 1275 | ;;; Param: C = FX param; either nibble should be 0, otherwise weird (unspecified) behavior may arise 1276 | ;;; Param: ZF = Set if and only if on tick 0 1277 | ;;; Destroy: AF C DE HL 1278 | fx_vol_slide: 1279 | ret nz 1280 | 1281 | ;; This is really more of a "retrigger note with lower volume" effect and thus 1282 | ;; isn't really that useful. Instrument envelopes should be used instead. 1283 | ;; Might replace this effect with something different if a new effect is 1284 | ;; ever needed. 1285 | 1286 | ;; check channel mute 1287 | 1288 | ld a, b 1289 | ;; 0 → $01, 1 → $02, 2 → $04, 3 → $05 1290 | ;; Overall, these two instructions add 1 to the number. 1291 | ;; However, the first instruction will generate a carry for inputs of $02 and $03; 1292 | ;; the `adc` will pick the carry up, and "separate" 0 / 1 from 2 / 3 by an extra 1. 1293 | ;; Luckily, this yields correct results for 0 ($01), 1 ($02), and 2 ($03 + 1 = $04). 1294 | ;; We'll see about fixing 3 afterwards. 1295 | add -2 1296 | adc 3 1297 | ;; After being shifted left, the inputs are $02, $04, $08 and $0A; all are valid BCD, 1298 | ;; except for $0A. Since we just performed `add a`, DAA will correct the latter to $10. 1299 | ;; (This should be correctly emulated everywhere, since the inputs are identical to 1300 | ;; "regular" BCD.) 1301 | ;; When shifting the results back, we'll thus get $01, $02, $04 and $08! 1302 | add a 1303 | daa 1304 | rra 1305 | ld d, a 1306 | ld a, [mute_channels] 1307 | cpl 1308 | and d 1309 | ret z 1310 | 1311 | ;; setup the up and down params 1312 | ld a, c 1313 | and %00001111 1314 | ld d, a 1315 | 1316 | ld a, c 1317 | and %11110000 1318 | ld e, a 1319 | swap e 1320 | 1321 | ; There are 5 bytes between each envelope register 1322 | ld a, b 1323 | add a 1324 | add a 1325 | add b 1326 | add LOW(rAUD1ENV) 1327 | ld c, a 1328 | 1329 | ldh a, [c] 1330 | and %11110000 1331 | swap a 1332 | sub d 1333 | jr nc, .cont1 1334 | xor a 1335 | .cont1: 1336 | add e 1337 | cp $10 1338 | jr c, .cont2 1339 | ld a, $F 1340 | .cont2: 1341 | swap a 1342 | ldh [c], a 1343 | 1344 | ; Go to rAUDxGO, which is 2 bytes after 1345 | inc c 1346 | inc c 1347 | ldh a, [c] 1348 | or %10000000 1349 | ldh [c], a 1350 | 1351 | jr play_note 1352 | 1353 | 1354 | ;;; Processes effect 7, "note delay". 1355 | ;;; Param: B = Current channel ID (0 = CH1, 1 = CH2, etc.) 1356 | ;;; Param: C = Amount of ticks by which to delay the note 1357 | ;;; Caveats: 0 never plays the note, and a delay longer than a row's duration skips the note entirely 1358 | ;;; Param: ZF = Set if and only if on tick 0 1359 | ;;; Destroy: AF D HL 1360 | fx_note_delay: 1361 | jr z, ret_dont_play_note 1362 | 1363 | cp c 1364 | ret nz ; wait until the correct tick to play the note 1365 | 1366 | ;; fallthrough 1367 | 1368 | 1369 | ;;; Plays a channel's current note. 1370 | ;;; Param: B = Which channel (0 = CH1, 1 = CH2, etc.) 1371 | ;;; Destroy: AF D HL 1372 | play_note: 1373 | ld a, b 1374 | add a 1375 | add LOW(play_note_routines) 1376 | ld l, a 1377 | adc HIGH(play_note_routines) 1378 | sub l 1379 | ld h, a 1380 | jp hl 1381 | 1382 | 1383 | ;;; Computes the pointer to an instrument. 1384 | ;;; Param: B = The instrument's ID 1385 | ;;; Param: HL = Instrument pointer table 1386 | ;;; Return: HL = Pointer to the instrument 1387 | ;;; Return: ZF = Set if and only if there was no instrument (ID == 0) 1388 | ;;; Destroy: AF 1389 | setup_instrument_pointer: 1390 | ld a, b 1391 | and %11110000 1392 | swap a 1393 | ret z ; If there's no instrument, then return early. 1394 | 1395 | dec a ; Instrument 0 is "no instrument" 1396 | .finish: 1397 | ;; Multiply by 6 1398 | add a 1399 | ld e, a 1400 | add a 1401 | add e 1402 | 1403 | add_a_to_r16 hl 1404 | 1405 | rla ; reset the Z flag 1406 | ret 1407 | 1408 | _hUGE_dosound:: 1409 | ;;; Ticks the sound engine once. 1410 | ;;; Destroy: AF BC DE HL 1411 | hUGE_dosound:: 1412 | IF DEF(PREVIEW_MODE) 1413 | ld a, [single_stepping] 1414 | ld hl, single_step_stopped 1415 | and [hl] 1416 | ret nz 1417 | ENDC 1418 | 1419 | ld a, [tick] 1420 | or a 1421 | jp nz, process_effects 1422 | 1423 | ;; Note playback 1424 | ld hl, pattern1 1425 | ld de, channel_note1 1426 | call get_current_note 1427 | 1428 | push af ; Save carry for conditonally calling note 1429 | jr nc, .do_setvol1 1430 | 1431 | ld a, b 1432 | and $0F 1433 | cp 3 ; If toneporta, don't load the channel period 1434 | jr z, .toneporta 1435 | ld a, l 1436 | ld [channel_period1], a 1437 | ld a, h 1438 | ld [channel_period1+1], a 1439 | .toneporta: 1440 | 1441 | ld hl, duty_instruments 1442 | ld a, [hl+] 1443 | ld h, [hl] 1444 | ld l, a 1445 | call setup_instrument_pointer 1446 | ld a, [highmask1] 1447 | res 7, a ; Turn off the "initial" flag 1448 | jr z, .write_mask1 1449 | 1450 | checkMute 0, .do_setvol1 1451 | 1452 | ld a, [hl+] 1453 | ldh [rAUD1SWEEP], a 1454 | ld a, [hl+] 1455 | ldh [rAUD1LEN], a 1456 | ld a, [hl+] 1457 | ldh [rAUD1ENV], a 1458 | ld a, [hl+] 1459 | ld [table1], a 1460 | ld a, [hl+] 1461 | ld [table1+1], a 1462 | xor a 1463 | ld [table_row1], a 1464 | 1465 | ld a, [hl] 1466 | 1467 | .write_mask1: 1468 | ld [highmask1], a 1469 | 1470 | .do_setvol1: 1471 | ld e, 0 1472 | call do_effect 1473 | 1474 | pop af 1475 | call c, play_ch1_note 1476 | 1477 | ld a, [table1] 1478 | ld c, a 1479 | ld a, [table1+1] 1480 | ld b, a 1481 | or c 1482 | ld hl, table_row1 1483 | ld e, 0 1484 | call nz, do_table 1485 | 1486 | process_ch2: 1487 | ;; Note playback 1488 | ld hl, pattern2 1489 | ld de, channel_note2 1490 | call get_current_note 1491 | 1492 | push af ; Save carry for conditonally calling note 1493 | jr nc, .do_setvol2 1494 | 1495 | ld a, b 1496 | and $0F 1497 | cp 3 ; If toneporta, don't load the channel period 1498 | jr z, .toneporta 1499 | ld a, l 1500 | ld [channel_period2], a 1501 | ld a, h 1502 | ld [channel_period2+1], a 1503 | .toneporta: 1504 | 1505 | ld hl, duty_instruments 1506 | ld a, [hl+] 1507 | ld h, [hl] 1508 | ld l, a 1509 | call setup_instrument_pointer 1510 | ld a, [highmask2] 1511 | res 7, a ; Turn off the "initial" flag 1512 | jr z, .write_mask2 1513 | 1514 | checkMute 1, .do_setvol2 1515 | 1516 | inc hl 1517 | 1518 | ld a, [hl+] 1519 | ldh [rAUD2LEN], a 1520 | ld a, [hl+] 1521 | ldh [rAUD2ENV], a 1522 | ld a, [hl+] 1523 | ld [table2], a 1524 | ld a, [hl+] 1525 | ld [table2+1], a 1526 | xor a 1527 | ld [table_row2], a 1528 | 1529 | ld a, [hl] 1530 | 1531 | .write_mask2: 1532 | ld [highmask2], a 1533 | 1534 | .do_setvol2: 1535 | ld e, 1 1536 | call do_effect 1537 | 1538 | pop af 1539 | call c, play_ch2_note 1540 | 1541 | ld a, [table2] 1542 | ld c, a 1543 | ld a, [table2+1] 1544 | ld b, a 1545 | or c 1546 | ld hl, table_row2 1547 | ld e, 1 1548 | call nz, do_table 1549 | 1550 | process_ch3: 1551 | ld hl, pattern3 1552 | ld de, channel_note3 1553 | call get_current_note 1554 | 1555 | push af ; Save carry for conditonally calling note 1556 | jp nc, .do_setvol3 1557 | 1558 | ld a, b 1559 | and $0F 1560 | cp 3 ; If toneporta, don't load the channel period 1561 | jr z, .toneporta 1562 | ld a, l 1563 | ld [channel_period3], a 1564 | ld a, h 1565 | ld [channel_period3+1], a 1566 | .toneporta: 1567 | 1568 | ld hl, wave_instruments 1569 | ld a, [hl+] 1570 | ld h, [hl] 1571 | ld l, a 1572 | call setup_instrument_pointer 1573 | ld a, [highmask3] 1574 | res 7, a ; Turn off the "initial" flag 1575 | jr z, .write_mask3 1576 | 1577 | checkMute 2, .do_setvol3 1578 | 1579 | ld a, [hl+] 1580 | ldh [rAUD3LEN], a 1581 | ld a, [hl+] 1582 | ldh [rAUD3LEVEL], a 1583 | ld a, [hl+] 1584 | push hl 1585 | 1586 | ;; Check to see if we need to copy the wave 1587 | ld hl, current_wave 1588 | cp [hl] 1589 | jr z, .no_wave_copy 1590 | call update_ch3_waveform 1591 | 1592 | .no_wave_copy: 1593 | pop hl 1594 | ld a, [hl+] 1595 | ld [table3], a 1596 | ld a, [hl+] 1597 | ld [table3+1], a 1598 | xor a 1599 | ld [table_row3], a 1600 | 1601 | ld a, [hl] 1602 | 1603 | .write_mask3: 1604 | ld [highmask3], a 1605 | 1606 | .do_setvol3: 1607 | ld e, 2 1608 | call do_effect 1609 | 1610 | pop af 1611 | call c, play_ch3_note 1612 | 1613 | ld a, [table3] 1614 | ld c, a 1615 | ld a, [table3+1] 1616 | ld b, a 1617 | or c 1618 | ld hl, table_row3 1619 | ld e, 2 1620 | call nz, do_table 1621 | 1622 | process_ch4: 1623 | ld hl, pattern4 1624 | ld a, [hl+] 1625 | ld c, a 1626 | ld b, [hl] 1627 | call get_current_row 1628 | cp LAST_NOTE 1629 | 1630 | push af ; Save carry for conditonally calling note 1631 | jr nc, .do_setvol4 1632 | 1633 | ld [channel_note4], a 1634 | 1635 | ;; No toneporta check because it's not supported for CH4 anyway 1636 | 1637 | call get_note_poly 1638 | ld [channel_period4], a 1639 | 1640 | ld hl, noise_instruments 1641 | ld a, [hl+] 1642 | ld h, [hl] 1643 | ld l, a 1644 | call setup_instrument_pointer 1645 | 1646 | ld a, [highmask4] 1647 | res 7, a ; Turn off the "initial" flag 1648 | jr z, .write_mask4 1649 | 1650 | checkMute 3, .do_setvol4 1651 | 1652 | ld a, [hl+] 1653 | ldh [rAUD4ENV], a 1654 | 1655 | ld a, [hl+] 1656 | ld [table4], a 1657 | ld a, [hl+] 1658 | ld [table4+1], a 1659 | xor a 1660 | ld [table_row4], a 1661 | 1662 | ld a, [hl] 1663 | and %00111111 1664 | ldh [rAUD4LEN], a 1665 | 1666 | ld a, [channel_period4] 1667 | ld d, a 1668 | ld a, [hl] 1669 | and %10000000 1670 | swap a 1671 | ld [step_width4], a 1672 | or d 1673 | ld [channel_period4], a 1674 | 1675 | ld a, [hl] 1676 | and %01000000 1677 | or %10000000 1678 | .write_mask4: 1679 | ld [highmask4], a 1680 | 1681 | .do_setvol4: 1682 | ld e, 3 1683 | call do_effect 1684 | 1685 | pop af 1686 | call c, play_ch4_note 1687 | 1688 | ld a, [table4] 1689 | ld c, a 1690 | ld a, [table4+1] 1691 | ld b, a 1692 | or c 1693 | ld hl, table_row4 1694 | ld e, 3 1695 | call nz, do_table 1696 | 1697 | ;; finally just update the tick/order/row values 1698 | jp tick_time 1699 | 1700 | process_effects: 1701 | ;; Only do effects if not on tick zero 1702 | checkMute 0, .after_effect1 1703 | 1704 | ld hl, pattern1 1705 | ld a, [hl+] 1706 | ld c, a 1707 | ld b, [hl] 1708 | call get_current_row 1709 | 1710 | ld a, c 1711 | or a 1712 | jr z, .after_effect1 1713 | 1714 | ld e, 0 1715 | call do_effect ; make sure we never return with ret_dont_play_note!! 1716 | 1717 | ;; TODO: Deduplicate this code by moving it into do_table? 1718 | .after_effect1: 1719 | ld a, [table1] 1720 | ld c, a 1721 | ld a, [table1+1] 1722 | ld b, a 1723 | or c 1724 | ld hl, table_row1 1725 | ld e, 0 1726 | call nz, do_table 1727 | 1728 | .process_ch2: 1729 | checkMute 1, .after_effect2 1730 | 1731 | ld hl, pattern2 1732 | ld a, [hl+] 1733 | ld c, a 1734 | ld b, [hl] 1735 | call get_current_row 1736 | 1737 | ld a, c 1738 | or a 1739 | jr z, .after_effect2 1740 | 1741 | ld e, 1 1742 | call do_effect ; make sure we never return with ret_dont_play_note!! 1743 | 1744 | .after_effect2: 1745 | ld a, [table2] 1746 | ld c, a 1747 | ld a, [table2+1] 1748 | ld b, a 1749 | or c 1750 | ld hl, table_row2 1751 | ld e, 1 1752 | call nz, do_table 1753 | 1754 | .process_ch3: 1755 | checkMute 2, .after_effect3 1756 | 1757 | ld hl, pattern3 1758 | ld a, [hl+] 1759 | ld c, a 1760 | ld b, [hl] 1761 | call get_current_row 1762 | 1763 | ld a, c 1764 | or a 1765 | jr z, .after_effect3 1766 | 1767 | ld e, 2 1768 | call do_effect ; make sure we never return with ret_dont_play_note!! 1769 | 1770 | .after_effect3: 1771 | ld a, [table3] 1772 | ld c, a 1773 | ld a, [table3+1] 1774 | ld b, a 1775 | or c 1776 | ld hl, table_row3 1777 | ld e, 2 1778 | call nz, do_table 1779 | 1780 | .process_ch4: 1781 | checkMute 3, .after_effect4 1782 | 1783 | ld hl, pattern4 1784 | ld a, [hl+] 1785 | ld c, a 1786 | ld b, [hl] 1787 | call get_current_row 1788 | 1789 | ld a, c 1790 | or a 1791 | jr z, .after_effect4 1792 | 1793 | ld e, 3 1794 | call do_effect ; make sure we never return with ret_dont_play_note!! 1795 | 1796 | .after_effect4: 1797 | ld a, [table4] 1798 | ld c, a 1799 | ld a, [table4+1] 1800 | ld b, a 1801 | or c 1802 | ld hl, table_row4 1803 | ld e, 3 1804 | call nz, do_table 1805 | 1806 | tick_time: 1807 | IF DEF(PREVIEW_MODE) 1808 | db $f4 ; signal tick to tracker 1809 | ENDC 1810 | ld hl, counter 1811 | inc [hl] 1812 | 1813 | assert counter + 1 == tick 1814 | inc hl ; ld hl, tick 1815 | inc [hl] ; Increment tick counter 1816 | 1817 | ;; Should we switch to the next row? 1818 | ld a, [ticks_per_row] 1819 | sub [hl] 1820 | ret nz ; Nope. 1821 | ld [hl+], a ; Reset tick to 0 1822 | ;; Below code relies on a == 0 1823 | 1824 | assert tick + 1 == row_break 1825 | ;; Check if we need to perform a row break or pattern break 1826 | or [hl] ; a == 0, so this is `ld a, [hl]` that also alters flags 1827 | jr z, .no_break 1828 | 1829 | ;; These are offset by one so we can check to see if they've 1830 | ;; been modified 1831 | dec a 1832 | ld b, a 1833 | 1834 | xor a 1835 | ld [hl+], a 1836 | assert row_break + 1 == next_order 1837 | or [hl] ; a = [next_order], zf = ([next_order] == 0) 1838 | jr z, .neworder 1839 | ld [hl], 0 1840 | 1841 | dec a 1842 | add a ; multiply order by 2 (they are words) 1843 | 1844 | jr .update_current_order 1845 | 1846 | .no_break: 1847 | ;; Increment row. 1848 | ld a, [row] 1849 | inc a 1850 | cp PATTERN_LENGTH 1851 | jr nz, .noreset 1852 | 1853 | ld b, 0 1854 | .neworder: 1855 | IF DEF(PREVIEW_MODE) 1856 | ld a, [loop_order] 1857 | and a 1858 | jr z, .no_loop_order 1859 | xor a 1860 | jr .noreset 1861 | .no_loop_order: 1862 | ENDC 1863 | ;; Increment order and change loaded patterns 1864 | ld a, [order_cnt] 1865 | ld c, a 1866 | ld a, [current_order] 1867 | add 2 1868 | cp c 1869 | jr nz, .update_current_order 1870 | xor a 1871 | .update_current_order: 1872 | ;; Call with: 1873 | ;; A: The order to load 1874 | ;; B: The row for the order to start on 1875 | ld [current_order], a 1876 | ld c, a 1877 | call load_patterns 1878 | 1879 | ld a, b 1880 | .noreset: 1881 | ld [row], a 1882 | 1883 | IF DEF(PREVIEW_MODE) 1884 | db $fd ; signal row update to tracker 1885 | 1886 | ld a, [single_stepping] 1887 | or a 1888 | ret z 1889 | 1890 | ; a is nonzero 1891 | ld [single_step_stopped], a 1892 | ENDC 1893 | ret 1894 | 1895 | note_table: 1896 | include "include/hUGE_note_table.inc" 1897 | -------------------------------------------------------------------------------- /include/hUGE.inc: -------------------------------------------------------------------------------- 1 | MACRO dn ;; (note, instr, effect) 2 | db (\1 | ((\2 & %00010000) << 3)) 3 | db (((\2 << 4) & $FF) | (\3 >> 8)) 4 | db LOW(\3) 5 | ENDM 6 | 7 | DEF C_3 EQU 0 8 | DEF C#3 EQU 1 9 | DEF D_3 EQU 2 10 | DEF D#3 EQU 3 11 | DEF E_3 EQU 4 12 | DEF F_3 EQU 5 13 | DEF F#3 EQU 6 14 | DEF G_3 EQU 7 15 | DEF G#3 EQU 8 16 | DEF A_3 EQU 9 17 | DEF A#3 EQU 10 18 | DEF B_3 EQU 11 19 | DEF C_4 EQU 12 20 | DEF C#4 EQU 13 21 | DEF D_4 EQU 14 22 | DEF D#4 EQU 15 23 | DEF E_4 EQU 16 24 | DEF F_4 EQU 17 25 | DEF F#4 EQU 18 26 | DEF G_4 EQU 19 27 | DEF G#4 EQU 20 28 | DEF A_4 EQU 21 29 | DEF A#4 EQU 22 30 | DEF B_4 EQU 23 31 | DEF C_5 EQU 24 32 | DEF C#5 EQU 25 33 | DEF D_5 EQU 26 34 | DEF D#5 EQU 27 35 | DEF E_5 EQU 28 36 | DEF F_5 EQU 29 37 | DEF F#5 EQU 30 38 | DEF G_5 EQU 31 39 | DEF G#5 EQU 32 40 | DEF A_5 EQU 33 41 | DEF A#5 EQU 34 42 | DEF B_5 EQU 35 43 | DEF C_6 EQU 36 44 | DEF C#6 EQU 37 45 | DEF D_6 EQU 38 46 | DEF D#6 EQU 39 47 | DEF E_6 EQU 40 48 | DEF F_6 EQU 41 49 | DEF F#6 EQU 42 50 | DEF G_6 EQU 43 51 | DEF G#6 EQU 44 52 | DEF A_6 EQU 45 53 | DEF A#6 EQU 46 54 | DEF B_6 EQU 47 55 | DEF C_7 EQU 48 56 | DEF C#7 EQU 49 57 | DEF D_7 EQU 50 58 | DEF D#7 EQU 51 59 | DEF E_7 EQU 52 60 | DEF F_7 EQU 53 61 | DEF F#7 EQU 54 62 | DEF G_7 EQU 55 63 | DEF G#7 EQU 56 64 | DEF A_7 EQU 57 65 | DEF A#7 EQU 58 66 | DEF B_7 EQU 59 67 | DEF C_8 EQU 60 68 | DEF C#8 EQU 61 69 | DEF D_8 EQU 62 70 | DEF D#8 EQU 63 71 | DEF E_8 EQU 64 72 | DEF F_8 EQU 65 73 | DEF F#8 EQU 66 74 | DEF G_8 EQU 67 75 | DEF G#8 EQU 68 76 | DEF A_8 EQU 69 77 | DEF A#8 EQU 70 78 | DEF B_8 EQU 71 79 | DEF LAST_NOTE EQU 72 80 | DEF ___ EQU 90 ; the default "no note" value 81 | DEF NO_NOTE EQU ___ -------------------------------------------------------------------------------- /include/hUGEDriver.h: -------------------------------------------------------------------------------- 1 | #ifndef HUGEDRIVER_H_INCLUDE 2 | #define HUGEDRIVER_H_INCLUDE 3 | 4 | #include 5 | 6 | #define DN(A, B, C) (unsigned char)(A | ((B & 0x10) << 3)),(unsigned char)(((B << 4) & 0xFF) | (C >> 8)),(unsigned char)(C & 0xFF) 7 | 8 | #define C_3 0 9 | #define Cs3 1 10 | #define D_3 2 11 | #define Ds3 3 12 | #define E_3 4 13 | #define F_3 5 14 | #define Fs3 6 15 | #define G_3 7 16 | #define Gs3 8 17 | #define A_3 9 18 | #define As3 10 19 | #define B_3 11 20 | #define C_4 12 21 | #define Cs4 13 22 | #define D_4 14 23 | #define Ds4 15 24 | #define E_4 16 25 | #define F_4 17 26 | #define Fs4 18 27 | #define G_4 19 28 | #define Gs4 20 29 | #define A_4 21 30 | #define As4 22 31 | #define B_4 23 32 | #define C_5 24 33 | #define Cs5 25 34 | #define D_5 26 35 | #define Ds5 27 36 | #define E_5 28 37 | #define F_5 29 38 | #define Fs5 30 39 | #define G_5 31 40 | #define Gs5 32 41 | #define A_5 33 42 | #define As5 34 43 | #define B_5 35 44 | #define C_6 36 45 | #define Cs6 37 46 | #define D_6 38 47 | #define Ds6 39 48 | #define E_6 40 49 | #define F_6 41 50 | #define Fs6 42 51 | #define G_6 43 52 | #define Gs6 44 53 | #define A_6 45 54 | #define As6 46 55 | #define B_6 47 56 | #define C_7 48 57 | #define Cs7 49 58 | #define D_7 50 59 | #define Ds7 51 60 | #define E_7 52 61 | #define F_7 53 62 | #define Fs7 54 63 | #define G_7 55 64 | #define Gs7 56 65 | #define A_7 57 66 | #define As7 58 67 | #define B_7 59 68 | #define C_8 60 69 | #define Cs8 61 70 | #define D_8 62 71 | #define Ds8 63 72 | #define E_8 64 73 | #define F_8 65 74 | #define Fs8 66 75 | #define G_8 67 76 | #define Gs8 68 77 | #define A_8 69 78 | #define As8 70 79 | #define B_8 71 80 | #define LAST_NOTE 72 81 | #define ___ 90 82 | 83 | // tick is a tick number; the high byte of param is channel and the low byte of param is routine id 84 | typedef void (*hUGERoutine_t)(unsigned char tick, unsigned int param); 85 | 86 | typedef struct hUGEDutyInstr_t { 87 | const unsigned char sweep; 88 | const unsigned char len_duty; 89 | const unsigned char envelope; 90 | const unsigned char * subpattern; 91 | const unsigned char highmask; 92 | } hUGEDutyInstr_t; 93 | 94 | typedef struct hUGEWaveInstr_t { 95 | const unsigned char length; 96 | const unsigned char volume; 97 | const unsigned char waveform; 98 | const unsigned char * subpattern; 99 | const unsigned char highmask; 100 | } hUGEWaveInstr_t; 101 | 102 | typedef struct hUGENoiseInstr_t { 103 | const unsigned char envelope; 104 | const unsigned char * subpattern; 105 | const unsigned char highmask; 106 | const unsigned char unused1; 107 | const unsigned char unused2; 108 | } hUGENoiseInstr_t; 109 | 110 | typedef struct hUGESong_t { 111 | unsigned char tempo; 112 | const unsigned char * order_cnt; 113 | const unsigned char ** order1, ** order2, ** order3, ** order4; 114 | const hUGEDutyInstr_t * duty_instruments; 115 | const hUGEWaveInstr_t * wave_instruments; 116 | const hUGENoiseInstr_t * noise_instruments; 117 | const hUGERoutine_t ** routines; 118 | const unsigned char * waves; 119 | } hUGESong_t; 120 | 121 | // initialize the driver with song data 122 | void hUGE_init(const hUGESong_t * song); 123 | 124 | // driver routine 125 | void hUGE_dosound(void); 126 | 127 | enum hUGE_channel_t {HT_CH1 = 0, HT_CH2, HT_CH3, HT_CH4}; 128 | enum hUGE_mute_t {HT_CH_PLAY = 0, HT_CH_MUTE}; 129 | 130 | void hUGE_mute_channel(enum hUGE_channel_t ch, enum hUGE_mute_t mute); 131 | 132 | void hUGE_set_position(unsigned char pattern); 133 | 134 | extern volatile unsigned char hUGE_current_wave; 135 | 136 | extern volatile unsigned char hUGE_mute_mask; 137 | 138 | inline void hUGE_reset_wave(void) { 139 | hUGE_current_wave = 100; 140 | } 141 | 142 | #endif 143 | -------------------------------------------------------------------------------- /include/hUGE_note_table.inc: -------------------------------------------------------------------------------- 1 | ;; hUGETracker note table. 2 | ;; Written by SuperDisk 2019 3 | 4 | ;; Gameboy sound frequences are represented as 11 byte periods. 5 | ;; this note table was generated from http://www.devrs.com/gb/files/sndtab.html 6 | 7 | dw 44 8 | dw 156 9 | dw 262 10 | dw 363 11 | dw 457 12 | dw 547 13 | dw 631 14 | dw 710 15 | dw 786 16 | dw 854 17 | dw 923 18 | dw 986 19 | dw 1046 20 | dw 1102 21 | dw 1155 22 | dw 1205 23 | dw 1253 24 | dw 1297 25 | dw 1339 26 | dw 1379 27 | dw 1417 28 | dw 1452 29 | dw 1486 30 | dw 1517 31 | dw 1546 32 | dw 1575 33 | dw 1602 34 | dw 1627 35 | dw 1650 36 | dw 1673 37 | dw 1694 38 | dw 1714 39 | dw 1732 40 | dw 1750 41 | dw 1767 42 | dw 1783 43 | dw 1798 44 | dw 1812 45 | dw 1825 46 | dw 1837 47 | dw 1849 48 | dw 1860 49 | dw 1871 50 | dw 1881 51 | dw 1890 52 | dw 1899 53 | dw 1907 54 | dw 1915 55 | dw 1923 56 | dw 1930 57 | dw 1936 58 | dw 1943 59 | dw 1949 60 | dw 1954 61 | dw 1959 62 | dw 1964 63 | dw 1969 64 | dw 1974 65 | dw 1978 66 | dw 1982 67 | dw 1985 68 | dw 1988 69 | dw 1992 70 | dw 1995 71 | dw 1998 72 | dw 2001 73 | dw 2004 74 | dw 2006 75 | dw 2009 76 | dw 2011 77 | dw 2013 78 | dw 2015 -------------------------------------------------------------------------------- /include/hardware.inc: -------------------------------------------------------------------------------- 1 | ;* 2 | ;* Gameboy Hardware definitions 3 | ;* 4 | ;* Based on Jones' hardware.inc 5 | ;* And based on Carsten Sorensen's ideas. 6 | ;* 7 | ;* Rev 1.1 - 15-Jul-97 : Added define check 8 | ;* Rev 1.2 - 18-Jul-97 : Added revision check macro 9 | ;* Rev 1.3 - 19-Jul-97 : Modified for RGBASM V1.05 10 | ;* Rev 1.4 - 27-Jul-97 : Modified for new subroutine prefixes 11 | ;* Rev 1.5 - 15-Aug-97 : Added _HRAM, PAD, CART defines 12 | ;* : and Nintendo Logo 13 | ;* Rev 1.6 - 30-Nov-97 : Added rDIV, rTIMA, rTMA, & rTAC 14 | ;* Rev 1.7 - 31-Jan-98 : Added _SCRN0, _SCRN1 15 | ;* Rev 1.8 - 15-Feb-98 : Added rSB, rSC 16 | ;* Rev 1.9 - 16-Feb-98 : Converted I/O registers to $FFXX format 17 | ;* Rev 2.0 - : Added GBC registers 18 | ;* Rev 2.1 - : Added MBC5 & cart RAM enable/disable defines 19 | ;* Rev 2.2 - : Fixed NR42,NR43, & NR44 equates 20 | ;* Rev 2.3 - : Fixed incorrect _HRAM equate 21 | ;* Rev 2.4 - 27-Apr-13 : Added some cart defines (AntonioND) 22 | ;* Rev 2.5 - 03-May-15 : Fixed format (AntonioND) 23 | ;* Rev 2.6 - 09-Apr-16 : Added GBC OAM and cart defines (AntonioND) 24 | ;* Rev 2.7 - 19-Jan-19 : Added rPCMXX (ISSOtm) 25 | ;* Rev 2.8 - 03-Feb-19 : Added audio registers flags (Álvaro Cuesta) 26 | ;* Rev 2.9 - 28-Feb-20 : Added utility rP1 constants 27 | ;* Rev 3.0 - 27-Aug-20 : Register ordering, byte-based sizes, OAM additions, general cleanup (Blitter Object) 28 | ;* Rev 4.0 - 03-May-21 : Updated to use RGBDS 0.5.0 syntax, changed IEF_LCDC to IEF_STAT (Eievui) 29 | ;* Rev 4.1 - 16-Aug-21 : Added more flags, bit number defines, and offset constants for OAM and window positions (rondnelson99) 30 | ;* Rev 4.2 - 04-Sep-21 : Added CH3- and CH4-specific audio registers flags (ISSOtm) 31 | ;* Rev 4.3 - 07-Nov-21 : Deprecate VRAM address constants (Eievui) 32 | ;* Rev 4.4 - 11-Jan-22 : Deprecate VRAM CART_SRAM_2KB constant (avivace) 33 | ;* Rev 4.5 - 03-Mar-22 : Added bit number definitions for OCPS, BCPS and LCDC (sukus) 34 | ;* Rev 4.6 - 15-Jun-22 : Added MBC3 registers and special values 35 | ;* Rev 4.7.0 - 27-Jun-22 : Added alternate names for some constants 36 | ;* Rev 4.7.1 - 05-Jul-22 : Added RPB_LED_ON constant 37 | 38 | ; NOTE: REVISION NUMBER CHANGES MUST BE REFLECTED 39 | ; IN `rev_Check_hardware_inc` BELOW! 40 | 41 | IF __RGBDS_MAJOR__ == 0 && __RGBDS_MINOR__ < 5 42 | FAIL "This version of 'hardware.inc' requires RGBDS version 0.5.0 or later." 43 | ENDC 44 | 45 | ; If all of these are already defined, don't do it again. 46 | 47 | IF !DEF(HARDWARE_INC) 48 | DEF HARDWARE_INC EQU 1 49 | 50 | ; Usage: rev_Check_hardware_inc 51 | ; Examples: rev_Check_hardware_inc 4.1.2 52 | ; rev_Check_hardware_inc 4.1 (equivalent to 4.1.0) 53 | ; rev_Check_hardware_inc 4 (equivalent to 4.0.0) 54 | MACRO rev_Check_hardware_inc 55 | DEF CUR_VER equs "4,7,1" ; ** UPDATE THIS LINE WHEN CHANGING THE REVISION NUMBER ** 56 | DEF MIN_VER equs STRRPL("\1", ".", ",") 57 | DEF INTERNAL_CHK equs """MACRO ___internal 58 | IF \\1 != \\4 || \\2 < \\5 || (\\2 == \\5 && \\3 < \\6) 59 | FAIL "Version \\1.\\2.\\3 of 'hardware.inc' is incompatible with requested version \\4.\\5.\\6" 60 | ENDC 61 | \nENDM""" 62 | INTERNAL_CHK 63 | ___internal {CUR_VER}, {MIN_VER},0,0 64 | PURGE CUR_VER, MIN_VER, INTERNAL_CHK, ___internal 65 | ENDM 66 | 67 | 68 | ;*************************************************************************** 69 | ;* 70 | ;* General memory region constants 71 | ;* 72 | ;*************************************************************************** 73 | 74 | DEF _VRAM EQU $8000 ; $8000->$9FFF 75 | DEF _SCRN0 EQU $9800 ; $9800->$9BFF 76 | DEF _SCRN1 EQU $9C00 ; $9C00->$9FFF 77 | DEF _SRAM EQU $A000 ; $A000->$BFFF 78 | DEF _RAM EQU $C000 ; $C000->$CFFF / $C000->$DFFF 79 | DEF _RAMBANK EQU $D000 ; $D000->$DFFF 80 | DEF _OAMRAM EQU $FE00 ; $FE00->$FE9F 81 | DEF _IO EQU $FF00 ; $FF00->$FF7F,$FFFF 82 | DEF _AUD3WAVERAM EQU $FF30 ; $FF30->$FF3F 83 | DEF _HRAM EQU $FF80 ; $FF80->$FFFE 84 | 85 | 86 | ;*************************************************************************** 87 | ;* 88 | ;* MBC registers 89 | ;* 90 | ;*************************************************************************** 91 | 92 | ; *** Common *** 93 | 94 | ; -- 95 | ; -- RAMG ($0000-$1FFF) 96 | ; -- Controls whether access to SRAM (and the MBC3 RTC registers) is allowed (W) 97 | ; -- 98 | DEF rRAMG EQU $0000 99 | 100 | DEF CART_SRAM_ENABLE EQU $0A 101 | DEF CART_SRAM_DISABLE EQU $00 102 | 103 | 104 | ; -- 105 | ; -- ROMB0 ($2000-$3FFF) 106 | ; -- Selects which ROM bank is mapped to the ROMX space ($4000-$7FFF) (W) 107 | ; -- 108 | ; -- The range of accepted values, as well as the behavior of writing $00, 109 | ; -- varies depending on the MBC. 110 | ; -- 111 | DEF rROMB0 EQU $2000 112 | 113 | ; -- 114 | ; -- RAMB ($4000-$5FFF) 115 | ; -- Selects which SRAM bank is mapped to the SRAM space ($A000-$BFFF) (W) 116 | ; -- 117 | ; -- The range of accepted values varies depending on the cartridge configuration. 118 | ; -- 119 | DEF rRAMB EQU $4000 120 | 121 | 122 | ; *** MBC3-specific registers *** 123 | 124 | ; Write one of these to rRAMG to map the corresponding RTC register to all SRAM space 125 | DEF RTC_S EQU $08 ; Seconds (0-59) 126 | DEF RTC_M EQU $09 ; Minutes (0-59) 127 | DEF RTC_H EQU $0A ; Hours (0-23) 128 | DEF RTC_DL EQU $0B ; Lower 8 bits of Day Counter ($00-$FF) 129 | DEF RTC_DH EQU $0C ; Bit 7 - Day Counter Carry Bit (1=Counter Overflow) 130 | ; Bit 6 - Halt (0=Active, 1=Stop Timer) 131 | ; Bit 0 - Most significant bit of Day Counter (Bit 8) 132 | 133 | 134 | ; -- 135 | ; -- RTCLATCH ($6000-$7FFF) 136 | ; -- Write $00 then $01 to latch the current time into the RTC registers (W) 137 | ; -- 138 | DEF rRTCLATCH EQU $6000 139 | 140 | 141 | ; *** MBC5-specific register *** 142 | 143 | ; -- 144 | ; -- ROMB1 ($3000-$3FFF) 145 | ; -- A 9th bit that "extends" ROMB0 if more than 256 banks are present (W) 146 | ; -- 147 | ; -- Also note that rROMB0 thus only spans $2000-$2FFF. 148 | ; -- 149 | DEF rROMB1 EQU $3000 150 | 151 | 152 | ; Bit 3 of RAMB enables the rumble motor (if any) 153 | DEF CART_RUMBLE_ON EQU 1 << 3 154 | 155 | 156 | ;*************************************************************************** 157 | ;* 158 | ;* Memory-mapped registers 159 | ;* 160 | ;*************************************************************************** 161 | 162 | ; -- 163 | ; -- P1 ($FF00) 164 | ; -- Register for reading joy pad info. (R/W) 165 | ; -- 166 | DEF rP1 EQU $FF00 167 | 168 | DEF P1F_5 EQU %00100000 ; P15 out port, set to 0 to get buttons 169 | DEF P1F_4 EQU %00010000 ; P14 out port, set to 0 to get dpad 170 | DEF P1F_3 EQU %00001000 ; P13 in port 171 | DEF P1F_2 EQU %00000100 ; P12 in port 172 | DEF P1F_1 EQU %00000010 ; P11 in port 173 | DEF P1F_0 EQU %00000001 ; P10 in port 174 | 175 | DEF P1F_GET_DPAD EQU P1F_5 176 | DEF P1F_GET_BTN EQU P1F_4 177 | DEF P1F_GET_NONE EQU P1F_4 | P1F_5 178 | 179 | 180 | ; -- 181 | ; -- SB ($FF01) 182 | ; -- Serial Transfer Data (R/W) 183 | ; -- 184 | DEF rSB EQU $FF01 185 | 186 | 187 | ; -- 188 | ; -- SC ($FF02) 189 | ; -- Serial I/O Control (R/W) 190 | ; -- 191 | DEF rSC EQU $FF02 192 | 193 | DEF SCF_START EQU %10000000 ; Transfer Start Flag (1=Transfer in progress, or requested) 194 | DEF SCF_SPEED EQU %00000010 ; Clock Speed (0=Normal, 1=Fast) ** CGB Mode Only ** 195 | DEF SCF_SOURCE EQU %00000001 ; Shift Clock (0=External Clock, 1=Internal Clock) 196 | 197 | DEF SCB_START EQU 7 198 | DEF SCB_SPEED EQU 1 199 | DEF SCB_SOURCE EQU 0 200 | 201 | ; -- 202 | ; -- DIV ($FF04) 203 | ; -- Divider register (R/W) 204 | ; -- 205 | DEF rDIV EQU $FF04 206 | 207 | 208 | ; -- 209 | ; -- TIMA ($FF05) 210 | ; -- Timer counter (R/W) 211 | ; -- 212 | DEF rTIMA EQU $FF05 213 | 214 | 215 | ; -- 216 | ; -- TMA ($FF06) 217 | ; -- Timer modulo (R/W) 218 | ; -- 219 | DEF rTMA EQU $FF06 220 | 221 | 222 | ; -- 223 | ; -- TAC ($FF07) 224 | ; -- Timer control (R/W) 225 | ; -- 226 | DEF rTAC EQU $FF07 227 | 228 | DEF TACF_START EQU %00000100 229 | DEF TACF_STOP EQU %00000000 230 | DEF TACF_4KHZ EQU %00000000 231 | DEF TACF_16KHZ EQU %00000011 232 | DEF TACF_65KHZ EQU %00000010 233 | DEF TACF_262KHZ EQU %00000001 234 | 235 | DEF TACB_START EQU 2 236 | 237 | 238 | ; -- 239 | ; -- IF ($FF0F) 240 | ; -- Interrupt Flag (R/W) 241 | ; -- 242 | DEF rIF EQU $FF0F 243 | 244 | 245 | ; -- 246 | ; -- AUD1SWEEP/NR10 ($FF10) 247 | ; -- Sweep register (R/W) 248 | ; -- 249 | ; -- Bit 6-4 - Sweep Time 250 | ; -- Bit 3 - Sweep Increase/Decrease 251 | ; -- 0: Addition (frequency increases???) 252 | ; -- 1: Subtraction (frequency increases???) 253 | ; -- Bit 2-0 - Number of sweep shift (# 0-7) 254 | ; -- Sweep Time: (n*7.8ms) 255 | ; -- 256 | DEF rNR10 EQU $FF10 257 | DEF rAUD1SWEEP EQU rNR10 258 | 259 | DEF AUD1SWEEP_UP EQU %00000000 260 | DEF AUD1SWEEP_DOWN EQU %00001000 261 | 262 | 263 | ; -- 264 | ; -- AUD1LEN/NR11 ($FF11) 265 | ; -- Sound length/Wave pattern duty (R/W) 266 | ; -- 267 | ; -- Bit 7-6 - Wave Pattern Duty (00:12.5% 01:25% 10:50% 11:75%) 268 | ; -- Bit 5-0 - Sound length data (# 0-63) 269 | ; -- 270 | DEF rNR11 EQU $FF11 271 | DEF rAUD1LEN EQU rNR11 272 | 273 | 274 | ; -- 275 | ; -- AUD1ENV/NR12 ($FF12) 276 | ; -- Envelope (R/W) 277 | ; -- 278 | ; -- Bit 7-4 - Initial value of envelope 279 | ; -- Bit 3 - Envelope UP/DOWN 280 | ; -- 0: Decrease 281 | ; -- 1: Range of increase 282 | ; -- Bit 2-0 - Number of envelope sweep (# 0-7) 283 | ; -- 284 | DEF rNR12 EQU $FF12 285 | DEF rAUD1ENV EQU rNR12 286 | 287 | 288 | ; -- 289 | ; -- AUD1LOW/NR13 ($FF13) 290 | ; -- Frequency low byte (W) 291 | ; -- 292 | DEF rNR13 EQU $FF13 293 | DEF rAUD1LOW EQU rNR13 294 | 295 | 296 | ; -- 297 | ; -- AUD1HIGH/NR14 ($FF14) 298 | ; -- Frequency high byte (W) 299 | ; -- 300 | ; -- Bit 7 - Initial (when set, sound restarts) 301 | ; -- Bit 6 - Counter/consecutive selection 302 | ; -- Bit 2-0 - Frequency's higher 3 bits 303 | ; -- 304 | DEF rNR14 EQU $FF14 305 | DEF rAUD1HIGH EQU rNR14 306 | 307 | 308 | ; -- 309 | ; -- AUD2LEN/NR21 ($FF16) 310 | ; -- Sound Length; Wave Pattern Duty (R/W) 311 | ; -- 312 | ; -- see AUD1LEN for info 313 | ; -- 314 | DEF rNR21 EQU $FF16 315 | DEF rAUD2LEN EQU rNR21 316 | 317 | 318 | ; -- 319 | ; -- AUD2ENV/NR22 ($FF17) 320 | ; -- Envelope (R/W) 321 | ; -- 322 | ; -- see AUD1ENV for info 323 | ; -- 324 | DEF rNR22 EQU $FF17 325 | DEF rAUD2ENV EQU rNR22 326 | 327 | 328 | ; -- 329 | ; -- AUD2LOW/NR23 ($FF18) 330 | ; -- Frequency low byte (W) 331 | ; -- 332 | DEF rNR23 EQU $FF18 333 | DEF rAUD2LOW EQU rNR23 334 | 335 | 336 | ; -- 337 | ; -- AUD2HIGH/NR24 ($FF19) 338 | ; -- Frequency high byte (W) 339 | ; -- 340 | ; -- see AUD1HIGH for info 341 | ; -- 342 | DEF rNR24 EQU $FF19 343 | DEF rAUD2HIGH EQU rNR24 344 | 345 | 346 | ; -- 347 | ; -- AUD3ENA/NR30 ($FF1A) 348 | ; -- Sound on/off (R/W) 349 | ; -- 350 | ; -- Bit 7 - Sound ON/OFF (1=ON,0=OFF) 351 | ; -- 352 | DEF rNR30 EQU $FF1A 353 | DEF rAUD3ENA EQU rNR30 354 | 355 | DEF AUD3ENA_OFF EQU %00000000 356 | DEF AUD3ENA_ON EQU %10000000 357 | 358 | 359 | ; -- 360 | ; -- AUD3LEN/NR31 ($FF1B) 361 | ; -- Sound length (R/W) 362 | ; -- 363 | ; -- Bit 7-0 - Sound length 364 | ; -- 365 | DEF rNR31 EQU $FF1B 366 | DEF rAUD3LEN EQU rNR31 367 | 368 | 369 | ; -- 370 | ; -- AUD3LEVEL/NR32 ($FF1C) 371 | ; -- Select output level 372 | ; -- 373 | ; -- Bit 6-5 - Select output level 374 | ; -- 00: 0/1 (mute) 375 | ; -- 01: 1/1 376 | ; -- 10: 1/2 377 | ; -- 11: 1/4 378 | ; -- 379 | DEF rNR32 EQU $FF1C 380 | DEF rAUD3LEVEL EQU rNR32 381 | 382 | DEF AUD3LEVEL_MUTE EQU %00000000 383 | DEF AUD3LEVEL_100 EQU %00100000 384 | DEF AUD3LEVEL_50 EQU %01000000 385 | DEF AUD3LEVEL_25 EQU %01100000 386 | 387 | 388 | ; -- 389 | ; -- AUD3LOW/NR33 ($FF1D) 390 | ; -- Frequency low byte (W) 391 | ; -- 392 | ; -- see AUD1LOW for info 393 | ; -- 394 | DEF rNR33 EQU $FF1D 395 | DEF rAUD3LOW EQU rNR33 396 | 397 | 398 | ; -- 399 | ; -- AUD3HIGH/NR34 ($FF1E) 400 | ; -- Frequency high byte (W) 401 | ; -- 402 | ; -- see AUD1HIGH for info 403 | ; -- 404 | DEF rNR34 EQU $FF1E 405 | DEF rAUD3HIGH EQU rNR34 406 | 407 | 408 | ; -- 409 | ; -- AUD4LEN/NR41 ($FF20) 410 | ; -- Sound length (R/W) 411 | ; -- 412 | ; -- Bit 5-0 - Sound length data (# 0-63) 413 | ; -- 414 | DEF rNR41 EQU $FF20 415 | DEF rAUD4LEN EQU rNR41 416 | 417 | 418 | ; -- 419 | ; -- AUD4ENV/NR42 ($FF21) 420 | ; -- Envelope (R/W) 421 | ; -- 422 | ; -- see AUD1ENV for info 423 | ; -- 424 | DEF rNR42 EQU $FF21 425 | DEF rAUD4ENV EQU rNR42 426 | 427 | 428 | ; -- 429 | ; -- AUD4POLY/NR43 ($FF22) 430 | ; -- Polynomial counter (R/W) 431 | ; -- 432 | ; -- Bit 7-4 - Selection of the shift clock frequency of the (scf) 433 | ; -- polynomial counter (0000-1101) 434 | ; -- freq=drf*1/2^scf (not sure) 435 | ; -- Bit 3 - Selection of the polynomial counter's step 436 | ; -- 0: 15 steps 437 | ; -- 1: 7 steps 438 | ; -- Bit 2-0 - Selection of the dividing ratio of frequencies (drf) 439 | ; -- 000: f/4 001: f/8 010: f/16 011: f/24 440 | ; -- 100: f/32 101: f/40 110: f/48 111: f/56 (f=4.194304 Mhz) 441 | ; -- 442 | DEF rNR43 EQU $FF22 443 | DEF rAUD4POLY EQU rNR43 444 | 445 | DEF AUD4POLY_15STEP EQU %00000000 446 | DEF AUD4POLY_7STEP EQU %00001000 447 | 448 | 449 | ; -- 450 | ; -- AUD4GO/NR44 ($FF23) 451 | ; -- 452 | ; -- Bit 7 - Initial (when set, sound restarts) 453 | ; -- Bit 6 - Counter/consecutive selection 454 | ; -- 455 | DEF rNR44 EQU $FF23 456 | DEF rAUD4GO EQU rNR44 457 | 458 | 459 | ; -- 460 | ; -- AUDVOL/NR50 ($FF24) 461 | ; -- Channel control / ON-OFF / Volume (R/W) 462 | ; -- 463 | ; -- Bit 7 - Vin->SO2 ON/OFF (left) 464 | ; -- Bit 6-4 - SO2 output level (left speaker) (# 0-7) 465 | ; -- Bit 3 - Vin->SO1 ON/OFF (right) 466 | ; -- Bit 2-0 - SO1 output level (right speaker) (# 0-7) 467 | ; -- 468 | DEF rNR50 EQU $FF24 469 | DEF rAUDVOL EQU rNR50 470 | 471 | DEF AUDVOL_VIN_LEFT EQU %10000000 ; SO2 472 | DEF AUDVOL_VIN_RIGHT EQU %00001000 ; SO1 473 | 474 | 475 | ; -- 476 | ; -- AUDTERM/NR51 ($FF25) 477 | ; -- Selection of Sound output terminal (R/W) 478 | ; -- 479 | ; -- Bit 7 - Output channel 4 to SO2 terminal (left) 480 | ; -- Bit 6 - Output channel 3 to SO2 terminal (left) 481 | ; -- Bit 5 - Output channel 2 to SO2 terminal (left) 482 | ; -- Bit 4 - Output channel 1 to SO2 terminal (left) 483 | ; -- Bit 3 - Output channel 4 to SO1 terminal (right) 484 | ; -- Bit 2 - Output channel 3 to SO1 terminal (right) 485 | ; -- Bit 1 - Output channel 2 to SO1 terminal (right) 486 | ; -- Bit 0 - Output channel 1 to SO1 terminal (right) 487 | ; -- 488 | DEF rNR51 EQU $FF25 489 | DEF rAUDTERM EQU rNR51 490 | 491 | ; SO2 492 | DEF AUDTERM_4_LEFT EQU %10000000 493 | DEF AUDTERM_3_LEFT EQU %01000000 494 | DEF AUDTERM_2_LEFT EQU %00100000 495 | DEF AUDTERM_1_LEFT EQU %00010000 496 | ; SO1 497 | DEF AUDTERM_4_RIGHT EQU %00001000 498 | DEF AUDTERM_3_RIGHT EQU %00000100 499 | DEF AUDTERM_2_RIGHT EQU %00000010 500 | DEF AUDTERM_1_RIGHT EQU %00000001 501 | 502 | 503 | ; -- 504 | ; -- AUDENA/NR52 ($FF26) 505 | ; -- Sound on/off (R/W) 506 | ; -- 507 | ; -- Bit 7 - All sound on/off (sets all audio regs to 0!) 508 | ; -- Bit 3 - Sound 4 ON flag (read only) 509 | ; -- Bit 2 - Sound 3 ON flag (read only) 510 | ; -- Bit 1 - Sound 2 ON flag (read only) 511 | ; -- Bit 0 - Sound 1 ON flag (read only) 512 | ; -- 513 | DEF rNR52 EQU $FF26 514 | DEF rAUDENA EQU rNR52 515 | 516 | DEF AUDENA_ON EQU %10000000 517 | DEF AUDENA_OFF EQU %00000000 ; sets all audio regs to 0! 518 | 519 | 520 | ; -- 521 | ; -- LCDC ($FF40) 522 | ; -- LCD Control (R/W) 523 | ; -- 524 | DEF rLCDC EQU $FF40 525 | 526 | DEF LCDCF_OFF EQU %00000000 ; LCD Control Operation 527 | DEF LCDCF_ON EQU %10000000 ; LCD Control Operation 528 | DEF LCDCF_WIN9800 EQU %00000000 ; Window Tile Map Display Select 529 | DEF LCDCF_WIN9C00 EQU %01000000 ; Window Tile Map Display Select 530 | DEF LCDCF_WINOFF EQU %00000000 ; Window Display 531 | DEF LCDCF_WINON EQU %00100000 ; Window Display 532 | DEF LCDCF_BG8800 EQU %00000000 ; BG & Window Tile Data Select 533 | DEF LCDCF_BG8000 EQU %00010000 ; BG & Window Tile Data Select 534 | DEF LCDCF_BG9800 EQU %00000000 ; BG Tile Map Display Select 535 | DEF LCDCF_BG9C00 EQU %00001000 ; BG Tile Map Display Select 536 | DEF LCDCF_OBJ8 EQU %00000000 ; OBJ Construction 537 | DEF LCDCF_OBJ16 EQU %00000100 ; OBJ Construction 538 | DEF LCDCF_OBJOFF EQU %00000000 ; OBJ Display 539 | DEF LCDCF_OBJON EQU %00000010 ; OBJ Display 540 | DEF LCDCF_BGOFF EQU %00000000 ; BG Display 541 | DEF LCDCF_BGON EQU %00000001 ; BG Display 542 | 543 | DEF LCDCB_ON EQU 7 ; LCD Control Operation 544 | DEF LCDCB_WIN9C00 EQU 6 ; Window Tile Map Display Select 545 | DEF LCDCB_WINON EQU 5 ; Window Display 546 | DEF LCDCB_BG8000 EQU 4 ; BG & Window Tile Data Select 547 | DEF LCDCB_BG9C00 EQU 3 ; BG Tile Map Display Select 548 | DEF LCDCB_OBJ16 EQU 2 ; OBJ Construction 549 | DEF LCDCB_OBJON EQU 1 ; OBJ Display 550 | DEF LCDCB_BGON EQU 0 ; BG Display 551 | ; "Window Character Data Select" follows BG 552 | 553 | 554 | ; -- 555 | ; -- STAT ($FF41) 556 | ; -- LCDC Status (R/W) 557 | ; -- 558 | DEF rSTAT EQU $FF41 559 | 560 | DEF STATF_LYC EQU %01000000 ; LYC=LY Coincidence (Selectable) 561 | DEF STATF_MODE10 EQU %00100000 ; Mode 10 562 | DEF STATF_MODE01 EQU %00010000 ; Mode 01 (V-Blank) 563 | DEF STATF_MODE00 EQU %00001000 ; Mode 00 (H-Blank) 564 | DEF STATF_LYCF EQU %00000100 ; Coincidence Flag 565 | DEF STATF_HBL EQU %00000000 ; H-Blank 566 | DEF STATF_VBL EQU %00000001 ; V-Blank 567 | DEF STATF_OAM EQU %00000010 ; OAM-RAM is used by system 568 | DEF STATF_LCD EQU %00000011 ; Both OAM and VRAM used by system 569 | DEF STATF_BUSY EQU %00000010 ; When set, VRAM access is unsafe 570 | 571 | DEF STATB_LYC EQU 6 572 | DEF STATB_MODE10 EQU 5 573 | DEF STATB_MODE01 EQU 4 574 | DEF STATB_MODE00 EQU 3 575 | DEF STATB_LYCF EQU 2 576 | DEF STATB_BUSY EQU 1 577 | 578 | ; -- 579 | ; -- SCY ($FF42) 580 | ; -- Scroll Y (R/W) 581 | ; -- 582 | DEF rSCY EQU $FF42 583 | 584 | 585 | ; -- 586 | ; -- SCX ($FF43) 587 | ; -- Scroll X (R/W) 588 | ; -- 589 | DEF rSCX EQU $FF43 590 | 591 | 592 | ; -- 593 | ; -- LY ($FF44) 594 | ; -- LCDC Y-Coordinate (R) 595 | ; -- 596 | ; -- Values range from 0->153. 144->153 is the VBlank period. 597 | ; -- 598 | DEF rLY EQU $FF44 599 | 600 | 601 | ; -- 602 | ; -- LYC ($FF45) 603 | ; -- LY Compare (R/W) 604 | ; -- 605 | ; -- When LY==LYC, STATF_LYCF will be set in STAT 606 | ; -- 607 | DEF rLYC EQU $FF45 608 | 609 | 610 | ; -- 611 | ; -- DMA ($FF46) 612 | ; -- DMA Transfer and Start Address (W) 613 | ; -- 614 | DEF rDMA EQU $FF46 615 | 616 | 617 | ; -- 618 | ; -- BGP ($FF47) 619 | ; -- BG Palette Data (W) 620 | ; -- 621 | ; -- Bit 7-6 - Intensity for %11 622 | ; -- Bit 5-4 - Intensity for %10 623 | ; -- Bit 3-2 - Intensity for %01 624 | ; -- Bit 1-0 - Intensity for %00 625 | ; -- 626 | DEF rBGP EQU $FF47 627 | 628 | 629 | ; -- 630 | ; -- OBP0 ($FF48) 631 | ; -- Object Palette 0 Data (W) 632 | ; -- 633 | ; -- See BGP for info 634 | ; -- 635 | DEF rOBP0 EQU $FF48 636 | 637 | 638 | ; -- 639 | ; -- OBP1 ($FF49) 640 | ; -- Object Palette 1 Data (W) 641 | ; -- 642 | ; -- See BGP for info 643 | ; -- 644 | DEF rOBP1 EQU $FF49 645 | 646 | 647 | ; -- 648 | ; -- WY ($FF4A) 649 | ; -- Window Y Position (R/W) 650 | ; -- 651 | ; -- 0 <= WY <= 143 652 | ; -- When WY = 0, the window is displayed from the top edge of the LCD screen. 653 | ; -- 654 | DEF rWY EQU $FF4A 655 | 656 | 657 | ; -- 658 | ; -- WX ($FF4B) 659 | ; -- Window X Position (R/W) 660 | ; -- 661 | ; -- 7 <= WX <= 166 662 | ; -- When WX = 7, the window is displayed from the left edge of the LCD screen. 663 | ; -- Values of 0-6 and 166 are unreliable due to hardware bugs. 664 | ; -- 665 | DEF rWX EQU $FF4B 666 | 667 | DEF WX_OFS EQU 7 ; add this to a screen position to get a WX position 668 | 669 | 670 | ; -- 671 | ; -- SPEED ($FF4D) 672 | ; -- Select CPU Speed (R/W) 673 | ; -- 674 | DEF rKEY1 EQU $FF4D 675 | DEF rSPD EQU rKEY1 676 | 677 | DEF KEY1F_DBLSPEED EQU %10000000 ; 0=Normal Speed, 1=Double Speed (R) 678 | DEF KEY1F_PREPARE EQU %00000001 ; 0=No, 1=Prepare (R/W) 679 | 680 | 681 | ; -- 682 | ; -- VBK ($FF4F) 683 | ; -- Select Video RAM Bank (R/W) 684 | ; -- 685 | ; -- Bit 0 - Bank Specification (0: Specify Bank 0; 1: Specify Bank 1) 686 | ; -- 687 | DEF rVBK EQU $FF4F 688 | 689 | 690 | ; -- 691 | ; -- HDMA1 ($FF51) 692 | ; -- High byte for Horizontal Blanking/General Purpose DMA source address (W) 693 | ; -- CGB Mode Only 694 | ; -- 695 | DEF rHDMA1 EQU $FF51 696 | 697 | 698 | ; -- 699 | ; -- HDMA2 ($FF52) 700 | ; -- Low byte for Horizontal Blanking/General Purpose DMA source address (W) 701 | ; -- CGB Mode Only 702 | ; -- 703 | DEF rHDMA2 EQU $FF52 704 | 705 | 706 | ; -- 707 | ; -- HDMA3 ($FF53) 708 | ; -- High byte for Horizontal Blanking/General Purpose DMA destination address (W) 709 | ; -- CGB Mode Only 710 | ; -- 711 | DEF rHDMA3 EQU $FF53 712 | 713 | 714 | ; -- 715 | ; -- HDMA4 ($FF54) 716 | ; -- Low byte for Horizontal Blanking/General Purpose DMA destination address (W) 717 | ; -- CGB Mode Only 718 | ; -- 719 | DEF rHDMA4 EQU $FF54 720 | 721 | 722 | ; -- 723 | ; -- HDMA5 ($FF55) 724 | ; -- Transfer length (in tiles minus 1)/mode/start for Horizontal Blanking, General Purpose DMA (R/W) 725 | ; -- CGB Mode Only 726 | ; -- 727 | DEF rHDMA5 EQU $FF55 728 | 729 | DEF HDMA5F_MODE_GP EQU %00000000 ; General Purpose DMA (W) 730 | DEF HDMA5F_MODE_HBL EQU %10000000 ; HBlank DMA (W) 731 | DEF HDMA5B_MODE EQU 7 ; DMA mode select (W) 732 | 733 | ; -- Once DMA has started, use HDMA5F_BUSY to check when the transfer is complete 734 | DEF HDMA5F_BUSY EQU %10000000 ; 0=Busy (DMA still in progress), 1=Transfer complete (R) 735 | 736 | 737 | ; -- 738 | ; -- RP ($FF56) 739 | ; -- Infrared Communications Port (R/W) 740 | ; -- CGB Mode Only 741 | ; -- 742 | DEF rRP EQU $FF56 743 | 744 | DEF RPF_ENREAD EQU %11000000 745 | DEF RPF_DATAIN EQU %00000010 ; 0=Receiving IR Signal, 1=Normal 746 | DEF RPF_WRITE_HI EQU %00000001 747 | DEF RPF_WRITE_LO EQU %00000000 748 | 749 | DEF RPB_LED_ON EQU 0 750 | DEF RPB_DATAIN EQU 1 751 | 752 | 753 | ; -- 754 | ; -- BCPS/BGPI ($FF68) 755 | ; -- Background Color Palette Specification (aka Background Palette Index) (R/W) 756 | ; -- 757 | DEF rBCPS EQU $FF68 758 | DEF rBGPI EQU rBCPS 759 | 760 | DEF BCPSF_AUTOINC EQU %10000000 ; Auto Increment (0=Disabled, 1=Increment after Writing) 761 | DEF BCPSB_AUTOINC EQU 7 762 | DEF BGPIF_AUTOINC EQU BCPSF_AUTOINC 763 | DEF BGPIB_AUTOINC EQU BCPSB_AUTOINC 764 | 765 | 766 | ; -- 767 | ; -- BCPD/BGPD ($FF69) 768 | ; -- Background Color Palette Data (aka Background Palette Data) (R/W) 769 | ; -- 770 | DEF rBCPD EQU $FF69 771 | DEF rBGPD EQU rBCPD 772 | 773 | 774 | ; -- 775 | ; -- OCPS/OBPI ($FF6A) 776 | ; -- Object Color Palette Specification (aka Object Background Palette Index) (R/W) 777 | ; -- 778 | DEF rOCPS EQU $FF6A 779 | DEF rOBPI EQU rOCPS 780 | 781 | DEF OCPSF_AUTOINC EQU %10000000 ; Auto Increment (0=Disabled, 1=Increment after Writing) 782 | DEF OCPSB_AUTOINC EQU 7 783 | DEF OBPIF_AUTOINC EQU OCPSF_AUTOINC 784 | DEF OBPIB_AUTOINC EQU OCPSB_AUTOINC 785 | 786 | 787 | ; -- 788 | ; -- OCPD/OBPD ($FF6B) 789 | ; -- Object Color Palette Data (aka Object Background Palette Data) (R/W) 790 | ; -- 791 | DEF rOCPD EQU $FF6B 792 | DEF rOBPD EQU rOCPD 793 | 794 | 795 | ; -- 796 | ; -- SMBK/SVBK ($FF70) 797 | ; -- Select Main RAM Bank (R/W) 798 | ; -- 799 | ; -- Bit 2-0 - Bank Specification (0,1: Specify Bank 1; 2-7: Specify Banks 2-7) 800 | ; -- 801 | DEF rSVBK EQU $FF70 802 | DEF rSMBK EQU rSVBK 803 | 804 | 805 | ; -- 806 | ; -- PCM12 ($FF76) 807 | ; -- Sound channel 1&2 PCM amplitude (R) 808 | ; -- 809 | ; -- Bit 7-4 - Copy of sound channel 2's PCM amplitude 810 | ; -- Bit 3-0 - Copy of sound channel 1's PCM amplitude 811 | ; -- 812 | DEF rPCM12 EQU $FF76 813 | 814 | 815 | ; -- 816 | ; -- PCM34 ($FF77) 817 | ; -- Sound channel 3&4 PCM amplitude (R) 818 | ; -- 819 | ; -- Bit 7-4 - Copy of sound channel 4's PCM amplitude 820 | ; -- Bit 3-0 - Copy of sound channel 3's PCM amplitude 821 | ; -- 822 | DEF rPCM34 EQU $FF77 823 | 824 | 825 | ; -- 826 | ; -- IE ($FFFF) 827 | ; -- Interrupt Enable (R/W) 828 | ; -- 829 | DEF rIE EQU $FFFF 830 | 831 | DEF IEF_HILO EQU %00010000 ; Transition from High to Low of Pin number P10-P13 832 | DEF IEF_SERIAL EQU %00001000 ; Serial I/O transfer end 833 | DEF IEF_TIMER EQU %00000100 ; Timer Overflow 834 | DEF IEF_STAT EQU %00000010 ; STAT 835 | DEF IEF_VBLANK EQU %00000001 ; V-Blank 836 | 837 | DEF IEB_HILO EQU 4 838 | DEF IEB_SERIAL EQU 3 839 | DEF IEB_TIMER EQU 2 840 | DEF IEB_STAT EQU 1 841 | DEF IEB_VBLANK EQU 0 842 | 843 | 844 | ;*************************************************************************** 845 | ;* 846 | ;* Flags common to multiple sound channels 847 | ;* 848 | ;*************************************************************************** 849 | 850 | ; -- 851 | ; -- Square wave duty cycle 852 | ; -- 853 | ; -- Can be used with AUD1LEN and AUD2LEN 854 | ; -- See AUD1LEN for more info 855 | ; -- 856 | DEF AUDLEN_DUTY_12_5 EQU %00000000 ; 12.5% 857 | DEF AUDLEN_DUTY_25 EQU %01000000 ; 25% 858 | DEF AUDLEN_DUTY_50 EQU %10000000 ; 50% 859 | DEF AUDLEN_DUTY_75 EQU %11000000 ; 75% 860 | 861 | 862 | ; -- 863 | ; -- Audio envelope flags 864 | ; -- 865 | ; -- Can be used with AUD1ENV, AUD2ENV, AUD4ENV 866 | ; -- See AUD1ENV for more info 867 | ; -- 868 | DEF AUDENV_UP EQU %00001000 869 | DEF AUDENV_DOWN EQU %00000000 870 | 871 | 872 | ; -- 873 | ; -- Audio trigger flags 874 | ; -- 875 | ; -- Can be used with AUD1HIGH, AUD2HIGH, AUD3HIGH 876 | ; -- See AUD1HIGH for more info 877 | ; -- 878 | DEF AUDHIGH_RESTART EQU %10000000 879 | DEF AUDHIGH_LENGTH_ON EQU %01000000 880 | DEF AUDHIGH_LENGTH_OFF EQU %00000000 881 | 882 | 883 | ;*************************************************************************** 884 | ;* 885 | ;* CPU values on bootup (a=type, b=qualifier) 886 | ;* 887 | ;*************************************************************************** 888 | 889 | DEF BOOTUP_A_DMG EQU $01 ; Dot Matrix Game 890 | DEF BOOTUP_A_CGB EQU $11 ; Color GameBoy 891 | DEF BOOTUP_A_MGB EQU $FF ; Mini GameBoy (Pocket GameBoy) 892 | 893 | ; if a=BOOTUP_A_CGB, bit 0 in b can be checked to determine if real CGB or 894 | ; other system running in GBC mode 895 | DEF BOOTUP_B_CGB EQU %00000000 896 | DEF BOOTUP_B_AGB EQU %00000001 ; GBA, GBA SP, Game Boy Player, or New GBA SP 897 | 898 | 899 | ;*************************************************************************** 900 | ;* 901 | ;* Header 902 | ;* 903 | ;*************************************************************************** 904 | 905 | ;* 906 | ;* Nintendo scrolling logo 907 | ;* (Code won't work on a real GameBoy) 908 | ;* (if next lines are altered.) 909 | MACRO NINTENDO_LOGO 910 | DB $CE,$ED,$66,$66,$CC,$0D,$00,$0B,$03,$73,$00,$83,$00,$0C,$00,$0D 911 | DB $00,$08,$11,$1F,$88,$89,$00,$0E,$DC,$CC,$6E,$E6,$DD,$DD,$D9,$99 912 | DB $BB,$BB,$67,$63,$6E,$0E,$EC,$CC,$DD,$DC,$99,$9F,$BB,$B9,$33,$3E 913 | ENDM 914 | 915 | ; $0143 Color GameBoy compatibility code 916 | DEF CART_COMPATIBLE_DMG EQU $00 917 | DEF CART_COMPATIBLE_DMG_GBC EQU $80 918 | DEF CART_COMPATIBLE_GBC EQU $C0 919 | 920 | ; $0146 GameBoy/Super GameBoy indicator 921 | DEF CART_INDICATOR_GB EQU $00 922 | DEF CART_INDICATOR_SGB EQU $03 923 | 924 | ; $0147 Cartridge type 925 | DEF CART_ROM EQU $00 926 | DEF CART_ROM_MBC1 EQU $01 927 | DEF CART_ROM_MBC1_RAM EQU $02 928 | DEF CART_ROM_MBC1_RAM_BAT EQU $03 929 | DEF CART_ROM_MBC2 EQU $05 930 | DEF CART_ROM_MBC2_BAT EQU $06 931 | DEF CART_ROM_RAM EQU $08 932 | DEF CART_ROM_RAM_BAT EQU $09 933 | DEF CART_ROM_MMM01 EQU $0B 934 | DEF CART_ROM_MMM01_RAM EQU $0C 935 | DEF CART_ROM_MMM01_RAM_BAT EQU $0D 936 | DEF CART_ROM_MBC3_BAT_RTC EQU $0F 937 | DEF CART_ROM_MBC3_RAM_BAT_RTC EQU $10 938 | DEF CART_ROM_MBC3 EQU $11 939 | DEF CART_ROM_MBC3_RAM EQU $12 940 | DEF CART_ROM_MBC3_RAM_BAT EQU $13 941 | DEF CART_ROM_MBC5 EQU $19 942 | DEF CART_ROM_MBC5_BAT EQU $1A 943 | DEF CART_ROM_MBC5_RAM_BAT EQU $1B 944 | DEF CART_ROM_MBC5_RUMBLE EQU $1C 945 | DEF CART_ROM_MBC5_RAM_RUMBLE EQU $1D 946 | DEF CART_ROM_MBC5_RAM_BAT_RUMBLE EQU $1E 947 | DEF CART_ROM_MBC7_RAM_BAT_GYRO EQU $22 948 | DEF CART_ROM_POCKET_CAMERA EQU $FC 949 | DEF CART_ROM_BANDAI_TAMA5 EQU $FD 950 | DEF CART_ROM_HUDSON_HUC3 EQU $FE 951 | DEF CART_ROM_HUDSON_HUC1 EQU $FF 952 | 953 | ; $0148 ROM size 954 | ; these are kilobytes 955 | DEF CART_ROM_32KB EQU $00 ; 2 banks 956 | DEF CART_ROM_64KB EQU $01 ; 4 banks 957 | DEF CART_ROM_128KB EQU $02 ; 8 banks 958 | DEF CART_ROM_256KB EQU $03 ; 16 banks 959 | DEF CART_ROM_512KB EQU $04 ; 32 banks 960 | DEF CART_ROM_1024KB EQU $05 ; 64 banks 961 | DEF CART_ROM_2048KB EQU $06 ; 128 banks 962 | DEF CART_ROM_4096KB EQU $07 ; 256 banks 963 | DEF CART_ROM_8192KB EQU $08 ; 512 banks 964 | DEF CART_ROM_1152KB EQU $52 ; 72 banks 965 | DEF CART_ROM_1280KB EQU $53 ; 80 banks 966 | DEF CART_ROM_1536KB EQU $54 ; 96 banks 967 | 968 | ; $0149 SRAM size 969 | ; these are kilobytes 970 | DEF CART_SRAM_NONE EQU 0 971 | DEF CART_SRAM_8KB EQU 2 ; 1 bank 972 | DEF CART_SRAM_32KB EQU 3 ; 4 banks 973 | DEF CART_SRAM_128KB EQU 4 ; 16 banks 974 | 975 | ; $014A Destination code 976 | DEF CART_DEST_JAPANESE EQU $00 977 | DEF CART_DEST_NON_JAPANESE EQU $01 978 | 979 | 980 | ;*************************************************************************** 981 | ;* 982 | ;* Keypad related 983 | ;* 984 | ;*************************************************************************** 985 | 986 | DEF PADF_DOWN EQU $80 987 | DEF PADF_UP EQU $40 988 | DEF PADF_LEFT EQU $20 989 | DEF PADF_RIGHT EQU $10 990 | DEF PADF_START EQU $08 991 | DEF PADF_SELECT EQU $04 992 | DEF PADF_B EQU $02 993 | DEF PADF_A EQU $01 994 | 995 | DEF PADB_DOWN EQU $7 996 | DEF PADB_UP EQU $6 997 | DEF PADB_LEFT EQU $5 998 | DEF PADB_RIGHT EQU $4 999 | DEF PADB_START EQU $3 1000 | DEF PADB_SELECT EQU $2 1001 | DEF PADB_B EQU $1 1002 | DEF PADB_A EQU $0 1003 | 1004 | 1005 | ;*************************************************************************** 1006 | ;* 1007 | ;* Screen related 1008 | ;* 1009 | ;*************************************************************************** 1010 | 1011 | DEF SCRN_X EQU 160 ; Width of screen in pixels 1012 | DEF SCRN_Y EQU 144 ; Height of screen in pixels. Also corresponds to the value in LY at the beginning of VBlank. 1013 | DEF SCRN_X_B EQU 20 ; Width of screen in bytes 1014 | DEF SCRN_Y_B EQU 18 ; Height of screen in bytes 1015 | 1016 | DEF SCRN_VX EQU 256 ; Virtual width of screen in pixels 1017 | DEF SCRN_VY EQU 256 ; Virtual height of screen in pixels 1018 | DEF SCRN_VX_B EQU 32 ; Virtual width of screen in bytes 1019 | DEF SCRN_VY_B EQU 32 ; Virtual height of screen in bytes 1020 | 1021 | 1022 | ;*************************************************************************** 1023 | ;* 1024 | ;* OAM related 1025 | ;* 1026 | ;*************************************************************************** 1027 | 1028 | ; OAM attributes 1029 | ; each entry in OAM RAM is 4 bytes (sizeof_OAM_ATTRS) 1030 | RSRESET 1031 | DEF OAMA_Y RB 1 ; y pos plus 16 1032 | DEF OAMA_X RB 1 ; x pos plus 8 1033 | DEF OAMA_TILEID RB 1 ; tile id 1034 | DEF OAMA_FLAGS RB 1 ; flags (see below) 1035 | DEF sizeof_OAM_ATTRS RB 0 1036 | 1037 | DEF OAM_Y_OFS EQU 16 ; add this to a screen-relative Y position to get an OAM Y position 1038 | DEF OAM_X_OFS EQU 8 ; add this to a screen-relative X position to get an OAM X position 1039 | 1040 | DEF OAM_COUNT EQU 40 ; number of OAM entries in OAM RAM 1041 | 1042 | ; flags 1043 | DEF OAMF_PRI EQU %10000000 ; Priority 1044 | DEF OAMF_YFLIP EQU %01000000 ; Y flip 1045 | DEF OAMF_XFLIP EQU %00100000 ; X flip 1046 | DEF OAMF_PAL0 EQU %00000000 ; Palette number; 0,1 (DMG) 1047 | DEF OAMF_PAL1 EQU %00010000 ; Palette number; 0,1 (DMG) 1048 | DEF OAMF_BANK0 EQU %00000000 ; Bank number; 0,1 (GBC) 1049 | DEF OAMF_BANK1 EQU %00001000 ; Bank number; 0,1 (GBC) 1050 | 1051 | DEF OAMF_PALMASK EQU %00000111 ; Palette (GBC) 1052 | 1053 | DEF OAMB_PRI EQU 7 ; Priority 1054 | DEF OAMB_YFLIP EQU 6 ; Y flip 1055 | DEF OAMB_XFLIP EQU 5 ; X flip 1056 | DEF OAMB_PAL1 EQU 4 ; Palette number; 0,1 (DMG) 1057 | DEF OAMB_BANK1 EQU 3 ; Bank number; 0,1 (GBC) 1058 | 1059 | 1060 | ; Deprecated constants. Please avoid using. 1061 | 1062 | DEF IEF_LCDC EQU %00000010 ; LCDC (see STAT) 1063 | DEF _VRAM8000 EQU _VRAM 1064 | DEF _VRAM8800 EQU _VRAM+$800 1065 | DEF _VRAM9000 EQU _VRAM+$1000 1066 | DEF CART_SRAM_2KB EQU 1 ; 1 incomplete bank 1067 | 1068 | 1069 | ENDC ;HARDWARE_INC 1070 | -------------------------------------------------------------------------------- /player.asm: -------------------------------------------------------------------------------- 1 | include "include/hardware.inc" 2 | 3 | ; Constants 4 | DEF STACK_SIZE EQU $7A 5 | ;; Stack starts at $FFFE 6 | 7 | ; $0000 - $003F: RST handlers. 8 | 9 | SECTION "restarts", ROM0[$0000] 10 | ret 11 | REPT 7 12 | nop 13 | ENDR 14 | ; $0008 15 | ret 16 | REPT 7 17 | nop 18 | ENDR 19 | ; $0010 20 | ret 21 | REPT 7 22 | nop 23 | ENDR 24 | ; $0018 25 | ret 26 | REPT 7 27 | nop 28 | ENDR 29 | ; $0020 30 | ret 31 | REPT 7 32 | nop 33 | ENDR 34 | ; $0028 35 | ret 36 | REPT 7 37 | nop 38 | ENDR 39 | ; $0030 40 | ret 41 | REPT 7 42 | nop 43 | ENDR 44 | ; $0038 45 | ret 46 | REPT 7 47 | nop 48 | ENDR 49 | 50 | ; Interrupt addresses 51 | SECTION "Vblank interrupt", ROM0[$0040] 52 | reti 53 | 54 | SECTION "LCD controller status interrupt", ROM0[$0048] 55 | ;; HACK!!!!!!!!!!!!! 56 | ;; there's some sort of bug in the emulator which needs to be fixed, 57 | ;; which screws up the program counter immediately after it exits a halt. 58 | ;; this nop protects against that for now. 59 | nop 60 | jp isr_wrapper 61 | 62 | SECTION "Timer overflow interrupt", ROM0[$0050] 63 | nop 64 | jp isr_wrapper 65 | 66 | SECTION "Serial transfer completion interrupt", ROM0[$0058] 67 | reti 68 | 69 | SECTION "P10-P13 signal low edge interrupt", ROM0[$0060] 70 | reti 71 | 72 | ; Reserved stack space 73 | SECTION "Stack", HRAM[$FFFE - STACK_SIZE] 74 | ds STACK_SIZE 75 | 76 | ; Control starts here, but there's more ROM header several bytes later, so the 77 | ; only thing we can really do is immediately jump to after the header 78 | 79 | SECTION "Header", ROM0[$0100] 80 | nop 81 | jp $0150 82 | 83 | NINTENDO_LOGO 84 | 85 | ; $0134 - $013E: The title, in upper-case letters, followed by zeroes. 86 | DB "HUGE" 87 | DS 7 ; padding 88 | ; $013F - $0142: The manufacturer code. Empty for now 89 | DS 4 90 | DS 1 91 | ; $0144 - $0145: "New" Licensee Code, a two character name. 92 | DB "NF" 93 | 94 | ; Initialization 95 | SECTION "main", ROM0[$0150] 96 | jp _init 97 | 98 | isr_wrapper: 99 | push af 100 | push hl 101 | push bc 102 | push de 103 | call hUGE_dosound 104 | pop de 105 | pop bc 106 | pop hl 107 | pop af 108 | reti 109 | 110 | _paint_tile: 111 | ld a, b 112 | ld [hl+], a 113 | ld a, c 114 | ld [hl+], a 115 | ret 116 | 117 | _init: 118 | xor a 119 | ldh [rIF], a 120 | inc a 121 | ldh [rIE], a 122 | halt 123 | nop 124 | 125 | ; Set LCD palette for grayscale mode; yes, it has a palette 126 | ld a, %11100100 127 | ldh [$FF47], a 128 | 129 | ;; Fill with pattern 130 | ld hl, $8000 131 | ld bc, `10000000 132 | call _paint_tile 133 | ld bc, `01000000 134 | call _paint_tile 135 | ld bc, `00100000 136 | call _paint_tile 137 | ld bc, `00010000 138 | call _paint_tile 139 | ld bc, `00001000 140 | call _paint_tile 141 | ld bc, `00000100 142 | call _paint_tile 143 | ld bc, `00000010 144 | call _paint_tile 145 | ld bc, `00000001 146 | call _paint_tile 147 | 148 | ; Enable sound globally 149 | ld a, $80 150 | ldh [rAUDENA], a 151 | ; Enable all channels in stereo 152 | ld a, $FF 153 | ldh [rAUDTERM], a 154 | ; Set volume 155 | ld a, $77 156 | ldh [rAUDVOL], a 157 | 158 | ld hl, SONG_DESCRIPTOR 159 | call hUGE_init 160 | 161 | IF DEF(USE_TIMER) 162 | ld a, TIMER_MODULO 163 | ldh [rTMA], a 164 | ld a, 4 ; 4096 hz 165 | ldh [rTAC], a 166 | 167 | ld a, IEF_TIMER 168 | ldh [rIE], a 169 | ei 170 | ELSE 171 | ;; Enable the HBlank interrupt on scanline 0 172 | ldh a, [rSTAT] 173 | or a, STATF_LYC 174 | ldh [rSTAT], a 175 | xor a ; ld a, 0 176 | ldh [rLYC], a 177 | 178 | ld a, IEF_LCDC 179 | ldh [rIE], a 180 | ei 181 | ENDC 182 | 183 | _halt: 184 | ; Do nothing, forever 185 | halt 186 | nop 187 | jr _halt 188 | -------------------------------------------------------------------------------- /rgbds_example/README.md: -------------------------------------------------------------------------------- 1 | This is a simple example of how to use hUGEDriver in your game. 2 | 3 | Make sure you have RGBDS in your path, then run `build.bat` to build a .gb file which plays some music! 4 | 5 | You can run `output.gb` in your favorite Game Boy emulator. 6 | -------------------------------------------------------------------------------- /rgbds_example/build.bat: -------------------------------------------------------------------------------- 1 | :: Assemble the hUGEDriver source into an object 2 | rgbasm -ohUGEDriver.obj -i.. ../hUGEDriver.asm 3 | 4 | :: Assemble the song into an object 5 | rgbasm -osample_song.obj -i.. sample_song.asm 6 | 7 | :: Assemble the example player code into an object 8 | rgbasm -H -oplayer.obj -i.. -DSONG_DESCRIPTOR=sample_song ../player.asm 9 | 10 | :: Link the objects together and run rgbfix 11 | rgblink -ooutput.gb -noutput.sym player.obj hUGEDriver.obj sample_song.obj 12 | rgbfix -p0 -fhg output.gb 13 | -------------------------------------------------------------------------------- /rgbds_example/build.sh: -------------------------------------------------------------------------------- 1 | # Assemble the hUGEDriver source into an object 2 | rgbasm -ohUGEDriver.obj -i.. ../hUGEDriver.asm 3 | 4 | # Assemble the song into an object 5 | rgbasm -osample_song.obj -i.. sample_song.asm 6 | 7 | # Assemble the example player code into an object 8 | rgbasm -H -oplayer.obj -i.. -DSONG_DESCRIPTOR=sample_song ../player.asm 9 | 10 | # Link the objects together and run rgbfix 11 | rgblink -ooutput.gb -noutput.sym player.obj hUGEDriver.obj sample_song.obj 12 | rgbfix -p0 -fhg output.gb 13 | -------------------------------------------------------------------------------- /rgbds_example/sample_song.asm: -------------------------------------------------------------------------------- 1 | include "include/hUGE.inc" 2 | 3 | SECTION "Song Data", ROMX 4 | 5 | sample_song:: 6 | db 2 7 | dw order_cnt 8 | dw order1, order2, order3, order4 9 | dw duty_instruments, wave_instruments, noise_instruments 10 | dw routines 11 | dw waves 12 | 13 | order_cnt: db 68 14 | order1: dw P0,P0,P0,P0,P0,P0,P0,P0,P0,P0,P11,P11,P12,P15,P11,P11,P12,P19,P11,P11,P12,P15,P11,P11,P12,P19,P29,P32,P11,P11,P29,P32,P11,P11 15 | order2: dw P1,P1,P1,P1,P1,P1,P1,P1,P1,P1,P10,P10,P13,P16,P10,P10,P13,P20,P10,P10,P13,P16,P10,P10,P13,P20,P30,P33,P35,P10,P30,P33,P35,P38 16 | order3: dw P2,P2,P4,P4,P5,P6,P4,P4,P5,P8,P9,P9,P14,P17,P9,P9,P14,P18,P21,P22,P23,P24,P25,P26,P27,P28,P31,P34,P36,P37,P31,P34,P36,P39 17 | order4: dw P3,P3,P3,P3,P3,P3,P3,P3,P3,P7,P3,P3,P3,P3,P3,P3,P3,P7,P3,P3,P3,P3,P3,P3,P3,P7,P3,P3,P3,P3,P3,P3,P3,P7 18 | 19 | P0: 20 | dn C_5,1,$2FF 21 | dn ___,0,$2FF 22 | dn C_3,0,$216 23 | dn ___,0,$218 24 | dn ___,0,$000 25 | dn ___,0,$000 26 | dn ___,0,$000 27 | dn ___,0,$000 28 | dn C_6,1,$2FF 29 | dn ___,0,$2FF 30 | dn C_3,0,$216 31 | dn ___,0,$218 32 | dn ___,0,$000 33 | dn ___,0,$000 34 | dn ___,0,$000 35 | dn ___,0,$000 36 | dn C_5,1,$2FF 37 | dn ___,0,$2FF 38 | dn C_3,0,$216 39 | dn ___,0,$218 40 | dn C_5,1,$2FF 41 | dn ___,0,$2FF 42 | dn C_3,0,$216 43 | dn ___,0,$218 44 | dn C_6,1,$2FF 45 | dn ___,0,$2FF 46 | dn C_3,0,$216 47 | dn ___,0,$218 48 | dn ___,0,$000 49 | dn ___,0,$000 50 | dn ___,0,$000 51 | dn ___,0,$000 52 | dn C_5,1,$2FF 53 | dn ___,0,$2FF 54 | dn C_3,0,$216 55 | dn ___,0,$218 56 | dn ___,0,$000 57 | dn ___,0,$000 58 | dn ___,0,$000 59 | dn ___,0,$000 60 | dn C_6,1,$2FF 61 | dn ___,0,$2FF 62 | dn C_3,0,$216 63 | dn ___,0,$218 64 | dn C_5,1,$2FF 65 | dn ___,0,$2FF 66 | dn C_3,0,$216 67 | dn ___,0,$218 68 | dn ___,0,$000 69 | dn ___,0,$000 70 | dn ___,0,$000 71 | dn ___,0,$000 72 | dn C_5,1,$2FF 73 | dn ___,0,$2FF 74 | dn C_3,0,$216 75 | dn ___,0,$218 76 | dn C_6,1,$2FF 77 | dn ___,0,$2FF 78 | dn C_3,0,$216 79 | dn ___,0,$218 80 | dn ___,0,$000 81 | dn ___,0,$000 82 | dn ___,0,$000 83 | dn ___,0,$000 84 | 85 | P1: 86 | dn ___,0,$000 87 | dn ___,0,$000 88 | dn ___,0,$000 89 | dn ___,0,$000 90 | dn C_5,2,$2FF 91 | dn ___,0,$2FF 92 | dn C_3,0,$216 93 | dn ___,0,$218 94 | dn ___,0,$000 95 | dn ___,0,$000 96 | dn ___,0,$000 97 | dn ___,0,$000 98 | dn C_6,2,$2FF 99 | dn ___,0,$2FF 100 | dn C_3,0,$216 101 | dn ___,0,$218 102 | dn ___,0,$000 103 | dn ___,0,$000 104 | dn ___,0,$000 105 | dn ___,0,$000 106 | dn C_5,2,$2FF 107 | dn ___,0,$2FF 108 | dn C_3,0,$216 109 | dn ___,0,$218 110 | dn C_5,2,$2FF 111 | dn ___,0,$2FF 112 | dn C_3,0,$216 113 | dn ___,0,$218 114 | dn C_6,2,$2FF 115 | dn ___,0,$2FF 116 | dn C_3,0,$216 117 | dn ___,0,$218 118 | dn ___,0,$000 119 | dn ___,0,$000 120 | dn ___,0,$000 121 | dn ___,0,$000 122 | dn C_5,2,$2FF 123 | dn ___,0,$2FF 124 | dn C_3,0,$216 125 | dn ___,0,$218 126 | dn ___,0,$000 127 | dn ___,0,$000 128 | dn ___,0,$000 129 | dn ___,0,$000 130 | dn C_6,2,$2FF 131 | dn ___,0,$2FF 132 | dn C_3,0,$216 133 | dn ___,0,$218 134 | dn C_5,2,$2FF 135 | dn ___,0,$2FF 136 | dn C_3,0,$216 137 | dn ___,0,$218 138 | dn ___,0,$000 139 | dn ___,0,$000 140 | dn ___,0,$000 141 | dn ___,0,$000 142 | dn C_5,2,$2FF 143 | dn ___,0,$2FF 144 | dn C_3,0,$216 145 | dn ___,0,$218 146 | dn C_6,2,$2FF 147 | dn ___,0,$2FF 148 | dn C_3,0,$216 149 | dn ___,0,$218 150 | 151 | P2: 152 | dn ___,0,$000 153 | dn ___,0,$000 154 | dn ___,0,$000 155 | dn ___,0,$000 156 | dn ___,0,$000 157 | dn ___,0,$000 158 | dn ___,0,$000 159 | dn ___,0,$000 160 | dn ___,0,$000 161 | dn ___,0,$000 162 | dn ___,0,$000 163 | dn ___,0,$000 164 | dn ___,0,$000 165 | dn ___,0,$000 166 | dn ___,0,$000 167 | dn ___,0,$000 168 | dn ___,0,$000 169 | dn ___,0,$000 170 | dn ___,0,$000 171 | dn ___,0,$000 172 | dn ___,0,$000 173 | dn ___,0,$000 174 | dn ___,0,$000 175 | dn ___,0,$000 176 | dn ___,0,$000 177 | dn ___,0,$000 178 | dn ___,0,$000 179 | dn ___,0,$000 180 | dn ___,0,$000 181 | dn ___,0,$000 182 | dn ___,0,$000 183 | dn ___,0,$000 184 | dn ___,0,$000 185 | dn ___,0,$000 186 | dn ___,0,$000 187 | dn ___,0,$000 188 | dn ___,0,$000 189 | dn ___,0,$000 190 | dn ___,0,$000 191 | dn ___,0,$000 192 | dn ___,0,$000 193 | dn ___,0,$000 194 | dn ___,0,$000 195 | dn ___,0,$000 196 | dn ___,0,$000 197 | dn ___,0,$000 198 | dn ___,0,$000 199 | dn ___,0,$000 200 | dn ___,0,$000 201 | dn ___,0,$000 202 | dn ___,0,$000 203 | dn ___,0,$000 204 | dn ___,0,$000 205 | dn ___,0,$000 206 | dn ___,0,$000 207 | dn ___,0,$000 208 | dn ___,0,$000 209 | dn ___,0,$000 210 | dn ___,0,$000 211 | dn ___,0,$000 212 | dn ___,0,$000 213 | dn ___,0,$000 214 | dn ___,0,$000 215 | dn ___,0,$000 216 | 217 | P3: 218 | dn F_7,1,$000 219 | dn F_6,2,$000 220 | dn ___,0,$000 221 | dn ___,0,$000 222 | dn ___,0,$000 223 | dn ___,0,$000 224 | dn ___,0,$000 225 | dn ___,0,$000 226 | dn C_7,3,$000 227 | dn D#8,3,$000 228 | dn ___,0,$000 229 | dn ___,0,$000 230 | dn ___,0,$000 231 | dn ___,0,$000 232 | dn ___,0,$000 233 | dn ___,0,$000 234 | dn F_7,1,$000 235 | dn F_6,2,$000 236 | dn ___,0,$000 237 | dn ___,0,$000 238 | dn F_7,1,$000 239 | dn F_6,2,$000 240 | dn ___,0,$000 241 | dn ___,0,$000 242 | dn C_7,3,$000 243 | dn D#8,3,$000 244 | dn ___,0,$000 245 | dn ___,0,$000 246 | dn ___,0,$000 247 | dn ___,0,$000 248 | dn ___,0,$000 249 | dn ___,0,$000 250 | dn F_7,1,$000 251 | dn F_6,2,$000 252 | dn ___,0,$000 253 | dn ___,0,$000 254 | dn ___,0,$000 255 | dn ___,0,$000 256 | dn ___,0,$000 257 | dn ___,0,$000 258 | dn C_7,3,$000 259 | dn D#8,3,$000 260 | dn ___,0,$000 261 | dn ___,0,$000 262 | dn F_7,1,$000 263 | dn F_6,2,$000 264 | dn ___,0,$000 265 | dn ___,0,$000 266 | dn ___,0,$000 267 | dn ___,0,$000 268 | dn ___,0,$000 269 | dn ___,0,$000 270 | dn F_7,1,$000 271 | dn F_6,2,$000 272 | dn ___,0,$000 273 | dn ___,0,$000 274 | dn C_7,3,$000 275 | dn D#8,3,$000 276 | dn ___,0,$000 277 | dn ___,0,$000 278 | dn ___,0,$000 279 | dn ___,0,$000 280 | dn ___,0,$000 281 | dn ___,0,$000 282 | 283 | P4: 284 | dn C_4,4,$C0F 285 | dn ___,0,$000 286 | dn C_4,5,$C0F 287 | dn ___,0,$000 288 | dn C_4,6,$C07 289 | dn ___,0,$000 290 | dn C_4,7,$C07 291 | dn ___,0,$000 292 | dn C_4,6,$C0F 293 | dn ___,0,$000 294 | dn C_4,5,$C0F 295 | dn ___,0,$000 296 | dn C_4,4,$C07 297 | dn ___,0,$000 298 | dn C_4,5,$C07 299 | dn ___,0,$000 300 | dn C_4,6,$C0F 301 | dn ___,0,$000 302 | dn C_4,7,$C0F 303 | dn ___,0,$000 304 | dn G_3,6,$C0F 305 | dn ___,0,$000 306 | dn G_3,5,$C0F 307 | dn ___,0,$000 308 | dn A#3,4,$C0F 309 | dn ___,0,$000 310 | dn A#3,5,$C0F 311 | dn ___,0,$000 312 | dn C_4,6,$C0F 313 | dn ___,0,$000 314 | dn C_4,7,$C0F 315 | dn ___,0,$000 316 | dn C_4,6,$C07 317 | dn ___,0,$000 318 | dn C_4,5,$C07 319 | dn ___,0,$000 320 | dn C_4,4,$C0F 321 | dn ___,0,$000 322 | dn C_4,5,$C0F 323 | dn ___,0,$000 324 | dn C_4,6,$C07 325 | dn ___,0,$000 326 | dn C_4,7,$C07 327 | dn ___,0,$000 328 | dn C_4,6,$C0F 329 | dn ___,0,$000 330 | dn C_4,5,$C0F 331 | dn ___,0,$000 332 | dn C_4,4,$C0F 333 | dn ___,0,$000 334 | dn C_4,5,$C0F 335 | dn ___,0,$000 336 | dn G_3,6,$C0F 337 | dn ___,0,$000 338 | dn G_3,7,$C0F 339 | dn ___,0,$000 340 | dn A#3,6,$C0F 341 | dn ___,0,$000 342 | dn A#3,5,$C0F 343 | dn ___,0,$000 344 | dn G_3,4,$C0F 345 | dn ___,0,$000 346 | dn G_3,5,$C0F 347 | dn ___,0,$000 348 | 349 | P5: 350 | dn D#4,4,$C0F 351 | dn ___,0,$000 352 | dn D#4,5,$C0F 353 | dn ___,0,$000 354 | dn D#4,6,$C07 355 | dn ___,0,$000 356 | dn D#4,7,$C07 357 | dn ___,0,$000 358 | dn D#4,6,$C0F 359 | dn ___,0,$000 360 | dn D#4,5,$C0F 361 | dn ___,0,$000 362 | dn D#4,4,$C07 363 | dn ___,0,$000 364 | dn D#4,5,$C07 365 | dn ___,0,$000 366 | dn D#4,6,$C0F 367 | dn ___,0,$000 368 | dn D#4,7,$C0F 369 | dn ___,0,$000 370 | dn A#3,6,$C0F 371 | dn ___,0,$000 372 | dn A#3,5,$C0F 373 | dn ___,0,$000 374 | dn C#4,4,$C0F 375 | dn ___,0,$000 376 | dn C#4,5,$C0F 377 | dn ___,0,$000 378 | dn D#4,6,$C0F 379 | dn ___,0,$000 380 | dn D#4,7,$C0F 381 | dn ___,0,$000 382 | dn D#4,6,$C07 383 | dn ___,0,$000 384 | dn D#4,5,$C07 385 | dn ___,0,$000 386 | dn D#4,4,$C0F 387 | dn ___,0,$000 388 | dn D#4,5,$C0F 389 | dn ___,0,$000 390 | dn D#4,6,$C07 391 | dn ___,0,$000 392 | dn D#4,7,$C07 393 | dn ___,0,$000 394 | dn D#4,6,$C0F 395 | dn ___,0,$000 396 | dn D#4,5,$C0F 397 | dn ___,0,$000 398 | dn D#4,4,$C0F 399 | dn ___,0,$000 400 | dn D#4,5,$C0F 401 | dn ___,0,$000 402 | dn A#3,6,$C0F 403 | dn ___,0,$000 404 | dn A#3,7,$C0F 405 | dn ___,0,$000 406 | dn C#4,6,$C0F 407 | dn ___,0,$000 408 | dn C#4,5,$C0F 409 | dn ___,0,$000 410 | dn A#3,4,$C0F 411 | dn ___,0,$000 412 | dn A#3,5,$C0F 413 | dn ___,0,$000 414 | 415 | P6: 416 | dn F_4,4,$C0F 417 | dn ___,0,$000 418 | dn F_4,5,$C0F 419 | dn ___,0,$000 420 | dn F_4,6,$C07 421 | dn ___,0,$000 422 | dn F_4,7,$C07 423 | dn ___,0,$000 424 | dn F_4,6,$C0F 425 | dn ___,0,$000 426 | dn F_4,5,$C0F 427 | dn ___,0,$000 428 | dn F_4,4,$C07 429 | dn ___,0,$000 430 | dn F_4,5,$C07 431 | dn ___,0,$000 432 | dn F_4,6,$C0F 433 | dn ___,0,$000 434 | dn F_4,7,$C0F 435 | dn ___,0,$000 436 | dn C_4,6,$C0F 437 | dn ___,0,$000 438 | dn C_4,5,$C0F 439 | dn ___,0,$000 440 | dn D#4,4,$C0F 441 | dn ___,0,$000 442 | dn D#4,5,$C0F 443 | dn ___,0,$000 444 | dn G_4,6,$C0F 445 | dn ___,0,$000 446 | dn G_4,7,$C0F 447 | dn ___,0,$000 448 | dn G_4,6,$C07 449 | dn ___,0,$000 450 | dn G_4,5,$C07 451 | dn ___,0,$000 452 | dn G_4,4,$C0F 453 | dn ___,0,$000 454 | dn G_4,5,$C0F 455 | dn ___,0,$000 456 | dn G_4,6,$C07 457 | dn ___,0,$000 458 | dn G_4,7,$C07 459 | dn ___,0,$000 460 | dn G_4,6,$C0F 461 | dn ___,0,$000 462 | dn G_4,5,$C0F 463 | dn ___,0,$000 464 | dn G_4,4,$C0F 465 | dn ___,0,$000 466 | dn G_4,5,$C0F 467 | dn ___,0,$000 468 | dn D#4,6,$C0F 469 | dn ___,0,$000 470 | dn D#4,7,$C0F 471 | dn ___,0,$000 472 | dn D_4,6,$C0F 473 | dn ___,0,$000 474 | dn D_4,5,$C0F 475 | dn ___,0,$000 476 | dn A#3,4,$C0F 477 | dn ___,0,$000 478 | dn A#3,5,$C0F 479 | dn ___,0,$000 480 | 481 | P7: 482 | dn F_7,1,$000 483 | dn F_6,2,$000 484 | dn ___,0,$000 485 | dn ___,0,$000 486 | dn ___,0,$000 487 | dn ___,0,$000 488 | dn ___,0,$000 489 | dn ___,0,$000 490 | dn C_7,3,$000 491 | dn D#8,3,$000 492 | dn ___,0,$000 493 | dn ___,0,$000 494 | dn ___,0,$000 495 | dn ___,0,$000 496 | dn ___,0,$000 497 | dn ___,0,$000 498 | dn F_7,1,$000 499 | dn F_6,2,$000 500 | dn ___,0,$000 501 | dn ___,0,$000 502 | dn F_7,1,$000 503 | dn F_6,2,$000 504 | dn ___,0,$000 505 | dn ___,0,$000 506 | dn C_7,3,$000 507 | dn D#8,3,$000 508 | dn ___,0,$000 509 | dn ___,0,$000 510 | dn ___,0,$000 511 | dn ___,0,$000 512 | dn ___,0,$000 513 | dn ___,0,$000 514 | dn C_7,3,$000 515 | dn D#8,3,$C65 516 | dn ___,0,$000 517 | dn ___,0,$000 518 | dn ___,0,$000 519 | dn ___,0,$000 520 | dn ___,0,$000 521 | dn ___,0,$000 522 | dn ___,0,$000 523 | dn ___,0,$000 524 | dn ___,0,$000 525 | dn ___,0,$000 526 | dn ___,0,$000 527 | dn ___,0,$000 528 | dn ___,0,$000 529 | dn ___,0,$000 530 | dn ___,0,$000 531 | dn ___,0,$000 532 | dn ___,0,$000 533 | dn ___,0,$000 534 | dn D#8,3,$CC0 535 | dn ___,0,$000 536 | dn ___,0,$000 537 | dn ___,0,$000 538 | dn B_7,0,$000 539 | dn A#7,0,$000 540 | dn A_7,0,$000 541 | dn F#7,0,$000 542 | dn F_7,0,$000 543 | dn E_7,0,$000 544 | dn D#7,0,$000 545 | dn D_7,0,$000 546 | 547 | P8: 548 | dn F_4,4,$C0F 549 | dn ___,0,$000 550 | dn F_4,5,$C0F 551 | dn ___,0,$000 552 | dn F_4,6,$C07 553 | dn ___,0,$000 554 | dn F_4,7,$C07 555 | dn ___,0,$000 556 | dn F_4,6,$C0F 557 | dn ___,0,$000 558 | dn F_4,5,$C0F 559 | dn ___,0,$000 560 | dn F_4,4,$C07 561 | dn ___,0,$000 562 | dn F_4,5,$C07 563 | dn ___,0,$000 564 | dn F_4,6,$C0F 565 | dn ___,0,$000 566 | dn F_4,7,$C0F 567 | dn ___,0,$000 568 | dn D#4,6,$C0F 569 | dn ___,0,$000 570 | dn D#4,5,$C0F 571 | dn ___,0,$000 572 | dn D_4,4,$C0F 573 | dn ___,0,$000 574 | dn D_4,5,$C0F 575 | dn ___,0,$000 576 | dn A#3,6,$C0F 577 | dn ___,0,$000 578 | dn A#3,7,$C0F 579 | dn ___,0,$000 580 | dn A#3,6,$C07 581 | dn ___,0,$000 582 | dn A#3,5,$C07 583 | dn ___,0,$000 584 | dn A#3,4,$C07 585 | dn ___,0,$000 586 | dn A#3,5,$C07 587 | dn ___,0,$000 588 | dn A#3,6,$C03 589 | dn ___,0,$000 590 | dn A#3,7,$C03 591 | dn ___,0,$000 592 | dn A#3,6,$C03 593 | dn ___,0,$000 594 | dn A#3,5,$C03 595 | dn ___,0,$000 596 | dn A#3,4,$C07 597 | dn ___,0,$000 598 | dn A#3,5,$C07 599 | dn ___,0,$000 600 | dn A#3,6,$C07 601 | dn ___,0,$000 602 | dn A#3,7,$C07 603 | dn ___,0,$000 604 | dn A#3,6,$C0F 605 | dn ___,0,$000 606 | dn A#3,5,$C0F 607 | dn ___,0,$000 608 | dn A#3,4,$C0F 609 | dn ___,0,$000 610 | dn A#3,5,$C0F 611 | dn ___,0,$000 612 | 613 | P9: 614 | dn C_6,3,$C0F 615 | dn C_6,4,$C0F 616 | dn G_6,3,$C07 617 | dn G_6,4,$C07 618 | dn D#6,3,$C0F 619 | dn D#6,4,$C0F 620 | dn C_6,3,$C07 621 | dn C_6,4,$C07 622 | dn G_6,3,$C0F 623 | dn G_6,4,$C0F 624 | dn G_6,3,$C07 625 | dn G_6,4,$C07 626 | dn C_6,3,$C0F 627 | dn C_6,4,$C0F 628 | dn G_6,3,$C07 629 | dn G_6,4,$C07 630 | dn D#6,3,$C0F 631 | dn D#6,4,$C0F 632 | dn C_6,3,$C07 633 | dn C_6,4,$C07 634 | dn G_6,3,$C0F 635 | dn G_6,4,$C0F 636 | dn G_6,3,$C07 637 | dn G_6,4,$C07 638 | dn C_6,3,$C0F 639 | dn C_6,4,$C0F 640 | dn G_6,3,$C07 641 | dn G_6,4,$C07 642 | dn D#6,3,$C0F 643 | dn D#6,4,$C0F 644 | dn C_6,3,$C07 645 | dn C_6,4,$C07 646 | dn G_6,3,$C0F 647 | dn G_6,4,$C0F 648 | dn G_6,3,$C07 649 | dn G_6,4,$C07 650 | dn C_6,3,$C0F 651 | dn C_6,4,$C0F 652 | dn G_6,3,$C07 653 | dn G_6,4,$C07 654 | dn D#6,3,$C0F 655 | dn D#6,4,$C0F 656 | dn C_6,3,$C07 657 | dn C_6,4,$C07 658 | dn G_6,3,$C0F 659 | dn G_6,4,$C0F 660 | dn G_6,3,$C07 661 | dn G_6,4,$C07 662 | dn C_6,3,$C0F 663 | dn C_6,4,$C0F 664 | dn G_6,3,$C07 665 | dn G_6,4,$C07 666 | dn D#6,3,$C0F 667 | dn D#6,4,$C0F 668 | dn C_6,3,$C07 669 | dn C_6,4,$C07 670 | dn G_6,3,$C0F 671 | dn G_6,4,$C0F 672 | dn G_6,3,$C07 673 | dn G_6,4,$C07 674 | dn D#6,3,$C0F 675 | dn D#6,4,$C0F 676 | dn G_6,3,$C07 677 | dn G_6,4,$C07 678 | 679 | P10: 680 | dn C_5,3,$900 681 | dn D#5,0,$000 682 | dn G_5,0,$940 683 | dn C_5,0,$000 684 | dn D#5,0,$980 685 | dn G_5,0,$000 686 | dn C_5,0,$9C0 687 | dn D#5,0,$000 688 | dn G_5,3,$900 689 | dn C_5,0,$000 690 | dn D#5,0,$940 691 | dn G_5,0,$000 692 | dn C_5,0,$980 693 | dn D#5,0,$000 694 | dn G_5,0,$9C0 695 | dn C_5,0,$000 696 | dn D#5,3,$900 697 | dn G_5,0,$000 698 | dn C_5,0,$940 699 | dn D#5,0,$000 700 | dn G_5,0,$980 701 | dn C_5,0,$000 702 | dn D#5,0,$9C0 703 | dn G_5,0,$000 704 | dn C_5,3,$900 705 | dn D#5,0,$000 706 | dn G_5,0,$940 707 | dn C_5,0,$000 708 | dn D#5,0,$980 709 | dn G_5,0,$000 710 | dn C_5,0,$9C0 711 | dn D#5,0,$000 712 | dn G_5,3,$900 713 | dn C_5,0,$000 714 | dn D#5,0,$940 715 | dn G_5,0,$000 716 | dn C_5,0,$980 717 | dn D#5,0,$000 718 | dn G_5,0,$9C0 719 | dn C_5,0,$000 720 | dn D#5,3,$900 721 | dn G_5,0,$000 722 | dn C_5,0,$940 723 | dn D#5,0,$000 724 | dn G_5,0,$980 725 | dn C_5,0,$000 726 | dn D#5,0,$9C0 727 | dn G_5,0,$000 728 | dn C_5,3,$900 729 | dn D#5,0,$000 730 | dn G_5,0,$940 731 | dn C_5,0,$000 732 | dn D#5,0,$980 733 | dn G_5,0,$000 734 | dn C_5,0,$9C0 735 | dn D#5,0,$000 736 | dn G_5,3,$900 737 | dn C_5,0,$000 738 | dn D#5,0,$940 739 | dn G_5,0,$000 740 | dn C_5,0,$980 741 | dn D#5,0,$000 742 | dn G_5,0,$9C0 743 | dn C_5,0,$000 744 | 745 | P11: 746 | dn C_5,4,$000 747 | dn C_3,5,$000 748 | dn ___,0,$000 749 | dn ___,0,$000 750 | dn C_3,5,$000 751 | dn ___,0,$000 752 | dn ___,0,$000 753 | dn ___,0,$000 754 | dn F#5,6,$000 755 | dn C_3,5,$000 756 | dn ___,0,$000 757 | dn ___,0,$000 758 | dn C_5,4,$000 759 | dn C_3,5,$000 760 | dn ___,0,$000 761 | dn ___,0,$000 762 | dn C_3,5,$000 763 | dn ___,0,$000 764 | dn ___,0,$000 765 | dn ___,0,$000 766 | dn C_5,4,$000 767 | dn G_3,5,$000 768 | dn ___,0,$000 769 | dn ___,0,$000 770 | dn F#5,6,$000 771 | dn A#3,5,$000 772 | dn ___,0,$000 773 | dn ___,0,$000 774 | dn C_4,5,$000 775 | dn ___,0,$000 776 | dn ___,0,$000 777 | dn ___,0,$000 778 | dn C_5,4,$000 779 | dn C_3,5,$000 780 | dn ___,0,$000 781 | dn ___,0,$000 782 | dn C_3,5,$000 783 | dn ___,0,$000 784 | dn ___,0,$000 785 | dn ___,0,$000 786 | dn F#5,6,$000 787 | dn C_3,5,$000 788 | dn ___,0,$000 789 | dn ___,0,$000 790 | dn C_5,4,$000 791 | dn C_3,5,$000 792 | dn ___,0,$000 793 | dn ___,0,$000 794 | dn C_3,5,$000 795 | dn ___,0,$000 796 | dn ___,0,$000 797 | dn ___,0,$000 798 | dn C_5,4,$000 799 | dn G_3,5,$000 800 | dn ___,0,$000 801 | dn ___,0,$000 802 | dn F#5,6,$000 803 | dn A#3,5,$000 804 | dn ___,0,$000 805 | dn ___,0,$000 806 | dn C_4,5,$000 807 | dn ___,0,$000 808 | dn ___,0,$000 809 | dn ___,0,$000 810 | 811 | P12: 812 | dn D#5,4,$000 813 | dn D#3,5,$000 814 | dn ___,0,$000 815 | dn ___,0,$000 816 | dn D#3,5,$000 817 | dn ___,0,$000 818 | dn ___,0,$000 819 | dn ___,0,$000 820 | dn A_5,6,$000 821 | dn D#3,5,$000 822 | dn ___,0,$000 823 | dn ___,0,$000 824 | dn D#5,4,$000 825 | dn D#3,5,$000 826 | dn ___,0,$000 827 | dn ___,0,$000 828 | dn D#3,5,$000 829 | dn ___,0,$000 830 | dn ___,0,$000 831 | dn ___,0,$000 832 | dn D#5,4,$000 833 | dn A#3,5,$000 834 | dn ___,0,$000 835 | dn ___,0,$000 836 | dn A_5,6,$000 837 | dn C#4,5,$000 838 | dn ___,0,$000 839 | dn ___,0,$000 840 | dn D#4,5,$000 841 | dn ___,0,$000 842 | dn ___,0,$000 843 | dn ___,0,$000 844 | dn D#5,4,$000 845 | dn D#3,5,$000 846 | dn ___,0,$000 847 | dn ___,0,$000 848 | dn D#3,5,$000 849 | dn ___,0,$000 850 | dn ___,0,$000 851 | dn ___,0,$000 852 | dn A_5,6,$000 853 | dn D#3,5,$000 854 | dn ___,0,$000 855 | dn ___,0,$000 856 | dn D#5,4,$000 857 | dn D#3,5,$000 858 | dn ___,0,$000 859 | dn ___,0,$000 860 | dn D#3,5,$000 861 | dn ___,0,$000 862 | dn ___,0,$000 863 | dn ___,0,$000 864 | dn D#5,4,$000 865 | dn A#3,5,$000 866 | dn ___,0,$000 867 | dn ___,0,$000 868 | dn A_5,6,$000 869 | dn C#4,5,$000 870 | dn ___,0,$000 871 | dn ___,0,$000 872 | dn D#4,5,$000 873 | dn ___,0,$000 874 | dn ___,0,$000 875 | dn ___,0,$000 876 | 877 | P13: 878 | dn D#5,3,$900 879 | dn G_5,0,$000 880 | dn A#5,0,$940 881 | dn D#5,0,$000 882 | dn G_5,0,$980 883 | dn A#5,0,$000 884 | dn D#5,0,$9C0 885 | dn G_5,0,$000 886 | dn A#5,3,$900 887 | dn D#5,0,$000 888 | dn G_5,0,$940 889 | dn A#5,0,$000 890 | dn D#5,0,$980 891 | dn G_5,0,$000 892 | dn A#5,0,$9C0 893 | dn D#5,0,$000 894 | dn G_5,3,$900 895 | dn A#5,0,$000 896 | dn D#5,0,$940 897 | dn G_5,0,$000 898 | dn A#5,0,$980 899 | dn D#5,0,$000 900 | dn G_5,0,$9C0 901 | dn A#5,0,$000 902 | dn D#5,3,$900 903 | dn G_5,0,$000 904 | dn A#5,0,$940 905 | dn D#5,0,$000 906 | dn G_5,0,$980 907 | dn A#5,0,$000 908 | dn D#5,0,$9C0 909 | dn G_5,0,$000 910 | dn A#5,3,$900 911 | dn D#5,0,$000 912 | dn G_5,0,$940 913 | dn A#5,0,$000 914 | dn D#5,0,$980 915 | dn G_5,0,$000 916 | dn A#5,0,$9C0 917 | dn D#5,0,$000 918 | dn G_5,3,$900 919 | dn A#5,0,$000 920 | dn D#5,0,$940 921 | dn G_5,0,$000 922 | dn A#5,0,$980 923 | dn D#5,0,$000 924 | dn G_5,0,$9C0 925 | dn A#5,0,$000 926 | dn D#5,3,$900 927 | dn G_5,0,$000 928 | dn A#5,0,$940 929 | dn D#5,0,$000 930 | dn G_5,0,$980 931 | dn A#5,0,$000 932 | dn D#5,0,$9C0 933 | dn G_5,0,$000 934 | dn A#5,3,$900 935 | dn D#5,0,$000 936 | dn G_5,0,$940 937 | dn A#5,0,$000 938 | dn D#5,0,$980 939 | dn G_5,0,$000 940 | dn A#5,0,$9C0 941 | dn D#5,0,$000 942 | 943 | P14: 944 | dn D#6,3,$C0F 945 | dn D#6,4,$C0F 946 | dn A#6,3,$C07 947 | dn A#6,4,$C07 948 | dn G_6,3,$C0F 949 | dn G_6,4,$C0F 950 | dn D#6,3,$C07 951 | dn D#6,4,$C07 952 | dn A#6,3,$C0F 953 | dn A#6,4,$C0F 954 | dn G_6,3,$C07 955 | dn G_6,4,$C07 956 | dn D#6,3,$C0F 957 | dn D#6,4,$C0F 958 | dn A#6,3,$C07 959 | dn A#6,4,$C07 960 | dn G_6,3,$C0F 961 | dn G_6,4,$C0F 962 | dn D#6,3,$C07 963 | dn D#6,4,$C07 964 | dn A#6,3,$C0F 965 | dn A#6,4,$C0F 966 | dn G_6,3,$C07 967 | dn G_6,4,$C07 968 | dn D#6,3,$C0F 969 | dn D#6,4,$C0F 970 | dn A#6,3,$C07 971 | dn A#6,4,$C07 972 | dn G_6,3,$C0F 973 | dn G_6,4,$C0F 974 | dn D#6,3,$C07 975 | dn D#6,4,$C07 976 | dn A#6,3,$C0F 977 | dn A#6,4,$C0F 978 | dn G_6,3,$C07 979 | dn G_6,4,$C07 980 | dn D#6,3,$C0F 981 | dn D#6,4,$C0F 982 | dn A#6,3,$C07 983 | dn A#6,4,$C07 984 | dn G_6,3,$C0F 985 | dn G_6,4,$C0F 986 | dn D#6,3,$C07 987 | dn D#6,4,$C07 988 | dn A#6,3,$C0F 989 | dn A#6,4,$C0F 990 | dn G_6,3,$C07 991 | dn G_6,4,$C07 992 | dn D#6,3,$C0F 993 | dn D#6,4,$C0F 994 | dn A#6,3,$C07 995 | dn A#6,4,$C07 996 | dn G_6,3,$C0F 997 | dn G_6,4,$C0F 998 | dn D#6,3,$C07 999 | dn D#6,4,$C07 1000 | dn A#6,3,$C0F 1001 | dn A#6,4,$C0F 1002 | dn G_6,3,$C07 1003 | dn G_6,4,$C07 1004 | dn D#6,3,$C0F 1005 | dn D#6,4,$C0F 1006 | dn A#6,3,$C07 1007 | dn A#6,4,$C07 1008 | 1009 | P15: 1010 | dn F_5,4,$000 1011 | dn F_3,5,$000 1012 | dn ___,0,$000 1013 | dn ___,0,$000 1014 | dn F_3,5,$000 1015 | dn ___,0,$000 1016 | dn ___,0,$000 1017 | dn ___,0,$000 1018 | dn B_5,6,$000 1019 | dn F_3,5,$000 1020 | dn ___,0,$000 1021 | dn ___,0,$000 1022 | dn F_5,4,$000 1023 | dn F_3,5,$000 1024 | dn ___,0,$000 1025 | dn ___,0,$000 1026 | dn F_3,5,$000 1027 | dn ___,0,$000 1028 | dn ___,0,$000 1029 | dn ___,0,$000 1030 | dn F_5,4,$000 1031 | dn C_4,5,$000 1032 | dn ___,0,$000 1033 | dn ___,0,$000 1034 | dn B_5,6,$000 1035 | dn D#4,5,$000 1036 | dn ___,0,$000 1037 | dn ___,0,$000 1038 | dn F_4,5,$000 1039 | dn ___,0,$000 1040 | dn ___,0,$000 1041 | dn ___,0,$000 1042 | dn F_5,4,$000 1043 | dn F_3,5,$000 1044 | dn ___,0,$000 1045 | dn ___,0,$000 1046 | dn F_3,5,$000 1047 | dn ___,0,$000 1048 | dn ___,0,$000 1049 | dn ___,0,$000 1050 | dn B_5,6,$000 1051 | dn F_3,5,$000 1052 | dn ___,0,$000 1053 | dn ___,0,$000 1054 | dn F_5,4,$000 1055 | dn F_3,5,$000 1056 | dn ___,0,$000 1057 | dn ___,0,$000 1058 | dn F_3,5,$000 1059 | dn ___,0,$000 1060 | dn ___,0,$000 1061 | dn ___,0,$000 1062 | dn F_5,4,$000 1063 | dn C_4,5,$000 1064 | dn ___,0,$000 1065 | dn ___,0,$000 1066 | dn B_5,6,$000 1067 | dn D#4,5,$000 1068 | dn ___,0,$000 1069 | dn ___,0,$000 1070 | dn F_4,5,$000 1071 | dn ___,0,$000 1072 | dn ___,0,$000 1073 | dn ___,0,$000 1074 | 1075 | P16: 1076 | dn F_5,3,$900 1077 | dn A_5,0,$000 1078 | dn C_6,0,$940 1079 | dn F_5,0,$000 1080 | dn A_5,0,$980 1081 | dn C_6,0,$000 1082 | dn F_5,0,$9C0 1083 | dn A_5,0,$000 1084 | dn C_6,3,$900 1085 | dn F_5,0,$000 1086 | dn A_5,0,$940 1087 | dn C_6,0,$000 1088 | dn F_5,0,$980 1089 | dn A_5,0,$000 1090 | dn C_6,0,$9C0 1091 | dn F_5,0,$000 1092 | dn A_5,3,$900 1093 | dn C_6,0,$000 1094 | dn F_5,0,$940 1095 | dn A_5,0,$000 1096 | dn C_6,0,$980 1097 | dn F_5,0,$000 1098 | dn A_5,0,$9C0 1099 | dn C_6,0,$000 1100 | dn F_5,3,$900 1101 | dn A_5,0,$000 1102 | dn C_6,0,$940 1103 | dn F_5,0,$000 1104 | dn A_5,0,$980 1105 | dn C_6,0,$000 1106 | dn F_5,0,$9C0 1107 | dn A_5,0,$000 1108 | dn C_6,3,$900 1109 | dn F_5,0,$000 1110 | dn A_5,0,$940 1111 | dn C_6,0,$000 1112 | dn F_5,0,$980 1113 | dn A_5,0,$000 1114 | dn C_6,0,$9C0 1115 | dn F_5,0,$000 1116 | dn A_5,3,$900 1117 | dn C_6,0,$000 1118 | dn F_5,0,$940 1119 | dn A_5,0,$000 1120 | dn C_6,0,$980 1121 | dn F_5,0,$000 1122 | dn A_5,0,$9C0 1123 | dn C_6,0,$000 1124 | dn F_5,3,$900 1125 | dn A_5,0,$000 1126 | dn C_6,0,$940 1127 | dn F_5,0,$000 1128 | dn A_5,0,$980 1129 | dn C_6,0,$000 1130 | dn F_5,0,$9C0 1131 | dn A_5,0,$000 1132 | dn C_6,3,$900 1133 | dn F_5,0,$000 1134 | dn A_5,0,$940 1135 | dn C_6,0,$000 1136 | dn F_5,0,$980 1137 | dn A_5,0,$000 1138 | dn C_6,0,$9C0 1139 | dn F_5,0,$000 1140 | 1141 | P17: 1142 | dn F_6,3,$C0F 1143 | dn F_6,4,$C0F 1144 | dn C_7,3,$C07 1145 | dn C_7,4,$C07 1146 | dn A_6,3,$C0F 1147 | dn A_6,4,$C0F 1148 | dn F_6,3,$C07 1149 | dn F_6,4,$C07 1150 | dn C_7,3,$C0F 1151 | dn C_7,4,$C0F 1152 | dn A_6,3,$C07 1153 | dn A_6,4,$C07 1154 | dn F_6,3,$C0F 1155 | dn F_6,4,$C0F 1156 | dn C_7,3,$C07 1157 | dn C_7,4,$C07 1158 | dn A_6,3,$C0F 1159 | dn A_6,4,$C0F 1160 | dn F_6,3,$C07 1161 | dn F_6,4,$C07 1162 | dn C_7,3,$C0F 1163 | dn C_7,4,$C0F 1164 | dn A_6,3,$C07 1165 | dn A_6,4,$C07 1166 | dn F_6,3,$C0F 1167 | dn F_6,4,$C0F 1168 | dn C_7,3,$C07 1169 | dn C_7,4,$C07 1170 | dn A_6,3,$C0F 1171 | dn A_6,4,$C0F 1172 | dn F_6,3,$C07 1173 | dn F_6,4,$C07 1174 | dn C_7,3,$C0F 1175 | dn C_7,4,$C0F 1176 | dn A_6,3,$C07 1177 | dn A_6,4,$C07 1178 | dn F_6,3,$C0F 1179 | dn F_6,4,$C0F 1180 | dn C_7,3,$C07 1181 | dn C_7,4,$C07 1182 | dn A_6,3,$C0F 1183 | dn A_6,4,$C0F 1184 | dn F_6,3,$C07 1185 | dn F_6,4,$C07 1186 | dn C_7,3,$C0F 1187 | dn C_7,4,$C0F 1188 | dn A_6,3,$C07 1189 | dn A_6,4,$C07 1190 | dn F_6,3,$C0F 1191 | dn F_6,4,$C0F 1192 | dn C_7,3,$C07 1193 | dn C_7,4,$C07 1194 | dn A_6,3,$C0F 1195 | dn A_6,4,$C0F 1196 | dn F_6,3,$C07 1197 | dn F_6,4,$C07 1198 | dn C_7,3,$C0F 1199 | dn C_7,4,$C0F 1200 | dn A_6,3,$C07 1201 | dn A_6,4,$C07 1202 | dn F_6,3,$C0F 1203 | dn F_6,4,$C0F 1204 | dn C_7,3,$C07 1205 | dn C_7,4,$C07 1206 | 1207 | P18: 1208 | dn F_6,3,$C0F 1209 | dn F_6,4,$C0F 1210 | dn C_7,3,$C07 1211 | dn C_7,4,$C07 1212 | dn G#6,3,$C0F 1213 | dn G#6,4,$C0F 1214 | dn F_6,3,$C07 1215 | dn F_6,4,$C07 1216 | dn C_7,3,$C0F 1217 | dn C_7,4,$C0F 1218 | dn G#6,3,$C07 1219 | dn G#6,4,$C07 1220 | dn F_6,3,$C0F 1221 | dn F_6,4,$C0F 1222 | dn C_7,3,$C07 1223 | dn C_7,4,$C07 1224 | dn G#6,3,$C0F 1225 | dn G#6,4,$C0F 1226 | dn F_6,3,$C07 1227 | dn F_6,4,$C07 1228 | dn C_7,3,$C0F 1229 | dn C_7,4,$C0F 1230 | dn G#6,3,$C07 1231 | dn G#6,4,$C07 1232 | dn F_6,3,$C0F 1233 | dn F_6,4,$C0F 1234 | dn C_7,3,$C07 1235 | dn C_7,4,$C07 1236 | dn G#6,3,$C0F 1237 | dn G#6,4,$C0F 1238 | dn F_6,3,$C07 1239 | dn F_6,4,$C07 1240 | dn B_6,3,$C0F 1241 | dn B_6,4,$C0F 1242 | dn G#6,3,$C07 1243 | dn G#6,4,$C07 1244 | dn D_6,3,$C0F 1245 | dn D_6,4,$C0F 1246 | dn B_6,3,$C07 1247 | dn B_6,4,$C07 1248 | dn G_6,3,$C0F 1249 | dn G_6,4,$C0F 1250 | dn D_6,3,$C07 1251 | dn D_6,4,$C07 1252 | dn B_6,3,$C0F 1253 | dn B_6,4,$C0F 1254 | dn G_6,3,$C07 1255 | dn G_6,4,$C07 1256 | dn D_6,3,$C0F 1257 | dn D_6,4,$C0F 1258 | dn B_6,3,$C07 1259 | dn B_6,4,$C07 1260 | dn G_6,3,$C0F 1261 | dn G_6,4,$C0F 1262 | dn D_6,3,$C07 1263 | dn D_6,4,$C07 1264 | dn B_6,3,$C0F 1265 | dn B_6,4,$C0F 1266 | dn G_6,3,$C07 1267 | dn G_6,4,$C07 1268 | dn D_6,3,$C07 1269 | dn D_6,4,$C07 1270 | dn B_6,3,$C03 1271 | dn B_6,4,$C03 1272 | 1273 | P19: 1274 | dn F_5,4,$000 1275 | dn F_3,5,$000 1276 | dn ___,0,$000 1277 | dn ___,0,$000 1278 | dn F_3,5,$000 1279 | dn ___,0,$000 1280 | dn ___,0,$000 1281 | dn ___,0,$000 1282 | dn B_5,6,$000 1283 | dn F_3,5,$000 1284 | dn ___,0,$000 1285 | dn ___,0,$000 1286 | dn F_5,4,$000 1287 | dn F_3,5,$000 1288 | dn ___,0,$000 1289 | dn ___,0,$000 1290 | dn F_3,5,$000 1291 | dn ___,0,$000 1292 | dn ___,0,$000 1293 | dn ___,0,$000 1294 | dn F_5,4,$000 1295 | dn C_4,5,$000 1296 | dn ___,0,$000 1297 | dn ___,0,$000 1298 | dn B_5,6,$000 1299 | dn D#4,5,$000 1300 | dn ___,0,$000 1301 | dn ___,0,$000 1302 | dn F_4,5,$000 1303 | dn ___,0,$000 1304 | dn ___,0,$000 1305 | dn ___,0,$000 1306 | dn D_5,4,$000 1307 | dn D_3,5,$000 1308 | dn ___,0,$000 1309 | dn ___,0,$000 1310 | dn D_3,5,$000 1311 | dn ___,0,$000 1312 | dn ___,0,$000 1313 | dn ___,0,$000 1314 | dn G#5,6,$000 1315 | dn D_3,5,$000 1316 | dn ___,0,$000 1317 | dn ___,0,$000 1318 | dn D_5,4,$000 1319 | dn D_3,5,$000 1320 | dn ___,0,$000 1321 | dn ___,0,$000 1322 | dn D_3,5,$000 1323 | dn ___,0,$000 1324 | dn ___,0,$000 1325 | dn ___,0,$000 1326 | dn D_5,4,$000 1327 | dn G_3,5,$000 1328 | dn ___,0,$000 1329 | dn ___,0,$000 1330 | dn G#5,6,$000 1331 | dn B_3,5,$000 1332 | dn ___,0,$000 1333 | dn ___,0,$000 1334 | dn D_4,5,$000 1335 | dn ___,0,$000 1336 | dn ___,0,$000 1337 | dn ___,0,$000 1338 | 1339 | P20: 1340 | dn F_5,3,$900 1341 | dn G#5,0,$000 1342 | dn C_6,0,$940 1343 | dn F_5,0,$000 1344 | dn G#5,0,$980 1345 | dn C_6,0,$000 1346 | dn F_5,0,$9C0 1347 | dn G#5,0,$000 1348 | dn C_6,3,$900 1349 | dn F_5,0,$000 1350 | dn G#5,0,$940 1351 | dn C_6,0,$000 1352 | dn F_5,0,$980 1353 | dn G#5,0,$000 1354 | dn C_6,0,$9C0 1355 | dn F_5,0,$000 1356 | dn G#5,3,$900 1357 | dn C_6,0,$000 1358 | dn F_5,0,$940 1359 | dn G#5,0,$000 1360 | dn C_6,0,$980 1361 | dn F_5,0,$000 1362 | dn G#5,0,$9C0 1363 | dn C_6,0,$000 1364 | dn F_5,3,$900 1365 | dn G#5,0,$000 1366 | dn C_6,0,$940 1367 | dn F_5,0,$000 1368 | dn G#5,0,$980 1369 | dn C_6,0,$000 1370 | dn F_5,0,$9C0 1371 | dn G#5,0,$000 1372 | dn B_5,3,$C03 1373 | dn D_5,0,$000 1374 | dn G_5,0,$940 1375 | dn B_5,0,$000 1376 | dn D_5,0,$980 1377 | dn G_5,0,$000 1378 | dn B_5,0,$9C0 1379 | dn D_5,0,$000 1380 | dn G_5,3,$C02 1381 | dn B_5,0,$000 1382 | dn D_5,0,$940 1383 | dn G_5,0,$000 1384 | dn B_5,0,$980 1385 | dn D_5,0,$000 1386 | dn G_5,0,$9C0 1387 | dn B_5,0,$000 1388 | dn D_5,3,$C01 1389 | dn G_5,0,$000 1390 | dn B_5,0,$940 1391 | dn D_5,0,$000 1392 | dn G_5,0,$980 1393 | dn B_5,0,$000 1394 | dn D_5,0,$9C0 1395 | dn G_5,0,$000 1396 | dn B_5,3,$C01 1397 | dn D_5,0,$000 1398 | dn G_5,0,$940 1399 | dn B_5,0,$000 1400 | dn D_5,0,$980 1401 | dn G_5,0,$000 1402 | dn B_5,0,$9C0 1403 | dn D_5,0,$000 1404 | 1405 | P21: 1406 | dn C_6,4,$C0F 1407 | dn ___,0,$000 1408 | dn C_6,5,$C0F 1409 | dn ___,0,$000 1410 | dn C_6,6,$C0F 1411 | dn ___,0,$000 1412 | dn C_6,7,$C07 1413 | dn ___,0,$000 1414 | dn C_6,6,$C07 1415 | dn ___,0,$000 1416 | dn C_6,5,$C03 1417 | dn ___,0,$000 1418 | dn D_6,4,$C0F 1419 | dn ___,0,$000 1420 | dn D_6,5,$C0F 1421 | dn ___,0,$000 1422 | dn D_6,6,$C0F 1423 | dn ___,0,$000 1424 | dn D_6,7,$C07 1425 | dn ___,0,$000 1426 | dn D_6,6,$C07 1427 | dn ___,0,$000 1428 | dn D_6,5,$C03 1429 | dn ___,0,$000 1430 | dn D_6,4,$C0F 1431 | dn D#6,0,$304 1432 | dn D#6,5,$C0F 1433 | dn ___,0,$000 1434 | dn D#6,6,$C0F 1435 | dn ___,0,$000 1436 | dn D#6,7,$C07 1437 | dn ___,0,$000 1438 | dn D#6,6,$C07 1439 | dn ___,0,$000 1440 | dn D#6,5,$C03 1441 | dn ___,0,$000 1442 | dn D#6,4,$C03 1443 | dn ___,0,$000 1444 | dn D#6,5,$C03 1445 | dn ___,0,$000 1446 | dn D_6,6,$C0F 1447 | dn ___,0,$000 1448 | dn D_6,7,$C0F 1449 | dn ___,0,$000 1450 | dn D_6,6,$C0F 1451 | dn ___,0,$000 1452 | dn D_6,5,$C07 1453 | dn ___,0,$000 1454 | dn C_6,4,$C0F 1455 | dn ___,0,$000 1456 | dn C_6,5,$C0F 1457 | dn ___,0,$000 1458 | dn C_6,6,$C0F 1459 | dn ___,0,$000 1460 | dn C_6,7,$C07 1461 | dn ___,0,$000 1462 | dn A#5,6,$C0F 1463 | dn ___,0,$000 1464 | dn A#5,5,$C0F 1465 | dn ___,0,$000 1466 | dn A#5,4,$C0F 1467 | dn ___,0,$000 1468 | dn A#5,5,$C07 1469 | dn ___,0,$000 1470 | 1471 | P22: 1472 | dn G_5,4,$C0F 1473 | dn ___,0,$000 1474 | dn G_5,5,$C0F 1475 | dn ___,0,$000 1476 | dn G_5,6,$C0F 1477 | dn ___,0,$000 1478 | dn G_5,7,$C07 1479 | dn ___,0,$000 1480 | dn A#5,6,$C0F 1481 | dn ___,0,$000 1482 | dn A#5,5,$C07 1483 | dn ___,0,$000 1484 | dn F_5,4,$C0F 1485 | dn ___,0,$000 1486 | dn F_5,5,$C0F 1487 | dn ___,0,$000 1488 | dn F_5,6,$C0F 1489 | dn ___,0,$000 1490 | dn F_5,7,$C07 1491 | dn ___,0,$000 1492 | dn A#5,6,$C0F 1493 | dn ___,0,$000 1494 | dn A#5,5,$C07 1495 | dn ___,0,$000 1496 | dn F_5,4,$C0F 1497 | dn G_5,0,$304 1498 | dn G_5,5,$C0F 1499 | dn ___,0,$000 1500 | dn G_5,6,$C0F 1501 | dn ___,0,$000 1502 | dn G_5,7,$C0F 1503 | dn ___,0,$000 1504 | dn G_5,6,$C0F 1505 | dn ___,0,$000 1506 | dn G_5,5,$C0F 1507 | dn ___,0,$000 1508 | dn G_5,4,$C07 1509 | dn ___,0,$000 1510 | dn G_5,5,$C07 1511 | dn ___,0,$000 1512 | dn G_5,6,$C07 1513 | dn ___,0,$000 1514 | dn G_5,7,$C07 1515 | dn ___,0,$000 1516 | dn G_5,6,$C03 1517 | dn ___,0,$000 1518 | dn G_5,5,$C03 1519 | dn ___,0,$000 1520 | dn G_5,4,$C03 1521 | dn ___,0,$000 1522 | dn G_5,5,$C03 1523 | dn ___,0,$000 1524 | dn G_5,6,$C03 1525 | dn ___,0,$000 1526 | dn G_5,7,$C03 1527 | dn ___,0,$000 1528 | dn C_6,6,$C0F 1529 | dn ___,0,$000 1530 | dn C_6,5,$C07 1531 | dn ___,0,$000 1532 | dn D_6,4,$C0F 1533 | dn ___,0,$000 1534 | dn D_6,5,$C07 1535 | dn ___,0,$000 1536 | 1537 | P23: 1538 | dn D#6,4,$C0F 1539 | dn ___,0,$000 1540 | dn D#6,5,$C0F 1541 | dn ___,0,$000 1542 | dn D#6,6,$C0F 1543 | dn ___,0,$000 1544 | dn D#6,7,$C07 1545 | dn ___,0,$000 1546 | dn D#6,6,$C07 1547 | dn ___,0,$000 1548 | dn D#6,5,$C03 1549 | dn ___,0,$000 1550 | dn F_6,4,$C0F 1551 | dn ___,0,$000 1552 | dn F_6,5,$C0F 1553 | dn ___,0,$000 1554 | dn F_6,6,$C0F 1555 | dn ___,0,$000 1556 | dn F_6,7,$C07 1557 | dn ___,0,$000 1558 | dn F_6,6,$C07 1559 | dn ___,0,$000 1560 | dn F_6,5,$C03 1561 | dn ___,0,$000 1562 | dn F_6,4,$C0F 1563 | dn G_6,0,$304 1564 | dn G_6,5,$C0F 1565 | dn ___,0,$000 1566 | dn G_6,6,$C0F 1567 | dn ___,0,$000 1568 | dn G_6,7,$C0F 1569 | dn ___,0,$000 1570 | dn G_6,6,$C0F 1571 | dn ___,0,$000 1572 | dn G_6,5,$C07 1573 | dn ___,0,$000 1574 | dn G_6,4,$C03 1575 | dn ___,0,$000 1576 | dn G_6,5,$C03 1577 | dn ___,0,$000 1578 | dn A#6,6,$C0F 1579 | dn ___,0,$000 1580 | dn A#6,7,$C0F 1581 | dn ___,0,$000 1582 | dn A#6,6,$C0F 1583 | dn ___,0,$000 1584 | dn A#6,5,$C07 1585 | dn ___,0,$000 1586 | dn F_6,4,$C0F 1587 | dn ___,0,$000 1588 | dn F_6,5,$C0F 1589 | dn ___,0,$000 1590 | dn F_6,6,$C0F 1591 | dn ___,0,$000 1592 | dn F_6,7,$C07 1593 | dn ___,0,$000 1594 | dn D#6,6,$C0F 1595 | dn ___,0,$000 1596 | dn D#6,5,$C0F 1597 | dn ___,0,$000 1598 | dn D#6,4,$C0F 1599 | dn ___,0,$000 1600 | dn D#6,5,$C07 1601 | dn ___,0,$000 1602 | 1603 | P24: 1604 | dn F_6,4,$C0F 1605 | dn ___,0,$000 1606 | dn F_6,5,$C0F 1607 | dn ___,0,$000 1608 | dn F_6,6,$C0F 1609 | dn ___,0,$000 1610 | dn F_6,7,$C0F 1611 | dn ___,0,$000 1612 | dn F_6,6,$C07 1613 | dn ___,0,$000 1614 | dn F_6,5,$C07 1615 | dn ___,0,$000 1616 | dn F_6,4,$C07 1617 | dn ___,0,$000 1618 | dn F_6,5,$C07 1619 | dn ___,0,$000 1620 | dn F_6,6,$C07 1621 | dn ___,0,$000 1622 | dn F_6,7,$C07 1623 | dn ___,0,$000 1624 | dn F_6,6,$C03 1625 | dn ___,0,$000 1626 | dn F_6,5,$C03 1627 | dn ___,0,$000 1628 | dn F_6,4,$C03 1629 | dn ___,0,$000 1630 | dn F_6,5,$C03 1631 | dn ___,0,$000 1632 | dn F_6,6,$C03 1633 | dn ___,0,$000 1634 | dn F_6,7,$C03 1635 | dn ___,0,$000 1636 | dn F_6,6,$C0F 1637 | dn G_6,0,$308 1638 | dn G_6,5,$C0F 1639 | dn ___,0,$000 1640 | dn G_6,4,$C0F 1641 | dn ___,0,$000 1642 | dn G_6,5,$C0F 1643 | dn ___,0,$000 1644 | dn G_6,6,$C0F 1645 | dn ___,0,$000 1646 | dn G_6,7,$C07 1647 | dn ___,0,$000 1648 | dn G_6,6,$C07 1649 | dn ___,0,$000 1650 | dn G_6,5,$C03 1651 | dn ___,0,$000 1652 | dn D_6,4,$C0F 1653 | dn ___,0,$000 1654 | dn D_6,5,$C0F 1655 | dn ___,0,$000 1656 | dn D_6,6,$C0F 1657 | dn ___,0,$000 1658 | dn D_6,7,$C0F 1659 | dn ___,0,$000 1660 | dn D_6,6,$C0F 1661 | dn ___,0,$000 1662 | dn D_6,5,$C07 1663 | dn ___,0,$000 1664 | dn D_6,4,$C07 1665 | dn ___,0,$000 1666 | dn D_6,5,$C03 1667 | dn ___,0,$000 1668 | 1669 | P25: 1670 | dn C_6,4,$C0F 1671 | dn ___,0,$000 1672 | dn C_6,5,$C0F 1673 | dn ___,0,$000 1674 | dn C_6,6,$C0F 1675 | dn ___,0,$000 1676 | dn C_6,7,$C07 1677 | dn ___,0,$000 1678 | dn C_6,6,$C07 1679 | dn ___,0,$000 1680 | dn C_6,5,$C03 1681 | dn ___,0,$000 1682 | dn D_6,4,$C0F 1683 | dn ___,0,$000 1684 | dn D_6,5,$C0F 1685 | dn ___,0,$000 1686 | dn D_6,6,$C0F 1687 | dn ___,0,$000 1688 | dn D_6,7,$C07 1689 | dn ___,0,$000 1690 | dn D_6,6,$C07 1691 | dn ___,0,$000 1692 | dn D_6,5,$C03 1693 | dn ___,0,$000 1694 | dn D_6,4,$C0F 1695 | dn D#6,0,$304 1696 | dn D#6,5,$C0F 1697 | dn ___,0,$000 1698 | dn D#6,6,$C0F 1699 | dn ___,0,$000 1700 | dn D#6,7,$C07 1701 | dn ___,0,$000 1702 | dn D#6,6,$C07 1703 | dn ___,0,$000 1704 | dn D#6,5,$C03 1705 | dn ___,0,$000 1706 | dn F_6,4,$C0F 1707 | dn ___,0,$000 1708 | dn F_6,5,$C0F 1709 | dn ___,0,$000 1710 | dn F_6,6,$C0F 1711 | dn ___,0,$000 1712 | dn F_6,7,$C07 1713 | dn ___,0,$000 1714 | dn F_6,6,$C07 1715 | dn ___,0,$000 1716 | dn F_6,5,$C03 1717 | dn ___,0,$000 1718 | dn G_6,4,$C0F 1719 | dn ___,0,$000 1720 | dn G_6,5,$C0F 1721 | dn ___,0,$000 1722 | dn G_6,6,$C0F 1723 | dn ___,0,$000 1724 | dn G_6,7,$C07 1725 | dn ___,0,$000 1726 | dn A#6,6,$C0F 1727 | dn ___,0,$000 1728 | dn A#6,5,$C0F 1729 | dn ___,0,$000 1730 | dn A#6,4,$C0F 1731 | dn ___,0,$000 1732 | dn A#6,5,$C07 1733 | dn ___,0,$000 1734 | 1735 | P26: 1736 | dn C_7,4,$C0F 1737 | dn ___,0,$000 1738 | dn C_7,5,$C0F 1739 | dn ___,0,$000 1740 | dn C_7,6,$C0F 1741 | dn ___,0,$000 1742 | dn C_7,7,$C07 1743 | dn ___,0,$000 1744 | dn C_7,6,$C07 1745 | dn ___,0,$000 1746 | dn C_7,5,$C03 1747 | dn ___,0,$000 1748 | dn A#6,4,$C0F 1749 | dn ___,0,$000 1750 | dn A#6,5,$C0F 1751 | dn ___,0,$000 1752 | dn A#6,6,$C0F 1753 | dn ___,0,$000 1754 | dn A#6,7,$C07 1755 | dn ___,0,$000 1756 | dn A#6,6,$C07 1757 | dn ___,0,$000 1758 | dn A#6,5,$C03 1759 | dn ___,0,$000 1760 | dn A#6,4,$C0F 1761 | dn C_7,0,$304 1762 | dn C_7,5,$C0F 1763 | dn ___,0,$000 1764 | dn C_7,6,$C0F 1765 | dn ___,0,$000 1766 | dn C_7,7,$C0F 1767 | dn ___,0,$000 1768 | dn C_7,6,$C0F 1769 | dn ___,0,$000 1770 | dn C_7,5,$C0F 1771 | dn ___,0,$000 1772 | dn C_7,4,$C07 1773 | dn ___,0,$000 1774 | dn C_7,5,$C07 1775 | dn ___,0,$000 1776 | dn C_7,6,$C07 1777 | dn ___,0,$000 1778 | dn C_7,7,$C07 1779 | dn ___,0,$000 1780 | dn C_7,6,$C03 1781 | dn ___,0,$000 1782 | dn C_7,5,$C03 1783 | dn ___,0,$000 1784 | dn C_7,4,$C03 1785 | dn ___,0,$000 1786 | dn C_7,5,$C03 1787 | dn ___,0,$000 1788 | dn C_7,6,$C03 1789 | dn ___,0,$000 1790 | dn C_7,7,$C03 1791 | dn ___,0,$000 1792 | dn C_7,6,$C0F 1793 | dn ___,0,$000 1794 | dn C_7,5,$C07 1795 | dn ___,0,$000 1796 | dn D_7,4,$C0F 1797 | dn ___,0,$000 1798 | dn D_7,5,$C07 1799 | dn ___,0,$000 1800 | 1801 | P27: 1802 | dn D#7,4,$C0F 1803 | dn ___,0,$000 1804 | dn D#7,5,$C0F 1805 | dn ___,0,$000 1806 | dn D#7,6,$C0F 1807 | dn ___,0,$000 1808 | dn D#7,7,$C07 1809 | dn ___,0,$000 1810 | dn D#7,6,$C07 1811 | dn ___,0,$000 1812 | dn D#7,5,$C03 1813 | dn ___,0,$000 1814 | dn D_7,4,$C0F 1815 | dn ___,0,$000 1816 | dn D_7,5,$C0F 1817 | dn ___,0,$000 1818 | dn D_7,6,$C0F 1819 | dn ___,0,$000 1820 | dn D_7,7,$C07 1821 | dn ___,0,$000 1822 | dn D_7,6,$C07 1823 | dn ___,0,$000 1824 | dn D_7,5,$C03 1825 | dn ___,0,$000 1826 | dn D_7,4,$C0F 1827 | dn D#7,0,$304 1828 | dn D#7,5,$C0F 1829 | dn ___,0,$000 1830 | dn D#7,6,$C0F 1831 | dn ___,0,$000 1832 | dn D#7,7,$C0F 1833 | dn ___,0,$000 1834 | dn D#7,6,$C0F 1835 | dn ___,0,$000 1836 | dn D#7,5,$C0F 1837 | dn ___,0,$000 1838 | dn D#7,4,$C07 1839 | dn ___,0,$000 1840 | dn D#7,5,$C03 1841 | dn ___,0,$000 1842 | dn F_7,6,$C0F 1843 | dn ___,0,$000 1844 | dn F_7,7,$C0F 1845 | dn ___,0,$000 1846 | dn F_7,6,$C0F 1847 | dn ___,0,$000 1848 | dn F_7,5,$C07 1849 | dn ___,0,$000 1850 | dn G_7,4,$C0F 1851 | dn ___,0,$000 1852 | dn G_7,5,$C0F 1853 | dn ___,0,$000 1854 | dn G_7,6,$C0F 1855 | dn ___,0,$000 1856 | dn G_7,7,$C07 1857 | dn ___,0,$000 1858 | dn G#7,6,$C0F 1859 | dn ___,0,$000 1860 | dn G#7,5,$C0F 1861 | dn ___,0,$000 1862 | dn G#7,4,$C0F 1863 | dn ___,0,$000 1864 | dn G#7,5,$C07 1865 | dn ___,0,$000 1866 | 1867 | P28: 1868 | dn G_7,4,$C0F 1869 | dn ___,0,$000 1870 | dn G#7,5,$C0F 1871 | dn ___,0,$000 1872 | dn G_7,6,$C0F 1873 | dn ___,0,$000 1874 | dn G#7,7,$C0F 1875 | dn ___,0,$000 1876 | dn G_7,6,$C07 1877 | dn ___,0,$000 1878 | dn G#7,5,$C07 1879 | dn ___,0,$000 1880 | dn G_7,4,$C07 1881 | dn ___,0,$000 1882 | dn G#7,5,$C07 1883 | dn ___,0,$000 1884 | dn G_7,6,$C03 1885 | dn ___,0,$000 1886 | dn G#7,7,$C03 1887 | dn ___,0,$000 1888 | dn G_7,6,$C03 1889 | dn ___,0,$000 1890 | dn G#7,5,$C03 1891 | dn ___,0,$000 1892 | dn G_7,4,$C03 1893 | dn ___,0,$000 1894 | dn G#7,5,$C03 1895 | dn ___,0,$000 1896 | dn G_7,6,$C03 1897 | dn ___,0,$000 1898 | dn G#7,7,$C03 1899 | dn ___,0,$000 1900 | dn G_7,6,$C03 1901 | dn ___,0,$000 1902 | dn ___,0,$E00 1903 | dn ___,0,$000 1904 | dn ___,0,$000 1905 | dn ___,0,$000 1906 | dn ___,0,$000 1907 | dn ___,0,$000 1908 | dn ___,0,$000 1909 | dn ___,0,$000 1910 | dn ___,0,$000 1911 | dn ___,0,$000 1912 | dn ___,0,$000 1913 | dn ___,0,$000 1914 | dn ___,0,$000 1915 | dn ___,0,$000 1916 | dn ___,0,$000 1917 | dn ___,0,$000 1918 | dn ___,0,$000 1919 | dn ___,0,$000 1920 | dn ___,0,$000 1921 | dn ___,0,$000 1922 | dn ___,0,$000 1923 | dn ___,0,$000 1924 | dn ___,0,$000 1925 | dn ___,0,$000 1926 | dn ___,0,$000 1927 | dn ___,0,$000 1928 | dn ___,0,$000 1929 | dn ___,0,$000 1930 | dn ___,0,$000 1931 | dn ___,0,$000 1932 | 1933 | P29: 1934 | dn C_5,4,$000 1935 | dn C_3,5,$000 1936 | dn ___,0,$000 1937 | dn ___,0,$000 1938 | dn C_3,5,$000 1939 | dn ___,0,$000 1940 | dn ___,0,$000 1941 | dn ___,0,$000 1942 | dn F#5,6,$000 1943 | dn C_3,5,$000 1944 | dn ___,0,$000 1945 | dn ___,0,$000 1946 | dn C_5,4,$000 1947 | dn C_3,5,$000 1948 | dn ___,0,$000 1949 | dn ___,0,$000 1950 | dn C_3,5,$000 1951 | dn ___,0,$000 1952 | dn ___,0,$000 1953 | dn ___,0,$000 1954 | dn C_5,4,$000 1955 | dn G#3,5,$000 1956 | dn ___,0,$000 1957 | dn ___,0,$000 1958 | dn F#5,6,$000 1959 | dn C_4,5,$000 1960 | dn ___,0,$000 1961 | dn ___,0,$000 1962 | dn D#4,5,$000 1963 | dn ___,0,$000 1964 | dn ___,0,$000 1965 | dn ___,0,$000 1966 | dn C_5,4,$000 1967 | dn C_3,5,$000 1968 | dn ___,0,$000 1969 | dn ___,0,$000 1970 | dn C_3,5,$000 1971 | dn ___,0,$000 1972 | dn ___,0,$000 1973 | dn ___,0,$000 1974 | dn F#5,6,$000 1975 | dn C_3,5,$000 1976 | dn ___,0,$000 1977 | dn ___,0,$000 1978 | dn C_5,4,$000 1979 | dn C_3,5,$000 1980 | dn ___,0,$000 1981 | dn ___,0,$000 1982 | dn C_3,5,$000 1983 | dn ___,0,$000 1984 | dn ___,0,$000 1985 | dn ___,0,$000 1986 | dn C_5,4,$000 1987 | dn G#3,5,$000 1988 | dn ___,0,$000 1989 | dn ___,0,$000 1990 | dn F#5,6,$000 1991 | dn C_4,5,$000 1992 | dn ___,0,$000 1993 | dn ___,0,$000 1994 | dn D#4,5,$000 1995 | dn ___,0,$000 1996 | dn ___,0,$000 1997 | dn ___,0,$000 1998 | 1999 | P30: 2000 | dn C_5,3,$900 2001 | dn D#5,0,$000 2002 | dn G#5,0,$940 2003 | dn C_5,0,$000 2004 | dn D#5,0,$980 2005 | dn G#5,0,$000 2006 | dn C_5,0,$9C0 2007 | dn D#5,0,$000 2008 | dn G#5,3,$900 2009 | dn C_5,0,$000 2010 | dn D#5,0,$940 2011 | dn G#5,0,$000 2012 | dn C_5,0,$980 2013 | dn D#5,0,$000 2014 | dn G#5,0,$9C0 2015 | dn C_5,0,$000 2016 | dn D#5,3,$900 2017 | dn G#5,0,$000 2018 | dn C_5,0,$940 2019 | dn D#5,0,$000 2020 | dn G#5,0,$980 2021 | dn C_5,0,$000 2022 | dn D#5,0,$9C0 2023 | dn G#5,0,$000 2024 | dn C_5,3,$900 2025 | dn D#5,0,$000 2026 | dn G#5,0,$940 2027 | dn C_5,0,$000 2028 | dn D#5,0,$980 2029 | dn G#5,0,$000 2030 | dn C_5,0,$9C0 2031 | dn D#5,0,$000 2032 | dn G#5,3,$900 2033 | dn C_5,0,$000 2034 | dn D#5,0,$940 2035 | dn G#5,0,$000 2036 | dn C_5,0,$980 2037 | dn D#5,0,$000 2038 | dn G#5,0,$9C0 2039 | dn C_5,0,$000 2040 | dn D#5,3,$900 2041 | dn G#5,0,$000 2042 | dn C_5,0,$940 2043 | dn D#5,0,$000 2044 | dn G#5,0,$980 2045 | dn C_5,0,$000 2046 | dn D#5,0,$9C0 2047 | dn G#5,0,$000 2048 | dn C_5,3,$900 2049 | dn D#5,0,$000 2050 | dn G#5,0,$940 2051 | dn C_5,0,$000 2052 | dn D#5,0,$980 2053 | dn G#5,0,$000 2054 | dn C_5,0,$9C0 2055 | dn D#5,0,$000 2056 | dn G#5,3,$900 2057 | dn C_5,0,$000 2058 | dn D#5,0,$940 2059 | dn G#5,0,$000 2060 | dn C_5,0,$980 2061 | dn D#5,0,$000 2062 | dn G#5,0,$9C0 2063 | dn C_5,0,$000 2064 | 2065 | P31: 2066 | dn G#6,4,$000 2067 | dn C_6,4,$000 2068 | dn D#6,5,$000 2069 | dn G#6,5,$000 2070 | dn C_6,6,$000 2071 | dn D#6,6,$000 2072 | dn G#6,7,$000 2073 | dn C_6,7,$000 2074 | dn D#6,6,$000 2075 | dn G#6,6,$000 2076 | dn C_6,5,$000 2077 | dn D#6,5,$000 2078 | dn G#6,4,$000 2079 | dn C_6,4,$000 2080 | dn D#6,5,$000 2081 | dn G#6,5,$000 2082 | dn C_6,6,$000 2083 | dn D#6,6,$000 2084 | dn G#6,7,$000 2085 | dn C_6,7,$000 2086 | dn D#6,6,$000 2087 | dn G#6,6,$000 2088 | dn C_6,5,$000 2089 | dn D#6,5,$000 2090 | dn G#6,4,$000 2091 | dn C_6,4,$000 2092 | dn D#6,5,$000 2093 | dn G#6,5,$000 2094 | dn C_6,6,$000 2095 | dn D#6,6,$000 2096 | dn G#6,7,$000 2097 | dn C_6,7,$000 2098 | dn D#6,6,$000 2099 | dn G#6,6,$000 2100 | dn C_6,5,$000 2101 | dn D#6,5,$000 2102 | dn G#6,4,$000 2103 | dn C_6,4,$000 2104 | dn D#6,5,$000 2105 | dn G#6,5,$000 2106 | dn C_6,6,$000 2107 | dn D#6,6,$000 2108 | dn G#6,7,$000 2109 | dn C_6,7,$000 2110 | dn D#6,6,$000 2111 | dn G#6,6,$000 2112 | dn C_6,5,$000 2113 | dn D#6,5,$000 2114 | dn G#6,4,$000 2115 | dn C_6,4,$000 2116 | dn D#6,5,$000 2117 | dn G#6,5,$000 2118 | dn C_6,6,$000 2119 | dn D#6,6,$000 2120 | dn G#6,7,$000 2121 | dn C_6,7,$000 2122 | dn D#6,6,$000 2123 | dn G#6,6,$000 2124 | dn C_6,5,$000 2125 | dn D#6,5,$000 2126 | dn G#6,4,$000 2127 | dn C_6,4,$000 2128 | dn D#6,5,$000 2129 | dn G#6,5,$000 2130 | 2131 | P32: 2132 | dn C_5,4,$000 2133 | dn D_3,5,$000 2134 | dn ___,0,$000 2135 | dn ___,0,$000 2136 | dn D_3,5,$000 2137 | dn ___,0,$000 2138 | dn ___,0,$000 2139 | dn ___,0,$000 2140 | dn F#5,6,$000 2141 | dn D_3,5,$000 2142 | dn ___,0,$000 2143 | dn ___,0,$000 2144 | dn C_5,4,$000 2145 | dn D_3,5,$000 2146 | dn ___,0,$000 2147 | dn ___,0,$000 2148 | dn D_3,5,$000 2149 | dn ___,0,$000 2150 | dn ___,0,$000 2151 | dn ___,0,$000 2152 | dn C_5,4,$000 2153 | dn A#3,5,$000 2154 | dn ___,0,$000 2155 | dn ___,0,$000 2156 | dn F#5,6,$000 2157 | dn D_4,5,$000 2158 | dn ___,0,$000 2159 | dn ___,0,$000 2160 | dn F_4,5,$000 2161 | dn ___,0,$000 2162 | dn ___,0,$000 2163 | dn ___,0,$000 2164 | dn C_5,4,$000 2165 | dn D_3,5,$000 2166 | dn ___,0,$000 2167 | dn ___,0,$000 2168 | dn D_3,5,$000 2169 | dn ___,0,$000 2170 | dn ___,0,$000 2171 | dn ___,0,$000 2172 | dn F#5,6,$000 2173 | dn D_3,5,$000 2174 | dn ___,0,$000 2175 | dn ___,0,$000 2176 | dn C_5,4,$000 2177 | dn D_3,5,$000 2178 | dn ___,0,$000 2179 | dn ___,0,$000 2180 | dn D_3,5,$000 2181 | dn ___,0,$000 2182 | dn ___,0,$000 2183 | dn ___,0,$000 2184 | dn C_5,4,$000 2185 | dn A#3,5,$000 2186 | dn ___,0,$000 2187 | dn ___,0,$000 2188 | dn F#5,6,$000 2189 | dn D_4,5,$000 2190 | dn ___,0,$000 2191 | dn ___,0,$000 2192 | dn F_4,5,$000 2193 | dn ___,0,$000 2194 | dn ___,0,$000 2195 | dn ___,0,$000 2196 | 2197 | P33: 2198 | dn D_5,3,$900 2199 | dn F_5,0,$000 2200 | dn A#5,0,$940 2201 | dn D_5,0,$000 2202 | dn F_5,0,$980 2203 | dn A#5,0,$000 2204 | dn D_5,0,$9C0 2205 | dn F_5,0,$000 2206 | dn A#5,3,$900 2207 | dn D_5,0,$000 2208 | dn F_5,0,$940 2209 | dn A#5,0,$000 2210 | dn D_5,0,$980 2211 | dn F_5,0,$000 2212 | dn A#5,0,$9C0 2213 | dn D_5,0,$000 2214 | dn F_5,3,$900 2215 | dn A#5,0,$000 2216 | dn D_5,0,$940 2217 | dn F_5,0,$000 2218 | dn A#5,0,$980 2219 | dn D_5,0,$000 2220 | dn F_5,0,$9C0 2221 | dn A#5,0,$000 2222 | dn D_5,3,$900 2223 | dn F_5,0,$000 2224 | dn A#5,0,$940 2225 | dn D_5,0,$000 2226 | dn F_5,0,$980 2227 | dn A#5,0,$000 2228 | dn D_5,0,$9C0 2229 | dn F_5,0,$000 2230 | dn A#5,3,$900 2231 | dn D_5,0,$000 2232 | dn F_5,0,$940 2233 | dn A#5,0,$000 2234 | dn D_5,0,$980 2235 | dn F_5,0,$000 2236 | dn A#5,0,$9C0 2237 | dn D_5,0,$000 2238 | dn F_5,3,$900 2239 | dn A#5,0,$000 2240 | dn D_5,0,$940 2241 | dn F_5,0,$000 2242 | dn A#5,0,$980 2243 | dn D_5,0,$000 2244 | dn F_5,0,$9C0 2245 | dn A#5,0,$000 2246 | dn D_5,3,$900 2247 | dn F_5,0,$000 2248 | dn A#5,0,$940 2249 | dn D_5,0,$000 2250 | dn F_5,0,$980 2251 | dn A#5,0,$000 2252 | dn D_5,0,$9C0 2253 | dn F_5,0,$000 2254 | dn A#5,3,$900 2255 | dn D_5,0,$000 2256 | dn F_5,0,$940 2257 | dn A#5,0,$000 2258 | dn D_5,0,$980 2259 | dn F_5,0,$000 2260 | dn A#5,0,$9C0 2261 | dn D_5,0,$000 2262 | 2263 | P34: 2264 | dn A#6,4,$000 2265 | dn D_6,4,$000 2266 | dn F_6,5,$000 2267 | dn A#6,5,$000 2268 | dn D_6,6,$000 2269 | dn F_6,6,$000 2270 | dn A#6,7,$000 2271 | dn D_6,7,$000 2272 | dn F_6,6,$000 2273 | dn A#6,6,$000 2274 | dn D_6,5,$000 2275 | dn F_6,5,$000 2276 | dn A#6,4,$000 2277 | dn D_6,4,$000 2278 | dn F_6,5,$000 2279 | dn A#6,5,$000 2280 | dn D_6,6,$000 2281 | dn F_6,6,$000 2282 | dn A#6,7,$000 2283 | dn D_6,7,$000 2284 | dn F_6,6,$000 2285 | dn A#6,6,$000 2286 | dn D_6,5,$000 2287 | dn F_6,5,$000 2288 | dn A#6,4,$000 2289 | dn D_6,4,$000 2290 | dn F_6,5,$000 2291 | dn A#6,5,$000 2292 | dn D_6,6,$000 2293 | dn F_6,6,$000 2294 | dn A#6,7,$000 2295 | dn D_6,7,$000 2296 | dn F_6,6,$000 2297 | dn A#6,6,$000 2298 | dn D_6,5,$000 2299 | dn F_6,5,$000 2300 | dn A#6,4,$000 2301 | dn D_6,4,$000 2302 | dn F_6,5,$000 2303 | dn A#6,5,$000 2304 | dn D_6,6,$000 2305 | dn F_6,6,$000 2306 | dn A#6,7,$000 2307 | dn D_6,7,$000 2308 | dn F_6,6,$000 2309 | dn A#6,6,$000 2310 | dn D_6,5,$000 2311 | dn F_6,5,$000 2312 | dn A#6,4,$000 2313 | dn D_6,4,$000 2314 | dn F_6,5,$000 2315 | dn A#6,5,$000 2316 | dn D_6,6,$000 2317 | dn F_6,6,$000 2318 | dn A#6,7,$000 2319 | dn D_6,7,$000 2320 | dn F_6,6,$000 2321 | dn A#6,6,$000 2322 | dn D_6,5,$000 2323 | dn F_6,5,$000 2324 | dn A#6,4,$000 2325 | dn D_6,4,$000 2326 | dn F_6,5,$000 2327 | dn A#6,5,$000 2328 | 2329 | P35: 2330 | dn D#5,3,$900 2331 | dn G_5,0,$000 2332 | dn C_6,0,$940 2333 | dn D#5,0,$000 2334 | dn G_5,0,$980 2335 | dn C_6,0,$000 2336 | dn D#5,0,$9C0 2337 | dn G_5,0,$000 2338 | dn C_6,3,$900 2339 | dn D#5,0,$000 2340 | dn G_5,0,$940 2341 | dn C_6,0,$000 2342 | dn D#5,0,$980 2343 | dn G_5,0,$000 2344 | dn C_6,0,$9C0 2345 | dn D#5,0,$000 2346 | dn G_5,3,$900 2347 | dn C_6,0,$000 2348 | dn D#5,0,$940 2349 | dn G_5,0,$000 2350 | dn C_6,0,$980 2351 | dn D#5,0,$000 2352 | dn G_5,0,$9C0 2353 | dn C_6,0,$000 2354 | dn D#5,3,$900 2355 | dn G_5,0,$000 2356 | dn C_6,0,$940 2357 | dn D#5,0,$000 2358 | dn G_5,0,$980 2359 | dn C_6,0,$000 2360 | dn D#5,0,$9C0 2361 | dn G_5,0,$000 2362 | dn C_6,3,$900 2363 | dn D#5,0,$000 2364 | dn G_5,0,$940 2365 | dn C_6,0,$000 2366 | dn D#5,0,$980 2367 | dn G_5,0,$000 2368 | dn C_6,0,$9C0 2369 | dn D#5,0,$000 2370 | dn G_5,3,$900 2371 | dn C_6,0,$000 2372 | dn D#5,0,$940 2373 | dn G_5,0,$000 2374 | dn C_6,0,$980 2375 | dn D#5,0,$000 2376 | dn G_5,0,$9C0 2377 | dn C_6,0,$000 2378 | dn D#5,3,$900 2379 | dn G_5,0,$000 2380 | dn C_6,0,$940 2381 | dn D#5,0,$000 2382 | dn G_5,0,$980 2383 | dn C_6,0,$000 2384 | dn D#5,0,$9C0 2385 | dn G_5,0,$000 2386 | dn C_6,3,$900 2387 | dn D#5,0,$000 2388 | dn G_5,0,$940 2389 | dn C_6,0,$000 2390 | dn D#5,0,$980 2391 | dn G_5,0,$000 2392 | dn C_6,0,$9C0 2393 | dn D#5,0,$000 2394 | 2395 | P36: 2396 | dn C_7,4,$000 2397 | dn D#6,4,$000 2398 | dn G_6,5,$000 2399 | dn C_7,5,$000 2400 | dn D#6,6,$000 2401 | dn G_6,6,$000 2402 | dn C_7,7,$000 2403 | dn D#6,7,$000 2404 | dn G_6,6,$000 2405 | dn C_7,6,$000 2406 | dn D#6,5,$000 2407 | dn G_6,5,$000 2408 | dn C_7,4,$000 2409 | dn D#6,4,$000 2410 | dn G_6,5,$000 2411 | dn C_7,5,$000 2412 | dn D#6,6,$000 2413 | dn G_6,6,$000 2414 | dn C_7,7,$000 2415 | dn D#6,7,$000 2416 | dn G_6,6,$000 2417 | dn C_7,6,$000 2418 | dn D#6,5,$000 2419 | dn G_6,5,$000 2420 | dn C_7,4,$000 2421 | dn D#6,4,$000 2422 | dn G_6,5,$000 2423 | dn C_7,5,$000 2424 | dn D#6,6,$000 2425 | dn G_6,6,$000 2426 | dn C_7,7,$000 2427 | dn D#6,7,$000 2428 | dn G_6,6,$000 2429 | dn C_7,6,$000 2430 | dn D#6,5,$000 2431 | dn G_6,5,$000 2432 | dn C_7,4,$000 2433 | dn D#6,4,$000 2434 | dn G_6,5,$000 2435 | dn C_7,5,$000 2436 | dn D#6,6,$000 2437 | dn G_6,6,$000 2438 | dn C_7,7,$000 2439 | dn D#6,7,$000 2440 | dn G_6,6,$000 2441 | dn C_7,6,$000 2442 | dn D#6,5,$000 2443 | dn G_6,5,$000 2444 | dn C_7,4,$000 2445 | dn D#6,4,$000 2446 | dn G_6,5,$000 2447 | dn C_7,5,$000 2448 | dn D#6,6,$000 2449 | dn G_6,6,$000 2450 | dn C_7,7,$000 2451 | dn D#6,7,$000 2452 | dn G_6,6,$000 2453 | dn C_7,6,$000 2454 | dn D#6,5,$000 2455 | dn G_6,5,$000 2456 | dn C_7,4,$000 2457 | dn D#6,4,$000 2458 | dn G_6,5,$000 2459 | dn C_7,5,$000 2460 | 2461 | P37: 2462 | dn G_6,4,$000 2463 | dn C_6,4,$000 2464 | dn D#6,5,$000 2465 | dn G_6,5,$000 2466 | dn C_6,6,$000 2467 | dn D#6,6,$000 2468 | dn G_6,7,$000 2469 | dn C_6,7,$000 2470 | dn D#6,6,$000 2471 | dn G_6,6,$000 2472 | dn C_6,5,$000 2473 | dn D#6,5,$000 2474 | dn G_6,4,$000 2475 | dn C_6,4,$000 2476 | dn D#6,5,$000 2477 | dn G_6,5,$000 2478 | dn C_6,6,$000 2479 | dn D#6,6,$000 2480 | dn G_6,7,$000 2481 | dn C_6,7,$000 2482 | dn D#6,6,$000 2483 | dn G_6,6,$000 2484 | dn C_6,5,$000 2485 | dn D#6,5,$000 2486 | dn G_6,4,$000 2487 | dn C_6,4,$000 2488 | dn D#6,5,$000 2489 | dn G_6,5,$000 2490 | dn C_6,6,$000 2491 | dn D#6,6,$000 2492 | dn G_6,7,$000 2493 | dn C_6,7,$000 2494 | dn D#6,6,$000 2495 | dn G_6,6,$000 2496 | dn C_6,5,$000 2497 | dn D#6,5,$000 2498 | dn G_6,4,$000 2499 | dn C_6,4,$000 2500 | dn D#6,5,$000 2501 | dn G_6,5,$000 2502 | dn C_6,6,$000 2503 | dn D#6,6,$000 2504 | dn G_6,7,$000 2505 | dn C_6,7,$000 2506 | dn D#6,6,$000 2507 | dn G_6,6,$000 2508 | dn C_6,5,$000 2509 | dn D#6,5,$000 2510 | dn G_6,4,$000 2511 | dn C_6,4,$000 2512 | dn D#6,5,$000 2513 | dn G_6,5,$000 2514 | dn C_6,6,$000 2515 | dn D#6,6,$000 2516 | dn G_6,7,$000 2517 | dn C_6,7,$000 2518 | dn D#6,6,$000 2519 | dn G_6,6,$000 2520 | dn C_6,5,$000 2521 | dn D#6,5,$000 2522 | dn G_6,4,$000 2523 | dn C_6,4,$000 2524 | dn D#6,5,$000 2525 | dn G_6,5,$000 2526 | 2527 | P38: 2528 | dn G_4,3,$900 2529 | dn C_5,0,$000 2530 | dn D#5,0,$940 2531 | dn G_4,0,$000 2532 | dn C_5,0,$980 2533 | dn D#5,0,$000 2534 | dn G_4,0,$9C0 2535 | dn C_5,0,$000 2536 | dn D#5,3,$900 2537 | dn G_4,0,$000 2538 | dn C_5,0,$940 2539 | dn D#5,0,$000 2540 | dn G_4,0,$980 2541 | dn C_5,0,$000 2542 | dn D#5,0,$9C0 2543 | dn G_4,0,$000 2544 | dn C_5,3,$900 2545 | dn D#5,0,$000 2546 | dn G_4,0,$940 2547 | dn C_5,0,$000 2548 | dn D#5,0,$980 2549 | dn G_4,0,$000 2550 | dn C_5,0,$9C0 2551 | dn D#5,0,$000 2552 | dn G_4,3,$900 2553 | dn C_5,0,$000 2554 | dn D#5,0,$940 2555 | dn G_4,0,$000 2556 | dn C_5,0,$980 2557 | dn D#5,0,$000 2558 | dn G_4,0,$9C0 2559 | dn C_5,0,$000 2560 | dn D#5,3,$900 2561 | dn G_4,0,$000 2562 | dn C_5,0,$940 2563 | dn D#5,0,$000 2564 | dn G_4,0,$980 2565 | dn C_5,0,$000 2566 | dn D#5,0,$9C0 2567 | dn G_4,0,$000 2568 | dn C_5,3,$900 2569 | dn D#5,0,$000 2570 | dn G_4,0,$940 2571 | dn C_5,0,$000 2572 | dn D#5,0,$980 2573 | dn G_4,0,$000 2574 | dn C_5,0,$9C0 2575 | dn D#5,0,$000 2576 | dn G_4,3,$900 2577 | dn C_5,0,$000 2578 | dn D#5,0,$940 2579 | dn G_4,0,$000 2580 | dn C_5,0,$980 2581 | dn D#5,0,$000 2582 | dn G_4,0,$9C0 2583 | dn C_5,0,$000 2584 | dn D#5,3,$900 2585 | dn G_4,0,$000 2586 | dn C_5,0,$940 2587 | dn D#5,0,$000 2588 | dn G_4,0,$980 2589 | dn C_5,0,$000 2590 | dn D#5,0,$9C0 2591 | dn G_4,0,$000 2592 | 2593 | P39: 2594 | dn D#6,4,$000 2595 | dn G_5,4,$000 2596 | dn C_6,5,$000 2597 | dn D#6,5,$000 2598 | dn G_5,6,$000 2599 | dn C_6,6,$000 2600 | dn D#6,7,$000 2601 | dn G_5,7,$000 2602 | dn C_6,6,$000 2603 | dn D#6,6,$000 2604 | dn G_5,5,$000 2605 | dn C_6,5,$000 2606 | dn D#6,4,$000 2607 | dn G_5,4,$000 2608 | dn C_6,5,$000 2609 | dn D#6,5,$000 2610 | dn G_5,6,$000 2611 | dn C_6,6,$000 2612 | dn D#6,7,$000 2613 | dn G_5,7,$000 2614 | dn C_6,6,$000 2615 | dn D#6,6,$000 2616 | dn G_5,5,$000 2617 | dn C_6,5,$000 2618 | dn D#6,4,$000 2619 | dn G_5,4,$000 2620 | dn C_6,5,$000 2621 | dn D#6,5,$000 2622 | dn G_5,6,$000 2623 | dn C_6,6,$000 2624 | dn D#6,7,$000 2625 | dn G_5,7,$000 2626 | dn C_6,6,$000 2627 | dn D#6,6,$000 2628 | dn G_5,5,$000 2629 | dn C_6,5,$000 2630 | dn D#6,4,$000 2631 | dn G_5,4,$000 2632 | dn C_6,5,$000 2633 | dn D#6,5,$000 2634 | dn G_5,6,$000 2635 | dn C_6,6,$000 2636 | dn D#6,7,$000 2637 | dn G_5,7,$000 2638 | dn C_6,6,$000 2639 | dn D#6,6,$000 2640 | dn G_5,5,$000 2641 | dn C_6,5,$000 2642 | dn D#6,4,$000 2643 | dn G_5,4,$000 2644 | dn C_6,5,$000 2645 | dn D#6,5,$000 2646 | dn G_5,6,$000 2647 | dn C_6,6,$000 2648 | dn D#6,7,$000 2649 | dn G_5,7,$000 2650 | dn C_6,6,$000 2651 | dn D#6,6,$000 2652 | dn G_5,5,$000 2653 | dn C_6,5,$000 2654 | dn D#6,4,$000 2655 | dn G_5,4,$000 2656 | dn C_6,5,$000 2657 | dn D#6,5,$B0B 2658 | 2659 | itNoiseSP1: 2660 | dn ___,0,$000 2661 | dn 22,2,$000 2662 | dn 5,0,$000 2663 | dn 5,0,$000 2664 | dn 5,0,$000 2665 | dn 5,0,$000 2666 | dn 5,0,$000 2667 | dn ___,0,$000 2668 | dn ___,0,$000 2669 | dn ___,0,$000 2670 | dn ___,0,$000 2671 | dn ___,0,$000 2672 | dn ___,0,$000 2673 | dn ___,0,$000 2674 | dn ___,0,$000 2675 | dn ___,0,$000 2676 | dn ___,0,$000 2677 | dn ___,0,$000 2678 | dn ___,0,$000 2679 | dn ___,0,$000 2680 | dn ___,0,$000 2681 | dn ___,0,$000 2682 | dn ___,0,$000 2683 | dn ___,0,$000 2684 | dn ___,0,$000 2685 | dn ___,0,$000 2686 | dn ___,0,$000 2687 | dn ___,0,$000 2688 | dn ___,0,$000 2689 | dn ___,0,$000 2690 | dn ___,0,$000 2691 | dn ___,1,$000 2692 | 2693 | itNoiseSP2: 2694 | dn ___,0,$000 2695 | dn 58,2,$000 2696 | dn 5,0,$000 2697 | dn 5,0,$000 2698 | dn 5,0,$000 2699 | dn 5,0,$000 2700 | dn 5,0,$000 2701 | dn ___,0,$000 2702 | dn ___,0,$000 2703 | dn ___,0,$000 2704 | dn ___,0,$000 2705 | dn ___,0,$000 2706 | dn ___,0,$000 2707 | dn ___,0,$000 2708 | dn ___,0,$000 2709 | dn ___,0,$000 2710 | dn ___,0,$000 2711 | dn ___,0,$000 2712 | dn ___,0,$000 2713 | dn ___,0,$000 2714 | dn ___,0,$000 2715 | dn ___,0,$000 2716 | dn ___,0,$000 2717 | dn ___,0,$000 2718 | dn ___,0,$000 2719 | dn ___,0,$000 2720 | dn ___,0,$000 2721 | dn ___,0,$000 2722 | dn ___,0,$000 2723 | dn ___,0,$000 2724 | dn ___,0,$000 2725 | dn ___,1,$000 2726 | 2727 | itNoiseSP3: 2728 | dn ___,0,$000 2729 | dn 26,2,$000 2730 | dn 44,0,$000 2731 | dn 44,0,$000 2732 | dn 44,0,$000 2733 | dn 44,0,$000 2734 | dn 44,0,$000 2735 | dn ___,0,$000 2736 | dn ___,0,$000 2737 | dn ___,0,$000 2738 | dn ___,0,$000 2739 | dn ___,0,$000 2740 | dn ___,0,$000 2741 | dn ___,0,$000 2742 | dn ___,0,$000 2743 | dn ___,0,$000 2744 | dn ___,0,$000 2745 | dn ___,0,$000 2746 | dn ___,0,$000 2747 | dn ___,0,$000 2748 | dn ___,0,$000 2749 | dn ___,0,$000 2750 | dn ___,0,$000 2751 | dn ___,0,$000 2752 | dn ___,0,$000 2753 | dn ___,0,$000 2754 | dn ___,0,$000 2755 | dn ___,0,$000 2756 | dn ___,0,$000 2757 | dn ___,0,$000 2758 | dn ___,0,$000 2759 | dn ___,1,$000 2760 | 2761 | itNoiseSP4: 2762 | dn ___,0,$000 2763 | dn 36,2,$000 2764 | dn 36,0,$000 2765 | dn 36,0,$000 2766 | dn 36,0,$000 2767 | dn 36,0,$000 2768 | dn 36,0,$000 2769 | dn ___,0,$000 2770 | dn ___,0,$000 2771 | dn ___,0,$000 2772 | dn ___,0,$000 2773 | dn ___,0,$000 2774 | dn ___,0,$000 2775 | dn ___,0,$000 2776 | dn ___,0,$000 2777 | dn ___,0,$000 2778 | dn ___,0,$000 2779 | dn ___,0,$000 2780 | dn ___,0,$000 2781 | dn ___,0,$000 2782 | dn ___,0,$000 2783 | dn ___,0,$000 2784 | dn ___,0,$000 2785 | dn ___,0,$000 2786 | dn ___,0,$000 2787 | dn ___,0,$000 2788 | dn ___,0,$000 2789 | dn ___,0,$000 2790 | dn ___,0,$000 2791 | dn ___,0,$000 2792 | dn ___,0,$000 2793 | dn ___,1,$000 2794 | 2795 | itNoiseSP5: 2796 | dn ___,0,$000 2797 | dn 36,2,$000 2798 | dn 36,0,$000 2799 | dn 36,0,$000 2800 | dn 36,0,$000 2801 | dn 36,0,$000 2802 | dn 36,0,$000 2803 | dn ___,0,$000 2804 | dn ___,0,$000 2805 | dn ___,0,$000 2806 | dn ___,0,$000 2807 | dn ___,0,$000 2808 | dn ___,0,$000 2809 | dn ___,0,$000 2810 | dn ___,0,$000 2811 | dn ___,0,$000 2812 | dn ___,0,$000 2813 | dn ___,0,$000 2814 | dn ___,0,$000 2815 | dn ___,0,$000 2816 | dn ___,0,$000 2817 | dn ___,0,$000 2818 | dn ___,0,$000 2819 | dn ___,0,$000 2820 | dn ___,0,$000 2821 | dn ___,0,$000 2822 | dn ___,0,$000 2823 | dn ___,0,$000 2824 | dn ___,0,$000 2825 | dn ___,0,$000 2826 | dn ___,0,$000 2827 | dn ___,1,$000 2828 | 2829 | itNoiseSP6: 2830 | dn ___,0,$000 2831 | dn 36,2,$000 2832 | dn 36,0,$000 2833 | dn 36,0,$000 2834 | dn 36,0,$000 2835 | dn 36,0,$000 2836 | dn 36,0,$000 2837 | dn ___,0,$000 2838 | dn ___,0,$000 2839 | dn ___,0,$000 2840 | dn ___,0,$000 2841 | dn ___,0,$000 2842 | dn ___,0,$000 2843 | dn ___,0,$000 2844 | dn ___,0,$000 2845 | dn ___,0,$000 2846 | dn ___,0,$000 2847 | dn ___,0,$000 2848 | dn ___,0,$000 2849 | dn ___,0,$000 2850 | dn ___,0,$000 2851 | dn ___,0,$000 2852 | dn ___,0,$000 2853 | dn ___,0,$000 2854 | dn ___,0,$000 2855 | dn ___,0,$000 2856 | dn ___,0,$000 2857 | dn ___,0,$000 2858 | dn ___,0,$000 2859 | dn ___,0,$000 2860 | dn ___,0,$000 2861 | dn ___,1,$000 2862 | 2863 | itNoiseSP7: 2864 | dn ___,0,$000 2865 | dn 36,2,$000 2866 | dn 36,0,$000 2867 | dn 36,0,$000 2868 | dn 36,0,$000 2869 | dn 36,0,$000 2870 | dn 36,0,$000 2871 | dn ___,0,$000 2872 | dn ___,0,$000 2873 | dn ___,0,$000 2874 | dn ___,0,$000 2875 | dn ___,0,$000 2876 | dn ___,0,$000 2877 | dn ___,0,$000 2878 | dn ___,0,$000 2879 | dn ___,0,$000 2880 | dn ___,0,$000 2881 | dn ___,0,$000 2882 | dn ___,0,$000 2883 | dn ___,0,$000 2884 | dn ___,0,$000 2885 | dn ___,0,$000 2886 | dn ___,0,$000 2887 | dn ___,0,$000 2888 | dn ___,0,$000 2889 | dn ___,0,$000 2890 | dn ___,0,$000 2891 | dn ___,0,$000 2892 | dn ___,0,$000 2893 | dn ___,0,$000 2894 | dn ___,0,$000 2895 | dn ___,1,$000 2896 | 2897 | itNoiseSP8: 2898 | dn ___,0,$000 2899 | dn 36,2,$000 2900 | dn 36,0,$000 2901 | dn 36,0,$000 2902 | dn 36,0,$000 2903 | dn 36,0,$000 2904 | dn 36,0,$000 2905 | dn ___,0,$000 2906 | dn ___,0,$000 2907 | dn ___,0,$000 2908 | dn ___,0,$000 2909 | dn ___,0,$000 2910 | dn ___,0,$000 2911 | dn ___,0,$000 2912 | dn ___,0,$000 2913 | dn ___,0,$000 2914 | dn ___,0,$000 2915 | dn ___,0,$000 2916 | dn ___,0,$000 2917 | dn ___,0,$000 2918 | dn ___,0,$000 2919 | dn ___,0,$000 2920 | dn ___,0,$000 2921 | dn ___,0,$000 2922 | dn ___,0,$000 2923 | dn ___,0,$000 2924 | dn ___,0,$000 2925 | dn ___,0,$000 2926 | dn ___,0,$000 2927 | dn ___,0,$000 2928 | dn ___,0,$000 2929 | dn ___,1,$000 2930 | 2931 | itNoiseSP9: 2932 | dn ___,0,$000 2933 | dn 36,2,$000 2934 | dn 36,0,$000 2935 | dn 36,0,$000 2936 | dn 36,0,$000 2937 | dn 36,0,$000 2938 | dn 36,0,$000 2939 | dn ___,0,$000 2940 | dn ___,0,$000 2941 | dn ___,0,$000 2942 | dn ___,0,$000 2943 | dn ___,0,$000 2944 | dn ___,0,$000 2945 | dn ___,0,$000 2946 | dn ___,0,$000 2947 | dn ___,0,$000 2948 | dn ___,0,$000 2949 | dn ___,0,$000 2950 | dn ___,0,$000 2951 | dn ___,0,$000 2952 | dn ___,0,$000 2953 | dn ___,0,$000 2954 | dn ___,0,$000 2955 | dn ___,0,$000 2956 | dn ___,0,$000 2957 | dn ___,0,$000 2958 | dn ___,0,$000 2959 | dn ___,0,$000 2960 | dn ___,0,$000 2961 | dn ___,0,$000 2962 | dn ___,0,$000 2963 | dn ___,1,$000 2964 | 2965 | itNoiseSP10: 2966 | dn ___,0,$000 2967 | dn 36,2,$000 2968 | dn 36,0,$000 2969 | dn 36,0,$000 2970 | dn 36,0,$000 2971 | dn 36,0,$000 2972 | dn 36,0,$000 2973 | dn ___,0,$000 2974 | dn ___,0,$000 2975 | dn ___,0,$000 2976 | dn ___,0,$000 2977 | dn ___,0,$000 2978 | dn ___,0,$000 2979 | dn ___,0,$000 2980 | dn ___,0,$000 2981 | dn ___,0,$000 2982 | dn ___,0,$000 2983 | dn ___,0,$000 2984 | dn ___,0,$000 2985 | dn ___,0,$000 2986 | dn ___,0,$000 2987 | dn ___,0,$000 2988 | dn ___,0,$000 2989 | dn ___,0,$000 2990 | dn ___,0,$000 2991 | dn ___,0,$000 2992 | dn ___,0,$000 2993 | dn ___,0,$000 2994 | dn ___,0,$000 2995 | dn ___,0,$000 2996 | dn ___,0,$000 2997 | dn ___,1,$000 2998 | 2999 | itNoiseSP11: 3000 | dn ___,0,$000 3001 | dn 36,2,$000 3002 | dn 36,0,$000 3003 | dn 36,0,$000 3004 | dn 36,0,$000 3005 | dn 36,0,$000 3006 | dn 36,0,$000 3007 | dn ___,0,$000 3008 | dn ___,0,$000 3009 | dn ___,0,$000 3010 | dn ___,0,$000 3011 | dn ___,0,$000 3012 | dn ___,0,$000 3013 | dn ___,0,$000 3014 | dn ___,0,$000 3015 | dn ___,0,$000 3016 | dn ___,0,$000 3017 | dn ___,0,$000 3018 | dn ___,0,$000 3019 | dn ___,0,$000 3020 | dn ___,0,$000 3021 | dn ___,0,$000 3022 | dn ___,0,$000 3023 | dn ___,0,$000 3024 | dn ___,0,$000 3025 | dn ___,0,$000 3026 | dn ___,0,$000 3027 | dn ___,0,$000 3028 | dn ___,0,$000 3029 | dn ___,0,$000 3030 | dn ___,0,$000 3031 | dn ___,1,$000 3032 | 3033 | itNoiseSP12: 3034 | dn ___,0,$000 3035 | dn 36,2,$000 3036 | dn 36,0,$000 3037 | dn 36,0,$000 3038 | dn 36,0,$000 3039 | dn 36,0,$000 3040 | dn 36,0,$000 3041 | dn ___,0,$000 3042 | dn ___,0,$000 3043 | dn ___,0,$000 3044 | dn ___,0,$000 3045 | dn ___,0,$000 3046 | dn ___,0,$000 3047 | dn ___,0,$000 3048 | dn ___,0,$000 3049 | dn ___,0,$000 3050 | dn ___,0,$000 3051 | dn ___,0,$000 3052 | dn ___,0,$000 3053 | dn ___,0,$000 3054 | dn ___,0,$000 3055 | dn ___,0,$000 3056 | dn ___,0,$000 3057 | dn ___,0,$000 3058 | dn ___,0,$000 3059 | dn ___,0,$000 3060 | dn ___,0,$000 3061 | dn ___,0,$000 3062 | dn ___,0,$000 3063 | dn ___,0,$000 3064 | dn ___,0,$000 3065 | dn ___,1,$000 3066 | 3067 | itNoiseSP13: 3068 | dn ___,0,$000 3069 | dn 36,2,$000 3070 | dn 36,0,$000 3071 | dn 36,0,$000 3072 | dn 36,0,$000 3073 | dn 36,0,$000 3074 | dn 36,0,$000 3075 | dn ___,0,$000 3076 | dn ___,0,$000 3077 | dn ___,0,$000 3078 | dn ___,0,$000 3079 | dn ___,0,$000 3080 | dn ___,0,$000 3081 | dn ___,0,$000 3082 | dn ___,0,$000 3083 | dn ___,0,$000 3084 | dn ___,0,$000 3085 | dn ___,0,$000 3086 | dn ___,0,$000 3087 | dn ___,0,$000 3088 | dn ___,0,$000 3089 | dn ___,0,$000 3090 | dn ___,0,$000 3091 | dn ___,0,$000 3092 | dn ___,0,$000 3093 | dn ___,0,$000 3094 | dn ___,0,$000 3095 | dn ___,0,$000 3096 | dn ___,0,$000 3097 | dn ___,0,$000 3098 | dn ___,0,$000 3099 | dn ___,1,$000 3100 | 3101 | itNoiseSP14: 3102 | dn ___,0,$000 3103 | dn 36,2,$000 3104 | dn 36,0,$000 3105 | dn 36,0,$000 3106 | dn 36,0,$000 3107 | dn 36,0,$000 3108 | dn 36,0,$000 3109 | dn ___,0,$000 3110 | dn ___,0,$000 3111 | dn ___,0,$000 3112 | dn ___,0,$000 3113 | dn ___,0,$000 3114 | dn ___,0,$000 3115 | dn ___,0,$000 3116 | dn ___,0,$000 3117 | dn ___,0,$000 3118 | dn ___,0,$000 3119 | dn ___,0,$000 3120 | dn ___,0,$000 3121 | dn ___,0,$000 3122 | dn ___,0,$000 3123 | dn ___,0,$000 3124 | dn ___,0,$000 3125 | dn ___,0,$000 3126 | dn ___,0,$000 3127 | dn ___,0,$000 3128 | dn ___,0,$000 3129 | dn ___,0,$000 3130 | dn ___,0,$000 3131 | dn ___,0,$000 3132 | dn ___,0,$000 3133 | dn ___,1,$000 3134 | 3135 | itNoiseSP15: 3136 | dn ___,0,$000 3137 | dn 36,2,$000 3138 | dn 36,0,$000 3139 | dn 36,0,$000 3140 | dn 36,0,$000 3141 | dn 36,0,$000 3142 | dn 36,0,$000 3143 | dn ___,0,$000 3144 | dn ___,0,$000 3145 | dn ___,0,$000 3146 | dn ___,0,$000 3147 | dn ___,0,$000 3148 | dn ___,0,$000 3149 | dn ___,0,$000 3150 | dn ___,0,$000 3151 | dn ___,0,$000 3152 | dn ___,0,$000 3153 | dn ___,0,$000 3154 | dn ___,0,$000 3155 | dn ___,0,$000 3156 | dn ___,0,$000 3157 | dn ___,0,$000 3158 | dn ___,0,$000 3159 | dn ___,0,$000 3160 | dn ___,0,$000 3161 | dn ___,0,$000 3162 | dn ___,0,$000 3163 | dn ___,0,$000 3164 | dn ___,0,$000 3165 | dn ___,0,$000 3166 | dn ___,0,$000 3167 | dn ___,1,$000 3168 | 3169 | duty_instruments: 3170 | itSquareinst1: 3171 | db 8 3172 | db 128 3173 | db 193 3174 | dw 0 3175 | db 128 3176 | 3177 | itSquareinst2: 3178 | db 8 3179 | db 128 3180 | db 67 3181 | dw 0 3182 | db 128 3183 | 3184 | itSquareinst3: 3185 | db 8 3186 | db 0 3187 | db 64 3188 | dw 0 3189 | db 128 3190 | 3191 | itSquareinst4: 3192 | db 28 3193 | db 128 3194 | db 145 3195 | dw 0 3196 | db 128 3197 | 3198 | itSquareinst5: 3199 | db 8 3200 | db 64 3201 | db 177 3202 | dw 0 3203 | db 128 3204 | 3205 | itSquareinst6: 3206 | db 29 3207 | db 128 3208 | db 145 3209 | dw 0 3210 | db 128 3211 | 3212 | itSquareinst7: 3213 | db 8 3214 | db 0 3215 | db 240 3216 | dw 0 3217 | db 128 3218 | 3219 | itSquareinst8: 3220 | db 8 3221 | db 0 3222 | db 240 3223 | dw 0 3224 | db 128 3225 | 3226 | itSquareinst9: 3227 | db 8 3228 | db 128 3229 | db 240 3230 | dw 0 3231 | db 128 3232 | 3233 | itSquareinst10: 3234 | db 8 3235 | db 128 3236 | db 240 3237 | dw 0 3238 | db 128 3239 | 3240 | itSquareinst11: 3241 | db 8 3242 | db 128 3243 | db 240 3244 | dw 0 3245 | db 128 3246 | 3247 | itSquareinst12: 3248 | db 8 3249 | db 128 3250 | db 240 3251 | dw 0 3252 | db 128 3253 | 3254 | itSquareinst13: 3255 | db 8 3256 | db 128 3257 | db 240 3258 | dw 0 3259 | db 128 3260 | 3261 | itSquareinst14: 3262 | db 8 3263 | db 128 3264 | db 240 3265 | dw 0 3266 | db 128 3267 | 3268 | itSquareinst15: 3269 | db 8 3270 | db 128 3271 | db 240 3272 | dw 0 3273 | db 128 3274 | 3275 | 3276 | 3277 | wave_instruments: 3278 | itWaveinst1: 3279 | db 0 3280 | db 64 3281 | db 0 3282 | dw 0 3283 | db 128 3284 | 3285 | itWaveinst2: 3286 | db 0 3287 | db 64 3288 | db 1 3289 | dw 0 3290 | db 128 3291 | 3292 | itWaveinst3: 3293 | db 0 3294 | db 64 3295 | db 2 3296 | dw 0 3297 | db 128 3298 | 3299 | itWaveinst4: 3300 | db 0 3301 | db 64 3302 | db 3 3303 | dw 0 3304 | db 128 3305 | 3306 | itWaveinst5: 3307 | db 0 3308 | db 64 3309 | db 4 3310 | dw 0 3311 | db 128 3312 | 3313 | itWaveinst6: 3314 | db 0 3315 | db 64 3316 | db 5 3317 | dw 0 3318 | db 128 3319 | 3320 | itWaveinst7: 3321 | db 0 3322 | db 64 3323 | db 6 3324 | dw 0 3325 | db 128 3326 | 3327 | itWaveinst8: 3328 | db 0 3329 | db 32 3330 | db 0 3331 | dw 0 3332 | db 128 3333 | 3334 | itWaveinst9: 3335 | db 0 3336 | db 32 3337 | db 0 3338 | dw 0 3339 | db 128 3340 | 3341 | itWaveinst10: 3342 | db 0 3343 | db 32 3344 | db 0 3345 | dw 0 3346 | db 128 3347 | 3348 | itWaveinst11: 3349 | db 0 3350 | db 32 3351 | db 0 3352 | dw 0 3353 | db 128 3354 | 3355 | itWaveinst12: 3356 | db 0 3357 | db 32 3358 | db 11 3359 | dw 0 3360 | db 128 3361 | 3362 | itWaveinst13: 3363 | db 0 3364 | db 32 3365 | db 12 3366 | dw 0 3367 | db 128 3368 | 3369 | itWaveinst14: 3370 | db 0 3371 | db 32 3372 | db 13 3373 | dw 0 3374 | db 128 3375 | 3376 | itWaveinst15: 3377 | db 0 3378 | db 32 3379 | db 14 3380 | dw 0 3381 | db 128 3382 | 3383 | 3384 | 3385 | noise_instruments: 3386 | itNoiseinst1: 3387 | db 113 3388 | dw itNoiseSP1 3389 | db 0 3390 | ds 2 3391 | 3392 | itNoiseinst2: 3393 | db 113 3394 | dw itNoiseSP2 3395 | db 0 3396 | ds 2 3397 | 3398 | itNoiseinst3: 3399 | db 99 3400 | dw itNoiseSP3 3401 | db 0 3402 | ds 2 3403 | 3404 | itNoiseinst4: 3405 | db 240 3406 | dw itNoiseSP4 3407 | db 0 3408 | ds 2 3409 | 3410 | itNoiseinst5: 3411 | db 240 3412 | dw itNoiseSP5 3413 | db 0 3414 | ds 2 3415 | 3416 | itNoiseinst6: 3417 | db 240 3418 | dw itNoiseSP6 3419 | db 0 3420 | ds 2 3421 | 3422 | itNoiseinst7: 3423 | db 240 3424 | dw itNoiseSP7 3425 | db 0 3426 | ds 2 3427 | 3428 | itNoiseinst8: 3429 | db 240 3430 | dw itNoiseSP8 3431 | db 0 3432 | ds 2 3433 | 3434 | itNoiseinst9: 3435 | db 240 3436 | dw itNoiseSP9 3437 | db 0 3438 | ds 2 3439 | 3440 | itNoiseinst10: 3441 | db 240 3442 | dw itNoiseSP10 3443 | db 0 3444 | ds 2 3445 | 3446 | itNoiseinst11: 3447 | db 240 3448 | dw itNoiseSP11 3449 | db 0 3450 | ds 2 3451 | 3452 | itNoiseinst12: 3453 | db 240 3454 | dw itNoiseSP12 3455 | db 0 3456 | ds 2 3457 | 3458 | itNoiseinst13: 3459 | db 240 3460 | dw itNoiseSP13 3461 | db 0 3462 | ds 2 3463 | 3464 | itNoiseinst14: 3465 | db 240 3466 | dw itNoiseSP14 3467 | db 0 3468 | ds 2 3469 | 3470 | itNoiseinst15: 3471 | db 240 3472 | dw itNoiseSP15 3473 | db 0 3474 | ds 2 3475 | 3476 | 3477 | 3478 | routines: 3479 | __hUGE_Routine_0: 3480 | 3481 | __end_hUGE_Routine_0: 3482 | ret 3483 | 3484 | __hUGE_Routine_1: 3485 | 3486 | __end_hUGE_Routine_1: 3487 | ret 3488 | 3489 | __hUGE_Routine_2: 3490 | 3491 | __end_hUGE_Routine_2: 3492 | ret 3493 | 3494 | __hUGE_Routine_3: 3495 | 3496 | __end_hUGE_Routine_3: 3497 | ret 3498 | 3499 | __hUGE_Routine_4: 3500 | 3501 | __end_hUGE_Routine_4: 3502 | ret 3503 | 3504 | __hUGE_Routine_5: 3505 | 3506 | __end_hUGE_Routine_5: 3507 | ret 3508 | 3509 | __hUGE_Routine_6: 3510 | 3511 | __end_hUGE_Routine_6: 3512 | ret 3513 | 3514 | __hUGE_Routine_7: 3515 | 3516 | __end_hUGE_Routine_7: 3517 | ret 3518 | 3519 | __hUGE_Routine_8: 3520 | 3521 | __end_hUGE_Routine_8: 3522 | ret 3523 | 3524 | __hUGE_Routine_9: 3525 | 3526 | __end_hUGE_Routine_9: 3527 | ret 3528 | 3529 | __hUGE_Routine_10: 3530 | 3531 | __end_hUGE_Routine_10: 3532 | ret 3533 | 3534 | __hUGE_Routine_11: 3535 | 3536 | __end_hUGE_Routine_11: 3537 | ret 3538 | 3539 | __hUGE_Routine_12: 3540 | 3541 | __end_hUGE_Routine_12: 3542 | ret 3543 | 3544 | __hUGE_Routine_13: 3545 | 3546 | __end_hUGE_Routine_13: 3547 | ret 3548 | 3549 | __hUGE_Routine_14: 3550 | 3551 | __end_hUGE_Routine_14: 3552 | ret 3553 | 3554 | __hUGE_Routine_15: 3555 | 3556 | __end_hUGE_Routine_15: 3557 | ret 3558 | 3559 | waves: 3560 | wave0: db 72,255,255,255,255,255,255,132,0,102,6,96,0,79,255,136 3561 | wave1: db 0,0,0,0,0,0,0,0,221,221,221,221,221,221,221,221 3562 | wave2: db 0,17,34,34,51,68,85,102,119,119,136,153,170,187,187,204 3563 | wave3: db 0,0,0,0,0,0,0,0,0,187,187,187,187,187,187,187 3564 | wave4: db 0,0,0,0,0,0,0,0,0,0,0,0,221,221,221,221 3565 | wave5: db 0,0,0,0,0,0,0,0,0,0,0,0,13,221,221,221 3566 | wave6: db 0,0,0,0,0,0,0,0,0,0,0,0,0,13,221,221 3567 | wave7: db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3568 | wave8: db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3569 | wave9: db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3570 | wave10: db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3571 | wave11: db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3572 | wave12: db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3573 | wave13: db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3574 | wave14: db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3575 | wave15: db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3576 | 3577 | -------------------------------------------------------------------------------- /song.asm: -------------------------------------------------------------------------------- 1 | include "include/hUGE.inc" 2 | 3 | SECTION "Song Data", ROMX 4 | 5 | ;; song descriptor 6 | 7 | SONG_DESCRIPTOR:: 8 | db TICKS ; tempo 9 | dw order_cnt 10 | dw order1, order2, order3, order4 11 | dw duty_instruments, wave_instruments, noise_instruments 12 | dw routines 13 | dw waves 14 | 15 | ;;;;;;;;;;; 16 | ;; Orders 17 | ;;;;;;;;;;; 18 | 19 | include "order.htt" 20 | 21 | ;;;;;;;;;;;; 22 | ;; Patterns 23 | ;;;;;;;;;;;; 24 | 25 | include "pattern.htt" 26 | include "subpattern.htt" 27 | 28 | ;;;;;;;;;;;;;;;; 29 | ;; Instruments 30 | ;;;;;;;;;;;;;;;; 31 | 32 | duty_instruments: 33 | 34 | include "duty_instrument.htt" 35 | 36 | wave_instruments: 37 | 38 | include "wave_instrument.htt" 39 | 40 | noise_instruments: 41 | 42 | include "noise_instrument.htt" 43 | 44 | ;;;;;;;;;;;;; 45 | ;; Routines 46 | ;;;;;;;;;;;;; 47 | 48 | MACRO loadRoutine 49 | __hUGE_Routine_\1: 50 | include "routine\1.htt" 51 | __end_hUGE_Routine_\1: 52 | ret 53 | ENDM 54 | 55 | loadRoutine 0 56 | loadRoutine 1 57 | loadRoutine 2 58 | loadRoutine 3 59 | loadRoutine 4 60 | loadRoutine 5 61 | loadRoutine 6 62 | loadRoutine 7 63 | loadRoutine 8 64 | loadRoutine 9 65 | loadRoutine 10 66 | loadRoutine 11 67 | loadRoutine 12 68 | loadRoutine 13 69 | loadRoutine 14 70 | loadRoutine 15 71 | 72 | routines: 73 | dw __hUGE_Routine_0, __hUGE_Routine_1, __hUGE_Routine_2, __hUGE_Routine_3, __hUGE_Routine_4, __hUGE_Routine_5, __hUGE_Routine_6, __hUGE_Routine_7 74 | dw __hUGE_Routine_8, __hUGE_Routine_9, __hUGE_Routine_10, __hUGE_Routine_11, __hUGE_Routine_12, __hUGE_Routine_13, __hUGE_Routine_14, __hUGE_Routine_15 75 | 76 | ;;;;;;;;; 77 | ;; Waves 78 | ;;;;;;;;; 79 | 80 | waves: 81 | 82 | include "wave.htt" 83 | 84 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 85 | -------------------------------------------------------------------------------- /tools/rgb2sdas.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import os 3 | from io import BytesIO 4 | from pathlib import Path 5 | from optparse import OptionParser 6 | from struct import unpack, unpack_from, calcsize 7 | 8 | RGBDS_REVISION_LOW = 6 9 | RGBDS_REVISION_HIGH = 9 10 | 11 | WRAM0 = 0; VRAM = 1; ROMX = 2; ROM0 = 3; HRAM = 4; WRAMX = 5; SRAM = 6; OAM = 7 12 | SYM_LOCAL = 0; SYM_IMPORT = 1; SYM_EXPORT = 2 13 | PATCH_BYTE = 0; PATCH_LE_WORD = 1; PATCH_LE_LONG = 2; PATCH_JR = 3 14 | 15 | rpnPlus = 0x00; rpnMinus = 0x01; rpnTimes = 0x02; rpnDiv = 0x03; rpnMod = 0x04; rpnNegate = 0x05; rpnExponent = 0x06; rpnOr = 0x10; 16 | rpnAnd = 0x11; rpnXor = 0x12; rpnComplement = 0x13; rpnBoolAnd = 0x21; rpnBoolOr = 0x22; rpnBoolNeg = 0x23; rpnEqual = 0x30; rpnNotEqual = 0x31; 17 | rpnGreater = 0x32; rpnLess = 0x33; rpnGreaterEqual = 0x34; rpnLessEqual = 0x35; rpnShl = 0x40; rpnShr = 0x41; rpnBankSymbol = 0x50; rpnBankSection = 0x51; 18 | rpnCurrentBank = 0x52; rpnSizeOfSection = 0x53; rpnStartOfSection = 0x54; rpnHramCheck = 0x60; rpnRstCheck = 0x61; rpnInteger = 0x80; rpnSymbol = 0x81 19 | 20 | class ByteStream(BytesIO): 21 | def read_record(self, fmt): 22 | return unpack(fmt, self.read(calcsize(fmt))) 23 | 24 | def read_null_term(self): 25 | res = [] 26 | while True: 27 | c = self.read(1) 28 | if (len(c) == 0): break 29 | if c[0] == 0: break 30 | res.append(c.decode('ascii')) 31 | return ''.join(res) 32 | 33 | def read_array(self, fmt, count): 34 | len = calcsize(fmt) 35 | res = [] 36 | for j in range(count): 37 | res.append(unpack(fmt, self.read(len))) 38 | return res 39 | 40 | class RGBObject(object): 41 | def __init__(self, data): 42 | self.Symbols = [] 43 | self.Sections = [] 44 | self.Nodes = [] 45 | 46 | stream = ByteStream(data) 47 | 48 | self.id, self.rev = stream.read_record('<4si') 49 | if (self.id != b'RGB9') or not (RGBDS_REVISION_LOW <= self.rev <= RGBDS_REVISION_HIGH): 50 | raise Exception("RGBDS Object version mismatch! Expected: {:d} received: {:d}".format(RGBDS_REVISION, self.rev)) 51 | 52 | nSymbols, nSections, nNodes = stream.read_record('> 8) & 0xff 132 | 133 | def main(argv=None): 134 | parser = OptionParser("Usage: rgb2sdas.py [options] INPUT_FILE_NAME.OBJ") 135 | parser.add_option("-o", '--out', dest='outfilename', help='output file name') 136 | 137 | parser.add_option("-b", '--bank', dest='default_bank', default="0", help='BANK number (default: 0)') 138 | parser.add_option("-c", '--codeseg', dest='CODESEG', default="_CODE", help='CODE segment name (default: "_CODE")') 139 | parser.add_option("-r", '--rename', dest='rename', help='rename symbol: old=new') 140 | parser.add_option("-e", '--export-all', dest='export_all', action="store_true", default=False, help='export all symbols') 141 | parser.add_option("-m", '--target', dest='target', default="sm83", help='target platform (default: "sm83")') 142 | 143 | (options, args) = parser.parse_args() 144 | 145 | if (len(args) == 0): 146 | parser.print_help() 147 | parser.error("Input file name required\n") 148 | 149 | infilename = Path(args[0]) 150 | 151 | if (options.outfilename == None): 152 | outfilename = infilename.with_suffix('.o') 153 | else: 154 | outfilename = Path(options.outfilename) 155 | 156 | if (options.rename != None): 157 | old_sym, new_sym = str(options.rename).split('=') 158 | else: 159 | old_sym = new_sym = '' 160 | 161 | with open(str(infilename), mode="rb") as f: 162 | obj = RGBObject(f.read()) 163 | 164 | try: 165 | with open(str(outfilename), "wb") as f: 166 | idx = 0 167 | # pass 1: all imports first 168 | for symbol in obj.Symbols: 169 | if ((symbol['SymType'] & 0x7f) == SYM_IMPORT): 170 | symbol['No'] = idx 171 | idx += 1 172 | elif ((symbol['SymType'] & 0x7f) == SYM_EXPORT): 173 | symbol['No'] = -1 174 | section = obj.Sections[symbol['SectionId']] 175 | if (section['SectType'] == ROMX): 176 | symbol['BankAlias'] = (max(int(options.default_bank), section['Bank']) > 0) 177 | symbol['BankValue'] = max(int(options.default_bank), section['Bank']) 178 | if (symbol['BankAlias']): 179 | idx += 1 180 | else: 181 | symbol['No'] = -1 182 | 183 | # pass 2: all other (export local only when forced) 184 | for symbol in obj.Symbols: 185 | if ((symbol['SymType'] & 0x7f) == SYM_LOCAL): 186 | if (options.export_all): 187 | symbol['No'] = idx 188 | idx += 1 189 | elif ((symbol['SymType'] & 0x7f) == SYM_IMPORT): 190 | pass 191 | elif ((symbol['SymType'] & 0x7f) == SYM_EXPORT): 192 | if ((len(old_sym) != 0) and (symbol['Name'] == old_sym)): 193 | symbol['Name'] = new_sym 194 | symbol['No'] = idx 195 | idx += 1 196 | else: 197 | raise Exception('Unsupported symbol type: {:d}'.format(symbol['SymType'] & 0x7f)) 198 | 199 | # output object header 200 | f.write(bytes('XL3\n', 'ascii')) 201 | f.write(bytes('H {:X} areas {:X} global symbols\n'.format(len(obj.Sections), idx), 'ascii')) 202 | f.write(bytes('M {:s}\n'.format(infilename.name.replace('.', '_')), 'ascii')) 203 | f.write(bytes('O -m{:s}\n'.format(options.target), 'ascii')) 204 | 205 | # output all imported symbols 206 | for symbol in obj.Symbols: 207 | if ((symbol['SymType'] & 0x7f) == SYM_IMPORT): 208 | f.write(bytes('S {:s} Ref{:06X}\n'.format(symbol['Name'].replace('.', '____'), 0), 'ascii')) 209 | elif ((symbol['SymType'] & 0x7f) == SYM_EXPORT) and (symbol.setdefault('BankAlias', False)): 210 | f.write(bytes('S b{:s} Ref{:06X}\n'.format(symbol['Name'].replace('.', '____'), symbol['BankValue']), 'ascii')) 211 | 212 | # output all sections and other symbols 213 | for section in obj.Sections: 214 | if (section['Org'] == -1): 215 | if (section['SectType'] == ROM0): 216 | f.write(bytes('A {:s} size {:X} flags 0 addr 0\n'.format(options.CODESEG, section['Size']), 'ascii')); 217 | elif (section['SectType'] == ROMX): 218 | if (int(options.default_bank) == 0): 219 | f.write(bytes('A {:s} size {:X} flags 0 addr 0\n'.format(options.CODESEG, section['Size']), 'ascii')); 220 | else: 221 | f.write(bytes('A _CODE_{:d} size {:X} flags 0 addr 0\n'.format(max(int(options.default_bank), section['Bank']), section['Size']), 'ascii')); 222 | else: 223 | f.write(bytes('A _DATA size {:X} flags 0 addr 0\n'.format(section['Size']), 'ascii')); 224 | else: 225 | raise Exception('Absolute sections currently unsupported: {:s}'.format(section['Name'])) 226 | 227 | for symbol in obj.Symbols: 228 | if (symbol['SectionId'] == section['Id']): 229 | if (((symbol['SymType'] & 0x7f) != SYM_IMPORT) and (symbol['No'] >= 0)): 230 | f.write(bytes('S {:s} Def{:06X}\n'.format(symbol['Name'], symbol['Value']).replace('.', '____'), 'ascii')) 231 | 232 | 233 | # convert object itself 234 | for section in obj.Sections: 235 | if (section['SectType'] != ROM0) and (section['SectType'] != ROMX): 236 | continue 237 | 238 | data = section.setdefault('Data', []) 239 | if (len(data) == 0): 240 | continue; 241 | 242 | read_position = 0 243 | while read_position < len(data): 244 | PC = read_position + (section['Org'] if (section['Org'] != -1) else 0) 245 | 246 | res, patch = obj.find_patch(section, read_position) 247 | if (res): 248 | RPN = patch['RPN'] 249 | if (patch['PatchType'] == PATCH_BYTE): 250 | if (((len(RPN) == 3) and ((RPN[1]['Tag'] != rpnInteger) or (RPN[2]['Tag'] != rpnAnd))) or 251 | ((len(RPN) == 5) and ((RPN[1]['Tag'] != rpnInteger) or (RPN[2]['Tag'] != rpnShr) or (RPN[3]['Tag'] != rpnInteger) or (RPN[4]['Tag'] != rpnAnd))) or 252 | (not len(RPN) in [3, 5])): 253 | raise Exception('Unsupported RPN expression in byte patch') 254 | 255 | symbol = obj.Symbols[RPN[0]['SymbolId']] 256 | if len(RPN) == 3: 257 | f.write(bytes('T {:02X} {:02X} 00 {:02X} {:02X} 00\n'.format(lo(PC), hi(PC), lo(symbol['Value']), hi(symbol['Value'])), 'ascii')) 258 | f.write(bytes('R 00 00 {:02X} {:02X} 09 03 {:02X} {:02X}\n'.format(lo(section['Id']), hi(section['Id']), lo(symbol['SectionId']), hi(symbol['SectionId'])), 'ascii')) 259 | elif len(RPN) == 5: 260 | f.write(bytes('T {:02X} {:02X} 00 {:02X} {:02X} 00\n'.format(lo(PC), hi(PC), lo(symbol['Value']), hi(symbol['Value'])), 'ascii')) 261 | f.write(bytes('R 00 00 {:02X} {:02X} 89 03 {:02X} {:02X}\n'.format(lo(section['Id']), hi(section['Id']), lo(symbol['SectionId']), hi(symbol['SectionId'])), 'ascii')) 262 | read_position += 1 263 | elif (patch['PatchType'] == PATCH_LE_WORD): 264 | if (((len(RPN) == 3) and ((RPN[1]['Tag'] != rpnInteger) or (RPN[2]['Tag'] != rpnPlus))) or 265 | (not len(RPN) in [1, 3])): 266 | raise Exception('Unsupported RPN expression in word patch') 267 | 268 | symbol = obj.Symbols[RPN[0]['SymbolId']] 269 | value_to_write = symbol['Value'] 270 | 271 | if (RPN[-1]['Tag'] == rpnPlus): 272 | value_to_write += RPN[1]['IntValue'] 273 | 274 | if (symbol['SymType'] == SYM_IMPORT): 275 | if (symbol['No'] < 0): 276 | raise Exception('Trying to reference eliminated symbol'); 277 | f.write(bytes('T {:02X} {:02X} 00 {:02X} {:02X}\n'.format(lo(PC), hi(PC), lo(value_to_write), hi(value_to_write)), 'ascii')) 278 | f.write(bytes('R 00 00 {:02X} {:02X} 02 03 {:02X} {:02X}\n'.format(lo(section['Id']), hi(section['Id']), lo(symbol['No']), hi(symbol['No'])), 'ascii')) 279 | else: 280 | f.write(bytes('T {:02X} {:02X} 00 {:02X} {:02X}\n'.format(lo(PC), hi(PC), lo(value_to_write), hi(value_to_write)), 'ascii')) 281 | f.write(bytes('R 00 00 {:02X} {:02X} 00 03 {:02X} {:02X}\n'.format(lo(section['Id']), hi(section['Id']), lo(symbol['SectionId']), hi(symbol['SectionId'])), 'ascii')) 282 | read_position += 2 283 | elif (patch['PatchType'] == PATCH_JR): 284 | if (len(RPN) != 1): 285 | raise Exception('Unsupported RPN expression in JR patch') 286 | 287 | symbol = obj.Symbols[RPN[0]['SymbolId']] 288 | f.write(bytes('T {:02X} {:02X} 00 {:02X}\n'.format(lo(PC), hi(PC), symbol['Value'] - read_position - 1), 'ascii')) 289 | f.write(bytes('R 00 00 {:02X} {:02X}\n'.format(lo(section['Id']), hi(section['Id'])), 'ascii')) 290 | read_position += 1 291 | else: 292 | raise Exception('Unsupported patch type: {:d} Section: {:s}'.format(patch['PatchType'], section['Name'])) 293 | else: 294 | f.write(bytes('T {:02X} {:02X} 00 {:02X}\n'.format(lo(PC), hi(PC), data[read_position]), 'ascii')) 295 | f.write(bytes('R 00 00 {:02X} {:02X}\n'.format(lo(section['Id']), hi(section['Id'])), 'ascii')) 296 | read_position += 1 297 | 298 | print('RGB2SDAS: object {:s} was successfully converted to {:s}'.format(infilename.name, outfilename.name)) 299 | except Exception as e: 300 | os.remove(str(outfilename)) 301 | raise e 302 | 303 | if __name__=='__main__': 304 | main() 305 | --------------------------------------------------------------------------------