#include "cpuboard.hpp" #include void Assigner::noteOn() { // called from serial interrupt handler // sets or clears a bit in the "MIDI Key pressed" bitfield // note that RAM addresses normally set to 0xff40 are reduced to 0x0040 // 06ca a = ram[0x3e]; // first byte is note value c = 0x40; // fake velocity // bring note into range // 06cc if (a <= 0x17) a += 12; // 06d0 if (a >= 0x6d) a -= 12; // 06d4 subtract transpose from ffbe // 06d7 mov b,a; slr b; slr b; slr b b = a >> 3; a &= 0x07; // 06e0 note on? if (ram[0x4e] != 0x90) goto h06f9; // no, skip to note off // 06e4 velocity zero? if (c == 0) goto h06f9; // yes, skip to note off // otherwise handle note on // 06e8 lxi hl,$0008; ldax (a+hl) for table of bits a = 1 << a; c = a; hl = 0x0040; // note bit flags a = ram[hl + b]; // byte pointed to by upper part a |= c; // or in the bit value ram[hl+b] = a; // save it in RAM // 06f4 mviw $003f, $01 expect two bytes; jre $064c return from interrupt return; h06f9: // note off a = 0xff ^ (1 << a); c = a; hl = 0x0040; // note bit flags a = ram[hl + b]; // byte pointed to by upper part a &= c; // mask off the bit ram[hl+b] = a; // save it in RAM return; }