                         .module denisfin.c
 0000                   .dbfile denisfin.c
                         .area text
                       ;  IX -> 0,x
 0000                 _SCI_isr::
 0000                   .dbfile C:\ICCTK\include/isrtk.h
 0000                   .dbfunc SCI_isr
 0000                   .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
 0000                 L2:
 0000 3B                rti
                       ;  IX -> 0,x
 0001                 _SPI_isr::
 0001                   .dbfunc SPI_isr
 0001                   .dbline 46
                       ; 
                       ; #define BUMPER_FUZZY 10
                       ; #define NOSMOKE 40
                       ; #define IRTHRESHOLD 110
                       ; #define FIRE 50
                       ; #define DEFFIRE 55
 0001                 L3:
 0001 3B                rti
                       ;  IX -> 0,x
 0002                 _PAIE_isr::
 0002                   .dbfunc PAIE_isr
 0002                   .dbline 52
                       ;  
                       ; /************************ End of Constants ******************************/
                       ; int rspeed = 0;
                       ; int lspeed = 0;
                       ; int foundfire = 0;
                       ; unsigned int temp_one = 0;
 0002                 L4:
 0002 3B                rti
                       ;  IX -> 0,x
 0003                 _PAV_isr::
 0003                   .dbfunc PAV_isr
 0003                   .dbline 58
                       ; unsigned int temp_two = 0;
                       ; int hightemp = 0;
                       ; int fireheat = 0;
                       ; 
                       ; void detectsmoke(void);
                       ; void avoidobject(void);
 0003                 L5:
 0003 3B                rti
                       ;  IX -> 0,x
 0004                 _TOF_isr::
 0004                   .dbfunc TOF_isr
 0004                   .dbline 64
                       ; void righturn(void);
                       ; void lefturn(void);
                       ; void checkbump(void);
                       ; void firecheck(void);
                       ; void intiztemp(void);
                       ; void gettemp(void);
 0004                 L6:
 0004 3B                rti
                       ;  IX -> 0,x
 0005                 _TOC4_isr::
 0005                   .dbfunc TOC4_isr
 0005                   .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 */ 
 0005                 L7:
 0005 3B                rti
                       ;  IX -> 0,x
 0006                 _TOC1_isr::
 0006                   .dbfunc TOC1_isr
 0006                   .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");*/
                       ;   
 0006                 L8:
 0006 3B                rti
                       ;  IX -> 0,x
 0007                 _TIC3_isr::
 0007                   .dbfunc TIC3_isr
 0007                   .dbline 100
                       ;   while (rear_bumper() < BUMPER_FUZZY);
                       ;   
                       ;   read_IR();
                       ;   
                       ;     
                       ;   /*printf("starting to look for smoke\n\n");*/
 0007                 L9:
 0007 3B                rti
                       ;  IX -> 0,x
 0008                 _TIC2_isr::
 0008                   .dbfunc TIC2_isr
 0008                   .dbline 106
                       ;     
                       ;   
                       ;   
                       ;   detectsmoke();    /*checks to see if there is a fire*/
                       ;   intiztemp();      /*records the curent tempurature*/
                       ;   
 0008                 L10:
 0008 3B                rti
                       ;  IX -> 0,x
 0009                 _TIC1_isr::
 0009                   .dbfunc TIC1_isr
 0009                   .dbline 112
                       ;   rspeed = lspeed = 100;
                       ;   motortk(RIGHT_MOTOR, rspeed);
                       ;   motortk(LEFT_MOTOR, lspeed);
                       ;   
                       ;   /*printf("Will start to look for the fire\n\n");*/
                       ;     
 0009                 L11:
 0009 3B                rti
                       ;  IX -> 0,x
 000A                 _RTI_isr::
 000A                   .dbfunc RTI_isr
 000A                   .dbline 118
                       ;     wait(500);
                       ; 
                       ;   /*printf("Starting to avoid objects\n");*/
                       ;   
                       ;   avoidobject();
                       ;   
 000A                 L12:
 000A 3B                rti
                       ;  IX -> 0,x
 000B                 _IRQ_isr::
 000B                   .dbfunc IRQ_isr
 000B                   .dbline 124
                       ; 
                       ; }
                       ; 
                       ; /**************************** End of Main ******************************/
                       ; 
                       ; void detectsmoke(void)
 000B                 L13:
 000B 3B                rti
                       ;  IX -> 0,x
 000C                 _XIRQ_isr::
 000C                   .dbfunc XIRQ_isr
 000C                   .dbline 130
                       ; {
                       ;     read_IR();
                       ;     
                       ;     while (IRDT[IR5clk] < NOSMOKE)
                       ;         {
                       ;             read_IR();
 000C                 L14:
 000C 3B                rti
                       ;  IX -> 0,x
 000D                 _SWI_isr::
 000D                   .dbfunc SWI_isr
 000D                   .dbline 136
                       ;             wait(10);
                       ;         }
                       ;     /*printf("I have found smoke\n");*/
                       ; }
                       ; 
                       ; void avoidobject(void)
 000D                 L15:
 000D 3B                rti
                       ;  IX -> 0,x
 000E                 _ILLOP_isr::
 000E                   .dbfunc ILLOP_isr
 000E                   .dbline 142
                       ; {
                       ;     /*printf("Starting motors at full speed\n");*/
                       ;     
                       ;     
                       ;      
                       ;      while (1)
 000E                 L16:
 000E 3B                rti
                       ;  IX -> 0,x
 000F                 _COP_isr::
 000F                   .dbfunc COP_isr
 000F                   .dbline 148
                       ;      {
                       ;         checkbump();
                       ;         
                       ;                 
                       ;         read_IR();
                       ;         firecheck();
 000F                 L17:
 000F 3B                rti
                       ;  IX -> 0,x
 0010                 _CLMON_isr::
 0010                   .dbfunc CLMON_isr
 0010                   .dbline 154
                       ;         if (foundfire == 10)
                       ;         {
                       ;             rspeed = lspeed = 50;
                       ;             motortk(RIGHT_MOTOR, rspeed);
                       ;             motortk(LEFT_MOTOR, lspeed);
                       ;         }
 0010                 L18:
 0010 3B                rti
                         .area data
 0000                 _drew::
 0000                   .blkw 1
                         .area idata
 0000 0000              .word _interrupt_vectors
                         .area data
 0002                 _rspeed::
 0002                   .blkb 2
                         .area idata
 0002 0000              .word 0
                         .area data
 0004                 _lspeed::
 0004                   .blkb 2
                         .area idata
 0004 0000              .word 0
                         .area data
 0006                 _foundfire::
 0006                   .blkb 2
                         .area idata
 0006 0000              .word 0
                         .area data
 0008                 _temp_one::
 0008                   .blkb 2
                         .area idata
 0008 0000              .word 0
                         .area data
 000A                 _temp_two::
 000A                   .blkb 2
                         .area idata
 000A 0000              .word 0
                         .area data
 000C                 _hightemp::
 000C                   .blkb 2
                         .area idata
 000C 0000              .word 0
                         .area data
 000E                 _fireheat::
 000E                   .blkb 2
                         .area idata
 000E 0000              .word 0
                         .area text
 0011                 L20:
 0011 1B5B324A0400      .byte 27,91,50,'J,4,0
 0017                 L21:
 0017 1B5B313B314800    .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
 001E                 _main::
 001E BD0000            jsr __enterb
 0021 18                .byte 0x18
 0022                   .dbfile denisfin.c
 0022                   .dbfunc main
 0022                   .dbline 76
 0022 EC00              ldd 0,x
 0024 C30012            addd #18
 0027 18CE0011          ldy #L20
 002B 3C                pshx
 002C 8F                xgdx
 002D CC0006            ldd #6
 0030 BD0000            jsr __asgnblk
 0033 38                pulx
 0034                   .dbline 77
 0034 EC00              ldd 0,x
 0036 C3000B            addd #11
 0039 18CE0017          ldy #L21
 003D 3C                pshx
 003E 8F                xgdx
 003F CC0007            ldd #7
 0042 BD0000            jsr __asgnblk
 0045 38                pulx
 0046                   .dbline 80
 0046 BD0000            jsr _init_analog
 0049                   .dbline 81
 0049 BD0000            jsr _init_motortk
 004C                   .dbline 82
 004C BD0000            jsr _init_clocktk
 004F                   .dbline 83
 004F BD0000            jsr _init_serial
 0052                   .dbline 85
 0052 C6FF              ldab #255
 0054 F7FFB9            stab 0xffb9
 0057                   .dbline 87
 0057 CC0000            ldd #0
 005A FD0004            std _lspeed
 005D CC0000            ldd #0
 0060 FD0002            std _rspeed
 0063                   .dbline 88
 0063 FC0002            ldd _rspeed
 0066 37                pshb
 0067 36                psha
 0068 CC0001            ldd #1
 006B BD0000            jsr _motortk
 006E 1838              puly
 0070                   .dbline 89
 0070 FC0004            ldd _lspeed
 0073 37                pshb
 0074 36                psha
 0075 CC0000            ldd #0
 0078 BD0000            jsr _motortk
 007B 1838              puly
 007D                 L22:
 007D                   .dbline 95
 007D                 L23:
 007D BD0000            jsr _rear_bumper
 0080 1A83000A          cpd #10
 0084 25F7              blo L22
 0086                   .dbline 97
 0086 BD0000            jsr _read_IR
 0089                   .dbline 104
 0089 BD00C6            jsr _detectsmoke
 008C                   .dbline 105
 008C BD0284            jsr _intiztemp
 008F                   .dbline 107
 008F CC0064            ldd #100
 0092 FD0004            std _lspeed
 0095 CC0064            ldd #100
 0098 FD0002            std _rspeed
 009B                   .dbline 108
 009B FC0002            ldd _rspeed
 009E 37                pshb
 009F 36                psha
 00A0 CC0001            ldd #1
 00A3 BD0000            jsr _motortk
 00A6 1838              puly
 00A8                   .dbline 109
 00A8 FC0004            ldd _lspeed
 00AB 37                pshb
 00AC 36                psha
 00AD CC0000            ldd #0
 00B0 BD0000            jsr _motortk
 00B3 1838              puly
 00B5                   .dbline 113
 00B5 CC01F4            ldd #500
 00B8 BD0000            jsr _wait
 00BB                   .dbline 117
 00BB BD00DE            jsr _avoidobject
 00BE                   .dbline 120
 00BE                 L19:
 00BE 8F                xgdx
 00BF C30018            addd #24
 00C2 8F                xgdx
 00C3 35                txs
 00C4 38                pulx
 00C5 39                rts
                       ;  IX -> 0,x
 00C6                 _detectsmoke::
 00C6                   .dbfunc detectsmoke
 00C6                   .dbline 126
 00C6 BD0000            jsr _read_IR
 00C9 2009              bra L27
 00CB                 L26:
 00CB                   .dbline 130
 00CB BD0000            jsr _read_IR
 00CE                   .dbline 131
 00CE CC000A            ldd #10
 00D1 BD0000            jsr _wait
 00D4                   .dbline 132
 00D4                 L27:
 00D4                   .dbline 128
 00D4 FC0010            ldd _IRDT+16
 00D7 1A830028          cpd #40
 00DB 25EE              blo L26
 00DD                   .dbline 134
 00DD                 L25:
 00DD 39                rts
                       ;  IX -> 0,x
 00DE                 _avoidobject::
 00DE                   .dbfunc avoidobject
 00DE                   .dbline 137
 00DE 7E017F            jmp L32
 00E1                 L31:
 00E1                   .dbline 144
 00E1 BD0211            jsr _checkbump
 00E4                   .dbline 147
 00E4 BD0000            jsr _read_IR
 00E7                   .dbline 148
 00E7 BD02DC            jsr _firecheck
 00EA                   .dbline 149
 00EA FC0006            ldd _foundfire
 00ED 1A83000A          cpd #10
 00F1 262B              bne L37
 00F3                   .dbline 151
 00F3 CC0032            ldd #50
 00F6 FD0004            std _lspeed
 00F9 CC0032            ldd #50
 00FC FD0002            std _rspeed
 00FF                   .dbline 152
 00FF FC0002            ldd _rspeed
 0102 37                pshb
 0103 36                psha
 0104 CC0001            ldd #1
 0107 BD0000            jsr _motortk
 010A 1838              puly
 010C                   .dbline 153
 010C FC0004            ldd _lspeed
 010F 37                pshb
 0110 36                psha
 0111 CC0000            ldd #0
 0114 BD0000            jsr _motortk
 0117 1838              puly
 0119                   .dbline 154
 0119 2003              bra L37
 011B                 L36:
 011B                   .dbline 157
 011B BD0324            jsr _followfire
 011E                   .dbline 158
 011E                 L37:
 011E                   .dbline 155
                       ;         while (foundfire == 10)
 011E FC0006            ldd _foundfire
 0121 1A83000A          cpd #10
 0125 27F4              beq L36
 0127                   .dbline 161
                       ;         {
                       ;             followfire();
                       ;         }       
                       ;         
                       ;         
                       ;         rspeed = lspeed = 100;
 0127 CC0064            ldd #100
 012A FD0004            std _lspeed
 012D CC0064            ldd #100
 0130 FD0002            std _rspeed
 0133                   .dbline 162
                       ;         motortk(RIGHT_MOTOR, rspeed);
 0133 FC0002            ldd _rspeed
 0136 37                pshb
 0137 36                psha
 0138 CC0001            ldd #1
 013B BD0000            jsr _motortk
 013E 1838              puly
 0140                   .dbline 163
                       ;         motortk(LEFT_MOTOR, lspeed);
 0140 FC0004            ldd _lspeed
 0143 37                pshb
 0144 36                psha
 0145 CC0000            ldd #0
 0148 BD0000            jsr _motortk
 014B 1838              puly
 014D                   .dbline 165
                       ;         
                       ;         if ((IRDT[IR1clk] > IRTHRESHOLD) || (IRDT[IR2clk] > IRTHRESHOLD))
 014D FC0008            ldd _IRDT+8
 0150 1A83006E          cpd #110
 0154 2209              bhi L42
 0156 FC0000            ldd _IRDT
 0159 1A83006E          cpd #110
 015D 2305              bls L39
 015F                 L42:
 015F                   .dbline 169
                       ;             {
                       ;                 /*printf("Object to my right, so\n");
                       ;                 printf("I will avoid it\n\n");*/
                       ;                 righturn();             
 015F BD0183            jsr _righturn
 0162                   .dbline 170
                       ;             }
 0162 201B              bra L40
 0164                 L39:
 0164                   .dbline 172
                       ;         
                       ;          else if ((IRDT[IR4clk] > IRTHRESHOLD) || (IRDT[IR3clk] > IRTHRESHOLD))
 0164 FC000E            ldd _IRDT+14
 0167 1A83006E          cpd #110
 016B 2209              bhi L47
 016D FC000C            ldd _IRDT+12
 0170 1A83006E          cpd #110
 0174 2309              bls L43
 0176                 L47:
 0176                   .dbline 176
                       ;      
                       ;             {
                       ;                 /*printf("Object to my left, so\n");*/
                       ;                 printf("I will avoid it\n\n");
 0176 CC048B            ldd #L48
 0179 BD0000            jsr _printf
 017C                   .dbline 177
                       ;                 lefturn();  
 017C BD01CA            jsr _lefturn
 017F                   .dbline 178
                       ;             }
 017F                 L43:
 017F                 L40:
 017F                   .dbline 179
 017F                 L32:
 017F                   .dbline 142
 017F 7E00E1            jmp L31
 0182                 L30:
 0182 39                rts
                       ;  IX -> 0,x
 0183                 _righturn::
 0183                   .dbfunc righturn
 0183                   .dbline 185
                       ;      }
                       ; }
                       ; 
                       ; void righturn(void)
                       ; {
                       ;     /*printf("Turning right.\n");*/
                       ;     rspeed = -100;
 0183 CCFF9C            ldd #-100
 0186 FD0002            std _rspeed
 0189                   .dbline 186
                       ;     lspeed = 100;
 0189 CC0064            ldd #100
 018C FD0004            std _lspeed
 018F                   .dbline 187
                       ;     motortk(RIGHT_MOTOR, rspeed);
 018F FC0002            ldd _rspeed
 0192 37                pshb
 0193 36                psha
 0194 CC0001            ldd #1
 0197 BD0000            jsr _motortk
 019A 1838              puly
 019C                   .dbline 188
                       ;     motortk(LEFT_MOTOR, lspeed);
 019C FC0004            ldd _lspeed
 019F 37                pshb
 01A0 36                psha
 01A1 CC0000            ldd #0
 01A4 BD0000            jsr _motortk
 01A7 1838              puly
 01A9 2006              bra L51
 01AB                 L50:
 01AB                   .dbline 191
 01AB BD0000            jsr _read_IR
 01AE                   .dbline 192
 01AE BD02DC            jsr _firecheck
 01B1                   .dbline 193
 01B1                 L51:
 01B1                   .dbline 189
                       ;     while ((IRDT[IR1clk] > IRTHRESHOLD) || (IRDT[IR2clk] > IRTHRESHOLD))
 01B1 FC0008            ldd _IRDT+8
 01B4 1A83006E          cpd #110
 01B8 22F1              bhi L50
 01BA FC0000            ldd _IRDT
 01BD 1A83006E          cpd #110
 01C1 22E8              bhi L50
 01C3                   .dbline 194
                       ;     {
                       ;         read_IR();
                       ;         firecheck();
                       ;     }
                       ;     wait(300);
 01C3 CC012C            ldd #300
 01C6 BD0000            jsr _wait
 01C9                   .dbline 195
                       ; }
 01C9                 L49:
 01C9 39                rts
                       ;  IX -> 0,x
 01CA                 _lefturn::
 01CA                   .dbfunc lefturn
 01CA                   .dbline 200
                       ; 
                       ; void lefturn(void)
                       ; {
                       ;     /*printf("Turning left.\n");*/
                       ;     rspeed = 100;
 01CA CC0064            ldd #100
 01CD FD0002            std _rspeed
 01D0                   .dbline 201
                       ;     lspeed = -100;
 01D0 CCFF9C            ldd #-100
 01D3 FD0004            std _lspeed
 01D6                   .dbline 202
                       ;     motortk(RIGHT_MOTOR, rspeed);
 01D6 FC0002            ldd _rspeed
 01D9 37                pshb
 01DA 36                psha
 01DB CC0001            ldd #1
 01DE BD0000            jsr _motortk
 01E1 1838              puly
 01E3                   .dbline 203
                       ;     motortk(LEFT_MOTOR, lspeed);
 01E3 FC0004            ldd _lspeed
 01E6 37                pshb
 01E7 36                psha
 01E8 CC0000            ldd #0
 01EB BD0000            jsr _motortk
 01EE 1838              puly
 01F0 2006              bra L56
 01F2                 L55:
 01F2                   .dbline 206
 01F2 BD0000            jsr _read_IR
 01F5                   .dbline 207
 01F5 BD02DC            jsr _firecheck
 01F8                   .dbline 209
 01F8                 L56:
 01F8                   .dbline 204
                       ;     while ((IRDT[IR3clk] > IRTHRESHOLD) || (IRDT[IR4clk] > IRTHRESHOLD))
 01F8 FC000C            ldd _IRDT+12
 01FB 1A83006E          cpd #110
 01FF 22F1              bhi L55
 0201 FC000E            ldd _IRDT+14
 0204 1A83006E          cpd #110
 0208 22E8              bhi L55
 020A                   .dbline 210
                       ;     {
                       ;         read_IR();
                       ;         firecheck();
                       ;         
                       ;     }
                       ;     wait(300);
 020A CC012C            ldd #300
 020D BD0000            jsr _wait
 0210                   .dbline 212
                       ;     
                       ; }
 0210                 L54:
 0210 39                rts
                       ;  IX -> 0,x
 0211                 _checkbump::
 0211                   .dbfunc checkbump
 0211                   .dbline 216
                       ; 
                       ; void checkbump(void)
                       ; {
                       ;     if (rear_bumper() > BUMPER_FUZZY)
 0211 BD0000            jsr _rear_bumper
 0214 1A83000A          cpd #10
 0218 2331              bls L61
 021A                   .dbline 219
                       ;         {
                       ;             /*printf("You hit my ass\n\n");*/
                       ;             rspeed = lspeed = 50;
 021A CC0032            ldd #50
 021D FD0004            std _lspeed
 0220 CC0032            ldd #50
 0223 FD0002            std _rspeed
 0226                   .dbline 220
                       ;             motortk(RIGHT_MOTOR, rspeed);
 0226 FC0002            ldd _rspeed
 0229 37                pshb
 022A 36                psha
 022B CC0001            ldd #1
 022E BD0000            jsr _motortk
 0231 1838              puly
 0233                   .dbline 221
                       ;             motortk(LEFT_MOTOR, lspeed);
 0233 FC0004            ldd _lspeed
 0236 37                pshb
 0237 36                psha
 0238 CC0000            ldd #0
 023B BD0000            jsr _motortk
 023E 1838              puly
 0240                   .dbline 222
                       ;             wait(500);
 0240 CC01F4            ldd #500
 0243 BD0000            jsr _wait
 0246                   .dbline 223
                       ;             righturn();
 0246 BD0183            jsr _righturn
 0249                   .dbline 224
                       ;         }
 0249 2038              bra L62
 024B                 L61:
 024B                   .dbline 225
                       ;     else if (front_bumper() > BUMPER_FUZZY)
 024B BD0000            jsr _front_bumper
 024E 1A83000A          cpd #10
 0252 232F              bls L63
 0254                   .dbline 228
                       ;         {
                       ;             /*printf("You hit my head\n\n");*/
                       ;             rspeed = lspeed = -50;
 0254 CCFFCE            ldd #-50
 0257 FD0004            std _lspeed
 025A CCFFCE            ldd #-50
 025D FD0002            std _rspeed
 0260                   .dbline 229
                       ;             motortk(RIGHT_MOTOR, rspeed);
 0260 FC0002            ldd _rspeed
 0263 37                pshb
 0264 36                psha
 0265 CC0001            ldd #1
 0268 BD0000            jsr _motortk
 026B 1838              puly
 026D                   .dbline 230
                       ;             motortk(LEFT_MOTOR, lspeed);
 026D FC0004            ldd _lspeed
 0270 37                pshb
 0271 36                psha
 0272 CC0000            ldd #0
 0275 BD0000            jsr _motortk
 0278 1838              puly
 027A                   .dbline 231
                       ;             wait(500);
 027A CC01F4            ldd #500
 027D BD0000            jsr _wait
 0280                   .dbline 232
                       ;             righturn();
 0280 BD0183            jsr _righturn
 0283                   .dbline 233
                       ;         }
 0283                 L63:
 0283                 L62:
 0283                   .dbline 234
                       ; }
 0283                 L60:
 0283 39                rts
                       ;  IX -> 0,x
 0284                 _intiztemp::
 0284                   .dbfunc intiztemp
 0284                   .dbline 238
                       ; 
                       ; void intiztemp(void)
                       ; {
                       ;     read_IR();
 0284 BD0000            jsr _read_IR
 0287                   .dbline 239
                       ;     wait(100);
 0287 CC0064            ldd #100
 028A BD0000            jsr _wait
 028D                   .dbline 240
                       ;     temp_one = IRDT[IR8clk];
 028D FC0014            ldd _IRDT+20
 0290 FD0008            std _temp_one
 0293                   .dbline 241
                       ;     temp_two = IRDT[IR9clk];
 0293 FC0016            ldd _IRDT+22
 0296 FD000A            std _temp_two
 0299                   .dbline 242
                       ;     wait(100);
 0299 CC0064            ldd #100
 029C BD0000            jsr _wait
 029F                   .dbline 243
                       ;     read_IR();
 029F BD0000            jsr _read_IR
 02A2 2015              bra L69
 02A4                 L68:
 02A4                   .dbline 246
 02A4 BD0000            jsr _read_IR
 02A7                   .dbline 247
 02A7 FC0014            ldd _IRDT+20
 02AA FD0008            std _temp_one
 02AD                   .dbline 248
 02AD FC0016            ldd _IRDT+22
 02B0 FD000A            std _temp_two
 02B3                   .dbline 249
 02B3 CC0032            ldd #50
 02B6 BD0000            jsr _wait
 02B9                   .dbline 250
 02B9                 L69:
 02B9                   .dbline 244
                       ;     while ((IRDT[IR8clk] != temp_one) || (IRDT[IR9clk] != temp_two))
 02B9 FC0014            ldd _IRDT+20
 02BC 1AB30008          cpd _temp_one
 02C0 26E2              bne L68
 02C2 FC0016            ldd _IRDT+22
 02C5 1AB3000A          cpd _temp_two
 02C9 26D9              bne L68
 02CB                   .dbline 251
                       ;         {
                       ;             read_IR();
                       ;             temp_one = IRDT[IR8clk];
                       ;             temp_two = IRDT[IR9clk];
                       ;             wait(50);
                       ;         }
                       ; }
 02CB                 L65:
 02CB 39                rts
                       ;  IX -> 0,x
 02CC                 _gettemp::
 02CC                   .dbfunc gettemp
 02CC                   .dbline 254
                       ; void gettemp(void)
                       ; {
                       ;     read_IR();
 02CC BD0000            jsr _read_IR
 02CF                   .dbline 256
                       ;     
                       ;     temp_one = IRDT[IR8clk];
 02CF FC0014            ldd _IRDT+20
 02D2 FD0008            std _temp_one
 02D5                   .dbline 257
                       ;     temp_two = IRDT[IR9clk];
 02D5 FC0016            ldd _IRDT+22
 02D8 FD000A            std _temp_two
 02DB                   .dbline 258
                       ; }
 02DB                 L75:
 02DB 39                rts
                       ;  IX -> 0,x
 02DC                 _firecheck::
 02DC                   .dbfunc firecheck
 02DC                   .dbline 264
                       ; 
                       ; /*****************************FIRECODE******************/
                       ; 
                       ; void firecheck(void)
                       ; {
                       ;     read_IR();
 02DC BD0000            jsr _read_IR
 02DF                   .dbline 266
                       ;     
                       ;     if ((IRDT[IR6clk] > FIRE) || (IRDT[IR7clk] > FIRE))
 02DF FC000A            ldd _IRDT+10
 02E2 1A830032          cpd #50
 02E6 2209              bhi L83
 02E8 FC0012            ldd _IRDT+18
 02EB 1A830032          cpd #50
 02EF 2332              bls L79
 02F1                 L83:
 02F1                   .dbline 269
                       ;     {
                       ;         
                       ;         rspeed = lspeed = 0;
 02F1 CC0000            ldd #0
 02F4 FD0004            std _lspeed
 02F7 CC0000            ldd #0
 02FA FD0002            std _rspeed
 02FD                   .dbline 270
                       ;         motortk(RIGHT_MOTOR, rspeed);
 02FD FC0002            ldd _rspeed
 0300 37                pshb
 0301 36                psha
 0302 CC0001            ldd #1
 0305 BD0000            jsr _motortk
 0308 1838              puly
 030A                   .dbline 271
                       ;         motortk(LEFT_MOTOR, lspeed);
 030A FC0004            ldd _lspeed
 030D 37                pshb
 030E 36                psha
 030F CC0000            ldd #0
 0312 BD0000            jsr _motortk
 0315 1838              puly
 0317                   .dbline 272
                       ;         foundfire = 10; 
 0317 CC000A            ldd #10
 031A FD0006            std _foundfire
 031D                   .dbline 275
                       ;          /*printf("I have found fire\n\n");*/
                       ;          
                       ;          wait(1000);
 031D CC03E8            ldd #1000
 0320 BD0000            jsr _wait
 0323                   .dbline 276
                       ;     }
 0323                 L79:
 0323                   .dbline 278
                       ;     else 
                       ;         foundfire == 0;
 0323                 L80:
 0323                   .dbline 279
                       ; }
 0323                 L78:
 0323 39                rts
                       ;  IX -> 0,x
 0324                 _followfire::
 0324                   .dbfunc followfire
 0324                   .dbline 282
                       ; void followfire(void)
                       ; {
                       ;     gettemp();
 0324 BD02CC            jsr _gettemp
 0327                   .dbline 283
                       ;     firetemp();
 0327 BD0380            jsr _firetemp
 032A                   .dbline 284
                       ;     read_IR();
 032A BD0000            jsr _read_IR
 032D                   .dbline 286
                       ;     
                       ;     if ((IRDT[IR6clk] > FIRE) && (IRDT[IR7clk] > FIRE))
 032D FC000A            ldd _IRDT+10
 0330 1A830032          cpd #50
 0334 231D              bls L85
 0336 FC0012            ldd _IRDT+18
 0339 1A830032          cpd #50
 033D 2314              bls L85
 033F                   .dbline 288
                       ;     {   
                       ;         gettemp();              
 033F BD02CC            jsr _gettemp
 0342                   .dbline 289
                       ;         firetemp();
 0342 BD0380            jsr _firetemp
 0345                   .dbline 290
                       ;         if (fireheat < DEFFIRE)
 0345 FC000E            ldd _fireheat
 0348 1A830037          cpd #55
 034C 2C31              bge L86
 034E                   .dbline 292
                       ;         {
                       ;             fireforward();
 034E BD038A            jsr _fireforward
 0351                   .dbline 295
                       ;         }
                       ;         
                       ;     }
 0351 202C              bra L86
 0353                 L85:
 0353                   .dbline 296
                       ;     else if ((IRDT[IR6clk] > FIRE) && (IRDT[IR7clk] < FIRE))
 0353 FC000A            ldd _IRDT+10
 0356 1A830032          cpd #50
 035A 230E              bls L91
 035C FC0012            ldd _IRDT+18
 035F 1A830032          cpd #50
 0363 2405              bhs L91
 0365                   .dbline 298
                       ;         {
                       ;             fireright();
 0365 BD03F7            jsr _fireright
 0368                   .dbline 299
                       ;         }
 0368 2015              bra L92
 036A                 L91:
 036A                   .dbline 300
                       ;     else if ((IRDT[IR6clk] < FIRE) && (IRDT[IR7clk] > FIRE))
 036A FC000A            ldd _IRDT+10
 036D 1A830032          cpd #50
 0371 240C              bhs L95
 0373 FC0012            ldd _IRDT+18
 0376 1A830032          cpd #50
 037A 2303              bls L95
 037C                   .dbline 302
                       ;         {
                       ;             fireleft();
 037C BD0441            jsr _fireleft
 037F                   .dbline 303
                       ;         }
 037F                 L95:
 037F                 L92:
 037F                 L86:
 037F                   .dbline 304
                       ; }
 037F                 L84:
 037F 39                rts
                       ;  IX -> 0,x
 0380                 _firetemp::
 0380                   .dbfunc firetemp
 0380                   .dbline 307
                       ; void firetemp(void)
                       ; {
                       ;     read_IR();
 0380 BD0000            jsr _read_IR
 0383                   .dbline 308
                       ;     fireheat = IRDT[IR8clk];
 0383 FC0014            ldd _IRDT+20
 0386 FD000E            std _fireheat
 0389                   .dbline 309
                       ; }
 0389                 L99:
 0389 39                rts
                       ;  IX -> 0,x
 038A                 _fireforward::
 038A                   .dbfunc fireforward
 038A                   .dbline 313
                       ; 
                       ; void fireforward(void)
                       ; {
                       ;     rspeed = lspeed = 50;
 038A CC0032            ldd #50
 038D FD0004            std _lspeed
 0390 CC0032            ldd #50
 0393 FD0002            std _rspeed
 0396                   .dbline 314
                       ;     motortk(RIGHT_MOTOR, rspeed);
 0396 FC0002            ldd _rspeed
 0399 37                pshb
 039A 36                psha
 039B CC0001            ldd #1
 039E BD0000            jsr _motortk
 03A1 1838              puly
 03A3                   .dbline 315
                       ;     motortk(LEFT_MOTOR, lspeed);
 03A3 FC0004            ldd _lspeed
 03A6 37                pshb
 03A7 36                psha
 03A8 CC0000            ldd #0
 03AB BD0000            jsr _motortk
 03AE 1838              puly
 03B0                   .dbline 316
                       ;     read_IR();
 03B0 BD0000            jsr _read_IR
 03B3                   .dbline 317
                       ;     firetemp();
 03B3 BD0380            jsr _firetemp
 03B6 2006              bra L103
 03B8                 L102:
 03B8                   .dbline 320
 03B8 BD0000            jsr _read_IR
 03BB                   .dbline 321
 03BB BD0380            jsr _firetemp
 03BE                   .dbline 322
 03BE                 L103:
 03BE                   .dbline 318
                       ;     while (fireheat < DEFFIRE)  
 03BE FC000E            ldd _fireheat
 03C1 1A830037          cpd #55
 03C5 2DF1              blt L102
 03C7                   .dbline 323
                       ;     {
                       ;         read_IR();
                       ;         firetemp();
                       ;     }
                       ;     if (fireheat >= DEFFIRE)
 03C7 FC000E            ldd _fireheat
 03CA 1A830037          cpd #55
 03CE 2D26              blt L105
 03D0                   .dbline 325
                       ;     {
                       ;         rspeed = lspeed = 0;
 03D0 CC0000            ldd #0
 03D3 FD0004            std _lspeed
 03D6 CC0000            ldd #0
 03D9 FD0002            std _rspeed
 03DC                   .dbline 326
                       ;         motortk(RIGHT_MOTOR, rspeed);
 03DC FC0002            ldd _rspeed
 03DF 37                pshb
 03E0 36                psha
 03E1 CC0001            ldd #1
 03E4 BD0000            jsr _motortk
 03E7 1838              puly
 03E9                   .dbline 327
                       ;         motortk(LEFT_MOTOR, lspeed);
 03E9 FC0004            ldd _lspeed
 03EC 37                pshb
 03ED 36                psha
 03EE CC0000            ldd #0
 03F1 BD0000            jsr _motortk
 03F4 1838              puly
 03F6                   .dbline 328
                       ;     }
 03F6                 L105:
 03F6                   .dbline 329
                       ; }
 03F6                 L101:
 03F6 39                rts
                       ;  IX -> 0,x
 03F7                 _fireright::
 03F7                   .dbfunc fireright
 03F7                   .dbline 333
                       ; 
                       ; void fireright(void)
                       ; {
                       ;     rspeed = -40;
 03F7 CCFFD8            ldd #-40
 03FA FD0002            std _rspeed
 03FD                   .dbline 334
                       ;     lspeed = 40;
 03FD CC0028            ldd #40
 0400 FD0004            std _lspeed
 0403                   .dbline 335
                       ;     motortk(RIGHT_MOTOR, rspeed);
 0403 FC0002            ldd _rspeed
 0406 37                pshb
 0407 36                psha
 0408 CC0001            ldd #1
 040B BD0000            jsr _motortk
 040E 1838              puly
 0410                   .dbline 336
                       ;     motortk(LEFT_MOTOR, lspeed);
 0410 FC0004            ldd _lspeed
 0413 37                pshb
 0414 36                psha
 0415 CC0000            ldd #0
 0418 BD0000            jsr _motortk
 041B 1838              puly
 041D                   .dbline 337
                       ;     read_IR();
 041D BD0000            jsr _read_IR
 0420 2009              bra L109
 0422                 L108:
 0422                   .dbline 340
 0422 BD0000            jsr _read_IR
 0425                   .dbline 341
 0425 CC000A            ldd #10
 0428 BD0000            jsr _wait
 042B                   .dbline 342
 042B                 L109:
 042B                   .dbline 338
                       ;     while ((IRDT[IR6clk] > FIRE) && (IRDT[IR7clk] < FIRE))
 042B FC000A            ldd _IRDT+10
 042E 1A830032          cpd #50
 0432 2309              bls L113
 0434 FC0012            ldd _IRDT+18
 0437 1A830032          cpd #50
 043B 25E5              blo L108
 043D                 L113:
 043D                   .dbline 343
                       ;     {
                       ;         read_IR();
                       ;         wait(10);
                       ;     }
                       ;     fireforward();
 043D BD038A            jsr _fireforward
 0440                   .dbline 344
                       ; }
 0440                 L107:
 0440 39                rts
                       ;  IX -> 0,x
 0441                 _fireleft::
 0441                   .dbfunc fireleft
 0441                   .dbline 348
                       ; 
                       ; void fireleft(void)
                       ; {
                       ;     rspeed = 40;
 0441 CC0028            ldd #40
 0444 FD0002            std _rspeed
 0447                   .dbline 349
                       ;     lspeed = -40;
 0447 CCFFD8            ldd #-40
 044A FD0004            std _lspeed
 044D                   .dbline 350
                       ;     motortk(RIGHT_MOTOR, rspeed);
 044D FC0002            ldd _rspeed
 0450 37                pshb
 0451 36                psha
 0452 CC0001            ldd #1
 0455 BD0000            jsr _motortk
 0458 1838              puly
 045A                   .dbline 351
                       ;     motortk(LEFT_MOTOR, lspeed);
 045A FC0004            ldd _lspeed
 045D 37                pshb
 045E 36                psha
 045F CC0000            ldd #0
 0462 BD0000            jsr _motortk
 0465 1838              puly
 0467                   .dbline 352
                       ;     read_IR();
 0467 BD0000            jsr _read_IR
 046A 2009              bra L116
 046C                 L115:
 046C                   .dbline 355
 046C BD0000            jsr _read_IR
 046F                   .dbline 356
 046F CC000A            ldd #10
 0472 BD0000            jsr _wait
 0475                   .dbline 357
 0475                 L116:
 0475                   .dbline 353
                       ;     while ((IRDT[IR6clk] < FIRE) && (IRDT[IR7clk] > FIRE))
 0475 FC000A            ldd _IRDT+10
 0478 1A830032          cpd #50
 047C 2409              bhs L120
 047E FC0012            ldd _IRDT+18
 0481 1A830032          cpd #50
 0485 22E5              bhi L115
 0487                 L120:
 0487                   .dbline 358
                       ;     {
                       ;         read_IR();
                       ;         wait(10);
                       ;     }
                       ;     fireforward();
 0487 BD038A            jsr _fireforward
 048A                   .dbline 360
                       ;     
                       ; }
 048A                 L114:
 048A 39                rts
 048B                 L48:
 048B 492077696C6C2061766F69642069740A  .byte 'I,32,'w,'i,'l,'l,32,'a,'v,'o,'i,'d,32,'i,'t,10
 049B 0A00              .byte 10,0
