Skip to content

Commit

Permalink
Merge pull request #22 from anarkiwi/pthru
Browse files Browse the repository at this point in the history
Add configuration for transparent mode.
  • Loading branch information
anarkiwi committed May 28, 2021
2 parents 6e17191 + 9866ba7 commit a465c14
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,17 @@ The C64 can send Vessel a command, by sending byte 0xFD (not used by MIDI),
and then a command, and then a fixed number of data bytes (depending on the
command - unless otherwise specified, a command is followed by 0 data bytes).

By default, NMI on external input is off, all MIDI channels are masked and
all status messages will be masked (no MIDI messages will be sent to the C64)
and MIDI through is disabled.
By default, transparent mode is off, NMI on external input is off, all MIDI channels
are masked and all status messages will be masked (no MIDI messages will be sent
to the C64) and MIDI through is disabled.

|byte|command |arg bytes|description
|----|------------|---------|--------------------------------------------------------------------------
|0x00|Reset | |Vessel will reset to default config.
|0x01|Purge | |Vessel will discard any buffered data.
|0x02|Panic | |Reserved for future implementation. Send all notes off on all channels.
|0x03|Version | |Vessel will return a version string (currently C64 screen code "vessel00").
|0x04|Config |CF |CF bit 0 enables NMI, bit 1 enables MIDI through.
|0x04|Config |CF |CF bit 0 enables NMI, bit 1 enables MIDI through, bit 2 enables transparent (no MIDI parsing) mode.
|0x05|Channel mask|HH LL |High byte (HH), low byte (LL) for channels 1 to 16.
|0x06|Status mask |HH LL |High byte (HH), low byte (LL) for channel-less messages F0 to FF.
|0x07|Control mask|CM |MSB unused, 3 high bits command mask, 4 low bits channel.
Expand Down
10 changes: 9 additions & 1 deletion vessel.ino
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ volatile byte outBufWritePtr = 0;
volatile byte *outBufReadPtr = outBuf;
volatile IsrModeEnum isrMode = ISR_INPUT;
volatile bool nmiEnabled = false;
volatile bool transparent = false;
volatile bool status = false;
volatile uint16_t receiveChannelMask = 0;
volatile uint16_t receiveStatusMask = 0;
Expand Down Expand Up @@ -347,7 +348,12 @@ inline bool drainOutBuf() {
flagPin.write(LOW);
return true;
} else if (uartRxready()) {
fs.set(uartRead());
if (transparent) {
NMI_WRAP(fs.write(uartRead()));
flagPin.write(LOW);
} else {
fs.set(uartRead());
}
blink();
return true;
}
Expand Down Expand Up @@ -416,6 +422,7 @@ inline void resetCmd() {
receiveStatusMask = 0;
memset(receiveCommandMask, 0, sizeof(receiveCommandMask));
nmiEnabled = false;
transparent = false;
MIDI.turnThruOff();
purgeCmd();
}
Expand All @@ -436,6 +443,7 @@ inline void configFlagsCmd() {
} else {
MIDI.turnThruOff();
}
transparent = configFlags & 4;
}

inline uint16_t get2bMask() {
Expand Down

0 comments on commit a465c14

Please sign in to comment.