| 1 | @ ARM code version of Blit1to2. |
| 2 | @ |
| 3 | @ @author Robin Watts (robin@wss.co.uk) |
| 4 | |
| 5 | .text |
| 6 | |
| 7 | .global Blit1to2ARM |
| 8 | |
| 9 | @ Reads a width x height block of 8 bpp pixels from srcPtr, looks |
| 10 | @ them up in the palette at map, and stores them as 16bpp pixels |
| 11 | @ at dstPtr. srcPitch and dstPitch give information about how to |
| 12 | @ find the next lines. |
| 13 | Blit1to2ARM: |
| 14 | @ r0 = srcPtr |
| 15 | @ r1 = srcPitch |
| 16 | @ r2 = dstPtr |
| 17 | @ r3 = dstPitch |
| 18 | MOV r12,r13 |
| 19 | STMFD r13!,{r4-r11,r14} |
| 20 | LDMIA r12,{r4-r6} |
| 21 | @ r4 = width |
| 22 | @ r5 = height |
| 23 | @ r6 = map |
| 24 | |
| 25 | CMP r7,#0 |
| 26 | BLE end |
| 27 | SUBS r5,r5,#1 @ while (--height) |
| 28 | BLT end |
| 29 | height_loop: |
| 30 | SUBS r7,r4,#5 @ r7= width_minus_5 |
| 31 | BLE thin |
| 32 | width_loop: |
| 33 | @ Have to do at least 6 here |
| 34 | LDRB r8, [r0],#1 @ r8 = *src++ |
| 35 | LDRB r9, [r0],#1 @ r9 = *src++ |
| 36 | LDRB r10,[r0],#1 @ r10= *src++ |
| 37 | LDRB r11,[r0],#1 @ r11= *src++ |
| 38 | LDRB r12,[r0],#1 @ r12= *src++ |
| 39 | LDRB r14,[r0],#1 @ r14= *src++ |
| 40 | ADD r8, r8, r8 @ r8 = 2*r8 |
| 41 | ADD r9, r9, r9 @ r9 = 2*r9 |
| 42 | ADD r10,r10,r10 @ r10= 2*r10 |
| 43 | ADD r11,r11,r11 @ r11= 2*r11 |
| 44 | ADD r12,r12,r12 @ r12= 2*r12 |
| 45 | ADD r14,r14,r14 @ r14= 2*r14 |
| 46 | LDRH r8, [r6,r8] @ r8 = map[r8] |
| 47 | LDRH r9, [r6,r9] @ r9 = map[r9] |
| 48 | LDRH r10,[r6,r10] @ r10= map[r10] |
| 49 | LDRH r11,[r6,r11] @ r11= map[r11] |
| 50 | LDRH r12,[r6,r12] @ r12= map[r12] |
| 51 | LDRH r14,[r6,r14] @ r14= map[r14] |
| 52 | SUBS r7,r7,#6 @ r7 = width_minus_5 -= 6 |
| 53 | STRH r8, [r2],#2 @ *dstPtr++ = r8 |
| 54 | STRH r9, [r2],#2 @ *dstPtr++ = r9 |
| 55 | STRH r10,[r2],#2 @ *dstPtr++ = r10 |
| 56 | STRH r11,[r2],#2 @ *dstPtr++ = r11 |
| 57 | STRH r12,[r2],#2 @ *dstPtr++ = r12 |
| 58 | STRH r14,[r2],#2 @ *dstPtr++ = r14 |
| 59 | BGT width_loop @ width_minus_5>0 => 6+ left to do |
| 60 | thin: |
| 61 | ADDS r7,r7,#5 @ r7 = width (width <= 5) |
| 62 | BEQ end_thin |
| 63 | thin_lp: |
| 64 | LDRB r8,[r0],#1 @ r8 = *src++ |
| 65 | SUBS r7,r7,#1 @ r7 = width-- |
| 66 | @ Stall |
| 67 | ADD r8,r8,r8 @ r8 = 2*r8 |
| 68 | LDRH r8,[r6,r8] @ r8 = map[r8] |
| 69 | @ Stall |
| 70 | @ Stall |
| 71 | STRH r8,[r2],#2 @ *dstPtr++ = r8 |
| 72 | BGT thin_lp |
| 73 | end_thin: |
| 74 | |
| 75 | ADD r2,r2,r3 @ dstPtr += dstPitch |
| 76 | ADD r0,r0,r1 @ srcPtr += srcPitch |
| 77 | |
| 78 | SUBS r5,r5,#1 |
| 79 | BGE height_loop |
| 80 | |
| 81 | end: |
| 82 | LDMFD r13!,{r4-r11,PC} |