39 lines
658 B
ArmAsm
39 lines
658 B
ArmAsm
|
|
#include <avr/io.h>
|
|
#define FRAME_SIZE 8
|
|
|
|
.section .text
|
|
;
|
|
.global copy_layer
|
|
.type copy_layer, @function
|
|
copy_layer:
|
|
movw X, r24 ; Source frame.
|
|
movw Z, r22 ; Target frame.
|
|
ldi r24, FRAME_SIZE*2 ; Number of iterations needed.
|
|
|
|
copy:
|
|
ld r0, X+
|
|
st Z+, r0
|
|
dec r24
|
|
brne copy
|
|
|
|
ret
|
|
|
|
|
|
.global push_layer
|
|
.type push_layer, @function
|
|
push_layer:
|
|
movw X, r24 ; Source frame.
|
|
movw Z, r22 ; Target frame.
|
|
ldi r24, FRAME_SIZE ; Number of iterations needed.
|
|
|
|
push:
|
|
ldd r0, Z+1
|
|
st Z+, r0
|
|
ld r0, X+
|
|
st Z+, r0
|
|
dec r24
|
|
brne push
|
|
|
|
ret
|
|
|