This commit is contained in:
Wolfgang Hottgenroth 2024-02-27 16:58:43 +01:00
parent 5c2a6c42d2
commit 155b7153e9
4 changed files with 53 additions and 76 deletions

View File

@ -10,7 +10,7 @@ ASFLAGS=$(COMMON) -D__ASSEMBLER__
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) $^
$(OBJDUMP) -D $(ARTIFACT).elf > $(ARTIFACT).txt

44
colors.S Normal file
View 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

View File

@ -14,6 +14,8 @@
#define _springgreen 0x09
#define _chartreuse 0x0a
#define _yellow 0x0b
#define _white 0x0c
#define _off 0x0d

81
main.S
View File

@ -16,78 +16,9 @@ screendata:
screendataend:
.byte 0xff
.section ".rodata","a"
screendata_tmpl:
.byte _blue
.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
.section ".rodata"
.extern screendata_tmpl
.extern colors
;; .text is the name of the section, it is a hint for the linker to
;; allocate the section
@ -183,7 +114,7 @@ mainloop_wait_for_isr_0:
bit #0x01,r4
jz mainloop_wait_for_isr_0
;; load data
mov.b colors1(r9), r5
mov.b colors(r9), r5
;; clear BYTE_DONE
bic #0x01, r4
mainloop_wait_for_isr_1:
@ -191,7 +122,7 @@ mainloop_wait_for_isr_1:
bit #0x01,r4
jz mainloop_wait_for_isr_1
;; load data
mov.b colors2(r9), r5
mov.b colors+1(r9), r5
;; clear BYTE_DONE
bic #0x01, r4
mainloop_wait_for_isr_2:
@ -199,7 +130,7 @@ mainloop_wait_for_isr_2:
bit #0x01,r4
jz mainloop_wait_for_isr_2
;; load data
mov.b colors3(r9), r5
mov.b colors+2(r9), r5
;; clear BYTE_DONE
bic #0x01, r4