|
|
1.1 root 1: /*
2: Hatari - high640x8.c
3:
4: This file is distributed under the GNU Public License, version 2 or at your
5: option any later version. Read the file gpl.txt for details.
6:
1.1.1.2 root 7: NeXT mono, memory to SDL_Surface
1.1 root 8: */
9:
10: static inline void putpixel(SDL_Surface * surface, Uint16 x, Uint16 y, Uint32 col)
11:
12: {
13:
14: /* Nombre de bits par pixels de la surface d'écran */
15: Uint8 bpp = surface->format->BytesPerPixel;
16: /* Pointeur vers le pixel à remplacer (pitch correspond à la taille
17: d'une ligne d'écran, c'est à dire (longueur * bitsParPixel)
18: pour la plupart des cas) */
19:
20: Uint8 * p1 = ((Uint8 *)surface->pixels) + y * surface->pitch + x * bpp;
21:
22:
23: Uint32 color = colors[col];
24:
25: switch(bpp) {
26: case 1:
27:
28: *p1 = color;
29:
30: break;
31:
32: case 2:
33:
34: *(Uint16 *)p1 = color;
35:
36: break;
37:
38: case 3:
39: if(SDL_BYTEORDER == SDL_BIG_ENDIAN) {
40:
41: p1[0] = (color >> 16) & 0xff;
42: p1[1] = (color >> 8) & 0xff;
43: p1[2] = color & 0xff;
44:
45: } else {
46:
47: p1[0] = color & 0xff;
48: p1[1] = (color >> 8) & 0xff;
49: p1[2] = (color >> 16) & 0xff;
50:
51: }
52: break;
53:
54: case 4:
55:
56: *(Uint32 *)p1 = color;
57: break;
58: }
59:
60: }
61:
62:
63: static void ConvertHighRes_640x8Bit(void)
64: {
65: int y, x;
66: int col;
67: static int first=1;
68:
69: if (first) {
70: first=0;
71: for (x=0;x<4;x++)
72: colors[x] = SDL_MapRGB(sdlscrn->format, sdlColors[x].r, sdlColors[x].g, sdlColors[x].b);
73: }
74:
1.1.1.3 ! root 75: if (ConfigureParams.System.bTurbo) {
! 76: for (y = 0; y < 832; y++)
! 77: {
1.1 root 78:
1.1.1.3 ! root 79: for (x = 0; x < 1120; x++)
! 80: {
! 81: switch (x&0x3)
! 82: {
! 83: case 0x0:
! 84: col=(NEXTVideo[(x/4)+y*280]&0xC0)>>6;
! 85: break;
! 86: case 0x1:
! 87: col=(NEXTVideo[(x/4)+y*280]&0x30)>>4;
! 88: break;
! 89: case 0x2:
! 90: col=(NEXTVideo[(x/4)+y*280]&0x0C)>>2;
! 91: break;
! 92: case 0x3:
! 93: col=(NEXTVideo[(x/4)+y*280]&0x03);
! 94: break;
! 95: }
! 96: /* Hack to provide video output on color systems to *
! 97: * do memory configuration experiments. Remove later */
! 98: if (ConfigureParams.System.bColor) {
! 99: col = (NEXTColorVideo[(x*2)+(y*280*8)]&0x30)>>4;
! 100: }
! 101: /* --------------------------------------------------*/
! 102: putpixel(sdlscrn,x,y,col);
! 103: }
! 104: }
! 105: }
! 106: else {
! 107: for (y = 0; y < 832; y++)
1.1 root 108: {
1.1.1.3 ! root 109:
! 110: for (x = 0; x < 1120; x++)
1.1 root 111: {
1.1.1.3 ! root 112: switch (x&0x3)
! 113: {
! 114: case 0x0:
! 115: col=(NEXTVideo[(x/4)+y*288]&0xC0)>>6;
! 116: break;
! 117: case 0x1:
! 118: col=(NEXTVideo[(x/4)+y*288]&0x30)>>4;
! 119: break;
! 120: case 0x2:
! 121: col=(NEXTVideo[(x/4)+y*288]&0x0C)>>2;
! 122: break;
! 123: case 0x3:
! 124: col=(NEXTVideo[(x/4)+y*288]&0x03);
! 125: break;
! 126: }
! 127: /* Hack to provide video output on color systems to *
! 128: * do memory configuration experiments. Remove later */
! 129: if (ConfigureParams.System.bColor) {
! 130: col = (NEXTColorVideo[(x*2)+(y*288*8)]&0x30)>>4;
! 131: }
! 132: /* --------------------------------------------------*/
! 133: putpixel(sdlscrn,x,y,col);
1.1 root 134: }
135: }
136: }
137: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.