Advertisement
Guest User

Untitled

a guest
Dec 23rd, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. znova:            
  2.             call M_rxbuf_getrdy
  3.             cjne A, #0, xx1
  4.             jmp znova
  5. xx1:        
  6.             call M_rxbuf_getch
  7.            
  8.             jnb ACC.7, NotStatusByte      ;test if MSB set          
  9.             mov m_p_action, A             ;save the status byte
  10.             anl A, #0F0h                  ;mask only the type of status
  11.            
  12.             cjne A, #90h, next1           ;test for NOTE ON
  13.             mov m_p_state, #m_s_read_note
  14.             jmp znova
  15.            
  16. next1:      cjne A, #80h, next2           ;test for NOTE CUT
  17.            ;mov m_p_state, #m_s_read_note
  18.             jmp znova
  19.  
  20. next2:      cjne A, #0B0h, next3          ;test for CONTROL CHANGE
  21.             jmp znova
  22.  
  23. next3:      cjne A, #0C0h, next4          ;test for PROGRAM CHANGE
  24.             jmp znova
  25.  
  26. next4:      
  27.             jmp znova
  28.  
  29. NotStatusByte:                  
  30.             mov R0, m_p_state             ;put MIDI parser state in R0 so we can compare            
  31.            
  32.             ;State: Read Note
  33.             cjne R0, #m_s_read_note, dnext1    
  34.             mov m_note, A                       ;save note number
  35.             mov m_p_state, #m_s_read_velocity   ;next state is Read Velocity
  36.             jmp znova
  37.            
  38.             ;State: Read Velocity
  39. dnext1:     cjne R0, #m_s_read_velocity, dnext2
  40.             mov m_velocity, A                   ;save velocity number
  41.             mov m_p_state, #m_s_no_op           ;next state none
  42.             call MIDI_NoteOnReceived            ;call NOTE ON received callback
  43.             jmp znova
  44.            
  45. dnext2:              
  46.  
  47.             jmp znova
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement