;MIDI FTP ORG $6000 JMP INITPGM ;-------------------------- ; ZP1L EQU $06 ZP1H EQU $07 ZP2L EQU $08 ZP2H EQU $09 ; MIDISLOT DFB $20 BUFSTRTL DFB $00 BUFSTRTH DFB $20 BUFENDL DFB $00 BUFENDH DFB $60 ; INBYTE DFB $00 PHASE DFB $00 DATAMSK1 DFB $00 DATAMSK2 DFB $00 DATA1 DFB $00 DATA2 DFB $00 ;------------------------------------------------- INITPGM LDA #$13 LDX MIDISLOT STA $C088,X LDA #$11 STA $C088,X LDA BUFSTRTL STA ZP1L LDA BUFSTRTH STA ZP1H LDA $C010 MAINLOOP LDA $C000 BMI ADIOS LDX MIDISLOT LDA $C088,X AND #$01 BEQ MAINLOOP LDX MIDISLOT LDA $C089,X CMP #$F1 BCS MAINLOOP SYSXRET STA INBYTE JMP PRCSBYTE ADIOS LDA $C010 LDA $07 JSR $FDDA LDA $06 JSR $FDDA RTS ;------------------------------ PRCSBYTE LDA INBYTE BPL DATABYTE AND #$F0 CMP #$80 BNE STSFF LDA INBYTE AND #$02 CLC ROR A ROR A ROR A STA DATAMSK1 LDA INBYTE AND #$01 CLC ROR A ROR A STA DATAMSK2 LDA #$81 STA PHASE JMP MAINLOOP STSFF LDA #$FF STA PHASE JMP MAINLOOP ;----------------------------- DATABYTE LDA PHASE CMP #$81 BNE CHK82 LDA INBYTE STA DATA1 LDA #$82 STA PHASE JMP MAINLOOP CHK82 CMP #$82 BNE PHASEFF LDA INBYTE STA DATA2 LDA DATA1 ORA DATAMSK1 LDY #$00 STA (ZP1L),Y LDA DATA2 ORA DATAMSK2 INY STA (ZP1L),Y INC ZP1L INC ZP1L LDA ZP1L BNE CONTINUE INC ZP1H CONTINUE LDA #$81 STA PHASE PHASEFF JMP MAINLOOP ;