Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;*****************************************************************************************
- ;*****************************************************************************************
- ;** **
- ;** Header Information **
- ;** **
- ;*****************************************************************************************
- ;** **
- ;** Processor Type: PIC 16F887 **
- ;** Default Assembler Radix: Decimal **
- ;** Assembler Error Level: Suppress error 302 **
- ;** Assembler Header File: P16F887.INC **
- ;** **
- ;** Configuration Word 1 **
- ;** **
- ;** Debug Mode Off (Default) **
- ;** Low Voltage Programming Off **
- ;** Fail Safe Clock Monitor Off **
- ;** Internal External Switchover Off **
- ;** Brown Out Reset Off **
- ;** Data Code Protect Off (Default) **
- ;** Code Protect Off (Default) **
- ;** RE3 Has MCLR Function (Default) **
- ;** Power Up Timer On **
- ;** Watchdog Timer Off **
- ;** Internal Oscillator - RA6 & RA7 are digital I/O **
- ;** **
- ;** Configuration Word 2 **
- ;** **
- ;** Program Memory Write Protect Off (Default) **
- ;** Brown Out Reset Voltage 4.0V (Default - BOR Disabled by Configuation Word 1) **
- ;** **
- ;** Fosc = 4MHz **
- ;** **
- ;*****************************************************************************************
- ;*****************************************************************************************
- list p=16F887, r=dec, w=-302
- include <P16F887.INC>
- __config _CONFIG1, _LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_OFF & _PWRTE_ON & _WDT_OFF & _INTOSCIO
- ;*****************************************************************************************
- ;** **
- ;** Variable Declarations **
- ;** **
- ;*****************************************************************************************
- cblock 0x20
- FUNCTIONDATA
- MIDIDATA
- MIDICHANNELH
- MIDICHANNELL
- AMPCHANNEL
- MIDIFLAGS
- endc
- cblock 0x70
- W_TEMP ;W context save for interrupts
- STATUS_TEMP ;STATUS context save for interrupts
- PCLATH_TEMP ;PCLATH context save for interrupts
- DATAL ;first data byte buffer
- DATAH ;second data byte buffer
- COMMAND ;GLCD instruction buffer
- DELAYCOUNT ;delay counter
- COUNT1 ;general purpose counter 1
- COUNT2 ;general purpose counter 2
- COUNT3 ;general purpose counter 3
- DATA_EE_ADDR ;data EEPROM address buffer
- DATA_EE_DATA ;data EEPROM data buffer
- endc
- ;*****************************************************************************************
- ;** **
- ;** I/O Line Names **
- ;** **
- ;*****************************************************************************************
- #define RD_EN 0x01 ;read enable macro
- #define WRT_EN 0x02 ;write enable macro
- #define RW_DIS 0x07 ;read/write disable macro
- #define CD PORTA,RA0 ;GLCD Command/Data (high = Command/low = Data)
- #define RST PORTA,RA1 ;GLCD Reset (active low)
- #define FONT PORTA,RA2 ;GLCD Font Select (high = 6x8 font/low = 8x8 font)
- #define WRITE PORTC,RC0 ;GLCD Read (active low)
- #define READ PORTC,RC1 ;GLCD Write (active low)
- #define CE PORTC,RC2 ;GLCD Chip Enable (active low)
- #define STA0 PORTB,RB0 ;GLCD data port bit 0
- #define STA1 PORTB,RB1 ;GLCD data port bit 1
- #define DARRDY PORTB,RB2 ;GLCD data port bit 2
- #define DAWRDY PORTB,RB3 ;GLCD data port bit 3
- #define D4 PORTB,RB4 ;GLCD data port bit 4
- #define D5 PORTB,RB5 ;GLCD data port bit 5
- #define D6 PORTB,RB6 ;GLCD data port bit 6
- #define D7 PORTB,RB7 ;GLCD data port bit 7
- ;*****************************************************************************************
- ;** **
- ;** Single Byte Instructions **
- ;** **
- ;*****************************************************************************************
- ;mode set instructions
- #define OR_CGROM 0x80 ;text OR'ed with graphics, CG-ROM on
- #define XOR_CGROM 0x81 ;text XOR'ed with graphics, CG-ROM on
- #define AND_CGROM 0x83 ;text AND'ed with graphics, CG-ROM on
- #define TATTR_CGROM 0x84 ;text attribute mode, CG-ROM on
- #define OR_CGRAM 0x88 ;text OR'ed with graphics, CG-RAM on
- #define XOR_CGRAM 0x89 ;text XOR'ed with graphics, CG-RAM on
- #define AND_CGRAM 0x8B ;text AND'ed with graphics, CG-RAM on
- #define TATTR_CGRAM 0x8C ;text attribute mode, CG-RAM on
- ;cursor pattern select instructions
- #define CSR1 0xA0 ;1 line cursor
- #define CSR2 0xA1 ;2 line cursor
- #define CSR3 0xA2 ;3 line cursor
- #define CSR4 0xA3 ;4 line cursor
- #define CSR5 0xA4 ;5 line cursor
- #define CSR6 0xA5 ;6 line cursor
- #define CSR7 0xA6 ;7 line cursor
- #define CSR8 0xA7 ;8 line cursor (block cursor)
- ;display mode set instructions
- #define DIS_MODE1 0x94 ;text RAM on, cursor off
- #define DIS_MODE2 0x96 ;text RAM on, cursor on, blink off
- #define DIS_MODE3 0x97 ;text RAM on, cursor on, blink on
- #define DIS_MODE4 0x98 ;graphics RAM on, cursor off
- #define DIS_MODE5 0x9A ;graphics RAM on, cursor on, blink off
- #define DIS_MODE6 0x9B ;graphics RAM on, cursor on, blink on
- #define DIS_MODE7 0x9C ;text/graphics RAM on, cursor off
- #define DIS_MODE8 0x9E ;text/graphics RAM on, cursor on, blink off
- #define DIS_MODE9 0x9F ;text/graphics RAM on, cursor on, blink on
- ;*****************************************************************************************
- ;** **
- ;** Start Here **
- ;** **
- ;*****************************************************************************************
- org 0x000 ;reset vector
- goto START
- org 0x004 ;interrupt vector
- goto ISR
- org 0x005 ;data table vector
- ;*****************************************************************************************
- ;** **
- ;** Character Map **
- ;** **
- ;*****************************************************************************************
- ALPHA addwf PCL,F
- retlw 0x00 ;blank space
- retlw 0x21 ;A
- retlw 0x22 ;B
- retlw 0x23 ;C
- retlw 0x24 ;D
- retlw 0x25 ;E
- retlw 0x26 ;F
- retlw 0x27 ;G
- retlw 0x28 ;H
- retlw 0x29 ;I
- retlw 0x2A ;J
- retlw 0x2B ;K
- retlw 0x2C ;L
- retlw 0x2D ;M
- retlw 0x2E ;N
- retlw 0x2F ;O
- retlw 0x30 ;P
- retlw 0x31 ;Q
- retlw 0x32 ;R
- retlw 0x33 ;S
- retlw 0x34 ;T
- retlw 0x35 ;U
- retlw 0x36 ;V
- retlw 0x37 ;W
- retlw 0x38 ;X
- retlw 0x39 ;Y
- retlw 0x3A ;Z
- DIGIT addwf PCL,F
- retlw 0x10 ;0
- retlw 0x11 ;1
- retlw 0x12 ;2
- retlw 0x13 ;3
- retlw 0x14 ;4
- retlw 0x15 ;5
- retlw 0x16 ;6
- retlw 0x17 ;7
- retlw 0x18 ;8
- retlw 0x19 ;9
- retlw 0x21 ;A
- retlw 0x22 ;B
- retlw 0x23 ;C
- retlw 0x24 ;D
- retlw 0x25 ;E
- retlw 0x26 ;F
- PUNCTUATION addwf PCL,F
- retlw 0x01 ; !
- retlw 0x02 ; "
- retlw 0x03 ; #
- retlw 0x04 ; $
- retlw 0x05 ; %
- retlw 0x06 ; &
- retlw 0x07 ; '
- retlw 0x08 ; (
- retlw 0x09 ; )
- retlw 0x0A ; *
- retlw 0x0B ; +
- retlw 0x0C ; ,
- retlw 0x0D ; -
- retlw 0x0E ; .
- retlw 0x0F ; /
- retlw 0x1A ; :
- retlw 0x1B ; ;
- retlw 0x1C ; <
- retlw 0x1D ; =
- retlw 0x1E ; >
- retlw 0x1F ; ?
- retlw 0x20 ; @
- retlw 0x3B ; [
- retlw 0x3C ; \
- retlw 0x3D ; ]
- retlw 0x3E ; ^
- retlw 0x3F ; _
- retlw 0x5B ; {
- retlw 0x5D ; }
- retlw 0x5E ; ~
- FUNCTION addwf PCL,F
- goto Chan1
- goto Chan2
- goto Chan3
- goto Chan4
- goto MuteOn
- goto MuteOff
- goto MR2On
- goto MR2Off
- goto MCutOn
- goto MCutOff
- goto FXOn
- goto FXOff
- org 0x100
- ;*****************************************************************************************
- ;** **
- ;** Interrupt Handler **
- ;** **
- ;*****************************************************************************************
- ISR movwf W_TEMP ;W save
- swapf STATUS,W ;STATUS save
- banksel 0 ;bank 0
- movwf STATUS_TEMP
- movfw PCLATH ;PCLATH save
- movwf PCLATH_TEMP
- ;*****************************************************************************************
- ;query interrupt bits
- btfsc PIR1,RCIF
- call MIDIRx
- btfsc INTCON,T0IF
- call TIMER0
- goto ISRExit
- ;*****************************************************************************************
- ;MIDI receive interrupt
- MIDIRx movfw RCREG
- btfsc MIDIFLAGS,0
- goto MIDIData
- movwf MIDICHANNELL
- movfw MIDICHANNELL
- andlw 0xF0
- xorlw 0xC0
- btfss STATUS,Z
- goto MIDIRxExit
- movlw 0x0F
- andwf MIDICHANNELL,F
- incf MIDICHANNELL,F
- incf MIDIFLAGS,F
- goto MIDIRxExit
- MIDIData movwf MIDIDATA
- incf MIDIFLAGS,F
- MIDIRxExit btfss RCSTA,OERR
- btfsc RCSTA,FERR
- call ClrSerErr
- return
- ;*****************************************************************************************
- ;timer 0 interrupt
- TIMER0 btfss MIDIFLAGS,1
- goto T0Exit
- ;process channel byte
- clrf MIDICHANNELH
- movlw 10
- subwf MIDICHANNELL,F
- btfss STATUS,C
- goto $+3
- goto TEN
- movlw 10
- addwf MIDICHANNELL,F
- movlw 0x4E
- movwf DATAL
- movlw 0x18
- movwf DATAH
- call ADDR_PTR
- call DAWSet
- goto ONE
- TEN incf MIDICHANNELH,F
- movlw 0x4E
- movwf DATAL
- movlw 0x18
- movwf DATAH
- call ADDR_PTR
- call DAWSet
- movfw MIDICHANNELH
- call DAWDLoad
- ONE movfw MIDICHANNELL
- call DAWDLoad
- movlw 0
- call DAWALoad
- call DAReset
- ;process data byte
- movlw 200
- subwf MIDIDATA,F
- movlw 12
- subwf MIDIDATA,W
- btfsc STATUS,C
- goto $+3
- movfw MIDIDATA
- call FUNCTION
- clrf MIDIFLAGS
- T0Exit clrf TMR0
- bcf INTCON,T0IF
- return
- ;*****************************************************************************************
- ISRExit movfw PCLATH_TEMP ;PCLATH restore
- movwf PCLATH
- swapf STATUS_TEMP,W ;STATUS restore
- movwf STATUS
- swapf W_TEMP,F ;W restore
- swapf W_TEMP,W
- retfie ;return to main code
- ;*****************************************************************************************
- ;** **
- ;** Serial Error Clear **
- ;** **
- ;*****************************************************************************************
- ClrSerErr bcf RCSTA,CREN
- movfw RCREG
- movfw RCREG
- bsf RCSTA,CREN
- ;*****************************************************************************************
- ;** **
- ;** Delay Routines **
- ;** **
- ;*****************************************************************************************
- Delay50mS clrf TMR2 ;init timer 2
- bcf PIR1,TMR2IF ;clear timer 2 interrupt flag
- btfss PIR1,TMR2IF ;timer 2 PR2 match?
- goto $-1 ;no, check again
- return ;yes, done
- Delay movwf DELAYCOUNT ;init delay counter
- call Delay50mS
- decfsz DELAYCOUNT,F ;decrement counter
- goto $-2
- return
- ;*****************************************************************************************
- ;** **
- ;** GLCD Two Data Byte Instructions **
- ;** **
- ;*****************************************************************************************
- CSR_PTR movlw 0x21 ;set cursor pointer
- goto InstLoad
- OFST_PTR movlw 0x22 ;set offset address
- goto InstLoad
- ADDR_PTR movlw 0x24 ;set address pointer
- goto InstLoad
- TXT_HOME movlw 0x40 ;set text home address
- goto InstLoad
- TXT_AREA movlw 0x41 ;set text area
- goto InstLoad
- GRPH_HOME movlw 0x42 ;set graphics home address
- goto InstLoad
- GRPH_AREA movlw 0x43 ;set graphics area
- goto InstLoad
- InstLoad movwf COMMAND ;load instruction into instruction buffer
- call TwoData
- return
- ;*****************************************************************************************
- ;** **
- ;** GLCD Data Auto Instructions **
- ;** **
- ;*****************************************************************************************
- ;data auto reset
- DAReset call DAWStat
- movlw 0xB2
- call Command
- return
- ;*****************************************************************************************
- ;data auto write set
- DAWSet movlw 0xB0
- movwf COMMAND
- call NoData
- call LCDStat
- return
- ;*****************************************************************************************
- ;data auto write
- DAWWrite call DAWStat ;check DAWRDY bit
- movfw DATAL ;load byte
- call DWrite ;send byte
- return
- ;*****************************************************************************************
- ;** **
- ;** GLCD Status Check **
- ;** **
- ;*****************************************************************************************
- ;status read mode enable
- StatReadEn bsf CD ;command mode
- movlw RD_EN ;enable read
- movwf PORTC
- return
- ;*****************************************************************************************
- ;status read mode disable
- StatReadDis movlw RW_DIS ;disable read
- movwf PORTC
- return
- ;*****************************************************************************************
- ;general GLCD status check
- LCDStat call StatReadEn ;enable read
- btfsc STA0 ;STA0 = 1?
- btfss STA1 ;STA1 = 1?
- goto $-2 ;no, check again
- call StatReadDis ;disable read
- return ;done
- ;*****************************************************************************************
- ;data auto write status check
- DAWStat call StatReadEn ;enable read
- btfss DAWRDY ;DAWRDY = 1?
- goto $-1 ;no, check again
- call StatReadDis ;disable read
- return ;done
- ;*****************************************************************************************
- ;data auto write status check
- DARStat call StatReadEn ;enable read
- btfss DARRDY ;DARRDY = 1?
- goto $-1 ;no, check again
- call StatReadDis ;disable read
- return ;done
- ;*****************************************************************************************
- ;** **
- ;** GLCD Instruction Send **
- ;** **
- ;*****************************************************************************************
- TwoData call LCDStat ;check status
- movfw DATAL ;load first data byte
- call DWrite ;send first data byte
- OneData call LCDStat ;check status
- movfw DATAH ;load second data byte
- call DWrite ;send second data byte
- NoData call LCDStat ;check status
- movfw COMMAND ;load instruction
- call Command ;send instruction
- return ;done
- ;*****************************************************************************************
- ;** **
- ;** GLCD Command/Data Write **
- ;** **
- ;*****************************************************************************************
- Command bsf CD ;command mode
- goto $+2
- DWrite bcf CD ;data mode
- movwf PORTB ;transfer data to bidirectional data port latch
- movlw WRT_EN ;enable write
- movwf PORTC
- banksel TRISD ;bank 1
- clrf TRISD ;port d output
- banksel 0 ;bank 0
- movlw RW_DIS ;disable read/write
- movwf PORTC
- banksel TRISD ;bank 1
- comf TRISD,F ;port d input
- banksel 0 ;bank 0
- return
- ;*****************************************************************************************
- ;** **
- ;** GLCD VRAM Clear **
- ;** **
- ;*****************************************************************************************
- VRAMClear call DAWSet
- movlw 0
- movwf DATAL
- movlw 40
- movwf COUNT1
- call DAWWrite
- decfsz COUNT1,F
- goto $-2
- decfsz COUNT2,F
- goto $-6
- goto WordExit
- ;*****************************************************************************************
- ;** **
- ;** GLCD Letter Auto Write **
- ;** **
- ;*****************************************************************************************
- DAWDLoad call DIGIT
- goto $+4
- DAWALoad call ALPHA
- goto $+2
- DAWPLoad call PUNCTUATION
- movwf DATAL
- call DAWWrite
- return
- ;*****************************************************************************************
- ;** **
- ;** Function Messages **
- ;** **
- ;*****************************************************************************************
- Chan1 movlw 1
- goto $+6
- Chan2 movlw 2
- goto $+4
- Chan3 movlw 3
- goto $+2
- Chan4 movlw 4
- movwf AMPCHANNEL
- call Line2
- call AmpChannel
- call Select
- call Line3
- call AmpChannel
- call DAWSet
- movfw AMPCHANNEL
- call DAWDLoad
- call DAReset
- movlw 5
- goto LineExit
- ;*****************************************************************************************
- MuteOn call Line3
- call Mute
- call Active
- goto $+4
- MuteOff call Line3
- call Mute
- call Bypass
- movlw 6
- call LineClear
- call Line2
- call Mute
- call Select
- movlw 9
- goto LineExit
- ;*****************************************************************************************
- MR2On call Line3
- call Master2
- call Active
- goto $+4
- MR2Off call Line3
- call Master2
- call Bypass
- movlw 5
- call LineClear
- call Line2
- call Master2
- call Select
- movlw 5
- goto LineExit
- ;*****************************************************************************************
- MCutOn call Line3
- call MidCut
- call Active
- goto $+4
- MCutOff call Line3
- call MidCut
- call Bypass
- movlw 5
- call LineClear
- call Line2
- call MidCut
- call Select
- movlw 5
- goto LineExit
- ;*****************************************************************************************
- FXOn call Line3
- call FXLoop
- call Active
- goto $+4
- FXOff call Line3
- call FXLoop
- call Bypass
- movlw 5
- call LineClear
- call Line2
- call FXLoop
- call Select
- movlw 5
- goto LineExit
- ;*****************************************************************************************
- Line2 movlw 154
- goto $+2
- Line3 movlw 230
- movwf DATAL
- movlw 0x18
- movwf DATAH
- call ADDR_PTR
- return
- ;*****************************************************************************************
- LineClear movwf COUNT1
- call DAWSet
- movlw 0
- call DAWALoad
- decfsz COUNT1,F
- goto $-3
- goto WordExit
- ;*****************************************************************************************
- ;** **
- ;** Data Messages **
- ;** **
- ;*****************************************************************************************
- ;Active
- Active call DAWSet ;enable data auto write mode
- movlw 1 ;A
- call DAWALoad
- movlw 3 ;C
- call DAWALoad
- movlw 20 ;T
- call DAWALoad
- movlw 9 ;I
- call DAWALoad
- movlw 22 ;V
- call DAWALoad
- movlw 5 ;E
- call DAWALoad
- goto WordExit
- ;*****************************************************************************************
- ;Bypass
- Bypass call DAWSet ;enable data auto write mode
- movlw 2 ;B
- call DAWALoad
- movlw 25 ;Y
- call DAWALoad
- movlw 16 ;P
- call DAWALoad
- movlw 1 ;A
- call DAWALoad
- movlw 19 ;S
- call DAWALoad
- movlw 19 ;S
- call DAWALoad
- goto WordExit
- ;*****************************************************************************************
- ;Channel
- AmpChannel call DAWSet ;enable data auto write mode
- movlw 1 ;A
- call DAWALoad
- movlw 13 ;M
- call DAWALoad
- movlw 16 ;P
- call DAWALoad
- movlw 0 ;
- call DAWALoad
- movlw 3 ;C
- call DAWALoad
- movlw 8 ;H
- call DAWALoad
- movlw 1 ;A
- call DAWALoad
- movlw 14 ;N
- call DAWALoad
- movlw 14 ;N
- call DAWALoad
- movlw 5 ;E
- call DAWALoad
- movlw 12 ;L
- call DAWALoad
- movlw 0 ;
- call DAWALoad
- goto WordExit
- ;*****************************************************************************************
- ;FX Loop
- FXLoop call DAWSet ;enable data auto write mode
- movlw 6 ;F
- call DAWALoad
- movlw 24 ;X
- call DAWALoad
- movlw 0 ;
- call DAWALoad
- movlw 12 ;L
- call DAWALoad
- movlw 15 ;O
- call DAWALoad
- movlw 15 ;O
- call DAWALoad
- movlw 16 ;P
- call DAWALoad
- movlw 0 ;
- call DAWALoad
- goto WordExit
- ;*****************************************************************************************
- ;Master 2
- Master2 call DAWSet ;enable data auto write mode
- movlw 13 ;M
- call DAWALoad
- movlw 1 ;A
- call DAWALoad
- movlw 19 ;S
- call DAWALoad
- movlw 20 ;T
- call DAWALoad
- movlw 5 ;E
- call DAWALoad
- movlw 18 ;R
- call DAWALoad
- movlw 0 ;
- call DAWALoad
- movlw 2 ;2
- call DAWDLoad
- movlw 0 ;
- call DAWALoad
- goto WordExit
- ;*****************************************************************************************
- ;Mid Cut
- MidCut call DAWSet ;enable data auto write mode
- movlw 13 ;M
- call DAWALoad
- movlw 9 ;I
- call DAWALoad
- movlw 4 ;D
- call DAWALoad
- movlw 0 ;
- call DAWALoad
- movlw 3 ;C
- call DAWALoad
- movlw 21 ;U
- call DAWALoad
- movlw 20 ;T
- call DAWALoad
- movlw 0 ;
- call DAWALoad
- goto WordExit
- ;*****************************************************************************************
- ;Mute
- Mute call DAWSet ;enable data auto write mode
- movlw 13 ;M
- call DAWALoad
- movlw 21 ;U
- call DAWALoad
- movlw 20 ;T
- call DAWALoad
- movlw 5 ;E
- call DAWALoad
- movlw 0 ;
- call DAWALoad
- goto WordExit
- ;*****************************************************************************************
- ;Select
- Select call DAWSet ;enable auto data write mode
- movlw 19 ;S
- call DAWALoad
- movlw 5 ;E
- call DAWALoad
- movlw 12 ;L
- call DAWALoad
- movlw 5 ;E
- call DAWALoad
- movlw 3 ;C
- call DAWALoad
- movlw 20 ;T
- call DAWALoad
- goto WordExit
- LineExit call LineClear
- goto $+2
- WordExit call DAReset ;disable data auto write mode
- return
- org 0x400
- ;*****************************************************************************************
- ;** **
- ;** Initialization Routine **
- ;** **
- ;*****************************************************************************************
- START movlw 0x05 ;Command mode, 6x8 font, reset
- movwf PORTA ;init port output latches
- clrf PORTB
- movlw RW_DIS ;read,write and ce disabled
- movwf PORTC
- clrf PORTD
- clrf PORTE
- banksel ANSEL ;bank 3
- clrf ANSEL
- clrf ANSELH
- banksel TRISA ;bank 1
- clrf TRISA ;PORTA - PORTC, PORTE output
- clrf TRISB
- movlw b'10000000' ;RC7 = UART RX, RC0-RC6 output
- movwf TRISC
- clrf TRISD
- clrf TRISE
- ;timer 0 init
- movlw 0xD7
- movwf OPTION_REG
- movlw 195 ;set PR2 for 50mS overflow
- movwf PR2
- ;UART init
- movlw 0x01 ;baud = 31.25K for MIDI
- movwf SPBRG
- clrf TXSTA ;asynchronous serial, disable tx
- banksel 0 ;bank 0
- bsf RCSTA,CREN ;enable continuous rx
- ;timer 2 init
- movlw b'01111110' ;timer 2 1:16 prescaler
- movwf T2CON ;and 1:16 postscaler
- ;*****************************************************************************************
- ;** **
- ;** GLCD Initialization **
- ;** **
- ;*****************************************************************************************
- GLCDInit call Delay50mS ;wait 50mS
- bsf RST ;release GLCD reset
- ;GLCD mode select - XOR mode w/CG-ROM
- movlw XOR_CGROM
- movwf COMMAND
- call NoData
- ;graphics home address set
- movlw 0x00
- movwf DATAL
- movlw 0x00
- movwf DATAH
- call GRPH_HOME
- ;graphics area set - 40 columns @ 6 pixels per column
- movlw 0x28
- movwf DATAL
- movlw 0x00
- movwf DATAH
- call GRPH_AREA
- ;text home address set - address 0x1700
- movlw 0x00
- movwf DATAL
- movlw 0x17
- movwf DATAH
- call TXT_HOME
- ;text area set - 40 columns @ 1 character per column
- movlw 0x28
- movwf DATAL
- movlw 0x00
- movwf DATAH
- call TXT_AREA
- ;set offset register - 0x03
- movlw 0x03
- movwf DATAL
- movlw 0x00
- movwf DATAH
- call OFST_PTR
- ;set address pointer to graphics home address
- movlw 0x00
- movwf DATAL
- movlw 0x00
- movwf DATAH
- call ADDR_PTR
- ;clear graphics RAM
- movlw 128
- movwf COUNT2
- call VRAMClear
- ;set address pointer to text home address
- movlw 0x00
- movwf DATAL
- movlw 0x17
- movwf DATAH
- call ADDR_PTR
- ;clear text RAM
- movlw 32
- movwf COUNT2
- call VRAMClear
- ;set cursor pointer - position row 0 column 0
- movlw 5
- movwf DATAL
- movlw 0
- movwf DATAH
- call CSR_PTR
- ;set cursor pattern - single line cursor
- movlw CSR1
- movwf COMMAND
- call NoData
- ;set display mode - text & graphics RAM on, cursor off
- movlw DIS_MODE7
- movwf COMMAND
- call NoData
- ;*****************************************************************************************
- ;** **
- ;** Begin Main Program **
- ;** **
- ;*****************************************************************************************
- movlw 40
- call Delay
- ;set address pointer to text home address
- movlw 0x33
- movwf DATAL
- movlw 0x17
- movwf DATAH
- call ADDR_PTR
- ;*****************************************************************************************
- ;** **
- ;** Splash Screen **
- ;** **
- ;*****************************************************************************************
- call DAWSet ;enable data auto write mode
- movlw 19 ;S
- call DAWALoad
- movlw 9 ;I
- call DAWALoad
- movlw 14 ;N
- call DAWALoad
- movlw 9 ;I
- call DAWALoad
- movlw 19 ;S
- call DAWALoad
- movlw 20 ;T
- call DAWALoad
- movlw 5 ;E
- call DAWALoad
- movlw 18 ;R
- call DAWALoad
- movlw 0 ;
- call DAWALoad
- movlw 4 ;D
- call DAWALoad
- movlw 5 ;E
- call DAWALoad
- movlw 19 ;S
- call DAWALoad
- movlw 9 ;I
- call DAWALoad
- movlw 7 ;G
- call DAWALoad
- movlw 14 ;N
- call DAWALoad
- movlw 19 ;S
- call DAWALoad
- call DAReset ;disable data auto write mode
- movlw 40 ;wait 2 seconds
- call Delay
- movlw 0x82
- movwf DATAL
- movlw 0x17
- movwf DATAH
- call ADDR_PTR
- call DAWSet ;enable data auto write mode
- movlw 4 ;D
- call DAWALoad
- movlw 9 ;I
- call DAWALoad
- movlw 5 ;E
- call DAWALoad
- movlw 26 ;Z
- call DAWALoad
- movlw 5 ;E
- call DAWALoad
- movlw 12 ;L
- call DAWALoad
- movlw 0 ;
- call DAWALoad
- movlw 8 ;H
- call DAWALoad
- movlw 5 ;E
- call DAWALoad
- movlw 18 ;R
- call DAWALoad
- movlw 2 ;B
- call DAWALoad
- movlw 5 ;E
- call DAWALoad
- movlw 18 ;R
- call DAWALoad
- movlw 20 ;T
- call DAWALoad
- movlw 14 ;/
- call DAWPLoad
- movlw 22 ;V
- call DAWALoad
- movlw 8 ;H
- call DAWALoad
- movlw 4 ;4
- call DAWDLoad
- call DAReset ;disable data auto write mode
- movlw 40 ;wait 2 seconds
- call Delay
- movlw 0xD0
- movwf DATAL
- movlw 0x17
- movwf DATAH
- call ADDR_PTR
- call DAWSet ;enable data auto write mode
- movlw 6 ;F
- call DAWALoad
- movlw 15 ;O
- call DAWALoad
- movlw 15 ;O
- call DAWALoad
- movlw 20 ;T
- call DAWALoad
- movlw 19 ;S
- call DAWALoad
- movlw 23 ;W
- call DAWALoad
- movlw 9 ;I
- call DAWALoad
- movlw 20 ;T
- call DAWALoad
- movlw 3 ;C
- call DAWALoad
- movlw 8 ;H
- call DAWALoad
- movlw 0 ;
- call DAWALoad
- movlw 4 ;D
- call DAWALoad
- movlw 5 ;E
- call DAWALoad
- movlw 3 ;C
- call DAWALoad
- movlw 15 ;O
- call DAWALoad
- movlw 4 ;D
- call DAWALoad
- movlw 5 ;E
- call DAWALoad
- movlw 18 ;R
- call DAWALoad
- movlw 0 ;
- call DAWALoad
- movlw 20 ;T
- call DAWALoad
- movlw 15 ;O
- call DAWALoad
- movlw 15 ;O
- call DAWALoad
- movlw 12 ;L
- call DAWALoad
- call DAReset ;disable data auto write mode
- movlw 40 ;wait 2 seconds
- call Delay
- bcf T2CON,1 ;change timer 2 to allow 1mS delay
- banksel PR2
- movlw 64
- movwf PR2
- banksel 0
- movlw 0x00 ;address pointer to graphics home address
- movwf DATAL
- movlw 0x00
- movwf DATAH
- call ADDR_PTR
- movlw 63
- movwf DATAL
- movlw 64
- movwf COUNT2
- movlw 2
- movwf COUNT3
- SCROLL call DAWSet
- movlw 40
- movwf COUNT1
- call DAWWrite
- call Delay50mS
- decfsz COUNT1,F
- goto $-3
- decfsz COUNT2,F
- goto $-7
- call DAReset
- movlw 0x00
- movwf DATAL
- movlw 0x00
- movwf DATAH
- call ADDR_PTR
- movlw 0
- movwf DATAL
- movlw 64
- movwf COUNT2
- decfsz COUNT3,F
- goto SCROLL
- bsf T2CON,1 ;change timer 2 to allow for 50mS delay
- banksel PR2
- movlw 195
- movwf PR2
- banksel 0
- ;*****************************************************************************************
- ;** **
- ;** Main Screen **
- ;** **
- ;*****************************************************************************************
- movlw 0x40
- movwf DATAL
- movlw 0x18
- movwf DATAH
- call ADDR_PTR
- call DAWSet ;enable data auto write mode
- movlw 13 ;M
- call DAWALoad
- movlw 9 ;I
- call DAWALoad
- movlw 4 ;D
- call DAWALoad
- movlw 9 ;I
- call DAWALoad
- movlw 0 ;
- call DAWALoad
- movlw 3 ;C
- call DAWALoad
- movlw 8 ;H
- call DAWALoad
- movlw 1 ;A
- call DAWALoad
- movlw 14 ;N
- call DAWALoad
- movlw 14 ;N
- call DAWALoad
- movlw 5 ;E
- call DAWALoad
- movlw 12 ;L
- call DAWALoad
- movlw 15 ;:
- call DAWPLoad
- call DAReset ;disable data auto write mode
- movlw 144
- movwf DATAL
- movlw 0x18
- movwf DATAH
- call ADDR_PTR
- call DAWSet ;enable data auto write mode
- movlw 6 ;F
- call DAWALoad
- movlw 21 ;U
- call DAWALoad
- movlw 14 ;N
- call DAWALoad
- movlw 3 ;C
- call DAWALoad
- movlw 20 ;T
- call DAWALoad
- movlw 9 ;I
- call DAWALoad
- movlw 15 ;O
- call DAWALoad
- movlw 14 ;N
- call DAWALoad
- movlw 15 ;:
- call DAWPLoad
- call DAReset ;disable data auto write mode
- movlw 224
- movwf DATAL
- movlw 0x18
- movwf DATAH
- call ADDR_PTR
- call DAWSet ;enable data auto write mode
- movlw 4 ;D
- call DAWALoad
- movlw 1 ;A
- call DAWALoad
- movlw 20 ;T
- call DAWALoad
- movlw 1 ;A
- call DAWALoad
- movlw 15 ;:
- call DAWPLoad
- movlw 0 ;
- call DAWALoad
- call DAReset ;disable data auto write mode
- movlw 40 ;wait 2 seconds
- call Delay
- movlw 6
- movwf COUNT1
- movlw 2
- movwf COUNT2
- movlw 40
- movwf DATAL
- movlw 0x17
- movwf DATAH
- TXTScroll call TXT_HOME
- movlw 2
- call Delay
- movlw 40
- addwf DATAL,F
- decfsz COUNT1,F
- goto TXTScroll
- incf DATAH,F
- movlw 2
- movwf COUNT1
- decfsz COUNT2,F
- goto TXTScroll
- ;Initialization is complete at this point. Unit will begin to recieve/process/display
- ;MIDI data from the Diezel Herbert/VH4 controller from here on out.
- ;*****************************************************************************************
- ;** **
- ;** MIDI Receive/Process **
- ;** **
- ;*****************************************************************************************
- MAIN clrf MIDIFLAGS ;clear MIDI flags
- bsf RCSTA,SPEN ;enable serial port
- banksel PIE1 ;bank 1
- bsf PIE1,RCIE ;enable serial rx interrupt
- banksel 0 ;bank 0
- clrf TMR0 ;clear timer 0
- movlw b'11100000' ;enable timer 0 and serial rx interrupts
- movwf INTCON
- goto $ ;wait for interrupts
- end ;end of file
Add Comment
Please, Sign In to add comment