diff options
author | vg <vgm+dev@devys.org> | 2020-07-07 16:24:01 +0200 |
---|---|---|
committer | vg <vgm+dev@devys.org> | 2020-07-07 16:24:01 +0200 |
commit | 66dcf910bd4744d8ced56cb9586aa937a1a2d4c5 (patch) | |
tree | df4dca1ae4af1e5df0be0d1f4f2cd0d54751f8e8 /avr-test2/ledcube.lst | |
download | hic-master.tar.gz hic-master.tar.bz2 hic-master.zip |
Diffstat (limited to 'avr-test2/ledcube.lst')
-rw-r--r-- | avr-test2/ledcube.lst | 827 |
1 files changed, 827 insertions, 0 deletions
diff --git a/avr-test2/ledcube.lst b/avr-test2/ledcube.lst new file mode 100644 index 0000000..3d7bf39 --- /dev/null +++ b/avr-test2/ledcube.lst @@ -0,0 +1,827 @@ + +ledcube.elf: file format elf32-avr + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .text 000003d2 00000000 00000000 00000074 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 1 .bss 00000088 00800060 00800060 00000446 2**0 + ALLOC + 2 .stab 00003f90 00000000 00000000 00000448 2**2 + CONTENTS, READONLY, DEBUGGING + 3 .stabstr 00002106 00000000 00000000 000043d8 2**0 + CONTENTS, READONLY, DEBUGGING + +Disassembly of section .text: + +00000000 <__vectors>: + 0: 12 c0 rjmp .+36 ; 0x26 <__ctors_end> + 2: 2c c0 rjmp .+88 ; 0x5c <__bad_interrupt> + 4: 2b c0 rjmp .+86 ; 0x5c <__bad_interrupt> + 6: 7f c0 rjmp .+254 ; 0x106 <__vector_3> + 8: 29 c0 rjmp .+82 ; 0x5c <__bad_interrupt> + a: 28 c0 rjmp .+80 ; 0x5c <__bad_interrupt> + c: 27 c0 rjmp .+78 ; 0x5c <__bad_interrupt> + e: 26 c0 rjmp .+76 ; 0x5c <__bad_interrupt> + 10: 25 c0 rjmp .+74 ; 0x5c <__bad_interrupt> + 12: 25 c0 rjmp .+74 ; 0x5e <__vector_9> + 14: 23 c0 rjmp .+70 ; 0x5c <__bad_interrupt> + 16: 22 c0 rjmp .+68 ; 0x5c <__bad_interrupt> + 18: 21 c0 rjmp .+66 ; 0x5c <__bad_interrupt> + 1a: 20 c0 rjmp .+64 ; 0x5c <__bad_interrupt> + 1c: 1f c0 rjmp .+62 ; 0x5c <__bad_interrupt> + 1e: 1e c0 rjmp .+60 ; 0x5c <__bad_interrupt> + 20: 1d c0 rjmp .+58 ; 0x5c <__bad_interrupt> + 22: 1c c0 rjmp .+56 ; 0x5c <__bad_interrupt> + 24: 1b c0 rjmp .+54 ; 0x5c <__bad_interrupt> + +00000026 <__ctors_end>: + 26: 11 24 eor r1, r1 + 28: 1f be out 0x3f, r1 ; 63 + 2a: cf e5 ldi r28, 0x5F ; 95 + 2c: d4 e0 ldi r29, 0x04 ; 4 + 2e: de bf out 0x3e, r29 ; 62 + 30: cd bf out 0x3d, r28 ; 61 + +00000032 <__do_copy_data>: + 32: 10 e0 ldi r17, 0x00 ; 0 + 34: a0 e6 ldi r26, 0x60 ; 96 + 36: b0 e0 ldi r27, 0x00 ; 0 + 38: e2 ed ldi r30, 0xD2 ; 210 + 3a: f3 e0 ldi r31, 0x03 ; 3 + 3c: 02 c0 rjmp .+4 ; 0x42 <.do_copy_data_start> + +0000003e <.do_copy_data_loop>: + 3e: 05 90 lpm r0, Z+ + 40: 0d 92 st X+, r0 + +00000042 <.do_copy_data_start>: + 42: a0 36 cpi r26, 0x60 ; 96 + 44: b1 07 cpc r27, r17 + 46: d9 f7 brne .-10 ; 0x3e <.do_copy_data_loop> + +00000048 <__do_clear_bss>: + 48: 10 e0 ldi r17, 0x00 ; 0 + 4a: a0 e6 ldi r26, 0x60 ; 96 + 4c: b0 e0 ldi r27, 0x00 ; 0 + 4e: 01 c0 rjmp .+2 ; 0x52 <.do_clear_bss_start> + +00000050 <.do_clear_bss_loop>: + 50: 1d 92 st X+, r1 + +00000052 <.do_clear_bss_start>: + 52: a8 3e cpi r26, 0xE8 ; 232 + 54: b1 07 cpc r27, r17 + 56: e1 f7 brne .-8 ; 0x50 <.do_clear_bss_loop> + 58: 06 d1 rcall .+524 ; 0x266 <main> + 5a: b9 c1 rjmp .+882 ; 0x3ce <_exit> + +0000005c <__bad_interrupt>: + 5c: d1 cf rjmp .-94 ; 0x0 <__vectors> + +0000005e <__vector_9>: +//volatile uint32_t timer0_overflow_count = 0; +volatile uint32_t timer0_millis = 0; +//static uint8_t timer0_fract = 0; + + +ISR(TIMER0_OVF_vect) + 5e: 1f 92 push r1 + 60: 0f 92 push r0 + 62: 0f b6 in r0, 0x3f ; 63 + 64: 0f 92 push r0 + 66: 11 24 eor r1, r1 + 68: 2f 93 push r18 + 6a: 3f 93 push r19 + 6c: 4f 93 push r20 + 6e: 5f 93 push r21 + 70: 8f 93 push r24 + 72: 9f 93 push r25 +{ + // copy these to local variables so they can be stored in registers + // (volatile variables must be read from memory on every access) + uint32_t m = timer0_millis; + 74: 20 91 e3 00 lds r18, 0x00E3 + 78: 30 91 e4 00 lds r19, 0x00E4 + 7c: 40 91 e5 00 lds r20, 0x00E5 + 80: 50 91 e6 00 lds r21, 0x00E6 + //uint8_t f = timer0_fract; + static uint8_t timer0_fract = 0; + + m += MILLIS_INC; + 84: 2f 5f subi r18, 0xFF ; 255 + 86: 3f 4f sbci r19, 0xFF ; 255 + 88: 4f 4f sbci r20, 0xFF ; 255 + 8a: 5f 4f sbci r21, 0xFF ; 255 + //f += FRACT_INC; + timer0_fract += FRACT_INC; + 8c: 90 91 e7 00 lds r25, 0x00E7 + 90: 89 2f mov r24, r25 + 92: 8d 5f subi r24, 0xFD ; 253 + 94: 80 93 e7 00 sts 0x00E7, r24 + //if (f >= FRACT_MAX) { + if (timer0_fract >= FRACT_MAX) { + 98: 8d 37 cpi r24, 0x7D ; 125 + 9a: 38 f0 brcs .+14 ; 0xaa <__vector_9+0x4c> + //f -= FRACT_MAX; + timer0_fract -= FRACT_MAX; + 9c: 9a 57 subi r25, 0x7A ; 122 + 9e: 90 93 e7 00 sts 0x00E7, r25 + ++m; + a2: 2f 5f subi r18, 0xFF ; 255 + a4: 3f 4f sbci r19, 0xFF ; 255 + a6: 4f 4f sbci r20, 0xFF ; 255 + a8: 5f 4f sbci r21, 0xFF ; 255 + } + + //timer0_fract = f; + timer0_millis = m; + aa: 20 93 e3 00 sts 0x00E3, r18 + ae: 30 93 e4 00 sts 0x00E4, r19 + b2: 40 93 e5 00 sts 0x00E5, r20 + b6: 50 93 e6 00 sts 0x00E6, r21 + //if (timer0_overflow_count & 0x1) + //if (m - last_time >= 5) { + //debounce_keys(); // called nearly each 2ms (0,002048s) + //last_time = m; + //} +} + ba: 9f 91 pop r25 + bc: 8f 91 pop r24 + be: 5f 91 pop r21 + c0: 4f 91 pop r20 + c2: 3f 91 pop r19 + c4: 2f 91 pop r18 + c6: 0f 90 pop r0 + c8: 0f be out 0x3f, r0 ; 63 + ca: 0f 90 pop r0 + cc: 1f 90 pop r1 + ce: 18 95 reti + +000000d0 <_Z9clear_ledv>: + else { + cube[y][z] &= ~(((unsigned char)1) << x); + } +} + +void clear_led() + d0: 20 e0 ldi r18, 0x00 ; 0 + d2: 30 e0 ldi r19, 0x00 ; 0 + d4: 14 c0 rjmp .+40 ; 0xfe <_Z9clear_ledv+0x2e> +{ + for (unsigned char z = 0; z < 8; ++z) { + for (unsigned char y = 0; y < 8; ++y) { + cube[y][z] = 0; + d6: fc 01 movw r30, r24 + d8: 43 e0 ldi r20, 0x03 ; 3 + da: ee 0f add r30, r30 + dc: ff 1f adc r31, r31 + de: 4a 95 dec r20 + e0: e1 f7 brne .-8 ; 0xda <_Z9clear_ledv+0xa> + e2: e2 0f add r30, r18 + e4: f3 1f adc r31, r19 + e6: ee 59 subi r30, 0x9E ; 158 + e8: ff 4f sbci r31, 0xFF ; 255 + ea: 10 82 st Z, r1 + ec: 01 96 adiw r24, 0x01 ; 1 +} + +void clear_led() +{ + for (unsigned char z = 0; z < 8; ++z) { + for (unsigned char y = 0; y < 8; ++y) { + ee: 88 30 cpi r24, 0x08 ; 8 + f0: 91 05 cpc r25, r1 + f2: 89 f7 brne .-30 ; 0xd6 <_Z9clear_ledv+0x6> + f4: 2f 5f subi r18, 0xFF ; 255 + f6: 3f 4f sbci r19, 0xFF ; 255 + } +} + +void clear_led() +{ + for (unsigned char z = 0; z < 8; ++z) { + f8: 28 30 cpi r18, 0x08 ; 8 + fa: 31 05 cpc r19, r1 + fc: 19 f0 breq .+6 ; 0x104 <_Z9clear_ledv+0x34> + fe: 80 e0 ldi r24, 0x00 ; 0 + 100: 90 e0 ldi r25, 0x00 ; 0 + 102: e9 cf rjmp .-46 ; 0xd6 <_Z9clear_ledv+0x6> + 104: 08 95 ret + +00000106 <__vector_3>: + +/***************************************************************************** + * RENDER + *****************************************************************************/ + +ISR(TIMER2_COMP_vect) + 106: 1f 92 push r1 + 108: 0f 92 push r0 + 10a: 0f b6 in r0, 0x3f ; 63 + 10c: 0f 92 push r0 + 10e: 11 24 eor r1, r1 + 110: 2f 93 push r18 + 112: 3f 93 push r19 + 114: 4f 93 push r20 + 116: 6f 93 push r22 + 118: 7f 93 push r23 + 11a: 8f 93 push r24 + 11c: 9f 93 push r25 + 11e: ef 93 push r30 + 120: ff 93 push r31 +{ + PORTD &= ~0x08; // layer down, should be done before latch + 122: 93 98 cbi 0x12, 3 ; 18 + PORTD &= ~0x20; // latch low + 124: 95 98 cbi 0x12, 5 ; 18 + unsigned char current_layer_ = current_layer; + 126: 40 91 60 00 lds r20, 0x0060 + 12a: 20 e0 ldi r18, 0x00 ; 0 + 12c: 30 e0 ldi r19, 0x00 ; 0 + for (unsigned char j = 0; j < 8; ++j) { + unsigned char val = cube[j][current_layer_]; + 12e: 64 2f mov r22, r20 + 130: 70 e0 ldi r23, 0x00 ; 0 + 132: f9 01 movw r30, r18 + 134: 83 e0 ldi r24, 0x03 ; 3 + 136: ee 0f add r30, r30 + 138: ff 1f adc r31, r31 + 13a: 8a 95 dec r24 + 13c: e1 f7 brne .-8 ; 0x136 <__vector_3+0x30> + 13e: e6 0f add r30, r22 + 140: f7 1f adc r31, r23 + 142: ee 59 subi r30, 0x9E ; 158 + 144: ff 4f sbci r31, 0xFF ; 255 + 146: 90 81 ld r25, Z + PORTD &= ~0x10; + 148: 94 98 cbi 0x12, 4 ; 18 + PORTC = val; + 14a: 95 bb out 0x15, r25 ; 21 + PORTD = (PORTD & ~0xC0) | (val & 0xC0); + 14c: 82 b3 in r24, 0x12 ; 18 + 14e: 90 7c andi r25, 0xC0 ; 192 + 150: 8f 73 andi r24, 0x3F ; 63 + 152: 98 2b or r25, r24 + 154: 92 bb out 0x12, r25 ; 18 + PORTD |= 0x10; + 156: 94 9a sbi 0x12, 4 ; 18 + 158: 2f 5f subi r18, 0xFF ; 255 + 15a: 3f 4f sbci r19, 0xFF ; 255 +ISR(TIMER2_COMP_vect) +{ + PORTD &= ~0x08; // layer down, should be done before latch + PORTD &= ~0x20; // latch low + unsigned char current_layer_ = current_layer; + for (unsigned char j = 0; j < 8; ++j) { + 15c: 28 30 cpi r18, 0x08 ; 8 + 15e: 31 05 cpc r19, r1 + 160: 41 f7 brne .-48 ; 0x132 <__vector_3+0x2c> + PORTD &= ~0x10; + PORTC = val; + PORTD = (PORTD & ~0xC0) | (val & 0xC0); + PORTD |= 0x10; + } + PORTB = (PORTB & ~0x07) | current_layer_; + 162: 88 b3 in r24, 0x18 ; 24 + 164: 88 7f andi r24, 0xF8 ; 248 + 166: 84 2b or r24, r20 + 168: 88 bb out 0x18, r24 ; 24 + PORTD |= 0x20; + 16a: 95 9a sbi 0x12, 5 ; 18 + ++current_layer_; + current_layer = current_layer_ & 0x07; + 16c: 4f 5f subi r20, 0xFF ; 255 + 16e: 47 70 andi r20, 0x07 ; 7 + 170: 40 93 60 00 sts 0x0060, r20 + PORTD |= 0x08; // layer, should be done in the end and must be after latch + 174: 93 9a sbi 0x12, 3 ; 18 +} + 176: ff 91 pop r31 + 178: ef 91 pop r30 + 17a: 9f 91 pop r25 + 17c: 8f 91 pop r24 + 17e: 7f 91 pop r23 + 180: 6f 91 pop r22 + 182: 4f 91 pop r20 + 184: 3f 91 pop r19 + 186: 2f 91 pop r18 + 188: 0f 90 pop r0 + 18a: 0f be out 0x3f, r0 ; 63 + 18c: 0f 90 pop r0 + 18e: 1f 90 pop r1 + 190: 18 95 reti + +00000192 <rs232>: + +void tmp2cube (void); +// Take input from a computer and load it onto the cube buffer +void rs232(void) + 192: 40 e0 ldi r20, 0x00 ; 0 + 194: 50 e0 ldi r21, 0x00 ; 0 + 196: 20 e0 ldi r18, 0x00 ; 0 + 198: 30 e0 ldi r19, 0x00 ; 0 + // Should switch state every time the code + // is waiting for a byte to be received. + //LED_PORT ^= LED_RED; + + // Wait until a byte has been received + while ( !(UCSRA & (1<<RXC)) ); + 19a: 5f 9b sbis 0x0b, 7 ; 11 + 19c: fe cf rjmp .-4 ; 0x19a <rs232+0x8> + + // Load the received byte from rs232 into a buffer. + tempval = UDR; + 19e: 8c b1 in r24, 0x0c ; 12 + 1a0: 90 e0 ldi r25, 0x00 ; 0 + // are reset to 0. This way the x and y counters are + // always the same on the computer and in the cube. + // To send an 0xff byte, you have to send it twice! + + // Go into sync escape mode + if (tempval == 0xff) + 1a2: 8f 3f cpi r24, 0xFF ; 255 + 1a4: 91 05 cpc r25, r1 + 1a6: 31 f4 brne .+12 ; 0x1b4 <rs232+0x22> + { + // Wait for the next byte + while ( !(UCSRA & (1<<RXC)) ); + 1a8: 5f 9b sbis 0x0b, 7 ; 11 + 1aa: fe cf rjmp .-4 ; 0x1a8 <rs232+0x16> + // Get the next byte + tempval = UDR; + 1ac: 8c b1 in r24, 0x0c ; 12 + 1ae: 90 e0 ldi r25, 0x00 ; 0 + + // Sync signal is received. + // Reset x and y counters to 0. + if (tempval == 0x00) + 1b0: 00 97 sbiw r24, 0x00 ; 0 + 1b2: 79 f3 breq .-34 ; 0x192 <rs232> + } + + if (escape == 0) + { + // Load data into the current position in the buffer + fb[x][y] = tempval; + 1b4: fa 01 movw r30, r20 + 1b6: 93 e0 ldi r25, 0x03 ; 3 + 1b8: ee 0f add r30, r30 + 1ba: ff 1f adc r31, r31 + 1bc: 9a 95 dec r25 + 1be: e1 f7 brne .-8 ; 0x1b8 <rs232+0x26> + 1c0: e2 0f add r30, r18 + 1c2: f3 1f adc r31, r19 + 1c4: ed 55 subi r30, 0x5D ; 93 + 1c6: ff 4f sbci r31, 0xFF ; 255 + 1c8: 80 83 st Z, r24 + + // Check if we have reached the limits of the buffer array. + if (y == 7) + 1ca: 27 30 cpi r18, 0x07 ; 7 + 1cc: 31 05 cpc r19, r1 + 1ce: 41 f4 brne .+16 ; 0x1e0 <rs232+0x4e> + { + if (x == 7) + 1d0: 47 30 cpi r20, 0x07 ; 7 + 1d2: 51 05 cpc r21, r1 + 1d4: 11 f4 brne .+4 ; 0x1da <rs232+0x48> + { + // All data is loaded. Reset both counters + y = 0; + x = 0; + // Copy the data onto the cube. + tmp2cube(); + 1d6: f1 d0 rcall .+482 ; 0x3ba <_Z8tmp2cubev> + 1d8: dc cf rjmp .-72 ; 0x192 <rs232> + } else + { + // A layer is loaded, reset y and increment x. + x++; + 1da: 4f 5f subi r20, 0xFF ; 255 + 1dc: 5f 4f sbci r21, 0xFF ; 255 + 1de: db cf rjmp .-74 ; 0x196 <rs232+0x4> + y = 0; + } + } else + { + // We are in the middle of loading a layer. increment y. + y++; + 1e0: 2f 5f subi r18, 0xFF ; 255 + 1e2: 3f 4f sbci r19, 0xFF ; 255 + 1e4: da cf rjmp .-76 ; 0x19a <rs232+0x8> + +000001e6 <_Z7set_ledhhhb>: +/***************************************************************************** + * ACCESSORS + *****************************************************************************/ + +unsigned char inrange(int x, int y, int z); +void set_led(unsigned char x, unsigned char y, unsigned char z, bool on) + 1e6: ef 92 push r14 + 1e8: ff 92 push r15 + 1ea: 0f 93 push r16 + 1ec: 1f 93 push r17 + 1ee: cf 93 push r28 + 1f0: df 93 push r29 + 1f2: f8 2e mov r15, r24 + 1f4: e2 2e mov r14, r18 +{ + + if (!inrange(x, y, z)) { + 1f6: 06 2f mov r16, r22 + 1f8: 10 e0 ldi r17, 0x00 ; 0 + 1fa: c4 2f mov r28, r20 + 1fc: d0 e0 ldi r29, 0x00 ; 0 + 1fe: 90 e0 ldi r25, 0x00 ; 0 + 200: b8 01 movw r22, r16 + 202: ae 01 movw r20, r28 + 204: c6 d0 rcall .+396 ; 0x392 <_Z7inrangeiii> + 206: 88 23 and r24, r24 + 208: 39 f1 breq .+78 ; 0x258 <_Z7set_ledhhhb+0x72> + 20a: b8 01 movw r22, r16 + 20c: 23 e0 ldi r18, 0x03 ; 3 + 20e: 66 0f add r22, r22 + 210: 77 1f adc r23, r23 + 212: 2a 95 dec r18 + 214: e1 f7 brne .-8 ; 0x20e <_Z7set_ledhhhb+0x28> + assert(x >= 0 && x <= 7); + assert(y >= 0 && y <= 7); + assert(z >= 0 && z <= 7); + */ + + if (on) { + 216: ee 20 and r14, r14 + 218: 79 f0 breq .+30 ; 0x238 <_Z7set_ledhhhb+0x52> + cube[y][z] |= ((unsigned char)1) << x; + 21a: fb 01 movw r30, r22 + 21c: ec 0f add r30, r28 + 21e: fd 1f adc r31, r29 + 220: ee 59 subi r30, 0x9E ; 158 + 222: ff 4f sbci r31, 0xFF ; 255 + 224: 20 81 ld r18, Z + 226: 81 e0 ldi r24, 0x01 ; 1 + 228: 90 e0 ldi r25, 0x00 ; 0 + 22a: 02 c0 rjmp .+4 ; 0x230 <_Z7set_ledhhhb+0x4a> + 22c: 88 0f add r24, r24 + 22e: 99 1f adc r25, r25 + 230: fa 94 dec r15 + 232: e2 f7 brpl .-8 ; 0x22c <_Z7set_ledhhhb+0x46> + 234: 28 2b or r18, r24 + 236: 0f c0 rjmp .+30 ; 0x256 <_Z7set_ledhhhb+0x70> + } + else { + cube[y][z] &= ~(((unsigned char)1) << x); + 238: fb 01 movw r30, r22 + 23a: ec 0f add r30, r28 + 23c: fd 1f adc r31, r29 + 23e: ee 59 subi r30, 0x9E ; 158 + 240: ff 4f sbci r31, 0xFF ; 255 + 242: 20 81 ld r18, Z + 244: 81 e0 ldi r24, 0x01 ; 1 + 246: 90 e0 ldi r25, 0x00 ; 0 + 248: 02 c0 rjmp .+4 ; 0x24e <_Z7set_ledhhhb+0x68> + 24a: 88 0f add r24, r24 + 24c: 99 1f adc r25, r25 + 24e: fa 94 dec r15 + 250: e2 f7 brpl .-8 ; 0x24a <_Z7set_ledhhhb+0x64> + 252: 80 95 com r24 + 254: 28 23 and r18, r24 + 256: 20 83 st Z, r18 + } +} + 258: df 91 pop r29 + 25a: cf 91 pop r28 + 25c: 1f 91 pop r17 + 25e: 0f 91 pop r16 + 260: ff 90 pop r15 + 262: ef 90 pop r14 + 264: 08 95 ret + +00000266 <main>: + +/***************************************************************************** + * MAIN + *****************************************************************************/ + +int main() + 266: df 92 push r13 + 268: ef 92 push r14 + 26a: ff 92 push r15 + 26c: 0f 93 push r16 + 26e: 1f 93 push r17 + * Initialisation + * ======================================================================= + */ + + //*** init time management + TCNT0 = 0; // init timer count to 0 + 270: 12 be out 0x32, r1 ; 50 + TCCR0 |= 0x03; // prescaler: 64 + 272: 83 b7 in r24, 0x33 ; 51 + 274: 83 60 ori r24, 0x03 ; 3 + 276: 83 bf out 0x33, r24 ; 51 + TIMSK |= 0x01; // enable timer 0 overflow interrupt + 278: 89 b7 in r24, 0x39 ; 57 + 27a: 81 60 ori r24, 0x01 ; 1 + 27c: 89 bf out 0x39, r24 ; 57 + + // Timer 2 + // Frame buffer interrupt + // 14745600/128/11 = 10472.72 interrupts per second + // 10472.72/8 = 1309 frames per second + OCR2 = 11; // interrupt at counter = 10 + 27e: 8b e0 ldi r24, 0x0B ; 11 + 280: 83 bd out 0x23, r24 ; 35 + TCCR2 |= (1 << CS20) | (0 << CS21) | (1 << CS22); // Prescaler = 128. + 282: 85 b5 in r24, 0x25 ; 37 + 284: 85 60 ori r24, 0x05 ; 5 + 286: 85 bd out 0x25, r24 ; 37 + TCCR2 |= (1 << WGM21); // CTC mode. Reset counter when OCR2 is reached. + 288: 85 b5 in r24, 0x25 ; 37 + 28a: 88 60 ori r24, 0x08 ; 8 + 28c: 85 bd out 0x25, r24 ; 37 + TCNT2 = 0x00; // initial counter value = 0; + 28e: 14 bc out 0x24, r1 ; 36 + TIMSK |= (1 << OCIE2); // Enable CTC interrupt + 290: 89 b7 in r24, 0x39 ; 57 + 292: 80 68 ori r24, 0x80 ; 128 + 294: 89 bf out 0x39, r24 ; 57 + + PORTD = 0; + 296: 12 ba out 0x12, r1 ; 18 + PORTB = 0; + 298: 18 ba out 0x18, r1 ; 24 + PORTC = 0; + 29a: 15 ba out 0x15, r1 ; 21 + DDRD = 0xff; + 29c: 8f ef ldi r24, 0xFF ; 255 + 29e: 81 bb out 0x11, r24 ; 17 + DDRB = 0xff; + 2a0: 87 bb out 0x17, r24 ; 23 + DDRC = 0xff; + 2a2: 84 bb out 0x14, r24 ; 20 + ////UDR = 0x00; // send an empty byte to indicate powerup. + +#if 1 +#define BAUDRATE 38400 +#define BAUD_PRESCALLER (((F_CPU / (BAUDRATE * 16UL))) - 1) + UBRRH = (uint8_t)(BAUD_PRESCALLER>>8); + 2a4: 10 bc out 0x20, r1 ; 32 + UBRRL = (uint8_t)(BAUD_PRESCALLER); + 2a6: 89 e1 ldi r24, 0x19 ; 25 + 2a8: 89 b9 out 0x09, r24 ; 9 + //UBRRH = (uint8_t)(0); + //UBRRL = (uint8_t)(0); + UCSRC = (1<<URSEL)|(3<<UCSZ0); + 2aa: 86 e8 ldi r24, 0x86 ; 134 + 2ac: 80 bd out 0x20, r24 ; 32 + UCSRB = (1<<RXEN)|(1<<TXEN); + 2ae: 88 e1 ldi r24, 0x18 ; 24 + 2b0: 8a b9 out 0x0a, r24 ; 10 +#undef BAUDRATE +#undef BAUD_PRESCALLER +#endif + + //*** set interupts + sei(); + 2b2: 78 94 sei + + //while (1) { delay(1000); UDR = 'a'; } + //while (1) { UDR = 'a'; } + //DDRD |= 0x02; while (1) { delay(1000); PORTD ^= 0x02; } + + rs232(); + 2b4: 6e df rcall .-292 ; 0x192 <rs232> + 2b6: 20 e0 ldi r18, 0x00 ; 0 + return timer0_millis; +} + +void delay(uint32_t ms) +{ + in_wait = true; + 2b8: ee 24 eor r14, r14 + 2ba: e3 94 inc r14 + + //clear_led(); + //delay_ms(1000); + for (unsigned char z = 0; z < 8; ++z) { + for (unsigned char y = 0; y < 8; ++y) { + cube[y][z] = 0xFF; + 2bc: dd 24 eor r13, r13 + 2be: da 94 dec r13 + 2c0: 14 c0 rjmp .+40 ; 0x2ea <main+0x84> + + //while (1) { delay(1000); UDR = 'a'; } + //while (1) { UDR = 'a'; } + //DDRD |= 0x02; while (1) { delay(1000); PORTD ^= 0x02; } + + rs232(); + 2c2: 80 e0 ldi r24, 0x00 ; 0 + 2c4: 90 e0 ldi r25, 0x00 ; 0 + + //clear_led(); + //delay_ms(1000); + for (unsigned char z = 0; z < 8; ++z) { + for (unsigned char y = 0; y < 8; ++y) { + cube[y][z] = 0xFF; + 2c6: 42 2f mov r20, r18 + 2c8: 50 e0 ldi r21, 0x00 ; 0 + 2ca: fc 01 movw r30, r24 + 2cc: 33 e0 ldi r19, 0x03 ; 3 + 2ce: ee 0f add r30, r30 + 2d0: ff 1f adc r31, r31 + 2d2: 3a 95 dec r19 + 2d4: e1 f7 brne .-8 ; 0x2ce <main+0x68> + 2d6: e4 0f add r30, r20 + 2d8: f5 1f adc r31, r21 + 2da: ee 59 subi r30, 0x9E ; 158 + 2dc: ff 4f sbci r31, 0xFF ; 255 + 2de: d0 82 st Z, r13 + 2e0: 01 96 adiw r24, 0x01 ; 1 + for (;;) { + + //clear_led(); + //delay_ms(1000); + for (unsigned char z = 0; z < 8; ++z) { + for (unsigned char y = 0; y < 8; ++y) { + 2e2: 88 30 cpi r24, 0x08 ; 8 + 2e4: 91 05 cpc r25, r1 + 2e6: 89 f7 brne .-30 ; 0x2ca <main+0x64> + + for (;;) { + + //clear_led(); + //delay_ms(1000); + for (unsigned char z = 0; z < 8; ++z) { + 2e8: 2f 5f subi r18, 0xFF ; 255 + 2ea: 28 30 cpi r18, 0x08 ; 8 + 2ec: 50 f3 brcs .-44 ; 0x2c2 <main+0x5c> + return timer0_millis; +} + +void delay(uint32_t ms) +{ + in_wait = true; + 2ee: e0 92 a2 00 sts 0x00A2, r14 +} +*/ + +inline uint32_t millis() +{ + return timer0_millis; + 2f2: 20 91 e3 00 lds r18, 0x00E3 + 2f6: 30 91 e4 00 lds r19, 0x00E4 + 2fa: 40 91 e5 00 lds r20, 0x00E5 + 2fe: 50 91 e6 00 lds r21, 0x00E6 + 302: 80 91 e3 00 lds r24, 0x00E3 + 306: 90 91 e4 00 lds r25, 0x00E4 + 30a: a0 91 e5 00 lds r26, 0x00E5 + 30e: b0 91 e6 00 lds r27, 0x00E6 + +void delay(uint32_t ms) +{ + in_wait = true; + uint32_t time1 = millis(); + while ((millis()) - time1 < ms); + 312: 82 1b sub r24, r18 + 314: 93 0b sbc r25, r19 + 316: a4 0b sbc r26, r20 + 318: b5 0b sbc r27, r21 + 31a: 88 58 subi r24, 0x88 ; 136 + 31c: 93 41 sbci r25, 0x13 ; 19 + 31e: a0 40 sbci r26, 0x00 ; 0 + 320: b0 40 sbci r27, 0x00 ; 0 + 322: 78 f3 brcs .-34 ; 0x302 <main+0x9c> + in_wait = false; + 324: 10 92 a2 00 sts 0x00A2, r1 + } + } + //continue; + delay(5000); + + clear_led(); + 328: d3 de rcall .-602 ; 0xd0 <_Z9clear_ledv> + 32a: ff 24 eor r15, r15 + 32c: 30 c0 rjmp .+96 ; 0x38e <main+0x128> + for (char z = 0; z < 8; ++z) { + for (char y = 0; y < 8; ++y) { + for (char x = 0; x < 8; ++x) { + set_led(x, y, z, true); + 32e: 81 2f mov r24, r17 + 330: 60 2f mov r22, r16 + 332: 4f 2d mov r20, r15 + 334: 21 e0 ldi r18, 0x01 ; 1 + 336: 57 df rcall .-338 ; 0x1e6 <_Z7set_ledhhhb> + return timer0_millis; +} + +void delay(uint32_t ms) +{ + in_wait = true; + 338: e0 92 a2 00 sts 0x00A2, r14 +} +*/ + +inline uint32_t millis() +{ + return timer0_millis; + 33c: 20 91 e3 00 lds r18, 0x00E3 + 340: 30 91 e4 00 lds r19, 0x00E4 + 344: 40 91 e5 00 lds r20, 0x00E5 + 348: 50 91 e6 00 lds r21, 0x00E6 + 34c: 80 91 e3 00 lds r24, 0x00E3 + 350: 90 91 e4 00 lds r25, 0x00E4 + 354: a0 91 e5 00 lds r26, 0x00E5 + 358: b0 91 e6 00 lds r27, 0x00E6 + +void delay(uint32_t ms) +{ + in_wait = true; + uint32_t time1 = millis(); + while ((millis()) - time1 < ms); + 35c: 82 1b sub r24, r18 + 35e: 93 0b sbc r25, r19 + 360: a4 0b sbc r26, r20 + 362: b5 0b sbc r27, r21 + 364: 84 36 cpi r24, 0x64 ; 100 + 366: 91 05 cpc r25, r1 + 368: a1 05 cpc r26, r1 + 36a: b1 05 cpc r27, r1 + 36c: 78 f3 brcs .-34 ; 0x34c <main+0xe6> + in_wait = false; + 36e: 10 92 a2 00 sts 0x00A2, r1 + delay(5000); + + clear_led(); + for (char z = 0; z < 8; ++z) { + for (char y = 0; y < 8; ++y) { + for (char x = 0; x < 8; ++x) { + 372: 1f 5f subi r17, 0xFF ; 255 + 374: 18 30 cpi r17, 0x08 ; 8 + 376: d9 f6 brne .-74 ; 0x32e <main+0xc8> + //continue; + delay(5000); + + clear_led(); + for (char z = 0; z < 8; ++z) { + for (char y = 0; y < 8; ++y) { + 378: 0f 5f subi r16, 0xFF ; 255 + 37a: 08 30 cpi r16, 0x08 ; 8 + 37c: 11 f0 breq .+4 ; 0x382 <main+0x11c> + 37e: 10 e0 ldi r17, 0x00 ; 0 + 380: d6 cf rjmp .-84 ; 0x32e <main+0xc8> + } + //continue; + delay(5000); + + clear_led(); + for (char z = 0; z < 8; ++z) { + 382: f3 94 inc r15 + 384: 88 e0 ldi r24, 0x08 ; 8 + 386: f8 16 cp r15, r24 + 388: 11 f4 brne .+4 ; 0x38e <main+0x128> + 38a: 20 e0 ldi r18, 0x00 ; 0 + 38c: 9a cf rjmp .-204 ; 0x2c2 <main+0x5c> + 38e: 00 e0 ldi r16, 0x00 ; 0 + 390: f6 cf rjmp .-20 ; 0x37e <main+0x118> + +00000392 <_Z7inrangeiii>: + 392: 08 97 sbiw r24, 0x08 ; 8 + 394: 78 f4 brcc .+30 ; 0x3b4 <_Z7inrangeiii+0x22> + 396: 77 fd sbrc r23, 7 + 398: 0d c0 rjmp .+26 ; 0x3b4 <_Z7inrangeiii+0x22> + 39a: 68 30 cpi r22, 0x08 ; 8 + 39c: 71 05 cpc r23, r1 + 39e: 54 f4 brge .+20 ; 0x3b4 <_Z7inrangeiii+0x22> + 3a0: 57 fd sbrc r21, 7 + 3a2: 08 c0 rjmp .+16 ; 0x3b4 <_Z7inrangeiii+0x22> + 3a4: 90 e0 ldi r25, 0x00 ; 0 + 3a6: 48 30 cpi r20, 0x08 ; 8 + 3a8: 51 05 cpc r21, r1 + 3aa: 0c f0 brlt .+2 ; 0x3ae <_Z7inrangeiii+0x1c> + 3ac: 91 e0 ldi r25, 0x01 ; 1 + 3ae: 81 e0 ldi r24, 0x01 ; 1 + 3b0: 98 27 eor r25, r24 + 3b2: 01 c0 rjmp .+2 ; 0x3b6 <_Z7inrangeiii+0x24> + 3b4: 90 e0 ldi r25, 0x00 ; 0 + 3b6: 89 2f mov r24, r25 + 3b8: 08 95 ret + +000003ba <_Z8tmp2cubev>: + 3ba: a2 e6 ldi r26, 0x62 ; 98 + 3bc: b0 e0 ldi r27, 0x00 ; 0 + 3be: e3 ea ldi r30, 0xA3 ; 163 + 3c0: f0 e0 ldi r31, 0x00 ; 0 + 3c2: 80 e4 ldi r24, 0x40 ; 64 + 3c4: 01 90 ld r0, Z+ + 3c6: 0d 92 st X+, r0 + 3c8: 81 50 subi r24, 0x01 ; 1 + 3ca: e1 f7 brne .-8 ; 0x3c4 <_Z8tmp2cubev+0xa> + 3cc: 08 95 ret + +000003ce <_exit>: + 3ce: f8 94 cli + +000003d0 <__stop_program>: + 3d0: ff cf rjmp .-2 ; 0x3d0 <__stop_program> |