Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ..... ...
- 3fa0: 3FFF JMP (0x3fa0)
- 3fa2: 3FFF JMP (0x3fa2)
- 3fa4: 3FFF JMP (0x3fa4)
- 3fa6: 3FFF JMP (0x3fa6)
- 3fa8: 3FFF JMP (0x3fa8)
- 3faa: 3FFF JMP (0x3faa)
- 3fac: 3FFF JMP (0x3fac)
- 3fae: 3FFF JMP (0x3fae)
- 3fb0: 3FFF JMP (0x3fb0)
- 3fb2: 3FFF JMP (0x3fb2)
- 3fb4: 3FFF JMP (0x3fb4)
- 3fb6: 3FFF JMP (0x3fb6)
- 3fb8: 3FFF JMP (0x3fb8)
- 3fba: 3FFF JMP (0x3fba)
- 3fbc: 3FFF JMP (0x3fbc)
- 3fbe: 3FFF JMP (0x3fbe)
- 3fc0: 3FFF JMP (0x3fc0)
- 3fc2: 3FFF JMP (0x3fc2)
- 3fc4: 3FFF JMP (0x3fc4)
- 3fc6: 3FFF JMP (0x3fc6)
- 3fc8: 3FFF JMP (0x3fc8)
- 3fca: 3FFF JMP (0x3fca)
- 3fcc: 3FFF JMP (0x3fcc)
- 3fce: 3FFF JMP (0x3fce)
- 3fd0: 3FFF JMP (0x3fd0)
- 3fd2: 3FFF JMP (0x3fd2)
- 3fd4: 3FFF JMP (0x3fd4)
- 3fd6: 3FFF JMP (0x3fd6)
- 3fd8: 3FFF JMP (0x3fd8)
- 3fda: 3FFF JMP (0x3fda)
- 3fdc: 3FFF JMP (0x3fdc)
- 3fde: 3FFF JMP (0x3fde)
- 3fe0: 3FFF JMP (0x3fe0)
- 3fe2: 3FFF JMP (0x3fe2)
- 3fe4: 3FFF JMP (0x3fe4)
- 3fe6: 3FFF JMP (0x3fe6)
- 3fe8: 3FFF JMP (0x3fe8)
- 3fea: 3FFF JMP (0x3fea)
- 3fec: 3FFF JMP (0x3fec)
- 3fee: 3FFF JMP (0x3fee)
- 3ff0: 3FFF JMP (0x3ff0)
- 3ff2: 3FFF JMP (0x3ff2)
- 3ff4: 3FFF JMP (0x3ff4)
- 3ff6: 3FFF JMP (0x3ff6)
- 3ff8: 3FFF JMP (0x3ff8)
- 3ffa: 3FFF JMP (0x3ffa)
- 3ffc: 3FFF JMP (0x3ffc)
- 3ffe: 3FFF JMP (0x3ffe)
- 19 RESET mov.w #__STACK_END,SP ; Initialize stackpointer
- $../main.asm:19:99$(), RESET():
- 4000: 4031 3900 MOV.W #0x3900,SP
- 20 StopWDT mov.w #WDTPW|WDTHOLD,&WDTCTL ; Stop watchdog timer
- StopWDT:
- 4004: 40B2 5A80 0120 MOV.W #0x5a80,&Watchdog_Timer_WDTCTL
- 28 init BIS.B #0FFh,&P3DIR ;set port 3 as output
- init:
- 400a: D3F2 001A BIS.B #-1,&Port_3_4_P3DIR
- 29 CLR.B &P3OUT
- 400e: 43C2 0019 CLR.B &Port_3_4_P3OUT
- 30 CLR R9
- 4012: 4309 CLR.W R9
- 31 CLR R5
- 4014: 4305 CLR.W R5
- 33 MOV.B #00Ah, &P1IE ;set port 1 as interrupt + input
- 4016: 40F2 000A 0025 MOV.B #0x000a,&Port_1_2_P1IE
- 34 MOV.B #00Ah, &P1IES
- 401c: 40F2 000A 0024 MOV.B #0x000a,&Port_1_2_P1IES
- 41 CLR.B &P1IFG
- main:
- 4022: 43C2 0023 CLR.B &Port_1_2_P1IFG
- 42 BIS #GIE+CPUOFF+SCG1+SCG0, SR
- 4026: D032 00D8 BIS.W #0x00d8,SR
- 43 MOV.B #00Ah, &P1IE ;enable interrupts
- 402a: 40F2 000A 0025 MOV.B #0x000a,&Port_1_2_P1IE
- 47 MOV.B &P1IN, R6
- mainloop:
- 4030: 4256 0020 MOV.B &Port_1_2_P1IN,R6
- 48 BIT.B #08h, R6 ;check if the load button was clicked
- 4034: B276 BIT.B #8,R6
- 49 JZ load
- 4036: 2418 JEQ (load)
- 50 CMP #01h, R8
- 4038: 9318 CMP.W #1,R8
- 51 MOV.B #0, R8 ;reset the flag
- 403a: 4348 CLR.B R8
- 52 JZ main ;there was a load but it's not anymore, so go to sleep
- 403c: 27F2 JEQ (main)
- 53 BIT.B #02h, R6 ;just in case test if clock was pressed
- 403e: B366 BIT.B #2,R6
- 54 JNZ main ;not zero - not pressed
- 4040: 23F0 JNE (main)
- 57 MOV.W #007FFh, R7 ;set the loop counter
- jittersetup:
- 4042: 4037 07FF MOV.W #0x07ff,R7
- 58 BIS #GIE, SR ;enable interrupts
- 4046: D232 EINT
- 61 DEC.W R7 ;2 cycles
- jitterloop:
- 4048: 8317 DEC.W R7
- 62 MOV.B &P1IN, R6 ;3 cycles
- 404a: 4256 0020 MOV.B &Port_1_2_P1IN,R6
- 63 BIT #08h, R6 ;2 cycles
- 404e: B236 BIT.W #8,R6
- 64 JZ load ;2 cycles
- 4050: 240B JEQ (load)
- 65 BIT #02h, R6 ;test the clock input - we know "on" is "0" 2 cycles
- 4052: B326 BIT.W #2,R6
- 66 JNZ main ;if it was 1, go to sleep 2 cycles
- 4054: 23E6 JNE (main)
- 67 CMP.W #0, R7 ;if we got to 2 cycles
- 4056: 9307 TST.W R7
- 68 JNZ jitterloop ;2 cycles
- 4058: 23F7 JNE (jitterloop)
- 71 BIC #GIE, SR ;disable interrupts
- decrease:
- 405a: C232 DINT
- 72 BIT.B #01h, R8 ;check if the load button was clicked in the meanwhile
- 405c: B358 BIT.B #1,R8
- 73 JNZ load ;otherwise, clock was clicked
- 405e: 2004 JNE (load)
- 74 DEC.B R5 ;decrease, set out and go to sleep
- 4060: 8355 DEC.B R5
- 75 MOV.B R5, &P3OUT
- 4062: 45C2 0019 MOV.B R5,&Port_3_4_P3OUT
- 76 JMP main
- 4066: 3FDD JMP (main)
- 79 MOV.B &P2IN, R5 ;move the values set by the user
- load:
- 4068: 4255 0028 MOV.B &Port_1_2_P2IN,R5
- 80 MOV.B R5, &P3OUT
- 406c: 45C2 0019 MOV.B R5,&Port_3_4_P3OUT
- 81 CLR R8
- 4070: 4308 CLR.W R8
- 82 OR #0F5h, R6
- 4072: D036 00F5 BIS.W #0x00f5,R6
- 83 CMP #0F5h, R6
- 4076: 9036 00F5 CMP.W #0x00f5,R6
- 84 JNZ mainloop
- 407a: 23DA JNE (mainloop)
- 86 MOV.B #1, R8 ;flag that there was a load
- is_two:
- 407c: 4358 MOV.B #1,R8
- 87 JMP mainloop ;load is enabled by value, not edge, so check it again
- 407e: 3FD8 JMP (mainloop)
- 90 MOV.B &P1IN, R6 ;set the button state to the register
- PORT1_ISR:
- ..... ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement