refactor
This commit is contained in:
parent
5c2a6c42d2
commit
155b7153e9
2
Makefile
2
Makefile
@ -10,7 +10,7 @@ ASFLAGS=$(COMMON) -D__ASSEMBLER__
|
|||||||
|
|
||||||
LDFLAGS=-L $(TOOLCHAIN_PREFIX)/include -Wl,-Map,firmware.map -nostdlib -nostartfiles -T $(MCU).ld
|
LDFLAGS=-L $(TOOLCHAIN_PREFIX)/include -Wl,-Map,firmware.map -nostdlib -nostartfiles -T $(MCU).ld
|
||||||
|
|
||||||
$(ARTIFACT).elf: main.o
|
$(ARTIFACT).elf: colors.o main.o
|
||||||
$(CC) -o $@ $(LDFLAGS) $^
|
$(CC) -o $@ $(LDFLAGS) $^
|
||||||
$(OBJDUMP) -D $(ARTIFACT).elf > $(ARTIFACT).txt
|
$(OBJDUMP) -D $(ARTIFACT).elf > $(ARTIFACT).txt
|
||||||
|
|
||||||
|
44
colors.S
Normal file
44
colors.S
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#include "colors.h"
|
||||||
|
|
||||||
|
.section ".rodata","a"
|
||||||
|
screendata_tmpl:
|
||||||
|
.global screendata_tmpl
|
||||||
|
.byte _red
|
||||||
|
.byte _off
|
||||||
|
.byte _white
|
||||||
|
screendataend_tmpl:
|
||||||
|
.byte 0xff
|
||||||
|
|
||||||
|
;; color definitions according to https://learn.sparkfun.com/tutorials/lilypad-protosnap-plus-activity-guide/3-custom-color-mixing
|
||||||
|
colors:
|
||||||
|
.global colors
|
||||||
|
;; red, green, blue, padding
|
||||||
|
red:
|
||||||
|
.byte 0xff, 0x00, 0x00, 0
|
||||||
|
blue:
|
||||||
|
.byte 0x00, 0x00, 0xff, 0
|
||||||
|
green:
|
||||||
|
.byte 0x00, 0xff, 0x00, 0
|
||||||
|
orange:
|
||||||
|
.byte 0xff, 0x80, 0x00, 0
|
||||||
|
rose:
|
||||||
|
.byte 0xff, 0x00, 0x80, 0
|
||||||
|
magenta:
|
||||||
|
.byte 0xff, 0x00, 0xff, 0
|
||||||
|
violet:
|
||||||
|
.byte 0x80, 0x00, 0xff, 0
|
||||||
|
azure:
|
||||||
|
.byte 0x00, 0x80, 0xff, 0
|
||||||
|
cyan:
|
||||||
|
.byte 0x00, 0xff, 0xff, 0
|
||||||
|
springgreen:
|
||||||
|
.byte 0x00, 0xff, 0x80, 0
|
||||||
|
chartreuse:
|
||||||
|
.byte 0x80, 0xff, 0x00, 0
|
||||||
|
yellow:
|
||||||
|
.byte 0xff, 0xff, 0x00, 0
|
||||||
|
white:
|
||||||
|
.byte 0xff, 0xff, 0xff, 0
|
||||||
|
off:
|
||||||
|
.byte 0x00, 0x00, 0x00, 0
|
||||||
|
|
2
colors.h
2
colors.h
@ -14,6 +14,8 @@
|
|||||||
#define _springgreen 0x09
|
#define _springgreen 0x09
|
||||||
#define _chartreuse 0x0a
|
#define _chartreuse 0x0a
|
||||||
#define _yellow 0x0b
|
#define _yellow 0x0b
|
||||||
|
#define _white 0x0c
|
||||||
|
#define _off 0x0d
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
81
main.S
81
main.S
@ -16,78 +16,9 @@ screendata:
|
|||||||
screendataend:
|
screendataend:
|
||||||
.byte 0xff
|
.byte 0xff
|
||||||
|
|
||||||
.section ".rodata","a"
|
.section ".rodata"
|
||||||
screendata_tmpl:
|
.extern screendata_tmpl
|
||||||
.byte _blue
|
.extern colors
|
||||||
.byte _red
|
|
||||||
.byte _blue
|
|
||||||
screendataend_tmpl:
|
|
||||||
.byte 0xff
|
|
||||||
|
|
||||||
;; color definitions according to https://learn.sparkfun.com/tutorials/lilypad-protosnap-plus-activity-guide/3-custom-color-mixing
|
|
||||||
red:
|
|
||||||
colors1:
|
|
||||||
.byte 0xff ;; red
|
|
||||||
colors2:
|
|
||||||
.byte 0x00 ;; green
|
|
||||||
colors3:
|
|
||||||
.byte 0x00 ;; blue
|
|
||||||
.byte 0
|
|
||||||
blue:
|
|
||||||
.byte 0x00
|
|
||||||
.byte 0x00
|
|
||||||
.byte 0xff
|
|
||||||
.byte 0
|
|
||||||
green:
|
|
||||||
.byte 0x00
|
|
||||||
.byte 0xff
|
|
||||||
.byte 0x00
|
|
||||||
.byte 0
|
|
||||||
orange:
|
|
||||||
.byte 0xff
|
|
||||||
.byte 0x80
|
|
||||||
.byte 0x00
|
|
||||||
.byte 0
|
|
||||||
rose:
|
|
||||||
.byte 0xff
|
|
||||||
.byte 0x00
|
|
||||||
.byte 0x80
|
|
||||||
.byte 0
|
|
||||||
magenta:
|
|
||||||
.byte 0xff
|
|
||||||
.byte 0x00
|
|
||||||
.byte 0xff
|
|
||||||
.byte 0
|
|
||||||
violet:
|
|
||||||
.byte 0x80
|
|
||||||
.byte 0x00
|
|
||||||
.byte 0xff
|
|
||||||
.byte 0
|
|
||||||
azure:
|
|
||||||
.byte 0x00
|
|
||||||
.byte 0x80
|
|
||||||
.byte 0xff
|
|
||||||
.byte 0
|
|
||||||
cyan:
|
|
||||||
.byte 0x00
|
|
||||||
.byte 0xff
|
|
||||||
.byte 0xff
|
|
||||||
.byte 0
|
|
||||||
springgreen:
|
|
||||||
.byte 0x00
|
|
||||||
.byte 0xff
|
|
||||||
.byte 0x80
|
|
||||||
.byte 0
|
|
||||||
chartreuse:
|
|
||||||
.byte 0x80
|
|
||||||
.byte 0xff
|
|
||||||
.byte 0x00
|
|
||||||
.byte 0
|
|
||||||
yellow:
|
|
||||||
.byte 0xff
|
|
||||||
.byte 0xff
|
|
||||||
.byte 0x00
|
|
||||||
.byte 0
|
|
||||||
|
|
||||||
;; .text is the name of the section, it is a hint for the linker to
|
;; .text is the name of the section, it is a hint for the linker to
|
||||||
;; allocate the section
|
;; allocate the section
|
||||||
@ -183,7 +114,7 @@ mainloop_wait_for_isr_0:
|
|||||||
bit #0x01,r4
|
bit #0x01,r4
|
||||||
jz mainloop_wait_for_isr_0
|
jz mainloop_wait_for_isr_0
|
||||||
;; load data
|
;; load data
|
||||||
mov.b colors1(r9), r5
|
mov.b colors(r9), r5
|
||||||
;; clear BYTE_DONE
|
;; clear BYTE_DONE
|
||||||
bic #0x01, r4
|
bic #0x01, r4
|
||||||
mainloop_wait_for_isr_1:
|
mainloop_wait_for_isr_1:
|
||||||
@ -191,7 +122,7 @@ mainloop_wait_for_isr_1:
|
|||||||
bit #0x01,r4
|
bit #0x01,r4
|
||||||
jz mainloop_wait_for_isr_1
|
jz mainloop_wait_for_isr_1
|
||||||
;; load data
|
;; load data
|
||||||
mov.b colors2(r9), r5
|
mov.b colors+1(r9), r5
|
||||||
;; clear BYTE_DONE
|
;; clear BYTE_DONE
|
||||||
bic #0x01, r4
|
bic #0x01, r4
|
||||||
mainloop_wait_for_isr_2:
|
mainloop_wait_for_isr_2:
|
||||||
@ -199,7 +130,7 @@ mainloop_wait_for_isr_2:
|
|||||||
bit #0x01,r4
|
bit #0x01,r4
|
||||||
jz mainloop_wait_for_isr_2
|
jz mainloop_wait_for_isr_2
|
||||||
;; load data
|
;; load data
|
||||||
mov.b colors3(r9), r5
|
mov.b colors+2(r9), r5
|
||||||
;; clear BYTE_DONE
|
;; clear BYTE_DONE
|
||||||
bic #0x01, r4
|
bic #0x01, r4
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user