home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / MATH / C25SIM.ZIP / foo.lst < prev    next >
File List  |  1994-01-02  |  12KB  |  352 lines

  1. DSP COFF Assembler          Version 5.20             Sun Jan 02 19:07:21 1994
  2.  (c) Copyright 1987, 1989, Texas Instruments Incorporated 
  3.  
  4.                                                                      PAGE    1
  5.  
  6.  0001            ***************************************************************
  7.  0002            ***************************************************************
  8.  0003            *                                *
  9.  0004            *    FOO.ASM - sample C25 code for demonstrating C25SIM    *
  10.  0005            *                                *
  11.  0006            ***************************************************************
  12.  0007            ***************************************************************
  13.  0008            
  14.  0009      0000  DRR    .equ    0000h
  15.  0010      0002  TIMER   .equ    0002h
  16.  0011      0003  PERIOD  .equ    0003h
  17.  0012      0004  IMR     .equ    0004h
  18.  0013      001e  STRLEN    .equ    30
  19.  0014      0064  STACK_SIZE .equ 100    ; This stack saves context during interrupt
  20.  0015            
  21.  0016            ***************************************************************
  22.  0017            * Labels and variables
  23.  0018            
  24.  0019                ; Here are globally defined labels that will appear in FOO.MAP
  25.  0020                .globl    _startup
  26.  0021                .globl    _nada
  27.  0022                .globl    _idle_here
  28.  0023            
  29.  0024                ; Globally defined interrupt handler labels
  30.  0025                .globl    tint
  31.  0026                .globl    rint
  32.  0027            
  33.  0028                ; Here are global variables that will appear in FOO.MAP
  34.  0029                .globl    _i
  35.  0030 0000           .bss    _i,1
  36.  0031                .globl    _k
  37.  0032 0001           .bss    _k,1
  38.  0033                .globl    _L
  39.  0034 0002           .bss    _L,1
  40.  0035                .globl    rstring
  41.  0036 0003           .bss    rstring,STRLEN
  42.  0037                .globl    cptr
  43.  0038 0021           .bss    cptr,1
  44.  0039            
  45.  0040 0022           .bss    sys_stack,STACK_SIZE
  46.  0041            
  47.  0042            ***************************************************************
  48.  0043            * Reset and interrupt vectors, and code, begin here
  49.  0044            ***************************************************************
  50.  0045            
  51.  0046 0000           .asect "vectors",0
  52.  0047            
  53.  0048                ; Reset and interrupt vectors
  54.  0049 0000 ff80      B       _startup    ; 0x0000
  55.       0001 0000' 
  56.  0050            ;    B    int0        ; 0x0002
  57.  0051            ;    B    int1        ; 0x0004
  58.  0052            ;    B    int2        ; 0x0006
  59.  0053 0002           .space  (018h-$)*16
  60.  0054 0018 ff80      B    tint        ; 0x0018
  61.       0019 003b' 
  62. DSP COFF Assembler          Version 5.20             Sun Jan 02 19:07:21 1994
  63.  (c) Copyright 1987, 1989, Texas Instruments Incorporated 
  64.  
  65.                                                                      PAGE    2
  66.  
  67.  0055 001a ff80      B    rint        ; 0x001A
  68.       001b 006b' 
  69.  0056            ;    B    xint        ; 0x001C
  70.  0057            ;    B    traph        ; 0x001E
  71.  0058             
  72.  0059            ***************************************************************
  73.  0060            * This is the main loop
  74.  0061 0000           .text
  75.  0062            
  76.  0063 0000       _startup:
  77.  0064 0000 d100      lrlk    AR1,sys_stack    ; Set up stack pointer
  78.       0001 0022- 
  79.  0065            
  80.  0066 0002 c800      ldpk    0
  81.  0067 0003 d001      lack    500        ; set up a timed interrupt for every
  82.       0004 01f4  
  83.  0068 0005 6002      sacl    TIMER        ; 500 processor cycles
  84.  0069 0006 6003      sacl    PERIOD
  85.  0070 0007 ca18      lack    18h        ; Enable timer and receive interrupts
  86.  0071 0008 6004      sacl    IMR
  87.  0072 0009 ce00      eint            ; Enable interrupts globally
  88.  0073            
  89.  0074 000a d000      lrlk    ar0,rstring
  90.       000b 0003- 
  91.  0075 000c 5588      larp    ar0
  92.  0076 000d ca00      lack    0        ; Fill rstring with zeroes
  93.  0077 000e cb1d      rptk    STRLEN-1
  94.  0078 000f 60a0      sacl    *+
  95.  0079 0010 d001      lalk    rstring        ; Set cptr pointing to rstring
  96.       0011 0003- 
  97.  0080 0012 6021-     sacl    cptr
  98.  0081            
  99.  0082 0013 c800-     ldpk    _k
  100.  0083 0014 ca00      lack    0
  101.  0084 0015 6001-     sacl    _k        ; Set _k and _L to zero
  102.  0085 0016 6002-     sacl    _L
  103.  0086            
  104.  0087 0017 c400      lark    ar4,0        ; Set AR4 and AR5 to zero
  105.  0088 0018 c500      lark    ar5,0
  106.  0089 0019       L1:
  107.  0090 0019 558c      larp    ar4        ; Do some bit-reverse addressing
  108.  0091 001a c008      lark    ar0,8
  109.  0092 001b 55fd      mar    *br0+,ar5
  110.  0093 001c 55c8      mar    *br0-,ar0
  111.  0094            
  112.  0095 001d fe80      call    _nada        ; Call a subroutine
  113.       001e 002f' 
  114.  0096            
  115.  0097 001f c800-     ldpk    _i
  116.  0098 0020 ca00      lack    0         ; Set _i to zero
  117.  0099 0021 6000-     sacl    _i
  118.  0100 0022 c009      lark    ar0,9        ; do loop L2 ten times
  119.  0101 0023       L2:
  120.  0102 0023 3c00-     lt    _i        ; _k gets set to 17 * _i
  121.  0103 0024 a011      mpyk    17
  122.  0104 0025 7c01-     spl    _k
  123. DSP COFF Assembler          Version 5.20             Sun Jan 02 19:07:21 1994
  124.  (c) Copyright 1987, 1989, Texas Instruments Incorporated 
  125.  
  126.                                                                      PAGE    3
  127.  
  128.  0105 0026 2000-     lac    _i        ; _i gets incremented
  129.  0106 0027 cc01      addk    1
  130.  0107 0028 6000-     sacl    _i
  131.  0108            
  132.  0109 0029       L3:
  133.  0110 0029 fb90      banz    L2,*-        ; end of L2 loop
  134.       002a 0023' 
  135.  0111            
  136.  0112 002b fe80      call    _test_idle
  137.       002c 0032' 
  138.  0113            
  139.  0114 002d ff80      b    L1
  140.       002e 0019' 
  141.  0115            
  142.  0116            ***************************************************************
  143.  0117            * A little do-nothing subroutine
  144.  0118            
  145.  0119 002f 5500  _nada:    nop
  146.  0120 0030 5500      nop
  147.  0121 0031 ce26      ret
  148.  0122            
  149.  0123            ***************************************************************
  150.  0124            * When _L reaches 15, idle until the next interrupt
  151.  0125            
  152.  0126 0032       _test_idle:
  153.  0127 0032 2002-     lac    _L    ; if _L = 15,
  154.  0128 0033 cd0f      subk    15
  155.  0129 0034 f580      bnz    skip_idle
  156.       0035 003a' 
  157.  0130 0036 d001      lack    1234h    ; then set _k to an odd value
  158.       0037 1234  
  159.  0131 0038 6001-     sacl    _k
  160.  0132 0039       _idle_here:
  161.  0133 0039 ce1f      idle        ; and idle until the next interrupt
  162.  0134 003a       skip_idle:
  163.  0135 003a ce26      ret
  164.  0136            
  165.  0137            ***************************************************************
  166.  0138            * Macros for context save and restore, used in interrupt handle
  167.  0139            
  168.  0140            isave    $MACRO
  169.  0141                larp    ar1
  170.  0142                sst1    *+    ; status registers
  171.  0143                sst    *+
  172.  0144                sach    *+    ; accumulator
  173.  0145                sacl    *+
  174.  0146                spm    0    ; P register
  175.  0147                sph    *+
  176.  0148                spl    *+
  177.  0149                mpyk    1    ; T register
  178.  0150                spl    *+
  179.  0151                rptk    7    ; the entire hardware stack
  180.  0152                popd    *+
  181.  0153                sar    ar0,*+    ; all the address registers
  182.  0154                sar    ar2,*+
  183.  0155                sar    ar3,*+
  184. DSP COFF Assembler          Version 5.20             Sun Jan 02 19:07:21 1994
  185.  (c) Copyright 1987, 1989, Texas Instruments Incorporated 
  186.  
  187.                                                                      PAGE    4
  188.  
  189.  0156                sar    ar4,*+
  190.  0157                sar    ar5,*+
  191.  0158                sar    ar6,*+
  192.  0159                sar    ar7,*+
  193.  0160                $END
  194.  0161            
  195.  0162            irestore    $MACRO
  196.  0163                larp    ar1
  197.  0164                mar    *-    ; prepare to pop stuff
  198.  0165                lar    ar7,*-    ; get address registers
  199.  0166                lar    ar6,*-
  200.  0167                lar    ar5,*-
  201.  0168                lar    ar4,*-
  202.  0169                lar    ar3,*-
  203.  0170                lar    ar2,*-
  204.  0171                lar    ar0,*-
  205.  0172                rptk    7    ; the hardware stack
  206.  0173                pshd    *-
  207.  0174                mar    *-
  208.  0175                lt    *+    ; low P register
  209.  0176                mpyk    1
  210.  0177                lt    *-    ; T register
  211.  0178                mar    *-
  212.  0179                lph    *-    ; high P register
  213.  0180                zals    *-    ; accumulator
  214.  0181                addh    *-
  215.  0182                lst    *-    ; status registers
  216.  0183                lst1    *
  217.  0184                $END
  218.  0185            
  219.  0186            ***************************************************************
  220.  0187            * The timer interrupt increments _L
  221.  0188            
  222.  0189 003b       tint:    isave
  223. !0001 003b 5589   larp ar1
  224. !0002 003c 79a0   sst1 *+
  225. !0003 003d 78a0   sst *+
  226. !0004 003e 68a0   sach *+
  227. !0005 003f 60a0   sacl *+
  228. !0006 0040 ce08   spm 0
  229. !0007 0041 7da0   sph *+
  230. !0008 0042 7ca0   spl *+
  231. !0009 0043 a001   mpyk 1
  232. !0010 0044 7ca0   spl *+
  233. !0011 0045 cb07   rptk 7
  234. !0012 0046 7aa0   popd *+
  235. !0013 0047 70a0   sar ar0,*+
  236. !0014 0048 72a0   sar ar2,*+
  237. !0015 0049 73a0   sar ar3,*+
  238. !0016 004a 74a0   sar ar4,*+
  239. !0017 004b 75a0   sar ar5,*+
  240. !0018 004c 76a0   sar ar6,*+
  241. !0019 004d 77a0   sar ar7,*+
  242.  0190 004e 5588      larp    ar0
  243.  0191 004f d000      lrlk    ar0,_L    ; increment _L
  244.       0050 0002- 
  245. DSP COFF Assembler          Version 5.20             Sun Jan 02 19:07:21 1994
  246.  (c) Copyright 1987, 1989, Texas Instruments Incorporated 
  247.  
  248.                                                                      PAGE    5
  249.  
  250.  0192 0051 2080      lac    *
  251.  0193 0052 cc01      addk    1
  252.  0194 0053 6080      sacl    *
  253.  0195 0054           irestore
  254. !0001 0054 5589   larp ar1
  255. !0002 0055 5590   mar *-
  256. !0003 0056 3790   lar ar7,*-
  257. !0004 0057 3690   lar ar6,*-
  258. !0005 0058 3590   lar ar5,*-
  259. !0006 0059 3490   lar ar4,*-
  260. !0007 005a 3390   lar ar3,*-
  261. !0008 005b 3290   lar ar2,*-
  262. !0009 005c 3090   lar ar0,*-
  263. !0010 005d cb07   rptk 7
  264. !0011 005e 5490   pshd *-
  265. !0012 005f 5590   mar *-
  266. !0013 0060 3ca0   lt *+
  267. !0014 0061 a001   mpyk 1
  268. !0015 0062 3c90   lt *-
  269. !0016 0063 5590   mar *-
  270. !0017 0064 5390   lph *-
  271. !0018 0065 4190   zals *-
  272. !0019 0066 4890   addh *-
  273. !0020 0067 5090   lst *-
  274. !0021 0068 5180   lst1 *
  275.  0196 0069 ce00      eint
  276.  0197 006a ce26      ret
  277.  0198            
  278.  0199            ***************************************************************
  279.  0200            * The receive interrupt fills rstring with data
  280.  0201            
  281.  0202 006b       rint:    isave
  282. !0001 006b 5589   larp ar1
  283. !0002 006c 79a0   sst1 *+
  284. !0003 006d 78a0   sst *+
  285. !0004 006e 68a0   sach *+
  286. !0005 006f 60a0   sacl *+
  287. !0006 0070 ce08   spm 0
  288. !0007 0071 7da0   sph *+
  289. !0008 0072 7ca0   spl *+
  290. !0009 0073 a001   mpyk 1
  291. !0010 0074 7ca0   spl *+
  292. !0011 0075 cb07   rptk 7
  293. !0012 0076 7aa0   popd *+
  294. !0013 0077 70a0   sar ar0,*+
  295. !0014 0078 72a0   sar ar2,*+
  296. !0015 0079 73a0   sar ar3,*+
  297. !0016 007a 74a0   sar ar4,*+
  298. !0017 007b 75a0   sar ar5,*+
  299. !0018 007c 76a0   sar ar6,*+
  300. !0019 007d 77a0   sar ar7,*+
  301.  0203 007e c800-     ldpk    cptr
  302.  0204 007f 3021-     lar    ar0,cptr    ; get a pointer into rstring from cptr
  303.  0205 0080 c200      lark    ar2,DRR
  304.  0206 0081 558a      larp    ar2
  305.  0207 0082 2088      lac    *,ar0        ; get data from receive buffer
  306. DSP COFF Assembler          Version 5.20             Sun Jan 02 19:07:21 1994
  307.  (c) Copyright 1987, 1989, Texas Instruments Incorporated 
  308.  
  309.                                                                      PAGE    6
  310.  
  311.  0208 0083 60a0      sacl    *+        ; store it in rstring
  312.  0209 0084 7021-     sar    ar0,cptr    ; store incremented pointer in cptr
  313.  0210 0085 f580      bnz    rint2
  314.       0086 0090' 
  315.  0211 0087 d000      lrlk    ar0,rstring    ; if recevied data was zero,
  316.       0088 0003- 
  317.  0212 0089 5588      larp    ar0
  318.  0213 008a ca00      lack    0        ; fill rstring with zeroes
  319.  0214 008b cb1d      rptk    STRLEN-1
  320.  0215 008c 60a0      sacl    *+
  321.  0216 008d d001      lalk    rstring        ; set cptr to rstring again
  322.       008e 0003- 
  323.  0217 008f 6021-     sacl    cptr
  324.  0218 0090       rint2:    irestore
  325. !0001 0090 5589   larp ar1
  326. !0002 0091 5590   mar *-
  327. !0003 0092 3790   lar ar7,*-
  328. !0004 0093 3690   lar ar6,*-
  329. !0005 0094 3590   lar ar5,*-
  330. !0006 0095 3490   lar ar4,*-
  331. !0007 0096 3390   lar ar3,*-
  332. !0008 0097 3290   lar ar2,*-
  333. !0009 0098 3090   lar ar0,*-
  334. !0010 0099 cb07   rptk 7
  335. !0011 009a 5490   pshd *-
  336. !0012 009b 5590   mar *-
  337. !0013 009c 3ca0   lt *+
  338. !0014 009d a001   mpyk 1
  339. !0015 009e 3c90   lt *-
  340. !0016 009f 5590   mar *-
  341. !0017 00a0 5390   lph *-
  342. !0018 00a1 4190   zals *-
  343. !0019 00a2 4890   addh *-
  344. !0020 00a3 5090   lst *-
  345. !0021 00a4 5180   lst1 *
  346.  0219 00a5 ce00      eint
  347.  0220 00a6 ce26      ret
  348.  0221            
  349.  0222                .end
  350.  
  351.  No Errors,  No Warnings
  352.