> MidiTrk  MIDI real time recorder/  playback program ( V 2.1, JWP 8/85 2 From EE March 86 <7 F: P CODE 1023 Z data 10399+4:STORE=data+4 d CLOCK 4 n: x: ?&72=STORE 256 ?&73=STORE 256 notecountl=&74 notecounth=&75 pointer=&70 pointerh=&71 OSWORD=&FFF1 OSBYTE=&FFF4 midi=&FCF1 status=&FCF0 last=&7F:?last=&90 : :  I%=0 2 2  P%=CODE  [OPT I% ".firstnote , LDA #0 6 STA CLOCK @STA CLOCK+1 JSTA CLOCK+2 TSTA CLOCK+3 ^STA CLOCK+4 hSTA notecountl rSTA notecounth | LDA &72  STA &70  LDA &73  STA &71  .start LDA status  #1  BEQ start  LDA #2 LDX #CLOCK 256 LDY #CLOCK 256 JSR OSWORD : :  .getnote  LDX #0  LDY #0 & LDA midi 0BMI comm_byte :PHA:LDA last DSTA (pointer),Y NJSR increment XPLA:BPL note_got b.comm_byte l STA last vSTA (pointer),Y JSR increment  .note LDA status  #1  BEQ note  LDA midi  .note_got STA (pointer),Y JSR increment  .tail LDA status  #1  BEQ tail  LDA midi  STA (pointer),Y JSR increment  JSR addnote *JSR timing 4 .next > LDA #255 H CMP &78 RBEQ tobasic \LDA status f #1 p BEQ next zJMP getnote : : .increment  INC &70 BNE nocarry  INC &71  .nocarry RTS : : .key PHP  LDA #255  STA &78 PLA RTS $: .: 8 .timing B LDA #1 LLDX #CLOCK 256 VLDY #CLOCK 256 `JSR OSWORD j LDY #0 t LDA CLOCK ~STA (pointer),Y JSR increment LDA CLOCK+1 STA (pointer),Y JSR increment RTS : :  .addnote INC notecountl  BNE nohi INC notecounth LDA notecounth  CMP #8  BNE nohi BRK  EQUB 100 (EQUS "Note store full" 2BRK < .nohi FRTS P: Z: d .tobasic nBRK x EQUB 102 EQUS "Key pressed" BRK : :  .wait  LDA #&91  LDX #0  LDY #0 JSR OSBYTE BCC tobasic LDX #CLOCK 256 LDY #CLOCK 256  LDA #1 JSR OSWORD  LDY #4 LDA CLOCK+1 "CMP (pointer),Y ,BEQ lobyte 6BCS outwait @ BCC wait J .lobyte TDEY ^ LDA CLOCK hCMP (pointer),Y r BCC wait | .outwait RTS : .firstplay :  LDA #0  STA CLOCK STA CLOCK+1 STA CLOCK+2 STA CLOCK+3 STA CLOCK+4  LDA &72  STA &70  LDA &73  STA &71  LDA &74  STA &76 & LDA &75 0 STA &77 : LDA #2 DLDX #CLOCK 256 NLDY #CLOCK 256 XJSR OSWORD bJSR nextnote l .playnote v JSR wait LDA status  #2 BEQ playnote  LDY #0 LDA (pointer),Y  STA midi JSR increment  .noteval LDA status  #2 BEQ noteval LDA (pointer),Y  STA midi JSR increment  .thirdval LDA status   #2 *BEQ thirdval 4LDA (pointer),Y > STA midi HJSR increment RJSR increment \JSR increment fJSR nextnote pJMP playnote z: :  .nextnote  DEC &76  LDA &76  CMP #255 BNE nextout  DEC &77  LDA &77  CMP #255 BNE nextout BRK  EQUB 101 EQUS "All notes played" BRK  .nextout RTS $] . I% 8: B: L DZJ V: `: j t ?status=3 ~?status=21 #?&220=key 256:?&221=key 256  5,1)"EE MIDI Tracker" 5,4)"Press R to record" 5,6)"Press P to playback" 5,8)"Press L to load file" !5,10)"Press S to save file" M5,12)"Press any key to stop recording"'5)"or playing back, except Esc" )5,15)"Press Escape to quit program" 9(!&74 &FFFF)>0 5,17);!&74 &FFFF;" events stored" : K= K=K 223  K=82 record  K=80 play  K=10 osc: ( K=76 load: 2 K=83 save: < F: P: Z =17 d *FX13,2 n ?&78=0 x =100 notes:tRI  =101 clearline:tRI  =102 K=82 notes:tRI # =102 K=80 clearline:tRI :" at line "; "Press a key";  DjI : : record *FX14,2 5,20)"Recording..." ?status=3 ?status=21  firstnote  ": ,: 6 play @ ?&75=0 ?&74=0 empty: J *FX14,2 T5,20)"Playing..." ^ firstplay h r: |: notes notecount=(256*?&75+?&74) &5,20);notecount;" events stored" *FX21 5,21)"Press any key"  clearline  : : clearline 5,20)20 5,21)20  31,5,20  : &: 0 empty :5,20)"Nothing recorded" D5,21)"Press any key" N Xclearline b l: v: osc: A$ "*"A$:A$:A$="": : : load "Load file: "A$ "LOAD "+A$+" "+~data ?&74=?data:?&75=data?1  : : save "Save file: "A$  !data=!&74:data?2=0:data?3=0 ,"SAVE "+A$+" "+~data+"+"+~(2+5*!data)  x * P=0 1 4 P%=&900 > [OPTP*3 H .loop RLDA &FCF0: #1:BEQ loop \LDA &FCF1:JSR pr_hex fBIT &FF:BPL loop pRTS z .pr_hex PHA:LSR A:LSR A:LSR A:LSR A JSR pr_nyb:PLA .pr_nyb  #15:CMP #10:BCC pr_ok ADC #6:.pr_ok ADC #48:JMP &FFEE ]