diff --git a/.gitignore b/.gitignore index 8ac76ee..9ca7c32 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ +.vscode/ +gbdk/ Source/obj -mgb.gb +Source/out +mgb.gb \ No newline at end of file diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 1f56146..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "gbdk-n"] - path = gbdk-n - url = https://github.com/trash80/gbdk-n.git diff --git a/README.md b/README.md index 1442c9c..ec96b08 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,22 @@ mGB is a Gameboy cartridge program (You need a Flash Cart and Transfer hardware) ![ScreenShot](http://trash80.net/arduinoboy/mGB1_2_0.png) +## Building mGB + +Follow the [GBDK-2020 instructions](https://github.com/gbdk-2020/gbdk-2020/tree/develop?tab=readme-ov-file#usage) and unzip v4.3.0+ into the `gbdk/` folder. Then run make: + +``` +cd Source + +make # fast compile +make DEBUG=1 # enable debug symbols +make RELEASE=1 # slower compile but faster on device +make clean # clean up the build directories +``` + ## Change Log + * 07/05/24 + * Project updated to build with [GBDK-2020](https://github.com/gbdk-2020/gbdk-2020) v4.3.0 * 06/26/15 * Project has been moved to GitHub along with sourcecode. * 12/21/12 1.3.3 diff --git a/Source/Makefile b/Source/Makefile index b7e1bfb..4792d73 100644 --- a/Source/Makefile +++ b/Source/Makefile @@ -1,22 +1,71 @@ -BIN=../gbdk-n/bin -OBJ=./obj +# If you move this project you can change the directory +# to match your GBDK root directory (ex: GBDK_HOME = "C:/GBDK/" +ifndef GBDK_HOME + GBDK_HOME = ../gbdk +endif +PROJECTNAME = mGB +LCC = $(GBDK_HOME)/bin/lcc -build: - mkdir -p $(OBJ) - $(BIN)/gbdk-n-compile.sh mgb_save.c -o $(OBJ)/mgb_save.rel -Wa-l -ba0 +LCCFLAGS += -msm83:gb # GB/GBC +# LCCFLAGS += -v # verbose +# LCCFLAGS += -autobank + +ifdef DEBUG +LCCFLAGS += -debug -v +endif + +ifdef RELEASE +LCCFLAGS += -Wf--max-allocs-per-node50000 # A better speed optimization than --opt-code-speed +else +LCCFLAGS += -Wf--opt-code-speed # Optimize for code speed rather than size +endif + +# sdcc settings (-Wf and -Wp) +# LCCFLAGS += -Wf--legacy-banking # Use legacy method to call banked functions + +# sdasgb (asm) settings (-Wa) +# LCCFLAGS += -Wa-l # generate asm listing +# LCCFLAGS += -Wa-a # All symbols are global +# LCCFLAGS += -Wa-s # Create symbol file/outfile[.sym] +# LCCFLAGS += -Wa-j # Enable NoICE Debug Symbols +# LCCFLAGS += -Wa-y # Enable SDCC Debug Symbols +# LCCFLAGS += -Wa-g # Undefined symbols are global +# LCCFLAGS += -Wa-n # Don't resolve global assigned value symbols +# LCCFLAGS += -Wa-z # Disable case sensitivity for symbols - $(BIN)/gbdk-n-assemble.sh $(OBJ)/mGBASMFunctions.rel mGBASMFunctions.s - $(BIN)/gbdk-n-assemble.sh $(OBJ)/mGBASMSynthFunctions.rel mGBASMSynthFunctions.s - $(BIN)/gbdk-n-assemble.sh $(OBJ)/mGBASMMidiFunctions.rel mGBASMMidiFunctions.s +# sdldgb (linker) settings (-Wl) +# LCCFLAGS += -Wl-m # Map output generated as (out)file[.map] +# LCCFLAGS += -Wl-j # NoICE Debug output as (out)file[.noi] +# LCCFLAGS += -Wl-w # Wide listing format for map file - $(BIN)/gbdk-n-compile.sh mgb.c -o $(OBJ)/mgb.rel -I ./ -Wa-l -Wl-m -Wl-j +# makebin settings (-Wm) +# LCCFLAGS += -Wm-yS # Convert .noi file named like input file to .sym +LCCFLAGS += -Wm-yc # GBC compatible +LCCFLAGS += -Wm-yn"$(PROJECTNAME)" # cartridge name +LCCFLAGS += -Wm-yt3 # MBC type = ROM+MBC1+RAM+BATT +LCCFLAGS += -Wm-ya1 # number of ram banks: -ya 1 + + +OBJ=obj +OUT=out + +build: + mkdir -p $(OBJ) + mkdir -p $(OUT) + + # mostly so you can see the .asm + $(LCC) $(LCCFLAGS) -c -o $(OBJ)/mGB.rel mGB.c - $(BIN)/gbdk-n-link.sh $(OBJ)/mgb.rel $(OBJ)/mgb_save.rel $(OBJ)/mGBASMFunctions.rel $(OBJ)/mGBASMSynthFunctions.rel $(OBJ)/mGBASMMidiFunctions.rel -o $(OBJ)/mgb.ihx + # SRAM bank 0 + $(LCC) $(LCCFLAGS) -Wf-ba0 -c -o $(OBJ)/mgb_save.rel mgb_save.c + $(LCC) $(LCCFLAGS) -o $(OUT)/$(PROJECTNAME).gb $(OBJ)/mGB.rel $(OBJ)/mgb_save.rel *.s - $(BIN)/gbdk-n-make-rom.sh -ya 1 $(OBJ)/mgb.ihx mgb.gb +compile.bat: Makefile + @echo "REM Automatically generated from Makefile" > compile.bat + @make -sn | sed y/\\//\\\\/ | sed s/mkdir\ \-p/mkdir/ | grep -v make >> compile.bat clean: rm -rf $(OBJ) - rm -f mgb.gb + rm -rf $(OUT) \ No newline at end of file diff --git a/Source/compile.bat b/Source/compile.bat new file mode 100644 index 0000000..de39464 --- /dev/null +++ b/Source/compile.bat @@ -0,0 +1,8 @@ +REM Automatically generated from Makefile +mkdir obj +mkdir out +# -ba 0 probably not needed anymore +..\..\gbdk-4.3.0\bin\lcc -msm83:gb -Wf--opt-code-speed -Wf--legacy-banking -Wm-yc -Wm-yn"mGB" -Wm-yt3 -Wm-ya1 -c -Wb-ba0 -o obj\mgb_save.rel mgb_save.c +# mostly so you can see the .asm +..\..\gbdk-4.3.0\bin\lcc -msm83:gb -Wf--opt-code-speed -Wf--legacy-banking -Wm-yc -Wm-yn"mGB" -Wm-yt3 -Wm-ya1 -c -o obj\mGB.rel mGB.c +..\..\gbdk-4.3.0\bin\lcc -msm83:gb -Wf--opt-code-speed -Wf--legacy-banking -Wm-yc -Wm-yn"mGB" -Wm-yt3 -Wm-ya1 -o out\mGB.gb obj\mGB.rel obj\mgb_save.rel *.s diff --git a/Source/mGB.c b/Source/mGB.c old mode 100755 new mode 100644 index 2d69790..6885018 --- a/Source/mGB.c +++ b/Source/mGB.c @@ -1,88 +1,123 @@ -#include -#include +#include "mGB.h" -void printbyte(UBYTE v1, UBYTE v2, UBYTE v3) -{ - bkg[0] = (v1 >> 4)+1; - bkg[1] = (0x0F & v1)+1; +void printbyte(UBYTE v1, UBYTE v2, UBYTE v3) { + bkg[0] = (v1 >> 4) + 1; + bkg[1] = (0x0F & v1) + 1; - bkg[2] = 0; + bkg[2] = 0; - bkg[3] = (v2 >> 4)+1; - bkg[4] = (0x0F & v2)+1; + bkg[3] = (v2 >> 4) + 1; + bkg[4] = (0x0F & v2) + 1; - bkg[5] = 0; + bkg[5] = 0; - bkg[6] = (v3 >> 4)+1; - bkg[7] = (0x0F & v3)+1; + bkg[6] = (v3 >> 4) + 1; + bkg[7] = (0x0F & v3) + 1; - bkg[8] = 0; - set_bkg_tiles(1,16,10,1,bkg); + bkg[8] = 0; + set_bkg_tiles(1, 16, 10, 1, bkg); } -#include -#include -#include -#include -#include +#include "mGBDisplayFunctions.c" +#include "mGBMemoryFunctions.c" +#include "mGBMidiFunctions.c" +#include "mGBSynthCommonFunctions.c" +#include "mGBSynthPitchFunctions.c" +#include "mGBUserFunctions.c" +#include "serial.c" -void setSoundDefaults() -{ - NR52_REG = 0x8FU; //Turn sound on - NR50_REG = 0x77U; //Turn on Pulses outs +void setSoundDefaults(void) { + rAUDENA = 0x8FU; // Turn sound on + rAUDVOL = 0x77U; // Turn on Pulses outs setOutputPan(0U, 64U); setOutputPan(1U, 64U); setOutputPan(2U, 64U); setOutputPan(3U, 64U); - asmLoadWav(wavDataOffset); //tRIANGLE - NR32_REG = 0x00U; + asmLoadWav(wavDataOffset); // tRIANGLE + rAUD3LEVEL = 0x00U; - NR44_REG = 0x80U; - NR41_REG = 0x3FU; //sound length + rAUD4GO = 0x80U; + rAUD4LEN = 0x3FU; // sound length } -void testSynths() -{ - addressByte = 0x40; - valueByte = 0x7F; - asmPlayNotePu1(); +void testSynths(void) { + addressByte = 0x40; + valueByte = 0x7F; + asmPlayNotePu1(); } +void main(void) { -void main() -{ - disable_interrupts(); - cpu_fast(); - checkMemory(); - displaySetup(); - setSoundDefaults(); - add_TIM(updateSynths); - - loadDataSet(0x00U); - loadDataSet(0x01U); - loadDataSet(0x02U); - loadDataSet(0x03U); - enable_interrupts(); + CRITICAL { + cpu_fast(); + checkMemory(); + displaySetup(); + setSoundDefaults(); + add_TIM(updateSynths); + loadDataSet(0x00U); + loadDataSet(0x01U); + loadDataSet(0x02U); + loadDataSet(0x03U); + } /* Set TMA to divide clock by 0x100 */ - TMA_REG = 0x00U; + rTMA = 0x00U; /* Set clock to 262144 Hertz */ - TAC_REG = 0x05U; + rTAC = TACF_START | TACF_262KHZ; /* Handle VBL and TIM interrupts */ set_interrupts(VBL_IFLAG | TIM_IFLAG | SIO_IFLAG); - SHOW_BKG; - SHOW_SPRITES; + SHOW_BKG; + SHOW_SPRITES; - showSplashScreen(); - delay(2000); + showSplashScreen(); + delay(2000); - showMainScreen(); - printversion(); - //testSynths(); - asmMain(); + showMainScreen(); + printversion(); + // testSynths(); + gameMain(); } + +inline void gameMain(void) { + rSC = SIOF_XFER_START | SIOF_CLOCK_EXT; + while (1) { + systemIdle = 1; + + updateMidiBuffer(); + + if (systemIdle) + getPad(); + + if (systemIdle) + asmUpdatePu1(); + + if (systemIdle) + asmUpdatePu2(); + + if (systemIdle) + asmUpdateWav(); + + if (systemIdle) + asmUpdateNoi(); + + if (systemIdle) + mainScreen(); + } +} + +void mainScreen(void) { + if (currentScreen == 0) { + return; + }; + + updateDisplaySynthCounter = (updateDisplaySynthCounter + 1) & 3U; + + updateDisplaySynth(); + // printbyte(statusByte, addressByte, valueByte); + setPlayMarker(); +} \ No newline at end of file diff --git a/Source/mGB.h b/Source/mGB.h index 862a509..ad4a520 100644 --- a/Source/mGB.h +++ b/Source/mGB.h @@ -1,27 +1,41 @@ +#pragma once + +#include +#include extern UBYTE saveData[513U]; -//extern UBYTE wavData[512U]; -extern UBYTE serialBuffer[256]; -extern UBYTE serialBufferPosition; -extern UBYTE serialBufferReadPosition; +UBYTE serialBuffer[256]; +UBYTE serialBufferPosition; +UBYTE serialBufferReadPosition; +// MIDI status UBYTE statusByte; +// MIDI address (e.g. note/CC control) UBYTE addressByte; +// MIDI value (e.g. velocity/value) UBYTE valueByte; -UBYTE captureDataType; UBYTE capturedAddress; UBYTE updateDisplaySynthCounter; -void asmMain(); -void asmUpdateSerial(); -void asmLoadWav(UBYTE ost); -void asmUpdateMidiBuffer(); -void asmUpdatePu1(); -void asmUpdatePu2(); -void asmUpdateWav(); -void asmUpdateNoi(); -void asmPlayNotePu1(); +void asmLoadWav(UBYTE offset) OLDCALL; +void updateMidiBuffer(void); +void asmUpdatePu1(void); +void asmUpdatePu2(void); +void asmUpdateWav(void); +void asmUpdateNoi(void); +void asmPlayNotePu1(void); +void asmEventMidiPB(void); +void asmEventMidiCC(void); +void asmEventMidiNote(void); +void asmEventMidiNoteOff(void); +void asmEventMidiPC(void); + +inline void gameMain(void); +void mainScreen(void); +void updateVibratoPosition(UBYTE synth); +void updateSynth(UBYTE synth); +void updateValueSynth(UBYTE p); #define PU1 0 #define PU2 1 @@ -29,21 +43,20 @@ void asmPlayNotePu1(); #define NOI 3 #define PU1_CURRENT_STATUS 0 -#define PU1_CURRENT_NOTE 1 +#define PU1_CURRENT_NOTE 1 #define PU2_CURRENT_STATUS 2 -#define PU2_CURRENT_NOTE 3 +#define PU2_CURRENT_NOTE 3 #define WAV_CURRENT_STATUS 4 -#define WAV_CURRENT_NOTE 5 +#define WAV_CURRENT_NOTE 5 #define NOI_CURRENT_STATUS 6 -#define NOI_CURRENT_NOTE 7 - -#define PBWHEEL_CENTER 0x80 +#define NOI_CURRENT_NOTE 7 +#define PBWHEEL_CENTER 0x80 -#define RGB_LIGHT RGB( 23, 29, 31) -#define RGB_DARK RGB( 0, 0, 2) -#define RGB_HAWT RGB( 31, 5, 31) -#define RGB_HAWTBLU RGB( 0, 15, 31) +#define RGB_LIGHT RGB(23, 29, 31) +#define RGB_DARK RGB(0, 0, 2) +#define RGB_HAWT RGB(31, 5, 31) +#define RGB_HAWTBLU RGB(0, 15, 31) #define SPRITE_ARRL 0x79 #define SPRITE_ARRT 0x80 #define SPRITE_ARRT_START 26 @@ -51,24 +64,22 @@ void asmPlayNotePu1(); #define SPRITE_PUFREQ_LOW 1 UWORD freq[72] = { - 44, 156, 262, 363, 457, 547, 631, 710, 786, 854, 923, 986, - 1046, 1102, 1155, 1205, 1253, 1297, 1339, 1379, 1417, 1452, 1486, 1517, - 1546, 1575, 1602, 1627, 1650, 1673, 1694, 1714, 1732, 1750, 1767, 1783, - 1798, 1812, 1825, 1837, 1849, 1860, 1871, 1881, 1890, 1899, 1907, 1915, - 1923, 1930, 1936, 1943, 1949, 1954, 1959, 1964, 1969, 1974, 1978, 1982, - 1985, 1988, 1992, 1995, 1998, 2001, 2004, 2006, 2009, 2011, 2013, 2015 -}; + 44, 156, 262, 363, 457, 547, 631, 710, 786, 854, 923, 986, + 1046, 1102, 1155, 1205, 1253, 1297, 1339, 1379, 1417, 1452, 1486, 1517, + 1546, 1575, 1602, 1627, 1650, 1673, 1694, 1714, 1732, 1750, 1767, 1783, + 1798, 1812, 1825, 1837, 1849, 1860, 1871, 1881, 1890, 1899, 1907, 1915, + 1923, 1930, 1936, 1943, 1949, 1954, 1959, 1964, 1969, 1974, 1978, 1982, + 1985, 1988, 1992, 1995, 1998, 2001, 2004, 2006, 2009, 2011, 2013, 2015}; UBYTE noteStatus[8]; UBYTE noiFreq[72] = { -0x94,0x87,0x86,0x85,0x84,0x77,0x76,0x75,0x74,0x67,0x66,0x65, -0x64,0x57,0x56,0x55,0x54,0x47,0x46,0x45,0x44,0x37,0x36,0x35, -0x34,0x27,0x26,0x25,0x24,0x17,0x16,0x15,0x14,0x07,0x06,0x00, -0x9C,0x8F,0x8E,0x8D,0x8C,0x7F,0x7E,0x7D,0x7C,0x6F,0x6E,0x6D, -0x6C,0x5F,0x5E,0x5D,0x5C,0x4F,0x4E,0x4D,0x4C,0x3F,0x3E,0x3D, -0x3C,0x2F,0x2E,0x2D,0x2C,0x1F,0x1E,0x1D,0x1C,0x0F,0x0E,0x08 -}; + 0x94, 0x87, 0x86, 0x85, 0x84, 0x77, 0x76, 0x75, 0x74, 0x67, 0x66, 0x65, + 0x64, 0x57, 0x56, 0x55, 0x54, 0x47, 0x46, 0x45, 0x44, 0x37, 0x36, 0x35, + 0x34, 0x27, 0x26, 0x25, 0x24, 0x17, 0x16, 0x15, 0x14, 0x07, 0x06, 0x00, + 0x9C, 0x8F, 0x8E, 0x8D, 0x8C, 0x7F, 0x7E, 0x7D, 0x7C, 0x6F, 0x6E, 0x6D, + 0x6C, 0x5F, 0x5E, 0x5D, 0x5C, 0x4F, 0x4E, 0x4D, 0x4C, 0x3F, 0x3E, 0x3D, + 0x3C, 0x2F, 0x2E, 0x2D, 0x2C, 0x1F, 0x1E, 0x1D, 0x1C, 0x0F, 0x0E, 0x08}; UBYTE pu1Env; UBYTE pu2Env; @@ -94,110 +105,75 @@ BOOLEAN pu2Sus; BOOLEAN noiSus; BOOLEAN wavSus; -UBYTE outputSwitch[4] = {0x01,0x02,0x40,0x80}; -UBYTE outputSwitchMute[4] = {0x01,0x02,0x40,0x80}; -UBYTE outputSwitchValue[4] = {3,3,3,3}; - +UBYTE outputSwitch[4] = {0x01, 0x02, 0x40, 0x80}; +UBYTE outputSwitchMute[4] = {0x01, 0x02, 0x40, 0x80}; +UBYTE outputSwitchValue[4] = {3, 3, 3, 3}; UBYTE counterWavStart; UBYTE wavShapeLast; UBYTE wavDataOffset; -UBYTE pbWheelIn[4] = {0x80,0x80,0x80,0x80}; -UBYTE pbWheelInLast[4] = {0x80,0x80,0x80,0x80}; -BOOLEAN pbWheelActive[4] = {0x00,0x00,0x00,0x00}; -UBYTE pbRange[4] = {2,2,2,12}; -UBYTE pbNoteRange[8] = {0,0,0,0,0,0,0,0}; +UBYTE pbWheelIn[4] = {0x80, 0x80, 0x80, 0x80}; +UBYTE pbWheelInLast[4] = {0x80, 0x80, 0x80, 0x80}; +BOOLEAN pbWheelActive[4] = {0x00, 0x00, 0x00, 0x00}; +UBYTE pbRange[4] = {2, 2, 2, 12}; +UBYTE pbNoteRange[8] = {0, 0, 0, 0, 0, 0, 0, 0}; UWORD currentFreq; UINT8 i; UINT8 x; UBYTE j; UBYTE l; UINT8 lastPadRead; -BOOLEAN joyState[8] = {0,0,0,0,0,0,0,0}; +BOOLEAN joyState[8] = {0, 0, 0, 0, 0, 0, 0, 0}; UBYTE wavSweepSpeed; UWORD wavCurrentFreq; UWORD currentFreqData[4]; -const UBYTE wavData[256] = { - 0x01,0x23,0x45,0x67, - 0x89,0xAB,0xCD,0xEF, - 0xFE,0xDC,0xBA,0x98, - 0x76,0x54,0x32,0x10, - - 0x22,0x55,0x77,0xAA, - 0xBB,0xDD,0xEE,0xFF, - 0xEE,0xDD,0xBB,0xAA, - 0x77,0x66,0x44,0x00, - - 0x01,0x23,0x45,0x67, - 0x89,0xAB,0xCD,0xEF, - 0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00, - - 0xFF,0xEE,0xDD,0xCC, - 0xBB,0xAA,0x99,0x88, - 0x77,0x66,0x55,0x44, - 0x33,0x22,0x11,0x00, - - 0xFF,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00, - - 0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00, - 0xFF,0xFF,0x00,0x00, - - 0xFF,0xFF,0xFF,0xFF, - 0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00, - - 0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00, - 0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF, - - 0x16,0x13,0xAA,0xB3, - 0x25,0x81,0xE8,0x2A, - 0x1B,0xEB,0xF8,0x85, - 0xE1,0x28,0xFF,0xA4, - - 0x34,0x09,0x91,0xA7, - 0x63,0xB8,0x99,0xA1, - 0x3F,0xE4,0xD0,0x61, - 0x66,0x73,0x59,0x7C, - - 0x86,0x04,0x2F,0xAC, - 0x85,0x17,0xD6,0xA1, - 0x03,0xCF,0x27,0xE4, - 0xF8,0x27,0x89,0x2C, - - 0x30,0x1B,0xD4,0x93, - 0xD3,0x6E,0x35,0x13, - 0x53,0x05,0x75,0xB9, - 0x79,0xCF,0x36,0x00, - - 0xD4,0x2C,0xC6,0x4E, - 0x2C,0x12,0xE2,0x15, - 0x8B,0xAF,0x3D,0xEF, - 0x6E,0xF1,0xBF,0xD9, - - 0x43,0x17,0x2B,0xF3, - 0x12,0xC2,0xCB,0x8C, - 0x3B,0x43,0xF2,0xDF, - 0x5D,0xF9,0xEF,0x31, - - 0x6D,0x46,0xF6,0x7A, - 0xEE,0x17,0x35,0xF4, - 0xDA,0xFE,0x7C,0x28, - 0xB8,0x55,0x12,0x57, - - 0xFF,0x82,0xBB,0x85, - 0xEF,0xD4,0x7C,0xA1, - 0x05,0xB4,0xFF,0xC1, - 0x95,0x27,0x30,0x03 -}; +const UBYTE wavData[256] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, + 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10, + + 0x22, 0x55, 0x77, 0xAA, 0xBB, 0xDD, 0xEE, 0xFF, + 0xEE, 0xDD, 0xBB, 0xAA, 0x77, 0x66, 0x44, 0x00, + + 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + 0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88, + 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00, + + 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, + + 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + + 0x16, 0x13, 0xAA, 0xB3, 0x25, 0x81, 0xE8, 0x2A, + 0x1B, 0xEB, 0xF8, 0x85, 0xE1, 0x28, 0xFF, 0xA4, + + 0x34, 0x09, 0x91, 0xA7, 0x63, 0xB8, 0x99, 0xA1, + 0x3F, 0xE4, 0xD0, 0x61, 0x66, 0x73, 0x59, 0x7C, + + 0x86, 0x04, 0x2F, 0xAC, 0x85, 0x17, 0xD6, 0xA1, + 0x03, 0xCF, 0x27, 0xE4, 0xF8, 0x27, 0x89, 0x2C, + + 0x30, 0x1B, 0xD4, 0x93, 0xD3, 0x6E, 0x35, 0x13, + 0x53, 0x05, 0x75, 0xB9, 0x79, 0xCF, 0x36, 0x00, + + 0xD4, 0x2C, 0xC6, 0x4E, 0x2C, 0x12, 0xE2, 0x15, + 0x8B, 0xAF, 0x3D, 0xEF, 0x6E, 0xF1, 0xBF, 0xD9, + + 0x43, 0x17, 0x2B, 0xF3, 0x12, 0xC2, 0xCB, 0x8C, + 0x3B, 0x43, 0xF2, 0xDF, 0x5D, 0xF9, 0xEF, 0x31, + + 0x6D, 0x46, 0xF6, 0x7A, 0xEE, 0x17, 0x35, 0xF4, + 0xDA, 0xFE, 0x7C, 0x28, 0xB8, 0x55, 0x12, 0x57, + + 0xFF, 0x82, 0xBB, 0x85, 0xEF, 0xD4, 0x7C, 0xA1, + 0x05, 0xB4, 0xFF, 0xC1, 0x95, 0x27, 0x30, 0x03}; INT8 pu1Oct; INT8 pu2Oct; @@ -208,266 +184,180 @@ UINT16 counterWav; BOOLEAN cueWavSweep; -const unsigned char data_barrow[16] = -{ - 0x00,0x00,0xE7,0xE7,0x7E,0x7E,0x3C,0x3C, - 0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00 +const unsigned char data_barrow[16] = {0x00, 0x00, 0xE7, 0xE7, 0x7E, 0x7E, + 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00}; + +const unsigned char data_larrow[] = {0xC0, 0xC0, 0xE0, 0xE0, 0x70, 0x70, + 0xE0, 0xE0, 0xC0, 0xC0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00}; + +const unsigned char data_font[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFC, 0xC6, 0xC6, 0xE6, 0xE6, 0xD6, 0xD6, + 0xCE, 0xCE, 0xC6, 0xC6, 0x7E, 0x7E, 0x00, 0x00, 0x38, 0x38, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x08, 0x08, 0x00, 0x00, + 0xFC, 0xFC, 0x06, 0x06, 0x06, 0x06, 0xFE, 0xFE, 0xC0, 0xC0, 0xC0, 0xC0, + 0x7C, 0x7C, 0x00, 0x00, 0xFC, 0xFC, 0x06, 0x06, 0x06, 0x06, 0x3E, 0x3E, + 0x06, 0x06, 0x06, 0x06, 0xFC, 0xFC, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, + 0xC6, 0xC6, 0x7E, 0x7E, 0x06, 0x06, 0x06, 0x06, 0x02, 0x02, 0x00, 0x00, + 0xFE, 0xFE, 0xC0, 0xC0, 0xC0, 0xC0, 0xFE, 0xFE, 0x06, 0x06, 0x06, 0x06, + 0xFE, 0xFE, 0x00, 0x00, 0x7E, 0x7E, 0xC0, 0xC0, 0xFE, 0xFE, 0xC6, 0xC6, + 0xC6, 0xC6, 0xC6, 0xC6, 0xFC, 0xFC, 0x00, 0x00, 0xFE, 0xFE, 0x06, 0x06, + 0x0E, 0x0E, 0x1C, 0x1C, 0x18, 0x18, 0x18, 0x18, 0x08, 0x08, 0x00, 0x00, + 0xFC, 0xFC, 0xC6, 0xC6, 0xC6, 0xC6, 0xFE, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, + 0x7E, 0x7E, 0x00, 0x00, 0xFC, 0xFC, 0xC6, 0xC6, 0xC6, 0xC6, 0xFE, 0xFE, + 0x06, 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x00, 0x00, 0x7E, 0x7E, 0xC6, 0xC6, + 0xFE, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x82, 0x82, 0x00, 0x00, + 0xFC, 0xFC, 0xC6, 0xC6, 0xFC, 0xFC, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, + 0xFC, 0xFC, 0x00, 0x00, 0x7E, 0x7E, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, + 0xC0, 0xC0, 0xC0, 0xC0, 0x7E, 0x7E, 0x00, 0x00, 0xF8, 0xF8, 0xC6, 0xC6, + 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xF8, 0xF8, 0x00, 0x00, + 0x7E, 0x7E, 0xC0, 0xC0, 0xC0, 0xC0, 0xF8, 0xF8, 0xC0, 0xC0, 0xC0, 0xC0, + 0x7E, 0x7E, 0x00, 0x00, 0x7E, 0x7E, 0xC0, 0xC0, 0xC0, 0xC0, 0xF8, 0xF8, + 0xC0, 0xC0, 0xC0, 0xC0, 0x40, 0x40, 0x00, 0x00, 0x7C, 0x7C, 0xC0, 0xC0, + 0xCE, 0xCE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x7C, 0x00, 0x00, + 0xC4, 0xC4, 0xC6, 0xC6, 0xFE, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, + 0x46, 0x46, 0x00, 0x00, 0xFE, 0xFE, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0xFE, 0xFE, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0xFC, 0xFC, 0x00, 0x00, + 0xC6, 0xC6, 0xCC, 0xCC, 0xF8, 0xF8, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, + 0x46, 0x46, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, + 0xC0, 0xC0, 0xC0, 0xC0, 0x7E, 0x7E, 0x00, 0x00, 0xC6, 0xC6, 0xEE, 0xEE, + 0xD6, 0xD6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x82, 0x82, 0x00, 0x00, + 0xFC, 0xFC, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, + 0x82, 0x82, 0x00, 0x00, 0x7C, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, + 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x7C, 0x00, 0x00, 0x7E, 0x7E, 0xC6, 0xC6, + 0xC6, 0xC6, 0xC6, 0xC6, 0xFC, 0xFC, 0xC0, 0xC0, 0x40, 0x40, 0x00, 0x00, + 0x7E, 0x7E, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x7E, 0x06, 0x06, + 0x06, 0x06, 0x00, 0x00, 0xFE, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xF8, 0xF8, + 0xC6, 0xC6, 0xC6, 0xC6, 0x46, 0x46, 0x00, 0x00, 0x7E, 0x7E, 0xC0, 0xC0, + 0xC0, 0xC0, 0x7C, 0x7C, 0x06, 0x06, 0x06, 0x06, 0xFC, 0xFC, 0x00, 0x00, + 0xFE, 0xFE, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x08, 0x08, 0x00, 0x00, 0x46, 0x46, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, + 0xC6, 0xC6, 0xC6, 0xC6, 0xFC, 0xFC, 0x00, 0x00, 0x82, 0x82, 0xC6, 0xC6, + 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x6C, 0x6C, 0x10, 0x10, 0x00, 0x00, + 0x82, 0x82, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xD6, 0xEE, 0xEE, + 0x44, 0x44, 0x00, 0x00, 0xC6, 0xC6, 0xEE, 0xEE, 0x6C, 0x6C, 0x38, 0x38, + 0x6C, 0x6C, 0xEE, 0xEE, 0xC6, 0xC6, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, + 0xC6, 0xC6, 0x7E, 0x7E, 0x0C, 0x0C, 0x18, 0x18, 0x30, 0x30, 0x00, 0x00, + 0xFE, 0xFE, 0x0E, 0x0E, 0x1C, 0x1C, 0x38, 0x38, 0x70, 0x70, 0xE0, 0xE0, + 0xFE, 0xFE, 0x00, 0x00, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, + 0x28, 0x28, 0x44, 0x44, 0x82, 0x82, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, + 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x08, 0x14, 0x14, 0x22, 0x22, 0x41, 0x41, 0x80, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x24, 0x24, 0x24, 0x24, 0x42, 0x42, + 0x81, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x14, 0x14, + 0x24, 0x24, 0x44, 0x44, 0x87, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x03, 0x0D, 0x0D, 0x31, 0x31, 0xC1, 0xC1, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7F, 0x7F, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xE0, 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3F, 0x3F, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFC, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x90, 0x90, 0x0D, 0x0D, 0x42, 0x42, 0xA9, 0xA9, 0x04, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0xFF, 0xFF, 0x7F, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0xC0, 0xC0, 0xFF, 0xFF, 0x7F, 0x7F, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0xC0, 0xC0, 0xE0, 0xE0, 0xFF, 0xFF, + 0x7F, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xC0, 0xC0, 0xE0, 0xE0, + 0xF0, 0xF0, 0xFF, 0xFF, 0x7F, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, + 0xF0, 0xF0, 0xF8, 0xF8, 0xFC, 0xFC, 0xFF, 0xFF, 0x7F, 0x7F, 0x00, 0x00, + 0x00, 0x00, 0xF0, 0xF0, 0xF8, 0xF8, 0xFC, 0xFC, 0xFE, 0xFE, 0xFF, 0xFF, + 0x7F, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFC, 0xFE, 0xFE, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x7F, 0x00, 0x00, + 0x00, 0x00, 0x3F, 0x3F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x3F, 0x3F, 0x7F, 0x7F, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, + 0x3F, 0x3F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0x00, 0x00, + 0x00, 0x00, 0x07, 0x07, 0x1F, 0x1F, 0x3F, 0x3F, 0x7F, 0x7F, 0xFF, 0xFF, + 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x0F, 0x0F, 0x3F, 0x3F, + 0x7F, 0x7F, 0xFF, 0xFF, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, + 0x03, 0x03, 0x0F, 0x0F, 0x3F, 0x3F, 0xFF, 0xFF, 0xFE, 0xFE, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x07, 0x07, 0x1F, 0x1F, 0xFF, 0xFF, + 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x38, 0x38, + 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x6C, 0x6C, 0x38, 0x38, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x70, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, + 0x00, 0x08, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x06, 0x00, 0x06, 0x00, 0xFE, + 0x00, 0xC0, 0x00, 0xC0, 0x00, 0x7E, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x06, + 0x00, 0x06, 0x00, 0x3E, 0x00, 0x06, 0x00, 0x06, 0x00, 0xFC, 0x00, 0x00, + 0x00, 0xC6, 0x00, 0xC6, 0x00, 0xC6, 0x00, 0x7E, 0x00, 0x06, 0x00, 0x06, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0xF3, 0xF3, 0xAB, 0xAB, + 0xAB, 0xAB, 0x89, 0x89, 0x04, 0x04, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, + 0x00, 0x00, 0xEF, 0xEF, 0x0C, 0x0C, 0x7F, 0x7F, 0x0C, 0x0C, 0xFF, 0xFF, + 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x20, 0x20, 0x90, 0x90, + 0xD1, 0xD1, 0xD1, 0xD1, 0xD0, 0xD0, 0x90, 0x90, 0x20, 0x20, 0xC0, 0xC0, + 0x00, 0x00, 0x00, 0x00, 0xB4, 0xB4, 0xF7, 0xF7, 0xE4, 0xE4, 0x44, 0x44, + 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x76, 0x55, 0x55, + 0x67, 0x67, 0x55, 0x55, 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x75, 0x75, 0x45, 0x45, 0x77, 0x77, 0x15, 0x15, 0x31, 0x31, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x05, 0x05, 0x77, 0x77, 0x05, 0x05, + 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x70, 0x50, 0x50, + 0x50, 0x50, 0x50, 0x50, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, + 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x70, 0x70, 0xF8, 0xF8, 0xF8, 0xF8, + 0xF8, 0xF8, 0x70, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x50, 0x50, 0x20, 0x20, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0xF0, 0x00, 0xF0, 0x00, 0xF0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x0F, + 0x00, 0x0F, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0xF0, + 0x00, 0xF0, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0F, 0x00, 0x0F, 0x00, 0x0F, 0x00, 0x0F, 0x00, 0xFF, 0x00, 0xFF, + 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, + 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD8, 0x00, 0x70, + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +const unsigned char versionnumber[10] = {32, 81, 2, 81, 4, 81, 4, 0, 0, 0}; + +const UBYTE helpdata[10][18] = { + {25, 13, 30, 11, 32, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {33, 11, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 13, 1, 2}, + {15, 24, 32, 15, 22, 25, 26, 15, 0, 0, 0, 0, 0, 0, 13, 13, 1, 3}, + {29, 33, 15, 15, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 13, 1, 4}, + {26, 12, 0, 28, 11, 24, 17, 15, 0, 0, 0, 0, 0, 0, 13, 13, 1, 5}, + {29, 31, 29, 30, 11, 19, 24, 0, 0, 0, 0, 0, 0, 0, 13, 13, 7, 5}, + {26, 11, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 13, 2, 1}, + {26, 28, 15, 29, 15, 30, 0, 0, 0, 0, 0, 0, 0, 0, 13, 13, 1, 6}, + {33, 11, 32, 0, 25, 16, 16, 29, 15, 30, 0, 0, 0, 0, 13, 13, 1, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, }; -const unsigned char data_larrow[] = -{ - 0xC0,0xC0,0xE0,0xE0,0x70,0x70,0xE0,0xE0, - 0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00 -}; - -const unsigned char data_font[] = -{ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0xFC,0xFC,0xC6,0xC6,0xE6,0xE6,0xD6,0xD6, - 0xCE,0xCE,0xC6,0xC6,0x7E,0x7E,0x00,0x00, - 0x38,0x38,0x18,0x18,0x18,0x18,0x18,0x18, - 0x18,0x18,0x18,0x18,0x08,0x08,0x00,0x00, - 0xFC,0xFC,0x06,0x06,0x06,0x06,0xFE,0xFE, - 0xC0,0xC0,0xC0,0xC0,0x7C,0x7C,0x00,0x00, - 0xFC,0xFC,0x06,0x06,0x06,0x06,0x3E,0x3E, - 0x06,0x06,0x06,0x06,0xFC,0xFC,0x00,0x00, - 0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x7E, - 0x06,0x06,0x06,0x06,0x02,0x02,0x00,0x00, - 0xFE,0xFE,0xC0,0xC0,0xC0,0xC0,0xFE,0xFE, - 0x06,0x06,0x06,0x06,0xFE,0xFE,0x00,0x00, - 0x7E,0x7E,0xC0,0xC0,0xFE,0xFE,0xC6,0xC6, - 0xC6,0xC6,0xC6,0xC6,0xFC,0xFC,0x00,0x00, - 0xFE,0xFE,0x06,0x06,0x0E,0x0E,0x1C,0x1C, - 0x18,0x18,0x18,0x18,0x08,0x08,0x00,0x00, - 0xFC,0xFC,0xC6,0xC6,0xC6,0xC6,0xFE,0xFE, - 0xC6,0xC6,0xC6,0xC6,0x7E,0x7E,0x00,0x00, - 0xFC,0xFC,0xC6,0xC6,0xC6,0xC6,0xFE,0xFE, - 0x06,0x06,0x06,0x06,0x0C,0x0C,0x00,0x00, - 0x7E,0x7E,0xC6,0xC6,0xFE,0xFE,0xC6,0xC6, - 0xC6,0xC6,0xC6,0xC6,0x82,0x82,0x00,0x00, - 0xFC,0xFC,0xC6,0xC6,0xFC,0xFC,0xC6,0xC6, - 0xC6,0xC6,0xC6,0xC6,0xFC,0xFC,0x00,0x00, - 0x7E,0x7E,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0, - 0xC0,0xC0,0xC0,0xC0,0x7E,0x7E,0x00,0x00, - 0xF8,0xF8,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6, - 0xC6,0xC6,0xC6,0xC6,0xF8,0xF8,0x00,0x00, - 0x7E,0x7E,0xC0,0xC0,0xC0,0xC0,0xF8,0xF8, - 0xC0,0xC0,0xC0,0xC0,0x7E,0x7E,0x00,0x00, - 0x7E,0x7E,0xC0,0xC0,0xC0,0xC0,0xF8,0xF8, - 0xC0,0xC0,0xC0,0xC0,0x40,0x40,0x00,0x00, - 0x7C,0x7C,0xC0,0xC0,0xCE,0xCE,0xC6,0xC6, - 0xC6,0xC6,0xC6,0xC6,0x7C,0x7C,0x00,0x00, - 0xC4,0xC4,0xC6,0xC6,0xFE,0xFE,0xC6,0xC6, - 0xC6,0xC6,0xC6,0xC6,0x46,0x46,0x00,0x00, - 0xFE,0xFE,0x30,0x30,0x30,0x30,0x30,0x30, - 0x30,0x30,0x30,0x30,0xFE,0xFE,0x00,0x00, - 0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06, - 0x06,0x06,0x06,0x06,0xFC,0xFC,0x00,0x00, - 0xC6,0xC6,0xCC,0xCC,0xF8,0xF8,0xC6,0xC6, - 0xC6,0xC6,0xC6,0xC6,0x46,0x46,0x00,0x00, - 0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0, - 0xC0,0xC0,0xC0,0xC0,0x7E,0x7E,0x00,0x00, - 0xC6,0xC6,0xEE,0xEE,0xD6,0xD6,0xC6,0xC6, - 0xC6,0xC6,0xC6,0xC6,0x82,0x82,0x00,0x00, - 0xFC,0xFC,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6, - 0xC6,0xC6,0xC6,0xC6,0x82,0x82,0x00,0x00, - 0x7C,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6, - 0xC6,0xC6,0xC6,0xC6,0x7C,0x7C,0x00,0x00, - 0x7E,0x7E,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6, - 0xFC,0xFC,0xC0,0xC0,0x40,0x40,0x00,0x00, - 0x7E,0x7E,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6, - 0x7E,0x7E,0x06,0x06,0x06,0x06,0x00,0x00, - 0xFE,0xFE,0xC6,0xC6,0xC6,0xC6,0xF8,0xF8, - 0xC6,0xC6,0xC6,0xC6,0x46,0x46,0x00,0x00, - 0x7E,0x7E,0xC0,0xC0,0xC0,0xC0,0x7C,0x7C, - 0x06,0x06,0x06,0x06,0xFC,0xFC,0x00,0x00, - 0xFE,0xFE,0x18,0x18,0x18,0x18,0x18,0x18, - 0x18,0x18,0x18,0x18,0x08,0x08,0x00,0x00, - 0x46,0x46,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6, - 0xC6,0xC6,0xC6,0xC6,0xFC,0xFC,0x00,0x00, - 0x82,0x82,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6, - 0xC6,0xC6,0x6C,0x6C,0x10,0x10,0x00,0x00, - 0x82,0x82,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6, - 0xD6,0xD6,0xEE,0xEE,0x44,0x44,0x00,0x00, - 0xC6,0xC6,0xEE,0xEE,0x6C,0x6C,0x38,0x38, - 0x6C,0x6C,0xEE,0xEE,0xC6,0xC6,0x00,0x00, - 0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x7E, - 0x0C,0x0C,0x18,0x18,0x30,0x30,0x00,0x00, - 0xFE,0xFE,0x0E,0x0E,0x1C,0x1C,0x38,0x38, - 0x70,0x70,0xE0,0xE0,0xFE,0xFE,0x00,0x00, - 0x82,0x82,0x44,0x44,0x28,0x28,0x10,0x10, - 0x28,0x28,0x44,0x44,0x82,0x82,0x00,0x00, - 0x00,0x00,0x38,0x38,0x7C,0x7C,0x7C,0x7C, - 0x7C,0x7C,0x38,0x38,0x00,0x00,0x00,0x00, - 0x08,0x08,0x14,0x14,0x22,0x22,0x41,0x41, - 0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 0x18,0x18,0x24,0x24,0x24,0x24,0x42,0x42, - 0x81,0x81,0x00,0x00,0x00,0x00,0x00,0x00, - 0x0C,0x0C,0x14,0x14,0x24,0x24,0x44,0x44, - 0x87,0x87,0x00,0x00,0x00,0x00,0x00,0x00, - 0x03,0x03,0x0D,0x0D,0x31,0x31,0xC1,0xC1, - 0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80, - 0x80,0x80,0xFF,0xFF,0x00,0x00,0x00,0x00, - 0x00,0x00,0xC0,0xC0,0x40,0x40,0x40,0x40, - 0x40,0x40,0x7F,0x7F,0x00,0x00,0x00,0x00, - 0x00,0x00,0xE0,0xE0,0x20,0x20,0x20,0x20, - 0x20,0x20,0x3F,0x3F,0x00,0x00,0x00,0x00, - 0x00,0x00,0xF0,0xF0,0x10,0x10,0x10,0x10, - 0x10,0x10,0x1F,0x1F,0x00,0x00,0x00,0x00, - 0x00,0x00,0xFC,0xFC,0x04,0x04,0x04,0x04, - 0x04,0x04,0x07,0x07,0x00,0x00,0x00,0x00, - 0x00,0x00,0x90,0x90,0x0D,0x0D,0x42,0x42, - 0xA9,0xA9,0x04,0x04,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80, - 0x80,0x80,0xFF,0xFF,0x7F,0x7F,0x00,0x00, - 0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80, - 0xC0,0xC0,0xFF,0xFF,0x7F,0x7F,0x00,0x00, - 0x00,0x00,0x80,0x80,0x80,0x80,0xC0,0xC0, - 0xE0,0xE0,0xFF,0xFF,0x7F,0x7F,0x00,0x00, - 0x00,0x00,0x80,0x80,0xC0,0xC0,0xE0,0xE0, - 0xF0,0xF0,0xFF,0xFF,0x7F,0x7F,0x00,0x00, - 0x00,0x00,0xC0,0xC0,0xF0,0xF0,0xF8,0xF8, - 0xFC,0xFC,0xFF,0xFF,0x7F,0x7F,0x00,0x00, - 0x00,0x00,0xF0,0xF0,0xF8,0xF8,0xFC,0xFC, - 0xFE,0xFE,0xFF,0xFF,0x7F,0x7F,0x00,0x00, - 0x00,0x00,0xFC,0xFC,0xFE,0xFE,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0x7F,0x7F,0x00,0x00, - 0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0x7F,0x7F,0x00,0x00, - 0x00,0x00,0x3F,0x3F,0x7F,0x7F,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0x00,0x00, - 0x00,0x00,0x1F,0x1F,0x3F,0x3F,0x7F,0x7F, - 0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0x00,0x00, - 0x00,0x00,0x0F,0x0F,0x3F,0x3F,0x7F,0x7F, - 0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0x00,0x00, - 0x00,0x00,0x07,0x07,0x1F,0x1F,0x3F,0x3F, - 0x7F,0x7F,0xFF,0xFF,0xFE,0xFE,0x00,0x00, - 0x00,0x00,0x03,0x03,0x0F,0x0F,0x3F,0x3F, - 0x7F,0x7F,0xFF,0xFF,0xFE,0xFE,0x00,0x00, - 0x00,0x00,0x01,0x01,0x03,0x03,0x0F,0x0F, - 0x3F,0x3F,0xFF,0xFF,0xFE,0xFE,0x00,0x00, - 0x00,0x00,0x01,0x01,0x01,0x01,0x07,0x07, - 0x1F,0x1F,0xFF,0xFF,0xFE,0xFE,0x00,0x00, - 0x00,0x00,0x00,0x00,0x10,0x10,0x38,0x38, - 0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x6C,0x6C,0x38,0x38, - 0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x70,0x00,0x18,0x00,0x18,0x00,0x18, - 0x00,0x18,0x00,0x18,0x00,0x08,0x00,0x00, - 0x00,0xFC,0x00,0x06,0x00,0x06,0x00,0xFE, - 0x00,0xC0,0x00,0xC0,0x00,0x7E,0x00,0x00, - 0x00,0xFC,0x00,0x06,0x00,0x06,0x00,0x3E, - 0x00,0x06,0x00,0x06,0x00,0xFC,0x00,0x00, - 0x00,0xC6,0x00,0xC6,0x00,0xC6,0x00,0x7E, - 0x00,0x06,0x00,0x06,0x00,0x02,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x03,0x03,0x04,0x04,0x05,0x05, - 0xF3,0xF3,0xAB,0xAB,0xAB,0xAB,0x89,0x89, - 0x04,0x04,0x03,0x03,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0xFF,0xFF,0x00,0x00,0xEF,0xEF, - 0x0C,0x0C,0x7F,0x7F,0x0C,0x0C,0xFF,0xFF, - 0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0xC0,0xC0,0x20,0x20,0x90,0x90, - 0xD1,0xD1,0xD1,0xD1,0xD0,0xD0,0x90,0x90, - 0x20,0x20,0xC0,0xC0,0x00,0x00,0x00,0x00, - 0xB4,0xB4,0xF7,0xF7,0xE4,0xE4,0x44,0x44, - 0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00, - 0x76,0x76,0x55,0x55,0x67,0x67,0x55,0x55, - 0x11,0x11,0x00,0x00,0x00,0x00,0x00,0x00, - 0x75,0x75,0x45,0x45,0x77,0x77,0x15,0x15, - 0x31,0x31,0x00,0x00,0x00,0x00,0x00,0x00, - 0x77,0x77,0x05,0x05,0x77,0x77,0x05,0x05, - 0x77,0x77,0x00,0x00,0x00,0x00,0x00,0x00, - 0x70,0x70,0x50,0x50,0x50,0x50,0x50,0x50, - 0x30,0x30,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x18,0x18,0x18,0x18,0x00,0x00, - 0x00,0x00,0x70,0x70,0xF8,0xF8,0xF8,0xF8, - 0xF8,0xF8,0x70,0x70,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x50,0x50,0x20,0x20, - 0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0xF0,0x00,0xF0,0x00,0xF0,0x00,0xF0, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0xF0,0x00,0xF0,0x00,0xF0,0x00,0xF0, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F, - 0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF, - 0x00,0x00,0x00,0x00,0x00,0xD8,0x00,0x70, - 0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00 -}; - -const unsigned char versionnumber[10] = -{ - 32,81, - 2,81, - 4,81, - 4, - 0,0,0 -}; +const UBYTE helpmap[4][9] = {{0, 1, 2, 3, 4, 5, 6, 9, 7}, + {0, 1, 2, 9, 4, 5, 6, 9, 7}, + {0, 1, 8, 3, 4, 5, 6, 9, 7}, + {0, 9, 2, 9, 9, 5, 6, 9, 7}}; -const UBYTE helpdata[10][18] = -{ - {25,13,30,11,32,15,0,0,0,0, 0,0,0,0,0,0,0,0}, - {33,11,32,0,0,0,0,0,0,0, 0,0,0,0,13,13,1,2}, - {15,24,32,15,22,25,26,15,0,0,0,0,0,0,13,13,1,3}, - {29,33,15,15,26,0,0,0,0,0, 0,0,0,0,13,13,1,4}, - {26,12,0,28,11,24,17,15,0,0, 0,0,0,0,13,13,1,5}, - {29,31,29,30,11,19,24,0,0,0, 0,0,0,0,13,13,7,5}, - {26,11,24,0,0,0,0,0,0,0, 0,0,0,0,13,13,2,1}, - {26,28,15,29,15,30,0,0,0,0, 0,0,0,0,13,13,1,6}, - {33,11,32,0,25,16,16,29,15,30, 0,0,0,0,13,13,1,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, -}; - -const UBYTE helpmap[4][9] = -{ - {0,1,2,3,4,5,6,9,7}, - {0,1,2,9,4,5,6,9,7}, - {0,1,8,3,4,5,6,9,7}, - {0,9,2,9,9,5,6,9,7} -}; +UBYTE bkg[20] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -UBYTE bkg[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - -const UBYTE logo[] = -{ - 70,72,74, 0, 0, 0, 0, 0, - 71,73,75,76,77,78,79,80 -}; +const UBYTE logo[] = {70, 72, 74, 0, 0, 0, 0, 0, + 71, 73, 75, 76, 77, 78, 79, 80}; -const UWORD bgpalette[] = -{ - RGB_BLACK , RGB_BLACK, RGB_HAWT, RGB_WHITE -}; +const UWORD bgpalette[] = {RGB_BLACK, RGB_BLACK, RGB_HAWT, RGB_WHITE}; -const UWORD spritepalette[] = -{ - RGB_WHITE, RGB_LIGHTGRAY, RGB_LIGHTGRAY, RGB_BLACK, - RGB_HAWT, RGB_HAWT, RGB_HAWT, RGB_HAWT -}; +const UWORD spritepalette[] = {RGB_WHITE, RGB_LIGHTGRAY, RGB_LIGHTGRAY, + RGB_BLACK, RGB_HAWT, RGB_HAWT, + RGB_HAWT, RGB_HAWT}; BOOLEAN recallMode; -const UBYTE SCREEN_XO =8; -const UBYTE SCREEN_YO =16; -const UBYTE SCREEN_XSPACE =32; -const UBYTE SCREEN_YSPACE =8; -const UBYTE SCREEN_PSTARTX =24; -const UBYTE SCREEN_PSTARTY =41; +const UBYTE SCREEN_XO = 8; +const UBYTE SCREEN_YO = 16; +const UBYTE SCREEN_XSPACE = 32; +const UBYTE SCREEN_YSPACE = 8; +const UBYTE SCREEN_PSTARTX = 24; +const UBYTE SCREEN_PSTARTY = 41; -BOOLEAN cursorEnable[4] = {1,0,0,0}; +BOOLEAN cursorEnable[4] = {1, 0, 0, 0}; UBYTE cursorColumn; UBYTE cursorRow[4]; UBYTE cursorBigStartX[4]; @@ -480,132 +370,90 @@ BOOLEAN shiftSelect; BOOLEAN systemIdle = 1; -UBYTE vibratoPosition[4] = {0,0,0,0}; -UBYTE vibratoSpeed[4] = {1,1,1,1}; -UBYTE vibratoDepth[4] = {0,0,0,0}; -BOOLEAN vibratoSlope[4] = {0,0,0,0}; +UBYTE vibratoPosition[4] = {0, 0, 0, 0}; +UBYTE vibratoSpeed[4] = {1, 1, 1, 1}; +UBYTE vibratoDepth[4] = {0, 0, 0, 0}; +BOOLEAN vibratoSlope[4] = {0, 0, 0, 0}; UBYTE dataSetSnap[28]; -UBYTE dataSet[28] = -{ - 0x02, // 0 Transpose 0 - 6 - 0x00, // 1 Shape 0 - 3 - 0x06, // 2 Envelope 0 - F - 0x00, // 3 Sweep 0 - F - 0x02, // 4 PB Range 0 - 12 - 0x00, // 5 Sustain 0 - 1 - 0x03, // 6 Output 0 - 3 - - 0x02, // 7 Transpose 0 - 6 - 0x00, // 8 Shape 0 - 3 - 0x06, // 9 Envelope 0 - F - 0x02, // 10 PB Range 0 - 12 - 0x00, // 11 Sustain 0 - 1 - 0x03, // 12 Output 0 - 3 - - 0x02, // 13 Transpose 0 - 6 - 0x00, // 14 Shape 0 - F - 0x00, // 15 Offset 0 - F - 0x00, // 16 Sweep 0 - F - 0x02, // 17 PB Range 0 - 12 - 0x00, // 18 Sustain 0 - 1 - 0x03, // 19 Output 0 - 3 - - 0x02, // 20 Transpose 0 - 6 - 0x06, // 21 Env 0 - F - 0x00, // 22 Sustain 0 - 1 - 0x03, // 23 Output 0 - 3 - - 0x00, // 24 Save 0 - 0x00, // 25 Save 1 - 0x00, // 26 Save 2 - 0x00, // 27 Save 3 +UBYTE dataSet[28] = { + 0x02, // 0 Transpose 0 - 6 + 0x00, // 1 Shape 0 - 3 + 0x06, // 2 Envelope 0 - F + 0x00, // 3 Sweep 0 - F + 0x02, // 4 PB Range 0 - 12 + 0x00, // 5 Sustain 0 - 1 + 0x03, // 6 Output 0 - 3 + + 0x02, // 7 Transpose 0 - 6 + 0x00, // 8 Shape 0 - 3 + 0x06, // 9 Envelope 0 - F + 0x02, // 10 PB Range 0 - 12 + 0x00, // 11 Sustain 0 - 1 + 0x03, // 12 Output 0 - 3 + + 0x02, // 13 Transpose 0 - 6 + 0x00, // 14 Shape 0 - F + 0x00, // 15 Offset 0 - F + 0x00, // 16 Sweep 0 - F + 0x02, // 17 PB Range 0 - 12 + 0x00, // 18 Sustain 0 - 1 + 0x03, // 19 Output 0 - 3 + + 0x02, // 20 Transpose 0 - 6 + 0x06, // 21 Env 0 - F + 0x00, // 22 Sustain 0 - 1 + 0x03, // 23 Output 0 - 3 + + 0x00, // 24 Save 0 + 0x00, // 25 Save 1 + 0x00, // 26 Save 2 + 0x00, // 27 Save 3 }; UBYTE currentScreen; BOOLEAN parameterLock[24]; -const UBYTE synthAddress[4][2] = -{ - {0,7}, - {7,13}, - {13,20}, - {20,24} -}; +const UBYTE synthAddress[4][2] = {{0, 7}, {7, 13}, {13, 20}, {20, 24}}; -const UBYTE tableCursorLookup[4][9] = -{ - { 0, 1, 2, 3, 4, 5, 6,255,24}, - { 7, 8, 9,255, 10,11,12,255,25}, - {13, 14,15, 16, 17,18,19,255,26}, - {20,255,21,255,255,22,23,255,27} -}; +const UBYTE tableCursorLookup[4][9] = { + {0, 1, 2, 3, 4, 5, 6, 255, 24}, + {7, 8, 9, 255, 10, 11, 12, 255, 25}, + {13, 14, 15, 16, 17, 18, 19, 255, 26}, + {20, 255, 21, 255, 255, 22, 23, 255, 27}}; -const UBYTE tableData[28][3] = -{ - {3,5,6}, - {3,6,4}, - {3,7,16}, - {3,8,255}, - {3,9,49}, - {3,10,2}, - {3,11,4}, - - {7,5,6}, - {7,6,4}, - {7,7,16}, - {7,9,49}, - {7,10,2}, - {7,11,4}, - - {11,5,6}, - {11,6,16}, - {11,7,32}, - {11,8,16}, - {11,9,49}, - {11,10,2}, - {11,11,4}, - - {15,5,6}, - {15,7,16}, - {15,10,2}, - {15,11,4}, - - {3,13,16}, - {7,13,16}, - {11,13,16}, - {15,13,16}, -}; +const UBYTE tableData[28][3] = { + {3, 5, 6}, {3, 6, 4}, {3, 7, 16}, {3, 8, 255}, + {3, 9, 49}, {3, 10, 2}, {3, 11, 4}, -const UBYTE octmap[6][2] = -{ - {3,65}, - {2,65}, - {83,83}, - {2,64}, - {3,64}, - {4,64} -}; + {7, 5, 6}, {7, 6, 4}, {7, 7, 16}, {7, 9, 49}, + {7, 10, 2}, {7, 11, 4}, + + {11, 5, 6}, {11, 6, 16}, {11, 7, 32}, {11, 8, 16}, + {11, 9, 49}, {11, 10, 2}, {11, 11, 4}, + + {15, 5, 6}, {15, 7, 16}, {15, 10, 2}, {15, 11, 4}, -const UBYTE panmap[4][2] = -{ - {37,37}, - {37,28}, - {22,37}, - {22,28}, + {3, 13, 16}, {7, 13, 16}, {11, 13, 16}, {15, 13, 16}, }; -const UBYTE susmap[2][2] = -{ - {83,0}, - {82,0}, +const UBYTE octmap[6][2] = {{3, 65}, {2, 65}, {83, 83}, + {2, 64}, {3, 64}, {4, 64}}; + +const UBYTE panmap[4][2] = { + {37, 37}, + {37, 28}, + {22, 37}, + {22, 28}, }; -const UBYTE markerMapTiles[4][4] = -{ - {0x03,0x02,0x00,0x5B}, - {0x07,0x02,0x00,0x5B}, - {0x0B,0x02,0x00,0x5B}, - {0x0F,0x02,0x00,0x5B} +const UBYTE susmap[2][2] = { + {83, 0}, + {82, 0}, }; + +const UBYTE markerMapTiles[4][4] = {{0x03, 0x02, 0x00, 0x5B}, + {0x07, 0x02, 0x00, 0x5B}, + {0x0B, 0x02, 0x00, 0x5B}, + {0x0F, 0x02, 0x00, 0x5B}}; diff --git a/Source/mGBASMFunctions.s b/Source/mGBASMFunctions.s index 9a167f6..a8ccdb9 100644 --- a/Source/mGBASMFunctions.s +++ b/Source/mGBASMFunctions.s @@ -1,50 +1,4 @@ - -_asmMain:: - ld A,#0x01 - ld hl,#_systemIdle - ld (hl),A - - call _asmUpdateMidiBuffer - - ld A,#0x01 - ld hl,#_systemIdle - bit 0,(hl) - call nz, _getPad - ld A,#0x01 - ld hl,#_systemIdle - bit 0,(hl) - call nz, _asmUpdatePu1 - ld hl,#_systemIdle - bit 0,(hl) - call nz, _asmUpdatePu2 - ld hl,#_systemIdle - bit 0,(hl) - call nz, _asmUpdateWav - ld hl,#_systemIdle - bit 0,(hl) - call nz, _asmUpdateNoi - ld hl,#_systemIdle - bit 0,(hl) - jr nz,_asmMainScreen - - jr _asmMain -ret -_asmMainScreen:: - ld hl,#_currentScreen - bit 0,(hl) - jr z,_asmMain - - ld hl,#_updateDisplaySynthCounter - ld A,(hl) - inc A - and #0x03 - ld (hl),A - - call _updateDisplaySynth - - call _setPlayMarker - jr _asmMain -ret +.module mGBASMFunctions _asmLoadWav:: push bc diff --git a/Source/mGBASMMidiFunctions.s b/Source/mGBASMMidiFunctions.s index f83b25e..3f82cad 100644 --- a/Source/mGBASMMidiFunctions.s +++ b/Source/mGBASMMidiFunctions.s @@ -1,94 +1,16 @@ - -_asmUpdateMidiBuffer:: -push bc - ld hl,#_serialBufferPosition - ld A, (hl) - ld hl,#_serialBufferReadPosition - cp (hl) - jr z,_popReturn$ - - inc (hl) - - ld A,#<_serialBuffer - add A,(hl) - ld E,A - ld A,#>_serialBuffer - ld D,A - ld A,(DE) - - bit 7,A - jr nz,_asmUpdateMidiBufferStatus$ - - ld hl,#_capturedAddress - bit 0,(hl) - jr z,_asmUpdateMidiBufferAddress$ - - ld hl,#_capturedAddress - ld (hl),#0x00 - ld hl,#_valueByte - ld (hl),A - ld hl,#_systemIdle - ld (hl),#0x00 - - ld hl,#_statusByte - ld A,(hl) - ld B,A - SWAP A - AND #0x0F - - cp #0x0E - jr z,_asmEventMidiPB$ - cp #0x0B - jr z,_asmEventMidiCC$ - cp #0x08 - jr z,_asmEventMidiNoteOff$ - cp #0x09 - jr z,_asmEventMidiNote$ - cp #0x0C - jp z,_asmEventMidiPC$ -pop bc -ret +.module mGBASMMidiFunctions _popReturn$:: -pop bc ret -_asmUpdateMidiBufferStatus$:: - ld B,A - AND #0xF0 - cp #0xF0 - jr z,_popReturn$ - ld A,B - - ld hl,#_statusByte - ld (hl),A - ld hl,#_capturedAddress - ld (hl),#0x00 - - ld hl,#_systemIdle - ld (hl),#0x00 -pop bc -ret - -_asmUpdateMidiBufferAddress$:: - ld (hl),#0x01 - ld hl,#_addressByte - ld (hl),A - - ld hl,#_systemIdle - ld (hl),#0x00 -pop bc -ret - -_asmEventMidiNoteOff$:: +_asmEventMidiNoteOff:: ld hl,#_valueByte ld (hl),#0x00 - jr _asmEventMidiNote$ -pop bc + jr _asmEventMidiNote ret -_asmEventMidiNote$:: - ld A,B +_asmEventMidiNote:: + ld a,(#_statusByte) AND #0x0F cp #0x00 jp z,_asmPlayNotePu1; @@ -100,11 +22,10 @@ _asmEventMidiNote$:: jp z,_asmPlayNoteNoi$; cp #0x04 jp z,_asmPlayNotePoly$; -pop bc ret -_asmEventMidiCC$:: - ld A,B +_asmEventMidiCC:: + ld a,(#_statusByte) AND #0x0F cp #0x00 jp z,_asmEventMidiCCPu1$; @@ -116,11 +37,10 @@ _asmEventMidiCC$:: jp z,_asmEventMidiCCNoi$; cp #0x04 jp z,_asmEventMidiCCPoly$; -pop bc ret -_asmEventMidiPB$:: - ld A,B +_asmEventMidiPB:: + ld a,(#_statusByte) AND #0x0F cp #0x00 jp z,_asmPu1MidiPb$; @@ -132,11 +52,10 @@ _asmEventMidiPB$:: jp z,_asmNoiMidiPb$; cp #0x04 jp z,_asmPolyMidiPb$; -pop bc ret -_asmEventMidiPC$:: - ld A,B +_asmEventMidiPC:: + ld a,(#_statusByte) AND #0x0F cp #0x00 jp z,_asmPu1Lod$; @@ -148,7 +67,6 @@ _asmEventMidiPC$:: jp z,_asmNoiLod$; cp #0x04 jp z,_asmPolyLod$; -pop bc ret ;---------------------------------------------------------------------------------------------------- @@ -173,7 +91,6 @@ _asmPu1MidiPb$:: ld de,#_pbWheelIn + 0 ld (de),A -pop bc ret _asmPu2MidiPb$:: @@ -191,7 +108,6 @@ _asmPu2MidiPb$:: ld de,#_pbWheelIn + 1 ld (de),A -pop bc ret _asmWavMidiPb$:: @@ -209,7 +125,6 @@ _asmWavMidiPb$:: ld de,#_pbWheelIn + 2 ld (de),A -pop bc ret _asmNoiMidiPb$:: @@ -227,7 +142,6 @@ _asmNoiMidiPb$:: ld de,#_pbWheelIn + 3 ld (de),A -pop bc ret _asmPolyMidiPb$:: @@ -249,7 +163,6 @@ _asmPolyMidiPb$:: ld (de),A ld de,#_pbWheelIn + 2 ld (de),A -pop bc ret @@ -280,7 +193,6 @@ _asmEventMidiCCPu1$:: jp z,_asmPu1Sus$; cp #0x7B jp z,_asmPu1Nf$; -pop bc ret _asmPu1Wav$:: @@ -303,7 +215,6 @@ _asmPu1Wav$:: AND #0x03 ld de,#_dataSet + 1 ld (de),A -pop bc ret @@ -326,7 +237,6 @@ _asmPu1Env$:: ld de,#_dataSet + 2 ld (de),A -pop bc ret @@ -343,7 +253,6 @@ _asmPu1Swp$:: ld de,#_dataSet + 3 ld (de),A -pop bc ret @@ -356,7 +265,6 @@ _asmPu1Pbr$:: ld de,#_dataSet + 4 ld (de),A -pop bc ret @@ -377,7 +285,6 @@ _asmPu1Lod$:: inc sp call _updateSynth lda sp,1(sp) -pop bc ret @@ -408,7 +315,6 @@ _asmPu1PanLeft$:: and #0xEE or B ld (#0xFF25),A -pop bc ret _asmPu1PanCenter$:: ld A,#0x03 @@ -420,7 +326,6 @@ _asmPu1PanCenter$:: and #0xEE or B ld (#0xFF25),A -pop bc ret _asmPu1PanRight$:: ld A,#0x01 @@ -432,7 +337,6 @@ _asmPu1PanRight$:: and #0xEE or B ld (#0xFF25),A -pop bc ret @@ -443,7 +347,6 @@ _asmPu1VD$:: ld de,#_vibratoDepth + 0 ld (de),A -pop bc ret @@ -453,7 +356,6 @@ _asmPu1VR$:: ld de,#_vibratoSpeed + 0 ld (de),A -pop bc ret @@ -469,7 +371,6 @@ _asmPu1SusOn$:: ld (de),A ld hl,#_pu1Sus ld (hl),A -pop bc ret _asmPu1SusOff$:: ld A,#0x00 @@ -482,12 +383,10 @@ _asmPu1SusOff$:: ld A,(hl) bit 0,A jr z, _asmPu1SusNoteOff$ -pop bc ret _asmPu1SusNoteOff$:: ld A,#0x00 ld (#0xFF12),A -pop bc ret @@ -498,7 +397,6 @@ _asmPu1Nf$:: ld (hl),A ld de,#_dataSet + 5 ld (de),A -pop bc ret @@ -526,7 +424,6 @@ _asmEventMidiCCPu2$:: jp z,_asmPu2Sus$; cp #0x7B jp z,_asmPu2Nf$; -pop bc ret _asmPu2Wav$:: @@ -549,7 +446,6 @@ _asmPu2Wav$:: AND #0x03 ld de,#_dataSet + 8 ld (de),A -pop bc ret @@ -572,7 +468,6 @@ _asmPu2Env$:: ld de,#_dataSet + 9 ld (de),A -pop bc ret _asmPu2Pbr$:: @@ -584,7 +479,6 @@ _asmPu2Pbr$:: ld de,#_dataSet + 10 ld (de),A -pop bc ret @@ -605,7 +499,6 @@ _asmPu2Lod$:: inc sp call _updateSynth lda sp,1(sp) -pop bc ret @@ -636,7 +529,6 @@ _asmPu2PanLeft$:: and #0xDD or B ld (#0xFF25),A -pop bc ret _asmPu2PanCenter$:: ld A,#0x03 @@ -648,7 +540,6 @@ _asmPu2PanCenter$:: and #0xDD or B ld (#0xFF25),A -pop bc ret _asmPu2PanRight$:: ld A,#0x01 @@ -660,7 +551,6 @@ _asmPu2PanRight$:: and #0xDD or B ld (#0xFF25),A -pop bc ret @@ -671,7 +561,6 @@ _asmPu2VD$:: ld de,#_vibratoDepth + 1 ld (de),A -pop bc ret @@ -681,7 +570,6 @@ _asmPu2VR$:: ld de,#_vibratoSpeed + 1 ld (de),A -pop bc ret @@ -697,7 +585,6 @@ _asmPu2SusOn$:: ld (de),A ld hl,#_pu2Sus ld (hl),A -pop bc ret _asmPu2SusOff$:: ld A,#0x00 @@ -710,12 +597,10 @@ _asmPu2SusOff$:: ld A,(hl) bit 0,A jr z, _asmPu2SusNoteOff$ -pop bc ret _asmPu2SusNoteOff$:: ld A,#0x00 ld (#0xFF17),A -pop bc ret @@ -726,7 +611,6 @@ _asmPu2Nf$:: ld (hl),A ld de,#_dataSet + 11 ld (de),A -pop bc ret ;---------------------------------------------------------------------------------------------------- @@ -755,7 +639,6 @@ _asmEventMidiCCWav$:: jp z,_asmWavSus$; cp #0x7B jp z,_asmWavNf$; -pop bc ret @@ -780,7 +663,6 @@ _asmWavWav$:: ADD A,(hl) ld hl,#_wavDataOffset ld (hl),A -pop bc ret @@ -806,7 +688,6 @@ _asmWavOst$:: ld hl,#_wavDataOffset ld (hl),A -pop bc ret @@ -825,7 +706,6 @@ _asmWavSwp$:: ld (hl),A ld de,#_dataSet + 16 ld (de),A -pop bc ret @@ -838,7 +718,6 @@ _asmWavPbr$:: ld de,#_dataSet + 17 ld (de),A -pop bc ret @@ -859,7 +738,6 @@ _asmWavLod$:: inc sp call _updateSynth lda sp,1(sp) -pop bc ret @@ -890,7 +768,6 @@ _asmWavPanLeft$:: and #0xBB or B ld (#0xFF25),A -pop bc ret _asmWavPanCenter$:: ld A,#0x03 @@ -902,7 +779,6 @@ _asmWavPanCenter$:: and #0xBB or B ld (#0xFF25),A -pop bc ret _asmWavPanRight$:: ld A,#0x01 @@ -914,7 +790,6 @@ _asmWavPanRight$:: and #0xBB or B ld (#0xFF25),A -pop bc ret @@ -925,7 +800,6 @@ _asmWavVD$:: ld de,#_vibratoDepth + 2 ld (de),A -pop bc ret @@ -935,7 +809,6 @@ _asmWavVR$:: ld de,#_vibratoSpeed + 2 ld (de),A -pop bc ret @@ -951,7 +824,6 @@ _asmWavSusOn$:: ld (de),A ld hl,#_wavSus ld (hl),A -pop bc ret _asmWavSusOff$:: ld A,#0x00 @@ -964,12 +836,10 @@ _asmWavSusOff$:: ld A,(hl) bit 0,A jr z, _asmWavSusNoteOff$ -pop bc ret _asmWavSusNoteOff$:: ld A,#0x00 ld (#0xFF1C),A -pop bc ret @@ -980,7 +850,6 @@ _asmWavNf$:: ld (hl),A ld de,#_dataSet + 11 ld (de),A -pop bc ret ;---------------------------------------------------------------------------------------------------- @@ -1003,7 +872,6 @@ _asmEventMidiCCNoi$:: jp z,_asmNoiSus$; cp #0x7B jp z,_asmNoiNf$; -pop bc ret @@ -1026,7 +894,6 @@ _asmNoiEnv$:: ld de,#_dataSet + 21 ld (de),A -pop bc ret @@ -1047,7 +914,6 @@ _asmNoiLod$:: inc sp call _updateSynth lda sp,1(sp) -pop bc ret @@ -1078,7 +944,6 @@ _asmNoiPanLeft$:: and #0x77 or B ld (#0xFF25),A -pop bc ret _asmNoiPanCenter$:: ld A,#0x03 @@ -1090,7 +955,6 @@ _asmNoiPanCenter$:: and #0x77 or B ld (#0xFF25),A -pop bc ret _asmNoiPanRight$:: ld A,#0x01 @@ -1102,7 +966,6 @@ _asmNoiPanRight$:: and #0x77 or B ld (#0xFF25),A -pop bc ret @@ -1113,7 +976,6 @@ _asmNoiVD$:: ld de,#_vibratoDepth + 3 ld (de),A -pop bc ret @@ -1123,7 +985,6 @@ _asmNoiVR$:: ld de,#_vibratoSpeed + 3 ld (de),A -pop bc ret @@ -1139,7 +1000,6 @@ _asmNoiSusOn$:: ld (de),A ld hl,#_noiSus ld (hl),A -pop bc ret _asmNoiSusOff$:: ld A,#0x00 @@ -1152,12 +1012,10 @@ _asmNoiSusOff$:: ld A,(hl) bit 0,A jr z, _asmNoiSusNoteOff$ -pop bc ret _asmNoiSusNoteOff$:: ld A,#0x00 ld (#0xFF21),A -pop bc ret @@ -1168,7 +1026,6 @@ _asmNoiNf$:: ld (hl),A ld de,#_dataSet + 22 ld (de),A -pop bc ret ;---------------------------------------------------------------------------------------------------- @@ -1190,51 +1047,39 @@ _asmEventMidiCCPoly$:: jr z,_asmPolySus$; cp #0x7B jr z,_asmPolyNf$; -pop bc ret _asmPolyWav$:: call _asmPu1Wav$; -push bc call _asmPu2Wav$; -push bc call _asmWavWav$; ret _asmPolyEnv$:: call _asmPu1Env$; -push bc call _asmPu2Env$; ret _asmPolyLod$:: call _asmPu1Lod$; -push bc call _asmPu2Lod$; -push bc call _asmWavLod$; ret _asmPolyPan$:: call _asmPu1Pan$; -push bc call _asmPu2Pan$; -push bc call _asmWavPan$; ret _asmPolySus$:: call _asmPu1Sus$; -push bc call _asmPu2Sus$; -push bc call _asmWavSus$; ret _asmPolyNf$:: call _asmPu1Nf$; -push bc call _asmPu2Nf$; -push bc call _asmWavNf$; ret diff --git a/Source/mGBASMSynthFunctions.s b/Source/mGBASMSynthFunctions.s index 364bbb7..54a1e55 100644 --- a/Source/mGBASMSynthFunctions.s +++ b/Source/mGBASMSynthFunctions.s @@ -1,5 +1,6 @@ +.module mGBASMSynthFunctions + _asmUpdatePu1:: -push bc ld hl, #_pu1NoteOffTrigger ld A,(hl) bit 0,A @@ -14,14 +15,12 @@ push bc ld A,(hl) bit 0,A jr nz, _asmUpdatePu1PbWheelReset$ -pop bc ret _asmUpdatePu1Noff$:: ld A,#0x00 ld (#0xFF12),A ld (hl),A -pop bc ret _asmUpdatePu1PbWheel$:: @@ -32,7 +31,6 @@ _asmUpdatePu1PbWheel$:: ld A, #0x01 ld hl, #_pbWheelActive + 0 ld (hl), A -pop bc ret _asmUpdatePu1PbWheelSet$:: ld (hl), A @@ -46,7 +44,6 @@ _asmUpdatePu1PbWheelSet$:: inc sp call _setPitchBendFrequencyOffset inc sp -pop bc ret _asmUpdatePu1PbWheelReset$:: @@ -77,7 +74,6 @@ _asmUpdatePu1PbWheelReset$:: ld A,(DE) ld (hl), A ld (#0xFF14),A -pop bc ret ;-------------------------------------------------------------- @@ -85,7 +81,6 @@ ret ;-------------------------------------------------------------- _asmUpdatePu2:: -push bc ld hl, #_pu2NoteOffTrigger ld A,(hl) bit 0,A @@ -100,14 +95,12 @@ push bc ld A,(hl) bit 0,A jr nz, _asmUpdatePu2PbWheelReset$ -pop bc ret _asmUpdatePu2Noff$:: ld A,#0x00 ld (#0xFF17),A ld (hl),A -pop bc ret _asmUpdatePu2PbWheel$:: @@ -118,7 +111,6 @@ _asmUpdatePu2PbWheel$:: ld A, #0x01 ld hl, #_pbWheelActive + 1 ld (hl), A -pop bc ret _asmUpdatePu2PbWheelSet$:: ld (hl), A @@ -132,7 +124,6 @@ _asmUpdatePu2PbWheelSet$:: inc sp call _setPitchBendFrequencyOffset inc sp -pop bc ret _asmUpdatePu2PbWheelReset$:: @@ -164,7 +155,6 @@ _asmUpdatePu2PbWheelReset$:: ld A,(DE) ld (hl), A ld (#0xFF19),A -pop bc ret ;-------------------------------------------------------------- @@ -172,7 +162,6 @@ ret ;-------------------------------------------------------------- _asmUpdateWav:: -push bc ld hl, #_wavNoteOffTrigger ld A,(hl) bit 0,A @@ -195,14 +184,12 @@ push bc bit 0,A jr nz, _asmUpdateWavPbWheelReset$ -pop bc ret _asmUpdateWavNoff$:: ld A,#0x00 ld (#0xFF1C),A ld (hl),A -pop bc ret @@ -217,7 +204,6 @@ _asmUpdateWavData$:: ld A, #0x80 ld hl, #_pbWheelInLast + 2 ld (hl), A -pop bc ret _asmUpdateWavPbWheel$:: @@ -228,7 +214,6 @@ _asmUpdateWavPbWheel$:: ld A, #0x01 ld hl, #_pbWheelActive + 2 ld (hl), A -pop bc ret _asmUpdateWavPbWheelSet$:: ld (hl), A @@ -242,7 +227,6 @@ _asmUpdateWavPbWheelSet$:: inc sp call _setPitchBendFrequencyOffset inc sp -pop bc ret _asmUpdateWavPbWheelReset$:: @@ -286,7 +270,6 @@ _asmUpdateWavPbWheelReset$:: and #0x7F ld (#0xFF1E),A -pop bc ret ;-------------------------------------------------------------- @@ -294,7 +277,6 @@ ret ;-------------------------------------------------------------- _asmUpdateNoi:: -push bc ld hl, #_pbWheelIn + 3 ld A,(hl) cp #0x80 @@ -304,7 +286,6 @@ push bc ld A,(hl) bit 0,A jr nz, _asmUpdateNoiPbWheelReset$ -pop bc ret _asmUpdateNoiPbWheel$:: @@ -315,7 +296,6 @@ _asmUpdateNoiPbWheel$:: ld A, #0x01 ld hl, #_pbWheelActive + 3 ld (hl), A -pop bc ret _asmUpdateNoiPbWheelSet$:: ld (hl), A @@ -325,7 +305,6 @@ _asmUpdateNoiPbWheelSet$:: ld (hl), A call _setPitchBendFrequencyOffsetNoise -pop bc ret _asmUpdateNoiPbWheelReset$:: @@ -354,7 +333,6 @@ _asmUpdateNoiPbWheelReset$:: ld (#0xFF20),A ;ld A,#0x80 ;ld (#0xFF23),A -pop bc ret ;-------------------------------------------------------------- @@ -418,7 +396,6 @@ _asmPlayNotePu1OnSetOff$:: ld (hl),A jr _asmPlayNotePu1On$ -pop bc ret @@ -473,7 +450,6 @@ _asmPlayNotePu1On$:: ld A,#0x00 ld hl, #_pu1NoteOffTrigger ld (hl),A -pop bc ret _asmPlayNotePu1Off$:: @@ -497,11 +473,9 @@ _asmPlayNotePu1Off$:: ;ld A,#0x00 ;ld (#0xFF12),A -pop bc ret _asmPlayNoteOffPu1Return$:: -pop bc ret ;-------------------------------------------------------------- @@ -559,7 +533,6 @@ _asmPlayNotePu2OnSetOff$:: ld (hl),A jr _asmPlayNotePu2On$ -pop bc ret _asmPlayNotePu2On$:: @@ -612,7 +585,6 @@ _asmPlayNotePu2On$:: ld A,#0x00 ld hl, #_pu2NoteOffTrigger ld (hl),A -pop bc ret _asmPlayNotePu2Off$:: @@ -636,7 +608,6 @@ _asmPlayNotePu2Off$:: ;ld A,#0x00 ;ld (#0xFF17),A -pop bc ret @@ -659,7 +630,6 @@ _asmPlayNoteWav$:: cp #0x00 jr nz,_asmPlayNoteWavOn$ jp _asmPlayNoteWavOff$ -pop bc ret _asmPlayNoteWavOn$:: @@ -673,19 +643,16 @@ _asmPlayNoteWavOn$:: ld A,#0x60 ld (#0xFF1C),A jr _asmPlayNoteWavSet$ -pop bc ret _asmPlayNoteWavVolF$:: ld A,#0x20 ld (#0xFF1C),A jr _asmPlayNoteWavSet$ -pop bc ret _asmPlayNoteWavVolM$:: ld A,#0x40 ld (#0xFF1C),A jr _asmPlayNoteWavSet$ -pop bc ret _asmPlayNoteWavSet$:: @@ -755,7 +722,6 @@ _asmPlayNoteWavSet$:: ld A,#0x00 ld hl, #_wavNoteOffTrigger ld (hl),A -pop bc ret @@ -782,7 +748,6 @@ _asmPlayNoteWavOff$:: ;ld A,#0x00 ;ld (#0xFF1C),A -pop bc ret @@ -804,7 +769,6 @@ _asmPlayNoteNoi$:: cp #0x00 jr nz,_asmPlayNoteNoiOn$ jr _asmPlayNoteNoiOff$ -pop bc ret _asmPlayNoteNoiOn$:: @@ -845,7 +809,6 @@ _asmPlayNoteNoiOn$:: ld A,#0x01 ld hl, #_noteStatus + 6 ld (hl),A -pop bc ret _asmPlayNoteNoiOff$:: @@ -865,7 +828,6 @@ _asmPlayNoteNoiOff$:: ld A,#0x00 ld (#0xFF21),A -pop bc ret @@ -889,7 +851,6 @@ _asmPlayNotePoly$:: cp #0x00 jr nz,_asmPlayNotePolyOn$ jr _asmPlayNotePolyOff$ -pop bc ret _asmPlayNotePolyOff$:: ld hl,#_polyNoteState + 0 @@ -912,20 +873,19 @@ _asmPlayNotePolyOff$:: ld A,(hl) cp B call z,_asmPlayNotePolyWavOff$; -pop bc ret _asmPlayNotePolyPu1Off$:: call _asmPlayNotePu1 - push bc + ret _asmPlayNotePolyPu2Off$:: call _asmPlayNotePu2$ - push bc + ret _asmPlayNotePolyWavOff$:: call _asmPlayNoteWav$ - push bc + ret _asmPlayNotePolyOn$:: @@ -935,12 +895,10 @@ _asmPlayNotePolyOn$:: cp #0x03 jr z,_asmPlayNotePolyRst$ jr _asmPlayNotePolyCon$ -pop bc ret _asmPlayNotePolyRst$:: ld A, #0x00 jr _asmPlayNotePolyCon$ -pop bc ret _asmPlayNotePolyCon$:: ld (hl),A @@ -952,18 +910,15 @@ _asmPlayNotePolyCon$:: ld hl,#_polyNoteState + 2 ld (hl),B jp _asmPlayNoteWav$; -pop bc ret _asmPlayNotePolyPu1$:: ld hl,#_polyNoteState + 0 ld (hl),B jp _asmPlayNotePu1; -pop bc ret _asmPlayNotePolyPu2$:: ld hl,#_polyNoteState + 1 ld (hl),B jp _asmPlayNotePu2$; -pop bc ret diff --git a/Source/mGBDisplayFunctions.c b/Source/mGBDisplayFunctions.c index 17b99d1..4e6fd3e 100644 --- a/Source/mGBDisplayFunctions.c +++ b/Source/mGBDisplayFunctions.c @@ -1,9 +1,11 @@ -void printversion() +#include "mGB.h" + +void printversion(void) { set_bkg_tiles(1,16,10,1,versionnumber); } -void printhelp() +void printhelp(void) { j=helpmap[cursorColumn][cursorRowMain]; set_bkg_tiles(1,16,18,1,helpdata[j]); @@ -86,7 +88,7 @@ void updateDisplayValue(UBYTE p,UBYTE v) } } -void updateDisplaySynth() +void updateDisplaySynth(void) { //printbyte(serialBufferPosition,serialBufferReadPosition,serialBuffer[serialBufferPosition]); for(i=0;i!=0x09U;i++) { @@ -96,7 +98,7 @@ void updateDisplaySynth() } } -void updateDisplay() +void updateDisplay(void) { UBYTE x=0; for(j=0;j!=0x04U;j++) { @@ -110,7 +112,7 @@ void updateDisplay() } } -void setCursor() +void setCursor(void) { if(cursorColumnLast != cursorColumn) { if(cursorColumn>0xF0U) cursorColumn=0x03U; @@ -150,7 +152,7 @@ void setCursor() printhelp(); } -void hideCursor() +void hideCursor(void) { for(j=0;j!=4;j++) { move_sprite(j+SPRITE_ARRL_START,0, 0); @@ -158,12 +160,12 @@ void hideCursor() move_sprite(SPRITE_ARRT_START, 0, 0); } -void showCursor() +void showCursor(void) { setCursor(); } -void setPlayMarker() +void setPlayMarker(void) { for(j=0;j!=4;j++) { if(!j) { @@ -179,7 +181,7 @@ void setPlayMarker() } } -void cls() +void cls(void) { for(j=0;j!=20;j++) bkg[j]= 0x00U; for(j=0;j!=18;j++) { @@ -187,14 +189,7 @@ void cls() } } -void showSampleScreen() -{ - hideCursor(); - cls(); - currentScreen = 1; -} - -void showMainScreen() +void showMainScreen(void) { cls(); currentScreen = 1; @@ -212,14 +207,14 @@ void showMainScreen() showCursor(); } -void showSplashScreen() +void showSplashScreen(void) { hideCursor(); cls(); set_bkg_tiles(6,7,8,2,logo); } -void toggleScreen() +void toggleScreen(void) { if(currentScreen == 0) { DISPLAY_ON; @@ -230,7 +225,7 @@ void toggleScreen() } } -void displaySetup() +void displaySetup(void) { DISPLAY_OFF; set_bkg_palette( 0, 1, &bgpalette[0] ); diff --git a/Source/mGBMemoryFunctions.c b/Source/mGBMemoryFunctions.c index 4cb40c2..7befe69 100644 --- a/Source/mGBMemoryFunctions.c +++ b/Source/mGBMemoryFunctions.c @@ -1,3 +1,4 @@ +#include "mGB.h" void saveDataSet(UBYTE synth) { @@ -69,7 +70,7 @@ void loadDataSet(UBYTE synth) DISABLE_RAM_MBC1; } -void snapRecall() +void snapRecall(void) { if(cursorRowMain == 0x08U) { for(l=0;l<4;l++) { @@ -92,7 +93,7 @@ void snapRecall() } } -void checkMemory() +void checkMemory(void) { ENABLE_RAM_MBC1; if(saveData[512] != 0xF7) { diff --git a/Source/mGBMidiFunctions.c b/Source/mGBMidiFunctions.c new file mode 100644 index 0000000..aa81893 --- /dev/null +++ b/Source/mGBMidiFunctions.c @@ -0,0 +1,64 @@ +#include "mGB.h" + +#define MIDI_STATUS_BIT 0x80 +#define MIDI_STATUS_NOTE_ON 0x09 +#define MIDI_STATUS_NOTE_OFF 0x08 +#define MIDI_STATUS_AT 0x0A +#define MIDI_STATUS_CC 0x0B +#define MIDI_STATUS_PC 0x0C +#define MIDI_STATUS_AT_MONO 0x0D +#define MIDI_STATUS_PB 0x0E + +#define MIDI_STATUS_SYSTEM 0xF0 + +void updateMidiBuffer(void) { + if (serialBufferReadPosition == serialBufferPosition) { + return; + } + + serialBufferReadPosition++; // unsigned overflow from 255 -> 0 is automatic. + + UBYTE byte = serialBuffer[serialBufferReadPosition]; + + // STATUS BYTE + if (byte & MIDI_STATUS_BIT) { + if ((byte & MIDI_STATUS_SYSTEM) == MIDI_STATUS_SYSTEM) { + return; + } + statusByte = byte; + capturedAddress = 0; + systemIdle = 0; + return; + } + + // 2ND BYTE (note/CC control) + if (!capturedAddress) { + capturedAddress = 1; + addressByte = byte; + systemIdle = 0; + return; + } + + // 3RD BYTE (velocity/value) + capturedAddress = 0; + valueByte = byte; + systemIdle = 0; + + switch ((statusByte >> 4) & 0x0F) { + case MIDI_STATUS_PB: + asmEventMidiPB(); + break; + case MIDI_STATUS_CC: + asmEventMidiCC(); + break; + case MIDI_STATUS_NOTE_ON: + asmEventMidiNote(); + break; + case MIDI_STATUS_NOTE_OFF: + asmEventMidiNoteOff(); + break; + case MIDI_STATUS_PC: + asmEventMidiPC(); + break; + } +} \ No newline at end of file diff --git a/Source/mGBSynthCommonFunctions.c b/Source/mGBSynthCommonFunctions.c index 4eb322a..573f2cb 100644 --- a/Source/mGBSynthCommonFunctions.c +++ b/Source/mGBSynthCommonFunctions.c @@ -1,7 +1,8 @@ +#include "mGB.h" UBYTE wavStepCounter; -void setOutputSwitch() +void setOutputSwitch(void) { NR51_REG = outputSwitch[0]+outputSwitch[1]+outputSwitch[2]+outputSwitch[3]; } @@ -139,7 +140,7 @@ void updateSynth(UBYTE synth) } -void updateSynths() +void updateSynths(void) { enable_interrupts(); diff --git a/Source/mGBSynthPitchFunctions.c b/Source/mGBSynthPitchFunctions.c index 59ec0d6..7f724ae 100644 --- a/Source/mGBSynthPitchFunctions.c +++ b/Source/mGBSynthPitchFunctions.c @@ -1,3 +1,5 @@ +#include "mGB.h" + void setPitchBendFrequencyOffset(UBYTE synth) { UWORD freqRange; @@ -37,7 +39,7 @@ void setPitchBendFrequencyOffset(UBYTE synth) } } -void setPitchBendFrequencyOffsetNoise() +void setPitchBendFrequencyOffsetNoise(void) { systemIdle = 0; if(pbWheelIn[NOI] & 0x80) { diff --git a/Source/mGBUserFunctions.c b/Source/mGBUserFunctions.c index 8f02d84..4220fb9 100644 --- a/Source/mGBUserFunctions.c +++ b/Source/mGBUserFunctions.c @@ -1,10 +1,11 @@ +#include "mGB.h" -void clearParameterLocks() +void clearParameterLocks(void) { for(j=0;j!=24;j++) parameterLock[j] = 0; } -void setDataValue() +void setDataValue(void) { BOOLEAN up=0; UBYTE inc=1; @@ -69,7 +70,7 @@ void setDataValue() } -void getPad() +void getPad(void) { i = joypad(); if(i != lastPadRead) { diff --git a/Source/make_mgb.bat b/Source/make_mgb.bat deleted file mode 100644 index 428f203..0000000 --- a/Source/make_mgb.bat +++ /dev/null @@ -1,6 +0,0 @@ -REM YUR MOM LIKES TEH TACO - -..\..\gbdk\bin\lcc.exe -IZ:\Projects\mGB -Wa-l -Wl-m -Wl-j -DUSE_SFR_FOR_REG -c -o mGB.o mGB.c - -..\..\gbdk\bin\lcc.exe -Wl-m -Wl-yt2 -Wl-yo4 -Wl-ya4 -Wl-yp0x143=0x80 -o mGB.gb mGB.o mgb_save.o mGBASMFunctions.s mGBASMSynthFunctions.s mGBASMMidiFunctions.s - diff --git a/Source/make_mgb_save.bat b/Source/make_mgb_save.bat deleted file mode 100644 index df6e0ac..0000000 --- a/Source/make_mgb_save.bat +++ /dev/null @@ -1 +0,0 @@ -..\..\gbdk\bin\lcc.exe -Wa-l -Wf-ba0 -c -o mgb_save.o mgb_save.c diff --git a/Source/mgb_save.c b/Source/mgb_save.c index 495dbb8..f146e5e 100644 --- a/Source/mgb_save.c +++ b/Source/mgb_save.c @@ -1,3 +1,3 @@ -#include +#include -UBYTE saveData[513]; +UBYTE saveData[513]; \ No newline at end of file diff --git a/Source/serial.c b/Source/serial.c new file mode 100644 index 0000000..788ba49 --- /dev/null +++ b/Source/serial.c @@ -0,0 +1,17 @@ +#include "mGB.h" +#include + +void serial_isr(void) CRITICAL INTERRUPT { + serialBufferPosition++; // unsigned overflow from 255 -> 0 is automatic. + serialBuffer[serialBufferPosition] = rSB; + + // queue another read + rSC = SIOF_XFER_START | SIOF_CLOCK_EXT; + + // the interrupt can happen over a vblank, and if so, no rendering should + // happen otherwise we will get unsafe VRAM access. + // also this prioritises updateMidiBuffer() + systemIdle = 0; +} + +ISR_VECTOR(VECTOR_SERIAL, serial_isr) \ No newline at end of file diff --git a/gbdk-n b/gbdk-n deleted file mode 160000 index 4c3abca..0000000 --- a/gbdk-n +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4c3abca0e2c75ae714bbd8efa01da2bd258dabd8