                         .module weather.c
                         .area text
                       ;  IX -> 0,x
                       ;      semaphore -> +4,x
 0000                 _Wait::
 0000 37                pshb
 0001 36                psha
 0002 3C                pshx
 0003 3C                pshx
 0004 30                tsx
 0005 EF00              stx 0,x
                       ; /*
                       ; - weather.c
                       ; - Olamide Adabonyan / Philip Lechowicz
                       ; - o_mide@yahoo.com / phillech@aol.com
                       ; */
                       ; 
                       ; #include "hc11.h"
                       ; #include "vector.h"
                       ; #include "weather-sci.h"
 0007 0F                     sei
                       
 0008 2003              bra L4
 000A                 L3:
 000A 0E                     cli
 000B 01                 nop
 000C 0F                 sei
                       
 000D                 L4:
                       ; #include "weather-progs.h"
                       ; 
 000D 1AEE04            ldy 4,x
 0010 18EC00            ldd 0,y
 0013 2FF5              ble L3
                       ; #define stacksize 150
                       ; #define switchtime 40000
                       ; #define readtime 50000
                       ; 
                       ; int Wind_speed, Wind_direction, Temperature;
                       ; char count;
                       ; int displayFree;
 0015 1AEE04            ldy 4,x
 0018 18EC00            ldd 0,y
 001B 830001            subd #1
 001E 1AEE04            ldy 4,x
 0021 18ED00            std 0,y
                       ; 
 0024 0E                     cli
                       
                       ; //==========[.c file includes]=========================
 0025                 L2:
 0025 08                inx
 0026 08                inx
 0027 35                txs
 0028 38                pulx
 0029 1838              puly
 002B                   .dbline 0 ; func end
 002B 39                rts
                       ;  IX -> 0,x
                       ;      semaphore -> +4,x
 002C                 _Signal::
 002C 37                pshb
 002D 36                psha
 002E 3C                pshx
 002F 3C                pshx
 0030 30                tsx
 0031 EF00              stx 0,x
                       ; #include "weather-spin.c"       //semaphore file
                       ; #include "weather-threads.c"    //thread structure file
                       ; #include "weather-sci.c"        //SCI file
                       ; #include "weather-progs.c"      //programs file
 0033 0F                     sei
                       
                       ; //=====================================================
 0034 1AEE04            ldy 4,x
 0037 18EC00            ldd 0,y
 003A C30001            addd #1
 003D 1AEE04            ldy 4,x
 0040 18ED00            std 0,y
                       ; 
 0043 0E                     cli
                       
                       ; /*******************************************************
 0044                 L6:
 0044 08                inx
 0045 08                inx
 0046 35                txs
 0047 38                pulx
 0048 1838              puly
 004A                   .dbline 0 ; func end
 004A 39                rts
                         .area data
 0000                 _sys::
 0000                   .blkw 1
                         .area idata
 0000 00A4              .word _sys+164
                         .area data
 0002                   .blkw 1
                         .area idata
 0002 009A              .word _sys+5+149
                         .area data
 0004                   .blkb 1
                         .area idata
 0004 01                .byte 1
                         .area data
 0005                   .blkb 1
                         .area idata
 0005 00                .byte 0
                         .area data
 0006                   .blkb 149
                         .area idata
 0006 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000   .word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 0042 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000   .word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 007E 00000000000000000000   .word 0,0,0,0,0
 0088 00000000000000000000   .word 0,0,0,0,0
 0092 000000000000000000     .byte 0,0,0,0,0,0,0,0,0
                         .area data
 009B                   .blkb 1
                         .area idata
 009B 40                .byte 64
                         .area data
 009C                   .blkb 1
                         .area idata
 009C 00                .byte 0
                         .area data
 009D                   .blkb 1
                         .area idata
 009D 00                .byte 0
                         .area data
 009E                   .blkb 2
                         .area idata
 009E 0000              .word 0
                         .area data
 00A0                   .blkb 2
                         .area idata
 00A0 0000              .word 0
                         .area data
 00A2                   .blkw 1
                         .area idata
 00A2 027B              .word _DispWeather
                         .area data
 00A4                   .blkw 1
                         .area idata
 00A4 0000              .word _sys
                         .area data
 00A6                   .blkw 1
                         .area idata
 00A6 013E              .word _sys+164+5+149
                         .area data
 00A8                   .blkb 1
                         .area idata
 00A8 02                .byte 2
                         .area data
 00A9                   .blkb 1
                         .area idata
 00A9 00                .byte 0
                         .area data
 00AA                   .blkb 149
                         .area idata
 00AA 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000   .word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 00E6 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000   .word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 0122 00000000000000000000   .word 0,0,0,0,0
 012C 00000000000000000000   .word 0,0,0,0,0
 0136 000000000000000000     .byte 0,0,0,0,0,0,0,0,0
                         .area data
 013F                   .blkb 1
                         .area idata
 013F 40                .byte 64
                         .area data
 0140                   .blkb 1
                         .area idata
 0140 00                .byte 0
                         .area data
 0141                   .blkb 1
                         .area idata
 0141 00                .byte 0
                         .area data
 0142                   .blkb 2
                         .area idata
 0142 0000              .word 0
                         .area data
 0144                   .blkb 2
                         .area idata
 0144 0000              .word 0
                         .area data
 0146                   .blkw 1
                         .area idata
 0146 030D              .word _DispWindDir
                         .area data
                         .area text
 004B                 _InChar::
 004B                 L14:
 004B                 L15:
 004B 18CE102E          ldy #0x102e
 004F 181F0020F7        brclr 0,y,#32,L14
                         ; vol
 0054 F6102F            ldab 0x102f
 0057 4F                clra
 0058                 L13:
 0058                   .dbline 0 ; func end
 0058 39                rts
                       ;  IX -> 0,x
                       ;           data -> +5,x
 0059                 _OutChar::
 0059 37                pshb
 005A 36                psha
 005B 3C                pshx
 005C 3C                pshx
 005D 30                tsx
 005E EF00              stx 0,x
 0060                 L18:
 0060                 L19:
 0060 18CE102E          ldy #0x102e
 0064 181F0080F7        brclr 0,y,#128,L18
 0069 E605              ldab 5,x
 006B F7102F            stab 0x102f
 006E                 L17:
 006E 08                inx
 006F 08                inx
 0070 35                txs
 0071 38                pulx
 0072 1838              puly
 0074                   .dbline 0 ; func end
 0074 39                rts
 0075                 _InStatus::
                       ; Name: ThreadSwitcher
                       ; Purpose: - Switch threads in a round-robin manner
                       ; Inputs: none
                       ; Outputs: none
                       ; ********************************************************/
                       ; #pragma interrupt_handler ThreadSwitcher()
                         ; vol
 0075 F6102E            ldab 0x102e
 0078 C420              andb #32
 007A 4F                clra
 007B                 L21:
 007B                   .dbline 0 ; func end
 007B 39                rts
 007C                 _OutStatus::
                       ; void ThreadSwitcher()
                       ; {
                       ;     //OutString("switch...");   //debugger
                       ;     INTR_OFF();           //disable interrupts
                       ;     asm(" ldx _RunPt\n"
                       ;         " sts 2,x");
                       ;     
                       ;     RunPt = RunPt->Next;
                       ;     
                         ; vol
 007C F6102E            ldab 0x102e
 007F C480              andb #128
 0081 4F                clra
 0082                 L22:
 0082                   .dbline 0 ; func end
 0082 39                rts
                       ;  IX -> 0,x
                       ;         number -> +4,x
 0083                 _OutUDec::
 0083 37                pshb
 0084 36                psha
 0085 3C                pshx
 0086 3C                pshx
 0087 30                tsx
 0088 EF00              stx 0,x
                       ;     asm(" ldx _RunPt\n"
                       ;         " lds 2,x");
                       ;     
                       ;     TOC1 = TCNT + switchtime;   //Reschedule Thread Swithcher(e.g. will run for 10ms if switchtime is 20000)
                       ;     TFLG1 = 0x80;
                       ;     INTR_ON();             //enable interrupts 
                       ; }
                       ; 
                       ; 
                       ; 
                       ; /*******************************************************
                       ; Name: AtoD
 008A EC04              ldd 4,x
 008C 1A83000A          cpd #10
 0090 251A              blo L24
                       ; Purpose: - To read in Voltages of weather signals and 
                       ; store them in global variables.
 0092 EC04              ldd 4,x
 0094 18CE000A          ldy #10
 0098 BD0000            jsr __divu
 009B BD0083            jsr _OutUDec
                       ; Inputs: none
 009E EC04              ldd 4,x
 00A0 18CE000A          ldy #10
 00A4 BD0000            jsr __modu
 00A7 BD0083            jsr _OutUDec
                       ; Outputs: none
 00AA 2009              bra L25
 00AC                 L24:
                       ; ********************************************************/
                       ; #pragma interrupt_handler AtoD()
 00AC EC04              ldd 4,x
 00AE C30030            addd #48
 00B1 4F                clra
 00B2 BD0059            jsr _OutChar
 00B5                 L25:
                       ; void AtoD(void)
 00B5                 L23:
 00B5 08                inx
 00B6 08                inx
 00B7 35                txs
 00B8 38                pulx
 00B9 1838              puly
 00BB                   .dbline 0 ; func end
 00BB 39                rts
                       ;  IX -> 0,x
                       ;          ?temp -> +2,x
                       ;          ?temp -> +3,x
                       ;         letter -> +5,x
                       ;             pt -> +8,x
 00BC                 _OutString::
 00BC BD0000            jsr __enterb
 00BF 46                .byte 0x46
                       ; {
                       ;     INTR_OFF();           //disable interrupts
                       ;     count = count + 1;
                       ; 
                       ;     if (count == 4)
                       ;     {
                       ;         Wind_speed = ADR1;
 00C0 2006              bra L28
 00C2                 L27:
 00C2 E605              ldab 5,x
 00C4 4F                clra
 00C5 BD0059            jsr _OutChar
 00C8                 L28:
                       ;         Wind_direction = ADR2;
                       ;         Temperature = ADR3;
 00C8 EC08              ldd 8,x
 00CA ED03              std 3,x
 00CC C30001            addd #1
 00CF ED08              std 8,x
 00D1 1AEE03            ldy 3,x
 00D4 18E600            ldab 0,y
 00D7 E702              stab 2,x
 00D9 E705              stab 5,x
 00DB 6D02              tst 2,x
 00DD 26E3              bne L27
                       ;         count = 0;
                       ;     }
 00DF                 L26:
 00DF 8F                xgdx
 00E0 C30006            addd #6
 00E3 8F                xgdx
 00E4 35                txs
 00E5 38                pulx
 00E6 1838              puly
 00E8                   .dbline 0 ; func end
 00E8 39                rts
                       ;  IX -> 0,x
                       ;  rMEM -> 2,x
                       ;           test -> +5,x
                       ;          dummy -> +12,x
                       ;              x -> +13,x
                       ;           temp -> +5,x
                       ;          dummy -> +12,x
                       ;              x -> +13,x
                       ;         wSpeed -> +5,x
                       ;          dummy -> +12,x
                       ;              x -> +13,x
                       ;     wDirection -> +5,x
                       ;          dummy -> +12,x
                       ;              x -> +13,x
                       ;    clearScreen -> +8,x
                       ;          dummy -> +12,x
                       ;              x -> +13,x
                       ;              i -> +17,x
 00E9                 _EscapeSequence::
 00E9 BD0000            jsr __enterb
 00EC 4E                .byte 0x4e
 00ED E611              ldab 17,x
 00EF C101              cmpb #1
 00F1 2640              bne L31
 00F3 C61B              ldab #27
 00F5 E708              stab 8,x
 00F7 C65B              ldab #91
 00F9 E709              stab 9,x
 00FB C632              ldab #50
 00FD E70A              stab 10,x
 00FF C64A              ldab #74
 0101 E70B              stab 11,x
 0103 C604              ldab #4
 0105 E70C              stab 12,x
 0107 6F0D              clr 13,x
 0109 201F              bra L38
 010B                 L37:
 010B EC00              ldd 0,x
 010D C30008            addd #8
 0110 ED02              std 2,x
 0112 E60D              ldab 13,x
 0114 4F                clra
 0115 E302              addd 2,x
 0117 188F              xgdy
 0119 18E600            ldab 0,y
 011C E70C              stab 12,x
 011E E60C              ldab 12,x
 0120 4F                clra
 0121 BD0059            jsr _OutChar
 0124 E60D              ldab 13,x
 0126 CB01              addb #1
 0128 E70D              stab 13,x
 012A                 L38:
 012A E60D              ldab 13,x
 012C C104              cmpb #4
 012E 25DB              blo L37
 0130 7E0271            jmp L32
 0133                 L31:
 0133 E611              ldab 17,x
 0135 C102              cmpb #2
 0137 264C              bne L40
 0139 C61B              ldab #27
 013B E705              stab 5,x
 013D C65B              ldab #91
 013F E706              stab 6,x
 0141 C633              ldab #51
 0143 E707              stab 7,x
 0145 C63B              ldab #59
 0147 E708              stab 8,x
 0149 C633              ldab #51
 014B E709              stab 9,x
 014D C634              ldab #52
 014F E70A              stab 10,x
 0151 C648              ldab #72
 0153 E70B              stab 11,x
 0155 C604              ldab #4
 0157 E70C              stab 12,x
 0159 6F0D              clr 13,x
 015B 201F              bra L50
 015D                 L49:
 015D EC00              ldd 0,x
 015F C30005            addd #5
 0162 ED02              std 2,x
 0164 E60D              ldab 13,x
 0166 4F                clra
 0167 E302              addd 2,x
 0169 188F              xgdy
 016B 18E600            ldab 0,y
 016E E70C              stab 12,x
 0170 E60C              ldab 12,x
 0172 4F                clra
 0173 BD0059            jsr _OutChar
 0176 E60D              ldab 13,x
 0178 CB01              addb #1
 017A E70D              stab 13,x
 017C                 L50:
 017C E60D              ldab 13,x
 017E C107              cmpb #7
 0180 25DB              blo L49
 0182 7E0271            jmp L41
 0185                 L40:
 0185 E611              ldab 17,x
 0187 C103              cmpb #3
 0189 264C              bne L52
 018B C61B              ldab #27
 018D E705              stab 5,x
 018F C65B              ldab #91
 0191 E706              stab 6,x
 0193 C635              ldab #53
 0195 E707              stab 7,x
 0197 C63B              ldab #59
 0199 E708              stab 8,x
 019B C632              ldab #50
 019D E709              stab 9,x
 019F C639              ldab #57
 01A1 E70A              stab 10,x
 01A3 C648              ldab #72
 01A5 E70B              stab 11,x
 01A7 C604              ldab #4
 01A9 E70C              stab 12,x
 01AB 6F0D              clr 13,x
 01AD 201F              bra L62
 01AF                 L61:
 01AF EC00              ldd 0,x
 01B1 C30005            addd #5
 01B4 ED02              std 2,x
 01B6 E60D              ldab 13,x
 01B8 4F                clra
 01B9 E302              addd 2,x
 01BB 188F              xgdy
 01BD 18E600            ldab 0,y
 01C0 E70C              stab 12,x
 01C2 E60C              ldab 12,x
 01C4 4F                clra
 01C5 BD0059            jsr _OutChar
 01C8 E60D              ldab 13,x
 01CA CB01              addb #1
 01CC E70D              stab 13,x
 01CE                 L62:
                       ; 
                       ;     TOC2 = TCNT + readtime;  
 01CE E60D              ldab 13,x
 01D0 C107              cmpb #7
 01D2 25DB              blo L61
                       ;     TFLG1 = 0x40;
                       ;     INTR_ON();             //enable interrupts 
                       ; }
                       ; 
                       ; 
                       ; 
 01D4 7E0271            jmp L53
 01D7                 L52:
                       ; /*******************************************************
                       ; Name: Main
 01D7 E611              ldab 17,x
 01D9 C104              cmpb #4
 01DB 264B              bne L64
                       ; Purpose: - Initialize weather station
                       ;          - Hand control over to Thread Switcher ISR
                       ; Inputs: none
 01DD C61B              ldab #27
 01DF E705              stab 5,x
                       ; Outputs: none
 01E1 C65B              ldab #91
 01E3 E706              stab 6,x
                       ; ********************************************************/
 01E5 C637              ldab #55
 01E7 E707              stab 7,x
                       ; main()
 01E9 C63B              ldab #59
 01EB E708              stab 8,x
                       ; {
 01ED C632              ldab #50
 01EF E709              stab 9,x
                       ;     unsigned char i, dummy;
 01F1 C639              ldab #57
 01F3 E70A              stab 10,x
                       ;     int temp;
 01F5 C648              ldab #72
 01F7 E70B              stab 11,x
                       ; 
 01F9 C604              ldab #4
 01FB E70C              stab 12,x
                       ;     INTR_OFF();                 //disable interrupts
 01FD 6F0D              clr 13,x
 01FF 201F              bra L74
 0201                 L73:
 0201 EC00              ldd 0,x
 0203 C30005            addd #5
 0206 ED02              std 2,x
 0208 E60D              ldab 13,x
 020A 4F                clra
 020B E302              addd 2,x
 020D 188F              xgdy
 020F 18E600            ldab 0,y
 0212 E70C              stab 12,x
 0214 E60C              ldab 12,x
 0216 4F                clra
 0217 BD0059            jsr _OutChar
 021A E60D              ldab 13,x
 021C CB01              addb #1
 021E E70D              stab 13,x
 0220                 L74:
                       ; 
                       ;     //init vars
 0220 E60D              ldab 13,x
 0222 C107              cmpb #7
 0224 25DB              blo L73
                       ;     Wind_speed=0;
                       ;     Wind_direction=0;
                       ;     Temperature=0;
                       ;     count = 0;
                       ; 
                       ;     EscapeSequence(1);
 0226 2049              bra L65
 0228                 L64:
                       ;     OutString(".:[ WEATHER STATION ]:.\n\r");
                       ;     OutString("=======================\n\r\n\r");
                       ; 
                       ;     //I/O config...
                       ;     OutString("Initializing I/O...\n\r");
 0228 C61B              ldab #27
 022A E705              stab 5,x
                       ;     SCCR1=0;
 022C C65B              ldab #91
 022E E706              stab 6,x
                       ;     SCCR2=0x0c;                 //enable SCI
 0230 C631              ldab #49
 0232 E707              stab 7,x
                       ;     setbaud(BAUD9600);          //set baud rate to 9600
 0234 C635              ldab #53
 0236 E708              stab 8,x
                       ;     PORTA = 0;  
 0238 C63B              ldab #59
 023A E709              stab 9,x
                       ;     DDRD = 0x3C;
 023C C632              ldab #50
 023E E70A              stab 10,x
                       ;     PACTL = 0x88;
 0240 C648              ldab #72
 0242 E70B              stab 11,x
                       ; 
 0244 C604              ldab #4
 0246 E70C              stab 12,x
                       ;     //OC1, OC2 config...
 0248 6F0D              clr 13,x
 024A 201F              bra L84
 024C                 L83:
 024C EC00              ldd 0,x
 024E C30005            addd #5
 0251 ED02              std 2,x
 0253 E60D              ldab 13,x
 0255 4F                clra
 0256 E302              addd 2,x
 0258 188F              xgdy
 025A 18E600            ldab 0,y
 025D E70C              stab 12,x
 025F E60C              ldab 12,x
 0261 4F                clra
 0262 BD0059            jsr _OutChar
 0265 E60D              ldab 13,x
 0267 CB01              addb #1
 0269 E70D              stab 13,x
 026B                 L84:
                       ;     OutString("Initializing OCn Interrupts...\n\r");
                       ;     TOC1vector = &ThreadSwitcher;
 026B E60D              ldab 13,x
 026D C107              cmpb #7
 026F 25DB              blo L83
                       ;     TOC2vector = &AtoD;
                       ;     TMSK1 = 0xC0;
                       ;     TFLG1 = 0xC0;
                       ;     TOC1 = TCNT + (65000);
                       ;     TOC2 = TCNT + 40000;
                       ;     
 0271                 L65:
 0271                 L53:
 0271                 L41:
 0271                 L32:
                       ;     //A/D Initialization...
 0271                 L30:
 0271 8F                xgdx
 0272 C3000E            addd #14
 0275 8F                xgdx
 0276 35                txs
 0277 38                pulx
 0278 1838              puly
 027A                   .dbline 0 ; func end
 027A 39                rts
                       ;  IX -> 0,x
                       ;           temp -> +2,x
                       ;    temperature -> +4,x
                       ;     wDirection -> +6,x
                       ;         wSpeed -> +8,x
 027B                 _DispWeather::
 027B BD0000            jsr __enterb
 027E 0A                .byte 0xa
                       ;     OutString("Initializing A/D...\n\r");
                       ;     OPTION = (OPTION | 0xC0);   //Power up A/D, set csel
                       ;     for (i=0; i<200; i++)       //Delay 100 us
                       ;         dummy = i;
                       ;     ADCTL = 0x30;  //set scan =1, mult=1, and cd=0, cc=0
                       ; 
                       ;     //Thread & Semaphore config...
                       ;     OutString("Initializing Threads & Semaphore...\n\r");
                       ;     displayFree = 1;
                       ;     RunPt=&sys[0];              //Specify first thread to run
 027F 7E0302            jmp L88
 0282                 L87:
 0282 0F                    sei
                       
 0283 CC0046            ldd #70
 0286 18FE0009          ldy _Wind_speed
 028A BD0000            jsr __muli
 028D 18CE00FF          ldy #255
 0291 BD0000            jsr __divi
 0294 ED08              std 8,x
 0296 CC005A            ldd #90
 0299 18FE0007          ldy _Wind_direction
 029D BD0000            jsr __muli
 02A0 ED02              std 2,x
 02A2 EC02              ldd 2,x
 02A4 18CE00FF          ldy #255
 02A8 BD0000            jsr __divi
 02AB 05                lsld
 02AC 05                lsld
 02AD ED06              std 6,x
 02AF CC0064            ldd #100
 02B2 18FE0005          ldy _Temperature
 02B6 BD0000            jsr __muli
 02B9 18CE00FF          ldy #255
 02BD BD0000            jsr __divi
 02C0 ED04              std 4,x
 02C2 CC0002            ldd #_displayFree
 02C5 BD0000            jsr _Wait
 02C8 CC0002            ldd #2
 02CB BD00E9            jsr _EscapeSequence
 02CE EC06              ldd 6,x
 02D0 BD0083            jsr _OutUDec
 02D3 CC0778            ldd #L90
 02D6 BD00BC            jsr _OutString
 02D9 CC0003            ldd #3
 02DC BD00E9            jsr _EscapeSequence
 02DF EC08              ldd 8,x
 02E1 BD0083            jsr _OutUDec
 02E4 CC0770            ldd #L91
 02E7 BD00BC            jsr _OutString
 02EA CC0004            ldd #4
 02ED BD00E9            jsr _EscapeSequence
 02F0 EC04              ldd 4,x
 02F2 BD0083            jsr _OutUDec
 02F5 CC0760            ldd #L92
 02F8 BD00BC            jsr _OutString
 02FB CC0002            ldd #_displayFree
 02FE BD002C            jsr _Signal
 0301 0E                    cli
                       
 0302                 L88:
                       ;     asm("  ldx _RunPt\n"
                       ;         "  lds 2,x\n");
                       ;     OutString("\n\r::[System Initialization Complete]::\n\r\n\r");
 0302 7E0282            jmp L87
 0305                 X0:
                       ; 
                       ;     for(temp=0; temp<60000; temp++) //delay (so above initialization messages can be seen)
                       ;         temp++;
                       ;     for(temp=0; temp<60000; temp++) //delay (so above initialization messages can be seen)
                       ;         temp++;
                       ; 
                       ;     EscapeSequence(1);          //clears screen
                       ;     //Display weather station readings
                       ;     OutString("WELCOME TO WEATHER STATION...\n\r\n\r");
                       ;     OutString("The Current Wind Direction is: \n\r\n\r");
                       ;     OutString("The Current Wind Speed is: \n\r\n\r");
                       ;     OutString("The Current Temperature is: ");
                       ; 
                       ;     INTR_ON();                  //enable interrupts
                       ;     asm("rti");
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
 0305                 L86:
 0305 8F                xgdx
 0306 C3000A            addd #10
 0309 8F                xgdx
 030A 35                txs
 030B 38                pulx
 030C                   .dbline 0 ; func end
 030C 39                rts
                       ;  IX -> 0,x
                       ;          ?temp -> +2,x
                       ;          ?temp -> +4,x
 030D                 _DispWindDir::
 030D BD0000            jsr __enterb
 0310 06                .byte 0x6
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
                       ; }
 0311 7E0481            jmp L95
 0314                 L94:
                       ; }
                       ; }
                       ; }
                       ; }
 0314 FC0009            ldd _Wind_speed
 0317 1A830003          cpd #3
 031B 2E10              bgt L97
                       ; }
                       ; }
 031D C680              ldab #128
 031F F71000            stab 0x1000
                       ; }
 0322 18CE1008          ldy #0x1008
 0326 181D003C          bclr 0,y,#0x3c
                       ; }
 032A 7E0481            jmp L98
 032D                 L97:
                       ; }
                       ; }
 032D FC0007            ldd _Wind_direction
 0330 2D4F              blt L99
 0332 FC0007            ldd _Wind_direction
 0335 1A830010          cpd #16
 0339 2C07              bge L103
 033B CC0001            ldd #1
 033E ED04              std 4,x
 0340 2005              bra L104
 0342                 L103:
 0342 CC0000            ldd #0
 0345 ED04              std 4,x
 0347                 L104:
 0347 FC0007            ldd _Wind_direction
 034A 1A8300F0          cpd #240
 034E 2D07              blt L105
 0350 CC0001            ldd #1
 0353 ED02              std 2,x
 0355 2005              bra L106
 0357                 L105:
 0357 CC0000            ldd #0
 035A ED02              std 2,x
 035C                 L106:
 035C EC04              ldd 4,x
 035E AA02              oraa 2,x
 0360 EA03              orab 3,x
 0362 1A830000          cpd #0
 0366 2719              beq L99
 0368 FC0007            ldd _Wind_direction
 036B 1A8300FF          cpd #255
 036F 2E10              bgt L99
                       ; }
                       ; }
 0371 C640              ldab #64
 0373 F71000            stab 0x1000
                       ; }
 0376 18CE1008          ldy #0x1008
 037A 181D003C          bclr 0,y,#0x3c
                       ; }
 037E 7E0481            jmp L100
 0381                 L99:
                       ; }
                       ; }
 0381 FC0007            ldd _Wind_direction
 0384 1A830010          cpd #16
 0388 2D19              blt L107
 038A FC0007            ldd _Wind_direction
 038D 1A830030          cpd #48
 0391 2C10              bge L107
                       ; }
                       ; }
 0393 C620              ldab #32
 0395 F71000            stab 0x1000
                       ; }
 0398 18CE1008          ldy #0x1008
 039C 181D003C          bclr 0,y,#0x3c
                       ; }
 03A0 7E0481            jmp L108
 03A3                 L107:
                       ; }
                       ; }
                       ; }
 03A3 FC0007            ldd _Wind_direction
 03A6 1A830030          cpd #48
 03AA 2D19              blt L109
 03AC FC0007            ldd _Wind_direction
 03AF 1A830050          cpd #80
 03B3 2C10              bge L109
                       ; }
                       ; }
 03B5 C610              ldab #16
 03B7 F71000            stab 0x1000
                       ; }
 03BA 18CE1008          ldy #0x1008
 03BE 181D003C          bclr 0,y,#0x3c
                       ; }
 03C2 7E0481            jmp L110
 03C5                 L109:
                       ; }
                       ; }
 03C5 FC0007            ldd _Wind_direction
 03C8 1A830050          cpd #80
 03CC 2D19              blt L111
 03CE FC0007            ldd _Wind_direction
 03D1 1A830070          cpd #112
 03D5 2C10              bge L111
                       ; }
                       ; }
 03D7 C608              ldab #8
 03D9 F71000            stab 0x1000
                       ; }
 03DC 18CE1008          ldy #0x1008
 03E0 181D003C          bclr 0,y,#0x3c
                       ; }
 03E4 7E0481            jmp L112
 03E7                 L111:
                       ; }
                       ; }
 03E7 FC0007            ldd _Wind_direction
 03EA 1A830070          cpd #112
 03EE 2D1E              blt L113
 03F0 FC0007            ldd _Wind_direction
 03F3 1A830090          cpd #144
 03F7 2C15              bge L113
                       ; }
                       ; }
 03F9 7F1000            clr 0x1000
                       ; }
 03FC 18CE1008          ldy #0x1008
 0400 181C0020          bset 0,y,#32
                       ; }
 0404 18CE1008          ldy #0x1008
 0408 181D001C          bclr 0,y,#0x1c
                       ; }
 040C 2073              bra L114
 040E                 L113:
                       ; }
                       ; }
 040E FC0007            ldd _Wind_direction
 0411 1A830090          cpd #144
 0415 2D1E              blt L115
 0417 FC0007            ldd _Wind_direction
 041A 1A8300B0          cpd #176
 041E 2C15              bge L115
                       ; }
                       ; }
 0420 7F1000            clr 0x1000
                       ; }
 0423 18CE1008          ldy #0x1008
 0427 181C0010          bset 0,y,#16
                       ; }
 042B 18CE1008          ldy #0x1008
 042F 181D002C          bclr 0,y,#0x2c
                       ; }
                       ; }
 0433 204C              bra L116
 0435                 L115:
                       ; }
                       ; }
 0435 FC0007            ldd _Wind_direction
 0438 1A8300B0          cpd #176
 043C 2D1E              blt L117
 043E FC0007            ldd _Wind_direction
 0441 1A8300D0          cpd #208
 0445 2C15              bge L117
                       ; }
                       ; }
 0447 7F1000            clr 0x1000
                       ; }
 044A 18CE1008          ldy #0x1008
 044E 181C0008          bset 0,y,#8
                       ; }
 0452 18CE1008          ldy #0x1008
 0456 181D0034          bclr 0,y,#0x34
                       ; }
 045A 2025              bra L118
 045C                 L117:
                       ; }
                       ; }
 045C FC0007            ldd _Wind_direction
 045F 1A8300D0          cpd #208
 0463 2D1C              blt L119
 0465 FC0007            ldd _Wind_direction
 0468 1A8300F0          cpd #240
 046C 2E13              bgt L119
                       ; }
                       ; }
 046E 7F1004            clr 0x1004
                       ; }
 0471 18CE1008          ldy #0x1008
 0475 181C0004          bset 0,y,#4
                       ; }
 0479 18CE1008          ldy #0x1008
 047D 181D0038          bclr 0,y,#0x38
                       ; }
                       ; }
 0481                 L119:
 0481                 L118:
 0481                 L116:
 0481                 L114:
 0481                 L112:
 0481                 L110:
 0481                 L108:
 0481                 L100:
 0481                 L98:
 0481                 L95:
 0481 7E0314            jmp L94
 0484                 X1:
                       ; }
                       ; }
 0484                 L93:
 0484 8F                xgdx
 0485 C30006            addd #6
 0488 8F                xgdx
 0489 35                txs
 048A 38                pulx
 048B                   .dbline 0 ; func end
 048B 39                rts
 048C                 _ThreadSwitcher::
 048C 0F                        sei
                       
 048D FE0000                 ldx _RunPt
 0490 AF02               sts 2,x
                       
 0492 18FE0000          ldy _RunPt
 0496 18EC00            ldd 0,y
 0499 FD0000            std _RunPt
 049C FE0000                 ldx _RunPt
 049F AE02               lds 2,x
                       
                         ; vol
 04A1 FC100E            ldd 0x100e
 04A4 C39C40            addd #0x9c40
 04A7 FD1016            std 0x1016
 04AA C680              ldab #128
 04AC F71023            stab 0x1023
 04AF 0E                        cli
                       
 04B0                 L121:
 04B0                   .dbline 0 ; func end
 04B0 3B                rti
 04B1                 _AtoD::
 04B1 0F                        sei
                       
 04B2 F60004            ldab _count
 04B5 CB01              addb #1
 04B7 F70004            stab _count
 04BA F60004            ldab _count
 04BD C104              cmpb #4
 04BF 2618              bne L123
                         ; vol
 04C1 F61031            ldab 0x1031
 04C4 4F                clra
 04C5 FD0009            std _Wind_speed
                         ; vol
 04C8 F61032            ldab 0x1032
 04CB 4F                clra
 04CC FD0007            std _Wind_direction
                         ; vol
 04CF F61033            ldab 0x1033
 04D2 4F                clra
 04D3 FD0005            std _Temperature
 04D6 7F0004            clr _count
 04D9                 L123:
                         ; vol
 04D9 FC100E            ldd 0x100e
 04DC C3C350            addd #0xc350
 04DF FD1018            std 0x1018
 04E2 C640              ldab #64
 04E4 F71023            stab 0x1023
 04E7 0E                        cli
                       
 04E8                 L122:
 04E8                   .dbline 0 ; func end
 04E8 3B                rti
                       ;  IX -> 0,x
                       ;          dummy -> +2,x
                       ;              i -> +3,x
                       ;           temp -> +4,x
 04E9                 _main::
 04E9 BD0000            jsr __enterb
 04EC 06                .byte 0x6
 04ED 0F                        sei
                       
 04EE CC0000            ldd #0
 04F1 FD0009            std _Wind_speed
 04F4 CC0000            ldd #0
 04F7 FD0007            std _Wind_direction
 04FA CC0000            ldd #0
 04FD FD0005            std _Temperature
 0500 7F0004            clr _count
 0503 CC0001            ldd #1
 0506 BD00E9            jsr _EscapeSequence
 0509 CC0746            ldd #L126
 050C BD00BC            jsr _OutString
 050F CC072A            ldd #L127
 0512 BD00BC            jsr _OutString
 0515 CC0714            ldd #L128
 0518 BD00BC            jsr _OutString
 051B 7F102C            clr 0x102c
 051E C60C              ldab #12
 0520 F7102D            stab 0x102d
 0523 CC0030            ldd #48
 0526 BD0000            jsr _setbaud
 0529 7F1000            clr 0x1000
 052C C63C              ldab #60
 052E F71009            stab 0x1009
 0531 C688              ldab #136
 0533 F71026            stab 0x1026
 0536 CC06F3            ldd #L129
 0539 BD00BC            jsr _OutString
 053C CC048C            ldd #_ThreadSwitcher
 053F FDFFE8            std 0xffe8
 0542 CC04B1            ldd #_AtoD
 0545 DDDD              std 0xdd
 0547 C6C0              ldab #192
 0549 F71022            stab 0x1022
 054C C6C0              ldab #192
 054E F71023            stab 0x1023
                         ; vol
 0551 FC100E            ldd 0x100e
 0554 C3FDE8            addd #0xfde8
 0557 FD1016            std 0x1016
                         ; vol
 055A FC100E            ldd 0x100e
 055D C39C40            addd #0x9c40
 0560 FD1018            std 0x1018
 0563 CC06DD            ldd #L130
 0566 BD00BC            jsr _OutString
 0569 18CE1039          ldy #0x1039
 056D 181C00C0          bset 0,y,#192
 0571 6F03              clr 3,x
 0573 200A              bra L134
 0575                 L131:
 0575 E603              ldab 3,x
 0577 E702              stab 2,x
 0579                 L132:
 0579 E603              ldab 3,x
 057B CB01              addb #1
 057D E703              stab 3,x
 057F                 L134:
 057F E603              ldab 3,x
 0581 C1C8              cmpb #200
 0583 25F0              blo L131
 0585 C630              ldab #48
 0587 F71030            stab 0x1030
 058A CC06B7            ldd #L135
 058D BD00BC            jsr _OutString
 0590 CC0001            ldd #1
 0593 FD0002            std _displayFree
 0596 CC0000            ldd #_sys
 0599 FD0000            std _RunPt
 059C FE0000                  ldx _RunPt
 059F AE02                lds 2,x
                         
                       
 05A1 CC068C            ldd #L136
 05A4 BD00BC            jsr _OutString
 05A7 CC0000            ldd #0
 05AA ED04              std 4,x
 05AC 200E              bra L140
 05AE                 L137:
 05AE EC04              ldd 4,x
 05B0 C30001            addd #1
 05B3 ED04              std 4,x
 05B5                 L138:
 05B5 EC04              ldd 4,x
 05B7 C30001            addd #1
 05BA ED04              std 4,x
 05BC                 L140:
 05BC EC04              ldd 4,x
 05BE 1A83EA60          cpd #0xea60
 05C2 25EA              blo L137
 05C4 CC0000            ldd #0
 05C7 ED04              std 4,x
 05C9 200E              bra L144
 05CB                 L141:
 05CB EC04              ldd 4,x
 05CD C30001            addd #1
 05D0 ED04              std 4,x
 05D2                 L142:
 05D2 EC04              ldd 4,x
 05D4 C30001            addd #1
 05D7 ED04              std 4,x
 05D9                 L144:
 05D9 EC04              ldd 4,x
 05DB 1A83EA60          cpd #0xea60
 05DF 25EA              blo L141
 05E1 CC0001            ldd #1
 05E4 BD00E9            jsr _EscapeSequence
 05E7 CC066A            ldd #L145
 05EA BD00BC            jsr _OutString
 05ED CC0646            ldd #L146
 05F0 BD00BC            jsr _OutString
 05F3 CC0626            ldd #L147
 05F6 BD00BC            jsr _OutString
 05F9 CC0609            ldd #L148
 05FC BD00BC            jsr _OutString
 05FF 0E                        cli
                       
 0600 3B                    rti
                       
 0601                 L125:
 0601 8F                xgdx
 0602 C30006            addd #6
 0605 8F                xgdx
 0606 35                txs
 0607 38                pulx
 0608                   .dbline 0 ; func end
 0608 39                rts
                         .area bss
 0000                 _RunPt::
 0000                   .blkb 2
 0002                 _displayFree::
 0002                   .blkb 2
 0004                 _count::
 0004                   .blkb 1
 0005                 _Temperature::
 0005                   .blkb 2
 0007                 _Wind_direction::
 0007                   .blkb 2
 0009                 _Wind_speed::
 0009                   .blkb 2
                         .area text
 0609                 L148:
 0609 5468652043757272656E742054656D70   .byte 'T,'h,'e,32,'C,'u,'r,'r,'e,'n,'t,32,'T,'e,'m,'p
 0619 657261747572652069733A2000     .byte 'e,'r,'a,'t,'u,'r,'e,32,'i,'s,58,32,0
 0626                 L147:
 0626 5468652043757272656E742057696E64   .byte 'T,'h,'e,32,'C,'u,'r,'r,'e,'n,'t,32,'W,'i,'n,'d
 0636 2053706565642069733A200A0D0A0D00   .byte 32,'S,'p,'e,'e,'d,32,'i,'s,58,32,10,13,10,13,0
 0646                 L146:
 0646 5468652043757272656E742057696E64   .byte 'T,'h,'e,32,'C,'u,'r,'r,'e,'n,'t,32,'W,'i,'n,'d
 0656 20446972656374696F6E2069733A200A   .byte 32,'D,'i,'r,'e,'c,'t,'i,'o,'n,32,'i,'s,58,32,10
 0666 0D0A0D00          .byte 13,10,13,0
 066A                 L145:
 066A 57454C434F4D4520544F205745415448   .byte 'W,'E,'L,'C,'O,'M,'E,32,'T,'O,32,'W,'E,'A,'T,'H
 067A 45522053544154494F4E2E2E2E0A0D0A   .byte 'E,'R,32,'S,'T,'A,'T,'I,'O,'N,46,46,46,10,13,10
 068A 0D00              .byte 13,0
 068C                 L136:
 068C 0A0D3A3A5B53797374656D20496E6974   .byte 10,13,58,58,91,'S,'y,'s,'t,'e,'m,32,'I,'n,'i,'t
 069C 69616C697A6174696F6E20436F6D706C   .byte 'i,'a,'l,'i,'z,'a,'t,'i,'o,'n,32,'C,'o,'m,'p,'l
 06AC 6574655D3A3A0A0D0A0D00     .byte 'e,'t,'e,93,58,58,10,13,10,13,0
 06B7                 L135:
 06B7 496E697469616C697A696E6720546872   .byte 'I,'n,'i,'t,'i,'a,'l,'i,'z,'i,'n,'g,32,'T,'h,'r
 06C7 6561647320262053656D6170686F7265   .byte 'e,'a,'d,'s,32,38,32,'S,'e,'m,'a,'p,'h,'o,'r,'e
 06D7 2E2E2E0A0D00      .byte 46,46,46,10,13,0
 06DD                 L130:
 06DD 496E697469616C697A696E6720412F44   .byte 'I,'n,'i,'t,'i,'a,'l,'i,'z,'i,'n,'g,32,'A,47,'D
 06ED 2E2E2E0A0D00      .byte 46,46,46,10,13,0
 06F3                 L129:
 06F3 496E697469616C697A696E67204F436E   .byte 'I,'n,'i,'t,'i,'a,'l,'i,'z,'i,'n,'g,32,'O,'C,'n
 0703 20496E74657272757074732E2E2E0A0D   .byte 32,'I,'n,'t,'e,'r,'r,'u,'p,'t,'s,46,46,46,10,13
 0713 00                .byte 0
 0714                 L128:
 0714 496E697469616C697A696E6720492F4F   .byte 'I,'n,'i,'t,'i,'a,'l,'i,'z,'i,'n,'g,32,'I,47,'O
 0724 2E2E2E0A0D00      .byte 46,46,46,10,13,0
 072A                 L127:
 072A 3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D   .byte 61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61
 073A 3D3D3D3D3D3D3D0A0D0A0D00   .byte 61,61,61,61,61,61,61,10,13,10,13,0
 0746                 L126:
 0746 2E3A5B20574541544845522053544154   .byte 46,58,91,32,'W,'E,'A,'T,'H,'E,'R,32,'S,'T,'A,'T
 0756 494F4E205D3A2E0A0D00   .byte 'I,'O,'N,32,93,58,46,10,13,0
 0760                 L92:
 0760 206420466172656E6865697420202000   .byte 32,'d,32,'F,'a,'r,'e,'n,'h,'e,'i,'t,32,32,32,0
 0770                 L91:
 0770 206D2F7320202000   .byte 32,'m,47,'s,32,32,32,0
 0778                 L90:
 0778 204465677265657320202000   .byte 32,'D,'e,'g,'r,'e,'e,'s,32,32,32,0
