                         .module again.c
 0000                   .dbfile again.c
                         .area text
                       ;  IX -> 0,x
 0000                 _SCI_isr::
 0000                   .dbfile C:\ICCTJP\include/isrdecl.h
 0000                   .dbfunc SCI_isr
 0000                   .dbline 41
                       ; ///////////////////////////////////////////////////////////
                       ; //  Program:        again.c
                       ; //  Description:    Another test program
                       ; //  Programmer:     Scott Nortman
                       ; //  Date:           3/24/00
                       ; ///////////////////////////////////////////////////////////
                       ; 
                       ; /**************************** Constants *********************************/
                       ; #define pulse_handler TOC2_isr
                       ; #define TOLERANCE 10 
                       ; #define valve_sensor analog(1)
                       ; /**************************** End of Constants **************************/
                       ; 
                       ; /*************************** Interrupts *********************************/
                       ; #pragma interrupt_handler TOC2_isr, RTI_isr, TOF_isr;
                       ; /*************************** End of Interrupts **************************/
                       ; 
                       ; /************************** Includes ************************************/
                       ; #include <tjpbase.h>
                       ; #include <analog.h>
                       ; #include <vectors.h>
                       ; #include <mil.h>
                       ; #include <hc11.h>
                       ; /************************ End of includes *******************************/
                       ; /************************** Global Variables*****************************/
                       ; long duty_cycle;    //duty_cycle in e clocks
                       ; long period;        //period in e clocks
                       ; int desired;        
                       ; long count = 0; 
                       ; /************************ End of Global Variables ***********************/
                       ; 
                       ; /**************************** Main **************************************/
                       ; void main(void)
                       ; {
                       ;     
                       ;     /* VT100 clear screen */ 
                       ;     char clear[]= "\x1b\x5B\x32\x4A\x04"; 
                       ;     
                       ;     /* VT100 position cursor at (x,y) = (3,12) command is "\x1b[3;12H"*/
                       ;     char place[]= "\x1b[1;1H";  /*Home*/
                       ;  
 0000                 L2:
 0000 3B                rti
                       ;  IX -> 0,x
 0001                 _SPI_isr::
 0001                   .dbfunc SPI_isr
 0001                   .dbline 47
                       ;     //SET_BIT(TMSK2, 0x40);     //Enble RTI interrupt
                       ;     SET_BIT(TCTL1, 0x40);       //TOC2 toggle
                       ;     CLEAR_BIT(TCTL1, 0x80);     //Enable toggle on TOC2
                       ; 
                       ;     INTR_OFF();
                       ;     printf("%s", clear);  
 0001                 L3:
 0001 3B                rti
                       ;  IX -> 0,x
 0002                 _PAIE_isr::
 0002                   .dbfunc PAIE_isr
 0002                   .dbline 53
                       ;     printf("%s", place);
                       ;     printf("Enter the desired period in e clocks / 1000:\n");
                       ;     period = (read_int() * 1000);
                       ;     TOC2 = 0;
                       ;     desired = 150;
                       ;     INTR_ON();
 0002                 L4:
 0002 3B                rti
                       ;  IX -> 0,x
 0003                 _PAV_isr::
 0003                   .dbfunc PAV_isr
 0003                   .dbline 59
                       ;     
                       ;     while(1)
                       ;     {
                       ;         SET_BIT(TMSK1, 0x40);   //Enable TOC        
                       ;         if (desired < valve_sensor)
                       ;         {
 0003                 L5:
 0003 3B                rti
                       ;  IX -> 0,x
 0004                 _TOC3_isr::
 0004                   .dbfunc TOC3_isr
 0004                   .dbline 89
                       ;             CLEAR_BIT(PORTA, 0x20);
                       ;         }
                       ;         else if (desired > valve_sensor) 
                       ;         {
                       ;             SET_BIT(PORTA, 0x20);
                       ;         }
                       ;         else if ((desired <= valve_sensor + TOLERANCE) && (desired >= valve_sensor - TOLERANCE))
                       ;         {
                       ;             CLEAR_BIT(TMSK1, 0x40);     //Disable TOC2
                       ;         }
                       ;         
                       ;     }/*End While*/
                       ;     
                       ; }/*End Main*/
                       ; 
                       ; /**************************** End of Main *******************************/
                       ; void pulse_handler()
                       ; {
                       ;     TOC2 += (period / 2);       //Add period / 2
                       ;     CLEAR_FLAG(TFLG1, 0x40)     //Clear the interrupt flag
                       ; }
                       ; 
                       ; void RTI_isr(void)
                       ; {
                       ;     printf("%d\n", valve_sensor);
                       ;     count += 1;
                       ;     if (count >=500)
                       ;     {
                       ;         count = 0;
                       ;         if (desired == 150)
 0004                 L6:
 0004 3B                rti
                       ;  IX -> 0,x
 0005                 _TIC3_isr::
 0005                   .dbfunc TIC3_isr
 0005                   .dbline 101
                       ;         {
                       ;             desired = 100;
                       ;         }
                       ;         
                       ;         else if (desired == 100)
                       ;         {
                       ;             desired = 150;
                       ;         }
                       ;     }
                       ;     CLEAR_FLAG(TFLG2, 0x40);
                       ; }
                       ; 
 0005                 L7:
 0005 3B                rti
                       ;  IX -> 0,x
 0006                 _TIC2_isr::
 0006                   .dbfunc TIC2_isr
 0006                   .dbline 107
                       ; void TOF_isr(void)
                       ; {
                       ;     CLEAR_FLAG(TFLG1, 0x80);
                       ; }
                       ; }
                       ; }
 0006                 L8:
 0006 3B                rti
                       ;  IX -> 0,x
 0007                 _TIC1_isr::
 0007                   .dbfunc TIC1_isr
 0007                   .dbline 113
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
 0007                 L9:
 0007 3B                rti
                       ;  IX -> 0,x
 0008                 _IRQ_isr::
 0008                   .dbfunc IRQ_isr
 0008                   .dbline 125
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
 0008                 L10:
 0008 3B                rti
                       ;  IX -> 0,x
 0009                 _XIRQ_isr::
 0009                   .dbfunc XIRQ_isr
 0009                   .dbline 131
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
 0009                 L11:
 0009 3B                rti
                       ;  IX -> 0,x
 000A                 _SWI_isr::
 000A                   .dbfunc SWI_isr
 000A                   .dbline 137
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
 000A                 L12:
 000A 3B                rti
                       ;  IX -> 0,x
 000B                 _ILLOP_isr::
 000B                   .dbfunc ILLOP_isr
 000B                   .dbline 143
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
 000B                 L13:
 000B 3B                rti
                       ;  IX -> 0,x
 000C                 _COP_isr::
 000C                   .dbfunc COP_isr
 000C                   .dbline 149
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
 000C                 L14:
 000C 3B                rti
                       ;  IX -> 0,x
 000D                 _CLMON_isr::
 000D                   .dbfunc CLMON_isr
 000D                   .dbline 155
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
 000D                 L15:
 000D 3B                rti
                         .area data
 0000                 _drew::
 0000                   .blkw 1
                         .area idata
 0000 0000              .word _interrupt_vectors
                         .area data
 0002                 _count::
 0002                   .blkb 4
                         .area idata
 0002 00000000          .word 0,0
                         .area text
 000E                 L17:
 000E 1B5B324A0400      .byte 27,91,50,'J,4,0
 0014                 L18:
 0014 1B5B313B314800    .byte 27,91,49,59,49,'H,0
                       ;  lreg1 -> -4,x
                       ;  lreg2 -> -8,x
                       ;  IX -> 0,x
                       ;  rMEM -> 2,x
                       ;  func temp: 4,x - 10,x
                       ;          place -> 11,x
                       ;          clear -> 18,x
 001B                 _main::
 001B BD0000            jsr __enterb
 001E 98                .byte 0x98
 001F                   .dbfile again.c
 001F                   .dbfunc main
 001F                   .dbline 37
 001F EC00              ldd 0,x
 0021 C30012            addd #18
 0024 18CE000E          ldy #L17
 0028 3C                pshx
 0029 8F                xgdx
 002A CC0006            ldd #6
 002D BD0000            jsr __asgnblk
 0030 38                pulx
 0031                   .dbline 40
 0031 EC00              ldd 0,x
 0033 C3000B            addd #11
 0036 18CE0014          ldy #L18
 003A 3C                pshx
 003B 8F                xgdx
 003C CC0007            ldd #7
 003F BD0000            jsr __asgnblk
 0042 38                pulx
 0043                   .dbline 43
 0043 18CE1020          ldy #0x1020
 0047 181C0040          bset 0,y,#64
 004B                   .dbline 44
 004B 18CE1020          ldy #0x1020
 004F 181D0080          bclr 0,y,#0x80
 0053 0F                        sei
                       
 0054                   .dbline 47
 0054 EC00              ldd 0,x
 0056 C30012            addd #18
 0059 37                pshb
 005A 36                psha
 005B CC020C            ldd #L19
 005E BD0000            jsr _printf
 0061 1838              puly
 0063                   .dbline 48
 0063 EC00              ldd 0,x
 0065 C3000B            addd #11
 0068 37                pshb
 0069 36                psha
 006A CC020C            ldd #L19
 006D BD0000            jsr _printf
 0070 1838              puly
 0072                   .dbline 49
 0072 CC01DE            ldd #L20
 0075 BD0000            jsr _printf
 0078                   .dbline 50
 0078 BD0000            jsr _read_int
 007B ED04              std 4,x
 007D CC03E8            ldd #1000
 0080 1AEE04            ldy 4,x
 0083 BD0000            jsr __muli
 0086 BD0000            jsr __d2lreg
 0089 18CE0002          ldy #_period
 008D BD0000            jsr __lreg2y
 0090                   .dbline 51
 0090 CC0000            ldd #0
 0093 FD1018            std 0x1018
 0096                   .dbline 52
 0096 CC0096            ldd #150
 0099 FD0000            std _desired
 009C 0E                        cli
                       
 009D                   .dbline 53
 009D 206A              bra L22
 009F                 L21:
 009F                   .dbline 57
 009F 18CE1022          ldy #0x1022
 00A3 181C0040          bset 0,y,#64
 00A7                   .dbline 58
 00A7 CC0001            ldd #1
 00AA BD0000            jsr _analog
 00AD ED06              std 6,x
 00AF FC0000            ldd _desired
 00B2 1AA306            cpd 6,x
 00B5 2C0A              bge L24
 00B7                   .dbline 60
 00B7 18CE1000          ldy #0x1000
 00BB 181D0020          bclr 0,y,#0x20
 00BF                   .dbline 61
 00BF 2048              bra L25
 00C1                 L24:
 00C1                   .dbline 62
 00C1 CC0001            ldd #1
 00C4 BD0000            jsr _analog
 00C7 ED08              std 8,x
 00C9 FC0000            ldd _desired
 00CC 1AA308            cpd 8,x
 00CF 2F0A              ble L26
 00D1                   .dbline 64
 00D1 18CE1000          ldy #0x1000
 00D5 181C0020          bset 0,y,#32
 00D9                   .dbline 65
 00D9 202E              bra L27
 00DB                 L26:
 00DB                   .dbline 66
 00DB CC0001            ldd #1
 00DE BD0000            jsr _analog
 00E1 C3000A            addd #10
 00E4 ED02              std 2,x
 00E6 FC0000            ldd _desired
 00E9 1AA302            cpd 2,x
 00EC 2E1B              bgt L28
 00EE CC0001            ldd #1
 00F1 BD0000            jsr _analog
 00F4 83000A            subd #10
 00F7 ED02              std 2,x
 00F9 FC0000            ldd _desired
 00FC 1AA302            cpd 2,x
 00FF 2D08              blt L28
 0101                   .dbline 68
 0101 18CE1022          ldy #0x1022
 0105 181D0040          bclr 0,y,#0x40
 0109                   .dbline 69
 0109                 L28:
 0109                 L27:
 0109                 L25:
 0109                   .dbline 71
 0109                 L22:
 0109                   .dbline 55
 0109 2094              bra L21
 010B                 L16:
 010B 8F                xgdx
 010C C30018            addd #24
 010F 8F                xgdx
 0110 35                txs
 0111 38                pulx
 0112 39                rts
                       ;  lreg1 -> -4,x
                       ;  lreg2 -> -8,x
                       ;  IX -> 0,x
 0113                 _TOC2_isr::
 0113 BD0000            jsr __enterb
 0116 82                .byte 0x82
 0117                   .dbfunc TOC2_isr
 0117                   .dbline 78
 0117 18CE0002          ldy #_period
 011B BD0000            jsr __ly2reg
 011E 18CE01DA          ldy #L31
 0122 BD0000            jsr __ly2reg2
 0125 BD0000            jsr __ldiv
 0128 BD0000            jsr __lregmov
                         ; vol
 012B FC1018            ldd 0x1018
 012E BD0000            jsr __ud2lreg
 0131 BD0000            jsr __ladd
 0134 BD0000            jsr __lreg2d
 0137 FD1018            std 0x1018
 013A                   .dbline 79
 013A 18CE1023          ldy #0x1023
 013E 181D00BF          bclr 0,y,#0xbf
 0142                   .dbline 80
 0142                 L30:
 0142 08                inx
 0143 08                inx
 0144 35                txs
 0145 38                pulx
 0146 3B                rti
                       ;  lreg1 -> -4,x
                       ;  lreg2 -> -8,x
                       ;  IX -> 0,x
 0147                 _RTI_isr::
 0147 BD0000            jsr __enterb
 014A 82                .byte 0x82
 014B                   .dbfunc RTI_isr
 014B                   .dbline 84
 014B CC0001            ldd #1
 014E BD0000            jsr _analog
 0151 37                pshb
 0152 36                psha
 0153 CC01D6            ldd #L33
 0156 BD0000            jsr _printf
 0159 1838              puly
 015B                   .dbline 85
 015B 18CE0002          ldy #_count
 015F BD0000            jsr __ly2reg
 0162 18CE01D2          ldy #L34
 0166 BD0000            jsr __ly2reg2
 0169 BD0000            jsr __ladd
 016C 18CE0002          ldy #_count
 0170 BD0000            jsr __lreg2y
 0173                   .dbline 86
 0173 18CE0002          ldy #_count
 0177 BD0000            jsr __ly2reg
 017A 18CE01CE          ldy #L37
 017E BD0000            jsr __ly2reg2
 0181 BD0000            jsr __lcmp
 0184 2D2E              blt L35
 0186                   .dbline 88
 0186 18CE01CA          ldy #L38
 018A BD0000            jsr __ly2reg
 018D 18CE0002          ldy #_count
 0191 BD0000            jsr __lreg2y
 0194                   .dbline 89
 0194 FC0000            ldd _desired
 0197 1A830096          cpd #150
 019B 2608              bne L39
 019D                   .dbline 91
 019D CC0064            ldd #100
 01A0 FD0000            std _desired
 01A3                   .dbline 92
 01A3 200F              bra L40
 01A5                 L39:
 01A5                   .dbline 94
 01A5 FC0000            ldd _desired
 01A8 1A830064          cpd #100
 01AC 2606              bne L41
 01AE                   .dbline 96
 01AE CC0096            ldd #150
 01B1 FD0000            std _desired
 01B4                   .dbline 97
 01B4                 L41:
 01B4                 L40:
 01B4                   .dbline 98
 01B4                 L35:
 01B4                   .dbline 99
 01B4 18CE1025          ldy #0x1025
 01B8 181D00BF          bclr 0,y,#0xbf
 01BC                   .dbline 100
 01BC                 L32:
 01BC 08                inx
 01BD 08                inx
 01BE 35                txs
 01BF 38                pulx
 01C0 3B                rti
                       ;  IX -> 0,x
 01C1                 _TOF_isr::
 01C1                   .dbfunc TOF_isr
 01C1                   .dbline 104
 01C1 18CE1023          ldy #0x1023
 01C5 181D007F          bclr 0,y,#0x7f
 01C9                   .dbline 105
 01C9                 L43:
 01C9 3B                rti
                         .area bss
 0000                 _desired::
 0000                   .blkb 2
 0002                 _period::
 0002                   .blkb 4
 0006                 _duty_cycle::
 0006                   .blkb 4
 000A                 _timertjp::
 000A                   .blkb 2
 000C                 _days::
 000C                   .blkb 2
 000E                 _hours::
 000E                   .blkb 2
 0010                 _minutes::
 0010                   .blkb 2
 0012                 _seconds::
 0012                   .blkb 2
 0014                 _msec::
 0014                   .blkb 2
                         .area text
 01CA                 L38:
 01CA 00000000          .word 0,0
 01CE                 L37:
 01CE 000001F4          .word 0,500
 01D2                 L34:
 01D2 00000001          .word 0,1
 01D6                 L33:
 01D6 25640A00          .byte 37,'d,10,0
 01DA                 L31:
 01DA 00000002          .word 0,2
 01DE                 L20:
 01DE 456E7465722074686520646573697265  .byte 'E,'n,'t,'e,'r,32,'t,'h,'e,32,'d,'e,'s,'i,'r,'e
 01EE 6420706572696F6420696E206520636C  .byte 'd,32,'p,'e,'r,'i,'o,'d,32,'i,'n,32,'e,32,'c,'l
 01FE 6F636B73202F20313030303A0A00  .byte 'o,'c,'k,'s,32,47,32,49,48,48,48,58,10,0
 020C                 L19:
 020C 257300            .byte 37,'s,0
