code beautified
This commit is contained in:
65
colors.S
65
colors.S
@ -1,71 +1,6 @@
|
|||||||
#include "colors.h"
|
#include "colors.h"
|
||||||
|
|
||||||
.section ".rodata","a"
|
.section ".rodata","a"
|
||||||
screendata_tmpl:
|
|
||||||
.global screendata_tmpl
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
.byte _red
|
|
||||||
screendataend_tmpl:
|
|
||||||
.byte 0xff
|
|
||||||
|
|
||||||
;; color definitions according to
|
;; color definitions according to
|
||||||
;; https://learn.sparkfun.com/tutorials/lilypad-protosnap-plus-activity-guide/3-custom-color-mixing
|
;; https://learn.sparkfun.com/tutorials/lilypad-protosnap-plus-activity-guide/3-custom-color-mixing
|
||||||
colors:
|
colors:
|
||||||
|
22
main.S
22
main.S
@ -25,9 +25,6 @@
|
|||||||
;; ----------------------------------------------------
|
;; ----------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;; 2.48us
|
;; 2.48us
|
||||||
#define TIMER_COMPLETE 45
|
#define TIMER_COMPLETE 45
|
||||||
;; 1.18us
|
;; 1.18us
|
||||||
@ -71,6 +68,7 @@ data_forward_pointer:
|
|||||||
;; @progbits is a hint for the linker to allocate this section into
|
;; @progbits is a hint for the linker to allocate this section into
|
||||||
;; program memory (flash)
|
;; program memory (flash)
|
||||||
.section ".text","ax",@progbits
|
.section ".text","ax",@progbits
|
||||||
|
;; ----------------------------------------------------
|
||||||
_start:
|
_start:
|
||||||
;; disable watchdog
|
;; disable watchdog
|
||||||
mov.w #WDTPW|WDTHOLD,&WDTCTL
|
mov.w #WDTPW|WDTHOLD,&WDTCTL
|
||||||
@ -84,8 +82,6 @@ _start:
|
|||||||
;; initialize stack pointer with value from linker
|
;; initialize stack pointer with value from linker
|
||||||
mov.w #__stack, SP
|
mov.w #__stack, SP
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
init:
|
init:
|
||||||
;; configuration of GPIO Ports
|
;; configuration of GPIO Ports
|
||||||
;; BIT0: data bit
|
;; BIT0: data bit
|
||||||
@ -112,7 +108,6 @@ init:
|
|||||||
mov.w #OUTMOD_7,&TA1CCTL1
|
mov.w #OUTMOD_7,&TA1CCTL1
|
||||||
mov.w #OUTMOD_7,&TA1CCTL2
|
mov.w #OUTMOD_7,&TA1CCTL2
|
||||||
|
|
||||||
|
|
||||||
;; make sure the isr will not immediately start
|
;; make sure the isr will not immediately start
|
||||||
mov.b #SIGNAL_INIT_VALUE, SIGNAL_REGISTER
|
mov.b #SIGNAL_INIT_VALUE, SIGNAL_REGISTER
|
||||||
|
|
||||||
@ -121,6 +116,8 @@ init:
|
|||||||
;; enable interrupts
|
;; enable interrupts
|
||||||
eint
|
eint
|
||||||
|
|
||||||
|
|
||||||
|
;; ----------------------------------------------------
|
||||||
mainloop:
|
mainloop:
|
||||||
call #forwardscreen_init
|
call #forwardscreen_init
|
||||||
call #resetscreen
|
call #resetscreen
|
||||||
@ -134,6 +131,7 @@ mainloop_draw:
|
|||||||
jmp mainloop_draw
|
jmp mainloop_draw
|
||||||
|
|
||||||
|
|
||||||
|
;; ----------------------------------------------------
|
||||||
wait:
|
wait:
|
||||||
push r11
|
push r11
|
||||||
push r12
|
push r12
|
||||||
@ -151,10 +149,13 @@ wait_continue_2:
|
|||||||
pop r11
|
pop r11
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
;; ----------------------------------------------------
|
||||||
forwardscreen_init:
|
forwardscreen_init:
|
||||||
mov.w #screendata, &data_forward_pointer
|
mov.w #screendata, &data_forward_pointer
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
;; ----------------------------------------------------
|
||||||
forwardscreen:
|
forwardscreen:
|
||||||
push r8
|
push r8
|
||||||
push r10
|
push r10
|
||||||
@ -163,7 +164,7 @@ forwardscreen:
|
|||||||
mov.w data_forward_pointer, r10
|
mov.w data_forward_pointer, r10
|
||||||
mov.b #_off, @r10
|
mov.b #_off, @r10
|
||||||
inc.w r10
|
inc.w r10
|
||||||
mov.b #_red, @r10
|
mov.b #_green, @r10
|
||||||
cmp.w r10, r8
|
cmp.w r10, r8
|
||||||
jnz forwardscreen_done
|
jnz forwardscreen_done
|
||||||
mov.w #screendata, r10
|
mov.w #screendata, r10
|
||||||
@ -175,6 +176,7 @@ forwardscreen_done:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
;; ----------------------------------------------------
|
||||||
resetscreen:
|
resetscreen:
|
||||||
push r7
|
push r7
|
||||||
push r8
|
push r8
|
||||||
@ -193,6 +195,7 @@ resetscreen_continue:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
;; ----------------------------------------------------
|
||||||
drawscreen:
|
drawscreen:
|
||||||
push r7
|
push r7
|
||||||
push r8
|
push r8
|
||||||
@ -266,8 +269,7 @@ drawscreen_data_done:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
;; ----------------------------------------------------
|
||||||
|
|
||||||
; --- timer isr ---
|
; --- timer isr ---
|
||||||
;; r6: exclusively used by isr as bit-counter
|
;; r6: exclusively used by isr as bit-counter
|
||||||
timer1_a0_isr:
|
timer1_a0_isr:
|
||||||
@ -308,7 +310,7 @@ timer1_a0_isr_exit:
|
|||||||
reti
|
reti
|
||||||
|
|
||||||
|
|
||||||
|
;; ----------------------------------------------------
|
||||||
.section "__interrupt_vector_14","ax",@progbits
|
.section "__interrupt_vector_14","ax",@progbits
|
||||||
.word timer1_a0_isr
|
.word timer1_a0_isr
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user