Start     ORG 0x00             ;This sets up the ports  
          BSF 	03,5
          MOVLW 00h
          MOVWF 05h
          MOVWF 06h
          BCF 	03,5
          ;org   04h          
          GOTO 	Run1

              ;Table1  holds the hex values for each column of LEDs 


Table1 		ADDWF 	02h,1         	;Add W to Program Counter

		RETLW 	.00  ;                      
             	RETLW 	7fh  ;
             	RETLW 	49h ;
             	RETLW 	49h  ;          ;Ba
                retlw   49h
                retlw   36h

		RETLW 	.00  ; 
             	RETLW 	.65  ; 
             	RETLW 	.127  ;    
                RETLW 	.65  ;            ;I
                ;RETLW	.64  ;
             	;RETLW 	.63  ;

		retlw   .00
		retlw	7fh
		retlw	49h            ;E
		retlw   49h
		retlw	41h

		retlw	.00
		retlw   7fh
		retlw	04h
		retlw   08h            ;N
		retlw   10h
		retlw   7fh

		

		retlw	.00
		retlw	.31
		retlw	.32          ;V
		retlw	.64
		retlw	.32
		retlw	.31

		retlw   .00
		retlw	7fh
		retlw	49h            ;E
		retlw   49h
		retlw	41h

		retlw	.00
		retlw   7fh
		retlw	04h
		retlw   08h            ;N
		retlw   10h
		retlw   7fh

		RETLW 	.00   
             	RETLW 	.65  
             	RETLW 	.127     
                RETLW 	.65              ;I

		retlw	.00
		retlw	.127
		retlw	.65
		retlw	.65              ;D
		retlw	.65
		retlw	.62

		retlw   .00
		retlw	3eh
		retlw	41h
		retlw   41h                ;O
		retlw	41h
		retlw   3eh

                RETLW 	.00  
             	RETLW 	26h 
             	RETLW 	49h    
            	RETLW 	49h               ;S
             	RETLW 	49h   
             	RETLW 	32h 
		
		retlw	.00
		retlw	.00

		retlw	.00
		retlw	7eh
		retlw   09h
		retlw	09h             ;A
		retlw   09h
		retlw	7eh

		retlw	.00
		retlw	.00

		retlw   .00
		retlw	7fh
		retlw	49h            ;E
		retlw   49h
		retlw	41h

		retlw	.00
		retlw	.127
		retlw	.02           ;M
		retlw	.12
		retlw	.02
		retlw	.127

	        retlw	.00
		retlw	.127
		retlw	.17          ;P
		retlw	.17
		retlw	.17
		retlw	.14

		retlw	.00
		retlw	.127
		retlw	.17          ;R
		retlw	.17
		retlw	.17
		retlw	.110

		retlw   .00
		retlw	7fh
		retlw	49h            ;E
		retlw   49h
		retlw	41h

		RETLW 	.00  
             	RETLW 	26h 
             	RETLW 	49h    
            	RETLW 	49h               ;S
             	RETLW 	49h   
             	RETLW 	32h

		retlw	.00
		retlw	7eh
		retlw   09h
		retlw	09h             ;A
		retlw   09h
		retlw	7eh

		retlw	.00
		retlw	.00

		retlw   .00
		retlw	3eh
		retlw   41h
		retlw	49h            ;G
		retlw   49h
		retlw	3Ah

		retlw   .00
		retlw	7fh
		retlw	49h            ;E
		retlw   49h
		retlw	41h

		retlw	.00
		retlw   7fh
		retlw	04h
		retlw   08h            ;N
		retlw   10h
		retlw   7fh

		retlw   .00
		retlw	7fh
		retlw	49h            ;E
		retlw   49h
		retlw	41h

		retlw	.00
		retlw	.127
		retlw	.17          ;R
		retlw	.17
		retlw	.17
		retlw	.110

		retlw	.00
		retlw	7eh
		retlw   09h
		retlw	09h             ;A
		retlw   09h
		retlw	7eh

		retlw	.00
		retlw	.127
		retlw	.64            ;L
		retlw	.64
		retlw	.64
		retlw	.64

		retlw	.00
		retlw	.00

		RETLW 	.00  
             	RETLW 	26h 
             	RETLW 	49h    
            	RETLW 	49h               ;S
             	RETLW 	49h   
             	RETLW 	32h

		retlw	.00
		retlw	7eh
		retlw   09h
		retlw	09h             ;A
		retlw   09h
		retlw	7eh

		retlw	.00
		retlw	.31
		retlw	.32          ;V
		retlw	.64
		retlw	.32
		retlw	.31

		RETLW 	.00   
             	RETLW 	.65  
             	RETLW 	.127     
                RETLW 	.65              ;I

		retlw   .00
		retlw	3eh
		retlw	41h
		retlw   41h                ;O
		retlw	41h
		retlw   3eh

		retlw	.00
		retlw   .00

                RETLW 	.00  ;  "E"
             	RETLW 	3fh ;0000000
             	RETLW 	40h  ;0  0  0 
             	RETLW 	40h  ;0  0  0         ;U
             	RETLW 	40h
                retlw   3fh  ;0     0

                retlw   .00
                retlw   3eh
		retlw	41h
		retlw   41h                 ;C
		retlw	41h
		retlw   22h

	        retlw   .00
		retlw	3eh
		retlw	41h
		retlw   51h                ;Q
		retlw	61h
		retlw   7eh

	        retlw	.00
		retlw	7Fh
		retlw	08h
		retlw	08h       ;H
		retlw	08h
		retlw	7Fh

		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h
		retlw		00h






	
		retlw	.255




Run1            CLRF 11h           ;Clear the Ghost locations ready for starting 
                CLRF 12h
                CLRF 13h
                CLRF 14h
                CLRF 15h
		clrf 26h
		clrf 27h
		clrf 28h
		clrf 29h

		clrf 2Ah
		CLRF 2Bh           ;Clear the Ghost locations ready for starting 
                CLRF 2Ch
                CLRF 2Dh
                CLRF 2Eh
                CLRF 2Fh
		clrf 30h
		clrf 31h
		clrf 32h

		clrf 33h
		clrf 34h
                CLRF 35h           ;Clear the Ghost locations ready for starting 
                CLRF 36h
                CLRF 37h
                CLRF 38h
                CLRF 39h
		clrf 3Ah
		clrf 3Bh

		clrf 3Ch
		clrf 3Dh
		clrf 3Eh        ;Clear the Ghost locations ready for starting 
        
		MOVLW 00
                MOVWF 19h      ;File 19h is the jump value for table
run2            MOVLW 02h
                MOVWF 18h      ;File 18h counts the number of scans
               	CALL Shift         ; and controls the "run speed"
               	INCF 19h,1
               	MOVF 19h,0      ;Put jump value into W 
          	CALL Table1
          	MOVWF 3Eh      ;W contains table data - put it in 15h
               	XORLW 0FFh     ;If table value is FF, 
               	BTFSC 03,2        ; bit 2 of file 3 will be SET (=1)
               	GOTO Run1       ;Start Table1 again
Run3     	DECFSZ 18h,1    ;Scan the display 40h times
              	GOTO Run4
              	GOTO Run2
Run4     	CALL Scan
              	GOTO Run3 

Scan            
		BSF 05,1               ;Reset 4017
             	NOP
             	BCF 05,1

		call DelD       ; 
            	MOVF 11h,0           ;Output the data at the 5 Ghost
            	MOVWF 06h        ;1   ; locations to the display
            	CALL DelD	; 
            	MOVF 12h,0
            	MOVWF 06h	;2
            	CALL DelD	; 
            	MOVF 13h,0
            	MOVWF 06h        ;3
            	CALL DelD	; 
            	MOVF 14h,0
            	MOVWF 06h       ;4
            	CALL DelD	; 
            	MOVF 15h,0
            	MOVWF 06h       ;5
            	CALL DelD	; 
		MOVF 26h,0           ;Output the data at the 5 Ghost
            	MOVWF 06h       ;6    ; locations to the display
            	CALL DelD	; 
            	MOVF 27h,0
            	MOVWF 06h        ;7	
            	CALL DelD	; 
            	MOVF 28h,0
            	MOVWF 06h       ;8
            	CALL DelD	; 
                MOVF 29h,0
            	MOVWF 06h       ;9
            	CALL DelD-0
                
            	;
		
            	
		BSF 05,1               ;Reset 4017
             	NOP
             	BCF 05,1

                call DelD_2
                MOVF 2Ah,0
            	MOVWF 06h
            	CALL DelD_2	; 1
                movf 2Bh,0
		movwf 06h
		call DelD_2     ; 2
		movf 2Ch,0
		movwf 06h
		call DelD_2     ; 3
                movf 2Dh,0
		movwf 06h
		call DelD_2     ; 4
		movf 2Eh,0
		movwf 06h
		call DelD_2     ; 5
                movf 2Fh,0
		movwf 06h
		call DelD_2     ; 6
		movf 30h,0
		movwf 06h
		call DelD_2     ; 7
                movf 31h,0
		movwf 06h
		call DelD_2     ; 8
                movf 32h,0
		movwf 06h
		call DelD_2     ; 9

		                
                BSF 05,1               ;Reset 4017
             	NOP
             	BCF 05,1

                call DelD_3      ; 
                movf 33h,0
                movwf 06h
		call DelD_3    ; 1
		movf 34h,0
		movwf 06h
		call DelD_3     ; 2
                movf 35h,0
		movwf 06h
		call DelD_3    ; 3
		movf 36h,0
		movwf 06h
		call DelD_3     ; 4
                movf 37h,0
		movwf 06h
		call DelD_3    ; 5
		movf 38h,0
		movwf 06h
		call DelD_3     ; 6
                movf 39h,0
		movwf 06h
		call DelD_3    ; 7
		movf 3Ah,0
		movwf 06h
		call DelD_3     ; 8
                movf 3Bh,0
		movwf 06h
		call DelD_3     ; 9

                BSF 05,1               ;Reset 4017
             	NOP
             	BCF 05,1

                call DelD_4      ; 
                movf 3Ch,0
                movwf 06h
		call DelD_4    ; 1
		movf 3Dh,0
		movwf 06h
		call DelD_4     ; 2
                movf 3Eh,0
		movwf 06h
		call DelD_4    ; 3
                movf 3fh,0  
                movwf o6h
                call deld_4   ; 4



                RETURN
 
       ;SHIFT moves the data one place to the left to give the "movement"
       ;  effect on the screen

Shift       	MOVF 12h,0         ;Move file 12h to W
            	MOVWF 11h         ;Move W to file 11h
            	MOVF 13h,0         ;Move file 13h to W
            	MOVWF 12h         ;Move W to file 12h
            	MOVF 14h,0         ;Move file 14h to W
            	MOVWF 13h         ;Move W to file 13h
            	MOVF 15h,0         ;Move file 15h to W
            	MOVWF 14h         ;Move W to file 14h
		movf 26h,0
		movwf 15h
		movf 27h,0
		movwf 26h
		movf 28h,0
		movwf 27h
		movf 29h,0
		movwf 28h
		movf 2Ah,0
                movwf 29h

		movf 2Bh,0
		movwf 2Ah
                MOVF 2Ch,0         ;Move file 12h to W
            	MOVWF 2Bh         ;Move W to file 11h
            	MOVF 2Dh,0         ;Move file 13h to W
            	MOVWF 2Ch         ;Move W to file 12h
            	MOVF 2Eh,0         ;Move file 14h to W
            	MOVWF 2Dh         ;Move W to file 13h
            	MOVF 2Fh,0         ;Move file 15h to W
            	MOVWF 2Eh         ;Move W to file 14h
		movf 30h,0
		movwf 2Fh
		movf 31h,0
		movwf 30h
		movf 32h,0
		movwf 31h
	        movf 33h,0
		movwf 32h

		movf 34h,0
		movwf 33h
                MOVF 35h,0         ;Move file 12h to W
            	MOVWF 34h         ;Move W to file 11h
            	MOVF 36h,0         ;Move file 13h to W
            	MOVWF 35h         ;Move W to file 12h
            	MOVF 37h,0         ;Move file 14h to W
            	MOVWF 36h         ;Move W to file 13h
            	MOVF 38h,0         ;Move file 15h to W
            	MOVWF 37h         ;Move W to file 14h
		movf 39h,0
		movwf 38h
		movf 3Ah,0
		movwf 39h
		movf 3Bh,0
		movwf 3Ah
		movf 3Ch,0
		movwf 3Bh

		movf 3Dh,0
		movwf 3Ch
                movf 3Eh,0
		movwf 3Dh
                RETURN

	 
	
DelD       movlw .128
           movwf 1Bh
DelD1	   DECFSZ 1Bh,1      ;Delay for viewing the 
           GOTO DelD1            ; column of LEDs
           
           clrf 06h
clk        bsf 05,0
           nop                       ; the next output
           BCF 05,0
	   return

	   
DelD_2     movlw .128
           movwf 1Bh
DelD2      DECFSZ 1Bh,1      ;Delay for viewing the 
           GOTO DelD2            ; column of LEDs
           
           clrf 06h
clk2       bsf 05,2
           nop                       ; the next output
           BCF 05,2
           return


DelD_3     movlw .128
           movwf 1Bh     
DelD3      DECFSZ 1Bh,1      ;Delay for viewing the 
           GOTO DelD3            ; column of LEDs
           
           clrf 06h
clk3       bsf 05,3
           nop                       ; the next output
           BCF 05,3
           RETURN

DelD_4     movlw .128
           movwf 1Bh 
DelD4      DECFSZ 1Bh,1      ;Delay for viewing the 
           GOTO DelD4            ; column of LEDs
           
           clrf 06h
clk4       bsf 06,7
           nop                       ; the next output
           BCF 06,7
           RETURN


           
           END 
