+@ vim:filetype=armasm\r
+\r
@ assembly "optimized" version of some funtions from draw.c\r
@ this is highly specialized, be careful if changing related C code!\r
\r
\r
FinalizeLineRGB555:\r
stmfd sp!, {r4-r8,lr}\r
- ldr r5, =(Pico+0x22228) @ Pico.video\r
+ ldr r8, =(Pico+0x22228) @ Pico.video\r
ldr r4, =HighPal\r
\r
- ldrb r7, [r5, #-0x1a] @ 0x2220e ~ dirtyPal\r
+ ldrb r7, [r8, #-0x1a] @ 0x2220e ~ dirtyPal\r
mov r6, r0\r
mov r1, #0\r
tst r7, r7\r
beq .fl_noconvRGB555\r
- strb r1, [r5, #-0x1a]\r
- sub r1, r5, #0x128 @ r1=Pico.cram\r
+ strb r1, [r8, #-0x1a]\r
+ sub r1, r8, #0x128 @ r1=Pico.cram\r
mov r0, r4\r
mov r2, #0x40\r
bl vidConvCpyRGB565\r
\r
.fl_noconvRGB555:\r
- ldrb r12, [r5, #12]\r
- ldr r0, =DrawLineDest\r
- ldr r0, [r0]\r
-\r
- tst r12, #1\r
- movne r2, #320/8 @ len\r
- bne .fl_no32colRGB555\r
- ldr r3, =PicoOpt\r
- mov r2, #256/8\r
- ldr r3, [r3]\r
- tst r3, #0x100\r
- addeq r0, r0, #32*2\r
-\r
-.fl_no32colRGB555:\r
mov r3, r4\r
tst r6, r6\r
beq .fl_noshRGB555\r
\r
sub r3, r3, #0x40*2\r
\r
-\r
.fl_noshRGB555:\r
+ ldr r0, =DrawLineDest\r
ldr r1, =(HighCol+8)\r
+ ldr r0, [r0]\r
+\r
+ ldrb r12, [r8, #12]\r
mov lr, #0xff\r
mov lr, lr, lsl #1\r
\r
+ tst r12, #1\r
+ movne r2, #320/8 @ len\r
+ bne .fl_no32colRGB555\r
+ ldr r4, =PicoOpt\r
+ mov r2, #256/8\r
+ ldr r4, [r4]\r
+ tst r4, #0x4000\r
+ bne .fl_32scale_RGB555\r
+ tst r4, #0x0100\r
+ addeq r0, r0, #32*2\r
+\r
+.fl_no32colRGB555:\r
.fl_loopRGB555:\r
\r
ldr r12, [r1], #4\r
stmia r0!, {r4,r5,r8,r12}\r
bne .fl_loopRGB555\r
\r
+ ldmfd sp!, {r4-r8,lr}\r
+ bx lr\r
+\r
+\r
+.fl_32scale_RGB555:\r
+ stmfd sp!, {r9,r10}\r
+ mov r9, #0x3900 @ f800 07e0 001f | e000 0780 001c | 3800 01e0 0007\r
+ orr r9, r9, #0x00e7\r
+\r
+.fl_loop32scale_RGB555:\r
+ ldr r12, [r1], #4\r
+ ldr r7, [r1], #4\r
\r
+ and r4, lr, r12,lsl #1\r
+ ldrh r4, [r3, r4]\r
+ and r5, lr, r12,lsr #7\r
+ ldrh r5, [r3, r5]\r
+ and r4, r4, r9, lsl #2\r
+ orr r4, r4, r4, lsl #14 @ r4[31:16] = 1/4 pix_s 0\r
+ and r5, r5, r9, lsl #2\r
+ sub r6, r5, r5, lsr #2 @ r6 = 3/4 pix_s 1\r
+ add r4, r4, r6, lsl #16 @ pix_d 0, 1\r
+ and r6, lr, r12,lsr #15\r
+ ldrh r6, [r3, r6]\r
+ and r12,lr, r12,lsr #23\r
+ ldrh r12,[r3, r12]\r
+ and r6, r6, r9, lsl #2\r
+ add r5, r5, r6\r
+ mov r5, r5, lsr #1\r
+ sub r6, r6, r6, lsr #2 @ r6 = 3/4 pix_s 2\r
+ orr r5, r5, r6, lsl #16\r
+\r
+ and r6, lr, r7, lsl #1\r
+ ldrh r6, [r3, r6]\r
+ and r12,r12,r9, lsl #2\r
+ add r5, r5, r12,lsl #14 @ pix_d 2, 3\r
+ and r6, r6, r9, lsl #2\r
+ orr r6, r12,r6, lsl #16 @ pix_d 4, 5\r
+\r
+ and r12,lr, r7, lsr #7\r
+ ldrh r12,[r3, r12]\r
+ and r10,lr, r7, lsr #15\r
+ ldrh r10,[r3, r10]\r
+ and r12,r12,r9, lsl #2\r
+ sub r8, r12,r12,lsr #2 @ r8 = 3/4 pix_s 1\r
+ add r8, r8, r6, lsr #18\r
+ and r7, lr, r7, lsr #23\r
+ ldrh r7, [r3, r7]\r
+ and r10,r10,r9, lsl #2\r
+ orr r8, r8, r10,lsl #15\r
+ add r8, r8, r12,lsl #15 @ pix_d 6, 7\r
+ sub r10,r10,r10,lsr #2 @ r10= 3/4 pix_s 2\r
+ and r7, r7, r9, lsl #2\r
+ add r10,r10,r7, lsr #2 @ += 1/4 pix_s 3\r
+ orr r10,r10,r7, lsl #16 @ pix_d 8, 9\r
+\r
+ subs r2, r2, #1\r
+\r
+ stmia r0!, {r4,r5,r6,r8,r10}\r
+ bne .fl_loop32scale_RGB555\r
+\r
+ ldmfd sp!, {r9,r10}\r
ldmfd sp!, {r4-r8,lr}\r
- bx lr\r
+ bx lr\r
+\r
\r
@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r
\r