File "debug.lis"

Full Path: /home/analogde/www/private/Projet/debug/debug.lis
File size: 21.53 KB
MIME-type: text/plain
Charset: 8 bit

                         .module debug.c
                         .area text
                       ;           baud -> 2,x
 0000                 _init_SCI::
                       ; #include "HC12.H"
                       ; 
                       ; int Mille,Centaine,Dizaine,Unite;
                       ; 
                       ; int val;
                       ; 
                       ; unsigned int canal[8]; 
                       ; char ascii[8];
                       ; 
                       ; /**************************************************************************/
                       ; void init_SCI(unsigned int baud)
                       ; {
                       ;     asm(" SEI");
 0000 1410                   SEI
                       
                       ; 
                       ;     SCICR1 = 0x00; /* 0 0 0 0 0 0 0 0   /* 8bits et pas de parit */
 0002 7900CA            clr 0xca
                       ; /*                          | | | | | | | |
                       ;                           | | | | | | | \____ Even Parity
                       ;                           | | | | | | \______ Parity Disabled
                       ;                           | | | | | \________ Short IDLE line mode (not used)
                       ;                           | | | | \__________ Wakeup by IDLE line rec (not used)
                       ;                           | | | \____________ 8 data bits
                       ;                           | | \______________ Not used (loopback disabled)
                       ;                           | \________________ SCI1 enabled in wait mode
                       ;                           \__________________ Normal (not loopback) mode
                       ; */
                       ;     SCICR2 = 0x2C; /* 0 0 1 0 1 1 0 0   /* TX et RX actif + RX int*/
 0005 C62C              ldab #44
 0007 7B00CB            stab 0xcb
                       ; /*                | | | | | | | |
                       ;                   | | | | | | | \____ No Break
                       ;                   | | | | | | \______ Not in wakeup mode (always awake)
                       ;                   | | | | | \________ Reciever enabled
                       ;                   | | | | \__________ Transmitter disabled
                       ;                   | | | \____________ No IDLE Interrupt
                       ;                   | | \______________ Reciever Interrupts used
                       ;                   | \________________ No Tranmit Complete Interrupt
                       ;                   \__________________ No Tranmit Ready Interrupt
                       ; */
                       ;     SCIBDH = 0x00;  
 000A 7900C8            clr 0xc8
                       ;     SCIBDL = 0x34;  // 9600 bauds (52 en dcimal)
 000D C634              ldab #52
 000F 7B00C9            stab 0xc9
                       ;     asm(" CLI");
 0012 10EF                   CLI
                       
                       ; }
 0014                 L1:
 0014                   .dbline 0 ; func end
 0014 3D                rts
 0015                 _initialise_SCI::
                       ; 
                       ; /**************************************************************************/
                       ; void initialise_SCI(void)
                       ; {
                       ;         SCIBDH = 0x34;          // 9600bps @ 8MHz Mclk
 0015 C634              ldab #52
 0017 7B00C8            stab 0xc8
                       ;         SCIBDL = 0x00;
 001A 7900C9            clr 0xc9
                       ;         SCICR1 = 0x00;          // mode normal 8bits
 001D 7900CA            clr 0xca
                       ;         SCICR2 = 0x0C;          // pas d'interruption, pas de parit
 0020 C60C              ldab #12
 0022 7B00CB            stab 0xcb
                       ; }
 0025                 L2:
 0025                   .dbline 0 ; func end
 0025 3D                rts
 0026                 _init_ADC::
                       ; /**************************************************************************/
                       ; void init_ADC(void)
                       ; {
                       ;      ATDCTL2 = 0xC0; /* dmarrage ADC */
 0026 C6C0              ldab #192
 0028 7B0122            stab 0x122
                       ;      ATDCTL3 = 0x00; /* cycle de 8 conversions */
 002B 790123            clr 0x123
                       ;      ATDCTL4 = 0x75; /* mode 10 bits */
 002E C675              ldab #117
 0030 7B0124            stab 0x124
                       ;      ATDCTL5 = 0x90; /* 1 0 0 1 0 0 0 0 
 0033 C690              ldab #144
 0035 7B0125            stab 0x125
                       ;                          | | | |   \__/
                       ;                          | | | |    |
                       ;                          | | | |    \___ First channel = 2
                       ;                          | | | \________ MULT = 1 => multiple channels
                       ;                          | | \__________ SCAN = 0 => one set of conversions
                       ;                          | \____________ DSGN = 0 => unsigned
                       ;                          \______________ DJM = 1 => right justified
                       ;                       */
                       ; }
 0038                 L3:
 0038                   .dbline 0 ; func end
 0038 3D                rts
                       ;              i -> -2,x
                       ;           data -> 3,x
 0039                 _ecrire_data::
 0039 3B                pshd
 003A 34                pshx
 003B B775              tfr s,x
 003D 1B9E              leas -2,sp
                       ; /**********************************************************/
                       ; void ecrire_data(char data)
                       ; {
                       ;      int i;
                       ;     
                       ;      i= 0x55;
 003F CC0055            ldd #85
 0042 6C1E              std -2,x
                       ; 
                       ; return;
 0044                 L4:
 0044 B757              tfr x,s
 0046 30                pulx
 0047 1B82              leas 2,sp
 0049                   .dbline 0 ; func end
 0049 3D                rts
                       ;         buffer -> 2,x
 004A                 _ecrire_chaine::
 004A 3B                pshd
 004B 34                pshx
 004C B775              tfr s,x
                       ; }
                       ; /**********************************************************/
                       ; void ecrire_chaine(char *buffer)
                       ; {
 004E 200F              bra L7
 0050                 L6:
 0050 ED02              ldy 2,x
 0052 E640              ldab 0,y
 0054 87                clra
 0055 160039            jsr _ecrire_data
 0058 EC02              ldd 2,x
 005A C30001            addd #1
 005D 6C02              std 2,x
 005F                 L7:
                       ;      while(*buffer) 
 005F ED02              ldy 2,x
 0061 E740              tst 0,y
 0063 26EB              bne L6
                       ;           { ecrire_data(*buffer); 
                       ;             buffer++; 
                       ;           }
                       ; return;
 0065                 L5:
 0065 B757              tfr x,s
 0067 30                pulx
 0068 1B82              leas 2,sp
 006A                   .dbline 0 ; func end
 006A 3D                rts
                       ;        compare -> -2,x
 006B                 _conversion_decimal::
 006B 34                pshx
 006C B775              tfr s,x
 006E 1B9E              leas -2,sp
                       ; }
                       ; /**********************************************************/
                       ; void conversion_decimal(void)
                       ; {
                       ; 
                       ;      int compare;
                       ; 
                       ;      Mille = 0;
 0070 CC0000            ldd #0
 0073 7C0020            std _Mille
                       ;      Centaine = 0;
 0076 CC0000            ldd #0
 0079 7C001E            std _Centaine
                       ;      Dizaine = 0;
 007C CC0000            ldd #0
 007F 7C001C            std _Dizaine
                       ;      Unite = 0;
 0082 CC0000            ldd #0
 0085 7C001A            std _Unite
                       ; 
                       ;      // recherche du nombre en dcimal - 4 chiffres
                       ; 
                       ;     compare=val; 
 0088 18011E0018        movw _val,-2,x
 008D 2010              bra L11
 008F                 L10:
 008F FC0020            ldd _Mille
 0092 C30001            addd #1
 0095 7C0020            std _Mille
 0098 EC1E              ldd -2,x
 009A 8303E8            subd #1000
 009D 6C1E              std -2,x
 009F                 L11:
                       ;    
                       ;    while( compare  > 1000 )      // nombre de paquets de 1000
 009F EC1E              ldd -2,x
 00A1 8C03E8            cpd #1000
 00A4 2EE9              bgt L10
 00A6 2010              bra L14
 00A8                 L13:
 00A8 FC001E            ldd _Centaine
 00AB C30001            addd #1
 00AE 7C001E            std _Centaine
 00B1 EC1E              ldd -2,x
 00B3 830064            subd #100
 00B6 6C1E              std -2,x
 00B8                 L14:
                       ;         { Mille++; 
                       ;           compare=compare-1000; 
                       ;         }
                       ;    while( compare  > 100 )      // nombre de centaines
 00B8 EC1E              ldd -2,x
 00BA 8C0064            cpd #100
 00BD 2EE9              bgt L13
 00BF 2010              bra L17
 00C1                 L16:
 00C1 FC001C            ldd _Dizaine
 00C4 C30001            addd #1
 00C7 7C001C            std _Dizaine
 00CA EC1E              ldd -2,x
 00CC 83000A            subd #10
 00CF 6C1E              std -2,x
 00D1                 L17:
                       ;         { Centaine++; 
                       ;           compare=compare-100; 
                       ;         }
                       ;    while( compare  > 10 )      // nombre de dizaines
 00D1 EC1E              ldd -2,x
 00D3 8C000A            cpd #10
 00D6 2EE9              bgt L16
                       ;         { Dizaine++; 
                       ;           compare=compare-10; 
                       ;         }
                       ;    
                       ;    Unite=compare;   
 00D8 18051E001A        movw -2,x,_Unite
                       ; }   
 00DD                 L9:
 00DD B757              tfr x,s
 00DF 30                pulx
 00E0                   .dbline 0 ; func end
 00E0 3D                rts
 00E1                 _conversion_Ascii::
                       ; /**********************************************************/
                       ; void conversion_Ascii(void)
                       ; {
                       ; 
                       ;      ascii[0]=Mille+0x30;   
 00E1 FC0020            ldd _Mille
 00E4 C30030            addd #48
 00E7 7B0000            stab _ascii
                       ;      ascii[1]='.';              // affiche virgule
 00EA C62E              ldab #46
 00EC 7B0001            stab _ascii+1
                       ;      ascii[2]=Centaine+0x30;    // centaines de mV
 00EF FC001E            ldd _Centaine
 00F2 C30030            addd #48
 00F5 7B0002            stab _ascii+2
                       ;      ascii[3]=Dizaine+0x30;     // dizaines de mV
 00F8 FC001C            ldd _Dizaine
 00FB C30030            addd #48
 00FE 7B0003            stab _ascii+3
                       ;      ascii[4]=Unite+0x30;       // affiche les mV
 0101 FC001A            ldd _Unite
 0104 C30030            addd #48
 0107 7B0004            stab _ascii+4
                       ;      ascii[5]='V';              // affiche le V de Volt
 010A C656              ldab #86
 010C 7B0005            stab _ascii+5
                       ; }    
 010F                 L19:
 010F                   .dbline 0 ; func end
 010F 3D                rts
 0110                 _acquisition::
                       ; /**********************************************************/
                       ; void acquisition(void)
                       ; {
                       ;       ATDCTL5 = 0x90;   // lance la conversion
 0110 C690              ldab #144
 0112 7B0125            stab 0x125
 0115                 L26:
 0115                 L27:
                       ;       
                       ;       while ((ADSTAT0 & 0x80) == 0 ) ; /* attendre la fin de la conversion */
 0115 1F012680FB        brclr 0x126,#128,L26
                       ;       canal[0] = ADR0;
                         ; vol
 011A FD0130            ldy 0x130
 011D 7D0008            sty _canal
                       ;       canal[1] = ADR1;
                         ; vol
 0120 FD0132            ldy 0x132
 0123 7D000A            sty _canal+2
                       ;       canal[2] = ADR2;
                         ; vol
 0126 FD0134            ldy 0x134
 0129 7D000C            sty _canal+4
                       ;       canal[3] = ADR3;
                         ; vol
 012C FD0136            ldy 0x136
 012F 7D000E            sty _canal+6
                       ;       canal[4] = ADR4;
                         ; vol
 0132 FD0138            ldy 0x138
 0135 7D0010            sty _canal+8
                       ;       canal[5] = ADR5;
                         ; vol
 0138 FD013A            ldy 0x13a
 013B 7D0012            sty _canal+10
                       ;       canal[6] = ADR6;
                         ; vol
 013E FD013C            ldy 0x13c
 0141 7D0014            sty _canal+12
                       ;       canal[7] = ADR7;
                         ; vol
 0144 FD013E            ldy 0x13e
 0147 7D0016            sty _canal+14
                       ; }
 014A                 L25:
 014A                   .dbline 0 ; func end
 014A 3D                rts
 014B                 _traitement::
                       ; /**************************************************************************/
                       ; void traitement(void)
                       ; {
                       ;      
                       ;      // lire le rsultat + stockage
                       ;      canal[6]= ADR6;     
                         ; vol
 014B FD013C            ldy 0x13c
 014E 7D0014            sty _canal+12
                       ; 
                       ;      val= (ADR6 * 4888)/10000;
 0151 CC1318            ldd #4888
                         ; vol
 0154 FD013C            ldy 0x13c
 0157 13                emul
 0158 CD2710            ldy #10000
 015B B7D6              exg x,y
 015D 1810              idiv
 015F B7D6              exg x,y
 0161 7D0018            sty _val
                       ;         
                       ; }
 0164                 L36:
 0164                   .dbline 0 ; func end
 0164 3D                rts
                       ;              c -> 3,x
 0165                 _envoi_caractere::
 0165 3B                pshd
 0166 34                pshx
 0167 B775              tfr s,x
                       ; /**************************************************************************/
                       ; void envoi_caractere(char c)
                       ; {
 0169                 L39:
 0169                 L40:
                       ;     while( (SCISR1 & 0x80 )== 0 );  // attendre la monte du flag TDRE
 0169 1F00CC80FB        brclr 0xcc,#128,L39
                       ;     SCIDRL = c;
 016E 180D0300CF        movb 3,x,0xcf
                       ; 
                       ; }
 0173                 L38:
 0173 B757              tfr x,s
 0175 30                pulx
 0176 1B82              leas 2,sp
 0178                   .dbline 0 ; func end
 0178 3D                rts
                       ;            ptr -> -2,x
                       ;            str -> 2,x
 0179                 _envoi_chaine::
 0179 3B                pshd
 017A 34                pshx
 017B B775              tfr s,x
 017D 1B9E              leas -2,sp
                       ; /**********************************************************/
                       ; void envoi_chaine(char str[])
                       ; {
                       ;     char *ptr;
                       ;     
                       ;     for(ptr = str; *ptr != '\0' ; ptr++  )
 017F 1802021E          movw 2,x,-2,x
 0183 200F              bra L46
 0185                 L43:
 0185 ED1E              ldy -2,x
 0187 E640              ldab 0,y
 0189 87                clra
 018A 160165            jsr _envoi_caractere
 018D                 L44:
 018D EC1E              ldd -2,x
 018F C30001            addd #1
 0192 6C1E              std -2,x
 0194                 L46:
 0194 ED1E              ldy -2,x
 0196 E740              tst 0,y
 0198 26EB              bne L43
                       ;        { envoi_caractere(*ptr);
                       ;        }
                       ; }
 019A                 L42:
 019A B757              tfr x,s
 019C 30                pulx
 019D 1B82              leas 2,sp
 019F                   .dbline 0 ; func end
 019F 3D                rts
 01A0                 _transmettre_CRLF::
                       ; /**************************************************************************/
                       ; void transmettre_CRLF(void)
                       ; {
                       ;        SCIDRL = 0x0A;    // fin de ligne = end of line                                                              
 01A0 C60A              ldab #10
 01A2 7B00CF            stab 0xcf
 01A5                 L48:
 01A5                 L49:
                       ;        while ( (SCISR1 & 0x80) == 0) ;  // attendre le flag TDRE                                    
 01A5 1F00CC80FB        brclr 0xcc,#128,L48
                       ;        SCIDRL = 0x0D;    // retour  la ligne = line feed                                                               
 01AA C60D              ldab #13
 01AC 7B00CF            stab 0xcf
 01AF                 L51:
 01AF                 L52:
                       ;        while ( (SCISR1 & 0x80) == 0) ;  // attendre le flag TDRE
 01AF 1F00CC80FB        brclr 0xcc,#128,L51
                       ;        
                       ; }
 01B4                 L47:
 01B4                   .dbline 0 ; func end
 01B4 3D                rts
                       ;            ptr -> -2,x
 01B5                 _main::
 01B5 34                pshx
 01B6 B775              tfr s,x
 01B8 1B9E              leas -2,sp
                       ; /**************************************************************************/
                       ; void main(void)
                       ; {
                       ;      /*char buffer[10]="";
                       ;      
                       ;      char v;
                       ;      char *ptr;
                       ;      
                       ;      buffer[0]='A';
                       ;      buffer[1]='b';
                       ;      buffer[2]='c';
                       ;      buffer[3]='d';  
                       ;      
                       ;      v=buffer[2];
                       ;      p=ascii;    
                       ;      ecrire_chaine(p);*/
                       ;      
                       ;      char *ptr;  
                       ;          
                       ;      COPCTL=0x00;
 01BA 79003C            clr 0x3c
                       ;      init_ADC();
 01BD 160026            jsr _init_ADC
                       ;      init_SCI(9600);
 01C0 CC2580            ldd #9600
 01C3 160000            jsr _init_SCI
 01C6 2019              bra L56
 01C8                 L55:
 01C8 1601A0            jsr _transmettre_CRLF
 01CB 160110            jsr _acquisition
 01CE 16014B            jsr _traitement
 01D1 16006B            jsr _conversion_decimal
 01D4 1600E1            jsr _conversion_Ascii
 01D7 CC0000            ldd #_ascii
 01DA 6C1E              std -2,x
 01DC EC1E              ldd -2,x
 01DE 160179            jsr _envoi_chaine
 01E1                 L56:
                       ;       
                       ;      while(1)
 01E1 20E5              bra L55
 01E3                 X0:
                       ;           { transmettre_CRLF();
                       ;             acquisition();
                       ;             traitement();
                       ;             conversion_decimal();
                       ;             conversion_Ascii();     
                       ;             ptr=ascii;   
                       ;             envoi_chaine(ptr);              
                       ;           } 
                       ; }
 01E3                 L54:
 01E3 B757              tfr x,s
 01E5 30                pulx
 01E6                   .dbline 0 ; func end
 01E6 3D                rts
                         .area bss
 0000                 _ascii::
 0000                   .blkb 8
 0008                 _canal::
 0008                   .blkb 16
 0018                 _val::
 0018                   .blkb 2
 001A                 _Unite::
 001A                   .blkb 2
 001C                 _Dizaine::
 001C                   .blkb 2
 001E                 _Centaine::
 001E                   .blkb 2
 0020                 _Mille::
 0020                   .blkb 2