;@ map d MID000
;@ map d MID000

;@ ins k k
;@ outs k
opcode PCSend, 0, kkkkk
  kProg, kCh, kSend, kValue, kOut xin
; TODO Done. Except This,SlotA-D
  ksend zkr kSend
  kvalue zkr kValue

  kvalloc init 0
  kout init 0

  if kValue == 1 goto NoValInp
    kvalloc = kvalue
    goto ValInp
  NoValInp:
    kvalloc = kProg
  ValInp:

  kTrig trigger ksend, 0, 0
  if kTrig==0 goto Halt
  	midiout 192, kCh, kVal, 0 ; GENERIC PC MESSAGE
    kout = 1
  Halt:
  zkw kout, kOut
  kout = 0 ; reset after send
endop
