| 1 | static int EmulateScanFull16_176(unsigned int scan,unsigned short *data)\r |
| 2 | {\r |
| 3 | unsigned short *ps=NULL,*end=NULL;\r |
| 4 | unsigned char *pd=NULL;\r |
| 5 | int xpitch=0;\r |
| 6 | TInt retValue = 0;\r |
| 7 | if(scan<224)\r |
| 8 | retValue = 1-(gLineTable[scan+1]-gLineTable[scan]);\r |
| 9 | scan = gLineTable[scan];\r |
| 10 | \r |
| 11 | if ((int)scan< 0) return 0; // Out of range\r |
| 12 | if ((int)scan>=176) return 0; // Out of range\r |
| 13 | \r |
| 14 | pd=Targ.screen+gLineOffsets[scan];//Targ.screen+scan*2+Targ.screen_offset+8;\r |
| 15 | \r |
| 16 | xpitch=-Targ.scanline_length;\r |
| 17 | if(Pico.video.reg[12]&1)\r |
| 18 | {\r |
| 19 | ps=data; end=ps+320;\r |
| 20 | // Reduce 14 pixels into 9\r |
| 21 | do\r |
| 22 | {\r |
| 23 | *(unsigned short *)pd=gColorMapTab[ps[0]];pd+=xpitch;\r |
| 24 | *(unsigned short *)pd=gColorMapTab[ps[1]];pd+=xpitch;\r |
| 25 | *(unsigned short *)pd=gColorMapTab[ps[3]];pd+=xpitch;\r |
| 26 | *(unsigned short *)pd=gColorMapTab[ps[4]];pd+=xpitch;\r |
| 27 | *(unsigned short *)pd=gColorMapTab[ps[6]];pd+=xpitch;\r |
| 28 | *(unsigned short *)pd=gColorMapTab[ps[7]];pd+=xpitch;\r |
| 29 | *(unsigned short *)pd=gColorMapTab[ps[9]];pd+=xpitch;\r |
| 30 | *(unsigned short *)pd=gColorMapTab[ps[11]];pd+=xpitch;\r |
| 31 | *(unsigned short *)pd=gColorMapTab[ps[12]];pd+=xpitch;\r |
| 32 | ps+=14;\r |
| 33 | }\r |
| 34 | while (ps<end);\r |
| 35 | }\r |
| 36 | else\r |
| 37 | {\r |
| 38 | ps=data+32; end=ps+256;\r |
| 39 | \r |
| 40 | // Reduce 5 pixels into 4\r |
| 41 | do\r |
| 42 | {\r |
| 43 | *(unsigned short *)pd=gColorMapTab[ps[0]];pd+=xpitch;\r |
| 44 | *(unsigned short *)pd=gColorMapTab[ps[1]];pd+=xpitch;\r |
| 45 | *(unsigned short *)pd=gColorMapTab[ps[2]];pd+=xpitch;\r |
| 46 | *(unsigned short *)pd=gColorMapTab[ps[4]];pd+=xpitch;\r |
| 47 | ps+=5;\r |
| 48 | }\r |
| 49 | while (ps<end);\r |
| 50 | }\r |
| 51 | return retValue;\r |
| 52 | }\r |
| 53 | \r |
| 54 | static int EmulateScanFullRight16_176(unsigned int scan,unsigned short *data)\r |
| 55 | {\r |
| 56 | unsigned short *ps=NULL,*end=NULL;\r |
| 57 | unsigned char *pd=NULL;\r |
| 58 | int xpitch=0;\r |
| 59 | int retValue = 0;\r |
| 60 | if(scan<224)\r |
| 61 | retValue = 1-(gLineTable[scan+1]-gLineTable[scan]);\r |
| 62 | scan = gLineTable[scan];\r |
| 63 | \r |
| 64 | if ((int)scan< 0) return 0; // Out of range\r |
| 65 | if ((int)scan>=176) return 0; // Out of range\r |
| 66 | \r |
| 67 | pd=Targ.screen+gLineOffsets[scan];//Targ.screen+Targ.scanline_length-scan*2-8;\r |
| 68 | \r |
| 69 | xpitch=+Targ.scanline_length;\r |
| 70 | if(Pico.video.reg[12]&1)\r |
| 71 | {\r |
| 72 | ps=data; end=ps+320;\r |
| 73 | // Reduce 14 pixels into 9\r |
| 74 | do\r |
| 75 | {\r |
| 76 | *(unsigned short *)pd=gColorMapTab[ps[0]];pd+=xpitch;\r |
| 77 | *(unsigned short *)pd=gColorMapTab[ps[1]];pd+=xpitch;\r |
| 78 | *(unsigned short *)pd=gColorMapTab[ps[3]];pd+=xpitch;\r |
| 79 | *(unsigned short *)pd=gColorMapTab[ps[4]];pd+=xpitch;\r |
| 80 | *(unsigned short *)pd=gColorMapTab[ps[6]];pd+=xpitch;\r |
| 81 | *(unsigned short *)pd=gColorMapTab[ps[7]];pd+=xpitch;\r |
| 82 | *(unsigned short *)pd=gColorMapTab[ps[9]];pd+=xpitch;\r |
| 83 | *(unsigned short *)pd=gColorMapTab[ps[11]];pd+=xpitch;\r |
| 84 | *(unsigned short *)pd=gColorMapTab[ps[12]];pd+=xpitch;\r |
| 85 | ps+=14;\r |
| 86 | }\r |
| 87 | while (ps<end);\r |
| 88 | }\r |
| 89 | else\r |
| 90 | {\r |
| 91 | ps=data+32; end=ps+256;\r |
| 92 | // Reduce 5 pixels into 4\r |
| 93 | do\r |
| 94 | {\r |
| 95 | *(unsigned short *)pd=gColorMapTab[ps[0]];pd+=xpitch;\r |
| 96 | *(unsigned short *)pd=gColorMapTab[ps[1]];pd+=xpitch;\r |
| 97 | *(unsigned short *)pd=gColorMapTab[ps[2]];pd+=xpitch;\r |
| 98 | *(unsigned short *)pd=gColorMapTab[ps[4]];pd+=xpitch;\r |
| 99 | ps+=5;\r |
| 100 | }\r |
| 101 | while (ps<end);\r |
| 102 | }\r |
| 103 | \r |
| 104 | return retValue;\r |
| 105 | }\r |
| 106 | \r |
| 107 | \r |
| 108 | \r |
| 109 | static int EmulateScan16_176(unsigned int scan,unsigned short *data)\r |
| 110 | {\r |
| 111 | // int len=0;\r |
| 112 | unsigned short *ps=NULL,*end=NULL;\r |
| 113 | unsigned char *pd=NULL;\r |
| 114 | int xpitch=0;\r |
| 115 | int retValue = 0;\r |
| 116 | if(scan<224)\r |
| 117 | retValue = 1-(gLineTable[scan+1]-gLineTable[scan]);\r |
| 118 | scan = gLineTable[scan];\r |
| 119 | \r |
| 120 | if ((int)scan< 0) return 0; // Out of range\r |
| 121 | if ((int)scan>=176) return 0; // Out of range\r |
| 122 | \r |
| 123 | pd=Targ.screen+gLineOffsets[scan];//Targ.screen+scan*Targ.scanline_length;\r |
| 124 | \r |
| 125 | xpitch=2;\r |
| 126 | if(Pico.video.reg[12]&1)\r |
| 127 | {\r |
| 128 | ps=data; end=ps+320;\r |
| 129 | // Reduce 9 pixels into 5\r |
| 130 | do\r |
| 131 | {\r |
| 132 | *(unsigned short *)pd=gColorMapTab[ps[0]];pd+=xpitch;\r |
| 133 | *(unsigned short *)pd=gColorMapTab[ps[2]];pd+=xpitch;\r |
| 134 | *(unsigned short *)pd=gColorMapTab[ps[4]];pd+=xpitch;\r |
| 135 | *(unsigned short *)pd=gColorMapTab[ps[6]];pd+=xpitch;\r |
| 136 | *(unsigned short *)pd=gColorMapTab[ps[8]];pd+=xpitch;\r |
| 137 | ps+=9;\r |
| 138 | }\r |
| 139 | while (ps<end);\r |
| 140 | } \r |
| 141 | else\r |
| 142 | {\r |
| 143 | ps=data+32; end=ps+256;\r |
| 144 | // Reduce 10 pixels into 7\r |
| 145 | do\r |
| 146 | {\r |
| 147 | *(unsigned short *)pd=gColorMapTab[ps[0]];pd+=xpitch;\r |
| 148 | *(unsigned short *)pd=gColorMapTab[ps[1]];pd+=xpitch;\r |
| 149 | *(unsigned short *)pd=gColorMapTab[ps[3]];pd+=xpitch;\r |
| 150 | *(unsigned short *)pd=gColorMapTab[ps[4]];pd+=xpitch;\r |
| 151 | *(unsigned short *)pd=gColorMapTab[ps[6]];pd+=xpitch;\r |
| 152 | *(unsigned short *)pd=gColorMapTab[ps[7]];pd+=xpitch; \r |
| 153 | *(unsigned short *)pd=gColorMapTab[ps[9]];pd+=xpitch;\r |
| 154 | ps+=10;\r |
| 155 | }\r |
| 156 | while (ps<end); \r |
| 157 | }\r |
| 158 | \r |
| 159 | return retValue;\r |
| 160 | }\r |
| 161 | \r |
| 162 | static int EmulateStretchScan16_176(unsigned int scan,unsigned short *data)\r |
| 163 | {\r |
| 164 | unsigned short *ps=NULL,*end=NULL;\r |
| 165 | unsigned char *pd=NULL;\r |
| 166 | int xpitch=0;\r |
| 167 | int retValue = 0;\r |
| 168 | if(scan<224)\r |
| 169 | retValue = 1-(gLineTable[scan+1]-gLineTable[scan]);\r |
| 170 | scan = gLineTable[scan];\r |
| 171 | \r |
| 172 | if ((int)scan<0) \r |
| 173 | return 0; // Out of range\r |
| 174 | if ((int)scan>=208) \r |
| 175 | return 0; // Out of range\r |
| 176 | \r |
| 177 | pd=Targ.screen+gLineOffsets[scan];//Targ.screen+scan*Targ.scanline_length;\r |
| 178 | \r |
| 179 | xpitch=2;\r |
| 180 | if(Pico.video.reg[12]&1)\r |
| 181 | {\r |
| 182 | ps=data; end=ps+320;\r |
| 183 | // Reduce 9 pixels into 5\r |
| 184 | do\r |
| 185 | {\r |
| 186 | *(unsigned short *)pd=gColorMapTab[ps[0]];pd+=xpitch;\r |
| 187 | *(unsigned short *)pd=gColorMapTab[ps[2]];pd+=xpitch;\r |
| 188 | *(unsigned short *)pd=gColorMapTab[ps[4]];pd+=xpitch;\r |
| 189 | *(unsigned short *)pd=gColorMapTab[ps[6]];pd+=xpitch;\r |
| 190 | *(unsigned short *)pd=gColorMapTab[ps[8]];pd+=xpitch;\r |
| 191 | ps+=9;\r |
| 192 | }\r |
| 193 | while (ps<end);\r |
| 194 | }\r |
| 195 | else\r |
| 196 | {\r |
| 197 | ps=data+32; end=ps+256;\r |
| 198 | // Reduce 10 pixels into 7\r |
| 199 | do\r |
| 200 | {\r |
| 201 | *(unsigned short *)pd=gColorMapTab[ps[0]];pd+=xpitch;\r |
| 202 | *(unsigned short *)pd=gColorMapTab[ps[1]];pd+=xpitch;\r |
| 203 | *(unsigned short *)pd=gColorMapTab[ps[3]];pd+=xpitch;\r |
| 204 | *(unsigned short *)pd=gColorMapTab[ps[4]];pd+=xpitch;\r |
| 205 | *(unsigned short *)pd=gColorMapTab[ps[6]];pd+=xpitch;\r |
| 206 | *(unsigned short *)pd=gColorMapTab[ps[7]];pd+=xpitch; \r |
| 207 | *(unsigned short *)pd=gColorMapTab[ps[9]];pd+=xpitch;\r |
| 208 | ps+=10;\r |
| 209 | }\r |
| 210 | while (ps<end); \r |
| 211 | }\r |
| 212 | \r |
| 213 | return retValue;\r |
| 214 | }\r |
| 215 | \r |
| 216 | \r |
| 217 | \r |
| 218 | static int EmulateStretchScan16_320(unsigned int scan,unsigned short *data)\r |
| 219 | {\r |
| 220 | unsigned short *ps=NULL,*end=NULL;\r |
| 221 | unsigned char *pd=NULL;\r |
| 222 | int xpitch=0;\r |
| 223 | int retValue = 0;\r |
| 224 | if(scan<224)\r |
| 225 | retValue = 1-(gLineTable[scan+1]-gLineTable[scan]);\r |
| 226 | scan = gLineTable[scan];\r |
| 227 | \r |
| 228 | if ((int)scan<0) \r |
| 229 | return 0; // Out of range\r |
| 230 | if ((int)scan>=208) \r |
| 231 | return 0; // Out of range\r |
| 232 | \r |
| 233 | pd=Targ.screen+gLineOffsets[scan];//Targ.screen+scan*Targ.scanline_length;\r |
| 234 | \r |
| 235 | xpitch=2;\r |
| 236 | ps=data+gFullOffset; end=ps+176;\r |
| 237 | /* if(!(Pico.video.reg[12]&1))\r |
| 238 | {\r |
| 239 | ps=data+gFullOffset; end=ps+176;\r |
| 240 | }\r |
| 241 | else\r |
| 242 | {\r |
| 243 | ps=data+32+gFullOffset; end=ps+176;\r |
| 244 | }*/\r |
| 245 | \r |
| 246 | // Draw 8 pixels in a row\r |
| 247 | do\r |
| 248 | {\r |
| 249 | *(unsigned short *)pd=gColorMapTab[ps[0]];pd+=xpitch;\r |
| 250 | *(unsigned short *)pd=gColorMapTab[ps[1]];pd+=xpitch;\r |
| 251 | *(unsigned short *)pd=gColorMapTab[ps[2]];pd+=xpitch;\r |
| 252 | *(unsigned short *)pd=gColorMapTab[ps[3]];pd+=xpitch;\r |
| 253 | *(unsigned short *)pd=gColorMapTab[ps[4]];pd+=xpitch;\r |
| 254 | *(unsigned short *)pd=gColorMapTab[ps[5]];pd+=xpitch;\r |
| 255 | *(unsigned short *)pd=gColorMapTab[ps[6]];pd+=xpitch;\r |
| 256 | *(unsigned short *)pd=gColorMapTab[ps[7]];pd+=xpitch;\r |
| 257 | ps+=8;\r |
| 258 | }\r |
| 259 | while (ps<end);\r |
| 260 | \r |
| 261 | return retValue;\r |
| 262 | }\r |
| 263 | \r |
| 264 | \r |
| 265 | \r |