35#if defined(__coco3__) || defined(__coco3b__)
40static RGBi SYSTEM_PALETTE[] = {
41 { 0x00, 0x00, 0x00, 0xff, 0x00,
"BLACK", 0x00 },
42 { 0x00, 0x00, 0x55, 0xff, 0x00,
"COLOR", 0x01 },
43 { 0x00, 0x00, 0xaa, 0xff, 0x00,
"BLUE", 0x08 },
44 { 0x00, 0x00, 0xff, 0xff, 0x00,
"LIGHT BLUE", 0x09 },
45 { 0x00, 0x55, 0x00, 0xff, 0x00,
"COLOR", 0x02 },
46 { 0x00, 0x55, 0x55, 0xff, 0x00,
"DARK CYAN", 0x03 },
47 { 0x00, 0x55, 0xaa, 0xff, 0x00,
"COLOR", 0x0a },
48 { 0x00, 0x55, 0xff, 0xff, 0x00,
"COLOR", 0x0b },
49 { 0x00, 0xaa, 0x00, 0xff, 0x00,
"GREEN", 0x10 },
50 { 0x00, 0xaa, 0x55, 0xff, 0x00,
"COLOR", 0x11 },
51 { 0x00, 0xaa, 0xaa, 0xff, 0x00,
"CYAN", 0x18 },
52 { 0x00, 0xaa, 0xff, 0xff, 0x00,
"COLOR", 0x19 },
53 { 0x00, 0xff, 0x00, 0xff, 0x00,
"LIGHT GREEN", 0x12 },
54 { 0x00, 0xff, 0x55, 0xff, 0x00,
"COLOR", 0x13 },
55 { 0x00, 0xff, 0xaa, 0xff, 0x00,
"COLOR", 0x1a },
56 { 0x00, 0xff, 0xff, 0xff, 0x00,
"LIGHT CYAN", 0x1b },
57 { 0x55, 0x00, 0x00, 0xff, 0x00,
"COLOR", 0x04 },
58 { 0x55, 0x00, 0x55, 0xff, 0x00,
"PURPLE", 0x05 },
59 { 0x55, 0x00, 0xaa, 0xff, 0x00,
"COLOR", 0x0c },
60 { 0x55, 0x00, 0xff, 0xff, 0x00,
"COLOR", 0x0d },
61 { 0x55, 0x55, 0x00, 0xff, 0x00,
"COLOR", 0x06 },
62 { 0x55, 0x55, 0x55, 0xff, 0x00,
"COLOR", 0x07 },
63 { 0x55, 0x55, 0xaa, 0xff, 0x00,
"COLOR", 0x0e },
64 { 0x55, 0x55, 0xff, 0xff, 0x00,
"COLOR", 0x0f },
65 { 0x55, 0xaa, 0x00, 0xff, 0x00,
"COLOR", 0x14},
66 { 0x55, 0xaa, 0x55, 0xff, 0x00,
"COLOR", 0x15 },
67 { 0x55, 0xaa, 0xaa, 0xff, 0x00,
"COLOR", 0x1c },
68 { 0x55, 0xaa, 0xff, 0xff, 0x00,
"PASTEL BLUE", 0x1d },
69 { 0x55, 0xff, 0x00, 0xff, 0x00,
"COLOR", 0x16 },
70 { 0x55, 0xff, 0x55, 0xff, 0x00,
"COLOR", 0x17 },
71 { 0x55, 0xff, 0xaa, 0xff, 0x00,
"COLOR", 0x1e },
72 { 0x55, 0xff, 0xff, 0xff, 0x00,
"COLOR", 0x1f },
73 { 0xaa, 0x00, 0x00, 0xff, 0x00,
"RED", 0x20 },
74 { 0xaa, 0x00, 0x55, 0xff, 0x00,
"COLOR", 0x21 },
75 { 0xaa, 0x00, 0xaa, 0xff, 0x00,
"MAGENTA", 0x28 },
76 { 0xaa, 0x00, 0xff, 0xff, 0x00,
"COLOR", 0x29 },
77 { 0xaa, 0x55, 0x00, 0xff, 0x00,
"COLOR", 0x22 },
78 { 0xaa, 0x55, 0x55, 0xff, 0x00,
"COLOR", 0x23 },
79 { 0xaa, 0x55, 0xaa, 0xff, 0x00,
"MAUVE", 0x2a },
80 { 0xaa, 0x55, 0xff, 0xff, 0x00,
"COLOR", 0x2b },
81 { 0xaa, 0xaa, 0x00, 0xff, 0x00,
"YELLOW", 0x30 },
82 { 0xaa, 0xaa, 0x55, 0xff, 0x00,
"COLOR", 0x31 },
83 { 0xaa, 0xaa, 0xaa, 0xff, 0x00,
"WHITE", 0x38 },
84 { 0xaa, 0xaa, 0xff, 0xff, 0x00,
"COLOR", 0x39 },
85 { 0xaa, 0xff, 0x00, 0xff, 0x00,
"COLOR", 0x32 },
86 { 0xaa, 0xff, 0x55, 0xff, 0x00,
"COLOR", 0x33 },
87 { 0xaa, 0xff, 0xaa, 0xff, 0x00,
"COLOR", 0x3a },
88 { 0xaa, 0xff, 0xff, 0xff, 0x00,
"COLOR", 0x3b },
89 { 0xff, 0x00, 0x00, 0xff, 0x00,
"LIGHT RED", 0x24},
90 { 0xff, 0x00, 0x55, 0xff, 0x00,
"COLOR", 0x25 },
91 { 0xff, 0x00, 0xaa, 0xff, 0x00,
"COLOR", 0x2c },
92 { 0xff, 0x00, 0xff, 0xff, 0x00,
"LIGHT MAGENTA", 0x2d },
93 { 0xff, 0x55, 0x00, 0xff, 0x00,
"ORANGE", 0x26 },
94 { 0xff, 0x55, 0x55, 0xff, 0x00,
"PINK", 0x27 },
95 { 0xff, 0x55, 0xaa, 0xff, 0x00,
"COLOR", 0x2e },
96 { 0xff, 0x55, 0xff, 0xff, 0x00,
"COLOR", 0x2f },
97 { 0xff, 0xaa, 0x00, 0xff, 0x00,
"COLOR", 0x34 },
98 { 0xff, 0xaa, 0x55, 0xff, 0x00,
"COLOR", 0x35 },
99 { 0xff, 0xaa, 0xaa, 0xff, 0x00,
"COLOR", 0x3c },
100 { 0xff, 0xaa, 0xff, 0xff, 0x00,
"COLOR", 0x3d },
101 { 0xff, 0xff, 0x00, 0xff, 0x00,
"COLOR", 0x36 },
102 { 0xff, 0xff, 0x55, 0xff, 0x00,
"COLOR", 0x37 },
103 { 0xff, 0xff, 0xaa, 0xff, 0x00,
"COLOR", 0x3e },
104 { 0xff, 0xff, 0xff, 0xff, 0x00,
"LIGHT WHITE", 0x3f }
107static RGBi * commonPalette;
114static int rgbConverterFunction(
int _red,
int _green,
int _blue ) {
116 return RGB2GIME( _red, _green, _blue );
170 outline1(
"STB %s", _background_color );
187 outline1(
"LDB %s", _background_color );
188 outline0(
"JSR GIMEUPDATEPALETTE" );
260#define GIME_MODE( _graphics, _linesize ) \
261 outline0( "LDA GIMEVIDM" ); \
262 outline0( "ANDA #$8" ); \
263 outline1( "ORA #$%2.2x", ( ( _graphics & 0x01 ) << 7 ) | ( _linesize & 0x03 ) ); \
264 outline0( "STA GIMEVIDM" ); \
265 outline0( "STA GIMEVIDMSHADOW" );
267#define GIME_TEXT( ) GIME_MODE( 0, 3 )
268#define GIME_GRAPH( ) GIME_MODE( 1, 1 )
275#define GIME_HRES_32COLS 0
276#define GIME_CRES_32COLS 1
278#define GIME_HRES_40COLS 1
279#define GIME_CRES_40COLS 1
281#define GIME_HRES_64COLS 4
282#define GIME_CRES_64COLS 1
284#define GIME_HRES_80COLS 5
285#define GIME_CRES_80COLS 1
287#define GIME_2COLORS 0
288#define GIME_4COLORS 1
289#define GIME_16COLORS 2
290#define GIME_32COLORS 3
292#define GIME_128PIXELS 0
293#define GIME_160PIXELS 1
294#define GIME_256PIXELS 2
295#define GIME_320PIXELS 3
296#define GIME_512PIXELS 4
297#define GIME_640PIXELS 5
298#define GIME_1024PIXELS 6
299#define GIME_1280PIXELS 7
301#define GIME_RESOLUTION( _hres, _cres, _vres ) \
302 outline1( "LDA #$%2.2x", ( ( _vres & 0x03 ) << 5 ) | ( ( _hres & 0x07 ) << 2 ) | ( ( _cres & 0x03 ) ) ); \
303 outline0( "STA GIMEVIDR" );
305#define GIME_ADDRESS( _address ) \
306 outline1( "LDD #$%4.4x", ( _address >> 3 ) ); \
307 outline0( "STA GIMEVOFF1" ); \
308 outline0( "STB GIMEVOFF0" ); \
309 outline0( "CLR GIMEHOFF" );
311#define GIME_128K( ) GIME_ADDRESS( 0x60000 )
312#define GIME_512K( ) GIME_\( 0x00000 )
316 int consoleSA = 0x4000;
345 int currentFrameSize;
364 if ( currentFrameSize <= 0x2000 ) {
366 }
else if ( currentFrameSize <= 0x4000 ) {
368 }
else if ( currentFrameSize <= 0x6000 ) {
370 }
else if ( currentFrameSize <= 0x8000 ) {
402 switch( _screen_mode->
id ) {
1136 int currentFrameSize;
1138 if ( _screen_mode->
bitmap ) {
1155 if ( currentFrameSize <= 0x2000 ) {
1160 }
else if ( currentFrameSize <= 0x4000 ) {
1165 }
else if ( currentFrameSize <= 0x6000 ) {
1170 }
else if ( currentFrameSize <= 0x8000 ) {
1203 cpu_store_16bit( _environment,
"CURRENTFRAMESIZE", currentFrameSize );
1217 cpu_call( _environment,
"GIMERAM" );
1283 outline1(
"LDX %4.4x", (_x & 0xffff ) );
1285 outline1(
"LDD %4.4x", ( _y & 0xffff ) );
1288 outline1(
"LDB #$%2.2x", (
unsigned char)( *_c & 0xff ) );
1427 outline1(
"LDA %s", _displacement );
1474 deploy( clsBox, src_hw_gime_cls_box_asm );
1492 outline1(
"LDA #$%2.2x", ( _direction & 0xff ) );
1494 outline1(
"LDA #$%2.2x", ( _overlap & 0xff ) );
1516 deploy_preferred( textEncodedAtTextRaw, src_hw_gime_text_at_text_raw_asm );
1520 deploy_preferred( textEncodedAtGraphicRaw, src_hw_gime_text_at_graphic_raw_asm );
1521 outline0(
"JSR TEXTATBITMAPMODERAW");
1733 if ( commonPalette ) {
1734 palette = commonPalette;
1736 palette = SYSTEM_PALETTE;
1739 for( i=0; i<7; ++i ) {
1740 out1(
"$%2.2x, ", palette[i].hardwareIndex );
1742 outline1(
"$%2.2x ", palette[i].hardwareIndex );
1745 for( i=8; i<14; ++i ) {
1746 out1(
"$%2.2x, ", palette[i].hardwareIndex );
1748 outline1(
"$%2.2x ", palette[i].hardwareIndex );
1759 copperList = copperList->
next;
1770 outline1(
"LDA #$%2.2x", ( _direction & 0xff ) );
1772 outline1(
"LDA #$%2.2x", ( _overlap & 0xff ) );
1786 outline1(
"LDA #$%2.2x", ( _direction & 0xff ) );
1788 outline1(
"LDA #$%2.2x", ( _overlap & 0xff ) );
1804 if ( _characters ) {
1816 deploy( textCline, src_hw_gime_cline_text_asm );
1819 deploy( textClineGraphic, src_hw_gime_cline_graphic_asm );
1848 return 3 + ( ( _width >> 3 ) * _height ) + 2;
1875 return 3 + ( ( _width >> 2 ) * _height ) + 4;
1896 return 3 + ( ( _width >> 1 ) * _height ) + 16;
1904static int calculate_images_size(
Environment * _environment,
int _frames,
int _width,
int _height,
int _mode ) {
1927 return 3 + ( 3 + ( ( _width >> 3 ) * _height ) + 2 ) * _frames;
1954 return 3 + ( 3 + ( ( _width >> 2 ) * _height ) + 4 ) * _frames;
1975 return 3 + ( 3 + ( ( _width >> 1 ) * _height ) + 16 ) * _frames;
1983static int calculate_sequence_size(
Environment * _environment,
int _sequences,
int _frames,
int _width,
int _height,
int _mode ) {
2006 return 3 + ( ( 3 + ( ( _width >> 3 ) * _height ) + 2 ) * _frames ) * _sequences;
2033 return 3 + ( ( 3 + ( ( _width >> 2 ) * _height ) + 4 ) * _frames ) * _sequences;
2054 return 3 + ( ( 3 + ( ( _width >> 1 ) * _height ) + 16 ) * _frames ) * _sequences;
2062static Variable * gime_image_converter_bitmap_mode_hires(
Environment * _environment,
char * _source,
int _width,
int _height,
int _depth,
int _offset_x,
int _offset_y,
int _frame_width,
int _frame_height,
int _transparent_color,
int _flags ) {
2065 (void)!_transparent_color;
2071 _width = ( ( ( _width - 1 ) / 8 ) - 1 ) * 8;
2073 if ( _frame_width % 8 ) {
2074 _frame_width = ( ( ( _frame_width - 1 ) / 8 ) - 1 ) * 8;
2082 if (paletteColorCount > 2) {
2088 if ( ! commonPalette ) {
2090 commonPalette =
palette_match( palette, paletteColorCount, SYSTEM_PALETTE,
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi) );
2093 if ( _transparent_color & 0x0f0000 ) {
2096 if ( _transparent_color & 0xf00000 ) {
2098 paletteColorCount = 2;
2106 RGBi * newPalette =
palette_match( palette, paletteColorCount, SYSTEM_PALETTE,
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi) );
2110 int mergedCommonPalette = 0;
2114 if ( _transparent_color & 0x0f0000 ) {
2117 if ( _transparent_color & 0xf00000 ) {
2119 mergedCommonPalette = 2;
2140 char * buffer =
malloc ( bufferSize );
2143 int image_x, image_y;
2156 *(buffer) = ( _frame_width >> 8 ) & 0xff;
2157 *(buffer+1) = (_frame_width & 0xff);
2158 *(buffer+2) = _frame_height;
2160 _source += ( ( _offset_y * _width ) + _offset_x ) * _depth;
2163 for (image_y = 0; image_y < _frame_height; ++image_y) {
2164 for (image_x = 0; image_x < _frame_width; ++image_x) {
2168 rgb.
green = *(_source + 1);
2169 rgb.
blue = *(_source + 2);
2171 rgb.
alpha = *(_source + 3);
2175 if ( rgb.
alpha == 0 ) {
2181 if ( rgb.
alpha < 255 ) {
2184 int minDistance = 9999;
2198 offset = (image_y *( _frame_width >> 3 ) ) + (image_x >> 3 );
2199 bitmask = 1 << ( 7 - (image_x & 0x7) );
2201 if ( colorIndex == 1 ) {
2202 *( buffer +
offset + 3) |= bitmask;
2204 *( buffer +
offset + 3) &= ~bitmask;
2211 _source += ( _width - _frame_width ) * _depth;
2220 hwIndex = commonPalette[1].hardwareIndex;
2224 *(buffer + 3 + ( ( _frame_width >> 3 ) * _frame_height ) + 1 ) = hwIndex;
2227 hwIndex = commonPalette[0].hardwareIndex;
2231 *(buffer + 3 + ( ( _frame_width >> 3 ) * _frame_height ) ) = hwIndex;
2239static Variable * gime_image_converter_multicolor_mode_midres(
Environment * _environment,
char * _source,
int _width,
int _height,
int _depth,
int _offset_x,
int _offset_y,
int _frame_width,
int _frame_height,
int _transparent_color,
int _flags ) {
2245 _width = ( ( ( _width - 1 ) / 8 ) - 1 ) * 8;
2247 if ( _frame_width % 8 ) {
2248 _frame_width = ( ( ( _frame_width - 1 ) / 8 ) - 1 ) * 8;
2256 if (paletteColorCount > 4) {
2262 if ( ! commonPalette ) {
2264 commonPalette =
palette_match( palette, paletteColorCount, SYSTEM_PALETTE,
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi) );
2266 if ( _transparent_color & 0x0f0000 ) {
2269 if ( _transparent_color & 0xf00000 ) {
2271 paletteColorCount = 4;
2278 RGBi * newPalette =
palette_match( palette, paletteColorCount, SYSTEM_PALETTE,
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi) );
2282 int mergedCommonPalette = 0;
2286 if ( _transparent_color & 0x0f0000 ) {
2289 if ( _transparent_color & 0xf00000 ) {
2291 mergedCommonPalette = 4;
2312 char * buffer =
malloc ( bufferSize );
2313 memset( buffer, 0, bufferSize );
2316 int image_x, image_y;
2322 int offset, offsetc, bitmask;
2327 *(buffer) = (_frame_width >> 8 ) & 0xff;
2328 *(buffer+1) = (_frame_width & 0xff);
2329 *(buffer+2) = _frame_height;
2331 _source += ( ( _offset_y * _width ) + _offset_x ) * _depth;
2334 for (image_y = 0; image_y < _frame_height; ++image_y) {
2335 for (image_x = 0; image_x < _frame_width; ++image_x) {
2339 rgb.
green = *(_source + 1);
2340 rgb.
blue = *(_source + 2);
2342 rgb.
alpha = *(_source + 3);
2346 if ( rgb.
alpha == 0 ) {
2354 offset = (image_y * ( _frame_width >> 2 ) ) + (image_x>>2);
2358 if ( rgb.
alpha < 255 ) {
2361 int minDistance = 9999;
2373 bitmask = ( ( colorIndex & 0x3 ) ) << ((3 - ((image_x & 0x3)))*2);
2375 *(buffer + 3 +
offset) |= bitmask;
2381 _source += ( _width - _frame_width ) * _depth;
2389 hwIndex = commonPalette[0].hardwareIndex;
2393 *(buffer + 3 + ( ( _frame_width >> 2 ) * _frame_height ) )= hwIndex;
2396 hwIndex = commonPalette[1].hardwareIndex;
2400 *(buffer + 3 + ( ( _frame_width >> 2 ) * _frame_height ) + 1 ) = hwIndex;
2403 hwIndex = commonPalette[2].hardwareIndex;
2407 *(buffer + 3 + ( ( _frame_width >> 2 ) * _frame_height ) + 2 ) = hwIndex;
2410 hwIndex = commonPalette[3].hardwareIndex;
2414 *(buffer + 3 + ( ( _frame_width >> 2 ) * _frame_height ) + 3 ) = hwIndex;
2422static Variable * gime_image_converter_multicolor_mode_lores(
Environment * _environment,
char * _source,
int _width,
int _height,
int _depth,
int _offset_x,
int _offset_y,
int _frame_width,
int _frame_height,
int _transparent_color,
int _flags ) {
2428 _width = ( ( ( _width - 1 ) / 8 ) - 1 ) * 8;
2430 if ( _frame_width % 8 ) {
2431 _frame_width = ( ( ( _frame_width - 1 ) / 8 ) - 1 ) * 8;
2439 if (paletteColorCount > 16) {
2445 if ( ! commonPalette ) {
2447 commonPalette =
palette_match( palette, paletteColorCount, SYSTEM_PALETTE,
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi) );
2450 if ( _transparent_color & 0x0f0000 ) {
2453 if ( _transparent_color & 0xf00000 ) {
2455 paletteColorCount = 16;
2463 RGBi * newPalette =
palette_match( palette, paletteColorCount, SYSTEM_PALETTE,
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi) );
2469 int mergedCommonPalette = 0;
2473 if ( _transparent_color & 0x0f0000 ) {
2476 if ( _transparent_color & 0xf00000 ) {
2478 mergedCommonPalette = 16;
2499 char * buffer =
malloc ( bufferSize );
2500 memset( buffer, 0, bufferSize );
2503 int image_x, image_y;
2509 int offset, offsetc, bitmask;
2514 *(buffer) = (_frame_width >> 8 ) & 0xff;
2515 *(buffer+1) = (_frame_width & 0xff);
2516 *(buffer+2) = _frame_height;
2518 _source += ( ( _offset_y * _width ) + _offset_x ) * _depth;
2521 for (image_y = 0; image_y < _frame_height; ++image_y) {
2522 for (image_x = 0; image_x < _frame_width; ++image_x) {
2526 rgb.
green = *(_source + 1);
2527 rgb.
blue = *(_source + 2);
2529 rgb.
alpha = *(_source + 3);
2533 if ( rgb.
alpha == 0 ) {
2541 offset = (image_y * ( _frame_width >> 1 ) ) + (image_x>>1);
2545 if ( rgb.
alpha < 255 ) {
2548 int minDistance = 9999;
2560 bitmask = ( ( colorIndex & 0xF ) ) << (4 - ((image_x & 0x1)*4));
2562 *(buffer + 3 +
offset) |= bitmask;
2568 _source += ( _width - _frame_width ) * _depth;
2574 for(
int i=0; i<16; ++i ) {
2577 hwIndex = commonPalette[i].hardwareIndex;
2579 *(buffer + 3 + ( ( _frame_width >> 1 ) * _frame_height ) + i ) = hwIndex;
2588Variable *
gime_image_converter(
Environment * _environment,
char * _data,
int _width,
int _height,
int _depth,
int _offset_x,
int _offset_y,
int _frame_width,
int _frame_height,
int _mode,
int _transparent_color,
int _flags ) {
2611 return gime_image_converter_bitmap_mode_hires( _environment, _data, _width, _height, _depth, _offset_x, _offset_y, _frame_width, _frame_height, _transparent_color, _flags );
2638 return gime_image_converter_multicolor_mode_midres( _environment, _data, _width, _height, _depth, _offset_x, _offset_y, _frame_width, _frame_height, _transparent_color, _flags );
2659 return gime_image_converter_multicolor_mode_lores( _environment, _data, _width, _height, _depth, _offset_x, _offset_y, _frame_width, _frame_height, _transparent_color, _flags );
2667static void gime_load_image_address_to_y(
Environment * _environment,
char * _source,
char * _sequence,
char * _frame,
int _frame_size,
int _frame_count ) {
2672 if ( strlen(_sequence) == 0 ) {
2674 outline1(
"LDX #OFFSETS%4.4x", _frame_count * _frame_size );
2683 if ( strlen(_frame) == 0 ) {
2685 outline1(
"LDX #OFFSETS%4.4x", _frame_size );
2697 if ( strlen(_frame) == 0 ) {
2699 outline1(
"LDX #OFFSETS%4.4x", _frame_size );
2712static void gime_load_image_address_to_register(
Environment * _environment,
char * _register,
Resource * _source,
char * _sequence,
char * _frame,
int _frame_size,
int _frame_count ) {
2721 if ( strlen(_sequence) == 0 ) {
2727 if ( strlen(_frame) == 0 ) {
2736 if ( strlen(_frame) == 0 ) {
2750void gime_blit_image(
Environment * _environment,
char * _sources[],
int _source_count,
char * _blit,
char * _x,
char * _y,
char * _frame,
char * _sequence,
int _frame_size,
int _frame_count,
int _flags ) {
2755 if ( _source_count > 2 ) {
2764 outline0(
"STY BLITIMAGEBLITADDR" );
2766 if ( _source_count > 0 ) {
2768 resource.
realName = strdup( _sources[0] );
2771 gime_load_image_address_to_register( _environment,
"BLITTMPPTR", &resource, _sequence, _frame, _frame_size, _frame_count );
2777 if ( _source_count > 1 ) {
2779 resource.
realName = strdup( _sources[1] );
2782 gime_load_image_address_to_register( _environment,
"BLITTMPPTR2", &resource, _sequence, _frame, _frame_size, _frame_count );
2793 outline1(
"LDA #$%2.2x", ( _flags & 0xff ) );
2795 outline1(
"LDA #$%2.2x", ( (_flags>>8) & 0xff ) );
2812 if ( _frame_size ) {
2815 if ( strlen(_sequence) == 0 ) {
2821 if ( strlen(_frame) == 0 ) {
2830 if ( strlen(_frame) == 0 ) {
2863 memset( buffer, 0,
size );
2865 *(buffer) = (_width >> 8 );
2866 *(buffer+1) = (_width & 0xff );
2867 *(buffer+2) = _height;
2878 int size = calculate_images_size( _environment, _frames, _width, _height, _mode );
2879 int frameSize =
gime_image_size( _environment, _width, _height, _mode );
2888 memset( buffer, 0,
size );
2890 *(buffer) = _frames;
2891 *(buffer+1) = ( _width & 0xff );
2892 *(buffer+2) = ( _width >> 8 ) & 0xff;
2893 for(
int i=0; i<_frames; ++i ) {
2894 *(buffer+3+(i*frameSize)) = ( ( _width >> 8 ) & 0xff );
2895 *(buffer+3+(i*frameSize)+1) = ( _width & 0xff );
2896 *(buffer+3+(i*frameSize)+2) = ( _height & 0xff );
2910 int size2 = calculate_sequence_size( _environment, _sequences, _frames, _width, _height, _mode );
2911 int size = calculate_images_size( _environment, _frames, _width, _height, _mode );
2912 int frameSize =
gime_image_size( _environment, _width, _height, _mode );
2920 char * buffer =
malloc ( size2 );
2921 memset( buffer, 0, size2 );
2923 *(buffer) = _frames;
2924 *(buffer+1) = _width;
2925 *(buffer+2) = _sequences;
2926 for(
int i=0; i<(_frames*_sequences); ++i ) {
2927 *(buffer+3+(i*frameSize)) = ( ( _width >> 8 ) & 0xff );
2928 *(buffer+3+(i*frameSize)+1) = ( _width & 0xff );
2929 *(buffer+3+(i*frameSize)+2) = ( _height & 0xff );
2941void gime_get_image(
Environment * _environment,
char * _image,
char * _x,
char * _y,
char * _frame,
char * _sequence,
int _frame_size,
int _frame_count,
int _palette ) {
2946 gime_load_image_address_to_y( _environment, _image, _sequence, _frame, _frame_size, _frame_count );
2952 outline1(
"LDA #$%2.2x", _palette );
2992void gime_slice_image(
Environment * _environment,
char * _image,
char * _frame,
char * _sequence,
int _frame_size,
int _frame_count,
char * _destination ) {
3000 memcpy( _palette,
palette_match( _palette, paletteColorCount, SYSTEM_PALETTE,
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi) ), paletteColorCount *
sizeof(
RGBi ) );
3002 int uniquePaletteCount = 0;
3006 return uniquePaletteCount;
3015 if ( strlen(_sequence) == 0 ) {
3017 outline1(
"LDX #OFFSETS%4.4x", _frame_count * _frame_size );
3026 if ( strlen(_frame) == 0 ) {
3028 outline1(
"LDX #OFFSETS%4.4x", _frame_size );
3040 if ( strlen(_frame) == 0 ) {
3042 outline1(
"LDX #OFFSETS%4.4x", _frame_size );
3059 deploy( gimevars, src_hw_gime_vars_asm);
3061 if ( strcmp( _direction,
"#FLIPIMAGEDIRECTION0001" ) == 0 || strcmp( _direction,
"#FLIPIMAGEDIRECTION0003" ) == 0 ) {
3062 gime_load_image_address_to_register( _environment,
"TMPPTR", _image, _sequence, _frame, _frame_size, _frame_count );
3063 deploy( flipimagex, src_hw_gime_flip_image_x_asm );
3069 gime_load_image_address_to_register( _environment,
"TMPPTR", _image, _sequence, _frame, _frame_size, _frame_count );
3070 deploy( flipimagex, src_hw_gime_flip_image_x_asm );
3079 if ( strcmp( _direction,
"#FLIPIMAGEDIRECTION0002" ) == 0 || strcmp( _direction,
"#FLIPIMAGEDIRECTION0003" ) == 0 ) {
3080 gime_load_image_address_to_register( _environment,
"TMPPTR", _image, _sequence, _frame, _frame_size, _frame_count );
3081 deploy( flipimagey, src_hw_gime_flip_image_y_asm );
3087 gime_load_image_address_to_register( _environment,
"TMPPTR", _image, _sequence, _frame, _frame_size, _frame_count );
3088 deploy( flipimagey, src_hw_gime_flip_image_y_asm );
3102 deploy( screen, src_hw_gime_screen_asm);
3119 outline0(
"LDX FLASHREGISTERADDRESSES" );
void cpu_store_16bit(Environment *_environment, char *_destination, int _value)
CPU 6309: emit code to store 16 bit
void cpu_move_16bit(Environment *_environment, char *_source, char *_destination)
CPU 6309: emit code to move 16 bit
void cpu_call(Environment *_environment, char *_label)
void cpu_store_8bit(Environment *_environment, char *_destination, int _value)
CPU 6309: emit code to store 8 bit
int lastUsedSlotInCommonPalette
Variable * variable_retrieve(Environment *_environment, char *_name)
Variable * variable_retrieve_or_define(Environment *_environment, char *_name, VariableType _type, int _value)
int rgbi_distance(RGBi *_e1, RGBi *_e2)
Calculate the distance between two colors.
RGBi * palette_merge(RGBi *_palette1, int _palette1_size, RGBi *_palette2, int _palette2_size, int *_size)
Make a "palette merge".
void image_converter_asserts_free_height(Environment *_environment, int _width, int _height, int _offset_x, int _offset_y, int *_frame_width, int *_frame_height, int _modulo_x)
Variable * variable_import(Environment *_environment, char *_name, VariableType _type, int _size_or_value)
RGBi * palette_promote_color_as_background(int _index, RGBi *_source, int _source_size)
Promote an index color in a palette.
RGBi * malloc_palette(int _size)
Allocate a palette space.
void variable_global(Environment *_environment, char *_pattern)
ScreenMode * find_screen_mode_by_suggestion(Environment *_environment, int _bitmap, int _width, int _height, int _colors, int _tile_width, int _tile_height)
Variable * variable_temporary(Environment *_environment, VariableType _type, char *_meaning)
Define a temporary variable.
int rgbi_extract_palette(Environment *_environment, unsigned char *_source, int _width, int _height, int _depth, RGBi _palette[], int _palette_size, int _sorted)
Extract the color palette from the given image.
RGBi * palette_promote_color_as_foreground(int _index, RGBi *_source, int _source_size, int _max_size)
Promote an index color in a palette.
RGBi * palette_remove_duplicates(RGBi *_source, int _source_size, int *_unique_size)
Remove duplicates from a palette.
void font_descriptors_init(Environment *_environment, int _embedded_present)
RGBi * palette_match(RGBi *_source, int _source_size, RGBi *_system, int _system_size)
Make a "palette match".
Variable * variable_store_buffer(Environment *_environment, char *_destination, unsigned char *_buffer, int _size, int _at)
void plot(Environment *_environment, char *_x, char *_y, char *_c, int _preserve_color)
#define BITMAP_MODE_320x200x4
#define BITMAP_MODE_320x200x2
#define BITMAP_MODE_640x200x2
void flash(Environment *_environment, char *_index, char *_register)
void console_init(Environment *_environment)
Variable * distance(Environment *_environment, char *_x1, char *_y1, char *_x2, char *_y2)
Return the distance between two (screen) positions.
void gime_flash_end(Environment *_environment)
void gime_back(Environment *_environment)
void gime_cline(Environment *_environment, char *_characters)
void gime_hscroll_screen(Environment *_environment, int _direction, int _overlap)
void gime_collision(Environment *_environment, char *_sprite_mask, char *_result)
VIC-II: emit code to check for collision
void gime_cls_box(Environment *_environment, char *_x1, char *_y1, char *_w, char *_h)
Variable * gime_image_converter(Environment *_environment, char *_data, int _width, int _height, int _depth, int _offset_x, int _offset_y, int _frame_width, int _frame_height, int _mode, int _transparent_color, int _flags)
void gime_put_tile(Environment *_environment, char *_tile, char *_x, char *_y)
void gime_sprite_common_color(Environment *_environment, char *_index, char *_common_color)
VIC-II: emit code to change common sprite's color
void gime_sprite_priority(Environment *_environment, char *_sprite, char *_priority)
void gime_tiles_get(Environment *_environment, char *_result)
void gime_calculate_sequence_frame_offset(Environment *_environment, char *_offset, char *_sequence, char *_frame, int _frame_size, int _frame_count)
void gime_move_tiles(Environment *_environment, char *_tile, char *_x, char *_y)
void gime_scroll(Environment *_environment, int _dx, int _dy)
void gime_sprite_multicolor(Environment *_environment, char *_sprite)
void gime_get_height(Environment *_environment, char *_result)
void gime_screen_rows(Environment *_environment, char *_rows)
void gime_sprite_data_set(Environment *_environment, char *_sprite, char *_address)
void gime_next_raster(Environment *_environment)
VIC-II: emit code to wait for next raster irq
void gime_sprite_monocolor(Environment *_environment, char *_sprite)
void gime_finalization(Environment *_environment)
void gime_background_color_get_vars(Environment *_environment, char *_index, char *_background_color)
void gime_sprite_color(Environment *_environment, char *_sprite, char *_color)
Variable * gime_get_raster_line(Environment *_environment)
void gime_sprite_compress_horizontal(Environment *_environment, char *_sprite)
void gime_sprite_compress_vertical(Environment *_environment, char *_sprite)
void gime_next_raster_at(Environment *_environment, char *_label, char *_positionlo, char *_positionhi)
VIC-II: emit code to wait for next raster irq at different position
void gime_blit_image(Environment *_environment, char *_sources[], int _source_count, char *_blit, char *_x, char *_y, char *_frame, char *_sequence, int _frame_size, int _frame_count, int _flags)
Variable * gime_new_image(Environment *_environment, int _width, int _height, int _mode)
void gime_text(Environment *_environment, char *_text, char *_text_size, int _raw)
void gime_flash_register(Environment *_environment, char *_index, char *_timer, char *_color)
void gime_sprite_at(Environment *_environment, char *_sprite, char *_x, char *_y)
void gime_vertical_scroll(Environment *_environment, char *_displacement)
void gime_tilemap_enable(Environment *_environment, int _width, int _height, int _colors, int _tile_width, int _tile_height)
void gime_initialization(Environment *_environment)
void gime_sprite_data_from(Environment *_environment, char *_sprite, char *_address)
void gime_slice_image(Environment *_environment, char *_image, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_destination)
void gime_tile_at(Environment *_environment, char *_x, char *_y, char *_result)
void gime_cls(Environment *_environment)
void gime_hscroll_line(Environment *_environment, int _direction, int _overlap)
#define GIME_RESOLUTION(_hres, _cres, _vres)
void gime_bitmap_enable(Environment *_environment, int _width, int _height, int _colors)
void gime_tiles_at(Environment *_environment, char *_address)
void gime_pset_int(Environment *_environment, int _x, int _y, int *_c)
void gime_border_color(Environment *_environment, char *_border_color)
VIC-II: emit code to change border color
void gime_hit(Environment *_environment, char *_sprite_mask, char *_result)
VIC-II: emit code to check for collision
void gime_screen_on(Environment *_environment)
void gime_screen_off(Environment *_environment)
void gime_raster_at(Environment *_environment, char *_label, char *_positionlo, char *_positionhi)
VIC-II: emit code to set raster irq
void console_calculate_vars(Environment *_environment)
int gime_screen_mode_enable(Environment *_environment, ScreenMode *_screen_mode)
void gime_sprite_disable(Environment *_environment, char *_sprite)
void gime_background_color(Environment *_environment, char *_index, char *_background_color)
VIC-II: emit code to change background color
int gime_palette_extract(Environment *_environment, char *_data, int _width, int _height, int _depth, int _flags, RGBi *_palette)
void gime_sprite_expand_horizontal(Environment *_environment, char *_sprite)
void gime_put_image(Environment *_environment, Resource *_image, char *_x, char *_y, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_flags)
void gime_bitmap_disable(Environment *_environment)
void gime_get_width(Environment *_environment, char *_result)
void gime_bank_select(Environment *_environment, int _bank)
void gime_use_tileset(Environment *_environment, char *_tileset)
void gime_flash_begin(Environment *_environment, char *_index, char *_register)
void gime_scroll_text(Environment *_environment, int _direction, int _overlap)
Variable * gime_new_images(Environment *_environment, int _frames, int _width, int _height, int _mode)
void gime_bitmap_at(Environment *_environment, char *_address)
void gime_colormap_at(Environment *_environment, char *_address)
void gime_get_image(Environment *_environment, char *_image, char *_x, char *_y, char *_frame, char *_sequence, int _frame_size, int _frame_count, int _palette)
void gime_pset_vars(Environment *_environment, char *_x, char *_y, char *_c)
int gime_image_size(Environment *_environment, int _width, int _height, int _mode)
void gime_screen_columns(Environment *_environment, char *_columns)
void gime_sprite_enable(Environment *_environment, char *_sprite)
void gime_pget_color_vars(Environment *_environment, char *_x, char *_y, char *_result)
void gime_screen(Environment *_environment, char *_x, char *_y, char *_c)
Variable * gime_new_sequence(Environment *_environment, int _sequences, int _frames, int _width, int _height, int _mode)
void gime_put_tiles(Environment *_environment, char *_tile, char *_x, char *_y, char *_w, char *_h)
void gime_flip_image(Environment *_environment, Resource *_image, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_direction)
void console_calculate(Environment *_environment)
void gime_sprite_expand_vertical(Environment *_environment, char *_sprite)
void gime_textmap_at(Environment *_environment, char *_address)
void gime_horizontal_scroll(Environment *_environment, char *_displacement)
#define BITMAP_MODE_256x192x2
#define BITMAP_MODE_80x225x4
#define BITMAP_MODE_160x225x16
#define TILEMAP_MODE_80X25
#define BITMAP_MODE_320x225x4
#define BITMAP_MODE_64x225x4
#define BITMAP_MODE_320x192x2
#define BITMAP_MODE_80x200x4
#define TILEMAP_MODE_40X25
#define BITMAP_MODE_160x225x2
#define BITMAP_MODE_160x192x16
#define BITMAP_MODE_512x200x4
#define BITMAP_MODE_640x192x2
#define BITMAP_MODE_256x200x2
#define BITMAP_MODE_160x200x16
#define BITMAP_MODE_256x225x4
#define BITMAP_MODE_160x192x4
#define BITMAP_MODE_256x192x16
#define BITMAP_MODE_160x200x4
#define BITMAP_MODE_80x225x16
#define BITMAP_MODE_512x192x4
#define TILEMAP_MODE_80X24
#define BITMAP_MODE_128x225x16
#define TILEMAP_MODE_64X25
#define BITMAP_MODE_64x192x16
#define TILEMAP_MODE_32X24
#define BITMAP_MODE_640x225x4
#define BITMAP_MODE_80x192x4
#define BITMAP_MODE_320x192x4
#define BITMAP_MODE_128x192x16
#define BITMAP_MODE_640x192x4
#define BITMAP_MODE_128x192x4
#define BITMAP_MODE_256x192x4
#define TILEMAP_MODE_32X28
#define BITMAP_MODE_512x192x2
#define BITMAP_MODE_640x225x2
#define TILEMAP_MODE_40X28
#define BITMAP_MODE_160x225x4
#define BITMAP_MODE_256x200x4
#define BITMAP_MODE_320x225x2
#define BITMAP_MODE_256x225x2
#define BITMAP_MODE_128x200x4
#define BITMAP_MODE_80x200x16
#define TILEMAP_MODE_32X25
#define TILEMAP_MODE_64X24
#define BITMAP_MODE_128x225x2
#define BITMAP_MODE_256x200x16
#define BITMAP_MODE_64x200x4
#define BITMAP_MODE_320x200x16
#define BITMAP_MODE_256x225x16
#define BITMAP_MODE_128x192x2
#define TILEMAP_MODE_64X28
#define BITMAP_MODE_64x192x4
#define BITMAP_MODE_320x225x16
#define BITMAP_MODE_160x192x2
#define BITMAP_MODE_128x200x2
#define BITMAP_MODE_512x200x2
#define BITMAP_MODE_64x200x16
#define BITMAP_MODE_128x225x4
#define BITMAP_MODE_512x225x4
#define BITMAP_MODE_160x200x2
#define TILEMAP_MODE_80X28
#define BITMAP_MODE_80x192x16
#define BITMAP_MODE_320x192x16
#define TILEMAP_MODE_40X24
#define BITMAP_MODE_640x200x4
#define RGB2GIME(r, g, b)
#define BITMAP_MODE_64x225x16
#define BITMAP_MODE_128x200x16
#define BITMAP_MODE_512x225x2
struct _CopperList * next
RgbConverterFunction currentRgbConverterFunction
VestigialConfig vestigialConfig
unsigned char * valueBuffer
RGBi originalPalette[MAX_PALETTE]
struct _ScreenMode ScreenMode
#define CRITICAL_IMAGE_CONVERTER_TOO_COLORS(f)
struct _Resource Resource
struct _RGBi RGBi
Structure to store color components (red, green and blue).
#define adilineendbitmap()
#define WARNING_SCREEN_MODE(v1)
struct _Variable Variable
Structure of a single variable.
struct _Environment Environment
Structure of compilation environment.
#define adiline3(s, a, b, c)
#define deploy_preferred(s, e)
#define SCREEN_MODE_DEFINE(_id, _bitmap, _width, _height, _colors, _tile_width, _tile_height, _description)
#define CRITICAL_NEW_IMAGES_UNSUPPORTED_MODE(f)
#define CRITICAL_SCREEN_UNSUPPORTED(v)
#define adilinepalette(s, c, p)
#define FONT_SCHEMA_ASCII
#define adilinebeginbitmap(s)
struct _CopperList CopperList
#define CRITICAL_NEW_IMAGE_UNSUPPORTED_MODE(f)
#define CRITICAL_BLIT_TOO_MUCH_SOURCES()