diff --git a/plugin/calls.txt b/plugin/calls.txt index 598b56a..3b05869 100644 --- a/plugin/calls.txt +++ b/plugin/calls.txt @@ -12,9 +12,9 @@ 1 CALF $0AF8 // voice functions 1 CALF $0B30 // voice functions 1 CALF $0BA9 // Sustain on/off - 1 CALF $0BCC // adjusts switch values - 1 CALF $0BDA // adjusts switch values - 1 CALF $0BEB // adjusts switch values + 1 CALF $0BCC // range switch values + 1 CALF $0BDA // osc switch values + 1 CALF $0BEB // both range and osc values 1 CALF $0C0C // switches2 values 1 CALF $0C54 // switches values 1 CALF $0F27 // maybe tape? diff --git a/plugin/ic1.cpp b/plugin/ic1.cpp index fbd73f8..2824ef7 100644 --- a/plugin/ic1.cpp +++ b/plugin/ic1.cpp @@ -214,8 +214,9 @@ // 0177: 17 01 ORI A,$01 // transpose on // 0179: 63 c8 STAW $FFC8 // save it // 017b: 78 00 CALF $0800_showTranspose - - +// ------------------------------------------------------------- +// done with transpose? +// ------------------------------------------------------------- // 017d: 24 ff 1f LXI DE,$1FFF // select keypad MUX // 0180: 69 de MVI A,$DE // 0182: 3a STAX (DE) // column 6 @@ -231,96 +232,103 @@ // 0192: 01 cd LDAW $FFCD // some flag // 0194: 07 10 ANI A,$10 // // 0196: 74 f8 bf EQAW $FFBF // some flag -// 0199: 71 c0 00 MVIW $FFC0_runningStatus,$00 -// 019c: 63 bf STAW $FFBF -// 019e: 24 ff 1f LXI DE,$1FFF -// 01a1: 34 50 ff LXI HL,$FF50 -// 01a4: 6a e8 MVI B,$E8 -// 01a6: 0a MOV A,B -// 01a7: 3a STAX (DE) +// 0199: 71 c0 00 MVIW $FFC0_runningStatus,$00 // clear running status +// 019c: 63 bf STAW $FFBF // save flag + +// scan keys again +// 019e: 24 ff 1f LXI DE,$1FFF // keypad MUX +// 01a1: 34 50 ff LXI HL,$FF50 // key bitfield +// 01a4: 6a e8 MVI B,$E8 // first column +// 01a6: 0a MOV A,B +// 01a7: 3a STAX (DE) // enable // 01a8: 00 NOP // 01a9: 00 NOP -// 01aa: 4c c0 MOV A,PA -// 01ac: 1b MOV C,A -// 01ad: 77 00 EQI A,$00 -// 01af: 15 87 80 ORIW $FF87,$80 +// 01aa: 4c c0 MOV A,PA // wait +// 01ac: 1b MOV C,A // save +// 01ad: 77 00 EQI A,$00 // is it zero +// 01af: 15 87 80 ORIW $FF87,$80 // yes, set All Notes Off flag // 01b2: 0a MOV A,B -// 01b3: 17 10 ORI A,$10 -// 01b5: 3a STAX (DE) -// 01b6: 0b MOV A,C -// 01b7: 70 93 XRAX (HL) -// 01b9: 48 0c SK Z -// 01bb: 79 96 CALF $0996 -// 01bd: 0b MOV A,C -// 01be: 3d STAX (HL+) -// 01bf: 42 INR B -// 01c0: 48 0b SK HC -// 01c2: e3 JR $01A6 -// 01c3: 55 87 80 OFFIW $FF87,$80 -// 01c6: d3 JR $01DA -// 01c7: 5e 87 BIT 6,$FF87 -// 01c9: d0 JR $01DA -// 01ca: 69 f9 MVI A,$F9 -// 01cc: 79 e8 CALF $09E8_sendToTx -// 01ce: 69 b0 MVI A,$B0 -// 01d0: 79 d5 CALF $09D5 -// 01d2: 69 7b MVI A,$7B +// 01b3: 17 10 ORI A,$10 +// 01b5: 3a STAX (DE) // disable +// 01b6: 0b MOV A,C // get bitfield back +// 01b7: 70 93 XRAX (HL) // compare with bitfield already stored +// 01b9: 48 0c SK Z // has it changed +// 01bb: 79 96 CALF $0996 // yes, so we need to do MIDI +// 01bd: 0b MOV A,C // get bitfield back +// 01be: 3d STAX (HL+) // save, incrementing HL, in the bitfield RAM +// 01bf: 42 INR B // next column +// 01c0: 48 0b SK HC // if we rolled over a nybble skip +// 01c2: e3 JR $01A6 // go back for the next column +// 01c3: 55 87 80 OFFIW $FF87,$80 // there are keys held +// 01c6: d3 JR $01DA // jump ahead +// 01c7: 5e 87 BIT 6,$FF87 // we already sent All Notes Off +// 01c9: d0 JR $01DA // jump ahead and flag All notes off as Sent +// 01ca: 69 f9 MVI A,$F9 +// 01cc: 79 e8 CALF $09E8_sendToTx // enable MIDI output +// 01ce: 69 b0 MVI A,$B0 // control change +// 01d0: 79 d5 CALF $09D5 // send and clear running status +// 01d2: 69 7b MVI A,$7B // All Notes Off // 01d4: 79 e8 CALF $09E8_sendToTx -// 01d6: 69 00 MVI A,$00 +// 01d6: 69 00 MVI A,$00 // off // 01d8: 79 e8 CALF $09E8_sendToTx -// 01da: 01 87 LDAW $FF87 +// 01da: 01 87 LDAW $FF87 // shift bit 7 to bit 6 to show we've already done it // 01dc: 48 21 SLR A // 01de: 63 87 STAW $FF87 -// 01e0: 6a 0d MVI B,$0D -// 01e2: 34 3d ff LXI HL,$FF3D -// 01e5: 24 57 ff LXI DE,$FF57 -// 01e8: 71 d0 00 MVIW $FFD0,$00 -// 01eb: af 10 LDAX (HL+$10) -// 01ed: 74 3a 03 LTI B,$03 -// 01f0: 74 3a 0b LTI B,$0B -// 01f3: c3 JR $01F7 -// 01f4: 70 9a ORAX (DE) -// 01f6: 23 DCX DE -// 01f7: 1b MOV C,A -// 01f8: 70 93 XRAX (HL) -// 01fa: 48 0c SK Z -// 01fc: 7a 18 CALF $0A18 -// 01fe: 0b MOV A,C -// 01ff: 3b STAX (HL) -// 0200: 33 DCX HL -// 0201: 52 DCR B -// 0202: e8 JR $01EB -// 0203: 65 d0 ff NEIW $FFD0,$FF + +// now consider bits from MIDI +// 01e0: 6a 0d MVI B,$0D // 13 bytes, 104 keys +// 01e2: 34 3d ff LXI HL,$FF3D // top of note bitfield +// 01e5: 24 57 ff LXI DE,$FF57 // top of keyboard bitfield +// 01e8: 71 d0 00 MVIW $FFD0,$00 // zero out +// 01eb: af 10 LDAX (HL+$10) // fetch MIDI bitfield +// 01ed: 74 3a 03 LTI B,$03 // B<3, skip +// 01f0: 74 3a 0b LTI B,$0B // B<11, skip - these select just the 8 bytes of keyboard scan +// 01f3: c3 JR $01F7 // it didn't skip, ignore keyboard +// 01f4: 70 9a ORAX (DE) // combine with the keyboard bitfield +// 01f6: 23 DCX DE // next byte down +// 01f7: 1b MOV C,A // save +// 01f8: 70 93 XRAX (HL) // compare with current note bitfield +// 01fa: 48 0c SK Z // has it changed +// 01fc: 7a 18 CALF $0A18 // yes, handle that +// 01fe: 0b MOV A,C // get bitfield back +// 01ff: 3b STAX (HL) // store in current note bitfield +// 0200: 33 DCX HL // next bitfield down +// 0201: 52 DCR B // count down bitfield bytes +// 0202: e8 JR $01EB // back for the next one +// 0203: 65 d0 ff NEIW $FFD0,$FF // ffd0 remains a mystery // 0206: 7b 9e CALF $0B9E_clrNoteBits -// 0208: 24 ff 1f LXI DE,$1FFF -// 020b: 34 a4 ff LXI HL,$FFA4 -// 020e: 6a da MVI B,$DA +// ------------------------------------------------------- +// now consider the keypad buttons +// ------------------------------------------------------- +// 0208: 24 ff 1f LXI DE,$1FFF // keypad mux +// 020b: 34 a4 ff LXI HL,$FFA4 // raw switch data +// 020e: 6a da MVI B,$DA // mux column, start with bank buttons // 0210: 0a MOV A,B -// 0211: 3a STAX (DE) -// 0212: 00 NOP -// 0213: 00 NOP -// 0214: 4c c0 MOV A,PA -// 0216: 1b MOV C,A +// 0211: 3a STAX (DE) // enable +// 0212: 00 NOP // wait +// 0213: 00 NOP +// 0214: 4c c0 MOV A,PA // read +// 0216: 1b MOV C,A // save // 0217: 0a MOV A,B -// 0218: 17 20 ORI A,$20 +// 0218: 17 20 ORI A,$20 // disable // 021a: 3a STAX (DE) -// 021b: 0b MOV A,C -// 021c: 70 93 XRAX (HL) -// 021e: bf 06 STAX (HL+$06) -// 0220: 60 8b ANA A,C -// 0222: bf 0c STAX (HL+$0C) -// 0224: 0b MOV A,C -// 0225: 3d STAX (HL+) -// 0226: 42 INR B -// 0227: 48 0b SK HC -// 0229: e6 JR $0210 -// 022a: 58 b6 BIT 0,$FFB6 -// 022c: c2 JR $022F -// 022d: 4e 3f JRE $026E -// 022f: 5b ae BIT 3,$FFAE -// 0231: d6 JR $0248 +// 021b: 0b MOV A,C // get it back +// 021c: 70 93 XRAX (HL) // has it changed? +// 021e: bf 06 STAX (HL+$06) // store xored value +// 0220: 60 8b ANA A,C // AND with original value +// 0222: bf 0c STAX (HL+$0C) // store ANDed value +// 0224: 0b MOV A,C // get value back +// 0225: 3d STAX (HL+) // store at HL, next byte +// 0226: 42 INR B // next column +// 0227: 48 0b SK HC // did it roll over nybble +// 0229: e6 JR $0210 // no, loop back for next +// 022a: 58 b6 BIT 0,$FFB6 // test mode? +// 022c: c2 JR $022F // no +// 022d: 4e 3f JRE $026E // interpret buttons for test mode +// 022f: 5b ae BIT 3,$FFAE // has the MIDI Channel button changed? +// 0231: d6 JR $0248 // no // 0232: 5b a8 BIT 3,$FFA8_midiSwitch ; MIDI CH button -// 0234: d1 JR $0246 +// 0234: d1 JR $0246 // button was released // 0235: 78 43 CALF $0843_sendOmniOffPoly // 0237: 7b 9a CALF $0B9A_clrMidiBits // 0239: 78 28 CALF $0828_centreBend @@ -332,29 +340,31 @@ // 0245: c2 JR $0248 // 0246: 7d 3c CALF $0D3C_rstrDigitPatt // 0248: 5b a8 BIT 3,$FFA8_midiSwitch ; MIDI CH button -// 024a: 4e 4f JRE $029B -// 024c: 55 87 40 OFFIW $FF87,$40 +// 024a: 4e 4f JRE $029B // if it's not still being pressed? +// 024c: 55 87 40 OFFIW $FF87,$40 // did we send all notes off? // 024f: db JR $026B -// 0250: 64 4a 08 ONI PC,$08 -// 0253: d7 JR $026B -// 0254: 25 b0 00 GTIW $FFB0,$00 -// 0257: c7 JR $025F +// 0250: 64 4a 08 ONI PC,$08 // sustain pedal +// 0253: d7 JR $026B +// 0254: 25 b0 00 GTIW $FFB0,$00 // any bank buttons pressed? +// 0257: c7 JR $025F // none pressed // 0258: 01 b0 LDAW $FFB0 -// 025a: 7c 9d CALF $0C9D -// 025c: 51 DCR A -// 025d: 78 13 CALF $0813 -// 025f: 25 b1 00 GTIW $FFB1,$00 -// 0262: c8 JR $026B -// 0263: 01 b1 LDAW $FFB1 -// 0265: 7c 9d CALF $0C9D -// 0267: 46 07 ADI A,$07 -// 0269: 78 13 CALF $0813 -// 026b: 54 5d 04 JMP $045D -// 026e: 5b b4 BIT 3,$FFB4 -// 0270: c2 JR $0273 -// 0271: 78 5c CALF $085C // tell the module board to zero the DAC +// 025a: 7c 9d CALF $0C9D // find which button is pressed +// 025c: 51 DCR A // subtract 1, 0-7 +// 025d: 78 13 CALF $0813 // store MIDI channel number and set flags +// 025f: 25 b1 00 GTIW $FFB1,$00 // any patch buttons pressed +// 0262: c8 JR $026B // no +// 0263: 01 b1 LDAW $FFB1 // get bitfield +// 0265: 7c 9d CALF $0C9D // find which button is pressed +// 0267: 46 07 ADI A,$07 // add 7, 8-15 +// 0269: 78 13 CALF $0813 // store MIDI channel number and set flags +// 026b: 54 5d 04 JMP $045D // go on ahead + +// set up testmode +// 026e: 5b b4 BIT 3,$FFB4 // MIDI CH pressed? +// 0270: c2 JR $0273 // no, go on +// 0271: 78 5c CALF $085C // tell the module board to zero the DAC // 0273: 01 a8 LDAW $FFA8_midiSwitch -// 0275: 48 21 SLR A +// 0275: 48 21 SLR A // // 0277: 07 38 ANI A,$38 // 0279: 1b MOV C,A // 027a: 01 c8 LDAW $FFC8 @@ -406,7 +416,7 @@ // 02d4: 63 c8 STAW $FFC8 // 02d6: 58 b6 BIT 0,$FFB6 // 02d8: cc JR $02E5 -// 02d9: 69 fd MVI A,$FD // select module board // select module board +// 02d9: 69 fd MVI A,$FD // select module board // 02db: 79 e8 CALF $09E8_sendToTx // 02dd: 5e c8 BIT 6,$FFC8 // 02df: 69 86 MVI A,$86 @@ -1388,33 +1398,35 @@ // 0993: 79 e8 CALF $09E8_sendToTx // 0995: b8 RET -// voice mapper? -// 0996: 19 MOV EAL,A -// 0997: 0a MOV A,B +// handles note on/off from key bitfield +// sends velocity byte after note on +// called with column in B, bitfield in C, difference in A +// 0996: 19 MOV EAL,A // save difference +// 0997: 0a MOV A,B // 0998: 07 07 ANI A,$07 -// 099a: 7a 0d CALF $0A0D +// 099a: 7a 0d CALF $0A0D // routine that multiplies A by 8 and saves it in EAH then stores C to FFC3 // 099c: b3 PUSH HL // 099d: b1 PUSH BC -// 099e: 6a 00 MVI B,$00 -// 09a0: 09 MOV A,EAL -// 09a1: 1b MOV C,A -// 09a2: 48 03 SLRC C -// 09a4: d5 JR $09BA -// 09a5: 34 08 00 LXI HL,$0008 -// 09a8: ad LDAX (HL+B) -// 09a9: 74 c8 c3 ONAW $FFC3 -// 09ac: c7 JR $09B4 -// 09ad: 79 c2 CALF $09C2 -// 09af: 69 40 MVI A,$40 +// 099e: 6a 00 MVI B,$00 // +// 09a0: 09 MOV A,EAL // difference +// 09a1: 1b MOV C,A // into C +// 09a2: 48 03 SLRC C // shift right, skip if carry +// 09a4: d5 JR $09BA // bit 7 was 0 +// 09a5: 34 08 00 LXI HL,$0008 // bit 7 was 1 +// 09a8: ad LDAX (HL+B) // get bit value +// 09a9: 74 c8 c3 ONAW $FFC3 // is that bit set in the saved bitfield +// 09ac: c7 JR $09B4 // no +// 09ad: 79 c2 CALF $09C2 // send Note On to MIDI +// 09af: 69 40 MVI A,$40 // velocity is 64 // 09b1: 79 e8 CALF $09E8_sendToTx -// 09b3: c6 JR $09BA -// 09b4: 79 c2 CALF $09C2 -// 09b6: 69 00 MVI A,$00 +// 09b3: c6 JR $09BA // loop around to next bit +// 09b4: 79 c2 CALF $09C2 // Note Off is send Note On to MIDI +// 09b6: 69 00 MVI A,$00 // but with velocity 0 // 09b8: 79 e8 CALF $09E8_sendToTx -// 09ba: 42 INR B -// 09bb: 74 7a 08 EQI B,$08 -// 09be: e3 JR $09A2 -// 09bf: a1 POP BC +// 09ba: 42 INR B // next nit +// 09bb: 74 7a 08 EQI B,$08 // if we've done all 8 +// 09be: e3 JR $09A2 // we haven't, loop +// 09bf: a1 POP BC // restore and return // 09c0: a3 POP HL // 09c1: b8 RET @@ -1423,10 +1435,10 @@ // 09c4: 79 e8 CALF $09E8_sendToTx // 09c6: 69 90 MVI A,$90 // 09c8: 79 dc CALF $09DC -// 09ca: 08 MOV A,EAH -// 09cb: 60 9a ORA A,B -// 09cd: 46 18 ADI A,$18 -// 09cf: 74 c0 be ADDW $FFBE_transpose +// 09ca: 08 MOV A,EAH // contains column number *8 +// 09cb: 60 9a ORA A,B // contains bit number count (lower 3 bits) of note +// 09cd: 46 18 ADI A,$18 // +24 +// 09cf: 74 c0 be ADDW $FFBE_transpose // +transpose // 09d2: 79 e8 CALF $09E8_sendToTx // 09d4: b8 RET @@ -1436,16 +1448,16 @@ // 09db: cc JR $09E8_sendToTx // add MIDI channel and send -// 09dc: 47 80 ONI A,$80 -// 09de: c9 JR $09E8_sendToTx -// 09df: 74 c0 bd ADDW $FFBD_midiChannel -// 09e2: 74 e8 c0 NEAW $FFC0_runningStatus -// 09e5: b8 RET +// 09dc: 47 80 ONI A,$80 // is it a status byte +// 09de: c9 JR $09E8_sendToTx // no, just send it +// 09df: 74 c0 bd ADDW $FFBD_midiChannel // yes, add the MIDI channel +// 09e2: 74 e8 c0 NEAW $FFC0_runningStatus // skip if not the same as the current running status +// 09e5: b8 RET // yes it is, return // set running status -// 09e6: 63 c0 STAW $FFC0_runningStatus +// 09e6: 63 c0 STAW $FFC0_runningStatus // save the running status and fall through to // send to TX -// 09e8: b3 PUSH HL +// 09e8: b3 PUSH HL // send to TX // 09e9: b1 PUSH BC // 09ea: b2 PUSH DE // 09eb: 1b MOV C,A