Dave Chapman | b3358bd | 2006-03-15 01:27:13 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (c) 2006 Fredrik Ohrn |
| 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame^] | 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License |
| 14 | * as published by the Free Software Foundation; either version 2 |
| 15 | * of the License, or (at your option) any later version. |
Dave Chapman | b3358bd | 2006-03-15 01:27:13 +0000 | [diff] [blame] | 16 | * |
| 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 18 | * KIND, either express or implied. |
| 19 | * |
| 20 | ****************************************************************************/ |
| 21 | |
| 22 | #include "pacbox.h" |
| 23 | |
| 24 | .section .text |
| 25 | .align 2 |
Dave Chapman | 03627e0 | 2006-03-18 09:14:10 +0000 | [diff] [blame] | 26 | |
| 27 | |
| 28 | #if defined(IRIVER_H300_SERIES) && !defined(SIMULATOR) |
| 29 | |
Dave Chapman | b3358bd | 2006-03-15 01:27:13 +0000 | [diff] [blame] | 30 | .global blit_display |
| 31 | |
| 32 | /* |
| 33 | |
| 34 | 0.75 scaling - display 3 out of 4 pixels = 216x168 |
| 35 | Skipping pixel #2 out of 4 seems to give the most legible display |
| 36 | |
| 37 | void blit_display(fb_data* lcd_framebuffer, unsigned char* vbuf) |
| 38 | { |
| 39 | next_dst=&lcd_framebuffer[YOFS*LCD_WIDTH+XOFS+((ScreenHeight*3)/4)-1]; |
| 40 | for (y=ScreenHeight-1;y >= 0; y--) { |
| 41 | if ((y & 3) != 1) { |
| 42 | dst = (next_dst--); |
| 43 | for (x=0;x<ScreenWidth;x++) { |
| 44 | if ((x & 3) == 1) { vbuf++; } |
| 45 | else { |
| 46 | *dst = palette[*(vbuf++)]; |
| 47 | dst+=LCD_WIDTH; |
| 48 | } |
| 49 | } |
| 50 | } else { |
| 51 | vbuf+=ScreenWidth; |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | */ |
| 56 | |
| 57 | /* FIXME: ScreenWidth & ScreenHeight are defined in arcade.h, but all |
| 58 | hell breaks loose if you include it... */ |
| 59 | |
| 60 | #define ScreenWidth 224 |
| 61 | #define ScreenHeight 288 |
| 62 | |
| 63 | #define SHRUNK_WIDTH ((ScreenWidth/4)*3) |
| 64 | #define SHRUNK_HEIGHT ((ScreenHeight/4)*3) |
| 65 | |
Dave Chapman | 03627e0 | 2006-03-18 09:14:10 +0000 | [diff] [blame] | 66 | #define BD_SAVE (9 * 4) |
Dave Chapman | b3358bd | 2006-03-15 01:27:13 +0000 | [diff] [blame] | 67 | |
Dave Chapman | 03627e0 | 2006-03-18 09:14:10 +0000 | [diff] [blame] | 68 | process_4_pixels: |
| 69 | move.b %d4, %d2 |
| 70 | move.w (%a1, %d2.l * 2), %d3 |
| 71 | move.w %d3, (2 * LCD_WIDTH * 2)(%a0) |
| 72 | |
| 73 | lsr.l #8, %d4 |
| 74 | move.b %d4, %d2 |
| 75 | move.w (%a1, %d2.l * 2), %d3 |
| 76 | move.w %d3, (1 * LCD_WIDTH * 2)(%a0) |
| 77 | |
| 78 | swap.w %d4 |
| 79 | move.b %d4, %d2 |
| 80 | move.w (%a1, %d2.l * 2), (%a0) |
| 81 | |
| 82 | lea.l 3 * LCD_WIDTH * 2(%a0), %a0 |
| 83 | rts |
| 84 | |
| 85 | process_line: |
| 86 | move.l %a3, %d1 |
| 87 | bd_x_loop: |
| 88 | movem.l (%a2), %d4-%d7 // Read 16 pixels |
| 89 | |
| 90 | bsr.s process_4_pixels |
| 91 | move.l %d5, %d4 |
| 92 | bsr.s process_4_pixels |
| 93 | move.l %d6, %d4 |
| 94 | bsr.s process_4_pixels |
| 95 | move.l %d7, %d4 |
| 96 | bsr.s process_4_pixels |
| 97 | |
| 98 | lea 16(%a2), %a2 |
| 99 | subq.l #1, %d1; |
| 100 | bne.s bd_x_loop |
| 101 | |
| 102 | rts |
| 103 | |
| 104 | blit_display: |
| 105 | lea -BD_SAVE(%sp), %sp |
| 106 | movem.l %d2-%d7/%a2-%a4, (%sp) |
| 107 | |
| 108 | move.l BD_SAVE + 4(%sp), %a0 // lcd_framebuffer |
| 109 | move.l BD_SAVE + 8(%sp), %a2 // vbuf |
Dave Chapman | b3358bd | 2006-03-15 01:27:13 +0000 | [diff] [blame] | 110 | |
| 111 | lea palette, %a1 |
| 112 | |
| 113 | lea.l ((YOFS * LCD_WIDTH + XOFS + SHRUNK_HEIGHT) * 2)(%a0), %a0 |
| 114 | |
| 115 | move.l #(ScreenHeight / 4), %d0 |
Dave Chapman | 03627e0 | 2006-03-18 09:14:10 +0000 | [diff] [blame] | 116 | move.l #(ScreenWidth / 16), %a3 |
| 117 | move.l #(LCD_WIDTH * SHRUNK_WIDTH + 1) * 2, %a4 |
Dave Chapman | b3358bd | 2006-03-15 01:27:13 +0000 | [diff] [blame] | 118 | moveq.l #0, %d2 |
| 119 | |
Dave Chapman | 03627e0 | 2006-03-18 09:14:10 +0000 | [diff] [blame] | 120 | bd_y_loop: |
| 121 | bsr.s process_line |
Dave Chapman | b3358bd | 2006-03-15 01:27:13 +0000 | [diff] [blame] | 122 | |
Dave Chapman | 03627e0 | 2006-03-18 09:14:10 +0000 | [diff] [blame] | 123 | suba.l %a4, %a0 |
Dave Chapman | b3358bd | 2006-03-15 01:27:13 +0000 | [diff] [blame] | 124 | lea.l ScreenWidth(%a2), %a2 // Skip 1 line |
| 125 | |
Dave Chapman | 03627e0 | 2006-03-18 09:14:10 +0000 | [diff] [blame] | 126 | bsr.s process_line |
Dave Chapman | b3358bd | 2006-03-15 01:27:13 +0000 | [diff] [blame] | 127 | |
Dave Chapman | 03627e0 | 2006-03-18 09:14:10 +0000 | [diff] [blame] | 128 | suba.l %a4, %a0 |
Dave Chapman | b3358bd | 2006-03-15 01:27:13 +0000 | [diff] [blame] | 129 | |
Dave Chapman | 03627e0 | 2006-03-18 09:14:10 +0000 | [diff] [blame] | 130 | bsr.s process_line |
Dave Chapman | b3358bd | 2006-03-15 01:27:13 +0000 | [diff] [blame] | 131 | |
Dave Chapman | 03627e0 | 2006-03-18 09:14:10 +0000 | [diff] [blame] | 132 | suba.l %a4, %a0 |
Dave Chapman | b3358bd | 2006-03-15 01:27:13 +0000 | [diff] [blame] | 133 | |
| 134 | subq.l #1, %d0 |
Dave Chapman | 03627e0 | 2006-03-18 09:14:10 +0000 | [diff] [blame] | 135 | bne bd_y_loop |
Dave Chapman | b3358bd | 2006-03-15 01:27:13 +0000 | [diff] [blame] | 136 | |
Dave Chapman | 03627e0 | 2006-03-18 09:14:10 +0000 | [diff] [blame] | 137 | movem.l (%sp), %d2-%d7/%a2-%a4 |
| 138 | lea.l BD_SAVE(%sp), %sp |
| 139 | rts |
| 140 | |
| 141 | #endif /* defined(IRIVER_H300_SERIES) && !defined(SIMULATOR) */ |
| 142 | |
| 143 | |
| 144 | /* See arcade.c for the C implementation of drawChar */ |
| 145 | /* Note! This version does not handle flipped screen mode. */ |
| 146 | |
| 147 | .global drawChar |
| 148 | |
| 149 | #define DC_SAVE (4 * 4) |
| 150 | |
| 151 | drawChar: |
| 152 | lea -DC_SAVE(%sp), %sp |
| 153 | movem.l %d2-%d5, (%sp) |
| 154 | |
| 155 | movea.l DC_SAVE + 4(%sp), %a0 // buffer |
| 156 | |
| 157 | move.l DC_SAVE + 16(%sp), %d0 // oy |
| 158 | move.l %d0, %d1 |
| 159 | lsl.l #8, %d0 |
| 160 | lsl.l #5, %d1 |
| 161 | sub.l %d1, %d0 |
| 162 | adda.l %d0, %a0 |
| 163 | adda.l DC_SAVE + 12(%sp), %a0 // ox |
| 164 | |
| 165 | move.l DC_SAVE + 20(%sp), %d0 // color |
| 166 | and.l #0x3F, %d0 |
| 167 | bne.s have_color |
| 168 | |
| 169 | moveq.l #8, %d1 |
| 170 | moveq.l #0, %d2 |
| 171 | moveq.l #0, %d3 |
| 172 | |
| 173 | clear_loop: |
| 174 | movem.l %d2-%d3, (%a0) |
| 175 | lea 224(%a0), %a0 |
| 176 | |
| 177 | subq.l #1, %d1 |
| 178 | bne.s clear_loop |
| 179 | |
| 180 | bra.s dc_exit |
| 181 | |
| 182 | have_color: |
| 183 | lsl.l #2, %d0 |
| 184 | |
| 185 | lea.l charmap_, %a1 |
| 186 | move.l DC_SAVE + 8(%sp), %d2 // index |
| 187 | lsl.l #6, %d2 |
| 188 | adda.l %d2, %a1 |
| 189 | |
| 190 | moveq.l #8, %d1 |
| 191 | moveq.l #0, %d3 |
| 192 | moveq.l #24, %d5 |
| 193 | |
| 194 | dc_y_loop: |
| 195 | move.l (%a1)+, %d3 |
| 196 | move.l %d3, %d4 |
| 197 | |
| 198 | move.l %d3, %d2 // Pixel 1 |
| 199 | lsr.l %d5, %d2 |
| 200 | add.l %d0, %d2 |
| 201 | lsl.l #8, %d2 |
| 202 | |
| 203 | swap.w %d4 // Pixel 2 |
| 204 | move.b %d4, %d2 |
| 205 | add.l %d0, %d2 |
| 206 | lsl.l #8, %d2 |
| 207 | |
| 208 | lsr.l #8, %d3 // Pixel 3 |
| 209 | move.b %d3, %d2 |
| 210 | add.l %d0, %d2 |
| 211 | lsl.l #8, %d2 |
| 212 | |
| 213 | swap.w %d4 // Pixel 4 |
| 214 | move.b %d4, %d2 |
| 215 | add.l %d0, %d2 |
| 216 | |
| 217 | move.l %d2, (%a0)+ |
| 218 | |
| 219 | move.l (%a1)+, %d3 |
| 220 | move.l %d3, %d4 |
| 221 | |
| 222 | move.l %d3, %d2 // Pixel 1 |
| 223 | lsr.l %d5, %d2 |
| 224 | add.l %d0, %d2 |
| 225 | lsl.l #8, %d2 |
| 226 | |
| 227 | swap.w %d4 // Pixel 2 |
| 228 | move.b %d4, %d2 |
| 229 | add.l %d0, %d2 |
| 230 | lsl.l #8, %d2 |
| 231 | |
| 232 | lsr.l #8, %d3 // Pixel 3 |
| 233 | move.b %d3, %d2 |
| 234 | add.l %d0, %d2 |
| 235 | lsl.l #8, %d2 |
| 236 | |
| 237 | swap.w %d4 // Pixel 4 |
| 238 | move.b %d4, %d2 |
| 239 | add.l %d0, %d2 |
| 240 | |
| 241 | move.l %d2, (%a0)+ |
| 242 | |
| 243 | lea 216(%a0), %a0 |
| 244 | |
| 245 | subq.l #1, %d1 |
| 246 | bne.s dc_y_loop |
| 247 | |
| 248 | dc_exit: |
| 249 | movem.l (%sp), %d2-%d5 |
| 250 | lea.l DC_SAVE(%sp), %sp |
Dave Chapman | b3358bd | 2006-03-15 01:27:13 +0000 | [diff] [blame] | 251 | rts |
| 252 | |