OpenCores
URL https://opencores.org/ocsvn/m16c5x/m16c5x/trunk

Subversion Repositories m16c5x

[/] [m16c5x/] [trunk/] [Code/] [MPLAB/] [M16C5x_Tst.lst] - Rev 2

Compare with Previous | Blame | View Log

MPASM  5.50                    M16C5X_TST.ASM   6-22-2013  10:14:54         PAGE  1


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00001 ;**************************************************************************
                      00002 ; M16C5x_Tst.ASM
                      00003 ;
                      00004 ; This sample program runs on most all PIC devices.  To ensure 
                      00005 ; proper execution, replace the processor specified in the LIST directive 
                      00006 ; with your target processor.
                      00007 ;
                      00008 ; Program execution starts at location H'50'.  The loop routine executes 
                      00009 ; seven times.  The routines Reduce and Double execute one time for each 
                      00010 ; loop.
                      00011 ;
                      00012 ; After the loop executes seven times, the program repeats execution from 
                      00013 ; the beginning.
                      00014 ;
                      00015 ;
                      00016 ; Variable    Initial    Description
                      00017 ;              Value
                      00018 ;--------------------------------------------------------------------------
                      00019 ; CountDown     255      Decreases to 128 by subtracting Doubler
                      00020 ; Doubler        1       Increases to 128 by adding to itself
                      00021 ; OuterLoop      7       Decrements by one to 0
                      00022 ;
                      00023 ;           
                      00024 ; The program generates the following values:
                      00025 ;
                      00026 ; Cycle #    CountDown   Doubler     OuterLoop
                      00027 ;   0           255           1           7
                      00028 ;   1           254           2           6
                      00029 ;   2           252           4           5
                      00030 ;   3           248           8           4
                      00031 ;   4           240          16           3
                      00032 ;   5           224          32           2  
                      00033 ;   6           192          64           1   
                      00034 ;   7           128         128           0  
                      00035 ;
                      00036 ;**************************************************************************
                      00037 
                      00038         LIST P=16F59, R=DEC
                      00039 
                      00040 ;--------------------------------------------------------------------------
                      00041 ;   Set ScratchPadRam here.  If you are using a PIC16C5X device, use: 
                      00042 ;ScratchPadRam EQU     0x10
                      00043 ;   Otherwise, use:
                      00044 ;ScratchPadRam EQU     0x20
                      00045 ;--------------------------------------------------------------------------
                      00046 
  00000010            00047 ScratchPadRam   EQU     0x10
                      00048 
                      00049 ;--------------------------------------------------------------------------
                      00050 ; Variables
                      00051 ;--------------------------------------------------------------------------
                      00052 
  00000010            00053 CountDown       EQU     ScratchPadRam+0
MPASM  5.50                    M16C5X_TST.ASM   6-22-2013  10:14:54         PAGE  2


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

  00000011            00054 Doubler         EQU     ScratchPadRam+1
  00000012            00055 OuterLoop       EQU     ScratchPadRam+2
                      00056 
                      00057 
                      00058 ;--------------------------------------------------------------------------
                      00059 ; Program Code
                      00060 ;--------------------------------------------------------------------------
                      00061 ;--------------------------------------------------------------------------
                      00062 ;   Set the reset vector here.  If you are using a PIC16C5X device, use:
                      00063 ;               ORG     <last program memory location>
                      00064 ;   Otherwise, use:
                      00065 ;               ORG     0
                      00066 ;--------------------------------------------------------------------------
                      00067 
07FF                  00068                 ORG     H'7FF'       
Message[306]: Crossing page boundary -- ensure page bits are set.
07FF   0A50           00069                 GOTO    Start
                      00070 
                      00071 ;--------------------------------------------------------------------------
                      00072 ; Main Program
                      00073 ;--------------------------------------------------------------------------
                      00074 
0050                  00075                 ORG     H'50'
                      00076 
0050                  00077 Start
0050   0CFF           00078                 MOVLW   255             ;   Initialize the variables to
0051   0030           00079                 MOVWF   CountDown       ; their starting values.
0052   0C01           00080                 MOVLW   1               
0053   0031           00081                 MOVWF   Doubler      
0054   0C07           00082                 MOVLW   7
0055   0032           00083                 MOVWF   OuterLoop    
0056                  00084 Loop                    
0056   095A           00085                 CALL    Reduce          ;   Perform the inner portion of
0057   02F2           00086                 DECFSZ  OuterLoop,f     ; the loop.
0058   0A56           00087                 GOTO    Loop   
                      00088 
0059   0A50           00089                 GOTO    Start           ;   Repeat the whole thing.
                      00090 
                      00091 ;--------------------------------------------------------------------------
005A                  00092 Reduce
005A   03B1           00093                 SWAPF   Doubler,f       ;   Reduce CountDown by the
005B   0391           00094                 SWAPF   Doubler,w       ; value of Doubler.  Then
005C   03B1           00095                 SWAPF   Doubler,f       ; call the doubling routine.
005D   00B0           00096                 SUBWF   CountDown,f     
005E   0960           00097                 CALL    Double
005F   0800           00098                 RETLW   0
                      00099 
                      00100 ;--------------------------------------------------------------------------
0060                  00101 Double
0060   03B1           00102                 SWAPF   Doubler,f       ;   Double the value of Doubler
0061   0391           00103                 SWAPF   Doubler,w       ; by adding it to itself.
0062   03B1           00104                 SWAPF   Doubler,f 
0063   01F1           00105                 ADDWF   Doubler,f       
MPASM  5.50                    M16C5X_TST.ASM   6-22-2013  10:14:54         PAGE  3


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

0064   0800           00106                 RETLW   0
                      00107 
                      00108                 END
MPASM  5.50                    M16C5X_TST.ASM   6-22-2013  10:14:54         PAGE  4


SYMBOL TABLE
  LABEL                             VALUE 

CountDown                         00000010
Double                            00000060
Doubler                           00000011
Loop                              00000056
OuterLoop                         00000012
Reduce                            0000005A
ScratchPadRam                     00000010
Start                             00000050
__16F59                           00000001
__DEBUG                           1


MEMORY USAGE MAP ('X' = Used,  '-' = Unused)

0040 : ---------------- XXXXXXXXXXXXXXXX XXXXX----------- ----------------
07C0 : ---------------- ---------------- ---------------- ---------------X

All other memory blocks unused.

Program Memory Words Used:    22
Program Memory Words Free:  2026


Errors   :     0
Warnings :     0 reported,     0 suppressed
Messages :     1 reported,     0 suppressed



Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.