home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-07-15 | 7.4 KB | 217 lines | [04] ASCII Text (0x0000) |
- ;
- ; EDIT.SRC0
- ;
- ORG $0800
- ;
- PTR EQU $06 ;SEQUENCE POINTER
- MCTR EQU $08 ;COUNTER FOR MEASURE MODE
- MISCPTR EQU $19
- DLYCTR EQU $FD ;DELAY COUNTER
- SPEED EQU $FF ;SPEED OF PLAYBACK
- ;
- ;=================================================
- ORIGIN JMP BEGINNIN
- ;
- DISPMODE DFB $00 ; 00=UCS, NON ZERO = LCF
- ;
- DURL DFB $00
- DURH DFB $00
- NOTE DFB $00
- VEL DFB $00
- ;
- ; ENTRY POINT FOR CLEANUP = ORIGIN + 8
- ;
- JMP CLEANUP
- ;
- ; ENTRY POINT FOR FINDEND = ORIGIN + 11
- JMP FINDEND
- ;=================================================
- BEGINNIN JSR INITIAL
- ;
- SENDLOOP LDY #$00 ;GET DURATION HI BYTE
- LDA (PTR),Y
- BNE SEND4BYT
- RTS ;EXIT PGM IF HI DUR = 0 (0-FF-2F-0)
- ;
- INITIAL JSR $FC58 ;CLEAR SCREEN
- LDA #$13 ;INIT MIDI CARD
- STA $C0A8
- LDA #$11
- STA $C0A8
- LDA #$00 ;SPEED=0
- STA SPEED
- LDA #$04 ;PTR = $2004
- STA PTR
- LDA #$20
- STA PTR+1
- JSR CLEANUP ;SPACE OUT PRINT LINE
- RTS
- ;
- ; ;CONVERT VLQ TO 2 BYTE BINARY
- SEND4BYT AND #$7F ;CONVERT HI DUR (STRIP HI BIT)
- ROR A ;AND ROTATE
- STA DURH
- LDA #$00 ;GET LO BIT INTO HI BIT
- ROR A
- INY
- ORA (PTR),Y ;OR WITH LO DUR
- STA DURL
- INY
- LDA (PTR),Y
- STA NOTE ;GET NOTE AND VEL
- INY
- LDA (PTR),Y
- STA VEL
- JSR PROCESS ;PROCESS THE 4 BYTES
- JSR INCPTR ;GET NEXT CELL
- CLV
- BVC SENDLOOP ;LOOP BACK
- ;=================================================
- INCPTR LDA PTR ;ADD 4 TO POINTER (EACH CELL=4 BYTES)
- CLC
- ADC #$04
- STA PTR
- LDA PTR+1
- ADC #$00
- STA PTR+1
- RTS
- ;=================================================
- PROCESS LDA DURH
- BNE PROCDUR
- LDA DURL
- BNE PROCDUR
- JSR NOTEOUT
- JMP LINEOUT
- ;
- PROCDUR JSR LINEOUT
- JSR PROCCMD
- JSR NOTEOUT
- RTS
- ;=================================================
- NOTEOUT LDA #$90
- JSR MIDIOUT
- LDA NOTE
- JSR MIDIOUT
- LDA VEL
- JSR MIDIOUT
- RTS
- ;
- MIDIOUT STA $C0A9
- ;
- MIDIOUT1 LDA $C0A8
- AND #$02
- BEQ MIDIOUT1
- RTS
- ;=================================================
- PROCCMD LDA SPEED
- BEQ KEYMODE
- LDA DURH ;WE ARE PLAYING SONG, SO PROCESS DURS
- STA DLYCTR+1
- LDA DURL
- STA DLYCTR
- ;
- DELAY1 LDX DLYCTR ;WAIT FOR DELAY TO FINISH
- BEQ DELAY2
- DEC DLYCTR
- LDA SPEED
- JSR $FCA8
- CLV
- BVC DELAY1
- ;
- DELAY2 LDX DLYCTR+1
- BEQ CHKKEY
- DEC DLYCTR+1
- LDA SPEED
- JSR $FCA8
- DEC DLYCTR ;EX: FROM 200->1FF
- CLV
- BVC DELAY1
- ;
- CHKKEY JSR PROCDLY ;PROCESS MEASURE BAR DISPLAY
- LDA $C000 ;CHECK FOR KEYPRESS
- BMI KEYMODE
- RTS
- ;=================================================
- KEYMODE LDA #$00 ;SPEED=0
- STA SPEED
- ;
- WAITKEY LDA $C000 ;WAIT FOR KEYPRESS
- BPL WAITKEY
- AND #$7F ;MASK HI BIT
- STA $C010
- STA USERKEY
- LDX NUMCMDS
- ;
- KEYLOOP LDA KEYTABLE,X ;SEARCH KEYSTROKE TABLE
- CMP USERKEY
- BEQ GOTKEY
- DEX
- BPL KEYLOOP
- RTS ;IF NOT FOUND DEFAULT TO ADVANCE CMD
- ;
- GOTKEY LDA #$4C
- STA KEYJMP
- LDA KEYADRL,X
- STA KEYJMP+1
- LDA KEYADRH,X
- STA KEYJMP+2
- JMP KEYJMP
- ;=================================================
- PLAY LDA SPEEDSAV
- STA SPEED
- RTS
- ;=================================================
- ;
- MEASFLAG DFB $00
- ;
- USERKEY DFB $00
- ;
- KEYJMP DFB $4C,$00,$00 ;JUMP VECTOR
- ;
- SPEEDSAV DFB $16
- ;
- MEASLEN DFB $C0,$03 ;$3C0=960
- ;
- SRCHPTR DFB $04,$20
- ;
- SRCHSTRT DFB $04,$20
- ;
- PATTERN DFB $80,00,00,00 ; MARKER PATTERN TO SRCH FOR
- ;
- ;=================================================
- ; KEYBOARD COMMAND TABLE
- ;
- NUMCMDS DFB $28
- KEYTABLE DFB $1B,$50,$0B,$2A,$7F,$04,$08,$15
- DFB $2F,$2C,$5C,$30,$33,$36,$38,$34
- DFB $32,$31,$37,$3D,$2B,$2D,$2E,$39
- DFB $35,$5D,$5B,$3E,$3C,$0E,$16,$56
- DFB $4D,$4E,$09,$28,$29,$47,$54,$41
- DFB $00,$00,$00,$00,$00,$00,$00,$00
- ;
- KEYADRL DFB >ESC,>PKEY,>CTRLK,>STAR,>DEL,>CTRLD,>CTRLH,>CTRLU
- DFB >SLASH,>COMMA,>BKSLASH,>ZERO,>THREE,>SIX,>EIGHT,>FOUR
- DFB >TWO,>ONE,>SEVEN,>EQUALS,>PLUS,>MINUS,>DOT,>NINE
- DFB >FIVE,>RBRKT,>LBRKT,>GRTRTHAN,>LESSTHAN
- DFB >CTRLN,>CTRLV,>VKEY
- DFB >MKEY,>NKEY,>CTRLI,>LTPAREN,>RTPAREN,>GKEY,>TKEY,>AKEY
- ;
- KEYADRH DFB <ESC,<PKEY,<CTRLK,<STAR,<DEL,<CTRLD,<CTRLH,<CTRLU
- DFB <SLASH,<COMMA,<BKSLASH,<ZERO,<THREE,<SIX,<EIGHT,<FOUR
- DFB <TWO,<ONE,<SEVEN,<EQUALS,<PLUS,<MINUS,<DOT,<NINE
- DFB <FIVE,<RBRKT,<LBRKT,<GRTRTHAN,<LESSTHAN
- DFB <CTRLN,<CTRLV,<VKEY
- DFB <MKEY,<NKEY,<CTRLI,<LTPAREN,<RTPAREN,<GKEY,<TKEY,<AKEY
- ;
- ;=================================================
- BACKPTR LDA PTR
- SEC
- SBC #$04
- STA PTR
- LDA PTR+1
- SBC #$00
- STA PTR+1
- RTS
- ;
- CHN EDIT.SRC1
-