35#if defined(__c64__) || defined(__c128__) || defined(__c64reu__)
42static RGBi SYSTEM_PALETTE[] = {
44 { 0, 0, 0, 0xff, 0,
"BLACK" },
46 { 255, 255, 255, 0xff, 1,
"WHITE" },
48 { 104, 55, 43, 0xff, 2,
"RED" },
50 { 112, 164, 178, 0xff, 3,
"CYAN" },
52 { 111, 61, 134, 0xff, 4,
"PURPLE" },
54 { 88, 141, 67, 0xff, 5,
"GREEN" },
56 { 53, 40, 121, 0xff, 6,
"BLUE" },
58 { 184, 199, 111, 0xff, 7,
"YELLOW" },
60 { 111, 79, 37, 0xff, 8,
"ORANGE" },
62 { 67, 57, 0, 0xff, 9,
"BROWN" },
64 { 154, 103, 89, 0xff, 10,
"LIGHT RED" },
66 { 68, 68, 68, 0xff, 11,
"DARK GREY" },
68 { 108, 108, 108, 0xff, 12,
"GREY" },
70 { 154, 210, 132, 0xff, 13,
"LIGHT GREEN" },
72 { 108, 94, 181, 0xff, 14,
"LIGHT BLUE" },
74 { 149, 149, 149, 0xff, 15,
"LIGHT GREY" }
78static RGBi * commonPalette;
81static int plotVBase[] = {
82 (0xa000+(0*320)),(0xa000+(1*320)),(0xa000+(2*320)),(0xa000+(3*320)),
83 (0xa000+(4*320)),(0xa000+(5*320)),(0xa000+(6*320)),(0xa000+(7*320)),
84 (0xa000+(8*320)),(0xa000+(9*320)),(0xa000+(10*320)),(0xa000+(11*320)),
85 (0xa000+(12*320)),(0xa000+(13*320)),(0xa000+(14*320)),(0xa000+(15*320)),
86 (0xa000+(16*320)),(0xa000+(17*320)),(0xa000+(18*320)),(0xa000+(19*320)),
87 (0xa000+(20*320)),(0xa000+(21*320)),(0xa000+(22*320)),(0xa000+(23*320)),
91 (0*8),(1*8),(2*8),(3*8),(4*8),(5*8),(6*8),(7*8),(8*8),(9*8),
92 (10*8),(11*8),(12*8),(13*8),(14*8),(15*8),(16*8),(17*8),(18*8),(19*8),
93 (20*8),(21*8),(22*8),(23*8),(24*8),(25*8),(26*8),(27*8),(28*8),(29*8),
94 (30*8),(31*8),(32*8),(33*8),(34*8),(35*8),(36*8),(37*8),(38*8),(39*8)
98 (0*4),(1*4),(2*4),(3*4),(4*4),(5*4),(6*4),(7*4),(8*4),(9*4),
99 (10*4),(11*4),(12*4),(13*4),(14*4),(15*4),(16*4),(17*4),(18*4),(19*4),
100 (20*4),(21*4),(22*4),(23*4),(24*4),(25*4),(26*4),(27*4),(28*4),(29*4),
101 (30*4),(31*4),(32*4),(33*4),(34*4),(35*4),(36*4),(37*4),(38*4),(39*4),
102 (40*4),(41*4),(42*4),(43*4),(44*4),(45*4),(46*4),(47*4),(48*4),(49*4),
103 (50*4),(51*4),(52*4),(53*4),(54*4),(55*4),(56*4),(57*4),(58*4),(59*4),
104 (60*4),(61*4),(62*4),(63*4),(64*4),(65*4),(66*4),(67*4),(68*4),(69*4),
105 (70*4),(71*4),(72*4),(73*4),(74*4),(75*4),(76*4),(77*4),(78*4),(79*4),
114 unsigned int minDistance = 0xffff;
124 return &SYSTEM_PALETTE[colorIndex];
139static void vic2_image_converter_tile(
Environment * _environment,
char * _source,
char * _dest,
int _width,
int _depth,
int _source_width ) {
142 memset(colorIndexesCount, 0,
COLOR_COUNT *
sizeof(
int ) );
148 memset( _dest, 0, 9 );
151 for (
int y=0; y<8; ++y) {
152 for (
int x=0; x<8; ++x) {
156 memset( &rgb, 0,
sizeof(
RGBi ) );
167 if ( rgb.
alpha == 0 ) {
173 if ( rgb.
alpha < 255 ) {
177 ++colorIndexesCount[systemRgb->
index];
184 source += _depth * ( _source_width - 8 );
188 int colorBackground = 0;
189 int colorBackgroundMax = 0;
190 int colorForeground = 0;
191 int colorForegroundMax = 0;
193 if ( colorIndexesCount[xx] > colorBackgroundMax ) {
194 colorBackground = xx;
195 colorBackgroundMax = colorIndexesCount[xx];
199 colorIndexesCount[colorBackground] = 0;
202 if ( colorIndexesCount[xx] > colorForegroundMax ) {
203 colorForeground = xx;
204 colorForegroundMax = colorIndexesCount[xx];
209 if ( colorForeground == 0 ) {
210 colorForeground = colorBackground;
217 if ( colorForeground == colorBackground ) {
218 colorForeground = ( colorBackground == 0 ) ? 1 : 0;
223 for (
int y=0; y<8; ++y) {
224 for (
int x=0; x<8; ++x) {
228 memset( &rgb, 0,
sizeof(
RGBi ) );
238 if ( rgb.
alpha == 0 ) {
246 char bitmask = 1 << ( 7 - ((x) & 0x7) );
248 if ( rgb.
alpha < 255 ) {
249 *( _dest + y ) &= ~bitmask;
252 if ( systemRgb->
index != colorBackground ) {
254 *( _dest + y ) |= bitmask;
257 *( _dest + y ) &= ~bitmask;
265 source += _depth * ( _source_width - 8 );
269 *( _dest + 8 ) = ( colorForeground << 4 ) | colorBackground ;
284static void vic2_image_converter_tiles(
Environment * _environment,
char * _source,
char * _dest,
int _width,
int _height,
int _depth,
int _source_width ) {
286 int bitmapSize = ( _width>>3 ) * _height;
287 int colormapSize = ( _width>>3 ) * (_height>>3);
289 memset( _dest, 0, bitmapSize + colormapSize );
293 for(
int y=0; y<_height; y+=8 ) {
294 for(
int x=0; x<_width; x+=8 ) {
296 char *
source = _source + ( ( y * _source_width ) + x ) * _depth;
299 vic2_image_converter_tile( _environment,
source, tile, _width, _depth, _source_width );
301 int offset = ((y>>3) * 8 *( _width >> 3 ) ) + ((x>>3) * 8) + ((y) & 0x07);
307 char * destBitmap = _dest +
offset;
308 char * destColormap = _dest + bitmapSize + ( ( ( y >> 3 ) * ( _width >> 3 ) ) + ( x >> 3 ) );
309 for(
int i=0; i<8; ++i ) {
310 *destBitmap = tile[i];
314 *destColormap = tile[8];
335static void vic2_image_converter_tile_multicolor(
Environment * _environment,
char * _source,
char * _dest,
int _width,
int _depth,
int _background,
int _source_width ) {
338 memset(colorIndexesCount, 0,
COLOR_COUNT *
sizeof(
int ) );
344 memset( _dest, 0, 10 );
347 for (
int y=0; y<8; ++y) {
348 for (
int x=0; x<4; ++x) {
352 memset( &rgb, 0,
sizeof(
RGBi ) );
363 if ( rgb.
alpha == 0 ) {
369 if ( rgb.
alpha < 255 ) {
375 ++colorIndexesCount[systemRgb->
index];
384 source += _depth * ( _source_width - 4 );
392 colorIndexesCount[_background] = 0;
395 int colorFirstMax = 0;
396 int colorSecond = -1;
397 int colorSecondMax = 0;
399 int colorThirdMax = 0;
402 if ( colorIndexesCount[xx] > colorFirstMax ) {
404 colorFirstMax = colorIndexesCount[xx];
408 if ( colorFirst > -1 ) {
409 colorIndexesCount[colorFirst] = 0;
413 if ( colorIndexesCount[xx] > colorSecondMax ) {
415 colorSecondMax = colorIndexesCount[xx];
419 if ( colorSecond > -1 ) {
420 colorIndexesCount[colorSecond] = 0;
424 if ( colorIndexesCount[xx] > colorThirdMax ) {
426 colorThirdMax = colorIndexesCount[xx];
430 if ( colorThird > -1 ) {
431 colorIndexesCount[colorThird] = 0;
436 for (
int y=0; y<8; ++y) {
437 for (
int x=0; x<4; ++x) {
441 memset( &rgb, 0,
sizeof(
RGBi ) );
451 if ( rgb.
alpha == 0 ) {
459 if ( rgb.
alpha < 255 ) {
466 if ( systemRgb->
index == colorFirst ) {
469 }
else if ( systemRgb->
index == colorSecond ) {
472 }
else if ( systemRgb->
index == colorThird ) {
481 char bitmask = colorIndex << (6 - ((x & 0x3) * 2));
483 *(_dest + y) |= bitmask;
489 source += _depth * ( _source_width - 4 );
493 colorFirst = ( colorFirst == -1 ) ? 0 : colorFirst;
494 colorSecond = ( colorSecond == -1 ) ? 0 : colorSecond;
495 colorThird = ( colorThird == -1 ) ? 0 : colorThird;
496 _background = ( _background == -1 ) ? 0 : _background;
498 *( _dest + 8 ) = ( colorFirst << 4 ) | colorSecond ;
499 *( _dest + 9 ) = ( _background << 4 ) | colorThird;
516static void vic2_image_converter_tiles_multicolor(
Environment * _environment,
char * _source,
char * _dest,
int _width,
int _height,
int _depth,
int _source_width,
int _background ) {
518 int bitmapSize = ( _width>>2 ) * _height;
519 int colormap1Size = ( _width>>2 ) * (_height>>3);
520 int colormap2Size = ( _width>>2 ) * (_height>>3);
522 memset( _dest, 0, bitmapSize + colormap1Size + colormap2Size );
526 for(
int y=0; y<_height; y+=8 ) {
527 for(
int x=0; x<_width; x+=4 ) {
529 char *
source = _source + ( ( y * _source_width ) + x ) * _depth;
532 vic2_image_converter_tile_multicolor( _environment,
source, tile, _width, _depth, _background, _source_width );
534 int offset = ((y>>3) * 8 *( _width >> 2 ) ) + ((x>>2) * 8) + ((y) & 0x07);
536 char * destBitmap = _dest +
offset;
537 char * destColormap1 = _dest + bitmapSize + ( ( ( y >> 3 ) * ( _width >> 2 ) ) + ( x >> 2 ) );
538 char * destColormap2 = _dest + bitmapSize + colormap1Size + ( ( ( y >> 3 ) * ( _width >> 2 ) ) + ( x >> 2 ) );
539 for(
int i=0; i<8; ++i ) {
540 *destBitmap = tile[i];
543 *destColormap1 = tile[8];
544 *destColormap2 = tile[9];
570 switch ( sprite->
type) {
639 outline1(
"LDA #$%2.2x", _border_color );
673 outline1(
"LDA #$%2.2x", ( _background_color & 0x0f ) );
674 outline1(
"STA $d021+%d", ( _index & 0x03 ) );
698 outline1(
"LDA %s", _background_color );
703 outline1(
"LDA %s", _background_color );
724 outline1(
"LDA %s", _background_color );
750 outline1(
"STA %s", _background_color );
765 outline1(
"LDA #$%2.2x", ( _common_color & 0x0f ) );
766 outline1(
"STA $,X", 0xd025 + ( _index & 0x03 ) );
903 outline1(
"ORA #%2.2x", ( ~_bank ) & 0x03 );
907static int rgbConverterFunction(
int _red,
int _green,
int _blue ) {
910 unsigned int minDistance = 0xffffffff;
918 for (j = 0; j <
sizeof(SYSTEM_PALETTE)/
sizeof(
RGBi); ++j) {
939 switch( _screen_mode->
id ) {
1227 outline0(
"JSR CONSOLECALCULATE" );
1351 outline1(
"LDA %2.2x", (_x & 0xff ) );
1353 outline1(
"LDA %2.2x", ( ( _x >> 8 ) & 0xff ) );
1355 outline1(
"LDA %2.2x", ( _y & 0xff ) );
1358 outline1(
"LDA #$%2.2x", ( *_c & 0xff ) );
1491 switch ( sprite->
type) {
1525 switch ( sprite->
type) {
1558 switch ( original->
type) {
1573 outline0(
"STA MSPRITEDUPLICATEY0+1" );
1576 outline0(
"STA MSPRITEDUPLICATEY1+1" );
1579 outline0(
"STA MSPRITEDUPLICATEY2+1" );
1582 outline0(
"STA MSPRITEDUPLICATEY3+1" );
1600 switch ( sprite->
type) {
1634 switch ( sprite->
type) {
1671 switch ( sprite->
type) {
1719 switch ( sprite->
type) {
1754 switch ( sprite->
type) {
1786 switch ( sprite->
type) {
1818 switch ( sprite->
type) {
1852 switch ( sprite->
type) {
1873 outline0(
"JSR MSPRITEMULTICOLOR" );
1887 switch ( sprite->
type) {
1922 switch ( sprite->
type) {
1960 switch ( sprite->
type) {
2011 outline1(
"ORA %s", _displacement );
2020 outline1(
"ORA %s", _displacement );
2125 if ( _direction > 0 ) {
2127 outline1(
"LDA $%2.2x", (
unsigned char)(_overlap&0xff) )
2132 outline1(
"LDA $%2.2x", (
unsigned char)(_overlap&0xff) )
2157 outline0(
"JSR TEXTATBITMAPMODERAW");
2281static RGBi * multicolorSpritePalette[2];
2287 if ( multicolorSpritePalette[0] ) {
2288 outline1(
"LDA #$%2.2x", multicolorSpritePalette[0]->index );
2292 if ( multicolorSpritePalette[1] ) {
2293 outline1(
"LDA #$%2.2x", multicolorSpritePalette[1]->index );
2312 while( copperList ) {
2313 if ( !copperList->
name ) {
2317 int currentLine = 0;
2325 if ( actual->
param1 > 0 ) {
2326 if ( actual->
param1 > currentLine ) {
2327 outline1(
"LDA #$%2.2x", (
unsigned char)( actual->
param1 & 0xff ) );
2329 if ( ( actual->
param1 >> 8 ) & 0x01 ) {
2343 currentLine = actual->
param1;
2348 outline1(
"LDA $%4.4x", (
unsigned short)( actual->
param2 & 0xffff )+3 );
2349 outline1(
"STA $%4.4x", (
unsigned short)( actual->
param1 & 0xffff )+3 );
2350 outline1(
"LDA $%4.4x", (
unsigned short)( actual->
param2 & 0xffff )+2 );
2351 outline1(
"STA $%4.4x", (
unsigned short)( actual->
param1 & 0xffff )+2 );
2353 outline1(
"LDA $%4.4x", (
unsigned short)( actual->
param2 & 0xffff )+1 );
2354 outline1(
"STA $%4.4x", (
unsigned short)( actual->
param1 & 0xffff )+1 );
2356 outline1(
"LDA $%4.4x", (
unsigned short)( actual->
param2 & 0xffff ) );
2357 outline1(
"STA $%4.4x", (
unsigned short)( actual->
param1 & 0xffff ) );
2360 outline1(
"LDA #$%2.2x", (
unsigned char)( ( actual->
param2 >> 24 ) & 0xff ) );
2361 outline1(
"STA $%4.4x", (
unsigned short)( actual->
param1 & 0xffff )+3 );
2362 outline1(
"LDA #$%2.2x", (
unsigned char)( ( actual->
param2 >> 16 ) & 0xff ) );
2363 outline1(
"STA $%4.4x", (
unsigned short)( actual->
param1 & 0xffff )+2 );
2365 outline1(
"LDA #$%2.2x", (
unsigned char)( ( actual->
param2 >> 8 ) & 0xff ) );
2366 outline1(
"STA $%4.4x", (
unsigned short)( actual->
param1 & 0xffff )+1 );
2368 outline1(
"LDA #$%2.2x", (
unsigned char)( ( actual->
param2 ) & 0xff ) );
2369 outline1(
"STA $%4.4x", (
unsigned short)( actual->
param1 & 0xffff ) );
2381 actual = actual->
next;
2389 outline1(
"LDA #<COPPERLIST%s0000", copperList->
name ? copperList->
name :
"" );
2391 outline1(
"LDA #>COPPERLIST%s0000", copperList->
name ? copperList->
name :
"" );
2394 copperList = copperList->
next;
2409 outline1(
"LDA #$%2.2x", ( _direction & 0xff ) );
2411 outline1(
"LDA #$%2.2x", ( _overlap & 0xff ) );
2423 outline1(
"LDA #$%2.2x", ( _direction & 0xff ) );
2425 outline1(
"LDA #$%2.2x", ( _overlap & 0xff ) );
2444 if ( _characters ) {
2471 return 3 + ( ( _width >> 3 ) * _height ) + ( ( _width >> 3 ) * ( _height >> 3 ) );
2475 return 3 + ( ( _width >> 2 ) * _height ) + 2 * ( ( _width >> 2 ) * ( _height >> 3 ) ) + 1;
2517static int calculate_images_size(
Environment * _environment,
int _frames,
int _width,
int _height,
int _mode ) {
2523 return 3 + ( 3 + ( ( _width >> 3 ) * _height ) + ( ( _width >> 3 ) * ( _height >> 3 ) ) ) * _frames;
2527 return 3 + ( 3 + ( ( _width >> 2 ) * _height ) + 2 * ( ( _width >> 2 ) * ( _height >> 3 ) ) + 1 ) * _frames;
2569static int calculate_sequences_size(
Environment * _environment,
int _sequences,
int _frames,
int _width,
int _height,
int _mode ) {
2575 return 3 + ( ( 3 + ( ( _width >> 3 ) * _height ) + ( ( _width >> 3 ) * ( _height >> 3 ) ) ) * _frames ) * _sequences;
2579 return 3 + ( ( 3 + ( ( _width >> 2 ) * _height ) + 2 * ( ( _width >> 2 ) * ( _height >> 3 ) ) + 1 ) * _frames ) * _sequences;
2621static Variable * vic2_image_converter_bitmap_mode_standard(
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 ) {
2623 image_converter_asserts( _environment, _width, _height, _offset_x, _offset_y, &_frame_width, &_frame_height, 8, 8 );
2627 _width = ( ( ( _width - 1 ) / 8 ) - 1 ) * 8;
2629 if ( _frame_width % 8 ) {
2630 _frame_width = ( ( ( _frame_width - 1 ) / 8 ) - 1 ) * 8;
2635 if ( _height % 8 ) {
2636 _height = ( ( ( _height - 1 ) / 8 ) - 1 ) * 8;
2638 if ( _frame_height % 8 ) {
2639 _frame_height = ( ( ( _frame_height - 1 ) / 8 ) - 1 ) * 8;
2647 if (paletteColorCount > 16) {
2653 commonPalette =
palette_match( palette, paletteColorCount, SYSTEM_PALETTE,
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi) );
2658 adilinepalette(
"CPMS:%d", (
int)(
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi)), SYSTEM_PALETTE );
2670 char * buffer =
malloc ( bufferSize );
2671 memset( buffer, 0, bufferSize );
2674 int image_x, image_y;
2685 *(buffer) = ( _frame_width & 0xff );
2686 *(buffer+1) = ( (_frame_width>>8) & 0xff );
2687 *(buffer+2) = _frame_height;
2689 _source += ( ( _offset_y * _width ) + _offset_x ) * _depth;
2691 vic2_image_converter_tiles( _environment, _source, buffer+3, _frame_width, _frame_height, _depth, _width );
2703static Variable * vic2_image_converter_multicolor_mode_standard(
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 ) {
2707 image_converter_asserts( _environment, _width, _height, _offset_x, _offset_y, &_frame_width, &_frame_height, 8, 8 );
2711 _width = ( ( ( _width - 1 ) / 8 ) - 1 ) * 8;
2713 if ( _frame_width % 8 ) {
2714 _frame_width = ( ( ( _frame_width - 1 ) / 8 ) - 1 ) * 8;
2719 if ( _height % 8 ) {
2720 _height = ( ( ( _height - 1 ) / 8 ) - 1 ) * 8;
2722 if ( _frame_height % 8 ) {
2723 _frame_height = ( ( ( _frame_height - 1 ) / 8 ) - 1 ) * 8;
2731 if (paletteColorCount > 16) {
2737 commonPalette =
palette_match( palette, paletteColorCount, SYSTEM_PALETTE,
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi) );
2742 adilinepalette(
"CPMS:%d", (
int) (
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi)), SYSTEM_PALETTE );
2752 char * buffer =
malloc ( bufferSize );
2753 memset( buffer, 0, bufferSize );
2756 int image_x, image_y;
2762 int offset, offsetc, bitmask;
2767 *(buffer) = ( _frame_width & 0xff );
2768 *(buffer+1) = ( _frame_width >> 8 ) & 0xff;
2769 *(buffer+2) = _frame_height;
2771 _source += ( ( _offset_y * _width ) + _offset_x ) * _depth;
2773 int colorBackground = 0;
2777 memset(colorCount, 0, 16 *
sizeof(
int ) );
2778 char * tmpSource = _source;
2779 for(
int y = 0; y < _frame_height; ++y ) {
2780 for(
int x = 0; x < _frame_width; ++x ) {
2782 rgb.
red = *tmpSource;
2783 rgb.
green = *(tmpSource + 1);
2784 rgb.
blue = *(tmpSource + 2);
2786 rgb.
alpha = *(tmpSource + 3);
2790 if ( rgb.
alpha == 0 ) {
2796 ++colorCount[systemColor->
index];
2798 tmpSource += _depth;
2801 tmpSource += _depth * ( _width - _frame_width );
2804 int colorBackgroundMax = 0;
2805 for(
int i=0; i<16; ++i ) {
2806 if ( colorBackgroundMax < colorCount[i] ) {
2807 colorBackground = i;
2808 colorBackgroundMax = colorCount[i];
2813 char * tmpSource = _source;
2815 rgb.
red = *tmpSource;
2816 rgb.
green = *(tmpSource + 1);
2817 rgb.
blue = *(tmpSource + 2);
2819 rgb.
alpha = *(tmpSource + 3);
2823 if ( rgb.
alpha == 0 ) {
2829 colorBackground = rgb.
index;
2832 vic2_image_converter_tiles_multicolor( _environment, _source, buffer+3, _frame_width, _frame_height, _depth, _width, colorBackground );
2834 *(buffer+bufferSize-1) = colorBackground;
2842static Variable * vic2_image_converter_tilemap_mode_standard(
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 ) {
2844 image_converter_asserts( _environment, _width, _height, _offset_x, _offset_y, &_frame_width, &_frame_height, 8, 8 );
2848 _width = ( ( ( _width - 1 ) / 8 ) - 1 ) * 8;
2850 if ( _frame_width % 8 ) {
2851 _frame_width = ( ( ( _frame_width - 1 ) / 8 ) - 1 ) * 8;
2856 if ( _height % 8 ) {
2857 _height = ( ( ( _height - 1 ) / 8 ) - 1 ) * 8;
2859 if ( _frame_height % 8 ) {
2860 _frame_height = ( ( ( _frame_height - 1 ) / 8 ) - 1 ) * 8;
2870 commonPalette =
palette_match( palette, colorUsed, SYSTEM_PALETTE,
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi) );
2874 adilinepalette(
"CPMS:%d", (
int)(
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi)), SYSTEM_PALETTE );
2882 if ( colorUsed == 2 ) {
2883 bufferSize = 3 + ( ( _frame_width >> 3 ) * ( _frame_height >> 3 ) ) + 1;
2885 bufferSize = 3 + 2* ( ( _frame_width >> 3 ) * ( _frame_height >> 3 ) );
2890 char * buffer =
malloc ( bufferSize );
2891 memset( buffer, 0, bufferSize );
2894 int image_x, image_y;
2905 *(buffer) = _frame_width;
2906 *(buffer+1) = _frame_height;
2908 if ( colorUsed > 2 ) {
2916 _source += ( ( _offset_y * _width ) + _offset_x ) * _depth;
2920 for( cy=0; cy<(_frame_height >> 3);++cy) {
2921 for( cx=0; cx<(_frame_width >> 3);++cx) {
2923 char *
source = _source + ( ( cy * 8 * _width ) + cx * 8 ) * _depth;
2926 memset(&tileData,0,
sizeof(
TileData));
2928 int mostFrequentColor[16];
2929 memset(&mostFrequentColor[0],0,
sizeof(
int)*16);
2934 for (image_y = 0; image_y < 8; ++image_y) {
2935 for (image_x = 0; image_x < 8; ++image_x) {
2942 rgb.
alpha = *(_source + 3);
2947 if ( rgb.
alpha < 255 ) {
2948 colorIndex = commonPalette[0].index;
2951 int minDistance = 9999;
2952 for(
int i=0; i<colorUsed; ++i ) {
2956 colorIndex = commonPalette[i].index;
2962 mostFrequentColor[colorIndex]++;
2970 offset = (image_y & 0x07);
2971 bitmask = 1 << ( 7 - (image_x & 0x7) );
2973 if ( !colorIndex ) {
2974 tileData.data[
offset] &= ~bitmask;
2977 tileData.data[
offset] |= bitmask;
2985 source += _depth * ( _width - 8 );
3020 int mostFrequentColorIndex = 1;
3021 int mostFrequentColorCount = 0;
3022 for(
int i=0;i<colorUsed;++i) {
3023 if ( mostFrequentColorCount < mostFrequentColor[commonPalette[i].index] ) {
3024 mostFrequentColorCount = mostFrequentColor[commonPalette[i].index];
3025 mostFrequentColorIndex = commonPalette[i].index;
3029 *(buffer + 3 + (cy * ( _frame_width >> 3 ) ) + cx ) = tile;
3030 if ( colorUsed > 2 ) {
3031 *(buffer + 3 + ( ( _frame_width >> 3 ) * ( _frame_height >> 3 ) ) + (cy * ( _frame_width >> 3 ) ) + cx ) = ( ( mostFrequentColorIndex & 0x07 ) );
3040 if ( colorUsed <= 2 ) {
3041 *(buffer + 3 + ( ( _frame_width >> 3 ) * ( _frame_height >> 3 ) ) ) = commonPalette[0].index == 0 ? commonPalette[1].index : commonPalette[0].index;
3053static Variable * vic2_image_converter_tilemap_mode_multicolor(
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 ) {
3055 image_converter_asserts( _environment, _width, _height, _offset_x, _offset_y, &_frame_width, &_frame_height, 8, 8 );
3059 _width = ( ( ( _width - 1 ) / 8 ) - 1 ) * 8;
3061 if ( _frame_width % 8 ) {
3062 _frame_width = ( ( ( _frame_width - 1 ) / 8 ) - 1 ) * 8;
3067 if ( _height % 8 ) {
3068 _height = ( ( ( _height - 1 ) / 8 ) - 1 ) * 8;
3070 if ( _frame_height % 8 ) {
3071 _frame_height = ( ( ( _frame_height - 1 ) / 8 ) - 1 ) * 8;
3081 commonPalette =
palette_match( palette, colorUsed, SYSTEM_PALETTE, (
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi) ) / 2 );
3085 adilinepalette(
"CPMS:%d", (
int)((
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi) ) / 2), SYSTEM_PALETTE );
3093 bufferSize = 3 + 2* ( ( _frame_width >> 2 ) * ( _frame_height >> 3 ) ) + 2;
3097 char * buffer =
malloc ( bufferSize );
3098 memset( buffer, 0, bufferSize );
3101 int image_x, image_y;
3112 *(buffer) = _frame_width;
3113 *(buffer+1) = _frame_height;
3118 _source += ( ( _offset_y * _width ) + _offset_x ) * _depth;
3122 for( cy=0; cy<(_frame_height >> 3);++cy) {
3123 for( cx=0; cx<(_frame_width >> 2);++cx) {
3125 char *
source = _source + ( ( cy * 8 * _width ) + cx * 4 ) * _depth;
3128 memset(&tileData,0,
sizeof(
TileData));
3130 int mostFrequentColor[16];
3131 memset(&mostFrequentColor[0],0,
sizeof(
int)*16);
3136 for (image_y = 0; image_y < 8; ++image_y) {
3137 for (image_x = 0; image_x < 4; ++image_x) {
3144 rgb.
alpha = *(_source + 3);
3150 if ( rgb.
alpha < 255 ) {
3151 colorIndex = commonPalette[0].index;
3154 int minDistance = 9999;
3155 for(
int i=0; i<colorUsed; ++i ) {
3159 colorIndex = commonPalette[i].index;
3165 mostFrequentColor[colorIndex]++;
3173 offset = (image_y & 0x07);
3174 bitmask = 1 << ( 6 - (2*(image_x & 0x3)) );
3176 if ( colorIndex == 0 ) {
3177 tileData.data[
offset] &= ~(3*bitmask);
3178 }
else if ( colorIndex == commonPalette[1].index ) {
3179 tileData.data[
offset] |= bitmask;
3180 }
else if ( colorIndex == commonPalette[2].index ) {
3181 tileData.data[
offset] |= 2*bitmask;
3183 if ( !colorIndex ) {
3184 tileData.data[
offset] &= ~(3*bitmask);
3186 tileData.data[
offset] |= (3*bitmask);
3195 source += _depth * ( _width - 4 );
3230 int mostFrequentColorIndex = 1;
3231 int mostFrequentColorCount = 0;
3232 for(
int i=3;i<colorUsed;++i) {
3233 if ( mostFrequentColorCount < mostFrequentColor[commonPalette[i].index] ) {
3234 mostFrequentColorCount = mostFrequentColor[commonPalette[i].index];
3235 mostFrequentColorIndex = commonPalette[i].index;
3239 *(buffer + 3 + (cy * ( _frame_width >> 3 ) ) + cx ) = tile;
3240 *(buffer + 3 + ( ( _frame_width >> 2 ) * ( _frame_height >> 3 ) ) + (cy * ( _frame_width >> 2 ) ) + cx ) = 0x8 | ( ( mostFrequentColorIndex & 0x03 ) );
3248 *(buffer + 3 + 2* ( ( _frame_width >> 2 ) * ( _frame_height >> 3 ) ) ) = commonPalette[0].index;
3249 *(buffer + 3 + 2* ( ( _frame_width >> 2 ) * ( _frame_height >> 3 ) ) + 1 ) = commonPalette[1].index;
3250 *(buffer + 3 + 2* ( ( _frame_width >> 2 ) * ( _frame_height >> 3 ) ) + 2 ) = commonPalette[2].index;
3262Variable *
vic2_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 ) {
3268 return vic2_image_converter_bitmap_mode_standard( _environment, _data, _width, _height, _depth, _offset_x, _offset_y, _frame_width, _frame_height, _transparent_color, _flags );
3272 return vic2_image_converter_multicolor_mode_standard( _environment, _data, _width, _height, _depth, _offset_x, _offset_y, _frame_width, _frame_height, _transparent_color, _flags );
3305 return vic2_image_converter_tilemap_mode_standard( _environment, _data, _width, _height, _depth, _offset_x, _offset_y, _frame_width, _frame_height, _transparent_color, _flags );
3307 return vic2_image_converter_tilemap_mode_multicolor( _environment, _data, _width, _height, _depth, _offset_x, _offset_y, _frame_width, _frame_height, _transparent_color, _flags );
3322 int colorUsed =
vic2_palette_extract( _environment, _source, _width, _height, _depth, _flags, &palette[0] );
3326 int spriteWidth = 0;
3327 int spriteHeight = 0;
3332 if (colorUsed > 4) {
3336 if (colorUsed > 2) {
3389 if ( palette[0].index == SYSTEM_PALETTE[0].index ) {
3395 rgbi_move( &SYSTEM_PALETTE[0], &palette[0] );
3407 if ( !multicolorSpritePalette[0] ) {
3409 multicolorSpritePalette[0] =
malloc(
sizeof(
RGBi ) );
3410 memset( multicolorSpritePalette[0], 0,
sizeof(
RGBi ) );
3411 rgbi_move( &palette[1], multicolorSpritePalette[0] );
3416 if ( !multicolorSpritePalette[1] ) {
3418 multicolorSpritePalette[1] =
malloc(
sizeof(
RGBi ) );
3419 memset( multicolorSpritePalette[1], 0,
sizeof(
RGBi ) );
3420 rgbi_move( &palette[2], multicolorSpritePalette[1] );
3426 rgbi_move( &SYSTEM_PALETTE[0], &temporaryPalette[0] );
3428 for(
int i=1; i<colorUsed; ++i ) {
3431 rgbi_move( &palette[i], &temporaryPalette[1] );
3432 }
else if (
rgbi_equals_rgba( &palette[i], multicolorSpritePalette[1] ) ) {
3434 rgbi_move( &palette[i], &temporaryPalette[3] );
3437 rgbi_move( &palette[i], &temporaryPalette[2] );
3441 rgbi_move( &temporaryPalette[0], &palette[0] );
3443 rgbi_move( &temporaryPalette[1], &palette[1] );
3445 rgbi_move( &temporaryPalette[2], &palette[2] );
3447 rgbi_move( &temporaryPalette[3], &palette[3] );
3454 int bufferSize = 64;
3458 char * buffer =
malloc ( bufferSize );
3459 memset( buffer, 0, bufferSize );
3462 int image_x, image_y;
3470 char *
source = _source + ( ( _slot_y * spriteHeight * _width ) + _slot_x * spriteWidth ) * _depth;
3475 for (image_y = 0; image_y < spriteHeight; ++image_y) {
3476 if ( ( image_y + ( _slot_y * spriteHeight ) ) == _height ) {
3480 for (image_x = 0; image_x < spriteWidth; ++image_x) {
3481 if ( ( image_x + ( _slot_x * spriteWidth ) ) == _width ) {
3496 if ( rgb.
alpha < 255 ) {
3501 int minDistance = 0xffff;
3504 for(
int k=0; k<colorUsed; ++k ) {
3508 color = &palette[k];
3519 int minDistance = 0xffff;
3521 for(
int k=0; k<colorUsed; ++k ) {
3525 color = &palette[k];
3541 offset = ( image_y * 3 ) + (image_x >> 2);
3542 bitmask = i << (6 - ((image_x & 0x3) * 2));
3545 *( buffer +
offset) |= bitmask;
3548 *( buffer +
offset) &= ~bitmask;
3556 offset = ( image_y * 3 ) + (image_x >> 3);
3557 bitmask = 1 << ( 7 - (image_x & 0x7) );
3560 *( buffer +
offset) |= bitmask;
3563 *( buffer +
offset) &= ~bitmask;
3574 if ( ( image_x + ( _slot_x * spriteWidth ) ) == _width ) {
3575 source += _depth * (_width - image_x );
3577 source += _depth * ( _width - spriteWidth );
3585 *(buffer+63) = _color->
index;
3588 *(buffer+63) = palette[3].index;
3590 *(buffer+63) = palette[1].index;
3604static void vic2_load_image_address_to_other_register(
Environment * _environment,
char * _register,
char * _source,
char * _sequence,
char * _frame,
int _frame_size,
int _frame_count ) {
3628 if ( strlen(_sequence) == 0 ) {
3631 outline1(
"LDA #<OFFSETS%4.4x", _frame_size * _frame_count );
3633 outline1(
"LDA #>OFFSETS%4.4x", _frame_size * _frame_count );
3649 if ( strlen(_frame) == 0 ) {
3652 outline1(
"LDA #<OFFSETS%4.4x", _frame_size );
3654 outline1(
"LDA #>OFFSETS%4.4x", _frame_size );
3680 if ( strlen(_frame) == 0 ) {
3683 outline1(
"LDA #<OFFSETS%4.4x", _frame_size );
3685 outline1(
"LDA #>OFFSETS%4.4x", _frame_size );
3705static void vic2_load_image_address_to_register(
Environment * _environment,
char * _register,
Resource * _source,
char * _sequence,
char * _frame,
int _frame_size,
int _frame_count ) {
3707 if ( !_sequence && !_frame ) {
3816 if ( strlen(_sequence) == 0 ) {
3824 if ( strlen(_frame) == 0 ) {
3843 if ( strlen(_frame) == 0 ) {
3893 if ( _frame_size ) {
3894 vic2_load_image_address_to_register( _environment,
"TMPPTR", _image, _sequence, _frame, _frame_size, _frame_count );
3915 if ( strchr( _flags,
'#' ) ) {
3916 outline1(
"LDA #((%s)&255)", _flags+1 );
3918 outline1(
"LDA #(((%s)>>8)&255)", _flags+1 );
3946 if ( strlen(_sequence) == 0 ) {
3949 outline1(
"LDA #<OFFSETS%4.4x", _frame_size * _frame_count );
3951 outline1(
"LDA #>OFFSETS%4.4x", _frame_size * _frame_count );
3967 if ( strlen(_frame) == 0 ) {
3970 outline1(
"LDA #<OFFSETS%4.4x", _frame_size );
3972 outline1(
"LDA #>OFFSETS%4.4x", _frame_size );
3998 if ( strlen(_frame) == 0 ) {
4001 outline1(
"LDA #<OFFSETS%4.4x", _frame_size );
4003 outline1(
"LDA #>OFFSETS%4.4x", _frame_size );
4023void vic2_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 ) {
4029 if ( _source_count > 2 ) {
4038 outline0(
"STA BLITIMAGEBLITADDR+1" );
4040 outline0(
"STA BLITIMAGEBLITADDR+2" );
4042 if ( _source_count > 0 ) {
4044 resource.
realName = strdup( _sources[0] );
4047 vic2_load_image_address_to_register( _environment,
"BLITTMPPTR", &resource, _sequence, _frame, _frame_size, _frame_count );
4054 if ( _source_count > 1 ) {
4056 resource.
realName = strdup( _sources[1] );
4059 vic2_load_image_address_to_register( _environment,
"BLITTMPPTR2", &resource, _sequence, _frame, _frame_size, _frame_count );
4076 outline1(
"LDA #$%2.2x", ( _flags & 0xff ) );
4078 outline1(
"LDA #$%2.2x", ( (_flags>>8) & 0xff ) );
4090 if ( ! _raster_line ) {
4113 memset( buffer, 0,
size );
4115 *(buffer) = (_width & 0xff);
4116 *(buffer+1) = (_width>>8) & 0xff;
4117 *(buffer+2) = _height;
4130 int size = calculate_images_size( _environment, _frames, _width, _height, _mode );
4131 int frameSize =
vic2_image_size( _environment, _width, _height, _mode );
4140 memset( buffer, 0,
size );
4142 *(buffer) = _frames;
4143 *(buffer+1) = ( _width & 0xff );
4144 *(buffer+2) = ( _width >> 8 ) & 0xff;
4145 for(
int i=0; i<_frames; ++i ) {
4146 *(buffer+3+(i*frameSize)) = ( _width & 0xff );
4147 *(buffer+3+(i*frameSize)+1) = ( ( _width >> 8 ) & 0xff );
4148 *(buffer+3+(i*frameSize)+2) = ( _height & 0xff );
4164 int size2 = calculate_sequences_size( _environment, _sequences, _frames, _width, _height, _mode );
4165 int size = calculate_images_size( _environment, _frames, _width, _height, _mode );
4166 int frameSize =
vic2_image_size( _environment, _width, _height, _mode );
4174 char * buffer =
malloc ( size2 );
4175 memset( buffer, 0, size2 );
4177 *(buffer) = _frames;
4178 *(buffer+1) = _width;
4179 *(buffer+2) = _sequences;
4180 for(
int i=0; i<(_frames * _sequences); ++i ) {
4181 *(buffer+3+(i*frameSize)) = ( _width & 0xff );
4182 *(buffer+3+(i*frameSize)+1) = ( ( _width >> 8 ) & 0xff );
4183 *(buffer+3+(i*frameSize)+2) = ( _height & 0xff );
4188 result->
size = size2;
4195void vic2_get_image(
Environment * _environment,
char * _image,
char * _x,
char * _y,
char * _frame,
char * _sequence,
int _frame_size,
int _frame_count,
int _palette ) {
4203 vic2_load_image_address_to_other_register( _environment,
"TMPPTR", _image, _sequence, _frame, _frame_size, _frame_count );
4213 outline1(
"LDA #$%2.2x", _palette );
4228 outline1(
"LDA #$%2.2x", (
unsigned char)(_dx&0xff) );
4230 outline1(
"LDA #$%2.2x", (
unsigned char)(_dy&0xff) );
4370void vic2_slice_image(
Environment * _environment,
char * _image,
char * _frame,
char * _sequence,
int _frame_size,
int _frame_count,
char * _destination ) {
4378 memcpy( _palette,
palette_match( _palette, paletteColorCount, SYSTEM_PALETTE,
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi) ), paletteColorCount *
sizeof(
RGBi ) );
4380 int uniquePaletteCount = 0;
4384 return uniquePaletteCount;
4393 if ( strcmp( _direction,
"#FLIPIMAGEDIRECTION0001" ) == 0 || strcmp( _direction,
"#FLIPIMAGEDIRECTION0003" ) == 0 ) {
4394 vic2_load_image_address_to_register( _environment,
"TMPPTR", _image, _sequence, _frame, _frame_size, _frame_count );
4401 vic2_load_image_address_to_register( _environment,
"TMPPTR", _image, _sequence, _frame, _frame_size, _frame_count );
4411 if ( strcmp( _direction,
"#FLIPIMAGEDIRECTION0002" ) == 0 || strcmp( _direction,
"#FLIPIMAGEDIRECTION0003" ) == 0 ) {
4412 vic2_load_image_address_to_register( _environment,
"TMPPTR", _image, _sequence, _frame, _frame_size, _frame_count );
4419 vic2_load_image_address_to_register( _environment,
"TMPPTR", _image, _sequence, _frame, _frame_size, _frame_count );
4443 outline0(
"STA FADERESETDURATION" );
4446 outline0(
"STA FADERESETDURATION+1" );
4474 outline0(
"LDA FLASHREGISTERADDRESSES, X" );
4477 outline0(
"LDA FLASHREGISTERADDRESSES, X" );
void cpu_store_16bit(Environment *_environment, char *_destination, int _value)
CPU 6309: emit code to store 16 bit
void cpu_math_mul_8bit_to_16bit(Environment *_environment, char *_source, char *_destination, char *_other, int _signed)
CPU 6309: emit code to multiply two 8bit values in a 16 bit register
void cpu_move_16bit(Environment *_environment, char *_source, char *_destination)
CPU 6309: emit code to move 16 bit
void cpu_store_8bit(Environment *_environment, char *_destination, int _value)
CPU 6309: emit code to store 8 bit
void cpu_beq(Environment *_environment, char *_label)
CPU 6309: emit code to make long conditional jump
unsigned char src_hw_6502_cpu_math_mul_8bit_to_16bit_asm[]
int lastUsedSlotInCommonPalette
#define BITMAP_MODE_STANDARD
int calculate_nearest_tile(TileDescriptor *_tile, TileDescriptors *_tiles)
Variable * variable_retrieve(Environment *_environment, char *_name)
int reset_screen_mode_selected(Environment *_environment)
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.
int rgbi_equals_rgba(RGBi *_first, RGBi *_second)
TileDescriptor * calculate_tile_descriptor(TileData *_tileData)
TileDescriptors * precalculate_tile_descriptors_for_font(char *_fontData, int _fontSize)
Variable * variable_import(Environment *_environment, char *_name, VariableType _type, int _size_or_value)
RGBi * malloc_palette(int _size)
Allocate a palette space.
void rgbi_move(RGBi *_source, RGBi *_destination)
int calculate_exact_tile(TileDescriptor *_tile, TileDescriptors *_tiles)
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_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".
void image_converter_asserts(Environment *_environment, int _width, int _height, int _offset_x, int _offset_y, int *_frame_width, int *_frame_height, int _modulo_x, int _modulo_y)
char * address_displacement(Environment *_environment, char *_address, char *_displacement)
Variable * variable_store_buffer(Environment *_environment, char *_destination, unsigned char *_buffer, int _size, int _at)
void back(Environment *_environment, char *_color)
Emit ASM code to fill background color.
void color(Environment *_environment, int _index, int _shade)
Emit ASM code for instruction COLOR [int], [int].
void plot(Environment *_environment, char *_x, char *_y, char *_c, int _preserve_color)
#define TILEMAP_MODE_STANDARD
void flash(Environment *_environment, char *_index, char *_register)
void console(Environment *_environment, int _x1, int _y1, int _x2, int _y2)
Emit code for CONSOLE.
void console_init(Environment *_environment)
Variable * distance(Environment *_environment, char *_x1, char *_y1, char *_x2, char *_y2)
Return the distance between two (screen) positions.
unsigned int data_font_alpha_bin_len
unsigned char data_font_alpha_bin[]
unsigned char src_hw_vic2_put_image_reu_asm[]
unsigned char src_hw_vic2_vscroll_text_up_asm[]
unsigned char src_hw_vic2_vars_asm[]
unsigned char src_hw_vic2_hscroll_text_asm[]
unsigned char src_hw_vic2_fade_asm[]
unsigned char src_hw_vic2_put_image_ram_rle_asm[]
unsigned char src_hw_vic2_put_image_asm[]
unsigned char src_hw_vic2_blit_image_asm[]
unsigned char src_hw_vic2_screen_asm[]
unsigned char src_hw_vic2_text_at_graphic_asm[]
unsigned char src_hw_vic2_back_asm[]
unsigned char src_hw_vic2_msprites_asm[]
unsigned char src_hw_vic2_vars_graphic_asm[]
unsigned char src_hw_vic2_plot_asm[]
unsigned char src_hw_vic2_put_image_ram_asm[]
unsigned char src_hw_vic2_text_at_text_raw_asm[]
unsigned char src_hw_vic2_vscroll_text_down_asm[]
unsigned char src_hw_vic2_cline_graphic_asm[]
unsigned char src_hw_vic2_tiles_asm[]
unsigned char src_hw_vic2_text_at_text_asm[]
unsigned char src_hw_vic2_cls_graphic_asm[]
unsigned char src_hw_vic2_get_image_asm[]
unsigned char src_hw_vic2_console_asm[]
unsigned char src_hw_vic2_sprites_asm[]
unsigned char src_hw_vic2_cline_text_asm[]
unsigned char src_hw_vic2_startup_asm[]
unsigned char src_hw_vic2_flip_image_x_asm[]
unsigned char src_hw_vic2_flash_asm[]
unsigned char src_hw_vic2_text_at_asm[]
unsigned char src_hw_vic2_cls_box_asm[]
unsigned char src_hw_vic2_cls_text_asm[]
unsigned char src_hw_vic2_vbl_asm[]
unsigned char src_hw_vic2_flip_image_y_asm[]
unsigned char src_hw_vic2_text_at_graphic_raw_asm[]
unsigned char src_hw_vic2_scroll_asm[]
CopperOperation operation
struct _CopperInstruction * next
struct _CopperInstruction * first
struct _CopperList * next
RgbConverterFunction currentRgbConverterFunction
TileDescriptors * descriptors
VestigialConfig vestigialConfig
TileDescriptor * descriptor[512]
unsigned char * valueBuffer
int initializedByConstant
RGBi originalPalette[MAX_PALETTE]
char rchack_4gravity_1164
#define TILEMAP_MODE_MULTICOLOR
#define TILEMAP_MODE_EXTENDED
#define BITMAP_MODE_MULTICOLOR
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.
#define outline2(s, a, b)
#define SPRITE_FLAG_MULTICOLOR
#define deploy_deferred(s, e)
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 outhead2(s, a, b)
struct _TileDescriptor TileDescriptor
#define CRITICAL_CANNOT_DUPLICATE_NOT_MPSRITE(n)
#define WARNING_IMAGE_CONVERTER_UNSUPPORTED_MODE(f)
#define adilinepalette(s, c, p)
#define adilinebeginbitmap(s)
#define deploy_embedded(s, e)
struct _CopperList CopperList
struct _CopperInstruction CopperInstruction
#define CRITICAL_NEW_IMAGE_UNSUPPORTED_MODE(f)
#define CRITICAL_BLIT_TOO_MUCH_SOURCES()
struct _TileData TileData
#define BITMAP_MODE_IAFLI
#define BITMAP_MODE_NUIFLI
#define BITMAP_MODE_MEGATEXT
#define BITMAP_MODE_TRIFLI
#define BITMAP_MODE_MUIFLI
#define BITMAP_MODE_MUCSUH
#define BITMAP_MODE_XIFLI
#define BITMAP_MODE_ASSLACE
#define BITMAP_MODE_SHIFLI
#define BITMAP_MODE_MUFLI
#define BITMAP_MODE_AIFLI
#define BITMAP_MODE_MUCSUFLI
#define BITMAP_MODE_SHFLI
#define BITMAP_MODE_NUFLI
#define BITMAP_MODE_MRFLI
#define BITMAP_MODE_MUCSU
#define BITMAP_MODE_SHIFXL
#define BITMAP_MODE_UIFLI
void vic2_bitmap_disable(Environment *_environment)
void vic2_tiles_get(Environment *_environment, char *_result)
void vic2_move_tiles(Environment *_environment, char *_tile, char *_x, char *_y)
void vic2_colormap_at(Environment *_environment, char *_address)
void vic2_sprite_duplicate(Environment *_environment, char *_sprite, char *_original)
void vic2_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)
void vic2_sprite_compress_horizontal(Environment *_environment, char *_sprite)
void vic2_pset_vars(Environment *_environment, char *_x, char *_y, char *_c)
void vic2_finalization(Environment *_environment)
void vic2_background_color_semivars(Environment *_environment, int _index, char *_background_color)
VIC-II: emit code to change background color
void vic2_sprite_enable(Environment *_environment, char *_sprite)
void vic2_wait_vbl(Environment *_environment, char *_raster_line)
void vic2_sprite_common_color_vars(Environment *_environment, char *_index, char *_common_color)
VIC-II: emit code to change common sprite's color
void vic2_sprite_monocolor(Environment *_environment, char *_sprite)
Variable * vic2_new_images(Environment *_environment, int _frames, int _width, int _height, int _mode)
void vic2_busy_wait(Environment *_environment, char *_timing)
void vic2_put_tiles(Environment *_environment, char *_tile, char *_x, char *_y, char *_w, char *_h)
void vic2_flip_image(Environment *_environment, Resource *_image, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_direction)
void vic2_hscroll_screen(Environment *_environment, int _direction, int _overlap)
void vic2_back(Environment *_environment)
void vic2_hscroll_line(Environment *_environment, int _direction, int _overlap)
void vic2_sprite_data_set(Environment *_environment, char *_sprite, char *_address)
void vic2_bank_select(Environment *_environment, int _bank)
void vic2_sprite_compress_vertical(Environment *_environment, char *_sprite)
int vic2_screen_mode_enable(Environment *_environment, ScreenMode *_screen_mode)
void vic2_fade(Environment *_environment, char *_ticks)
void vic2_slice_image(Environment *_environment, char *_image, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_destination)
void vic2_initialization(Environment *_environment)
void vic2_text(Environment *_environment, char *_text, char *_text_size, int _raw)
void vic2_raster_at(Environment *_environment, char *_label, char *_positionlo, char *_positionhi)
VIC-II: emit code to set raster irq
void vic2_bitmap_at(Environment *_environment, char *_address)
int vic2_palette_extract(Environment *_environment, char *_data, int _width, int _height, int _depth, int _flags, RGBi *_palette)
void vic2_tiles_at(Environment *_environment, char *_address)
Variable * vic2_collision(Environment *_environment, char *_sprite)
VIC-II: emit code to check for collision
void vic2_next_raster(Environment *_environment)
VIC-II: emit code to wait for next raster irq
void vic2_calculate_sequence_frame_offset(Environment *_environment, char *_offset, char *_sequence, char *_frame, int _frame_size, int _frame_count)
void vic2_screen_rows(Environment *_environment, char *_rows)
void vic2_put_image(Environment *_environment, Resource *_image, char *_x, char *_y, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_flags)
void vic2_screen(Environment *_environment, char *_x, char *_y, char *_c)
void vic2_cls_box(Environment *_environment, char *_x1, char *_y1, char *_w, char *_h)
Variable * vic2_new_sequence(Environment *_environment, int _sequences, int _frames, int _width, int _height, int _mode)
void vic2_get_image(Environment *_environment, char *_image, char *_x, char *_y, char *_frame, char *_sequence, int _frame_size, int _frame_count, int _palette)
void vic2_sprite_color(Environment *_environment, char *_sprite, char *_color)
void vic2_bitmap_enable(Environment *_environment, int _width, int _height, int _colors)
void vic2_get_width(Environment *_environment, char *_result)
Variable * vic2_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 vic2_pset_int(Environment *_environment, int _x, int _y, int *_c)
void vic2_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 vic2_screen_off(Environment *_environment)
void vic2_sprite_expand_vertical(Environment *_environment, char *_sprite)
void vic2_scroll(Environment *_environment, int _dx, int _dy)
void vic2_scroll_text(Environment *_environment, int _direction, int _overlap)
int vic2_image_size(Environment *_environment, int _width, int _height, int _mode)
RGBi * vic2_image_nearest_system_color(RGBi *_color)
Variable * vic2_get_raster_line(Environment *_environment)
void vic2_sprite_at(Environment *_environment, char *_sprite, char *_x, char *_y)
void vic2_flash_begin(Environment *_environment, char *_index, char *_register)
void vic2_get_height(Environment *_environment, char *_result)
void vic2_tilemap_enable(Environment *_environment, int _width, int _height, int _colors, int _tile_width, int _tile_height)
void vic2_pget_color_vars(Environment *_environment, char *_x, char *_y, char *_result)
Variable * vic2_new_image(Environment *_environment, int _width, int _height, int _mode)
void vic2_background_color_get_vars(Environment *_environment, char *_index, char *_background_color)
VIC-II: emit code to retrieve background color
void vic2_sprite_common_color(Environment *_environment, int _index, int _common_color)
VIC-II: emit code to change common sprite's color
void vic2_cline(Environment *_environment, char *_characters)
void vic2_cls(Environment *_environment)
void console_calculate_vars(Environment *_environment)
void vic2_flash_register(Environment *_environment, char *_index, char *_timer, char *_color)
void vic2_sprite_priority(Environment *_environment, char *_sprite, char *_priority)
void vic2_sprite_multicolor(Environment *_environment, char *_sprite)
void vic2_tile_at(Environment *_environment, char *_x, char *_y, char *_result)
void vic2_use_tileset(Environment *_environment, char *_tileset)
void vic2_border_color(Environment *_environment, int _border_color)
void vic2_screen_columns(Environment *_environment, char *_columns)
Variable * vic2_sprite_converter(Environment *_environment, char *_source, int _width, int _height, int _depth, RGBi *_color, int _flags, int _slot_x, int _slot_y)
void vic2_textmap_at(Environment *_environment, char *_address)
void vic2_sprite_data_from(Environment *_environment, char *_sprite, char *_image)
void vic2_flash_end(Environment *_environment)
void vic2_screen_on(Environment *_environment)
void vic2_background_color(Environment *_environment, int _index, int _background_color)
VIC-II: emit code to change background color
void vic2_put_tile(Environment *_environment, char *_tile, char *_x, char *_y)
void vic2_vertical_scroll(Environment *_environment, char *_displacement)
void vic2_hit(Environment *_environment, char *_sprite_mask, char *_result)
VIC-II: emit code to check for collision
void vic2_sprite_expand_horizontal(Environment *_environment, char *_sprite)
void vic2_border_color_vars(Environment *_environment, char *_border_color)
VIC-II: emit code to change border color
void vic2_background_color_vars(Environment *_environment, char *_index, char *_background_color)
VIC-II: emit code to change background color
void vic2_sprite_disable(Environment *_environment, char *_sprite)
void vic2_flash_off(Environment *_environment, char *_index)
void vic2_horizontal_scroll(Environment *_environment, char *_displacement)
void console_calculate(Environment *_environment)