35#if defined(__msx1__) || defined(__coleco__) || defined(__sc3000__) || defined(__sg1000__)
40static RGBi SYSTEM_PALETTE[] = {
41 { 0, 0, 0, 0x00, 0,
"TRANSPARENT" },
42 { 0, 0, 0, 0xff, 1,
"BLACK" },
43 { 81, 202, 92, 0xff, 2,
"GREEN" },
44 { 133, 223, 141, 0xff, 3,
"LIGHT_GREEN" },
45 { 107, 103, 240, 0xff, 4,
"DARK_BLUE" },
46 { 146, 136, 255, 0xff, 5,
"LIGHT_BLUE" },
47 { 212, 100, 113, 0xff, 6,
"DARK_RED" },
48 { 102, 219, 239, 0xff, 7,
"CYAN" },
49 { 230, 118, 130, 0xff, 8,
"RED" },
50 { 255, 151, 164, 0xff, 9,
"LIGHT_RED" },
51 { 215, 207, 97, 0xff, 10,
"DARK_YELLOW" },
52 { 230, 222, 112, 0xff, 11,
"LIGHT_YELLOW" },
53 { 74, 177, 81, 0xff, 12,
"DARK_GREEN" },
54 { 200, 121, 198, 0xff, 13,
"MAGENTA" },
55 { 204, 204, 204, 0xff, 14,
"GRAY" },
56 { 255, 255, 255, 0xff, 15,
"WHITE" }
59static RGBi * commonPalette;
68 unsigned int minDistance = 0xffff;
72 if ( _color->
alpha < 255 ) {
79 if ( SYSTEM_PALETTE[j].alpha < 255 ) {
89 return &SYSTEM_PALETTE[colorIndex];
104static void tms9918_image_converter_tile(
Environment * _environment,
char * _source,
char * _dest,
int _width,
int _depth,
int _source_width ) {
108 int colorBackgroundMax = 0;
109 int colorBackground[8];
110 memset( colorBackground, 0, 8 *
sizeof(
int ) );
112 int colorForegroundMax = 0;
113 int colorForeground[8];
114 memset( colorForeground, 0, 8 *
sizeof(
int ) );
119 memset( _dest, 0, 16 );
122 for (
int y=0; y<8; ++y) {
124 memset(colorIndexesCount, 0,
COLOR_COUNT *
sizeof(
int ) );
125 colorBackgroundMax = 0;
126 colorForegroundMax = 0;
128 for (
int x=0; x<8; ++x) {
132 memset( &rgb, 0,
sizeof(
RGBi ) );
143 if ( rgb.
alpha == 0 ) {
151 ++colorIndexesCount[systemRgb->
index];
160 if ( colorIndexesCount[xx] > colorBackgroundMax ) {
161 colorBackground[y] = xx;
162 colorBackgroundMax = colorIndexesCount[xx];
166 colorIndexesCount[colorBackground[y]] = 0;
169 if ( colorIndexesCount[xx] > colorForegroundMax ) {
170 colorForeground[y] = xx;
171 colorForegroundMax = colorIndexesCount[xx];
175 if ( colorForeground[y] == 0 ) {
176 colorForeground[y] = colorBackground[y];
179 source += _depth * ( _source_width - 8 );
185 for (
int y=0; y<8; ++y) {
186 for (
int x=0; x<8; ++x) {
190 memset( &rgb, 0,
sizeof(
RGBi ) );
200 if ( rgb.
alpha == 0 ) {
208 char bitmask = 1 << ( 7 - ((x) & 0x7) );
210 if ( systemRgb->
index != colorBackground[y] ) {
212 *( _dest + y ) |= bitmask;
216 *( _dest + y ) &= ~bitmask;
226 source += _depth * ( _source_width - 8 );
232 for(
int i=0; i<8; ++i ) {
233 *( _dest + 8 + i ) = ( colorForeground[i] << 4 ) | colorBackground[i] ;
249static void tms9918_image_converter_tiles(
Environment * _environment,
char * _source,
char * _dest,
int _width,
int _height,
int _depth,
int _source_width ) {
251 int bitmapSize = ( _width>>3 ) * _height;
252 int colormapSize = ( _width>>3 ) * _height;
254 memset( _dest, 0, bitmapSize + colormapSize );
258 for(
int y=0; y<_height; y+=8 ) {
259 for(
int x=0; x<_width; x+=8 ) {
261 char *
source = _source + ( ( y * _source_width ) + x ) * _depth;
264 tms9918_image_converter_tile( _environment,
source, tile, _width, _depth, _source_width );
266 int offset = ((y>>3) * 8 *( _width >> 3 ) ) + ((x>>3) * 8) + ((y) & 0x07);
272 char * destBitmap = _dest +
offset;
273 char * destColormap = _dest + bitmapSize +
offset;
274 for(
int i=0; i<8; ++i ) {
275 *destBitmap = tile[i];
276 *destColormap = tile[i+8];
303 deploy( sprite, src_hw_tms9918_sprites_asm );
357 outline1(
"LD A, (%s)", _border_color );
417 outline1(
"LD A, (%s)", _background_color );
444 outline1(
"LD A, (%s)", _background_color );
468 outline1(
"LD (%s), A", _background_color );
503 outline1(
"LD A, (%s)", _common_color );
573static int rgbConverterFunction(
int _red,
int _green,
int _blue ) {
576 unsigned int minDistance = 0xffffffff;
584 for (j = 0; j <
sizeof(SYSTEM_PALETTE)/
sizeof(
RGBi); ++j) {
614 switch( _screen_mode->
id ) {
890 int startAddress = 0;
900 startAddress = 6 * 0x0400;
904 startAddress = 0x0e * 0x0400;
922 outline0(
"CALL CONSOLECALCULATE" );
995 deploy( tms9918vars, src_hw_tms9918_vars_asm);
996 deploy( tms9918varsGraphic, src_hw_tms9918_vars_graphic_asm );
1000 outline1(
"LD A, #$%2.2x", ( *_c & 0xff ) );
1006 outline1(
"LD A, $%2.2x", ( _y & 0xff ) );
1008 outline1(
"LD A, $%2.2x", ( _x & 0xff ) );
1010 outline1(
"LD A, $%2.2x", ( ( _x >> 8 ) & 0xff ) );
1033 deploy( tms9918vars, src_hw_tms9918_vars_asm);
1034 deploy( tms9918varsGraphic, src_hw_tms9918_vars_graphic_asm );
1060 deploy( tms9918vars, src_hw_tms9918_vars_asm);
1061 deploy( tms9918varsGraphic, src_hw_tms9918_vars_graphic_asm );
1145 deploy( sprite, src_hw_tms9918_sprites_asm );
1153 outline0(
"CALL SPRITEDATASETNMI2");
1163 deploy( sprite, src_hw_tms9918_sprites_asm );
1171 outline0(
"CALL SPRITEDATAFROMNMI2");
1180 deploy( sprite, src_hw_tms9918_sprites_asm );
1196 deploy( sprite, src_hw_tms9918_sprites_asm );
1203 outline0(
"CALL SPRITEDISABLENMI2");
1214 deploy( sprite, src_hw_tms9918_sprites_asm );
1234 deploy( sprite, src_hw_tms9918_sprites_asm );
1248 deploy( sprite, src_hw_tms9918_sprites_asm );
1262 deploy( sprite, src_hw_tms9918_sprites_asm );
1267 outline0(
"CALL SPRITECOMPRESSNMI2");
1276 deploy( sprite, src_hw_tms9918_sprites_asm );
1281 outline0(
"CALL SPRITECOMPRESSNMI2");
1299 deploy( sprite, src_hw_tms9918_sprites_asm );
1346 outline0(
"LD HL, (CURRENTWIDTH)" );
1360 outline0(
"LD HL, (CURRENTHEIGHT)" );
1368 deploy( clsGraphic, src_hw_tms9918_cls_graphic_asm );
1375 deploy( clsText, src_hw_tms9918_cls_text_asm );
1388 deploy( clsBox, src_hw_tms9918_cls_box_asm );
1407 if ( _direction > 0 ) {
1408 deploy( vScrollTextDown, src_hw_tms9918_vscroll_text_down_asm );
1415 deploy( vScrollTextUp, src_hw_tms9918_vscroll_text_up_asm );
1427 deploy( tms9918vars, src_hw_tms9918_vars_asm);
1428 deploy( vScrollTextUp, src_hw_tms9918_vscroll_text_up_asm );
1431 outline1(
"LD A, (%s)", _text_size);
1437 deploy( clsGraphic, src_hw_tms9918_cls_graphic_asm );
1438 deploy( tms9918varsGraphic, src_hw_tms9918_vars_graphic_asm );
1439 deploy( textEncodedAt, src_hw_tms9918_text_asm );
1440 deploy( textEncodedAtGraphicRaw, src_hw_tms9918_text_at_graphic_raw_asm );
1442 outline0(
"CALL TEXTATBITMAPMODERAW");
1444 outline0(
"CALL TEXTATBITMAPMODENMI2RAW");
1447 deploy( tms9918varsGraphic, src_hw_tms9918_vars_graphic_asm );
1448 deploy( clsText, src_hw_tms9918_cls_text_asm );
1449 #if defined(__sc3000__) || defined(__sg1000__) || defined(__msx1__) || defined(__coleco__)
1450 deploy( textEncodedAt, src_hw_tms9918_text_asm );
1452 deploy( textEncodedAtTextRaw, src_hw_tms9918_text_at_text_raw_asm );
1454 outline0(
"CALL TEXTATTILEMODERAW");
1456 outline0(
"CALL TEXTATTILEMODENMI2RAW");
1463 deploy( clsGraphic, src_hw_tms9918_cls_graphic_asm );
1464 deploy( tms9918varsGraphic, src_hw_tms9918_vars_graphic_asm );
1465 deploy( textEncodedAt, src_hw_tms9918_text_asm );
1466 deploy( textEncodedAtGraphic, src_hw_tms9918_text_at_graphic_asm );
1470 outline0(
"CALL TEXTATBITMAPMODENMI2");
1473 deploy( tms9918varsGraphic, src_hw_tms9918_vars_graphic_asm );
1474 deploy( clsText, src_hw_tms9918_cls_text_asm );
1475 #if defined(__sc3000__) || defined(__sg1000__) || defined(__msx1__) || defined(__coleco__)
1476 deploy( textEncodedAt, src_hw_tms9918_text_asm );
1478 deploy( textEncodedAtText, src_hw_tms9918_text_at_text_asm );
1482 outline0(
"CALL TEXTATTILEMODENMI2");
1493 deploy( tms9918vars, src_hw_tms9918_vars_asm );
1526 char defaultPalette[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
1687 deploy( clsText, src_hw_tms9918_cls_text_asm );
1695 copperList = copperList->
next;
1703 deploy( textHScroll, src_hw_tms9918_hscroll_text_asm );
1706 outline1(
"LD A, $%2.2x", ( _direction & 0xff ) );
1718 deploy( textHScroll, src_hw_tms9918_hscroll_text_asm );
1720 outline1(
"LD A, $%2.2x", ( _direction & 0xff ) );
1743 deploy( tms9918vars, src_hw_tms9918_vars_asm);
1753 if ( _characters ) {
1754 outline1(
"LD A, (%s)", _characters);
1762 deploy( textClineGraphic, src_hw_tms9918_cline_graphic_asm );
1769 deploy( textCline, src_hw_tms9918_cline_text_asm );
1785 return 3 + ( ( _width >> 3 ) * _height ) + ( ( _width >> 3 ) * ( _height ) );
1797static int calculate_images_size(
Environment * _environment,
int _frames,
int _width,
int _height,
int _mode ) {
1803 return 3 + ( 3 + ( ( _width >> 3 ) * _height ) + ( ( _width >> 3 ) * ( _height ) ) ) * _frames;
1815static int calculate_sequence_size(
Environment * _environment,
int _sequences,
int _frames,
int _width,
int _height,
int _mode ) {
1821 return 3 + ( ( 3 + ( ( _width >> 3 ) * _height ) + ( ( _width >> 3 ) * ( _height ) ) ) * _frames ) * _sequences;
1833static Variable * tms9918_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 ) {
1835 deploy( tms9918varsGraphic, src_hw_tms9918_vars_graphic_asm );
1838 (void)!_transparent_color;
1840 image_converter_asserts( _environment, _width, _height, _offset_x, _offset_y, &_frame_width, &_frame_height, 8, 8 );
1844 _width = ( ( ( _width - 1 ) / 8 ) - 1 ) * 8;
1846 if ( _frame_width % 8 ) {
1847 _frame_width = ( ( ( _frame_width - 1 ) / 8 ) - 1 ) * 8;
1852 if ( _height % 8 ) {
1853 _height = ( ( ( _height - 1 ) / 8 ) - 1 ) * 8;
1855 if ( _frame_height % 8 ) {
1856 _frame_height = ( ( ( _frame_height - 1 ) / 8 ) - 1 ) * 8;
1864 if (paletteColorCount > 16) {
1875 commonPalette =
palette_match( palette, paletteColorCount, SYSTEM_PALETTE,
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi) );
1880 adilinepalette(
"CPMS:%d", (
int)(
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi)), SYSTEM_PALETTE );
1890 char * buffer =
malloc ( bufferSize );
1891 memset( buffer, 0, bufferSize );
1894 int image_x, image_y;
1900 int offset, offsetc, bitmask;
1905 *(buffer) = (_frame_width & 0xff);
1906 *(buffer+1) = (_frame_width >> 8 ) & 0xff;
1907 *(buffer+2) = _frame_height;
1909 _source += ( ( _offset_y * _width ) + _offset_x ) * _depth;
1911 tms9918_image_converter_tiles( _environment, _source, buffer+3, _frame_width, _frame_height, _depth, _width );
1921 deploy( tms9918varsGraphic, src_hw_tms9918_vars_graphic_asm );
1929 if (colorUsed > 2) {
1965 int bufferSize = ( ( _width >> 3 ) * _height ) + 1;
1967 char * buffer =
malloc ( bufferSize );
1968 memset( buffer, 0, bufferSize );
1971 int image_x, image_y;
1984 int spriteWidth = 16;
1985 int spriteHeight = 16;
1987 char *
source = _source + ( ( _slot_y * spriteHeight * spriteWidth ) + _slot_x * spriteWidth ) * _depth;
1990 for (image_y = 0; image_y < spriteHeight; ++image_y) {
1991 if ( ( image_y + ( _slot_y * spriteHeight ) ) == _height ) {
1995 for (image_x = _slot_x * spriteWidth; image_x < ( _slot_x * spriteWidth ) + spriteWidth; ++image_x) {
1996 if ( ( image_x + ( _slot_x * spriteWidth ) ) == _width ) {
2015 offset = image_y * ( _width >> 4 ) + ( ( image_x & 0x07 ) >> 3 );
2016 if ( image_x > 7 ) {
2020 if ( rgb.
alpha < 255 ) {
2025 int minDistance = 0xffff;
2028 for(
int k=0; k<colorUsed; ++k ) {
2032 color = &palette[k];
2043 int minDistance = 0xffff;
2045 for(
int k=0; k<colorUsed; ++k ) {
2046 if ( palette[k].alpha < 255 )
continue;
2050 color = &palette[k];
2064 bitmask = ( colorIndex == 0 ? 0 : 1 ) << (7 - ((image_x & 0x7)));
2065 *(buffer +
offset) |= bitmask;
2071 source += _depth * ( _width - image_x );
2079 *(buffer + ( ( _width >> 3 ) * _height )) = _color->
index;
2081 *(buffer + ( ( _width >> 3 ) * _height )) = palette[1].index;
2092Variable *
tms9918_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 ) {
2098 return tms9918_image_converter_bitmap_mode_standard( _environment, _data, _width, _height, _depth, _offset_x, _offset_y, _frame_width, _frame_height, _transparent_color, _flags );
2109static void tms9918_load_image_address_to_other_register(
Environment * _environment,
char * _register,
char * _source,
char * _sequence,
char * _frame,
int _frame_size,
int _frame_count ) {
2116 if ( strlen(_sequence) == 0 ) {
2120 outline1(
"LD A, (%s)", _sequence );
2125 outline1(
"LD HL, OFFSETS%4.4x", _frame_size * _frame_count );
2137 if ( strlen(_frame) == 0 ) {
2146 outline1(
"LD HL, OFFSETS%4.4x", _frame_size * _frame_count );
2163 if ( strlen(_frame) == 0 ) {
2172 outline1(
"LD HL, OFFSETS%4.4x", _frame_size );
2187 outline1(
"LD (%s), HL", _register );
2192static void tms9918_load_image_address_to_register(
Environment * _environment,
char * _register,
Resource * _source,
char * _sequence,
char * _frame,
int _frame_size,
int _frame_count ) {
2200 if ( _frame_size ) {
2202 if ( !_sequence && !_frame ) {
2207 if ( strlen(_sequence) == 0 ) {
2210 outline1(
"LD A, (%s)", _sequence );
2216 if ( strlen(_frame) == 0 ) {
2231 if ( strlen(_frame) == 0 ) {
2248 outline1(
"LD (%s), HL", _register );
2254void tms9918_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 ) {
2256 deploy( tms9918vars, src_hw_tms9918_vars_asm);
2257 deploy( tms9918varsGraphic, src_hw_tms9918_vars_graphic_asm );
2258 deploy( blitimage, src_hw_tms9918_blit_image_asm );
2260 if ( _source_count > 2 ) {
2267 outline0(
"LD (BLITIMAGEBLITTINGADDR), HL");
2270 if ( _source_count > 0 ) {
2272 resource.
realName = strdup( _sources[0] );
2275 tms9918_load_image_address_to_register( _environment,
"BLITTMPPTR", &resource, _sequence, _frame, _frame_size, _frame_count );
2281 if ( _source_count > 1 ) {
2283 resource.
realName = strdup( _sources[0] );
2286 tms9918_load_image_address_to_register( _environment,
"BLITTMPPTR2", &resource, _sequence, _frame, _frame_size, _frame_count );
2289 outline0(
"LD (BLITTMPPTR2), HL" );
2315 deploy( tms9918vars, src_hw_tms9918_vars_asm);
2316 deploy( tms9918varsGraphic, src_hw_tms9918_vars_graphic_asm );
2317 deploy( putimage, src_hw_tms9918_put_image_asm );
2323 tms9918_load_image_address_to_register( _environment, NULL, _image, _sequence, _frame, _frame_size, _frame_count );
2344 deploy( tms9918varsGraphic, src_hw_tms9918_vars_graphic_asm );
2345 deploy( vbl, src_hw_tms9918_vbl_asm);
2353 deploy( tms9918varsGraphic, src_hw_tms9918_vars_graphic_asm );
2364 memset( buffer, 0,
size );
2366 *(buffer) = (_width & 0xff);
2367 *(buffer+1) = (_width>>8) & 0xff;
2368 *(buffer+2) = _height;
2379 deploy( tms9918varsGraphic, src_hw_tms9918_vars_graphic_asm );
2381 int size = calculate_images_size( _environment, _frames, _width, _height, _mode );
2391 memset( buffer, 0,
size );
2393 *(buffer) = _frames;
2394 *(buffer+1) = ( _width & 0xff );
2395 *(buffer+2) = ( _width >> 8 ) & 0xff;
2396 for(
int i=0; i<_frames; ++i ) {
2397 *(buffer+3+(i*frameSize)) = ( _width & 0xff );
2398 *(buffer+3+(i*frameSize)+1) = ( ( _width >> 8 ) & 0xff );
2399 *(buffer+3+(i*frameSize)+2) = ( _height & 0xff );
2413 deploy( tms9918varsGraphic, src_hw_tms9918_vars_graphic_asm );
2415 int size2 = calculate_sequence_size( _environment, _sequences, _frames, _width, _height, _mode );
2416 int size = calculate_images_size( _environment, _frames, _width, _height, _mode );
2425 char * buffer =
malloc ( size2 );
2426 memset( buffer, 0, size2 );
2428 *(buffer) = _frames;
2429 *(buffer+1) = _width;
2430 *(buffer+2) = _sequences;
2431 for(
int i=0; i<(_frames*_sequences); ++i ) {
2432 *(buffer+3+(i*frameSize)) = ( _width & 0xff );
2433 *(buffer+3+(i*frameSize)+1) = ( ( _width >> 8 ) & 0xff );
2434 *(buffer+3+(i*frameSize)+2) = ( _height & 0xff );
2439 result->
size = size2;
2446void tms9918_get_image(
Environment * _environment,
char * _image,
char * _x,
char * _y,
char * _frame,
char * _sequence,
int _frame_size,
int _frame_count,
int _palette ) {
2448 deploy( tms9918vars, src_hw_tms9918_vars_asm);
2449 deploy( tms9918varsGraphic, src_hw_tms9918_vars_graphic_asm );
2450 deploy( getimage, src_hw_tms9918_get_image_asm );
2454 tms9918_load_image_address_to_other_register( _environment, NULL, _image, _sequence, _frame, _frame_size, _frame_count );
2460 outline1(
"LD A, $%2.2x", _palette );
2474 deploy( vic2vars, src_hw_tms9918_vars_asm);
2476 deploy( textHScroll, src_hw_tms9918_hscroll_text_asm );
2477 deploy( vScrollTextDown, src_hw_tms9918_vscroll_text_down_asm );
2478 deploy( vScrollTextUp, src_hw_tms9918_vscroll_text_up_asm );
2480 outline1(
"LD A, $%2.2x", (
unsigned char)(_dx&0xff) );
2482 outline1(
"LD A, $%2.2x", (
unsigned char)(_dy&0xff) );
2490 deploy( tms9918vars, src_hw_tms9918_vars_asm);
2491 deploy( tiles, src_hw_tms9918_tiles_asm );
2519 deploy( tms9918vars, src_hw_tms9918_vars_asm);
2520 deploy( tiles, src_hw_tms9918_tiles_asm );
2561 deploy( tms9918vars, src_hw_tms9918_vars_asm);
2562 deploy( tiles, src_hw_tms9918_tiles_asm );
2593 deploy( tms9918vars, src_hw_tms9918_vars_asm);
2594 deploy( tiles, src_hw_tms9918_tiles_asm );
2614 deploy( tms9918vars, src_hw_tms9918_vars_asm);
2615 deploy( tiles, src_hw_tms9918_tiles_asm );
2666 outline1(
"LD A, (%s)", _foreground_color );
2672 outline1(
"LD A, (%s)", _background_color );
2694 deploy( tms9918vars, src_hw_tms9918_vars_asm);
2695 deploy( tms9918varsGraphic, src_hw_tms9918_vars_graphic_asm);
2696 deploy( duff, src_hw_z80_duff_asm );
2697 deploy( sliceimagecopy, src_hw_tms9918_slice_image_copy_asm );
2702 resource.realName = strdup( _image );
2704 tms9918_load_image_address_to_register( _environment, NULL, &resource, _sequence, _frame, _frame_size, _frame_count );
2706 outline1(
"LD DE, %s", _destination );
2714 deploy( tms9918vars, src_hw_tms9918_vars_asm);
2715 deploy( tms9918varsGraphic, src_hw_tms9918_vars_graphic_asm);
2716 deploy( duff, src_hw_z80_duff_asm );
2717 deploy( sliceimageextract, src_hw_tms9918_slice_image_extract_asm );
2722 resource.realName = strdup( _image );
2724 tms9918_load_image_address_to_register( _environment, NULL, &resource, _sequence, _frame, _frame_size, _frame_count );
2732 outline1(
"LD DE, %s", _destination );
2742 memcpy( _palette,
palette_match( _palette, paletteColorCount, SYSTEM_PALETTE,
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi) ), paletteColorCount *
sizeof(
RGBi ) );
2744 int uniquePaletteCount = 0;
2748 return uniquePaletteCount;
2754 if ( !_sequence && !_frame ) {
2762 if ( strlen(_sequence) == 0 ) {
2765 outline1(
"LD A, (%s)", _sequence );
2768 outline1(
"CALL fs%4.4Xoffsetsequence", _frame_count * _frame_size );
2771 if ( strlen(_frame) == 0 ) {
2777 outline1(
"CALL fs%4.4Xoffsetframe", _frame_size );
2786 if ( strlen(_frame) == 0 ) {
2792 outline1(
"CALL fs%4.4Xoffsetframe", _frame_size );
2826 deploy( screen, src_hw_tms9918_screen_asm);
void cpu_store_16bit(Environment *_environment, char *_destination, int _value)
CPU 6309: emit code to store 16 bit
void cpu_label(Environment *_environment, char *_label)
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_compare_and_branch_8bit_const(Environment *_environment, char *_source, int _destination, char *_label, int _positive)
CPU 6309: emit code to compare two 8 bit values and jump if they are equal/different
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.
int rgbi_equals_rgba(RGBi *_first, RGBi *_second)
int rgbi_equals_rgb(RGBi *_first, RGBi *_second)
Variable * variable_import(Environment *_environment, char *_name, VariableType _type, int _size_or_value)
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.
Variable * variable_store(Environment *_environment, char *_destination, unsigned int _value)
Store a direct value to a variable.
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
#define BITMAP_MODE_GRAPHIC2
Variable * distance(Environment *_environment, char *_x1, char *_y1, char *_x2, char *_y2)
Return the distance between two (screen) positions.
struct _CopperList * next
RgbConverterFunction currentRgbConverterFunction
VestigialConfig vestigialConfig
unsigned char * valueBuffer
RGBi originalPalette[MAX_PALETTE]
#define BITMAP_MODE_MULTICOLOR
void tms9918_cline(Environment *_environment, char *_characters)
void tms9918_finalization(Environment *_environment)
void tms9918_calculate_sequence_frame_offset(Environment *_environment, char *_offset, char *_sequence, char *_frame, int _frame_size, int _frame_count)
Variable * tms9918_new_images(Environment *_environment, int _frames, int _width, int _height, int _mode)
void tms9918_sprite_data_set(Environment *_environment, char *_sprite, char *_address)
void tms9918_sprite_multicolor(Environment *_environment, char *_sprite)
void tms9918_hit(Environment *_environment, char *_sprite_mask, char *_result)
TMS9918: emit code to check for collision
void tms9918_background_color(Environment *_environment, int _index, int _background_color)
TMS9918: emit code to change background color
Variable * tms9918_new_sequence(Environment *_environment, int _sequences, int _frames, int _width, int _height, int _mode)
void tms9918_background_color_vars(Environment *_environment, char *_index, char *_background_color)
TMS9918: emit code to change background color
Variable * tms9918_collision(Environment *_environment, char *_sprite)
TMS9918: emit code to check for collision
Variable * tms9918_sprite_converter(Environment *_environment, char *_source, int _width, int _height, int _depth, RGBi *_color, int _slot_x, int _slot_y)
void tms9918_background_color_get_vars(Environment *_environment, char *_index, char *_background_color)
TMS9918: emit code to retrieve background color
void tms9918_bitmap_disable(Environment *_environment)
void tms9918_sprite_common_color(Environment *_environment, char *_index, char *_common_color)
TMS9918: emit code to change common sprite's color
void tms9918_pset_int(Environment *_environment, int _x, int _y, int *_c)
void tms9918_use_tileset(Environment *_environment, char *_tileset)
void tms9918_text(Environment *_environment, char *_text, char *_text_size, int _raw)
void tms9918_screen(Environment *_environment, char *_x, char *_y, char *_c)
void tms9918_vertical_scroll(Environment *_environment, char *_displacement)
void tms9918_get_image(Environment *_environment, char *_image, char *_x, char *_y, char *_frame, char *_sequence, int _frame_size, int _frame_count, int _palette)
void tms9918_tiles_at(Environment *_environment, char *_address)
void tms9918_hscroll_line(Environment *_environment, int _direction, int _overlap)
void tms9918_move_video_memory(Environment *_environment, char *_from, char *_to, char *_size)
Variable * tms9918_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 tms9918_next_raster_at(Environment *_environment, char *_label, char *_positionlo, char *_positionhi)
TMS9918: emit code to wait for next raster irq at different position
void tms9918_get_width(Environment *_environment, char *_result)
void tms9918_slice_image_extract(Environment *_environment, char *_image, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_destination)
void tms9918_bitmap_enable(Environment *_environment, int _width, int _height, int _colors)
void tms9918_scroll_text(Environment *_environment, int _direction, int _overlap)
void tms9918_border_color(Environment *_environment, char *_border_color)
TMS9918: emit code to change border color
void tms9918_sprite_expand_vertical(Environment *_environment, char *_sprite)
void tms9918_sprite_compress_horizontal(Environment *_environment, char *_sprite)
void tms9918_pset_vars(Environment *_environment, char *_x, char *_y, char *_c)
void tms9918_tile_at(Environment *_environment, char *_x, char *_y, char *_result)
RGBi * tms9918_image_nearest_system_color(RGBi *_color)
void tms9918_slice_image(Environment *_environment, char *_image, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_destination)
void tms9918_get_height(Environment *_environment, char *_result)
void tms9918_pget_color_vars(Environment *_environment, char *_x, char *_y, char *_result)
void tms9918_screen_rows(Environment *_environment, char *_rows)
void tms9918_horizontal_scroll(Environment *_environment, char *_displacement)
void tms9918_move_memory_video(Environment *_environment, char *_from, char *_to, char *_size)
void tms9918_tiles_get(Environment *_environment, char *_result)
void tms9918_bitmap_at(Environment *_environment, char *_address)
void tms9918_cls(Environment *_environment)
void tms9918_raster_at(Environment *_environment, char *_label, char *_positionlo, char *_positionhi)
TMS9918: emit code to set raster irq
void tms9918_sprite_data_from(Environment *_environment, char *_sprite, char *_image)
void tms9918_colormap_at(Environment *_environment, char *_address)
void tms9918_sprite_color(Environment *_environment, char *_sprite, char *_color)
void console_calculate_vars(Environment *_environment)
void tms9918_cls_box(Environment *_environment, char *_x1, char *_y1, char *_w, char *_h)
void tms9918_screen_on(Environment *_environment)
int tms9918_palette_extract(Environment *_environment, char *_data, int _width, int _height, int _depth, int _flags, RGBi *_palette)
Variable * tms9918_get_raster_line(Environment *_environment)
void tms9918_flip_image(Environment *_environment, Resource *_image, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_direction)
void tms9918_bank_select(Environment *_environment, int _bank)
void tms9918_sprite_priority(Environment *_environment, char *_sprite, char *_priority)
void tms9918_background_color_semivars(Environment *_environment, int _index, char *_background_color)
TMS9918: emit code to change background color
void tms9918_next_raster(Environment *_environment)
TMS9918: emit code to wait for next raster irq
void tms9918_scroll(Environment *_environment, int _dx, int _dy)
Variable * tms9918_new_image(Environment *_environment, int _width, int _height, int _mode)
int tms9918_image_size(Environment *_environment, int _width, int _height, int _mode)
void tms9918_sprite_disable(Environment *_environment, char *_sprite)
void tms9918_move_tiles(Environment *_environment, char *_tile, char *_x, char *_y)
void tms9918_screen_off(Environment *_environment)
void tms9918_sprite_monocolor(Environment *_environment, char *_sprite)
void tms9918_put_tile(Environment *_environment, char *_tile, char *_x, char *_y)
void tms9918_screen_columns(Environment *_environment, char *_columns)
void tms9918_busy_wait(Environment *_environment, char *_timing)
void tms9918_colors_vars(Environment *_environment, char *_foreground_color, char *_background_color)
void tms9918_sprite_at(Environment *_environment, char *_sprite, char *_x, char *_y)
void tms9918_back(Environment *_environment)
int tms9918_screen_mode_enable(Environment *_environment, ScreenMode *_screen_mode)
void tms9918_sprite_expand_horizontal(Environment *_environment, char *_sprite)
void tms9918_slice_image_copy(Environment *_environment, char *_image, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_destination)
void tms9918_put_image(Environment *_environment, Resource *_image, char *_x, char *_y, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_flags)
void tms9918_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 tms9918_initialization(Environment *_environment)
void tms9918_hscroll_screen(Environment *_environment, int _direction, int _overlap)
void tms9918_textmap_at(Environment *_environment, char *_address)
void tms9918_tilemap_enable(Environment *_environment, int _width, int _height, int _colors, int _tile_width, int _tile_height)
void tms9918_wait_vbl(Environment *_environment)
void tms9918_sprite_enable(Environment *_environment, char *_sprite)
void console_calculate(Environment *_environment)
void tms9918_put_tiles(Environment *_environment, char *_tile, char *_x, char *_y, char *_w, char *_h)
void tms9918_sprite_compress_vertical(Environment *_environment, char *_sprite)
#define TILEMAP_MODE_GRAPHIC1
#define WVDP_RCOLORTABLE(v)
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 MAX_TEMPORARY_STORAGE
#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 WARNING_IMAGE_CONVERTER_UNSUPPORTED_MODE(f)
#define adilinepalette(s, c, p)
#define adilinebeginbitmap(s)
struct _CopperList CopperList
#define CRITICAL_NEW_IMAGE_UNSUPPORTED_MODE(f)
#define CRITICAL_BLIT_TOO_MUCH_SOURCES()