.extern DrawStripInterlace\r
.extern HighCacheS_ptr\r
\r
+.equiv OVERRIDE_HIGHCOL, 1\r
+\r
.equ PDRAW_SPRITES_MOVED, (1<<0)\r
.equ PDRAW_WND_DIFF_PRIO, (1<<1)\r
.equ PDRAW_ACC_SPRITES, (1<<2)\r
.endif\r
ldreqb r4, [r1,#\offs]\r
orrne r4, r3, r4\r
- andeq r4, r4, #0x3f\r
+ andeq r4, r4, #0xbf\r
strb r4, [r1,#\offs]\r
.endm\r
\r
.endif\r
beq 0f\r
cmp r4, #0xe\r
- ldrgeb r4, [r1,#\ofs]\r
- orrlt r4, r3, r4 @ normal\r
-\r
- biceq r4, r4, #0xc0 @ hilight\r
- orreq r4, r4, #0x80\r
- orrgt r4, r4, #0xc0 @ shadow\r
+ ldrgeb r7, [r1,#\ofs]\r
+ orrlt r7, r3, r4 @ normal\r
\r
- strb r4, [r1,#\ofs]\r
+ bicge r7, r7, #0xc0\r
+ orrge r7, r7, r4, lsl #6\r
+ strb r7, [r1,#\ofs]\r
0:\r
.endm\r
\r
TileDoShGenPixel 16, 7 @ #0x000f0000\r
.endm\r
\r
-.macro TileDoShGenPixel_noop shift ofs\r
+.macro TileDoShGenPixel_markop shift ofs\r
.if \shift\r
- and r4, r12, r2, lsr #\shift\r
+ ands r4, r12, r2, lsr #\shift\r
.else\r
- and r4, r12, r2\r
+ ands r4, r12, r2\r
.endif\r
- sub r7, r4, #1\r
- cmp r7, #0xd\r
- orrcc r4, r3, r4 @ 0-0xc (was 1-0xd)\r
- strccb r4, [r1,#\ofs]\r
+ beq 0f\r
+ cmp r4, #0xe\r
+ ldrgeb r4, [r1,#\ofs]\r
+ orrlt r4, r3, r4\r
+ orrge r4, r4, #0x80\r
+ strb r4, [r1,#\ofs]\r
+0:\r
.endm\r
\r
-.macro TileFlipSh_noop\r
- TileDoShGenPixel_noop 16, 0 @ #0x000f0000\r
- TileDoShGenPixel_noop 20, 1 @ #0x00f00000\r
- TileDoShGenPixel_noop 24, 2 @ #0x0f000000\r
- TileDoShGenPixel_noop 28, 3 @ #0xf0000000\r
- TileDoShGenPixel_noop 0, 4 @ #0x0000000f\r
- TileDoShGenPixel_noop 4, 5 @ #0x000000f0\r
- TileDoShGenPixel_noop 8, 6 @ #0x00000f00\r
- TileDoShGenPixel_noop 12, 7 @ #0x0000f000\r
+.macro TileFlipSh_markop\r
+ TileDoShGenPixel_markop 16, 0 @ #0x000f0000\r
+ TileDoShGenPixel_markop 20, 1 @ #0x00f00000\r
+ TileDoShGenPixel_markop 24, 2 @ #0x0f000000\r
+ TileDoShGenPixel_markop 28, 3 @ #0xf0000000\r
+ TileDoShGenPixel_markop 0, 4 @ #0x0000000f\r
+ TileDoShGenPixel_markop 4, 5 @ #0x000000f0\r
+ TileDoShGenPixel_markop 8, 6 @ #0x00000f00\r
+ TileDoShGenPixel_markop 12, 7 @ #0x0000f000\r
.endm\r
\r
-.macro TileNormSh_noop\r
- TileDoShGenPixel_noop 12, 0 @ #0x0000f000\r
- TileDoShGenPixel_noop 8, 1 @ #0x00000f00\r
- TileDoShGenPixel_noop 4, 2 @ #0x000000f0\r
- TileDoShGenPixel_noop 0, 3 @ #0x0000000f\r
- TileDoShGenPixel_noop 28, 4 @ #0xf0000000\r
- TileDoShGenPixel_noop 24, 5 @ #0x0f000000\r
- TileDoShGenPixel_noop 20, 6 @ #0x00f00000\r
- TileDoShGenPixel_noop 16, 7 @ #0x000f0000\r
+.macro TileNormSh_markop\r
+ TileDoShGenPixel_markop 12, 0 @ #0x0000f000\r
+ TileDoShGenPixel_markop 8, 1 @ #0x00000f00\r
+ TileDoShGenPixel_markop 4, 2 @ #0x000000f0\r
+ TileDoShGenPixel_markop 0, 3 @ #0x0000000f\r
+ TileDoShGenPixel_markop 28, 4 @ #0xf0000000\r
+ TileDoShGenPixel_markop 24, 5 @ #0x0f000000\r
+ TileDoShGenPixel_markop 20, 6 @ #0x00f00000\r
+ TileDoShGenPixel_markop 16, 7 @ #0x000f0000\r
.endm\r
\r
.macro TileDoShGenPixel_onlyop_lp shift ofs\r
ands r7, r12, r2\r
.endif\r
ldrneb r4, [r1,#\ofs]\r
- tstne r4, #0x40\r
- beq 0f\r
-\r
cmp r7, #0xe\r
- biceq r4, r4, #0xc0 @ hilight\r
- orreq r4, r4, #0x80\r
- orrgt r4, r4, #0xc0 @ shadow\r
- strgeb r4, [r1,#\ofs]\r
+ blt 0f\r
+\r
+ tst r4, #0xc0\r
+ bicne r4, r4, #0xc0\r
+ orrne r4, r4, r7, lsl #6\r
+ strneb r4, [r1,#\ofs]\r
0:\r
.endm\r
\r
.dtfc_shadow_blank:\r
tst r1, #1\r
ldrneb r4, [r1]\r
- mov r6, #0x3f\r
- and r4, r4, #0x3f\r
+ mov r6, #0xbf\r
+ and r4, r4, #0xbf\r
strneb r4, [r1], #1\r
ldrh r4, [r1]\r
orr r6, r6, r6, lsl #8\r
\r
add r1, r11,#8\r
mov r3, #320/4/4\r
- mov r6, #0x3f\r
+ mov r6, #0xbf\r
orr r6, r6, r6, lsl #8\r
orr r6, r6, r6, lsl #16\r
.dtfc_loop_shprep:\r
orr r9, r9, r4, lsl #16\r
orr r9, r9, #0x90000000 @ r9=scc1 ???? ... <code> (s=shadow/hilight, cc=pal)\r
cmp r12,r9, lsr #28 @ sh/hi with pal3?\r
- cmpne r3, #1 @ if not, is ir hi prio?\r
+ cmpne r3, #1 @ if not, is it hi prio?\r
bne DrawSpriteSHi @ non-operator low sprite, already drawn\r
\r
ldr r3, [r0] @ sprite[0]\r
tst r9, #0x0800\r
bne .dsprShi_TileFlip_sh\r
\r
- @ (r1=pdest, r2=pixels8, r3=pal) r4: scratch, r12: helper pattern\r
+ @ (r1=pdest, r2=pixels8, r3=pal) r4, r7: scratch, r12: helper pattern\r
.dsprShi_TileNorm_sh:\r
TileNormSh\r
b .dsprShi_loop\r
\r
.dspr_singlec_sh:\r
cmp r2, #0xe0000000\r
- bcs .dspr_loop @ operator tileline, ignore\r
+ bcs .dspr_TileNorm_sh @ op. tileline, markop. XXX: maybe add a spec. handler?\r
\r
.dspr_SingleColor:\r
and r4, r2, #0xf\r
\r
@ (r1=pdest, r2=pixels8, r3=pal) r4: scratch, r12: helper pattern\r
.dspr_TileNorm_sh:\r
- TileNormSh_noop\r
+ TileNormSh_markop\r
b .dspr_loop\r
\r
.dspr_TileFlip_sh:\r
- TileFlipSh_noop\r
+ TileFlipSh_markop\r
b .dspr_loop\r
\r
\r
@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r
\r
\r
-@ hilights 2 pixels in RGB555/BGR555 format\r
-.macro TileDoShHi2Pixels555 reg\r
- adds \reg, \reg, #0x40000000\r
- orrcs \reg, \reg, #0xf0000000\r
- mov \reg, \reg, ror #27\r
- adds \reg, \reg, #0x40000000\r
- orrcs \reg, \reg, #0xf0000000\r
- mov \reg, \reg, ror #26\r
- adds \reg, \reg, #0x40000000\r
- orrcs \reg, \reg, #0xf0000000\r
- mov \reg, \reg, ror #27\r
- adds \reg, \reg, #0x40000000\r
- orrcs \reg, \reg, #0xf0000000\r
- mov \reg, \reg, ror #27\r
- adds \reg, \reg, #0x40000000\r
- orrcs \reg, \reg, #0xf0000000\r
- mov \reg, \reg, ror #26\r
- adds \reg, \reg, #0x40000000\r
- orrcs \reg, \reg, #0xf0000000\r
- mov \reg, \reg, ror #27\r
-.endm\r
-\r
-\r
@ Convert 0000bbb0 ggg0rrr0\r
@ to rrrrrggg gggbbbbb\r
\r
-@ r2,r3,r9 - scratch, lr = 0x001c001c, r8 = 0x00030003\r
+@ r2,r3 - scratch, lr = 0x001c001c, r8 = 0x08610861\r
.macro convRGB565 reg\r
- and r2, lr, \reg,lsl #1\r
- and r9, r8, \reg,lsr #2\r
- orr r2, r2, r9 @ r2=red\r
- and r3, lr, \reg,lsr #7\r
- and r9, r8, \reg,lsr #10\r
- orr r3, r3, r9 @ r3=blue\r
- and \reg, \reg, lr, lsl #3\r
- orr \reg, \reg, \reg,lsl #3 @ green\r
- orr \reg, \reg, r2, lsl #11 @ add red back\r
- orr \reg, \reg, r3 @ add blue back\r
+ and r2, lr, \reg,lsr #7 @ b\r
+ and r3, lr, \reg,lsr #3 @ g\r
+ and \reg, lr, \reg,lsl #1 @ r\r
+ orr r2, r2, r3, lsl #6\r
+ orr \reg, r2, \reg,lsl #11\r
+\r
+ and r2, r8, \reg,lsr #4\r
+ orr \reg, \reg, r2\r
.endm\r
\r
-@ trashes: r2-r9,r12,lr; r0,r1 are advanced\r
+@ trashes: r2-r8,r12,lr; r8 = 0x08610861; r0,r1 are advanced\r
.macro vidConvCpyRGB565_local\r
mov r12, r2, lsr #3 @ repeats\r
mov lr, #0x001c0000\r
orr lr, lr, #0x01c @ lr == pattern 0x001c001c\r
- mov r8, #0x00030000\r
- orr r8, r8, #0x003\r
\r
0:\r
ldmia r1!, {r4-r7}\r
\r
vidConvCpyRGB565: @ void *to, void *from, int pixels\r
stmfd sp!, {r4-r9,lr}\r
+ mov r8, #0x0061\r
+ orr r8, r8, #0x0800\r
+ orr r8, r8, r8, lsl #16\r
vidConvCpyRGB565_local\r
ldmfd sp!, {r4-r9,lr}\r
bx lr\r
ldr r8, =(Pico+0x22228) @ Pico.video\r
\r
PicoDoHighPal555_nopush:\r
- str r1, [sp, #-8] @ is called from FinalizeLineRGB555?\r
+ orr r9, r1, r0, lsl #31 @ 0:called from FinalizeLine555, 31: s/h\r
\r
- str r0, [sp, #-4]\r
ldr r0, =HighPal\r
\r
mov r1, #0\r
\r
sub r1, r8, #0x128 @ r1=Pico.cram\r
mov r2, #0x40\r
+ mov r8, #0x0061\r
+ orr r8, r8, #0x0800\r
+ orr r8, r8, r8, lsl #16\r
+\r
vidConvCpyRGB565_local\r
\r
- ldr r0, [sp, #-4]\r
- tst r0, r0\r
+ tst r9, #(1<<31)\r
beq PicoDoHighPal555_end\r
\r
ldr r3, =HighPal\r
bne .fl_loopcpRGB555_sh\r
\r
@ hilighted pixels:\r
+ @ t = ((dpal[i] >> 1) & 0x738e738e) + 0x738e738e;\r
+ @ t |= (t >> 4) & 0x08610861;\r
+ @ r8=0x08610861\r
sub r3, r3, #0x40*2\r
- mov lr, #0x40/2\r
+ mov lr, #0x40/4\r
.fl_loopcpRGB555_hi:\r
- ldr r1, [r3], #4\r
- TileDoShHi2Pixels555 r1\r
- str r1, [r4], #4\r
+ ldmia r3!, {r1,r6}\r
+ and r1, r12, r1, lsr #1\r
+ and r6, r12, r6, lsr #1\r
+ add r1, r12, r1\r
+ add r6, r12, r6\r
+ and r5, r8, r1, lsr #4\r
+ and r7, r8, r6, lsr #4\r
+ orr r1, r1, r5\r
+ orr r6, r6, r7\r
+ stmia r4!, {r1,r6}\r
subs lr, lr, #1\r
bne .fl_loopcpRGB555_hi\r
mov r0, #1\r
\r
PicoDoHighPal555_end:\r
- ldr r1, [sp, #-8]\r
- tst r1, r1\r
+ tst r9, #1\r
ldmeqfd sp!, {r4-r9,pc}\r
\r
ldr r8, =(Pico+0x22228) @ Pico.video\r
b FinalizeLineRGB555_pal_done\r
\r
\r
-.global FinalizeLineRGB555 @ int sh\r
+.global FinalizeLine555 @ int sh\r
\r
-FinalizeLineRGB555:\r
+FinalizeLine555:\r
stmfd sp!, {r4-r9,lr}\r
ldr r8, =(Pico+0x22228) @ Pico.video\r
\r