stardot / b-em

An opensource BBC Micro emulator for Win32 and Linux
http://stardot.org.uk/forums/viewtopic.php?f=4&t=10823
GNU General Public License v2.0
118 stars 58 forks source link

Music 2000 MIDI send does not work. #236

Open SteveFosdick opened 3 weeks ago

SteveFosdick commented 3 weeks ago

As per the Music 2000 user guide, setting a tune playing and then running:

1 SHARE MIDIV

Cause the voice concerned to no longer sound on the Music 5000 but does not cause any MIDI activity.

SteveFosdick commented 3 weeks ago

Problem is possibly related to interrupts. The ISR for the M2 module is:

    195C: 08          PHP         
    195D: 8A          TXA         
    195E: 48          PHA         
    195F: A2 00       LDX #00     ; Point to first ACIA
    1961: AD 08 FC    LDA FC08    ; Did this raise the interrupt?
    1964: 30 0E       BMI 1974    ; Yes, handle it.
    1966: E8          INX         ; Point to second ACIA
    1967: E8          INX         
    1968: AD 0A FC    LDA FC0A    ; Did this raise the interrupt?
    196B: 30 07       BMI 1974    ; Yes, handle it.
    196D: E8          INX         ; Point to third ACIA
    196E: E8          INX         
    196F: AD 0C FC    LDA FC0C    ; Did this raise the interrupt?
    1972: 10 38       BPL 19AC    ; No, end of this part of ISR.

    ; All three ACIAs end up here is one of them has caused
    ; the interrupt.  X points to which one.

    1974: BD 08 FC    LDA FC08,X  ; Get the status register.
    1977: 29 02       AND #02     ; Check for Tx Data Reg Empty.
    1979: F0 31       BEQ 19AC    ; Branch if not empty.
    197B: 98          TYA         
    197C: 48          PHA         
    197D: BD 3A 19    LDA 193A,X  ; Anything to send?
    1980: DD 39 19    CMP 1939,X  
    1983: F0 15       BEQ 199A    ; Branch if nothing to send
    1985: 18          CLC         
    1986: 69 01       ADC #01     ; Advance the buffer pointer?
    1988: 29 1F       AND #1F     
    198A: 1D 45 19    ORA 1945,X  
    198D: 9D 3A 19    STA 193A,X  
    1990: A8          TAY         
    1991: B9 D9 18    LDA 18D9,Y  ; Get the byte to transmit.
    1994: 9D 09 FC    STA FC09,X  ; Write to TX data register.
    1997: 4C A4 19    JMP 19A4    
    199A: A9 15       LDA #15     ; Turn off the TXDR empty IRQ.
    199C: 9D 08 FC    STA FC08,X  ; Write to control register.
    199F: A9 00       LDA #00     
    19A1: 9D 3F 19    STA 193F,X  
    19A4: 68          PLA         
    19A5: A8          TAY         
    19A6: 68          PLA         
    19A7: AA          TAX         
    19A8: A5 FC       LDA FC      ; End of ISR having done something.
    19AA: 28          PLP         
    19AB: 40          RTI         
    19AC: 68          PLA         ; End of ISR when daisy chaining.
    19AD: AA          TAX         
    19AE: A5 FC       LDA FC      
    19B0: 28          PLP         
    19B1: 6C 0C 18    JMP (180C)  
SteveFosdick commented 3 weeks ago

See: https://github.com/stardot/b-em/tree/sf/issue236