	.module denisfin.c
	.dbfile denisfin.c
	.area text
;  IX -> 0,x
_SCI_isr::
	.dbfile C:\ICCTK\include/isrtk.h
	.dbfunc SCI_isr
	.dbline 40
; /************************************************************************
;  * Title        smokeden.c                                	                
;  * Programmer	Sean Justice	        				
;  * Date         July 17,1999      	                                
;  * Version	1			                		
;  *								        
;  * Description
;  * Start by hit the rear bumper and then Denise will not do 
;  * anything until she has detected smoke.
;  *	
;  *	Functions:
;  *		detectsmoke() used to detect if the smoke detector 
;  * 		has detected any smoke
;  *								
;  * Use Hyperterm with the following settings:                           
;  *   									
;  *      COM1, 9600 Baud, 8 bits, No Parity, 1 Stop bit, No Flow         
;  *      of Control, VT100 Terminal, WrapLines.				
;  *									
;  *Usage: Verify functionality of TALRIK's sensors.
;  ************************************************************************/
;  
; /**************************** Includes **********************************/
; 
; #include <tkbase.h>
; 
; 
; /************************ End of includes *******************************/
; 
; 
; /*************************** Constants **********************************/
; 
; /*IR emitter output port driver, the output latch at address 0xffb9 */
; #define IRE_OUT   *(unsigned char *)(0xffb9) 
; 
; /*Constant for driving all the 40KHz modulated IR emitters on when loaded into IRE_OUT */
; #define IRE_ALL_ON 0xff 
; 
; /*Constant for turning all the 40KHz modulated IR emitters off when loaded into IRE_OUT */
; #define IRE_ALL_OFF 0x00
L2:
	rti
;  IX -> 0,x
_SPI_isr::
	.dbfunc SPI_isr
	.dbline 46
; 
; #define BUMPER_FUZZY 10
; #define NOSMOKE 40
; #define IRTHRESHOLD 110
; #define FIRE 50
; #define DEFFIRE 55
L3:
	rti
;  IX -> 0,x
_PAIE_isr::
	.dbfunc PAIE_isr
	.dbline 52
;  
; /************************ End of Constants ******************************/
; int rspeed = 0;
; int lspeed = 0;
; int foundfire = 0;
; unsigned int temp_one = 0;
L4:
	rti
;  IX -> 0,x
_PAV_isr::
	.dbfunc PAV_isr
	.dbline 58
; unsigned int temp_two = 0;
; int hightemp = 0;
; int fireheat = 0;
; 
; void detectsmoke(void);
; void avoidobject(void);
L5:
	rti
;  IX -> 0,x
_TOF_isr::
	.dbfunc TOF_isr
	.dbline 64
; void righturn(void);
; void lefturn(void);
; void checkbump(void);
; void firecheck(void);
; void intiztemp(void);
; void gettemp(void);
L6:
	rti
;  IX -> 0,x
_TOC4_isr::
	.dbfunc TOC4_isr
	.dbline 76
; int comptemp(int a, int b);
; void followfire(void);
; void firetemp(void);
; void fireforward(void);
; void fireright(void);
; void fireleft(void);
; 
; void main(void)
; /****************************** Main ***********************************/
; {
;   unsigned int bl, cv, fb, rb;
;   char clear[]= "\x1b\x5B\x32\x4A\x04";  /* clear screen */ 
L7:
	rti
;  IX -> 0,x
_TOC1_isr::
	.dbfunc TOC1_isr
	.dbline 94
;   char place[]= "\x1b[1;1H";		/* Home cursor */
; 
; 
;   init_analog();
;   init_motortk();
;   init_clocktk();
;   init_serial();
; 
;   IRE_OUT = IRE_ALL_ON;    /* Turns on all the 40KHz modulated IR emitters */
;   
;   rspeed = lspeed = 0;
;   motortk(RIGHT_MOTOR, rspeed);
;   motortk(LEFT_MOTOR, lspeed);
; 
;   /*printf("%s", clear);  
;   printf("%s", place);  
;   printf("Hit my ass to start me\n\n");*/
;   
L8:
	rti
;  IX -> 0,x
_TIC3_isr::
	.dbfunc TIC3_isr
	.dbline 100
;   while (rear_bumper() < BUMPER_FUZZY);
;   
;   read_IR();
;   
;     
;   /*printf("starting to look for smoke\n\n");*/
L9:
	rti
;  IX -> 0,x
_TIC2_isr::
	.dbfunc TIC2_isr
	.dbline 106
;     
;   
;   
;   detectsmoke();	/*checks to see if there is a fire*/
;   intiztemp();		/*records the curent tempurature*/
;   
L10:
	rti
;  IX -> 0,x
_TIC1_isr::
	.dbfunc TIC1_isr
	.dbline 112
;   rspeed = lspeed = 100;
;   motortk(RIGHT_MOTOR, rspeed);
;   motortk(LEFT_MOTOR, lspeed);
;   
;   /*printf("Will start to look for the fire\n\n");*/
; 	
L11:
	rti
;  IX -> 0,x
_RTI_isr::
	.dbfunc RTI_isr
	.dbline 118
; 	wait(500);
; 
;   /*printf("Starting to avoid objects\n");*/
;   
;   avoidobject();
;   
L12:
	rti
;  IX -> 0,x
_IRQ_isr::
	.dbfunc IRQ_isr
	.dbline 124
; 
; }
; 
; /**************************** End of Main ******************************/
; 
; void detectsmoke(void)
L13:
	rti
;  IX -> 0,x
_XIRQ_isr::
	.dbfunc XIRQ_isr
	.dbline 130
; {
; 	read_IR();
; 	
; 	while (IRDT[IR5clk] < NOSMOKE)
; 		{
; 			read_IR();
L14:
	rti
;  IX -> 0,x
_SWI_isr::
	.dbfunc SWI_isr
	.dbline 136
; 			wait(10);
; 		}
; 	/*printf("I have found smoke\n");*/
; }
; 
; void avoidobject(void)
L15:
	rti
;  IX -> 0,x
_ILLOP_isr::
	.dbfunc ILLOP_isr
	.dbline 142
; {
; 	/*printf("Starting motors at full speed\n");*/
; 	
; 	
; 	 
; 	 while (1)
L16:
	rti
;  IX -> 0,x
_COP_isr::
	.dbfunc COP_isr
	.dbline 148
; 	 {
; 	 	checkbump();
; 	 	
; 	 		 	
; 	 	read_IR();
; 	 	firecheck();
L17:
	rti
;  IX -> 0,x
_CLMON_isr::
	.dbfunc CLMON_isr
	.dbline 154
; 	 	if (foundfire == 10)
; 	 	{
; 	 		rspeed = lspeed = 50;
; 	 		motortk(RIGHT_MOTOR, rspeed);
; 	 		motortk(LEFT_MOTOR, lspeed);
; 	 	}
L18:
	rti
	.area data
_drew::
	.blkw 1
	.area idata
	.word _interrupt_vectors
	.area data
_rspeed::
	.blkb 2
	.area idata
	.word 0
	.area data
_lspeed::
	.blkb 2
	.area idata
	.word 0
	.area data
_foundfire::
	.blkb 2
	.area idata
	.word 0
	.area data
_temp_one::
	.blkb 2
	.area idata
	.word 0
	.area data
_temp_two::
	.blkb 2
	.area idata
	.word 0
	.area data
_hightemp::
	.blkb 2
	.area idata
	.word 0
	.area data
_fireheat::
	.blkb 2
	.area idata
	.word 0
	.area text
L20:
	.byte 27,91,50,'J,4,0
L21:
	.byte 27,91,49,59,49,'H,0
;  IX -> 0,x
;             rb -> 3,x
;             fb -> 5,x
;             cv -> 7,x
;             bl -> 9,x
;          place -> 11,x
;          clear -> 18,x
_main::
	jsr __enterb
	.byte 0x18
	.dbfile denisfin.c
	.dbfunc main
	.dbline 76
	ldd 0,x
	addd #18
	ldy #L20
	pshx
	xgdx
	ldd #6
	jsr __asgnblk
	pulx
	.dbline 77
	ldd 0,x
	addd #11
	ldy #L21
	pshx
	xgdx
	ldd #7
	jsr __asgnblk
	pulx
	.dbline 80
	jsr _init_analog
	.dbline 81
	jsr _init_motortk
	.dbline 82
	jsr _init_clocktk
	.dbline 83
	jsr _init_serial
	.dbline 85
	ldab #255
	stab 0xffb9
	.dbline 87
	ldd #0
	std _lspeed
	ldd #0
	std _rspeed
	.dbline 88
	ldd _rspeed
	pshb
	psha
	ldd #1
	jsr _motortk
	puly
	.dbline 89
	ldd _lspeed
	pshb
	psha
	ldd #0
	jsr _motortk
	puly
L22:
	.dbline 95
L23:
	jsr _rear_bumper
	cpd #10
	blo L22
	.dbline 97
	jsr _read_IR
	.dbline 104
	jsr _detectsmoke
	.dbline 105
	jsr _intiztemp
	.dbline 107
	ldd #100
	std _lspeed
	ldd #100
	std _rspeed
	.dbline 108
	ldd _rspeed
	pshb
	psha
	ldd #1
	jsr _motortk
	puly
	.dbline 109
	ldd _lspeed
	pshb
	psha
	ldd #0
	jsr _motortk
	puly
	.dbline 113
	ldd #500
	jsr _wait
	.dbline 117
	jsr _avoidobject
	.dbline 120
L19:
	xgdx
	addd #24
	xgdx
	txs
	pulx
	rts
;  IX -> 0,x
_detectsmoke::
	.dbfunc detectsmoke
	.dbline 126
	jsr _read_IR
	bra L27
L26:
	.dbline 130
	jsr _read_IR
	.dbline 131
	ldd #10
	jsr _wait
	.dbline 132
L27:
	.dbline 128
	ldd _IRDT+16
	cpd #40
	blo L26
	.dbline 134
L25:
	rts
;  IX -> 0,x
_avoidobject::
	.dbfunc avoidobject
	.dbline 137
	jmp L32
L31:
	.dbline 144
	jsr _checkbump
	.dbline 147
	jsr _read_IR
	.dbline 148
	jsr _firecheck
	.dbline 149
	ldd _foundfire
	cpd #10
	bne L37
	.dbline 151
	ldd #50
	std _lspeed
	ldd #50
	std _rspeed
	.dbline 152
	ldd _rspeed
	pshb
	psha
	ldd #1
	jsr _motortk
	puly
	.dbline 153
	ldd _lspeed
	pshb
	psha
	ldd #0
	jsr _motortk
	puly
	.dbline 154
	bra L37
L36:
	.dbline 157
	jsr _followfire
	.dbline 158
L37:
	.dbline 155
; 	 	while (foundfire == 10)
	ldd _foundfire
	cpd #10
	beq L36
	.dbline 161
; 	 	{
; 	 		followfire();
; 	 	}	 	
; 	 	
; 	 	
; 	    rspeed = lspeed = 100;
	ldd #100
	std _lspeed
	ldd #100
	std _rspeed
	.dbline 162
; 	    motortk(RIGHT_MOTOR, rspeed);
	ldd _rspeed
	pshb
	psha
	ldd #1
	jsr _motortk
	puly
	.dbline 163
; 	    motortk(LEFT_MOTOR, lspeed);
	ldd _lspeed
	pshb
	psha
	ldd #0
	jsr _motortk
	puly
	.dbline 165
; 	 	
; 	 	if ((IRDT[IR1clk] > IRTHRESHOLD) || (IRDT[IR2clk] > IRTHRESHOLD))
	ldd _IRDT+8
	cpd #110
	bhi L42
	ldd _IRDT
	cpd #110
	bls L39
L42:
	.dbline 169
; 	 		{
; 	 			/*printf("Object to my right, so\n");
; 	 			printf("I will avoid it\n\n");*/
; 	 			righturn();	 			
	jsr _righturn
	.dbline 170
; 	 		}
	bra L40
L39:
	.dbline 172
; 	 	
; 		 else if ((IRDT[IR4clk] > IRTHRESHOLD) || (IRDT[IR3clk] > IRTHRESHOLD))
	ldd _IRDT+14
	cpd #110
	bhi L47
	ldd _IRDT+12
	cpd #110
	bls L43
L47:
	.dbline 176
; 	 
; 	 		{
; 	 			/*printf("Object to my left, so\n");*/
; 	 			printf("I will avoid it\n\n");
	ldd #L48
	jsr _printf
	.dbline 177
; 	 			lefturn();	
	jsr _lefturn
	.dbline 178
; 	 		}
L43:
L40:
	.dbline 179
L32:
	.dbline 142
	jmp L31
L30:
	rts
;  IX -> 0,x
_righturn::
	.dbfunc righturn
	.dbline 185
; 	 }
; }
; 
; void righturn(void)
; {
; 	/*printf("Turning right.\n");*/
; 	rspeed = -100;
	ldd #-100
	std _rspeed
	.dbline 186
; 	lspeed = 100;
	ldd #100
	std _lspeed
	.dbline 187
; 	motortk(RIGHT_MOTOR, rspeed);
	ldd _rspeed
	pshb
	psha
	ldd #1
	jsr _motortk
	puly
	.dbline 188
; 	motortk(LEFT_MOTOR, lspeed);
	ldd _lspeed
	pshb
	psha
	ldd #0
	jsr _motortk
	puly
	bra L51
L50:
	.dbline 191
	jsr _read_IR
	.dbline 192
	jsr _firecheck
	.dbline 193
L51:
	.dbline 189
; 	while ((IRDT[IR1clk] > IRTHRESHOLD) || (IRDT[IR2clk] > IRTHRESHOLD))
	ldd _IRDT+8
	cpd #110
	bhi L50
	ldd _IRDT
	cpd #110
	bhi L50
	.dbline 194
; 	{
; 		read_IR();
; 		firecheck();
; 	}
; 	wait(300);
	ldd #300
	jsr _wait
	.dbline 195
; }
L49:
	rts
;  IX -> 0,x
_lefturn::
	.dbfunc lefturn
	.dbline 200
; 
; void lefturn(void)
; {
; 	/*printf("Turning left.\n");*/
; 	rspeed = 100;
	ldd #100
	std _rspeed
	.dbline 201
; 	lspeed = -100;
	ldd #-100
	std _lspeed
	.dbline 202
; 	motortk(RIGHT_MOTOR, rspeed);
	ldd _rspeed
	pshb
	psha
	ldd #1
	jsr _motortk
	puly
	.dbline 203
; 	motortk(LEFT_MOTOR, lspeed);
	ldd _lspeed
	pshb
	psha
	ldd #0
	jsr _motortk
	puly
	bra L56
L55:
	.dbline 206
	jsr _read_IR
	.dbline 207
	jsr _firecheck
	.dbline 209
L56:
	.dbline 204
; 	while ((IRDT[IR3clk] > IRTHRESHOLD) || (IRDT[IR4clk] > IRTHRESHOLD))
	ldd _IRDT+12
	cpd #110
	bhi L55
	ldd _IRDT+14
	cpd #110
	bhi L55
	.dbline 210
; 	{
; 		read_IR();
; 		firecheck();
; 		
; 	}
; 	wait(300);
	ldd #300
	jsr _wait
	.dbline 212
; 	
; }
L54:
	rts
;  IX -> 0,x
_checkbump::
	.dbfunc checkbump
	.dbline 216
; 
; void checkbump(void)
; {
; 	if (rear_bumper() > BUMPER_FUZZY)
	jsr _rear_bumper
	cpd #10
	bls L61
	.dbline 219
; 		{
; 			/*printf("You hit my ass\n\n");*/
; 			rspeed = lspeed = 50;
	ldd #50
	std _lspeed
	ldd #50
	std _rspeed
	.dbline 220
; 			motortk(RIGHT_MOTOR, rspeed);
	ldd _rspeed
	pshb
	psha
	ldd #1
	jsr _motortk
	puly
	.dbline 221
; 			motortk(LEFT_MOTOR, lspeed);
	ldd _lspeed
	pshb
	psha
	ldd #0
	jsr _motortk
	puly
	.dbline 222
; 			wait(500);
	ldd #500
	jsr _wait
	.dbline 223
; 			righturn();
	jsr _righturn
	.dbline 224
; 		}
	bra L62
L61:
	.dbline 225
; 	else if (front_bumper() > BUMPER_FUZZY)
	jsr _front_bumper
	cpd #10
	bls L63
	.dbline 228
; 		{
; 			/*printf("You hit my head\n\n");*/
; 			rspeed = lspeed = -50;
	ldd #-50
	std _lspeed
	ldd #-50
	std _rspeed
	.dbline 229
; 			motortk(RIGHT_MOTOR, rspeed);
	ldd _rspeed
	pshb
	psha
	ldd #1
	jsr _motortk
	puly
	.dbline 230
; 			motortk(LEFT_MOTOR, lspeed);
	ldd _lspeed
	pshb
	psha
	ldd #0
	jsr _motortk
	puly
	.dbline 231
; 			wait(500);
	ldd #500
	jsr _wait
	.dbline 232
; 			righturn();
	jsr _righturn
	.dbline 233
; 		}
L63:
L62:
	.dbline 234
; }
L60:
	rts
;  IX -> 0,x
_intiztemp::
	.dbfunc intiztemp
	.dbline 238
; 
; void intiztemp(void)
; {
; 	read_IR();
	jsr _read_IR
	.dbline 239
; 	wait(100);
	ldd #100
	jsr _wait
	.dbline 240
; 	temp_one = IRDT[IR8clk];
	ldd _IRDT+20
	std _temp_one
	.dbline 241
; 	temp_two = IRDT[IR9clk];
	ldd _IRDT+22
	std _temp_two
	.dbline 242
; 	wait(100);
	ldd #100
	jsr _wait
	.dbline 243
; 	read_IR();
	jsr _read_IR
	bra L69
L68:
	.dbline 246
	jsr _read_IR
	.dbline 247
	ldd _IRDT+20
	std _temp_one
	.dbline 248
	ldd _IRDT+22
	std _temp_two
	.dbline 249
	ldd #50
	jsr _wait
	.dbline 250
L69:
	.dbline 244
; 	while ((IRDT[IR8clk] != temp_one) || (IRDT[IR9clk] != temp_two))
	ldd _IRDT+20
	cpd _temp_one
	bne L68
	ldd _IRDT+22
	cpd _temp_two
	bne L68
	.dbline 251
; 		{
; 			read_IR();
; 			temp_one = IRDT[IR8clk];
; 			temp_two = IRDT[IR9clk];
; 			wait(50);
; 		}
; }
L65:
	rts
;  IX -> 0,x
_gettemp::
	.dbfunc gettemp
	.dbline 254
; void gettemp(void)
; {
; 	read_IR();
	jsr _read_IR
	.dbline 256
; 	
; 	temp_one = IRDT[IR8clk];
	ldd _IRDT+20
	std _temp_one
	.dbline 257
; 	temp_two = IRDT[IR9clk];
	ldd _IRDT+22
	std _temp_two
	.dbline 258
; }
L75:
	rts
;  IX -> 0,x
_firecheck::
	.dbfunc firecheck
	.dbline 264
; 
; /*****************************FIRECODE******************/
; 
; void firecheck(void)
; {
; 	read_IR();
	jsr _read_IR
	.dbline 266
; 	
; 	if ((IRDT[IR6clk] > FIRE) || (IRDT[IR7clk] > FIRE))
	ldd _IRDT+10
	cpd #50
	bhi L83
	ldd _IRDT+18
	cpd #50
	bls L79
L83:
	.dbline 269
; 	{
; 		
; 		rspeed = lspeed = 0;
	ldd #0
	std _lspeed
	ldd #0
	std _rspeed
	.dbline 270
; 		motortk(RIGHT_MOTOR, rspeed);
	ldd _rspeed
	pshb
	psha
	ldd #1
	jsr _motortk
	puly
	.dbline 271
; 		motortk(LEFT_MOTOR, lspeed);
	ldd _lspeed
	pshb
	psha
	ldd #0
	jsr _motortk
	puly
	.dbline 272
; 		foundfire = 10; 
	ldd #10
	std _foundfire
	.dbline 275
; 		 /*printf("I have found fire\n\n");*/
; 		 
; 		 wait(1000);
	ldd #1000
	jsr _wait
	.dbline 276
; 	}
L79:
	.dbline 278
; 	else 
; 		foundfire == 0;
L80:
	.dbline 279
; }
L78:
	rts
;  IX -> 0,x
_followfire::
	.dbfunc followfire
	.dbline 282
; void followfire(void)
; {
; 	gettemp();
	jsr _gettemp
	.dbline 283
; 	firetemp();
	jsr _firetemp
	.dbline 284
; 	read_IR();
	jsr _read_IR
	.dbline 286
; 	
; 	if ((IRDT[IR6clk] > FIRE) && (IRDT[IR7clk] > FIRE))
	ldd _IRDT+10
	cpd #50
	bls L85
	ldd _IRDT+18
	cpd #50
	bls L85
	.dbline 288
; 	{	
; 		gettemp();				
	jsr _gettemp
	.dbline 289
; 		firetemp();
	jsr _firetemp
	.dbline 290
; 		if (fireheat < DEFFIRE)
	ldd _fireheat
	cpd #55
	bge L86
	.dbline 292
; 		{
; 			fireforward();
	jsr _fireforward
	.dbline 295
; 		}
; 		
; 	}
	bra L86
L85:
	.dbline 296
; 	else if ((IRDT[IR6clk] > FIRE) && (IRDT[IR7clk] < FIRE))
	ldd _IRDT+10
	cpd #50
	bls L91
	ldd _IRDT+18
	cpd #50
	bhs L91
	.dbline 298
; 		{
; 			fireright();
	jsr _fireright
	.dbline 299
; 		}
	bra L92
L91:
	.dbline 300
; 	else if ((IRDT[IR6clk] < FIRE) && (IRDT[IR7clk] > FIRE))
	ldd _IRDT+10
	cpd #50
	bhs L95
	ldd _IRDT+18
	cpd #50
	bls L95
	.dbline 302
; 		{
; 			fireleft();
	jsr _fireleft
	.dbline 303
; 		}
L95:
L92:
L86:
	.dbline 304
; }
L84:
	rts
;  IX -> 0,x
_firetemp::
	.dbfunc firetemp
	.dbline 307
; void firetemp(void)
; {
; 	read_IR();
	jsr _read_IR
	.dbline 308
; 	fireheat = IRDT[IR8clk];
	ldd _IRDT+20
	std _fireheat
	.dbline 309
; }
L99:
	rts
;  IX -> 0,x
_fireforward::
	.dbfunc fireforward
	.dbline 313
; 
; void fireforward(void)
; {
; 	rspeed = lspeed = 50;
	ldd #50
	std _lspeed
	ldd #50
	std _rspeed
	.dbline 314
; 	motortk(RIGHT_MOTOR, rspeed);
	ldd _rspeed
	pshb
	psha
	ldd #1
	jsr _motortk
	puly
	.dbline 315
; 	motortk(LEFT_MOTOR, lspeed);
	ldd _lspeed
	pshb
	psha
	ldd #0
	jsr _motortk
	puly
	.dbline 316
; 	read_IR();
	jsr _read_IR
	.dbline 317
; 	firetemp();
	jsr _firetemp
	bra L103
L102:
	.dbline 320
	jsr _read_IR
	.dbline 321
	jsr _firetemp
	.dbline 322
L103:
	.dbline 318
; 	while (fireheat < DEFFIRE)	
	ldd _fireheat
	cpd #55
	blt L102
	.dbline 323
; 	{
; 		read_IR();
; 		firetemp();
; 	}
; 	if (fireheat >= DEFFIRE)
	ldd _fireheat
	cpd #55
	blt L105
	.dbline 325
; 	{
; 		rspeed = lspeed = 0;
	ldd #0
	std _lspeed
	ldd #0
	std _rspeed
	.dbline 326
; 		motortk(RIGHT_MOTOR, rspeed);
	ldd _rspeed
	pshb
	psha
	ldd #1
	jsr _motortk
	puly
	.dbline 327
; 		motortk(LEFT_MOTOR, lspeed);
	ldd _lspeed
	pshb
	psha
	ldd #0
	jsr _motortk
	puly
	.dbline 328
; 	}
L105:
	.dbline 329
; }
L101:
	rts
;  IX -> 0,x
_fireright::
	.dbfunc fireright
	.dbline 333
; 
; void fireright(void)
; {
; 	rspeed = -40;
	ldd #-40
	std _rspeed
	.dbline 334
; 	lspeed = 40;
	ldd #40
	std _lspeed
	.dbline 335
; 	motortk(RIGHT_MOTOR, rspeed);
	ldd _rspeed
	pshb
	psha
	ldd #1
	jsr _motortk
	puly
	.dbline 336
; 	motortk(LEFT_MOTOR, lspeed);
	ldd _lspeed
	pshb
	psha
	ldd #0
	jsr _motortk
	puly
	.dbline 337
; 	read_IR();
	jsr _read_IR
	bra L109
L108:
	.dbline 340
	jsr _read_IR
	.dbline 341
	ldd #10
	jsr _wait
	.dbline 342
L109:
	.dbline 338
; 	while ((IRDT[IR6clk] > FIRE) && (IRDT[IR7clk] < FIRE))
	ldd _IRDT+10
	cpd #50
	bls L113
	ldd _IRDT+18
	cpd #50
	blo L108
L113:
	.dbline 343
; 	{
; 		read_IR();
; 		wait(10);
; 	}
; 	fireforward();
	jsr _fireforward
	.dbline 344
; }
L107:
	rts
;  IX -> 0,x
_fireleft::
	.dbfunc fireleft
	.dbline 348
; 
; void fireleft(void)
; {
; 	rspeed = 40;
	ldd #40
	std _rspeed
	.dbline 349
; 	lspeed = -40;
	ldd #-40
	std _lspeed
	.dbline 350
; 	motortk(RIGHT_MOTOR, rspeed);
	ldd _rspeed
	pshb
	psha
	ldd #1
	jsr _motortk
	puly
	.dbline 351
; 	motortk(LEFT_MOTOR, lspeed);
	ldd _lspeed
	pshb
	psha
	ldd #0
	jsr _motortk
	puly
	.dbline 352
; 	read_IR();
	jsr _read_IR
	bra L116
L115:
	.dbline 355
	jsr _read_IR
	.dbline 356
	ldd #10
	jsr _wait
	.dbline 357
L116:
	.dbline 353
; 	while ((IRDT[IR6clk] < FIRE) && (IRDT[IR7clk] > FIRE))
	ldd _IRDT+10
	cpd #50
	bhs L120
	ldd _IRDT+18
	cpd #50
	bhi L115
L120:
	.dbline 358
; 	{
; 		read_IR();
; 		wait(10);
; 	}
; 	fireforward();
	jsr _fireforward
	.dbline 360
; 	
; }
L114:
	rts
L48:
	.byte 'I,32,'w,'i,'l,'l,32,'a,'v,'o,'i,'d,32,'i,'t,10
	.byte 10,0
