Skip to content

Commit

Permalink
#368 GBA matrixRotateYXZ_fast_asm (pre-shifted angles)
Browse files Browse the repository at this point in the history
  • Loading branch information
XProger committed Dec 3, 2022
1 parent f7d6d4d commit 4bb76c2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/fixed/common.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef H_COMMON
#define H_COMMON
//#define STATIC_ITEMS
#define PROFILING
//#define PROFILING
#ifdef PROFILING
#define STATIC_ITEMS
#define PROFILE_FRAMETIME
Expand Down
21 changes: 8 additions & 13 deletions src/platform/gba/asm/matrixFrame.s
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ angles .req r1 // arg
x .req pos
y .req angles
z .req r2
mask .req r3
packed .req r12

.extern matrixTranslateRel_asm, matrixRotateYXZ_asm
.extern matrixTranslateRel_asm, matrixRotateYXZ_fast_asm

.global matrixFrame_asm
matrixFrame_asm:
Expand All @@ -20,20 +21,14 @@ matrixFrame_asm:

bl matrixTranslateRel_asm // doesn't affect user mode r12

lsl z, packed, #22
asr z, #16
mov mask, #4096
sub mask, #4

lsr packed, #10

lsl y, packed, #22
asr y, #16

lsr packed, #10

lsl x, packed, #22
asr x, #16
and z, mask, packed, lsl #2
and y, mask, packed, lsr #(10 - 2)
and x, mask, packed, lsr #(20 - 2)

ldmfd sp!, {lr}
b matrixRotateYXZ_asm
b matrixRotateYXZ_fast_asm

// TODO matrixFrameLerp
3 changes: 2 additions & 1 deletion src/platform/gba/asm/matrixRotate.s
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ cosZ .req angleZ
mask .req tmp
mm .req tmp

.global matrixRotateYXZ_asm
.global matrixRotateYXZ_asm, matrixRotateYXZ_fast_asm
matrixRotateYXZ_asm:
mov mask, #0xFF
orr mask, mask, #0xF00 ; mask = 0xFFF
Expand All @@ -151,6 +151,7 @@ matrixRotateYXZ_asm:
and angleY, mask, angleY, lsr #4
and angleZ, mask, angleZ, lsr #4

matrixRotateYXZ_fast_asm:
orr mask, angleX, angleY
orrs mask, mask, angleZ
bxeq lr
Expand Down

0 comments on commit 4bb76c2

Please sign in to comment.