aboutsummaryrefslogtreecommitdiff
path: root/plugins/gpu_unai/gpu_arm.s
diff options
context:
space:
mode:
authornotaz2011-12-20 02:38:53 +0200
committernotaz2011-12-20 23:40:51 +0200
commitb3db94096d7e5b4f60d610a441e370d639b3fd06 (patch)
tree2b8d0aa0d4e2a07b36cb21b3725b79e2b6990f72 /plugins/gpu_unai/gpu_arm.s
parent89c0de4234815e0fa9e8399b940ecec6c89a062b (diff)
downloadpcsx_rearmed-b3db94096d7e5b4f60d610a441e370d639b3fd06.tar.gz
pcsx_rearmed-b3db94096d7e5b4f60d610a441e370d639b3fd06.tar.bz2
pcsx_rearmed-b3db94096d7e5b4f60d610a441e370d639b3fd06.zip
gpu_unai: add 4bpp asm sprite blitter
Diffstat (limited to 'plugins/gpu_unai/gpu_arm.s')
-rw-r--r--plugins/gpu_unai/gpu_arm.s55
1 files changed, 55 insertions, 0 deletions
diff --git a/plugins/gpu_unai/gpu_arm.s b/plugins/gpu_unai/gpu_arm.s
new file mode 100644
index 0000000..a2fa174
--- /dev/null
+++ b/plugins/gpu_unai/gpu_arm.s
@@ -0,0 +1,55 @@
+/*
+ * (C) GraÅžvydas "notaz" Ignotas, 2011
+ *
+ * This work is licensed under the terms of GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+
+.text
+.align 2
+
+@ in: r0=dst, r2=pal, r12=0x1e
+@ trashes r6-r8,lr,flags
+.macro do_4_pixels rs ibase obase
+.if \ibase - 1 < 0
+ and r6, r12, \rs, lsl #1
+.else
+ and r6, r12, \rs, lsr #\ibase-1
+.endif
+ and r7, r12, \rs, lsr #\ibase+3
+ and r8, r12, \rs, lsr #\ibase+7
+ and lr, r12, \rs, lsr #\ibase+11
+ ldrh r6, [r2, r6]
+ ldrh r7, [r2, r7]
+ ldrh r8, [r2, r8]
+ ldrh lr, [r2, lr]
+ tst r6, r6
+ strneh r6, [r0, #\obase+0]
+ tst r7, r7
+ strneh r7, [r0, #\obase+2]
+ tst r8, r8
+ strneh r8, [r0, #\obase+4]
+ tst lr, lr
+ strneh lr, [r0, #\obase+6]
+.endm
+
+.global draw_spr16_full @ (u16 *d, void *s, u16 *pal, int lines)
+draw_spr16_full:
+ stmfd sp!, {r4-r8,lr}
+ mov r12, #0x1e @ empty pixel
+
+0:
+ ldmia r1, {r4,r5}
+ do_4_pixels r4, 0, 0
+ do_4_pixels r4, 16, 8
+ do_4_pixels r5, 0, 16
+ do_4_pixels r5, 16, 24
+ subs r3, #1
+ add r0, #2048
+ add r1, #2048
+ bgt 0b
+
+ ldmfd sp!, {r4-r8,pc}
+
+@ vim:filetype=armasm