Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- znova:
- call M_rxbuf_getrdy
- cjne A, #0, xx1
- jmp znova
- xx1:
- call M_rxbuf_getch
- jnb ACC.7, NotStatusByte ;test if MSB set
- mov m_p_action, A ;save the status byte
- anl A, #0F0h ;mask only the type of status
- cjne A, #90h, next1 ;test for NOTE ON
- mov m_p_state, #m_s_read_note
- jmp znova
- next1: cjne A, #80h, next2 ;test for NOTE CUT
- ;mov m_p_state, #m_s_read_note
- jmp znova
- next2: cjne A, #0B0h, next3 ;test for CONTROL CHANGE
- jmp znova
- next3: cjne A, #0C0h, next4 ;test for PROGRAM CHANGE
- jmp znova
- next4:
- jmp znova
- NotStatusByte:
- mov R0, m_p_state ;put MIDI parser state in R0 so we can compare
- ;State: Read Note
- cjne R0, #m_s_read_note, dnext1
- mov m_note, A ;save note number
- mov m_p_state, #m_s_read_velocity ;next state is Read Velocity
- jmp znova
- ;State: Read Velocity
- dnext1: cjne R0, #m_s_read_velocity, dnext2
- mov m_velocity, A ;save velocity number
- mov m_p_state, #m_s_no_op ;next state none
- call MIDI_NoteOnReceived ;call NOTE ON received callback
- jmp znova
- dnext2:
- jmp znova
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement