Created
August 2, 2020 19:43
-
-
Save Wren6991/69774698bbaa744284c57f4550a9f4de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.syntax unified | |
.cpu cortex-m0plus | |
.thumb | |
#ifndef FONT_BLIT_UNROLL | |
#define FONT_BLIT_UNROLL 4 | |
#endif | |
.macro decl_func name | |
.global \name | |
.type \name,%function | |
.thumb_func | |
\name: | |
.endm | |
.altmacro | |
.macro for_loop count body | |
.set i, 0 | |
.rept \count | |
body %i | |
.set i,i+1 | |
.endr | |
.endm | |
.macro font8_blit_body i | |
ldrb r2, [r1, #\i] | |
lsls r2, #5 // 8px font, 4 byte/pix | |
adds r2, r3 | |
ldmia r2!, {r4-r7} | |
stmia r0!, {r4-r7} | |
ldmia r2!, {r4-r7} | |
stmia r0!, {r4-r7} | |
.endm | |
// r0: dst | |
// r1: src | |
// r2: len in characters | |
// r3: font line pointer | |
decl_func font8_blit | |
push {r4-r7, lr} | |
adds r2, r1 | |
mov ip, r2 | |
b 2f | |
1: | |
for_loop FONT_BLIT_UNROLL font8_blit_body | |
adds r1, #FONT_BLIT_UNROLL | |
2: | |
cmp r1, ip | |
blo 1b | |
pop {r4-r7, pc} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment