diff --git a/Source/io/midi.c b/Source/io/midi.c index 87f9b11..8ccdbec 100644 --- a/Source/io/midi.c +++ b/Source/io/midi.c @@ -23,23 +23,23 @@ void updateMidiBuffer(void) { return; } statusByte = byte; - capturedAddress = 0; - systemIdle = 0; + capturedAddress = false; + systemIdle = false; return; } // 2ND BYTE (note/CC control) if (!capturedAddress) { - capturedAddress = 1; + capturedAddress = true; addressByte = byte; - systemIdle = 0; + systemIdle = false; return; } // 3RD BYTE (velocity/value) - capturedAddress = 0; + capturedAddress = false; valueByte = byte; - systemIdle = 0; + systemIdle = false; switch ((statusByte >> 4) & 0x0F) { case MIDI_STATUS_PB: diff --git a/Source/io/serial.c b/Source/io/serial.c index 54c1df9..58c262e 100644 --- a/Source/io/serial.c +++ b/Source/io/serial.c @@ -16,7 +16,7 @@ void serial_isr(void) CRITICAL INTERRUPT { // 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; + systemIdle = false; } ISR_VECTOR(VECTOR_SERIAL, serial_isr) diff --git a/Source/mGB.c b/Source/mGB.c index 75650d1..412aabd 100644 --- a/Source/mGB.c +++ b/Source/mGB.c @@ -73,7 +73,7 @@ void main(void) { inline void gameMain(void) { rSC = SIOF_XFER_START | SIOF_CLOCK_EXT; while (1) { - systemIdle = 1; + systemIdle = true; updateMidiBuffer(); diff --git a/Source/screen/main.c b/Source/screen/main.c index ba60c98..e67ee40 100644 --- a/Source/screen/main.c +++ b/Source/screen/main.c @@ -9,7 +9,6 @@ #include "../synth/wav.h" #include "screen.h" -bool recallMode; // v 1.3.3 const uint8_t versionnumber[10] = {32, 81, 2, 81, 4, 81, 4, 0, 0, 0}; @@ -261,9 +260,9 @@ void setCursor(void) { cursorColumn = LAST_COL; if (cursorColumn > LAST_COL) cursorColumn = 0; - cursorEnable[cursorColumn] = 1U; + cursorEnable[cursorColumn] = true; if (!shiftSelect) { - cursorEnable[cursorColumnLast] = 0U; + cursorEnable[cursorColumnLast] = false; } // cursorRow[cursorColumn] = cursorRowMain; @@ -272,7 +271,7 @@ void setCursor(void) { for (j = 0; j != NUM_COLS; j++) { if (!shiftSelect && cursorColumn != j) { - cursorEnable[j] = 0; + cursorEnable[j] = false; } if (cursorEnable[j]) { if (cursorRow[j] > 0xF0U) @@ -307,18 +306,18 @@ void setPlayMarker(void) { void clearParameterLocks(void) { for (j = 0; j != 24; j++) - parameterLock[j] = 0; + parameterLock[j] = false; } void setDataValue(void) { - bool increasing = 0; + bool increasing = false; uint8_t delta = 1; - systemIdle = 0; + systemIdle = false; j = 0; if (i & J_UP) { j = 1; - increasing = 1; + increasing = true; delta = 16; } else if (i & J_DOWN) { j = 1; @@ -326,7 +325,7 @@ void setDataValue(void) { } else if (i & J_LEFT) { j = 1; } else if (i & J_RIGHT) { - increasing = 1; + increasing = true; j = 1; } if (j) { @@ -369,7 +368,7 @@ void setDataValue(void) { // EMU_printf("setDataValue dataSet[%d]: %d\n", p, dataSet[p]); } if (p < NUM_PARAMS) { - parameterLock[p] = 1; + parameterLock[p] = true; } updateValueSynth(p); } @@ -390,11 +389,10 @@ void getPadMainScreen(void) { if (joyState & J_B) { if (joyState & J_SELECT) { - recallMode = 0; + snapRecall(RECALL_SAVE); } else { - recallMode = 1; + snapRecall(RECALL_LOAD); } - snapRecall(); return; } @@ -441,11 +439,11 @@ void printbyte(uint8_t v1, uint8_t v2, uint8_t v3) { set_bkg_tiles(1, 16, 10, 1, bkg); } -void snapRecall(void) { +void snapRecall(RecallMode mode) { if (cursorRowMain == LAST_ROW) { for (l = 0; l < NUM_COLS; l++) { if (cursorEnable[l]) { - if (!recallMode) { + if (mode == RECALL_SAVE) { saveDataSet(l); } else { loadDataSet(l); @@ -454,7 +452,7 @@ void snapRecall(void) { } } } else { - if (!recallMode) { + if (mode == RECALL_SAVE) { for (j = 0; j != 24; j++) dataSetSnap[j] = dataSet[j]; } else { diff --git a/Source/screen/main.h b/Source/screen/main.h index 27751d4..788a2ad 100644 --- a/Source/screen/main.h +++ b/Source/screen/main.h @@ -3,7 +3,10 @@ #include #include -extern bool recallMode; +typedef enum RecallMode { + RECALL_SAVE = 0, + RECALL_LOAD = 1, +} RecallMode; // v 1.3.3 extern const uint8_t versionnumber[10]; @@ -54,7 +57,7 @@ void updateDisplay(void); void updateDisplaySynth(void); void showCursor(void); void setPlayMarker(void); -void snapRecall(void); +void snapRecall(RecallMode mode); void updateSynth(uint8_t synth); void showMainScreen(void); void renderMainScreen(void); diff --git a/Source/synth/common.c b/Source/synth/common.c index 8c17bc4..53eb41d 100644 --- a/Source/synth/common.c +++ b/Source/synth/common.c @@ -41,7 +41,7 @@ uint8_t outputSwitchValue[4] = {3, 3, 3, 3}; void setPitchBendFrequencyOffset(uint8_t synth) { uint16_t freqRange; uint16_t f = freq[noteStatus[synth].note]; - systemIdle = 0; + systemIdle = false; if (pbWheelIn[synth] & PBWHEEL_CENTER) { freqRange = freq[pbNoteRange[synth].high]; currentFreq = (uint16_t)(pbWheelIn[synth] - 0x7F); diff --git a/Source/synth/noi.c b/Source/synth/noi.c index 7eb0c85..cc11f2e 100644 --- a/Source/synth/noi.c +++ b/Source/synth/noi.c @@ -51,7 +51,7 @@ void playNoteNoi(void) { if (valueByte == 0) { // Note off if (noteStatus[NOI].note == noteIndex) { - noteStatus[NOI].active = 0; + noteStatus[NOI].active = false; if (!noiSus) { rAUD4ENV = 0x00; @@ -85,7 +85,7 @@ void playNoteNoi(void) { } void setPitchBendFrequencyOffsetNoise(void) { - systemIdle = 0; + systemIdle = false; if (pbWheelIn[NOI] & PBWHEEL_CENTER) { // noteStatus[NOI].note = noteStatus[NOI].note; currentFreq = noiFreq[noteStatus[NOI].note + diff --git a/Source/synth/wav.c b/Source/synth/wav.c index 6f8d453..92d99d5 100644 --- a/Source/synth/wav.c +++ b/Source/synth/wav.c @@ -166,7 +166,7 @@ void playNoteWav(void) { pbNoteRange[WAV].high = noteIndex + pbRange[WAV]; noteStatus[WAV].active = true; - cueWavSweep = 1; + cueWavSweep = true; wavNoteOffTrigger = false; } @@ -179,7 +179,7 @@ void updateWavSweep(void) { wavCurrentFreq = currentFreqData[WAV] - (counterWav << wavSweepSpeed); if (!(wavSweepSpeed >> 3U) && (wavCurrentFreq > 0x898U)) { wavCurrentFreq = 0U; - cueWavSweep = 0U; + cueWavSweep = false; } rAUD3HIGH = wavCurrentFreq >> 8U; rAUD3LOW = wavCurrentFreq; @@ -211,5 +211,5 @@ void loadWav(uint8_t offset) { rAUD3LOW = wavCurrentFreq; rAUD3HIGH = (wavCurrentFreq >> 8U) | AUDHIGH_RESTART; - systemIdle = 0; + systemIdle = false; }