home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / 8_16BIT / PICSTART.ZIP / SAMPLE.LST < prev    next >
Encoding:
File List  |  1993-08-12  |  11.8 KB  |  255 lines

  1. 16c5x/xx Cross-Assembler V4.12.01 Intermediate  Thu Aug 12 15:47:18 1993  Page 1
  2.  
  3. Line   PC    Opcode
  4.  
  5. 0001               ;********************************************************
  6.                        ***********
  7. 0002               ;                           SAMPLE.ASM
  8. 0003               ;                   8x8 Software Multiplier
  9. 0004               ;********************************************************
  10.                        ***********
  11. 0005               ;
  12. 0006               ;   The 16 bit result is stored in 2 bytes
  13. 0007               ;
  14. 0008               ; Before calling the subroutine " mpy ", the multiplier s
  15.                        hould
  16. 0009               ; be loaded in location " mulplr ", and the multiplicand 
  17.                        in
  18. 0010               ; " mulcnd " . The 16 bit result is stored in locations
  19. 0011               ; H_byte & L_byte.
  20. 0012               ;
  21. 0013               ;       Performance :
  22. 0014               ;                       Program Memory  :  15 locations
  23. 0015               ;                       # of cycles     :  71
  24. 0016               ;                       Scratch RAM     :   0 locations
  25. 0017               ;
  26. 0018               ;  This routine is optimized for code efficiency ( looped
  27.                         code )
  28. 0019               ;  For time efficiency code refer to "mult8x8F.asm" ( str
  29.                        aight line code )
  30. 0020               ;********************************************************
  31.                        ***********
  32. 0021               ;
  33. 0022         0009  mulcnd  equ     09      ; 8 bit multiplicand
  34. 0023         0010  mulplr  equ     10      ; 8 bit multiplier
  35. 0024         0012  H_byte  equ     12      ; High byte of the 16 bit result
  36. 0025         0013  L_byte  equ     13      ; Low byte of the 16 bit result
  37. 0026         0014  count   equ     14      ; loop counter
  38. 0027         0006  portb   equ     06      ; I/O register F6
  39. 0028               ;
  40. 0029               ;
  41. 0030                    include         "picreg.equ"
  42. 0031               ;**************************     PIC16C5X Header *********
  43.                        ****************
  44. 0032               ;
  45. 0033               ;
  46. 0034         01FF  PIC54   equ     1FFH            ; Define Reset Vectors
  47. 0035         01FF  PIC55   equ     1FFH
  48. 0036         03FF  PIC56   equ     3FFH
  49. 0037         07FF  PIC57   equ     7FFH
  50. 0038         0000  PIC71   equ     0H
  51. 0039               ;
  52. 0040         0001  RTCC    equ     1h
  53. 0041         0002  PC      equ     2h
  54. 0042         0003  STATUS  equ     3h              ; F3 Reg is STATUS Reg.
  55. 0043         0004  FSR     equ     4h
  56. 0044               ;
  57. 0045         0005  Port_A  equ     5h
  58. 0046         0006  Port_B  equ     6h              ; I/O Port Assignments
  59. 0047         0007  Port_C  equ     7h
  60. 0048               ;
  61. 0049               ;
  62. 0050         0009  ADRES   equ     9h      ;16C71 Special-purpose registers
  63. 0051         0008  ADCON0  equ     8h      ;16C71 Special-purpose registers
  64. 16c5x/xx Cross-Assembler V4.12.01 Intermediate  Thu Aug 12 15:47:18 1993  Page 2
  65.  
  66. Line   PC    Opcode
  67.  
  68. 0052         0088  ADCON1  equ     88h     ;16C71 Special-purpose registers
  69. 0053         000A  PCLATH  equ     0AH     ;16C71 Special-purpose registers
  70. 0054         000B  INTCON  equ     0BH     ;16C71 Special-purpose registers
  71. 0055         0085  TRISA   equ     85H     ;16C71 Special-purpose registers
  72. 0056         0086  TRISB   equ     86H     ;16C71 Special-purpose registers
  73. 0057               ;
  74. 0058               ;
  75. 0059               ;
  76. 0060               ;********************************************************
  77.                        *****************
  78. 0061               ;
  79. 0062               ;                               ; STATUS REG. Bits
  80. 0063         0000  CARRY   equ     0h              ; Carry Bit is Bit.0 of F
  81.                        3
  82. 0064         0000  C       equ     0h
  83. 0065         0001  DCARRY  equ     1h
  84. 0066         0001  DC      equ     1h
  85. 0067         0002  Z_bit   equ     2h              ; Bit 2 of F3 is Zero Bit
  86.                        
  87. 0068         0002  Z       equ     2h
  88. 0069         0003  P_DOWN  equ     3h
  89. 0070         0003  PD      equ     3h
  90. 0071         0004  T_OUT   equ     4h
  91. 0072         0004  TO      equ     4h
  92. 0073         0005  PA0     equ     5h      ;16C5X Status bits
  93. 0074         0006  PA1     equ     6h      ;16C5X Status bits
  94. 0075         0007  PA2     equ     7h      ;16C5X Status bits
  95. 0076               ;
  96. 0077               ;
  97. 0078         0005  RP0     equ     5h      ;16C71 Status bits
  98. 0079         0006  RP1     equ     6h      ;16C71 Status bits
  99. 0080         0007  IRP     equ     7h      ;16C71 Status bits
  100. 0081         0007  GIE     equ     7h      ;16C71 INTCON register bits
  101. 0082         0006  ADIE    equ     6h      ;16C71 INTCON register bits
  102. 0083         0005  RTIE    equ     5h      ;16C71 INTCON register bits
  103. 0084         0004  INTE    equ     4h      ;16C71 INTCON register bits
  104. 0085         0003  RBIE    equ     3h      ;16C71 INTCON register bits
  105. 0086         0002  RTIF    equ     2h      ;16C71 INTCON register bits
  106. 0087         0001  INTF    equ     1h      ;16C71 INTCON register bits
  107. 0088         0000  RBIF    equ     0       ;16C71 INTCON register bits
  108. 0089         0007  ADCS1   equ     7h      ;16C71 ADCN0 register bits
  109. 0090         0006  ADCS0   equ     6h      ;16C71 ADCN0 register bits
  110. 0091         0004  CHS1    equ     4h      ;16C71 ADCN0 register bits
  111. 0092         0003  CHS0    equ     3h      ;16C71 ADCN0 register bits
  112. 0093         0002  GO      equ     2h      ;16C71 ADCN0 register bits
  113. 0094         0001  ADIF    equ     1h      ;16C71 ADCN0 register bits
  114. 0095         0000  ADON    equ     0       ;16C71 ADCN0 register bits
  115. 0096         0001  PCFG1   equ     1h      ;16C71 ADCN1 register bits
  116. 0097         0000  PCFG0   equ     0       ;16C71 ADCN1 register bits
  117. 0098               ;
  118. 0099               ;
  119. 0100         0001  Same    equ     1h
  120. 0101               ;
  121. 0102         0000  LSB     equ     0h
  122. 16c5x/xx Cross-Assembler V4.12.01 Intermediate  Thu Aug 12 15:47:18 1993  Page 3
  123.  
  124. Line   PC    Opcode
  125.  
  126. 0103         0007  MSB     equ     7h
  127. 0104               ;
  128. 0105         0001  TRUE    equ     1h
  129. 0106         0001  YES     equ     1h
  130. 0107         0000  FALSE   equ     0h
  131. 0108         0000  NO      equ     0h
  132. 0109               ;
  133. 0110               ;********************************************************
  134.                        *****************
  135. 0111               
  136. 0112               ;
  137. 0113               ; *****************************         Begin Multiplier 
  138.                        Routine
  139. 0114   0000  0072  mpy_S   clrf    H_byte
  140. 0115   0001  0073          clrf    L_byte
  141. 0116   0002  0C08          movlw   8
  142. 0117   0003  0034          movwf   count
  143. 0118   0004  0209          movf    mulcnd,w
  144. 0119   0005  0403          bcf     STATUS,CARRY    ; Clear the carry bit in 
  145.                        the status Reg.
  146. 0120   0006  0330  loop    rrf     mulplr
  147. 0121   0007  0603          btfsc   STATUS,CARRY
  148. 0122   0008  01F2          addwf   H_byte,Same
  149. 0123   0009  0332          rrf     H_byte,Same
  150. 0124   000A  0333          rrf     L_byte,Same
  151. 0125   000B  02F4          decfsz  count
  152. 0126   000C  0A06          goto    loop
  153. 0127               ;
  154. 0128   000D  0800          retlw   0
  155. 0129               ;
  156. 0130               ;********************************************************
  157.                        ************
  158. 0131               ;               Test Program
  159. 0132               ;********************************************************
  160.                        *************
  161. 0133   000E  0040  start   clrw
  162. 0134   000F  0002          option
  163. 0135   0010  0206  main    movf    portb,w
  164. 0136   0011  0030          movwf   mulplr          ; multiplier (in mulplr) 
  165.                        = 05
  166. 0137   0012  0206          movf    portb,w
  167. 0138   0013  0029          movwf   mulcnd
  168. 0139               ;
  169. 0140   0014  0900  call_m  call    mpy_S           ; The result is in locati
  170.                        ons F12 & F13
  171. 0141                                              ; H_byte & L_byte
  172. 0142               ;
  173. 0143   0015  0A10          goto    main
  174. 0144               ;
  175. 0145         0000          org     01FFh
  176. 0146   01FF  0A0E          goto    start
  177. 0147               ;
  178. 0148         0000       END
  179. 16c5x/xx Cross-Assembler V4.12.01 Intermediate  Thu Aug 12 15:47:18 1993  Page 4
  180.  
  181.  
  182.  
  183. Cross-Reference Listing
  184. LABEL        VALUE        DEFN        REFERENCES
  185. ADCON0       8            51          51     
  186. ADCON1       136          52          52     
  187. ADCS0        6            90          90     
  188. ADCS1        7            89          89     
  189. ADIE         6            82          82     
  190. ADIF         1            94          94     
  191. ADON         0            95          95     
  192. ADRES        9            50          50     
  193. C            0            64          64     
  194. CARRY        0            63          63     119    121    
  195. CHS0         3            92          92     
  196. CHS1         4            91          91     
  197. DC           1            66          66     
  198. DCARRY       1            65          65     
  199. FALSE        0            107         107    
  200. FSR          4            43          43     
  201. GIE          7            81          81     
  202. GO           2            93          93     
  203. H_byte       18           24          24     114    122    123    
  204. INTCON       11           54          54     
  205. INTE         4            84          84     
  206. INTF         1            87          87     
  207. IRP          7            80          80     
  208. LSB          0            102         102    
  209. L_byte       19           25          25     115    124    
  210. MSB          7            103         103    
  211. NO           0            108         108    
  212. PA0          5            73          73     
  213. PA1          6            74          74     
  214. PA2          7            75          75     
  215. PC           2            41          41     
  216. PCFG0        0            97          97     
  217. PCFG1        1            96          96     
  218. PCLATH       10           53          53     
  219. PD           3            70          70     
  220. PIC54        511          34          34     
  221. PIC55        511          35          35     
  222. PIC56        1023         36          36     
  223. PIC57        2047         37          37     
  224. PIC71        0            38          38     
  225. P_DOWN       3            69          69     
  226. Port_A       5            45          45     
  227. Port_B       6            46          46     
  228. Port_C       7            47          47     
  229. RBIE         3            85          85     
  230. RBIF         0            88          88     
  231. RP0          5            78          78     
  232. RP1          6            79          79     
  233. RTCC         1            40          40     
  234. RTIE         5            83          83     
  235. RTIF         2            86          86     
  236. STATUS       3            42          42     119    121    
  237. Same         1            100         100    122    123    124    
  238. TO           4            72          72     
  239. TRISA        133          55          55     
  240. TRISB        134          56          56     
  241. TRUE         1            105         105    
  242. T_OUT        4            71          71     
  243. YES          1            106         106    
  244. Z            2            68          68     
  245. Z_bit        2            67          67     
  246. call_m       20           140         140    
  247. count        20           26          26     117    125    
  248. loop         6            120         120    126    
  249. main         16           135         135    143    
  250. mpy_S        0            114         114    140    
  251. mulcnd       9            22          22     118    138    
  252. mulplr       16           23          23     120    136    
  253. portb        6            27          27     135    137    
  254. start        14           133         133    146    
  255.