7 .equiv P32XV_PRI, (1<< 7)
11 .global Pico32xNativePal
19 .macro call_scan_prep cond
21 ldr r4, =PicoScan32xBegin
22 ldr r5, =PicoScan32xEnd
30 .macro call_scan_fin_ge cond
36 .macro call_scan_begin cond
42 ldr pc, [sp, #(3+0)*4]
43 ldr r0, [sp, #(3+2)*4] @ &DrawLineDest
49 .macro call_scan_end cond
55 ldr pc, [sp, #(4+1)*4]
61 @ unsigned short *dst, unsigned short *dram, int lines_sft_offs, int mdbg
62 .macro make_do_loop_dc name call_scan do_md
65 stmfd sp!, {r4-r11,lr}
69 ldr r10,[r10, #0x40] @ Pico32x.vdp_regs[0]
71 ldr r9, =HighPal @ palmd
72 add r11,r11,#(328*8) @ r11 = pmd: md data
75 movne r10,#0x8000 @ r10 = inv_bit
76 call_scan_prep \call_scan
79 b 1f @ loop_outer_entry
82 call_scan_end \call_scan
84 sub r11,r11,#1 @ adjust for prev read
86 call_scan_fin_ge \call_scan
87 ldmgefd sp!, {r4-r11,pc}
89 1: @ loop_outer_entry:
90 call_scan_begin \call_scan
95 add r5, r1, r12, lsl #1 @ p32x = dram + dram[l]
98 ldrb r7, [r11], #1 @ MD pixel
101 ldrh r8, [r5], #2 @ 32x pixel
102 cmp r7, r3 @ MD has bg pixel?
105 ands r12,r12,#0x8000 @ !((t ^ inv) & 0x8000)
109 streqh r12,[r0], #2 @ *dst++ = palmd[*pmd]
116 orr r8, r8, r8, lsr #(10+11)
117 orr r8, r8, r12,lsl #1
118 bic r8, r8, #0x0020 @ kill prio bit
119 strh r8, [r0], #2 @ *dst++ = bgr2rgb(*p32x++)
125 @ note: this may read a few bytes over the end of PicoDraw2FB and dram,
126 @ so those should have a bit more alloc'ed than really needed.
127 @ unsigned short *dst, unsigned short *dram, int lines_sft_offs, int mdbg
128 .macro make_do_loop_pp name call_scan do_md
131 stmfd sp!, {r4-r11,lr}
134 ldr r10,=Pico32xNativePal
137 ldr r9, =HighPal @ palmd
138 add r11,r11,#(328*8) @ r11 = pmd: md data
139 call_scan_prep \call_scan
142 b 1f @ loop_outer_entry
145 call_scan_end \call_scan
148 call_scan_fin_ge \call_scan
149 ldmgefd sp!, {r4-r11,pc}
151 1: @ loop_outer_entry:
152 call_scan_begin \call_scan
157 add r5, r1, r12, lsl #1 @ p32x = dram + dram[l]
158 and r12,r2, #0x100 @ shift
159 add r5, r5, r12,lsr #8
162 @ r4,r6 - counters; r5 - 32x data; r9,r10 - md,32x pal; r11 - md data
163 @ r7,r8,r12,lr - temp
167 ldrneb r8, [r5, #2]! @ r7,r8 - pixel 0,1 index
171 beq 5f @ check_fill @ +8
182 ldrneb r12,[r11,#-2] @ MD pixel 0
184 cmpne r12,r3 @ MD has bg pixel?
187 ldrneh r7, [r9, r12] @ t = palmd[pmd[0]]
189 ldrneb lr, [r11,#-1] @ MD pixel 1
191 cmpne lr, r3 @ MD has bg pixel?
193 ldrneh r8, [r9, lr] @ t = palmd[pmd[1]]
198 ldrneb lr, [r11,#-1] @ MD pixel 1
200 cmpne lr, r3 @ MD has bg pixel?
206 @ count pixels, align if needed
209 orr lr, r7, r7, lsl #8
214 sub lr, r5, #2 @ starting r5 (32x render data start)
216 addne r5, r5, #1 @ add for the check above
217 add r6, r6, #1 @ restore from dec
218 orr r7, r7, r7, lsl #8
230 sub r5, r5, #4 @ undo readahead
232 @ fix alignment and check type
241 movgt r8, r6, lsl #1 @ r8=count
243 sub r6, r6, r8, lsr #1 @ adjust counter
256 ldrb r12,[r11],#1 @ MD pixel
258 cmp r12,r3 @ MD has bg pixel?
261 ldrneh r12,[r9, r12] @ t = palmd[*pmd]
282 @ unsigned short *dst, unsigned short *dram, int lines_sft_offs, int mdbg
283 .macro make_do_loop_rl name call_scan do_md
286 stmfd sp!, {r4-r11,lr}
289 ldr r10,=Pico32xNativePal
292 ldr r9, =HighPal @ palmd
293 add r11,r11,#(328*8) @ r11 = pmd: md data
294 call_scan_prep \call_scan
297 b 1f @ loop_outer_entry
300 call_scan_end \call_scan
302 sub r11,r11,#1 @ adjust for prev read
304 call_scan_fin_ge \call_scan
305 ldmgefd sp!, {r4-r11,pc}
307 1: @ loop_outer_entry:
308 call_scan_begin \call_scan
313 add r5, r1, r12, lsl #1 @ p32x = dram + dram[l]
316 ldrh r8, [r5], #2 @ control word
319 ldrh lr, [r10,r12] @ t = 32x pixel
323 ldrb r7, [r11], #1 @ MD pixel
326 cmp r7, r3 @ MD has bg pixel?
330 ldrneh r12,[r9, r7] @ t = palmd[*pmd]
332 strneh r12,[r0], #2 @ *dst++ = t
338 bge 3b @ loop_innermost
343 make_do_loop_dc do_loop_dc, 0, 0
344 make_do_loop_dc do_loop_dc_md, 0, 1
345 make_do_loop_dc do_loop_dc_scan, 1, 0
346 make_do_loop_dc do_loop_dc_scan_md, 1, 1
348 make_do_loop_pp do_loop_pp, 0, 0
349 make_do_loop_pp do_loop_pp_md, 0, 1
350 make_do_loop_pp do_loop_pp_scan, 1, 0
351 make_do_loop_pp do_loop_pp_scan_md, 1, 1
353 make_do_loop_rl do_loop_rl, 0, 0
354 make_do_loop_rl do_loop_rl_md, 0, 1
355 make_do_loop_rl do_loop_rl_scan, 1, 0
356 make_do_loop_rl do_loop_rl_scan_md, 1, 1