reworked assigner note on
This commit is contained in:
parent
72fa8a2aab
commit
3e16f5314f
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include "cpuboard.hpp"
|
#include "cpuboard.hpp"
|
||||||
|
|
||||||
|
// startup needs to clear RAM etc
|
||||||
|
// 0xffbe = 0x0c; transpose = 12;
|
||||||
// Disassembly of assigner.bin, 8192 bytes [0x0 to 0x1fff]
|
// Disassembly of assigner.bin, 8192 bytes [0x0 to 0x1fff]
|
||||||
// ; start
|
// ; start
|
||||||
// 0000: 4e 9a JRE $009C
|
// 0000: 4e 9a JRE $009C
|
||||||
@ -20,7 +22,7 @@
|
|||||||
// 000a: 04 08 10 LXI SP,$1008
|
// 000a: 04 08 10 LXI SP,$1008
|
||||||
// 000d: 20 40 INRW $0040
|
// 000d: 20 40 INRW $0040
|
||||||
// 000f: 80 CALT ($0080)
|
// 000f: 80 CALT ($0080)
|
||||||
//
|
|
||||||
// ; bit patterns used for Note Off
|
// ; bit patterns used for Note Off
|
||||||
// ; ANDed with a flag byte to mask it off
|
// ; ANDed with a flag byte to mask it off
|
||||||
// 0010: fe JR $000F
|
// 0010: fe JR $000F
|
||||||
@ -30,7 +32,7 @@
|
|||||||
// 0014: ef JR $0004
|
// 0014: ef JR $0004
|
||||||
// 0015: df JR $0035
|
// 0015: df JR $0035
|
||||||
// 0016: bf 7f STAX (HL+$7F)
|
// 0016: bf 7f STAX (HL+$7F)
|
||||||
//
|
|
||||||
// ; timer/event
|
// ; timer/event
|
||||||
// 0018: 00 NOP
|
// 0018: 00 NOP
|
||||||
// 0019: 00 NOP
|
// 0019: 00 NOP
|
||||||
@ -873,7 +875,7 @@
|
|||||||
// 0592: 11 EXX
|
// 0592: 11 EXX
|
||||||
// 0593: aa EI
|
// 0593: aa EI
|
||||||
// 0594: 62 RETI
|
// 0594: 62 RETI
|
||||||
//
|
|
||||||
// ; serial interrupt handler
|
// ; serial interrupt handler
|
||||||
// 0595: 10 EXA
|
// 0595: 10 EXA
|
||||||
// 0596: 11 EXX
|
// 0596: 11 EXX
|
||||||
@ -910,7 +912,7 @@
|
|||||||
// 05d5: 75 a0 00 EQIW $00A0,$00
|
// 05d5: 75 a0 00 EQIW $00A0,$00
|
||||||
// 05d8: 71 a0 80 MVIW $00A0,$80
|
// 05d8: 71 a0 80 MVIW $00A0,$80
|
||||||
// 05db: d3 JR $05EF ; return from interrupt
|
// 05db: d3 JR $05EF ; return from interrupt
|
||||||
//
|
|
||||||
// ; handle control change
|
// ; handle control change
|
||||||
// 05dc: 1b MOV C,A
|
// 05dc: 1b MOV C,A
|
||||||
// 05dd: 0a MOV A,B
|
// 05dd: 0a MOV A,B
|
||||||
@ -927,7 +929,7 @@
|
|||||||
// 05f0: 11 EXX
|
// 05f0: 11 EXX
|
||||||
// 05f1: aa EI
|
// 05f1: aa EI
|
||||||
// 05f2: 62 RETI
|
// 05f2: 62 RETI
|
||||||
//
|
|
||||||
// ; wasn't control or note
|
// ; wasn't control or note
|
||||||
// 05f3: 67 c0 NEI A,$C0 ; program change?
|
// 05f3: 67 c0 NEI A,$C0 ; program change?
|
||||||
// 05f5: c4 JR $05FA
|
// 05f5: c4 JR $05FA
|
||||||
@ -1050,142 +1052,200 @@
|
|||||||
//
|
//
|
||||||
// ; handle note on/off?
|
// ; handle note on/off?
|
||||||
// ; called with status in $ff4e, value in $ff3e and velocity in C
|
// ; called with status in $ff4e, value in $ff3e and velocity in C
|
||||||
// 06ca: 01 3e LDAW $003E ; first byte
|
|
||||||
// 06cc: 27 17 GTI A,$17 ; greater than 23
|
void Assigner::noteOn(uint8_t c) {
|
||||||
// 06ce: 4e 36 JRE $0706 ; no, add an octave
|
// 06ca: 01 3e LDAW $003E ; first byte
|
||||||
// 06d0: 37 6d LTI A,$6D ; less than 108
|
a = ram[0x3e];
|
||||||
// 06d2: 4e 36 JRE $070A ; no, subtract an octave
|
h06cc:
|
||||||
// 06d4: 74 e0 be SUBW $00BE ; subtract a value - transpose?
|
// 06cc: 27 17 GTI A,$17 ; greater than 23
|
||||||
// 06d7: 1a MOV B,A ; save in b
|
// 06ce: 4e 36 JRE $0706 ; no, add an octave
|
||||||
// 06d8: 48 22 SLR B
|
if (a > 0x17) {
|
||||||
// 06da: 48 22 SLR B
|
// skip
|
||||||
// 06dc: 48 22 SLR B ; divide by 8
|
} else
|
||||||
// 06de: 07 07 ANI A,$07 ; lower three bits
|
goto h0706;
|
||||||
// 06e0: 75 4e 90 EQIW $004E,$90 ; note on?
|
h06d0:
|
||||||
// 06e3: d5 JR $06F9 ; no, jump ahead
|
// 06d0: 37 6d LTI A,$6D ; less than 108
|
||||||
// 06e4: 74 6b 00 NEI C,$00 ; velocity 0
|
// 06d2: 4e 36 JRE $070A ; no, subtract an octave
|
||||||
// 06e7: d1 JR $06F9 ; no, jump ahead
|
if (a < 0x6d) {
|
||||||
// ; otherwise fall through and handle Note On
|
// skip
|
||||||
// 06e8: 34 08 00 LXI HL,$0008 ; lookup table runs 01, 02, 04, 08, 10, 20, 40, 80
|
} else
|
||||||
// ; inverse of the one at 0x0010
|
goto h070a;
|
||||||
// 06eb: ac LDAX (HL+A) ; look up table based on note
|
// 06d4: 74 e0 be SUBW $00BE ; subtract a value - transpose?
|
||||||
// 06ec: 1b MOV C,A ; save
|
a -= ram[0xbe];
|
||||||
// 06ed: 34 40 ff LXI HL,$FF40 ; bit flags
|
// 06d7: 1a MOV B,A ; save in b
|
||||||
// 06f0: ad LDAX (HL+B) ; byte pointed to by upper part
|
b = a;
|
||||||
// 06f1: 60 9b ORA A,C ; or in whichever note is flagged
|
// 06d8: 48 22 SLR B
|
||||||
// 06f3: bd STAX (HL+B) ; save in flag
|
// 06da: 48 22 SLR B
|
||||||
//
|
// 06dc: 48 22 SLR B ; divide by 8
|
||||||
// ;
|
b >>= 3;
|
||||||
// 06f4: 71 3f 01 MVIW $003F,$01 ; expect two bytes
|
// 06de: 07 07 ANI A,$07 ; lower three bits
|
||||||
// 06f7: 4f 53 JRE $064C ; return
|
a &= 0x07;
|
||||||
//
|
// 06e0: 75 4e 90 EQIW $004E,$90 ; note on?
|
||||||
// ; note off?
|
// 06e3: d5 JR $06F9 ; no, jump ahead
|
||||||
// ; A contains lower three bits of note, B contains upper 4 bits
|
if (ram[0x4e] == 0x90) {
|
||||||
// 06f9: 34 10 00 LXI HL,$0010 ; lookup table runs fe, fd, fb, f7, ef, df, bf, 7f
|
// skip
|
||||||
// ; inverse of 0x0008
|
} else
|
||||||
// 06fc: ac LDAX (HL+A) ; look up the table based on the note
|
goto h06f9;
|
||||||
// 06fd: 1b MOV C,A ; fetch value, store in C
|
|
||||||
// 06fe: 34 40 ff LXI HL,$FF40 ; table in RAM
|
// 06e4: 74 6b 00 NEI C,$00 ; velocity 0
|
||||||
// 0701: ad LDAX (HL+B) ; $FF40 + upper four bits as offset
|
// 06e7: d1 JR $06F9 ; no, jump ahead
|
||||||
// 0702: 60 8b ANA A,C ; mask off the bit for the note
|
if (c != 0) {
|
||||||
// 0704: bd STAX (HL+B) ; store at $FF40 + offset
|
// skip
|
||||||
// 0705: ee JR $06F4
|
} else
|
||||||
//
|
goto h06f9;
|
||||||
// ; add or subtract an octave to bring out-of-range notes in
|
|
||||||
// 0706: 46 0c ADI A,$0C ; add 12 to note value in A
|
// ; otherwise fall through and handle Note On
|
||||||
// 0708: 4f c2 JRE $06CC ; jump back and test if it's in range yet
|
// 06e8: 34 08 00 LXI HL,$0008 ; lookup table runs 01, 02, 04, 08, 10, 20, 40, 80
|
||||||
// 070a: 66 0c SUI A,$0C ; subtract 12 from note value in A
|
// ; inverse of the one at 0x0010
|
||||||
// 070c: 4f c2 JRE $06D0 ; jump back and test if it's in range yet
|
// 06eb: ac LDAX (HL+A) ; look up table based on note
|
||||||
//
|
hl = 0x08;
|
||||||
// ; store first value
|
a = bitMask[hl + a]; // fetch bit corresponding to lower bits of note
|
||||||
// 070e: 63 3e STAW $003E
|
|
||||||
// 0710: 4f 3a JRE $064C ; return from interrupt
|
// 06ec: 1b MOV C,A ; save
|
||||||
//
|
// 06ed: 34 40 ff LXI HL,$FF40 ; bit flags
|
||||||
// ; control change?
|
// 06f0: ad LDAX (HL+B) ; byte pointed to by upper part
|
||||||
// 0712: 01 3e LDAW $003E ; parameter?
|
// 06f1: 60 9b ORA A,C ; or in whichever note is flagged
|
||||||
// 0714: 27 7a GTI A,$7A ; all notes off, or higher?
|
// 06f3: bd STAX (HL+B) ; save in flag
|
||||||
// 0716: 4e 35 JRE $074D
|
|
||||||
// 0718: 45 4f 40 ONIW $004F,$40 ; flag variable
|
c = a; // save A for later
|
||||||
// 071b: 4f d7 JRE $06F4
|
hl = 0x40; // MIDI key bitmap
|
||||||
// 071d: 67 7b NEI A,$7B ; all notes off?
|
a = ram[hl + b];
|
||||||
// 071f: 4e 51 JRE $0772
|
a |= c;
|
||||||
// 0721: 47 02 ONI A,$02 ; mono/poly (but ignored according to the manual)
|
ram[hl + b] = a; // OR in the bit we saved and save it back
|
||||||
// 0723: c8 JR $072C
|
|
||||||
// 0724: 05 4f fd ANIW $004F,$FD ; flag variable
|
// ; this sets up the MIDI routine to expect a two-byte message again
|
||||||
// 0727: 47 01 ONI A,$01 ; omni on
|
// which allows for running status
|
||||||
// 0729: 4e 4d JRE $0778 ; set omni off
|
// 06f4: 71 3f 01 MVIW $003F,$01 ; expect two bytes
|
||||||
// 072b: c8 JR $0734
|
// 06f7: 4f 53 JRE $064C ; return
|
||||||
// 072c: 05 4f fe ANIW $004F,$FE ; clear flag variable bit 0
|
return;
|
||||||
// 072f: 47 01 ONI A,$01 ; if mono on?
|
|
||||||
// 0731: 15 4f 01 ORIW $004F,$01 ; set flag variable?
|
h06f9:
|
||||||
// 0734: 69 03 MVI A,$03
|
// ; note off?
|
||||||
// 0736: 74 88 4f ANAW $004F
|
// ; A contains lower three bits of note, B contains upper 4 bits
|
||||||
// 0739: 15 4f 20 ORIW $004F,$20
|
// 06f9: 34 10 00 LXI HL,$0010 ; lookup table runs fe, fd, fb, f7, ef, df, bf, 7f
|
||||||
// 073c: 77 01 EQI A,$01
|
// ; inverse of 0x0008
|
||||||
// 073e: 05 4f df ANIW $004F,$DF
|
// 06fc: ac LDAX (HL+A) ; look up the table based on the note
|
||||||
// 0741: 6a 0d MVI B,$0D ; 14 values
|
hl = 0x10;
|
||||||
// 0743: 69 00 MVI A,$00 ; zero out note flags
|
a = bitMask[hl + a];
|
||||||
// 0745: 34 40 ff LXI HL,$FF40 ; table in RAM for note flags
|
|
||||||
// 0748: 3d STAX (HL+) ; store
|
// 06fd: 1b MOV C,A ; fetch value, store in C
|
||||||
// 0749: 52 DCR B
|
// 06fe: 34 40 ff LXI HL,$FF40 ; table in RAM
|
||||||
// 074a: fd JR $0748 ; loop
|
// 0701: ad LDAX (HL+B) ; $FF40 + upper four bits as offset
|
||||||
// 074b: 4f a7 JRE $06F4 ; expect two bytes
|
// 0702: 60 8b ANA A,C ; mask off the bit for the note
|
||||||
// 074d: 77 40 EQI A,$40 ; sustain
|
// 0704: bd STAX (HL+B) ; store at $FF40 + offset
|
||||||
// 074f: ce JR $075E
|
|
||||||
// 0750: 74 6b 00 NEI C,$00 ; value is zero
|
c = a;
|
||||||
// 0753: c5 JR $0759
|
hl = 0x40;
|
||||||
// 0754: 15 b6 10 ORIW $00B6,$10 ; sustain on
|
a = ram[hl + b];
|
||||||
// 0757: 4f 9b JRE $06F4
|
a &= c;
|
||||||
// 0759: 15 b6 08 ORIW $00B6,$08 ; sustain off
|
ram[hl + b] = a;
|
||||||
// 075c: 4f 96 JRE $06F4
|
return;
|
||||||
// 075e: 77 01 EQI A,$01 ; mod wheel
|
|
||||||
// 0760: 4f 92 JRE $06F4 ; expect two bytes and return (running status)
|
// jump back to set up for running status
|
||||||
// 0762: 55 a8 20 OFFIW $00A8,$20 ; midi mode 0
|
// 0705: ee JR $06F4
|
||||||
// 0765: c7 JR $076D ; continue
|
|
||||||
// 0766: 0b MOV A,C ; get byte
|
h0706:
|
||||||
// 0767: 17 80 ORI A,$80 ; set bit?
|
// ; add or subtract an octave to bring out-of-range notes in
|
||||||
// 0769: 63 a2 STAW $00A2 ; mod wheel value?
|
// 0706: 46 0c ADI A,$0C ; add 12 to note value in A
|
||||||
// 076b: 4f 87 JRE $06F4 ; expect two bytes and return (running status)
|
// 0708: 4f c2 JRE $06CC ; jump back and test if it's in range yet
|
||||||
// 076d: 71 a2 80 MVIW $00A2,$80 ; mod wheel off?
|
a += 12; // semitones
|
||||||
// 0770: 4f 82 JRE $06F4 ; expect two bytes and return
|
goto h06cc; // test again
|
||||||
//
|
|
||||||
// ; handle all notes off
|
h070a:
|
||||||
// 0772: 5d 4f BIT 5,$004F ; all notes off?
|
// 070a: 66 0c SUI A,$0C ; subtract 12 from note value in A
|
||||||
// 0774: 4f 7e JRE $06F4 ; expect two bytes and return
|
// 070c: 4f c2 JRE $06D0 ; jump back and test if it's in range yet
|
||||||
// 0776: 4f c9 JRE $0741 ; wipe a table
|
a -= 12; // semitones
|
||||||
// 0778: 74 7b 01 EQI C,$01
|
goto h06d0;
|
||||||
// 077b: 15 4f 02 ORIW $004F,$02
|
|
||||||
// 077e: 4f b4 JRE $0734
|
// ; store first value
|
||||||
//
|
// 070e: 63 3e STAW $003E
|
||||||
// ; program change
|
// 0710: 4f 3a JRE $064C ; return from interrupt
|
||||||
// 0780: 55 a8 20 OFFIW $00A8,$20 ; Midi mode 0?
|
//
|
||||||
// 0783: c5 JR $0789 ; skip ahead and do nothing
|
// ; control change?
|
||||||
// 0784: 0b MOV A,C ; get prog
|
// 0712: 01 3e LDAW $003E ; parameter?
|
||||||
// 0785: 17 80 ORI A,$80 ; bit 7
|
// 0714: 27 7a GTI A,$7A ; all notes off, or higher?
|
||||||
// 0787: 63 a3 STAW $00A3 ; store
|
// 0716: 4e 35 JRE $074D
|
||||||
// 0789: 71 3f 00 MVIW $003F,$00 ; expect one byte (running status)
|
// 0718: 45 4f 40 ONIW $004F,$40 ; flag variable
|
||||||
// 078c: 54 4c 06 JMP $064C ; return
|
// 071b: 4f d7 JRE $06F4
|
||||||
//
|
// 071d: 67 7b NEI A,$7B ; all notes off?
|
||||||
// ; bend
|
// 071f: 4e 51 JRE $0772
|
||||||
// 078f: 55 a8 20 OFFIW $00A8,$20 ; midi mode 0?
|
// 0721: 47 02 ONI A,$02 ; mono/poly (but ignored according to the manual)
|
||||||
// 0792: d7 JR $07AA ; clear and end
|
// 0723: c8 JR $072C
|
||||||
// 0793: 0b MOV A,C
|
// 0724: 05 4f fd ANIW $004F,$FD ; flag variable
|
||||||
// 0794: 18 MOV EAH,A ; EAH gets msb
|
// 0727: 47 01 ONI A,$01 ; omni on
|
||||||
// 0795: 01 3e LDAW $003E ; lsb
|
// 0729: 4e 4d JRE $0778 ; set omni off
|
||||||
// 0797: 48 25 SLL A ; multiply by two
|
// 072b: c8 JR $0734
|
||||||
// 0799: 19 MOV EAL,A ; EA contains 14-bit bend multiplied by 2
|
// 072c: 05 4f fe ANIW $004F,$FE ; clear flag variable bit 0
|
||||||
// 079a: 48 a4 DSLL EA ; left aligned
|
// 072f: 47 01 ONI A,$01 ; if mono on?
|
||||||
// 079c: 08 MOV A,EAH
|
// 0731: 15 4f 01 ORIW $004F,$01 ; set flag variable?
|
||||||
// 079d: 47 80 ONI A,$80 ; negative?
|
// 0734: 69 03 MVI A,$03
|
||||||
// 079f: c4 JR $07A4
|
// 0736: 74 88 4f ANAW $004F
|
||||||
// 07a0: 63 a1 STAW $00A1 ; save in ffa1
|
// 0739: 15 4f 20 ORIW $004F,$20
|
||||||
// 07a2: 4f 50 JRE $06F4 ; return, two byte running status
|
// 073c: 77 01 EQI A,$01
|
||||||
// 07a4: 16 ff XRI A,$FF ; invert
|
// 073e: 05 4f df ANIW $004F,$DF
|
||||||
// 07a6: 63 a0 STAW $00A0 ; save in ffa0
|
// 0741: 6a 0d MVI B,$0D ; 14 values
|
||||||
// 07a8: 4f 4a JRE $06F4 ; return, two byte running status
|
// 0743: 69 00 MVI A,$00 ; zero out note flags
|
||||||
// 07aa: 71 a1 80 MVIW $00A1,$80 ; reset bend?
|
// 0745: 34 40 ff LXI HL,$FF40 ; table in RAM for note flags
|
||||||
// 07ad: 4f 45 JRE $06F4 ; return, two byte running status
|
// 0748: 3d STAX (HL+) ; store
|
||||||
//
|
// 0749: 52 DCR B
|
||||||
|
// 074a: fd JR $0748 ; loop
|
||||||
|
// 074b: 4f a7 JRE $06F4 ; expect two bytes
|
||||||
|
// 074d: 77 40 EQI A,$40 ; sustain
|
||||||
|
// 074f: ce JR $075E
|
||||||
|
// 0750: 74 6b 00 NEI C,$00 ; value is zero
|
||||||
|
// 0753: c5 JR $0759
|
||||||
|
// 0754: 15 b6 10 ORIW $00B6,$10 ; sustain on
|
||||||
|
// 0757: 4f 9b JRE $06F4
|
||||||
|
// 0759: 15 b6 08 ORIW $00B6,$08 ; sustain off
|
||||||
|
// 075c: 4f 96 JRE $06F4
|
||||||
|
// 075e: 77 01 EQI A,$01 ; mod wheel
|
||||||
|
// 0760: 4f 92 JRE $06F4 ; expect two bytes and return (running status)
|
||||||
|
// 0762: 55 a8 20 OFFIW $00A8,$20 ; midi mode 0
|
||||||
|
// 0765: c7 JR $076D ; continue
|
||||||
|
// 0766: 0b MOV A,C ; get byte
|
||||||
|
// 0767: 17 80 ORI A,$80 ; set bit?
|
||||||
|
// 0769: 63 a2 STAW $00A2 ; mod wheel value?
|
||||||
|
// 076b: 4f 87 JRE $06F4 ; expect two bytes and return (running status)
|
||||||
|
// 076d: 71 a2 80 MVIW $00A2,$80 ; mod wheel off?
|
||||||
|
// 0770: 4f 82 JRE $06F4 ; expect two bytes and return
|
||||||
|
//
|
||||||
|
// ; handle all notes off
|
||||||
|
// 0772: 5d 4f BIT 5,$004F ; all notes off?
|
||||||
|
// 0774: 4f 7e JRE $06F4 ; expect two bytes and return
|
||||||
|
// 0776: 4f c9 JRE $0741 ; wipe a table
|
||||||
|
// 0778: 74 7b 01 EQI C,$01
|
||||||
|
// 077b: 15 4f 02 ORIW $004F,$02
|
||||||
|
// 077e: 4f b4 JRE $0734
|
||||||
|
//
|
||||||
|
// ; program change
|
||||||
|
// 0780: 55 a8 20 OFFIW $00A8,$20 ; Midi mode 0?
|
||||||
|
// 0783: c5 JR $0789 ; skip ahead and do nothing
|
||||||
|
// 0784: 0b MOV A,C ; get prog
|
||||||
|
// 0785: 17 80 ORI A,$80 ; bit 7
|
||||||
|
// 0787: 63 a3 STAW $00A3 ; store
|
||||||
|
// 0789: 71 3f 00 MVIW $003F,$00 ; expect one byte (running status)
|
||||||
|
// 078c: 54 4c 06 JMP $064C ; return
|
||||||
|
//
|
||||||
|
// ; bend
|
||||||
|
// 078f: 55 a8 20 OFFIW $00A8,$20 ; midi mode 0?
|
||||||
|
// 0792: d7 JR $07AA ; clear and end
|
||||||
|
// 0793: 0b MOV A,C
|
||||||
|
// 0794: 18 MOV EAH,A ; EAH gets msb
|
||||||
|
// 0795: 01 3e LDAW $003E ; lsb
|
||||||
|
// 0797: 48 25 SLL A ; multiply by two
|
||||||
|
// 0799: 19 MOV EAL,A ; EA contains 14-bit bend multiplied by 2
|
||||||
|
// 079a: 48 a4 DSLL EA ; left aligned
|
||||||
|
// 079c: 08 MOV A,EAH
|
||||||
|
// 079d: 47 80 ONI A,$80 ; negative?
|
||||||
|
// 079f: c4 JR $07A4
|
||||||
|
// 07a0: 63 a1 STAW $00A1 ; save in ffa1
|
||||||
|
// 07a2: 4f 50 JRE $06F4 ; return, two byte running status
|
||||||
|
// 07a4: 16 ff XRI A,$FF ; invert
|
||||||
|
// 07a6: 63 a0 STAW $00A0 ; save in ffa0
|
||||||
|
// 07a8: 4f 4a JRE $06F4 ; return, two byte running status
|
||||||
|
// 07aa: 71 a1 80 MVIW $00A1,$80 ; reset bend?
|
||||||
|
// 07ad: 4f 45 JRE $06F4 ; return, two byte running status
|
||||||
|
}
|
||||||
// ; handle TX interrupt
|
// ; handle TX interrupt
|
||||||
// 07af: 01 c1 LDAW $00C1 ; buffer pointers?
|
// 07af: 01 c1 LDAW $00C1 ; buffer pointers?
|
||||||
// 07b1: 74 f8 c2 EQAW $00C2
|
// 07b1: 74 f8 c2 EQAW $00C2
|
||||||
@ -1901,12 +1961,12 @@ void Assigner::resetVoices() {
|
|||||||
b = 5; // five voices
|
b = 5; // five voices
|
||||||
// 0b86: 69 80 MVI A,$80
|
// 0b86: 69 80 MVI A,$80
|
||||||
a = 0x80;
|
a = 0x80;
|
||||||
// 0b88: 3d STAX (HL+)
|
// 0b88: 3d STAX (HL+)
|
||||||
h0b88:
|
h0b88:
|
||||||
ram[hl++] = a;
|
ram[hl++] = a;
|
||||||
// 0b89: 52 DCR B
|
// 0b89: 52 DCR B
|
||||||
// 0b8a: fd JR $0B88
|
// 0b8a: fd JR $0B88
|
||||||
if (b>0) {
|
if (b > 0) {
|
||||||
b--;
|
b--;
|
||||||
goto h0b88;
|
goto h0b88;
|
||||||
}
|
}
|
||||||
@ -1916,14 +1976,14 @@ void Assigner::resetVoices() {
|
|||||||
b = 0x05;
|
b = 0x05;
|
||||||
// 0b90: 69 88 MVI A,$88
|
// 0b90: 69 88 MVI A,$88
|
||||||
a = 0x88;
|
a = 0x88;
|
||||||
// 0b92: 3d STAX (HL+)
|
// 0b92: 3d STAX (HL+)
|
||||||
h0b92:
|
h0b92:
|
||||||
ram[hl++] = a;
|
ram[hl++] = a;
|
||||||
// 0b93: 41 INR A
|
// 0b93: 41 INR A
|
||||||
a++;
|
a++;
|
||||||
// 0b94: 52 DCR B
|
// 0b94: 52 DCR B
|
||||||
// 0b95: fc JR $0B92
|
// 0b95: fc JR $0B92
|
||||||
if (b>0) {
|
if (b > 0) {
|
||||||
b--;
|
b--;
|
||||||
goto h0b92;
|
goto h0b92;
|
||||||
}
|
}
|
||||||
|
@ -71,14 +71,16 @@ void Chassis::noteOn(uint8_t note) {
|
|||||||
|
|
||||||
ic1.ram[0x4e] = 0x90;
|
ic1.ram[0x4e] = 0x90;
|
||||||
ic1.ram[0x3e] = note;
|
ic1.ram[0x3e] = note;
|
||||||
ic1.noteOn();
|
ic1.noteOn(0x40);
|
||||||
|
|
||||||
/*
|
#ifdef D_MIDIBITMAP
|
||||||
|
printf("note on -> ");
|
||||||
for (uint8_t i = 0x40; i < 0x4f; i++) {
|
for (uint8_t i = 0x40; i < 0x4f; i++) {
|
||||||
printf("%02x ", ic1.ram[i]);
|
printf("%02x ", ic1.ram[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
*/
|
#endif
|
||||||
|
|
||||||
s.keyon = true;
|
s.keyon = true;
|
||||||
for (i = 0; i < NUM_VOICES; i++) {
|
for (i = 0; i < NUM_VOICES; i++) {
|
||||||
vPtr++;
|
vPtr++;
|
||||||
@ -98,16 +100,18 @@ void Chassis::noteOn(uint8_t note) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Chassis::noteOff(uint8_t note) {
|
void Chassis::noteOff(uint8_t note) {
|
||||||
ic1.ram[0x4e] = 0x80;
|
ic1.ram[0x4e] = 0x90;
|
||||||
ic1.ram[0x3e] = note;
|
ic1.ram[0x3e] = note;
|
||||||
ic1.noteOn();
|
ic1.noteOn(0);
|
||||||
|
|
||||||
/*
|
#ifdef D_MIDIBITMAP
|
||||||
|
printf("note off -> ");
|
||||||
for (uint8_t i = 0x40; i < 0x4f; i++) {
|
for (uint8_t i = 0x40; i < 0x4f; i++) {
|
||||||
printf("%02x ", ic1.ram[i]);
|
printf("%02x ", ic1.ram[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
*/
|
#endif
|
||||||
|
|
||||||
s.keyon = false;
|
s.keyon = false;
|
||||||
for (uint32_t i = 0; i < NUM_VOICES; i++) {
|
for (uint32_t i = 0; i < NUM_VOICES; i++) {
|
||||||
if (s.voice[i].note == note && !s.voice[i].isFree()) {
|
if (s.voice[i].note == note && !s.voice[i].isFree()) {
|
||||||
@ -133,7 +137,7 @@ void Chassis::doMidi(const MidiEvent *ev, uint32_t count, uint32_t timeLimit) {
|
|||||||
}
|
}
|
||||||
lastEvent = i;
|
lastEvent = i;
|
||||||
|
|
||||||
ic1.voiceOn();
|
//ic1.voiceOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chassis::run(const float **, float **outputs, uint32_t frames, const MidiEvent *midiEvents, uint32_t midiEventCount) {
|
void Chassis::run(const float **, float **outputs, uint32_t frames, const MidiEvent *midiEvents, uint32_t midiEventCount) {
|
||||||
|
@ -2,16 +2,23 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
#define D_MIDIBITMAP
|
||||||
|
|
||||||
class Assigner {
|
class Assigner {
|
||||||
public:
|
public:
|
||||||
uint8_t ram[256];
|
uint8_t ram[256];
|
||||||
uint16_t a = 0, b = 0, c = 0, eal = 0, eah = 0;
|
uint16_t a = 0, b = 0, c = 0, eal = 0, eah = 0;
|
||||||
uint32_t bc, de, hl, ea = 0;
|
uint32_t bc, de, hl, ea = 0;
|
||||||
|
|
||||||
void noteOn();
|
void noteOn(uint8_t c);
|
||||||
void voiceOn();
|
void voiceOn();
|
||||||
void resetVoices();
|
void resetVoices();
|
||||||
// void clearNotes();
|
// void clearNotes();
|
||||||
//void assignNote();
|
// void assignNote();
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint8_t bitMask[24] = {
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
|
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
|
||||||
|
0xfe, 0xfd, 0xfb, 0xf7, 0xef, 0xdf, 0xbf, 0x7f};
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user