![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
9 tile screen working with one image space, platform for development
frameout.s@0:8b26631e8c70, 2012-03-06 (annotated)
- Committer:
- rsavitski
- Date:
- Tue Mar 06 19:58:34 2012 +0000
- Revision:
- 0:8b26631e8c70
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rsavitski | 0:8b26631e8c70 | 1 | AREA framefunc, CODE, READONLY |
rsavitski | 0:8b26631e8c70 | 2 | ; Export my_asm function location so that C compiler can find it and link |
rsavitski | 0:8b26631e8c70 | 3 | EXPORT frameout |
rsavitski | 0:8b26631e8c70 | 4 | frameout |
rsavitski | 0:8b26631e8c70 | 5 | |
rsavitski | 0:8b26631e8c70 | 6 | ; r0 - dsVal array base address |
rsavitski | 0:8b26631e8c70 | 7 | ; r1 - data array base address |
rsavitski | 0:8b26631e8c70 | 8 | ; r2 - base address for port 0 |
rsavitski | 0:8b26631e8c70 | 9 | ; r3 - loop counter |
rsavitski | 0:8b26631e8c70 | 10 | ; r4 - sclk bitmask |
rsavitski | 0:8b26631e8c70 | 11 | ; r5 - RGB channels bitmask |
rsavitski | 0:8b26631e8c70 | 12 | ; r6 - data reg 1 |
rsavitski | 0:8b26631e8c70 | 13 | ; r7 - data reg 2 |
rsavitski | 0:8b26631e8c70 | 14 | ; r8 - temporary value holding intensity info (used as an offset into dsVal array) |
rsavitski | 0:8b26631e8c70 | 15 | |
rsavitski | 0:8b26631e8c70 | 16 | |
rsavitski | 0:8b26631e8c70 | 17 | ; Save state |
rsavitski | 0:8b26631e8c70 | 18 | PUSH {R4, R5, R6, R7, R8} |
rsavitski | 0:8b26631e8c70 | 19 | |
rsavitski | 0:8b26631e8c70 | 20 | ; Load GPIO Port 0 base address in register R6 |
rsavitski | 0:8b26631e8c70 | 21 | LDR R2, =0x2009C000 ; GPIO port 0 base address |
rsavitski | 0:8b26631e8c70 | 22 | |
rsavitski | 0:8b26631e8c70 | 23 | ; R3 - loop counter |
rsavitski | 0:8b26631e8c70 | 24 | MOV R3, #256 |
rsavitski | 0:8b26631e8c70 | 25 | |
rsavitski | 0:8b26631e8c70 | 26 | ; sclk mask |
rsavitski | 0:8b26631e8c70 | 27 | MOV R4, #0x00010000 ; sclk bitmask |
rsavitski | 0:8b26631e8c70 | 28 | |
rsavitski | 0:8b26631e8c70 | 29 | LOOP |
rsavitski | 0:8b26631e8c70 | 30 | |
rsavitski | 0:8b26631e8c70 | 31 | ;NOTE clocking swapped due to inverter used for logic levels |
rsavitski | 0:8b26631e8c70 | 32 | |
rsavitski | 0:8b26631e8c70 | 33 | MOV R5, #0x03800000 ; bitmask for RGB bits |
rsavitski | 0:8b26631e8c70 | 34 | STR R4, [R2, #0x1C] ; cleark clk to clock in data (negative edge) |
rsavitski | 0:8b26631e8c70 | 35 | |
rsavitski | 0:8b26631e8c70 | 36 | |
rsavitski | 0:8b26631e8c70 | 37 | STR R5, [R2, #0x1C] ; clear RGB via FIOCLEAR |
rsavitski | 0:8b26631e8c70 | 38 | |
rsavitski | 0:8b26631e8c70 | 39 | ; R channel |
rsavitski | 0:8b26631e8c70 | 40 | LDRB R8, [R1], #1 ; read data word (0-255 intensity) and post-increment array pointer to point to next word in data |
rsavitski | 0:8b26631e8c70 | 41 | LDRB R6, [R0, R8] ; loading on/off state from dsVal, pointed to by offset equal to intensity of data |
rsavitski | 0:8b26631e8c70 | 42 | |
rsavitski | 0:8b26631e8c70 | 43 | |
rsavitski | 0:8b26631e8c70 | 44 | ; G channel |
rsavitski | 0:8b26631e8c70 | 45 | LDRB R8, [R1], #1 ; read data word (0-255 intensity) into R8 and post-increment to point to next word in data |
rsavitski | 0:8b26631e8c70 | 46 | LDRB R7, [R0, R8] ; loading on/off state from dsVal, pointed to by offset equal to intensity of data |
rsavitski | 0:8b26631e8c70 | 47 | |
rsavitski | 0:8b26631e8c70 | 48 | AND R7, R7, #0x2 ; pick blue channel bit |
rsavitski | 0:8b26631e8c70 | 49 | |
rsavitski | 0:8b26631e8c70 | 50 | ORR R6, R7, R6, lsr #7 ; store RG bits in R6 with clever stuff in R chan |
rsavitski | 0:8b26631e8c70 | 51 | |
rsavitski | 0:8b26631e8c70 | 52 | ; B channel |
rsavitski | 0:8b26631e8c70 | 53 | LDRB R8, [R1], #1 ; read data word (0-255 intensity) into R8 and post-increment to point to next word in data |
rsavitski | 0:8b26631e8c70 | 54 | LDRB R7, [R0, R8] ; loading on/off state from dsVal, pointed to by offset equal to intensity of data |
rsavitski | 0:8b26631e8c70 | 55 | |
rsavitski | 0:8b26631e8c70 | 56 | AND R7, R7, #0x4 ; pick green channel bit |
rsavitski | 0:8b26631e8c70 | 57 | |
rsavitski | 0:8b26631e8c70 | 58 | ; writing to output |
rsavitski | 0:8b26631e8c70 | 59 | ORR R6, R6, R7 ; RGB bits in R6 |
rsavitski | 0:8b26631e8c70 | 60 | |
rsavitski | 0:8b26631e8c70 | 61 | MOV R6, R6, lsl #23 |
rsavitski | 0:8b26631e8c70 | 62 | |
rsavitski | 0:8b26631e8c70 | 63 | STR R6, [R2,#0x18] ; FIOSET on/off for LED |
rsavitski | 0:8b26631e8c70 | 64 | |
rsavitski | 0:8b26631e8c70 | 65 | ;SUB R1, R1, #3 |
rsavitski | 0:8b26631e8c70 | 66 | |
rsavitski | 0:8b26631e8c70 | 67 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
rsavitski | 0:8b26631e8c70 | 68 | |
rsavitski | 0:8b26631e8c70 | 69 | |
rsavitski | 0:8b26631e8c70 | 70 | MOV R5, #0x00000380 ; bitmask for RGB bits |
rsavitski | 0:8b26631e8c70 | 71 | |
rsavitski | 0:8b26631e8c70 | 72 | STR R5, [R2, #0x1C] ; clear RGB via FIOCLEAR |
rsavitski | 0:8b26631e8c70 | 73 | |
rsavitski | 0:8b26631e8c70 | 74 | ; R channel |
rsavitski | 0:8b26631e8c70 | 75 | LDRB R8, [R1], #1 ; read data word (0-255 intensity) and post-increment array pointer to point to next word in data |
rsavitski | 0:8b26631e8c70 | 76 | LDRB R6, [R0, R8] ; loading on/off state from dsVal, pointed to by offset equal to intensity of data |
rsavitski | 0:8b26631e8c70 | 77 | |
rsavitski | 0:8b26631e8c70 | 78 | |
rsavitski | 0:8b26631e8c70 | 79 | ; G channel |
rsavitski | 0:8b26631e8c70 | 80 | LDRB R8, [R1], #1 ; read data word (0-255 intensity) into R8 and post-increment to point to next word in data |
rsavitski | 0:8b26631e8c70 | 81 | LDRB R7, [R0, R8] ; loading on/off state from dsVal, pointed to by offset equal to intensity of data |
rsavitski | 0:8b26631e8c70 | 82 | |
rsavitski | 0:8b26631e8c70 | 83 | AND R7, R7, #0x2 ; pick blue channel bit |
rsavitski | 0:8b26631e8c70 | 84 | |
rsavitski | 0:8b26631e8c70 | 85 | ORR R6, R7, R6, lsr #7 ; store RG bits in R6 with clever stuff in R chan |
rsavitski | 0:8b26631e8c70 | 86 | |
rsavitski | 0:8b26631e8c70 | 87 | ; B channel |
rsavitski | 0:8b26631e8c70 | 88 | LDRB R8, [R1], #1 ; read data word (0-255 intensity) into R8 and post-increment to point to next word in data |
rsavitski | 0:8b26631e8c70 | 89 | LDRB R7, [R0, R8] ; loading on/off state from dsVal, pointed to by offset equal to intensity of data |
rsavitski | 0:8b26631e8c70 | 90 | |
rsavitski | 0:8b26631e8c70 | 91 | AND R7, R7, #0x4 ; pick green channel bit |
rsavitski | 0:8b26631e8c70 | 92 | |
rsavitski | 0:8b26631e8c70 | 93 | ; writing to output |
rsavitski | 0:8b26631e8c70 | 94 | ORR R6, R6, R7 ; RGB bits in R6 |
rsavitski | 0:8b26631e8c70 | 95 | |
rsavitski | 0:8b26631e8c70 | 96 | MOV R6, R6, lsl #7 |
rsavitski | 0:8b26631e8c70 | 97 | |
rsavitski | 0:8b26631e8c70 | 98 | STR R6, [R2,#0x18] ; FIOSET on/off for LED |
rsavitski | 0:8b26631e8c70 | 99 | |
rsavitski | 0:8b26631e8c70 | 100 | ;SUB R1, R1, #3 |
rsavitski | 0:8b26631e8c70 | 101 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
rsavitski | 0:8b26631e8c70 | 102 | |
rsavitski | 0:8b26631e8c70 | 103 | |
rsavitski | 0:8b26631e8c70 | 104 | MOV R5, #0x00068000 ; bitmask for RGB bits |
rsavitski | 0:8b26631e8c70 | 105 | |
rsavitski | 0:8b26631e8c70 | 106 | STR R5, [R2, #0x1C] ; clear RGB via FIOCLEAR |
rsavitski | 0:8b26631e8c70 | 107 | |
rsavitski | 0:8b26631e8c70 | 108 | ; R channel |
rsavitski | 0:8b26631e8c70 | 109 | LDRB R8, [R1], #1 ; read data word (0-255 intensity) and post-increment array pointer to point to next word in data |
rsavitski | 0:8b26631e8c70 | 110 | LDRB R6, [R0, R8] ; loading on/off state from dsVal, pointed to by offset equal to intensity of data |
rsavitski | 0:8b26631e8c70 | 111 | |
rsavitski | 0:8b26631e8c70 | 112 | |
rsavitski | 0:8b26631e8c70 | 113 | ; G channel |
rsavitski | 0:8b26631e8c70 | 114 | LDRB R8, [R1], #1 ; read data word (0-255 intensity) into R8 and post-increment to point to next word in data |
rsavitski | 0:8b26631e8c70 | 115 | LDRB R7, [R0, R8] ; loading on/off state from dsVal, pointed to by offset equal to intensity of data |
rsavitski | 0:8b26631e8c70 | 116 | |
rsavitski | 0:8b26631e8c70 | 117 | AND R7, R7, #0x4 ; pick blue channel bit |
rsavitski | 0:8b26631e8c70 | 118 | |
rsavitski | 0:8b26631e8c70 | 119 | ORR R6, R7, R6, lsr #7 ; store RG bits in R6 with clever stuff in R chan |
rsavitski | 0:8b26631e8c70 | 120 | |
rsavitski | 0:8b26631e8c70 | 121 | ; B channel |
rsavitski | 0:8b26631e8c70 | 122 | LDRB R8, [R1], #1 ; read data word (0-255 intensity) into R8 and post-increment to point to next word in data |
rsavitski | 0:8b26631e8c70 | 123 | LDRB R7, [R0, R8] ; loading on/off state from dsVal, pointed to by offset equal to intensity of data |
rsavitski | 0:8b26631e8c70 | 124 | |
rsavitski | 0:8b26631e8c70 | 125 | AND R7, R7, #0x8 ; pick green channel bit |
rsavitski | 0:8b26631e8c70 | 126 | |
rsavitski | 0:8b26631e8c70 | 127 | ; writing to output |
rsavitski | 0:8b26631e8c70 | 128 | ORR R6, R6, R7 ; RGB bits in R6 |
rsavitski | 0:8b26631e8c70 | 129 | |
rsavitski | 0:8b26631e8c70 | 130 | MOV R6, R6, lsl #15 |
rsavitski | 0:8b26631e8c70 | 131 | |
rsavitski | 0:8b26631e8c70 | 132 | STR R6, [R2,#0x18] ; FIOSET on/off for LED |
rsavitski | 0:8b26631e8c70 | 133 | |
rsavitski | 0:8b26631e8c70 | 134 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
rsavitski | 0:8b26631e8c70 | 135 | |
rsavitski | 0:8b26631e8c70 | 136 | SUBS R3, R3, #0x1 ; decrement loop counter |
rsavitski | 0:8b26631e8c70 | 137 | |
rsavitski | 0:8b26631e8c70 | 138 | STR R4, [R2, #0x18] ; setting clock high |
rsavitski | 0:8b26631e8c70 | 139 | |
rsavitski | 0:8b26631e8c70 | 140 | |
rsavitski | 0:8b26631e8c70 | 141 | BNE LOOP |
rsavitski | 0:8b26631e8c70 | 142 | |
rsavitski | 0:8b26631e8c70 | 143 | POP {R4, R5, R6, R7, R8} |
rsavitski | 0:8b26631e8c70 | 144 | |
rsavitski | 0:8b26631e8c70 | 145 | BX LR |
rsavitski | 0:8b26631e8c70 | 146 | END |