home *** CD-ROM | disk | FTP | other *** search
/ Set of Apple II Hard Drive Images / hard.hdv / HARD / PROJECT / SOURCE / EDIT.SRC0 < prev    next >
Encoding:
Text File  |  1992-07-15  |  7.4 KB  |  217 lines  |  [04] ASCII Text (0x0000)

  1. ;
  2. ; EDIT.SRC0
  3. ;
  4.                     ORG   $0800
  5. ;
  6. PTR                 EQU   $06          ;SEQUENCE POINTER
  7. MCTR                EQU   $08          ;COUNTER FOR MEASURE MODE
  8. MISCPTR             EQU   $19
  9. DLYCTR              EQU   $FD          ;DELAY COUNTER
  10. SPEED               EQU   $FF          ;SPEED OF PLAYBACK
  11. ;
  12. ;=================================================
  13. ORIGIN              JMP   BEGINNIN
  14. ;
  15. DISPMODE            DFB   $00  ;    00=UCS, NON ZERO = LCF
  16. ;
  17. DURL                DFB   $00
  18. DURH                DFB   $00
  19. NOTE                DFB   $00  
  20. VEL                 DFB   $00 
  21. ;
  22. ; ENTRY POINT FOR CLEANUP = ORIGIN + 8
  23. ;
  24.                     JMP   CLEANUP
  25. ;
  26. ; ENTRY POINT FOR FINDEND = ORIGIN + 11
  27.                     JMP   FINDEND
  28. ;=================================================
  29. BEGINNIN            JSR   INITIAL
  30. ;
  31. SENDLOOP            LDY   #$00         ;GET DURATION HI BYTE
  32.                     LDA   (PTR),Y
  33.                     BNE   SEND4BYT
  34.                     RTS                ;EXIT PGM IF HI DUR = 0 (0-FF-2F-0)
  35. ;
  36. INITIAL             JSR   $FC58        ;CLEAR SCREEN
  37.                     LDA   #$13         ;INIT MIDI CARD
  38.                     STA   $C0A8
  39.                     LDA   #$11
  40.                     STA   $C0A8
  41.                     LDA   #$00         ;SPEED=0
  42.                     STA   SPEED
  43.                     LDA   #$04         ;PTR = $2004
  44.                     STA   PTR
  45.                     LDA   #$20
  46.                     STA   PTR+1
  47.                     JSR   CLEANUP      ;SPACE OUT PRINT LINE
  48.                     RTS   
  49. ;
  50. ;                                      ;CONVERT VLQ TO 2 BYTE BINARY
  51. SEND4BYT            AND   #$7F         ;CONVERT HI DUR (STRIP HI BIT)
  52.                     ROR   A            ;AND ROTATE
  53.                     STA   DURH
  54.                     LDA   #$00         ;GET LO BIT INTO HI BIT
  55.                     ROR   A   
  56.                     INY   
  57.                     ORA   (PTR),Y      ;OR WITH LO DUR
  58.                     STA   DURL
  59.                     INY   
  60.                     LDA   (PTR),Y
  61.                     STA   NOTE         ;GET NOTE AND VEL
  62.                     INY   
  63.                     LDA   (PTR),Y
  64.                     STA   VEL
  65.                     JSR   PROCESS      ;PROCESS THE 4 BYTES
  66.                     JSR   INCPTR       ;GET NEXT CELL
  67.                     CLV   
  68.                     BVC   SENDLOOP     ;LOOP BACK
  69. ;=================================================
  70. INCPTR              LDA   PTR          ;ADD 4 TO POINTER (EACH CELL=4 BYTES)
  71.                     CLC   
  72.                     ADC   #$04
  73.                     STA   PTR
  74.                     LDA   PTR+1
  75.                     ADC   #$00
  76.                     STA   PTR+1
  77.                     RTS   
  78. ;=================================================
  79. PROCESS             LDA   DURH
  80.                     BNE   PROCDUR
  81.                     LDA   DURL
  82.                     BNE   PROCDUR
  83.                     JSR   NOTEOUT
  84.                     JMP   LINEOUT
  85. ;
  86. PROCDUR             JSR   LINEOUT
  87.                     JSR   PROCCMD
  88.                     JSR   NOTEOUT
  89.                     RTS
  90. ;=================================================
  91. NOTEOUT             LDA   #$90
  92.                     JSR   MIDIOUT
  93.                     LDA   NOTE
  94.                     JSR   MIDIOUT
  95.                     LDA   VEL
  96.                     JSR   MIDIOUT
  97.                     RTS   
  98. ;
  99. MIDIOUT             STA   $C0A9
  100. ;
  101. MIDIOUT1            LDA   $C0A8
  102.                     AND   #$02
  103.                     BEQ   MIDIOUT1
  104.                     RTS   
  105. ;=================================================
  106. PROCCMD             LDA   SPEED
  107.                     BEQ   KEYMODE
  108.                     LDA   DURH         ;WE ARE PLAYING SONG, SO PROCESS DURS
  109.                     STA   DLYCTR+1
  110.                     LDA   DURL
  111.                     STA   DLYCTR
  112. ;
  113. DELAY1              LDX   DLYCTR       ;WAIT FOR DELAY TO FINISH
  114.                     BEQ   DELAY2
  115.                     DEC   DLYCTR
  116.                     LDA   SPEED
  117.                     JSR   $FCA8
  118.                     CLV   
  119.                     BVC   DELAY1
  120. ;
  121. DELAY2              LDX   DLYCTR+1
  122.                     BEQ   CHKKEY
  123.                     DEC   DLYCTR+1
  124.                     LDA   SPEED
  125.                     JSR   $FCA8
  126.                     DEC   DLYCTR       ;EX: FROM 200->1FF
  127.                     CLV   
  128.                     BVC   DELAY1
  129. ;
  130. CHKKEY              JSR   PROCDLY      ;PROCESS MEASURE BAR DISPLAY
  131.                     LDA   $C000        ;CHECK FOR KEYPRESS
  132.                     BMI   KEYMODE
  133.                     RTS   
  134. ;=================================================
  135. KEYMODE             LDA   #$00         ;SPEED=0
  136.                     STA   SPEED
  137. ;
  138. WAITKEY             LDA   $C000        ;WAIT FOR KEYPRESS
  139.                     BPL   WAITKEY
  140.                     AND   #$7F         ;MASK HI BIT
  141.                     STA   $C010
  142.                     STA   USERKEY
  143.                     LDX   NUMCMDS
  144. ;
  145. KEYLOOP             LDA   KEYTABLE,X   ;SEARCH KEYSTROKE TABLE
  146.                     CMP   USERKEY
  147.                     BEQ   GOTKEY
  148.                     DEX   
  149.                     BPL   KEYLOOP
  150.                     RTS                ;IF NOT FOUND DEFAULT TO ADVANCE CMD
  151. ;
  152. GOTKEY              LDA   #$4C
  153.                     STA   KEYJMP
  154.                     LDA   KEYADRL,X
  155.                     STA   KEYJMP+1
  156.                     LDA   KEYADRH,X
  157.                     STA   KEYJMP+2
  158.                     JMP   KEYJMP
  159. ;=================================================
  160. PLAY                LDA   SPEEDSAV
  161.                     STA   SPEED
  162.                     RTS   
  163. ;=================================================
  164. ;
  165. MEASFLAG            DFB $00
  166. ;
  167. USERKEY             DFB $00
  168. ;
  169. KEYJMP              DFB $4C,$00,$00    ;JUMP VECTOR
  170. ;
  171. SPEEDSAV            DFB $16  
  172. ;
  173. MEASLEN             DFB $C0,$03        ;$3C0=960
  174. ;
  175. SRCHPTR             DFB $04,$20
  176. ;
  177. SRCHSTRT            DFB $04,$20
  178. ;
  179. PATTERN             DFB $80,00,00,00   ; MARKER PATTERN TO SRCH FOR
  180. ;
  181. ;=================================================
  182. ; KEYBOARD COMMAND TABLE
  183. ;
  184. NUMCMDS             DFB $28
  185. KEYTABLE            DFB $1B,$50,$0B,$2A,$7F,$04,$08,$15
  186.                     DFB $2F,$2C,$5C,$30,$33,$36,$38,$34
  187.                     DFB $32,$31,$37,$3D,$2B,$2D,$2E,$39   
  188.                     DFB $35,$5D,$5B,$3E,$3C,$0E,$16,$56
  189.                     DFB $4D,$4E,$09,$28,$29,$47,$54,$41
  190.                     DFB $00,$00,$00,$00,$00,$00,$00,$00
  191. ;
  192. KEYADRL             DFB >ESC,>PKEY,>CTRLK,>STAR,>DEL,>CTRLD,>CTRLH,>CTRLU
  193.                     DFB >SLASH,>COMMA,>BKSLASH,>ZERO,>THREE,>SIX,>EIGHT,>FOUR
  194.                     DFB >TWO,>ONE,>SEVEN,>EQUALS,>PLUS,>MINUS,>DOT,>NINE
  195.                     DFB >FIVE,>RBRKT,>LBRKT,>GRTRTHAN,>LESSTHAN
  196.                     DFB >CTRLN,>CTRLV,>VKEY
  197.                     DFB >MKEY,>NKEY,>CTRLI,>LTPAREN,>RTPAREN,>GKEY,>TKEY,>AKEY
  198. ;
  199. KEYADRH             DFB <ESC,<PKEY,<CTRLK,<STAR,<DEL,<CTRLD,<CTRLH,<CTRLU
  200.                     DFB <SLASH,<COMMA,<BKSLASH,<ZERO,<THREE,<SIX,<EIGHT,<FOUR
  201.                     DFB <TWO,<ONE,<SEVEN,<EQUALS,<PLUS,<MINUS,<DOT,<NINE
  202.                     DFB <FIVE,<RBRKT,<LBRKT,<GRTRTHAN,<LESSTHAN
  203.                     DFB <CTRLN,<CTRLV,<VKEY
  204.                     DFB <MKEY,<NKEY,<CTRLI,<LTPAREN,<RTPAREN,<GKEY,<TKEY,<AKEY
  205. ;
  206. ;=================================================
  207. BACKPTR             LDA   PTR
  208.                     SEC   
  209.                     SBC   #$04
  210.                     STA   PTR
  211.                     LDA   PTR+1
  212.                     SBC   #$00
  213.                     STA   PTR+1
  214.                     RTS   
  215. ;
  216.                     CHN   EDIT.SRC1
  217.