                        .module firsttest.c
                        .area data
 0000           _T_counts::
 0000                   .blkb 2
                        .area idata
 0000 4E20              .word 20000
                        .area data
 0002           _per_on2::
 0002                   .blkb 2
                        .area idata
 0002 003C              .word 60
                        .area data
 0004           _per_on3::
 0004                   .blkb 2
                        .area idata
 0004 0046              .word 70
                        .area data
 0006           _cntflag::
 0006                   .blkb 2
                        .area idata
 0006 0000              .word 0
                        .area data
                        .area text
 0000           L4:
 0000 0000              .word 0
 0002 003C              .word 60
 0004 0046              .word 70
 0006 003C              .word 60
 0008           L5:
 0008 0000              .word 0
 000A 0046              .word 70
 000C 003C              .word 60
 000E 003C              .word 60
 0010           L6:
 0010 0000              .word 0
 0012 003C              .word 60
 0014 0046              .word 70
 0016 003C              .word 60
 0018           L7:
 0018 0000              .word 0
 001A 0046              .word 70
 001C 003C              .word 60
 001E 003C              .word 60
 0020           ;  IX -> 0,x
 0020           ;  rMEM -> 2,x
 0020           ;          ?temp -> +4,x
 0020           ;       leftline -> +6,x
 0020           ;      rightline -> +8,x
 0020           ;     anglethree -> +10,x
 0020           ;       angletwo -> +18,x
 0020           ;          three -> +26,x
 0020           ;            two -> +34,x
 0020           ;          temp2 -> +42,x
 0020           ;      sensorone -> +44,x
 0020           ;     sensorzero -> +46,x
 0020           ;          temp1 -> +48,x
 0020           _main::
 0020 BD0000            jsr __enterb
 0023 32                .byte 0x32
 0024           ; /* C Listing 11.4 */
 0024           ; 
 0024           ; #include <hc11.h>     /* Include register definitions */
 0024           ; #include <stdio.h>
 0024           ; #define motcont *(unsigned char volatile *)(0xB590)
 0024           ; #define linetrack *(unsigned char volatile *) (0XB5A0)
 0024           ; 
 0024           ; 
 0024           ; /* Declarations */
 0024           ; unsigned int OC2hi, OC2lo, OC3hi, OC3lo;      /* Duty cycle data */
 0024           ; unsigned int T_counts=0x4E20, per_on2=60, per_on3=70, cntflag=0;
 0024           ; 
 0024           ; 
 0024           ; /* Prototypes */
 0024           ; void initoc(void);
 0024           ; void rtoc2(void);
 0024           ; void rtoc3(void);
 0024           ; void cnts2(void);
 0024           ; void cnts3(void);
 0024           ; void RTIINTR (void);
 0024           ; 
 0024           ; 
 0024           ; void main(void)
 0024           ; {
 0024           ;       int temp1=0, temp2=0, sensorzero=0, sensorone=0;
 0024 CC0000            ldd #0
 0027 ED30              std 48,x
 0029 CC0000            ldd #0
 002C ED2A              std 42,x
 002E CC0000            ldd #0
 0031 ED2E              std 46,x
 0033 CC0000            ldd #0
 0036 ED2C              std 44,x
 0038           ;       int rightline = 0, leftline = 0;
 0038 CC0000            ldd #0
 003B ED08              std 8,x
 003D CC0000            ldd #0
 0040 ED06              std 6,x
 0042           ;       //             0  1 2  3  
 0042           ;       int two[4]=  {0,60,70,60};
 0042 EC00              ldd 0,x
 0044 C30022            addd #34
 0047 18CE0000          ldy #L4
 004B 3C                pshx
 004C 8F                xgdx
 004D CC0008            ldd #8
 0050 BD0000            jsr __asgnblk
 0053 38                pulx
 0054           ;       int three[4]={0,70,60,60};
 0054 EC00              ldd 0,x
 0056 C3001A            addd #26
 0059 18CE0008          ldy #L5
 005D 3C                pshx
 005E 8F                xgdx
 005F CC0008            ldd #8
 0062 BD0000            jsr __asgnblk
 0065 38                pulx
 0066           ;       //                  0  1  2  3
 0066           ;       int     angletwo[4]      ={00,60,70,60};                  
 0066 EC00              ldd 0,x
 0068 C30012            addd #18
 006B 18CE0010          ldy #L6
 006F 3C                pshx
 0070 8F                xgdx
 0071 CC0008            ldd #8
 0074 BD0000            jsr __asgnblk
 0077 38                pulx
 0078           ;       int anglethree[4]={00,70,60,60};
 0078 EC00              ldd 0,x
 007A C3000A            addd #10
 007D 18CE0018          ldy #L7
 0081 3C                pshx
 0082 8F                xgdx
 0083 CC0008            ldd #8
 0086 BD0000            jsr __asgnblk
 0089 38                pulx
 008A           ;       
 008A           ;       setbaud(BAUD9600);
 008A CC0030            ldd #48
 008D BD0000            jsr _setbaud
 0090           ;       INTR_OFF();
 0090 0F                                sei
 0091           
 0091           ;       /* set up jump vector for buffalo */
 0091           ;       asm("   ldaa #$7e");
 0091 867E                              ldaa #$7e
 0093           
 0093           ;       asm("   staa $dc");
 0093 97DC                              staa $dc
 0095           
 0095           ;       asm("   staa $eb");
 0095 97EB                              staa $eb
 0097           
 0097           ;       asm("   staa $d9");
 0097 97D9                              staa $d9
 0099           
 0099           ;       asm("   ldd #_rtoc2");
 0099 CC0323                            ldd #_rtoc2
 009C           
 009C           ;       asm("   std $dd");
 009C DDDD                              std $dd
 009E           
 009E           ;       asm("   ldd #_rtoc3");
 009E CC0359                            ldd #_rtoc3
 00A1           
 00A1           ;       asm("   std $da");
 00A1 DDDA                              std $da
 00A3           
 00A3           ;       asm("   ldd #_RTIINTR");
 00A3 CC0549                            ldd #_RTIINTR
 00A6           
 00A6           ;       asm("   std $ec");
 00A6 DDEC                              std $ec
 00A8           
 00A8           ;       
 00A8           ;       TMSK2=0x40;
 00A8 C640              ldab #64
 00AA F71024            stab 0x1024
 00AD           ;       PACTL=PACTL & 0xFC;
 00AD 18CE1026          ldy #0x1026
 00B1 181D0003          bclr 0,y,#0x3
 00B5           ;       PACTL=PACTL | 0x00;
 00B5                   ; vol
 00B5 F61026            ldab 0x1026
 00B8 F71026            stab 0x1026
 00BB           ;       
 00BB           ;       motcont =0x03;
 00BB C603              ldab #3
 00BD F7B590            stab 0xb590
 00C0           ;       cnts2();
 00C0 BD038F            jsr _cnts2
 00C3           ;       cnts3();
 00C3 BD046C            jsr _cnts3
 00C6           ;       
 00C6           ;       initoc();
 00C6 BD0308            jsr _initoc
 00C9           ;       
 00C9           ;       cntflag = 0;
 00C9 CC0000            ldd #0
 00CC FD0006            std _cntflag
 00CF 7E02FE            jmp L9
 00D2           X0:
 00D2           ; 	
 00D2           ; 	while(1)
 00D2           ; 	{	 
 00D2           L11:
 00D2           ; 		 
 00D2           ; 		 while (cntflag == 1)
 00D2           ; 		 {
 00D2           ; 			temp2 = linetrack & 0x0C;	
 00D2           	; vol
 00D2 F6B5A0            ldab 0xb5a0
 00D5 4F                clra
 00D6 8400              anda #0
 00D8 C40C              andb #12
 00DA ED2A              std 42,x
 00DC           ;                       temp1 = linetrack & 0x03;
 00DC                   ; vol
 00DC F6B5A0            ldab 0xb5a0
 00DF 4F                clra
 00E0 8400              anda #0
 00E2 C403              andb #3
 00E4 ED30              std 48,x
 00E6           ;                       leftline = linetrack & 0xC0;
 00E6                   ; vol
 00E6 F6B5A0            ldab 0xb5a0
 00E9 4F                clra
 00EA 8400              anda #0
 00EC C4C0              andb #192
 00EE ED06              std 6,x
 00F0           ;                       rightline = linetrack & 0x30;
 00F0                   ; vol
 00F0 F6B5A0            ldab 0xb5a0
 00F3 4F                clra
 00F4 8400              anda #0
 00F6 C430              andb #48
 00F8 ED08              std 8,x
 00FA           ;                       motcont =0x03;  
 00FA C603              ldab #3
 00FC F7B590            stab 0xb590
 00FF 201A              bra L15
 0101           L14:
 0101 7F1022            clr 0x1022
 0104 7F1000            clr 0x1000
 0107                   ; vol
 0107 F6B5A0            ldab 0xb5a0
 010A 4F                clra
 010B 8400              anda #0
 010D C40C              andb #12
 010F ED2A              std 42,x
 0111                   ; vol
 0111 F6B5A0            ldab 0xb5a0
 0114 4F                clra
 0115 8400              anda #0
 0117 C403              andb #3
 0119 ED30              std 48,x
 011B           L15:
 011B           ; 		 
 011B           ; 		 	while ( (temp1 == 0x00)  &&  (temp2 == 0x00) )
 011B EC30              ldd 48,x
 011D 2604              bne L17
 011F EC2A              ldd 42,x
 0121 27DE              beq L14
 0123           L17:
 0123 7E01CB            jmp L19
 0126           L18:
 0126           ; 			{
 0126           ; 		 	   TMSK1=0x00;
 0126           ; 			   PORTA=0x00; 
 0126           ; 			   temp2 = linetrack & 0x0C;	
 0126           ; 		 	   temp1 = linetrack & 0x03;
 0126           ; 			}
 0126           ; 		
 0126           ; 		    while ( (temp1 == 0x00) && (temp2 != 0x00) )
 0126           ; 		    {	  
 0126           ; 			  
 0126           ; 		 	  TMSK1= 0x00;
 0126 7F1022            clr 0x1022
 0129           ;                         PORTA = 0x00;
 0129 7F1000            clr 0x1000
 012C           ;                         cntflag = 0;
 012C CC0000            ldd #0
 012F FD0006            std _cntflag
 0132           L21:
 0132           L22:
 0132           ; 			  
 0132           ; 			  while (cntflag <= 244)
 0132 FC0006            ldd _cntflag
 0135 1A8300F4          cpd #244
 0139 23F7              bls L21
 013B           ;                         {
 013B           ;                                       
 013B           ;                         }
 013B           ;                         cntflag = 0;
 013B CC0000            ldd #0
 013E FD0006            std _cntflag
 0141 2068              bra L25
 0143           L24:
 0143           ; 			  
 0143           ; 			  while (cntflag <= 75)
 0143           ; 			  {
 0143           ; 			  
 0143           ; 		  	   		if (sensorzero == 1)
 0143 EC2E              ldd 46,x
 0145 1A830001          cpd #1
 0149 2611              bne L27
 014B           ;                                       {
 014B           ;                                          motcont = 0x02;
 014B C602              ldab #2
 014D F7B590            stab 0xb590
 0150           ;                                          per_on2 = 60;
 0150 CC003C            ldd #60
 0153 FD0002            std _per_on2
 0156           ;                                          per_on3 = 70;
 0156 CC0046            ldd #70
 0159 FD0004            std _per_on3
 015C           ;                                       }
 015C           L27:
 015C           ; 			  		if (sensorone == 1)
 015C EC2C              ldd 44,x
 015E 1A830001          cpd #1
 0162 2611              bne L29
 0164           ;                                       {
 0164           ;                                          motcont = 0x01;
 0164 C601              ldab #1
 0166 F7B590            stab 0xb590
 0169           ;                                          per_on2 = 70;
 0169 CC0046            ldd #70
 016C FD0002            std _per_on2
 016F           ;                                          per_on3 = 60;
 016F CC003C            ldd #60
 0172 FD0004            std _per_on3
 0175           ;                                       }
 0175           L29:
 0175           ; 			 		TMSK1 = 0x60;
 0175 C660              ldab #96
 0177 F71022            stab 0x1022
 017A           ;                                       cnts2();
 017A BD038F            jsr _cnts2
 017D           ;                                       cnts3();
 017D BD046C            jsr _cnts3
 0180           ;                                       temp1 = linetrack & 0x03;
 0180                   ; vol
 0180 F6B5A0            ldab 0xb5a0
 0183 4F                clra
 0184 8400              anda #0
 0186 C403              andb #3
 0188 ED30              std 48,x
 018A           ;                                       cntflag = 0;
 018A CC0000            ldd #0
 018D FD0006            std _cntflag
 0190 2006              bra L32
 0192           L31:
 0192 7F1022            clr 0x1022
 0195 7F1000            clr 0x1000
 0198           L32:
 0198           ; 					while (cntflag <= 183)
 0198 FC0006            ldd _cntflag
 019B 1A8300B7          cpd #183
 019F 23F1              bls L31
 01A1           ;                                       {
 01A1           ;                                         TMSK1 = 0x00;
 01A1           ;                                         PORTA = 0x00;
 01A1           ;                                       }
 01A1           ;                                       if (temp1 == 0)
 01A1 EC30              ldd 48,x
 01A3 2606              bne L34
 01A5           ;                                       {
 01A5           ;                                        cntflag = 0;
 01A5 CC0000            ldd #0
 01A8 FD0006            std _cntflag
 01AB           ;                                       }
 01AB           L34:
 01AB           L25:
 01AB FC0006            ldd _cntflag
 01AE 1A83004B          cpd #75
 01B2 2203              bhi X2
 01B4 7E0143            jmp L24
 01B7           X2:
 01B7           	; vol
 01B7 F6B5A0            ldab 0xb5a0
 01BA 4F                clra
 01BB 8400              anda #0
 01BD C403              andb #3
 01BF ED30              std 48,x
 01C1                   ; vol
 01C1 F6B5A0            ldab 0xb5a0
 01C4 4F                clra
 01C5 8400              anda #0
 01C7 C40C              andb #12
 01C9 ED2A              std 42,x
 01CB           L19:
 01CB EC30              ldd 48,x
 01CD 2607              bne L36
 01CF EC2A              ldd 42,x
 01D1 2703              beq X3
 01D3 7E0126            jmp L18
 01D6           X3:
 01D6           L36:
 01D6 7E024F            jmp L38
 01D9           L37:
 01D9           ; 					
 01D9           ; 					
 01D9           ;               }
 01D9           ; 			  temp1 = linetrack & 0x03;
 01D9           ; 			  temp2 = linetrack & 0x0C;
 01D9           ; 	        }
 01D9           ; 		
 01D9           ; 		while ((two[temp1] != 0) && (three[temp1] != 0 ))
 01D9           ; 		{   
 01D9           ; 		  	  sensorzero = 0;
 01D9 CC0000            ldd #0
 01DC ED2E              std 46,x
 01DE           ;                         sensorone = 0;
 01DE CC0000            ldd #0
 01E1 ED2C              std 44,x
 01E3           ;                         if(temp1 == 0x01)
 01E3 EC30              ldd 48,x
 01E5 1A830001          cpd #1
 01E9 2605              bne L40
 01EB           ;                         {
 01EB           ;                         sensorzero = 1;
 01EB CC0001            ldd #1
 01EE ED2E              std 46,x
 01F0           ;                         }
 01F0           L40:
 01F0           ; 		  	  if (temp1 == 0x02)
 01F0 EC30              ldd 48,x
 01F2 1A830002          cpd #2
 01F6 2605              bne L42
 01F8           ;                         {
 01F8           ;                         sensorone = 1;
 01F8 CC0001            ldd #1
 01FB ED2C              std 44,x
 01FD           ;                         }
 01FD           L42:
 01FD C660              ldab #96
 01FF F71022            stab 0x1022
 0202 C603              ldab #3
 0204 F7B590            stab 0xb590
 0207 EC00              ldd 0,x
 0209 C30022            addd #34
 020C ED02              std 2,x
 020E EC30              ldd 48,x
 0210 05                lsld
 0211 E302              addd 2,x
 0213 188F              xgdy
 0215 18EC00            ldd 0,y
 0218 FD0002            std _per_on2
 021B EC00              ldd 0,x
 021D C3001A            addd #26
 0220 ED02              std 2,x
 0222 EC30              ldd 48,x
 0224 05                lsld
 0225 E302              addd 2,x
 0227 188F              xgdy
 0229 18EC00            ldd 0,y
 022C FD0004            std _per_on3
 022F BD038F            jsr _cnts2
 0232 BD046C            jsr _cnts3
 0235 CC0000            ldd #0
 0238 FD0006            std _cntflag
 023B                   ; vol
 023B F6B5A0            ldab 0xb5a0
 023E 4F                clra
 023F 8400              anda #0
 0241 C403              andb #3
 0243 ED30              std 48,x
 0245                   ; vol
 0245 F6B5A0            ldab 0xb5a0
 0248 4F                clra
 0249 8400              anda #0
 024B C40C              andb #12
 024D ED2A              std 42,x
 024F           L38:
 024F EC30              ldd 48,x
 0251 05                lsld
 0252 ED04              std 4,x
 0254 EC00              ldd 0,x
 0256 C30022            addd #34
 0259 ED02              std 2,x
 025B EC04              ldd 4,x
 025D E302              addd 2,x
 025F 188F              xgdy
 0261 18EC00            ldd 0,y
 0264 2715              beq L44
 0266 EC00              ldd 0,x
 0268 C3001A            addd #26
 026B ED02              std 2,x
 026D EC04              ldd 4,x
 026F E302              addd 2,x
 0271 188F              xgdy
 0273 18EC00            ldd 0,y
 0276 2703              beq X4
 0278 7E01D9            jmp L37
 027B           X4:
 027B           L44:
 027B 7E02E1            jmp L46
 027E           L45:
 027E           ; 		  	  TMSK1 = 0x60;
 027E           ; 			  motcont = 0x03;
 027E           ; 		  	  per_on2 = two[temp1];
 027E           ; 		  	  per_on3 = three[temp1];
 027E           ; 		  	  cnts2();
 027E           ; 		  	  cnts3();
 027E           ; 			  cntflag = 0;
 027E           ; 			  temp1 = linetrack & 0x03;
 027E           ; 			  temp2 = linetrack & 0x0C;
 027E           ; 		 }
 027E           ;        	 while (temp1 == 0x03)
 027E           ; 		 {
 027E           ; 		   	  if (temp2 == 0x00)
 027E EC2A              ldd 42,x
 0280 2622              bne L48
 0282           ;                         {
 0282           ;                               TMSK1 = 0x60;
 0282 C660              ldab #96
 0284 F71022            stab 0x1022
 0287           ;                               motcont = 0x03;
 0287 C603              ldab #3
 0289 F7B590            stab 0xb590
 028C           ;                               per_on2 = 30;
 028C CC001E            ldd #30
 028F FD0002            std _per_on2
 0292           ;                               per_on3 = 30;
 0292 CC001E            ldd #30
 0295 FD0004            std _per_on3
 0298           ;                               cnts2();
 0298 BD038F            jsr _cnts2
 029B           ;                               cnts3();
 029B BD046C            jsr _cnts3
 029E           ;                               cntflag = 0;
 029E CC0000            ldd #0
 02A1 FD0006            std _cntflag
 02A4           ;                               
 02A4           ;                         }
 02A4           L48:
 02A4 C603              ldab #3
 02A6 F7B590            stab 0xb590
 02A9 EC00              ldd 0,x
 02AB C30012            addd #18
 02AE ED02              std 2,x
 02B0 EC2A              ldd 42,x
 02B2 05                lsld
 02B3 E302              addd 2,x
 02B5 188F              xgdy
 02B7 18EC00            ldd 0,y
 02BA FD0002            std _per_on2
 02BD EC00              ldd 0,x
 02BF C3000A            addd #10
 02C2 ED02              std 2,x
 02C4 EC2A              ldd 42,x
 02C6 05                lsld
 02C7 E302              addd 2,x
 02C9 188F              xgdy
 02CB 18EC00            ldd 0,y
 02CE FD0004            std _per_on3
 02D1 BD038F            jsr _cnts2
 02D4 BD046C            jsr _cnts3
 02D7                   ; vol
 02D7 F6B5A0            ldab 0xb5a0
 02DA 4F                clra
 02DB 8400              anda #0
 02DD C403              andb #3
 02DF ED30              std 48,x
 02E1           L46:
 02E1 EC30              ldd 48,x
 02E3 1A830003          cpd #3
 02E7 2603              bne X5
 02E9 7E027E            jmp L45
 02EC           X5:
 02EC CC0000            ldd #0
 02EF FD0006            std _cntflag
 02F2           L12:
 02F2 FC0006            ldd _cntflag
 02F5 1A830001          cpd #1
 02F9 2603              bne X6
 02FB 7E00D2            jmp L11
 02FE           X6:
 02FE           L9:
 02FE 20F2              bra L12
 0300           X1:
 0300           ; 		  	 motcont = 0x03;
 0300           ; 		  	 per_on2 = angletwo[temp2];
 0300           ; 		  	 per_on3 = anglethree[temp2];
 0300           ; 		  	 cnts2();
 0300           ; 		 	 cnts3();
 0300           ; 			 temp1 = linetrack & 0x03; 
 0300           ; 		}
 0300           ; 		  
 0300           ; 
 0300           ; 	    cntflag = 0;
 0300           ; 	  }
 0300           ; 		
 0300           ;     }
 0300           ; 
 0300           ; 	
 0300           ; }
 0300           L3:
 0300 8F                xgdx
 0301 C30032            addd #50
 0304 8F                xgdx
 0305 35                txs
 0306 38                pulx
 0307                   .dbline 0 ; func end
 0307 39                rts
 0308           _initoc::
 0308           ; 
 0308           ; void initoc(void)
 0308           ; /* Initialize OC2 */
 0308           ; {
 0308           ; 	TOC2 = TCNT;
 0308           	; vol
 0308 FC100E            ldd 0x100e
 030B FD1018            std 0x1018
 030E           ;       TOC3 = TCNT;
 030E                   ; vol
 030E FC100E            ldd 0x100e
 0311 FD101A            std 0x101a
 0314           ;       TCTL1 = 0x00;
 0314 7F1020            clr 0x1020
 0317           ;       TFLG1 = 0x60;
 0317 C660              ldab #96
 0319 F71023            stab 0x1023
 031C           ;       TMSK1 = 0x60;
 031C C660              ldab #96
 031E F71022            stab 0x1022
 0321           ;       INTR_ON();
 0321 0E                                cli
 0322           
 0322           ; }
 0322           L50:
 0322                   .dbline 0 ; func end
 0322 39                rts
 0323           _rtoc2::
 0323           ; 
 0323           ; void rtoc2(void)
 0323           ; /* Interrupt Service Routine for OC2 PWM */
 0323           ; {   
 0323           ; 	if ((PORTA & 0X40) == 0){ 
 0323 18CE1000          ldy #0x1000
 0327 181F004002        brclr 0,y,#64,X7
 032C 2013              bra L52
 032E           X7:
 032E           ; 		TOC2 = TOC2 + OC2hi;
 032E           	; vol
 032E FC1018            ldd 0x1018
 0331 F30006            addd _OC2hi
 0334 FD1018            std 0x1018
 0337           ;               PORTA = PORTA | 0x40;
 0337 18CE1000          ldy #0x1000
 033B 181C0040          bset 0,y,#64
 033F           ;               }
 033F 2011              bra L53
 0341           L52:
 0341           ; 	else{
 0341           ; 		TOC2 = TOC2 + OC2lo;
 0341           	; vol
 0341 FC1018            ldd 0x1018
 0344 F30004            addd _OC2lo
 0347 FD1018            std 0x1018
 034A           ;               PORTA = PORTA & 0xBF;
 034A 18CE1000          ldy #0x1000
 034E 181D0040          bclr 0,y,#0x40
 0352           ;               }
 0352           L53:
 0352           ; 	//TCTL1 = TCTL1 ^ 0x40;	/* invert OL2 to toggle next OC2 edge */
 0352           ; 	TFLG1 = 0x40;	/* Clear flag OC2F */
 0352 C640              ldab #64
 0354 F71023            stab 0x1023
 0357           ;       asm("   rti");  /* This is an interrupt service routine */
 0357 3B                                rti
 0358           
 0358           ; }
 0358           L51:
 0358                   .dbline 0 ; func end
 0358 39                rts
 0359           _rtoc3::
 0359           ; 
 0359           ; void rtoc3(void)
 0359           ; {	
 0359           ; 	if ((PORTA & 0X20) == 0) {
 0359 18CE1000          ldy #0x1000
 035D 181F002002        brclr 0,y,#32,X8
 0362 2013              bra L55
 0364           X8:
 0364           ; 		TOC3 = TOC3 + OC3hi;
 0364           	; vol
 0364 FC101A            ldd 0x101a
 0367 F30002            addd _OC3hi
 036A FD101A            std 0x101a
 036D           ;               PORTA = PORTA | 0x20;
 036D 18CE1000          ldy #0x1000
 0371 181C0020          bset 0,y,#32
 0375           ;       }       
 0375 2011              bra L56
 0377           L55:
 0377           ; 	else{
 0377           ; 		TOC3 = TOC3 + OC3lo;
 0377           	; vol
 0377 FC101A            ldd 0x101a
 037A F30000            addd _OC3lo
 037D FD101A            std 0x101a
 0380           ;               PORTA = PORTA & 0xDF;
 0380 18CE1000          ldy #0x1000
 0384 181D0020          bclr 0,y,#0x20
 0388           ;       }
 0388           L56:
 0388           ; 	//TCTL1 = TCTL1 ^ 0x10;	/* invert OL2 to toggle next OC2 edge */
 0388           ; 	TFLG1 = 0x20;	/* Clear flag OC2F */
 0388 C620              ldab #32
 038A F71023            stab 0x1023
 038D           ;       asm("   rti");  /* This is an interrupt service routine */
 038D 3B                                rti
 038E           
 038E           ; }
 038E           L54:
 038E                   .dbline 0 ; func end
 038E 39                rts
 038F           ;  lreg1 -> -4,x
 038F           ;  lreg2 -> -8,x
 038F           ;  IX -> 0,x
 038F           ;          ?temp -> +2,x
 038F           ;          ?temp -> +6,x
 038F           _cnts2::
 038F BD0000            jsr __enterb
 0392 88                .byte 0x88
 0393           ; void cnts2 (void)
 0393           ; {
 0393           ;       OC2hi=T_counts * (float)per_on2/100;
 0393 FC0002            ldd _per_on2
 0396 04                lsrd
 0397 BD0000            jsr __d2lreg
 039A BD0000            jsr __long2fp
 039D BD0000            jsr __fpmov
 03A0 18CE0561          ldy #L61
 03A4 BD0000            jsr __tofp1
 03A7 BD0000            jsr __fpmul
 03AA FC0002            ldd _per_on2
 03AD 8400              anda #0
 03AF C401              andb #1
 03B1 BD0000            jsr __d2lreg
 03B4 BD0000            jsr __pshfp1 ; spill
 03B7 BD0000            jsr __long2fp
 03BA BD0000            jsr __fpmov
 03BD BD0000            jsr __pulfp1 ; reload
 03C0 BD0000            jsr __fpadd
 03C3 BD0000            jsr __fpmov
 03C6 FC0000            ldd _T_counts
 03C9 04                lsrd
 03CA BD0000            jsr __d2lreg
 03CD BD0000            jsr __long2fp
 03D0 BD0000            jsr __pshfp2 ; spill
 03D3 BD0000            jsr __fpmov
 03D6 18CE0561          ldy #L61
 03DA BD0000            jsr __tofp1
 03DD BD0000            jsr __fpmul
 03E0 FC0000            ldd _T_counts
 03E3 8400              anda #0
 03E5 C401              andb #1
 03E7 BD0000            jsr __d2lreg
 03EA BD0000            jsr __pshfp1 ; spill
 03ED BD0000            jsr __long2fp
 03F0 BD0000            jsr __fpmov
 03F3 BD0000            jsr __pulfp1 ; reload
 03F6 BD0000            jsr __fpadd
 03F9 BD0000            jsr __pulfp2 ; reload
 03FC BD0000            jsr __fpmul
 03FF 18CE055D          ldy #L62
 0403 BD0000            jsr __tofp2
 0406 BD0000            jsr __fpdiv
 0409 EC00              ldd 0,x
 040B C30002            addd #2
 040E 188F              xgdy
 0410 BD0000            jsr __fromfp1
 0413 EC00              ldd 0,x
 0415 C30002            addd #2
 0418 188F              xgdy
 041A BD0000            jsr __tofp1
 041D 18CE0559          ldy #L63
 0421 BD0000            jsr __tofp2
 0424 BD0000            jsr __fpcmp
 0427 2D1E              blt L59
 0429 EC00              ldd 0,x
 042B C30002            addd #2
 042E 188F              xgdy
 0430 BD0000            jsr __tofp1
 0433 18CE0559          ldy #L63
 0437 BD0000            jsr __tofp2
 043A BD0000            jsr __fpsub
 043D BD0000            jsr __fp2int
 0440 C38000            addd #0x8000
 0443 ED06              std 6,x
 0445 200F              bra L60
 0447           L59:
 0447 EC00              ldd 0,x
 0449 C30002            addd #2
 044C 188F              xgdy
 044E BD0000            jsr __tofp1
 0451 BD0000            jsr __fp2int
 0454 ED06              std 6,x
 0456           L60:
 0456 EC06              ldd 6,x
 0458 FD0006            std _OC2hi
 045B           ;       OC2lo=T_counts - OC2hi;
 045B FC0000            ldd _T_counts
 045E B30006            subd _OC2hi
 0461 FD0004            std _OC2lo
 0464           ; }
 0464           L57:
 0464 8F                xgdx
 0465 C30008            addd #8
 0468 8F                xgdx
 0469 35                txs
 046A 38                pulx
 046B                   .dbline 0 ; func end
 046B 39                rts
 046C           ;  lreg1 -> -4,x
 046C           ;  lreg2 -> -8,x
 046C           ;  IX -> 0,x
 046C           ;          ?temp -> +2,x
 046C           ;          ?temp -> +6,x
 046C           _cnts3::
 046C BD0000            jsr __enterb
 046F 88                .byte 0x88
 0470           ; 
 0470           ; void cnts3 (void)
 0470           ; {
 0470           ;       OC3hi=T_counts * (float)per_on3/100;
 0470 FC0004            ldd _per_on3
 0473 04                lsrd
 0474 BD0000            jsr __d2lreg
 0477 BD0000            jsr __long2fp
 047A BD0000            jsr __fpmov
 047D 18CE0561          ldy #L61
 0481 BD0000            jsr __tofp1
 0484 BD0000            jsr __fpmul
 0487 FC0004            ldd _per_on3
 048A 8400              anda #0
 048C C401              andb #1
 048E BD0000            jsr __d2lreg
 0491 BD0000            jsr __pshfp1 ; spill
 0494 BD0000            jsr __long2fp
 0497 BD0000            jsr __fpmov
 049A BD0000            jsr __pulfp1 ; reload
 049D BD0000            jsr __fpadd
 04A0 BD0000            jsr __fpmov
 04A3 FC0000            ldd _T_counts
 04A6 04                lsrd
 04A7 BD0000            jsr __d2lreg
 04AA BD0000            jsr __long2fp
 04AD BD0000            jsr __pshfp2 ; spill
 04B0 BD0000            jsr __fpmov
 04B3 18CE0561          ldy #L61
 04B7 BD0000            jsr __tofp1
 04BA BD0000            jsr __fpmul
 04BD FC0000            ldd _T_counts
 04C0 8400              anda #0
 04C2 C401              andb #1
 04C4 BD0000            jsr __d2lreg
 04C7 BD0000            jsr __pshfp1 ; spill
 04CA BD0000            jsr __long2fp
 04CD BD0000            jsr __fpmov
 04D0 BD0000            jsr __pulfp1 ; reload
 04D3 BD0000            jsr __fpadd
 04D6 BD0000            jsr __pulfp2 ; reload
 04D9 BD0000            jsr __fpmul
 04DC 18CE055D          ldy #L62
 04E0 BD0000            jsr __tofp2
 04E3 BD0000            jsr __fpdiv
 04E6 EC00              ldd 0,x
 04E8 C30002            addd #2
 04EB 188F              xgdy
 04ED BD0000            jsr __fromfp1
 04F0 EC00              ldd 0,x
 04F2 C30002            addd #2
 04F5 188F              xgdy
 04F7 BD0000            jsr __tofp1
 04FA 18CE0559          ldy #L63
 04FE BD0000            jsr __tofp2
 0501 BD0000            jsr __fpcmp
 0504 2D1E              blt L66
 0506 EC00              ldd 0,x
 0508 C30002            addd #2
 050B 188F              xgdy
 050D BD0000            jsr __tofp1
 0510 18CE0559          ldy #L63
 0514 BD0000            jsr __tofp2
 0517 BD0000            jsr __fpsub
 051A BD0000            jsr __fp2int
 051D C38000            addd #0x8000
 0520 ED06              std 6,x
 0522 200F              bra L67
 0524           L66:
 0524 EC00              ldd 0,x
 0526 C30002            addd #2
 0529 188F              xgdy
 052B BD0000            jsr __tofp1
 052E BD0000            jsr __fp2int
 0531 ED06              std 6,x
 0533           L67:
 0533 EC06              ldd 6,x
 0535 FD0002            std _OC3hi
 0538           ;       OC3lo=T_counts - OC3hi;
 0538 FC0000            ldd _T_counts
 053B B30002            subd _OC3hi
 053E FD0000            std _OC3lo
 0541           ; }     
 0541           L64:
 0541 8F                xgdx
 0542 C30008            addd #8
 0545 8F                xgdx
 0546 35                txs
 0547 38                pulx
 0548                   .dbline 0 ; func end
 0548 39                rts
 0549           _RTIINTR::
 0549           ; 
 0549           ; void RTIINTR (void)
 0549           ; {
 0549           ;   TFLG2 = 0x40;
 0549 C640              ldab #64
 054B F71025            stab 0x1025
 054E           ;   
 054E           ;   cntflag ++;
 054E FC0006            ldd _cntflag
 0551 C30001            addd #1
 0554 FD0006            std _cntflag
 0557           ;   
 0557           ;   asm("         rti");
 0557 3B                                  rti
 0558           
 0558           ; }
 0558           L68:
 0558                   .dbline 0 ; func end
 0558 39                rts
                        .area bss
 0000           _OC3lo::
 0000                   .blkb 2
 0002           _OC3hi::
 0002                   .blkb 2
 0004           _OC2lo::
 0004                   .blkb 2
 0006           _OC2hi::
 0006                   .blkb 2
                        .area text
 0559           L63:
 0559 47000000          .word 0x4700,0x0
 055D           L62:
 055D 42C80000          .word 0x42c8,0x0
 0561           L61:
 0561 40000000          .word 0x4000,0x0
