📄 main.lst
字号:
1 .file "main.c" 2 .arch attiny2313 3 __SREG__ = 0x3f 4 __SP_H__ = 0x3e 5 __SP_L__ = 0x3d 6 __tmp_reg__ = 0 7 __zero_reg__ = 1 8 .global __do_copy_data 9 .global __do_clear_bss 12 .text 13 .Ltext0: 93 .global pixelNum 94 .data 97 pixelNum: 98 0000 FF .byte -1 99 .global cur_code 102 cur_code: 103 0001 06 .byte 6 104 .global line_shift 107 line_shift: 108 0002 0F .byte 15 109 .global cur_line 112 cur_line: 113 0003 08 .byte 8 114 .global line_timer 117 line_timer: 118 0004 10 .byte 16 119 .global patterns 120 .section .progmem.data,"a",@progbits 123 patterns: 124 0000 00 .byte 0 125 0001 00 .byte 0 126 0002 00 .byte 0 127 0003 00 .byte 0 128 0004 00 .byte 0 129 0005 00 .byte 0 130 0006 FF .byte -1 131 0007 FF .byte -1 132 0008 FF .byte -1 133 0009 FF .byte -1 134 000a FF .byte -1 135 000b FF .byte -1 136 000c 00 .byte 0 137 000d 00 .byte 0 138 000e FF .byte -1 139 000f FF .byte -1 140 0010 FF .byte -1 141 0011 FF .byte -1 142 0012 FF .byte -1 143 0013 FF .byte -1 144 0014 00 .byte 0 145 0015 00 .byte 0 146 0016 00 .byte 0 147 0017 00 .byte 0 148 0018 00 .byte 0 149 0019 00 .byte 0 150 001a FF .byte -1 151 001b FF .byte -1 152 001c 00 .byte 0 153 001d 00 .byte 0 154 001e FF .byte -1 155 001f FF .byte -1 156 0020 00 .byte 0 157 0021 00 .byte 0 158 0022 FF .byte -1 159 0023 FF .byte -1 160 0024 FF .byte -1 161 0025 00 .byte 0 162 0026 FF .byte -1 163 0027 00 .byte 0 164 0028 FF .byte -1 165 0029 00 .byte 0 166 002a 00 .byte 0 167 002b FF .byte -1 168 002c 00 .byte 0 169 002d FF .byte -1 170 002e 00 .byte 0 171 002f FF .byte -1 172 0030 F0 .byte -16 173 0031 F0 .byte -16 174 0032 F0 .byte -16 175 0033 F0 .byte -16 176 0034 F0 .byte -16 177 0035 F0 .byte -16 178 0036 0F .byte 15 179 0037 0F .byte 15 180 0038 0F .byte 15 181 0039 0F .byte 15 182 003a 0F .byte 15 183 003b 0F .byte 15 184 003c FF .byte -1 185 003d FF .byte -1 186 003e FF .byte -1 187 003f F0 .byte -16 188 0040 FF .byte -1 189 0041 FF .byte -1 190 0042 FF .byte -1 191 0043 F0 .byte -16 192 0044 FF .byte -1 193 0045 FF .byte -1 194 0046 FF .byte -1 195 0047 FF .byte -1 196 0048 00 .byte 0 197 0049 00 .byte 0 198 004a 00 .byte 0 199 004b 0F .byte 15 200 004c 00 .byte 0 201 004d 00 .byte 0 202 004e 00 .byte 0 203 004f 0F .byte 15 204 0050 00 .byte 0 205 0051 00 .byte 0 206 0052 00 .byte 0 207 0053 00 .byte 0 208 0054 FF .byte -1 209 0055 FF .byte -1 210 0056 FF .byte -1 211 0057 FF .byte -1 212 0058 00 .byte 0 213 0059 00 .byte 0 214 005a 00 .byte 0 215 005b 00 .byte 0 216 005c 00 .byte 0 217 005d 00 .byte 0 218 005e FF .byte -1 219 005f FF .byte -1 220 .global lines 223 lines: 224 0060 E0 .byte -32 225 0061 E0 .byte -32 226 0062 E0 .byte -32 227 0063 E0 .byte -32 228 0064 E0 .byte -32 229 0065 E0 .byte -32 230 0066 E0 .byte -32 231 0067 E0 .byte -32 232 0068 E1 .byte -31 233 0069 E2 .byte -30 234 006a E3 .byte -29 235 006b E4 .byte -28 236 .text 239 .global clock_scroll 241 clock_scroll: 1:main.c **** /****************************************** 2:main.c **** Background V1.02 firmware 3:main.c **** 4:main.c **** BackgroundPOV firmware is distributed under CC license. 5:main.c **** For more info on CC go to www.creativecommons.org 6:main.c **** For more info on SpokePOV go to www.ladyada.net/make/spokepov 7:main.c **** 8:main.c **** Creative Commons Deed 9:main.c **** Attribution-NonCommercial-ShareAlike 2.5 10:main.c **** You are free: 11:main.c **** * to copy, distribute, display, and perform the work 12:main.c **** * to make derivative works 13:main.c **** 14:main.c **** Under the following conditions: 15:main.c **** Attribution. 16:main.c **** You must attribute the work in the manner specified by the 17:main.c **** author or licensor. 18:main.c **** Noncommercial. 19:main.c **** You may not use this work for commercial purposes. 20:main.c **** Share Alike. 21:main.c **** If you alter, transform, or build upon this work, you may 22:main.c **** distribute the resulting work only under a license identical to this one. 23:main.c **** 24:main.c **** * For any reuse or distribution, you must make clear to others 25:main.c **** the license terms of this work. 26:main.c **** * Any of these conditions can be waived if you get permission 27:main.c **** from the copyright holder. 28:main.c **** 29:main.c **** Your fair use and other rights are in no way affected by the above. 30:main.c **** 31:main.c **** A more detailed version of this license is available at: 32:main.c **** http://creativecommons.org/licenses/by-nc-sa/2.5/legalcode 33:main.c **** ******************************************/ 34:main.c **** 35:main.c **** /* Modified from charPOV 1.09 by RJW to animations and bitmaps. Sort of */ 36:main.c **** /* full-circle from the original code */ 37:main.c **** 38:main.c **** /* Currently does not use the rotation offset or backside leds */ 39:main.c **** 40:main.c **** /* ANNOTATED by RJW - trebor@animeigo.com - to further my understanding */ 41:main.c **** /* of the code and environment before proceeding to make mods. All page */ 42:main.c **** /* numbers refer to the ATMEL ATTiny2313 documentation located at */ 43:main.c **** /* http://www.atmel.com/dyn/resources/prod_documents/doc2543.pdf */ 44:main.c **** 45:main.c **** /* Any comments implying any ignorance were made by RJW! The esteemed */ 46:main.c **** /* original author is by definition omniscient, and, it is feared, */ 47:main.c **** /* omnipotent as well... */ 48:main.c **** 49:main.c **** #include <avr/io.h> 50:main.c **** #include <avr/interrupt.h> 51:main.c **** 52:main.c **** /* We now store the data that's displayed on the SpokePOV in the flash */ 53:main.c **** /* memory. This requires using the PROGMEM routines. For more info about */ 54:main.c **** /* them, see: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=38003 */ 55:main.c **** /* IMPORTANT: read the erratta postings after the main posting, there are */ 56:main.c **** /* a couple that can bite you in the ass (esp: pgm_read_byte example) */ 57:main.c **** 58:main.c **** #include <avr/pgmspace.h> 59:main.c **** 60:main.c **** /* The spi_ transfer routines are now in eeprom.c. There is a define in */ 61:main.c **** /* eeprom.c as to whether they are functions or inline code */ 62:main.c **** 63:main.c **** #include "main.h" 64:main.c **** #include "eeprom.h" 65:main.c **** 66:main.c **** /* We always need to define nothing... */ 67:main.c **** 68:main.c **** #define NULL ((void *)0) 69:main.c **** 70:main.c **** /****************************************************************************/ 71:main.c **** /* */ 72:main.c **** /* IMPORTANT NOTE ABOUT VARIABLES! */ 73:main.c **** /* */ 74:main.c **** /* This firmware is on the ragged edge of running out of RAM for variables */ 75:main.c **** /* and stack when all the features are turned on. */ 76:main.c **** /* */ 77:main.c **** /* If you modify it and start seeing displays where some of the characters */ 78:main.c **** /* are displayed OK but others are mangled, this is a symptom that you have */ 79:main.c **** /* run out of RAM! */ 80:main.c **** /* */ 81:main.c **** /* REMEMBER: function calls use up RAM as well... */ 82:main.c **** /* */ 83:main.c **** /****************************************************************************/ 84:main.c **** 85:main.c **** /* Cute flag that can be used to easily comment out blocks of code */ 86:main.c **** 87:main.c **** #define DONOTCOMPILE 1 88:main.c **** 89:main.c **** /* Define the rotation direction of the SpokePOV, needed for proper bitmap */ 90:main.c **** /* display. In my case, commented out since I rotation counterclockwise */ 91:main.c **** 92:main.c **** // #define CLOCKWISE 1 93:main.c **** 94:main.c **** /* flag to determine whether we compile version that does smooth scrolling */ 95:main.c **** /* between lines, or the simpler jumping. COMMENT OUT to disable! */ 96:main.c **** /* Will almost always be the same as whatever the char firmware is doing */ 97:main.c **** 98:main.c **** #define SMOOTHSCROLL 1 99:main.c **** 100:main.c **** /* How many 8msec delays between each smooth scrolling increment. This */ 101:main.c **** /* time * 16 is the line scroll delay time, even if not smooth scrolling */ 102:main.c **** 103:main.c **** #define SCROLLSPEED 16 104:main.c **** 105:main.c **** /* How many lines does the display software skip when it moves between */ 106:main.c **** /* lines? Normally 1, but 2 can be useful for special effects like */ 107:main.c **** /* changing instantly between displays. Not really useful in the background*/ 108:main.c **** /* firmware, but still around for legacy reasons */ 109:main.c **** 110:main.c **** #define LINEINC 1 111:main.c **** 112:main.c **** /* The number of "lines" in our message - how many actual different displays*/ 113:main.c **** /* does the background cycle through. Each display can be a static */ 114:main.c **** /* background, a bitmap, or an animation of some sort. If another SpokePOV */ 115:main.c **** /* is running the char firmware and they start up at the same time, they */ 116:main.c **** /* will stay in rough sync. */ 117:main.c **** 118:main.c **** #define NUM_LINES 9 119:main.c **** 120:main.c **** /* The line codes. These define what each "line" will display, as follows: */ 121:main.c **** /* */ 122:main.c **** /* 0xFn Display bitmap n, n = 0,4,8,A */ 123:main.c **** /* */ 124:main.c **** /* 0xE0 Pacman animation, forward direction */ 125:main.c **** /* 0xE1 Pacman animation, left direction */ 126:main.c **** /* 0xE2 Pacman animation, right direction */ 127:main.c **** /* 0xE3 Pacman animation, backward direction */ 128:main.c **** /* 0xE4 Pacman animation, death of the little guy */ 129:main.c **** 130:main.c **** /* <0x80 Code is an index into the patterns array. This consists of 6 */ 131:main.c **** /* byte patterns that are shifted into the display. Things start */ 132:main.c **** /* with the first 4 bytes visible, then progress during the */ 133:main.c **** /* SMOOTHSCROLL to display the last 4 bytes. */ 134:main.c **** 135:main.c **** #define PAC_OPEN 0x30 // PacMan mode, mouth open/closed amts 136:main.c **** #define PAC_CLOSED 0x10 137:main.c **** #define PAC_OPEN_NEG 0xD0 // 0x0100-PAC_OPEN 138:main.c **** #define PAC_CLOSED_NEG 0xF0 // 0x0100-PAC_CLOSED 139:main.c **** 140:main.c **** const uint8_t lines[] PROGMEM = { 0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE1,0xE2,0xE3,0xE4 141:main.c **** }; 142:main.c **** 143:main.c **** /* Now the patterns array, which has all the patterns we need */ 144:main.c **** /* Remember, set bits are black, clear bits are white */ 145:main.c **** 146:main.c **** const uint8_t patterns[] PROGMEM = { 147:main.c **** 148:main.c **** 0x00,0x00,0x00,0x00,0x00,0x00, // 000 - Full White 149:main.c **** 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, // 006 - Full Black 150:main.c **** 0x00,0x00,0xFF,0xFF,0xFF,0xFF, // 012 - inner white, outer black, shifting to all black 151:main.c **** 0xFF,0xFF,0x00,0x00,0x00,0x00, // 018 - inner black, outer white, shifting to all white 152:main.c **** 0x00,0x00,0xFF,0xFF,0x00,0x00, // 024 - inner white, outer black, scrolling in white on edges 153:main.c **** 0xFF,0xFF,0x00,0x00,0xFF,0xFF, // 030 - inner black, outer white, scrolling in back on edges
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -